diff --git a/src/lib/navigation/completer/locationcompleterview.cpp b/src/lib/navigation/completer/locationcompleterview.cpp index 90f537f19..89ce2341c 100644 --- a/src/lib/navigation/completer/locationcompleterview.cpp +++ b/src/lib/navigation/completer/locationcompleterview.cpp @@ -18,6 +18,9 @@ #include "locationcompleterview.h" #include "locationcompletermodel.h" #include "locationcompleterdelegate.h" +#include "toolbutton.h" +#include "iconprovider.h" +#include "searchenginesdialog.h" #include #include @@ -57,6 +60,22 @@ LocationCompleterView::LocationCompleterView() m_delegate = new LocationCompleterDelegate(this); m_view->setItemDelegate(m_delegate); + + QWidget *searchWidget = new QWidget(this); + QHBoxLayout *searchLayout = new QHBoxLayout(searchWidget); + searchLayout->setContentsMargins(2, 2, 2, 2); + searchWidget->setLayout(searchLayout); + + ToolButton *searchSettingsButton = new ToolButton(this); + searchSettingsButton->setToolTip(tr("Manage Search Engines")); + searchSettingsButton->setAutoRaise(true); + searchSettingsButton->setIcon(IconProvider::settingsIcon()); + connect(searchSettingsButton, &ToolButton::clicked, this, &LocationCompleterView::openSearchEnginesDialog); + + searchLayout->addStretch(); + searchLayout->addWidget(searchSettingsButton); + + layout->addWidget(searchWidget); } QAbstractItemModel *LocationCompleterView::model() const @@ -325,3 +344,14 @@ void LocationCompleterView::close() emit closed(); } + +void LocationCompleterView::openSearchEnginesDialog() +{ + if (!m_searchDialog) { + m_searchDialog = new SearchEnginesDialog(this); + } + + m_searchDialog->open(); + m_searchDialog->raise(); + m_searchDialog->activateWindow(); +} diff --git a/src/lib/navigation/completer/locationcompleterview.h b/src/lib/navigation/completer/locationcompleterview.h index 6fcf33386..b5eb29329 100644 --- a/src/lib/navigation/completer/locationcompleterview.h +++ b/src/lib/navigation/completer/locationcompleterview.h @@ -18,10 +18,12 @@ #ifndef LOCATIONCOMPLETERVIEW_H #define LOCATIONCOMPLETERVIEW_H +#include #include #include "qzcommon.h" +class SearchEnginesDialog; class LocationCompleterDelegate; class FALKON_EXPORT LocationCompleterView : public QWidget @@ -56,10 +58,13 @@ public slots: void close(); private: + void openSearchEnginesDialog(); + bool m_ignoreNextMouseMove; QListView *m_view; LocationCompleterDelegate *m_delegate; + QPointer m_searchDialog; }; #endif // LOCATIONCOMPLETERVIEW_H