Skip to content

Commit

Permalink
Allow Search On Any Tab.
Browse files Browse the repository at this point in the history
With MultiZim, searching on library, settings, and blank tabs are reasonable.
  • Loading branch information
ShaopengLin committed Nov 3, 2024
1 parent 80743cb commit 7fe06f5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/searchbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);});
}
}

Expand Down

0 comments on commit 7fe06f5

Please sign in to comment.