1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

[ProfileUpdater] Don't overwrite settings.ini on incompatible profile data

This commit is contained in:
nowrep 2014-02-04 23:03:21 +01:00
parent 2261ed4b79
commit f824a81da3
3 changed files with 10 additions and 4 deletions

View File

@ -99,7 +99,7 @@ void ProfileUpdater::updateProfile(const QString &current, const QString &profil
return;
}
std::cout << "QupZilla: Incompatible profile version detected, overwriting profile data..." << std::endl;
std::cout << "QupZilla: Incompatible profile version detected (" << qPrintable(prof.versionString()) << "), overwriting profile data..." << std::endl;
copyDataToProfile();
}
@ -112,11 +112,10 @@ void ProfileUpdater::copyDataToProfile()
QFile browseData(m_profilePath + "browsedata.db");
if (browseData.exists()) {
const QString browseDataBackup = QzTools::ensureUniqueFilename(m_profilePath + "browsedata-backup.db");
const QString settingsBackup = QzTools::ensureUniqueFilename(m_profilePath + "settings-backup.ini");
browseData.copy(browseDataBackup);
QFile(m_profilePath + "settings.ini").copy(settingsBackup);
const QString text = "Incompatible profile version has been detected. To avoid losing your profile data, they were "
"backed up in following directories:<br/><br/><b>" + browseDataBackup + "<br/>" + settingsBackup + "<br/></b>";
"backed up in following file:<br/><br/><b>" + browseDataBackup + "<br/></b>";
QMessageBox::warning(0, "QupZilla: Incompatible profile version", text);
}

View File

@ -106,6 +106,11 @@ bool Updater::Version::operator <=(const Updater::Version &other) const
return *this < other;
}
QString Updater::Version::versionString() const
{
return QString("%1.%2.%3").arg(majorVersion, minorVersion, revisionNumber);
}
Updater::Updater(QupZilla* mainClass, QObject* parent)
: QObject(parent)
, p_QupZilla(mainClass)

View File

@ -48,6 +48,8 @@ public:
bool operator==(const Version &other) const;
bool operator>=(const Version &other) const;
bool operator<=(const Version &other) const;
QString versionString() const;
};
private slots: