Commit a5368b3b authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

SettingsAccessor: Upgrade both user and shared maps to latest version

Since the merge itself requires the user sticky settings to be
transformed, it must be done before merging.

Change-Id: I7a2c8b7e8c01412b21a156e24d54780f9dce8bbf
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent ac24fd02
...@@ -675,7 +675,7 @@ bool SettingsAccessor::isBetterMatch(const QVariantMap &origData, const QVariant ...@@ -675,7 +675,7 @@ bool SettingsAccessor::isBetterMatch(const QVariantMap &origData, const QVariant
* *
* Returns settings of the requested version. * Returns settings of the requested version.
*/ */
QVariantMap SettingsAccessor::upgradeSettings(const QVariantMap &data, int toVersion) const QVariantMap SettingsAccessor::upgradeSettings(const QVariantMap &data) const
{ {
const int version = versionFromMap(data); const int version = versionFromMap(data);
...@@ -688,14 +688,8 @@ QVariantMap SettingsAccessor::upgradeSettings(const QVariantMap &data, int toVer ...@@ -688,14 +688,8 @@ QVariantMap SettingsAccessor::upgradeSettings(const QVariantMap &data, int toVer
else else
result = data; result = data;
if (version < 15 && toVersion < 15) { const int toVersion = currentVersion();
result.insert(QLatin1String(USER_STICKY_KEYS_KEY), if (version >= toVersion || version < d->firstVersion())
data.value(QLatin1String("ProjectExplorer.Project.UserStickyKeys")));
}
if (version >= toVersion
|| version < d->firstVersion()
|| toVersion > d->currentVersion())
return result; return result;
for (int i = version; i < toVersion; ++i) { for (int i = version; i < toVersion; ++i) {
...@@ -1064,8 +1058,8 @@ QVariantMap SettingsAccessor::mergeSettings(const QVariantMap &userMap, ...@@ -1064,8 +1058,8 @@ QVariantMap SettingsAccessor::mergeSettings(const QVariantMap &userMap,
QVariantMap newShared = sharedMap; QVariantMap newShared = sharedMap;
QVariantMap result; QVariantMap result;
if (!newUser.isEmpty() && !newShared.isEmpty()) { if (!newUser.isEmpty() && !newShared.isEmpty()) {
newUser = upgradeSettings(newUser, versionFromMap(newShared)); newUser = upgradeSettings(newUser);
newShared = upgradeSettings(newShared, versionFromMap(newUser)); newShared = upgradeSettings(newShared);
result = mergeSharedSettings(newUser, newShared); result = mergeSharedSettings(newUser, newShared);
} else if (!sharedMap.isEmpty()) { } else if (!sharedMap.isEmpty()) {
result = sharedMap; result = sharedMap;
...@@ -1076,7 +1070,7 @@ QVariantMap SettingsAccessor::mergeSettings(const QVariantMap &userMap, ...@@ -1076,7 +1070,7 @@ QVariantMap SettingsAccessor::mergeSettings(const QVariantMap &userMap,
m_project->setProperty(SHARED_SETTINGS, newShared); m_project->setProperty(SHARED_SETTINGS, newShared);
// Update from the base version to Creator's version. // Update from the base version to Creator's version.
return upgradeSettings(result, currentVersion()); return upgradeSettings(result);
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
......
...@@ -105,7 +105,7 @@ public: ...@@ -105,7 +105,7 @@ public:
protected: protected:
QVariantMap readFile(const Utils::FileName &path) const; QVariantMap readFile(const Utils::FileName &path) const;
QVariantMap upgradeSettings(const QVariantMap &data, int toVersion) const; QVariantMap upgradeSettings(const QVariantMap &data) const;
ProceedInfo reportIssues(const QVariantMap &data, const Utils::FileName &path, QWidget *parent) const; ProceedInfo reportIssues(const QVariantMap &data, const Utils::FileName &path, QWidget *parent) const;
......
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