Skip to content

Commit 5922f38

Browse files
ShaopengLinkelson42
authored andcommitted
Allow Search On Any Tab.
With MultiZim, searching on library, settings, and blank tabs are reasonable.
1 parent 14d7cff commit 5922f38

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
@@ -237,8 +237,8 @@ void SearchBarLineEdit::updateCompletion()
237237
{
238238
mp_typingTimer->stop();
239239
clearSuggestions();
240-
WebView* current = KiwixApp::instance()->getTabWidget()->currentWebView();
241-
if (!current || current->url().isEmpty() || m_searchbarInput.isEmpty()) {
240+
const auto& multiZim = KiwixApp::instance()->getSearchBar().getMultiZimButton();
241+
if (multiZim.getZimIds().isEmpty() || m_searchbarInput.isEmpty()) {
242242
hideSuggestions();
243243
return;
244244
}
@@ -311,7 +311,9 @@ void SearchBarLineEdit::openCompletion(const QModelIndex &index)
311311
if (index.isValid())
312312
{
313313
const QUrl url = index.data(Qt::UserRole).toUrl();
314-
QTimer::singleShot(0, [=](){KiwixApp::instance()->openUrl(url, false);});
314+
const auto app = KiwixApp::instance();
315+
const bool newTab = app->getTabWidget()->currentWebView() == nullptr;
316+
QTimer::singleShot(0, [=](){KiwixApp::instance()->openUrl(url, newTab);});
315317
}
316318
}
317319

0 commit comments

Comments
 (0)