Falkon Develop
Cross-platform Qt-based web browser
websearchbar.h
Go to the documentation of this file.
1/* ============================================================
2* Falkon - Qt web browser
3* Copyright (C) 2010-2014 David Rosca <nowrep@gmail.com>
4*
5* This program is free software: you can redistribute it and/or modify
6* it under the terms of the GNU General Public License as published by
7* the Free Software Foundation, either version 3 of the License, or
8* (at your option) any later version.
9*
10* This program is distributed in the hope that it will be useful,
11* but WITHOUT ANY WARRANTY; without even the implied warranty of
12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13* GNU General Public License for more details.
14*
15* You should have received a copy of the GNU General Public License
16* along with this program. If not, see <http://www.gnu.org/licenses/>.
17* ============================================================ */
18#ifndef WEBSEARCHBAR_H
19#define WEBSEARCHBAR_H
20
21#include <QPointer>
22
23#include "qzcommon.h"
24#include "lineedit.h"
25#include "buttonwithmenu.h"
27#include "clickablelabel.h"
28
29class QStringListModel;
30
31class BrowserWindow;
32class LineEdit;
33class ClickableLabel;
37
39{
40public:
41 explicit WebSearchBar_Button(QWidget* parent = nullptr);
42
43private:
44 void contextMenuEvent(QContextMenuEvent* event) override;
45};
46
48{
49 Q_OBJECT
50
51public:
52 explicit WebSearchBar(BrowserWindow* window);
53
54private Q_SLOTS:
55 void searchChanged(const ButtonWithMenu::Item &item);
56 void setupEngines();
57
58 void search();
59 void searchInNewTab();
60
61 void aboutToShowMenu();
62 void openSearchEnginesDialog();
63
64 void enableSearchSuggestions(bool enable);
65 void addSuggestions(const QStringList &list);
66
67 void addEngineFromAction();
68 void pasteAndGo();
69 void instantSearchChanged(bool);
70
71private:
72 void focusOutEvent(QFocusEvent* e) override;
73 void dropEvent(QDropEvent* event) override;
74 void keyPressEvent(QKeyEvent* event) override;
75
76 void contextMenuEvent(QContextMenuEvent* event) override;
77
78 void updateOpenSearchEngine();
79
80 QCompleter* m_completer;
81 QStringListModel* m_completerModel;
82
83 OpenSearchEngine* m_openSearchEngine;
84 SearchEngine m_activeEngine;
85
86 BrowserWindow* m_window;
87
88 WebSearchBar_Button* m_buttonSearch;
89 ButtonWithMenu* m_boxSearchType;
90 SearchEnginesManager* m_searchManager;
91 QPointer<SearchEnginesDialog> m_searchDialog;
92
93 bool m_reloadingEngines;
94};
95
96#endif // WEBSEARCHBAR_H
A class representing a single search engine described in OpenSearch format.
#define FALKON_EXPORT
Definition: qzcommon.h:28