1
mirror of https://invent.kde.org/network/falkon.git synced 2024-09-21 17:52:10 +02:00

LocationCompleter: Properly close popup when showing search engines dialog

This commit is contained in:
David Rosca 2018-01-26 10:13:10 +01:00
parent 52076009e0
commit 3ec4d96f74
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8
4 changed files with 15 additions and 8 deletions

View File

@ -30,6 +30,7 @@
#include "qzsettings.h"
#include "opensearchengine.h"
#include "networkmanager.h"
#include "searchenginesdialog.h"
#include <QWindow>
@ -142,6 +143,7 @@ void LocationCompleter::slotPopupClosed()
disconnect(s_view, SIGNAL(indexShiftActivated(QModelIndex)), this, SLOT(indexShiftActivated(QModelIndex)));
disconnect(s_view, SIGNAL(indexDeleteRequested(QModelIndex)), this, SLOT(indexDeleteRequested(QModelIndex)));
disconnect(s_view, &LocationCompleterView::loadRequested, this, &LocationCompleter::loadRequested);
disconnect(s_view, &LocationCompleterView::searchEnginesDialogRequested, this, &LocationCompleter::openSearchEnginesDialog);
disconnect(s_view->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(currentChanged(QModelIndex)));
emit popupClosed();
@ -348,6 +350,15 @@ void LocationCompleter::loadRequest(const LoadRequest &request)
emit loadRequested(request);
}
void LocationCompleter::openSearchEnginesDialog()
{
// Clear locationbar
emit clearCompletion();
SearchEnginesDialog *dialog = new SearchEnginesDialog(m_window);
dialog->open();
}
void LocationCompleter::showPopup()
{
Q_ASSERT(m_window);
@ -376,6 +387,7 @@ void LocationCompleter::showPopup()
connect(s_view, SIGNAL(indexShiftActivated(QModelIndex)), this, SLOT(indexShiftActivated(QModelIndex)));
connect(s_view, SIGNAL(indexDeleteRequested(QModelIndex)), this, SLOT(indexDeleteRequested(QModelIndex)));
connect(s_view, &LocationCompleterView::loadRequested, this, &LocationCompleter::loadRequested);
connect(s_view, &LocationCompleterView::searchEnginesDialogRequested, this, &LocationCompleter::openSearchEnginesDialog);
connect(s_view->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(currentChanged(QModelIndex)));
s_view->createWinId();

View File

@ -70,6 +70,7 @@ private:
LoadRequest createLoadRequest(const QModelIndex &index);
void switchToTab(BrowserWindow* window, int tab);
void loadRequest(const LoadRequest &reqeust);
void openSearchEnginesDialog();
void showPopup();
void adjustPopupSize();

View File

@ -21,7 +21,6 @@
#include "toolbutton.h"
#include "iconprovider.h"
#include "mainapplication.h"
#include "searchenginesdialog.h"
#include "searchenginesmanager.h"
#include "loadrequest.h"
@ -73,7 +72,7 @@ LocationCompleterView::LocationCompleterView()
searchSettingsButton->setToolTip(tr("Manage Search Engines"));
searchSettingsButton->setAutoRaise(true);
searchSettingsButton->setIconSize(QSize(16, 16));
connect(searchSettingsButton, &ToolButton::clicked, this, &LocationCompleterView::openSearchEnginesDialog);
connect(searchSettingsButton, &ToolButton::clicked, this, &LocationCompleterView::searchEnginesDialogRequested);
QLabel *searchLabel = new QLabel(tr("Search with:"));
m_searchEnginesLayout = new QHBoxLayout();
@ -396,9 +395,3 @@ void LocationCompleterView::setupSearchEngines()
m_searchEnginesLayout->addWidget(button);
}
}
void LocationCompleterView::openSearchEnginesDialog()
{
SearchEnginesDialog *dialog = new SearchEnginesDialog(focusProxy());
dialog->open();
}

View File

@ -50,6 +50,7 @@ public:
signals:
void closed();
void searchEnginesDialogRequested();
void loadRequested(const LoadRequest &request);
void indexActivated(const QModelIndex &index);