mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-21 19:18:39 -04:00
Restores the previous current tab index on startup
Current tab index will be saved now and will be reset with respect to the reopened tabs upon startup
This commit is contained in:
parent
9bd598b00e
commit
65fe4b4997
@ -215,6 +215,9 @@ void KiwixApp::restoreTabs()
|
||||
openUrl(QUrl(zimUrl));
|
||||
}
|
||||
}
|
||||
|
||||
/* Restore current tab index. */
|
||||
getTabWidget()->setCurrentIndex(mp_session->value("currentTabIndex", 0).toInt());
|
||||
}
|
||||
|
||||
KiwixApp *KiwixApp::instance()
|
||||
@ -569,3 +572,8 @@ void KiwixApp::restoreWindowState()
|
||||
getMainWindow()->restoreGeometry(mp_session->value("geometry").toByteArray());
|
||||
getMainWindow()->restoreState(mp_session->value("windowState").toByteArray());
|
||||
}
|
||||
|
||||
void KiwixApp::saveCurrentTabIndex()
|
||||
{
|
||||
return mp_session->setValue("currentTabIndex", getTabWidget()->currentIndex());
|
||||
}
|
||||
|
@ -91,6 +91,7 @@ public:
|
||||
void saveListOfOpenTabs();
|
||||
void saveWindowState();
|
||||
void restoreWindowState();
|
||||
void saveCurrentTabIndex();
|
||||
|
||||
public slots:
|
||||
void newTab();
|
||||
|
@ -338,6 +338,8 @@ void TabBar::onCurrentChanged(int index)
|
||||
// In the future, other types of tabs can be added.
|
||||
// For example, About dialog, or Kiwix Server control panel.
|
||||
}
|
||||
|
||||
KiwixApp::instance()->saveCurrentTabIndex();
|
||||
}
|
||||
|
||||
void TabBar::fullScreenRequested(QWebEngineFullScreenRequest request)
|
||||
|
Loading…
x
Reference in New Issue
Block a user