openHomePage code to standalone function

This commit is contained in:
sgourdas 2024-07-23 11:58:01 +03:00 committed by Kelson
parent a7c19105f9
commit 76bb8228ee
2 changed files with 8 additions and 5 deletions

View File

@ -41,11 +41,7 @@ TabBar::TabBar(QWidget *parent) :
this->closeTab(currentIndex());
});
connect(getAction(KiwixApp::OpenHomePageAction), &QAction::triggered,
this, [=]() {
auto current = this->currentWebView();
QUITIFNULL(current);
current->setUrl("zim://" + current->zimId() + ".zim/");
});
this, &TabBar::openHomePage);
connect(getAction(KiwixApp::SettingAction), &QAction::triggered,
this, &TabBar::openOrSwitchToSettingsTab);
@ -66,6 +62,12 @@ TabBar::TabBar(QWidget *parent) :
this, SLOT(onTabMoved(int,int)), Qt::DirectConnection);
}
void TabBar::openHomePage() {
auto current = this->currentWebView();
QUITIFNULL(current);
current->setUrl("zim://" + current->zimId() + ".zim/");
}
void TabBar::openOrSwitchToSettingsTab()
{
SettingsView* view = KiwixApp::instance()->getSettingsManager()->getView();

View File

@ -62,6 +62,7 @@ signals:
public slots:
void closeTab(int index);
void openHomePage();
void openOrSwitchToSettingsTab();
void fullScreenRequested(QWebEngineFullScreenRequest request);
void on_webview_titleChanged(const QString& title);