Skip to content

Commit 1d533a3

Browse files
committed
Allow Search On Any Tab.
With MultiZim, searching on library, settings, and blank tabs are reasonable.
1 parent 10f339e commit 1d533a3

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/searchbar.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,8 @@ void SearchBarLineEdit::updateCompletion()
228228
{
229229
mp_typingTimer->stop();
230230
clearSuggestions();
231-
WebView* current = KiwixApp::instance()->getTabWidget()->currentWebView();
232-
if (!current || current->url().isEmpty() || m_searchbarInput.isEmpty()) {
231+
const auto& multiZim = KiwixApp::instance()->getSearchBar().getMultiZimButton();
232+
if (multiZim.getZimIds().isEmpty() || m_searchbarInput.isEmpty()) {
233233
hideSuggestions();
234234
return;
235235
}
@@ -302,7 +302,9 @@ void SearchBarLineEdit::openCompletion(const QModelIndex &index)
302302
if (index.isValid())
303303
{
304304
const QUrl url = index.data(Qt::UserRole).toUrl();
305-
QTimer::singleShot(0, [=](){KiwixApp::instance()->openUrl(url, false);});
305+
const auto app = KiwixApp::instance();
306+
const bool newTab = app->getTabWidget()->currentWebView() == nullptr;
307+
QTimer::singleShot(0, [=](){KiwixApp::instance()->openUrl(url, newTab);});
306308
}
307309
}
308310

0 commit comments

Comments
 (0)