Saves settings tab for reopen

Settings tab is saved to be reopened on startup.
This commit is contained in:
ShaopengLin 2024-06-16 17:13:06 -04:00
parent 60cc7f1dde
commit 9bd598b00e
2 changed files with 6 additions and 1 deletions

View File

@ -207,7 +207,9 @@ void KiwixApp::restoreTabs()
{
for (const auto &zimUrl : tabsToOpen)
{
if (zimUrl.isEmpty())
if (zimUrl == "SettingsTab")
getTabWidget()->openOrSwitchToSettingsTab();
else if (zimUrl.isEmpty())
getTabWidget()->createNewTab(true, true);
else
openUrl(QUrl(zimUrl));

View File

@ -81,6 +81,7 @@ void TabBar::openOrSwitchToSettingsTab()
insertTab(index,QIcon(":/icons/settings.svg"), gt("settings"));
setCloseTabButton(index);
setCurrentIndex(index);
KiwixApp::instance()->saveListOfOpenTabs();
}
void TabBar::setStackedWidget(QStackedWidget *widget) {
@ -275,6 +276,8 @@ QStringList TabBar::getTabUrls() const {
{
if (ZimView* zv = qobject_cast<ZimView*>(mp_stackedWidget->widget(index)))
idList.push_back(zv->getWebView()->url().url());
else if (qobject_cast<SettingsView*>(mp_stackedWidget->widget(index)))
idList.push_back("SettingsTab");
}
return idList;
}