1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

[Sessions] Last 2 sessions are now backuped in profile directory.

Closes #1100
This commit is contained in:
nowrep 2013-12-06 21:26:07 +01:00
parent 5a550eb853
commit d519a1253e
3 changed files with 26 additions and 0 deletions

View File

@ -17,6 +17,7 @@ Version 1.5.0
* cancel upload when trying to upload non-readable files * cancel upload when trying to upload non-readable files
* select previous / next engines with ctrl+up/down in websearchbar * select previous / next engines with ctrl+up/down in websearchbar
* ask user first before closing all but the current tab from tabbar * ask user first before closing all but the current tab from tabbar
* last 2 sessions are now backuped in profile directory
* GreaseMonkey: added icon in statusbar * GreaseMonkey: added icon in statusbar
* GreaseMonkey: added support for GM_Settings * GreaseMonkey: added support for GM_Settings
* GreaseMonkey: fixed userscripts when first loading plugin * GreaseMonkey: fixed userscripts when first loading plugin

View File

@ -289,6 +289,9 @@ MainApplication::MainApplication(int &argc, char** argv)
if (checkUpdates) { if (checkUpdates) {
new Updater(qupzilla); new Updater(qupzilla);
} }
backupSavedSessions();
if (m_startingAfterCrash || afterLaunch == 3) { if (m_startingAfterCrash || afterLaunch == 3) {
m_restoreManager = new RestoreManager(m_activeProfil + "session.dat"); m_restoreManager = new RestoreManager(m_activeProfil + "session.dat");
if (!m_restoreManager->isValid()) { if (!m_restoreManager->isValid()) {
@ -763,6 +766,27 @@ void MainApplication::translateApp()
installTranslator(sys); installTranslator(sys);
} }
void MainApplication::backupSavedSessions()
{
// session.dat - current
// session.dat.old - first backup
// session.dat.old1 - second backup
const QString sessionFile = m_activeProfil + "session.dat";
if (!QFile::exists(sessionFile)) {
return;
}
if (QFile::exists(sessionFile + ".old")) {
QFile::remove(sessionFile + ".old1");
QFile::copy(sessionFile + ".old", sessionFile + ".old1");
}
QFile::remove(sessionFile + ".old");
QFile::copy(sessionFile, sessionFile + ".old");
}
void MainApplication::quitApplication() void MainApplication::quitApplication()
{ {
if (m_downloadManager && !m_downloadManager->canClose()) { if (m_downloadManager && !m_downloadManager->canClose()) {

View File

@ -163,6 +163,7 @@ private:
void loadTheme(const QString &name); void loadTheme(const QString &name);
void translateApp(); void translateApp();
void restoreOtherWindows(); void restoreOtherWindows();
void backupSavedSessions();
QUrl userStyleSheet(const QString &filePath) const; QUrl userStyleSheet(const QString &filePath) const;