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 authored and kelson42 committed Nov 4, 2024
1 parent 14d7cff commit 5922f38
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 @@ -237,8 +237,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 @@ -311,7 +311,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 5922f38

Please sign in to comment.