1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-14 02:52:12 +01:00

Searchbar: Fix show suggestions handling

Do not contact search engine when suggestions are disabled.

BUG: 439268

Signed-off-by: Juraj Oravec <jurajoravec@mailo.com>
This commit is contained in:
Juraj Oravec 2022-09-10 11:10:47 +02:00
parent feea129644
commit f5bbdf24e1
Signed by: SGOrava
GPG Key ID: 13660A3F1D9F093B
2 changed files with 15 additions and 2 deletions

View File

@ -156,6 +156,7 @@ void WebSearchBar::enableSearchSuggestions(bool enable)
qzSettings->showWSBSearchSuggestions = enable; qzSettings->showWSBSearchSuggestions = enable;
m_completerModel->setStringList(QStringList()); m_completerModel->setStringList(QStringList());
updateOpenSearchEngine();
} }
void WebSearchBar::setupEngines() void WebSearchBar::setupEngines()
@ -200,8 +201,7 @@ void WebSearchBar::searchChanged(const ButtonWithMenu::Item &item)
m_activeEngine = item.userData.value<SearchEngine>(); m_activeEngine = item.userData.value<SearchEngine>();
m_openSearchEngine->setSuggestionsUrl(m_activeEngine.suggestionsUrl); updateOpenSearchEngine();
m_openSearchEngine->setSuggestionsParameters(m_activeEngine.suggestionsParameters);
m_searchManager->setActiveEngine(m_activeEngine); m_searchManager->setActiveEngine(m_activeEngine);
@ -334,3 +334,14 @@ void WebSearchBar::keyPressEvent(QKeyEvent* event)
LineEdit::keyPressEvent(event); LineEdit::keyPressEvent(event);
} }
void WebSearchBar::updateOpenSearchEngine()
{
if (qzSettings->showWSBSearchSuggestions) {
m_openSearchEngine->setSuggestionsUrl(m_activeEngine.suggestionsUrl);
m_openSearchEngine->setSuggestionsParameters(m_activeEngine.suggestionsParameters);
}
else {
m_openSearchEngine->setSuggestionsUrl(QL1S(""));
}
}

View File

@ -75,6 +75,8 @@ private:
void contextMenuEvent(QContextMenuEvent* event) override; void contextMenuEvent(QContextMenuEvent* event) override;
void updateOpenSearchEngine();
QCompleter* m_completer; QCompleter* m_completer;
QStringListModel* m_completerModel; QStringListModel* m_completerModel;