Skip to content
This repository has been archived by the owner on May 10, 2018. It is now read-only.

Commit

Permalink
Also backup settings.ini when incompatible profile is detected
Browse files Browse the repository at this point in the history
  • Loading branch information
nowrep committed Mar 30, 2016
1 parent fc17444 commit 5f84f29
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/lib/app/profilemanager.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2014 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2016 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -206,14 +206,20 @@ void ProfileManager::copyDataToProfile()
if (browseData.exists()) {
const QString browseDataBackup = QzTools::ensureUniqueFilename(profileDir.filePath(QLatin1String("browsedata-backup.db")));
browseData.copy(browseDataBackup);
browseData.remove();

QFile settings(profileDir.filePath(QSL("settings.ini")));
if (settings.exists()) {
const QString settingsBackup = QzTools::ensureUniqueFilename(profileDir.filePath(QSL("settings-backup.ini")));
settings.copy(settingsBackup);
settings.remove();
}

const QString text = "Incompatible profile version has been detected. To avoid losing your profile data, they were "
"backed up in following file:<br/><br/><b>" + browseDataBackup + "<br/></b>";
QMessageBox::warning(0, "QupZilla: Incompatible profile version", text);
}

browseData.remove();

QFile(QLatin1String(":data/browsedata.db")).copy(profileDir.filePath(QLatin1String("browsedata.db")));
QFile(profileDir.filePath(QLatin1String("browsedata.db"))).setPermissions(QFile::ReadUser | QFile::WriteUser);

Expand Down

0 comments on commit 5f84f29

Please sign in to comment.