mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 18:56:34 +01:00
LocationCompleterView: Add button to open search engine settings
Closes #2568
This commit is contained in:
parent
d443a69d8f
commit
b618323a5e
@ -18,6 +18,9 @@
|
||||
#include "locationcompleterview.h"
|
||||
#include "locationcompletermodel.h"
|
||||
#include "locationcompleterdelegate.h"
|
||||
#include "toolbutton.h"
|
||||
#include "iconprovider.h"
|
||||
#include "searchenginesdialog.h"
|
||||
|
||||
#include <QKeyEvent>
|
||||
#include <QApplication>
|
||||
@ -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();
|
||||
}
|
||||
|
@ -18,10 +18,12 @@
|
||||
#ifndef LOCATIONCOMPLETERVIEW_H
|
||||
#define LOCATIONCOMPLETERVIEW_H
|
||||
|
||||
#include <QPointer>
|
||||
#include <QListView>
|
||||
|
||||
#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<SearchEnginesDialog> m_searchDialog;
|
||||
};
|
||||
|
||||
#endif // LOCATIONCOMPLETERVIEW_H
|
||||
|
Loading…
Reference in New Issue
Block a user