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:
parent
2261ed4b79
commit
f824a81da3
|
@ -99,7 +99,7 @@ void ProfileUpdater::updateProfile(const QString ¤t, 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue
Block a user