From 338e9a092ba189dc8a75eca49724e1800749a855 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Mon, 1 Jul 2013 08:34:39 +0300 Subject: 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: Daniel Teske --- src/plugins/projectexplorer/settingsaccessor.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/plugins/projectexplorer/settingsaccessor.cpp b/src/plugins/projectexplorer/settingsaccessor.cpp index a4b774aaa7..923b1ba370 100644 --- a/src/plugins/projectexplorer/settingsaccessor.cpp +++ b/src/plugins/projectexplorer/settingsaccessor.cpp @@ -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 "

All settings files were either too new or too " "old to be read.

"), 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 { -- cgit v1.2.1