Merge pull request #569 from HanYoung-uwu/master

This commit is contained in:
Matthieu Gautier 2021-01-06 17:07:22 +01:00 committed by GitHub
commit 79366c01af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -14,6 +14,8 @@ void SuggestionListWorker::run()
QVector<QUrl> urlList;
auto currentWidget = KiwixApp::instance()->getTabWidget()->currentWebView();
if(!currentWidget)
return;
auto qurl = currentWidget->url();
auto currentZimId = qurl.host().split(".")[0];
auto reader = KiwixApp::instance()->getLibrary()->getReader(currentZimId);

View File

@ -25,7 +25,8 @@ public:
ZimView* createNewTab(bool setCurrent);
ZimView* widget(int index) { return (index != 0) ? static_cast<ZimView*>(mp_stackedWidget->widget(index)) : nullptr; }
WebView* currentWebView() { auto current = mp_stackedWidget->currentWidget();
if (mp_stackedWidget->currentIndex() == 0) return nullptr;
if (mp_stackedWidget->currentIndex() == 0 ||
mp_stackedWidget->currentIndex() == m_settingsIndex) return nullptr;
return static_cast<ZimView*>(current)->getWebView();
}
ZimView* currentWidget() { auto current = mp_stackedWidget->currentWidget();