Verified Commit f5350dbe authored by Juraj Oravec's avatar Juraj Oravec
Browse files

Searchbar: Fix show suggestions handling

Do not contact search engine when suggestions are disabled.

BUG: 439268



Signed-off-by: Juraj Oravec's avatarJuraj Oravec <jurajoravec@mailo.com>
parent bdfeff5b
......@@ -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(""));
}
}
......@@ -75,6 +75,8 @@ private:
void contextMenuEvent(QContextMenuEvent* event) override;
void updateOpenSearchEngine();
QCompleter* m_completer;
QStringListModel* m_completerModel;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment