1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +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 bdfeff5b08
commit f5350dbe41
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;
m_completerModel->setStringList(QStringList());
updateOpenSearchEngine();
}
void WebSearchBar::setupEngines()
@ -200,8 +201,7 @@ void WebSearchBar::searchChanged(const ButtonWithMenu::Item &item)
m_activeEngine = item.userData.value<SearchEngine>();
m_openSearchEngine->setSuggestionsUrl(m_activeEngine.suggestionsUrl);
m_openSearchEngine->setSuggestionsParameters(m_activeEngine.suggestionsParameters);
updateOpenSearchEngine();
m_searchManager->setActiveEngine(m_activeEngine);
@ -334,3 +334,14 @@ void WebSearchBar::keyPressEvent(QKeyEvent* 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 updateOpenSearchEngine();
QCompleter* m_completer;
QStringListModel* m_completerModel;