diff --git a/src/searchbar.cpp b/src/searchbar.cpp index fdf835242..54d0070f9 100644 --- a/src/searchbar.cpp +++ b/src/searchbar.cpp @@ -228,8 +228,8 @@ void SearchBarLineEdit::updateCompletion() { mp_typingTimer->stop(); clearSuggestions(); - WebView* current = KiwixApp::instance()->getTabWidget()->currentWebView(); - if (!current || current->url().isEmpty() || m_searchbarInput.isEmpty()) { + const auto& multiZim = KiwixApp::instance()->getSearchBar().getMultiZimButton(); + if (multiZim.getZimIds().isEmpty() || m_searchbarInput.isEmpty()) { hideSuggestions(); return; } @@ -302,7 +302,9 @@ void SearchBarLineEdit::openCompletion(const QModelIndex &index) if (index.isValid()) { const QUrl url = index.data(Qt::UserRole).toUrl(); - QTimer::singleShot(0, [=](){KiwixApp::instance()->openUrl(url, false);}); + const auto app = KiwixApp::instance(); + const bool newTab = app->getTabWidget()->currentWebView() == nullptr; + QTimer::singleShot(0, [=](){KiwixApp::instance()->openUrl(url, newTab);}); } }