Commit 338e9a09 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

SettingsAccessor: Fix empty environmentId handling

* Empty environment should be ignored when comparing to current one
* Fixes superfluous warning when opening a .user file without environmentId

Change-Id: Iaf3f71eb2dd2a2a10faa1f6f9fe9e9154fe1ab1f
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
parent 62554e76
......@@ -734,7 +734,7 @@ void SettingsAccessor::backupUserFile() const
// Do we need to do a backup?
const QString origName = oldSettings.fileName().toString();
QString backupName = origName;
if (oldSettings.environmentId() != creatorId())
if (!oldSettings.environmentId().isEmpty() && oldSettings.environmentId() != creatorId())
backupName += QLatin1String(".") + QString::fromLatin1(oldSettings.environmentId()).mid(1, 7);
if (oldSettings.version() != currentVersion()) {
if (m_handlers.contains(oldSettings.version()))
......@@ -774,7 +774,7 @@ SettingsAccessor::SettingsData SettingsAccessor::readUserSettings() const
"<p>All settings files were either too new or too "
"old to be read.</p>"),
QMessageBox::Ok);
} else if (result.environmentId() != creatorId()) {
} else if (!result.environmentId().isEmpty() && result.environmentId() != creatorId()) {
// Wrong environment!
QMessageBox msgBox(
QMessageBox::Question,
......@@ -873,7 +873,7 @@ SettingsAccessor::SettingsData SettingsAccessor::findBestSettings(const QStringL
continue;
}
if (!tmp.environmentId().isEmpty() && tmp.environmentId() == creatorId()) {
if (tmp.environmentId().isEmpty() || tmp.environmentId() == creatorId()) {
if (tmp.version() > newestMatching.version())
newestMatching = tmp;
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment