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
*
* 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);
......@@ -688,14 +688,8 @@ QVariantMap SettingsAccessor::upgradeSettings(const QVariantMap &data, int toVer
else
result = data;
if (version < 15 && toVersion < 15) {
result.insert(QLatin1String(USER_STICKY_KEYS_KEY),
data.value(QLatin1String("ProjectExplorer.Project.UserStickyKeys")));
}
if (version >= toVersion
|| version < d->firstVersion()
|| toVersion > d->currentVersion())
const int toVersion = currentVersion();
if (version >= toVersion || version < d->firstVersion())
return result;
for (int i = version; i < toVersion; ++i) {
......@@ -1064,8 +1058,8 @@ QVariantMap SettingsAccessor::mergeSettings(const QVariantMap &userMap,
QVariantMap newShared = sharedMap;
QVariantMap result;
if (!newUser.isEmpty() && !newShared.isEmpty()) {
newUser = upgradeSettings(newUser, versionFromMap(newShared));
newShared = upgradeSettings(newShared, versionFromMap(newUser));
newUser = upgradeSettings(newUser);
newShared = upgradeSettings(newShared);
result = mergeSharedSettings(newUser, newShared);
} else if (!sharedMap.isEmpty()) {
result = sharedMap;
......@@ -1076,7 +1070,7 @@ QVariantMap SettingsAccessor::mergeSettings(const QVariantMap &userMap,
m_project->setProperty(SHARED_SETTINGS, newShared);
// Update from the base version to Creator's version.
return upgradeSettings(result, currentVersion());
return upgradeSettings(result);
}
// -------------------------------------------------------------------------
......
......@@ -105,7 +105,7 @@ public:
protected:
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;
......
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