@@ -27,11 +27,11 @@ namespace OCC {
2727
2828Q_LOGGING_CATEGORY (lcMigration, " nextcloud.settings.migration" , QtInfoMsg)
2929
30- Migration::MigrationPhase Migration::_migrationPhase = MigrationPhase ::NotStarted;;
31- Migration::MigrationType Migration::_migrationType = MigrationType ::UnbrandedToUnbranded;
32- Migration::VersionChangeType Migration::_versionChangeType = VersionChangeType::NoVersionChange ;
30+ Migration::Phase Migration::_phase = Phase ::NotStarted;;
31+ Migration::BrandingType Migration::_brandingType = BrandingType ::UnbrandedToUnbranded;
32+ Migration::UpgradeType Migration::_upgradeType = UpgradeType::NoChange ;
3333QString Migration::_discoveredLegacyConfigPath = {};
34- Migration::LegacyData Migration::_configSettings = {};
34+ Migration::LegacyData Migration::_legacyData = {};
3535
3636QVersionNumber Migration::currentVersion () const
3737{
@@ -48,77 +48,77 @@ QVersionNumber Migration::configVersion() const
4848 return QVersionNumber::fromString (ConfigFile ().clientVersionString ());
4949}
5050
51- void Migration::setMigrationPhase (const MigrationPhase phase)
51+ void Migration::setPhase (const Phase phase)
5252{
5353 // do not rollback
54- if (phase > _migrationPhase ) {
55- _migrationPhase = phase;
54+ if (phase > _phase ) {
55+ _phase = phase;
5656 }
5757}
5858
59- Migration::MigrationPhase Migration::migrationPhase () const
59+ Migration::Phase Migration::phase () const
6060{
61- return _migrationPhase ;
61+ return _phase ;
6262}
6363
64- void Migration::setMigrationType (const MigrationType type)
64+ void Migration::setBrandingType (const BrandingType type)
6565{
66- _migrationType = type;
66+ _brandingType = type;
6767}
6868
69- Migration::MigrationType Migration::migrationType () const
69+ Migration::BrandingType Migration::brandingType () const
7070{
71- return _migrationType ;
71+ return _brandingType ;
7272}
7373
74- Migration::VersionChangeType Migration::versionChangeType () const
74+ Migration::UpgradeType Migration::upgradeType () const
7575{
76- return _versionChangeType ;
76+ return _upgradeType ;
7777}
7878
79- void Migration::setVersionChangeType (const VersionChangeType type)
79+ void Migration::setUpgradeType (const UpgradeType type)
8080{
81- _versionChangeType = type;
81+ _upgradeType = type;
8282}
8383
8484bool Migration::isUpgrade ()
8585{
8686 const auto isUpgrade = currentVersion () > previousVersion ();
8787 if (isUpgrade) {
88- setVersionChangeType (VersionChangeType ::Upgrade);
88+ setUpgradeType (UpgradeType ::Upgrade);
8989 }
90- return versionChangeType () == VersionChangeType ::Upgrade;
90+ return _upgradeType == UpgradeType ::Upgrade;
9191}
9292
9393bool Migration::isDowngrade ()
9494{
9595 const auto isDowngrade = previousVersion () > currentVersion ();
9696 if (isDowngrade) {
97- setVersionChangeType (VersionChangeType ::Downgrade);
97+ setUpgradeType (UpgradeType ::Downgrade);
9898 }
99- return versionChangeType () == VersionChangeType ::Downgrade;
99+ return _upgradeType == UpgradeType ::Downgrade;
100100}
101101
102102bool Migration::versionChanged ()
103103{
104104 return isUpgrade () || isDowngrade ();
105105}
106106
107- bool Migration::shouldTryUnbrandedToBrandedMigration () const
107+ bool Migration::shouldTryUnbrandedToBrandedMigration ()
108108{
109- const auto isUnbrandedToBranded = migrationPhase () == Migration::MigrationPhase ::SetupFolders
109+ const auto isUnbrandedToBranded = phase () == Migration::Phase ::SetupFolders
110110 && Theme::instance ()->appName () != ConfigFile::unbrandedAppName
111111 && !_discoveredLegacyConfigPath.isEmpty ();
112112
113113 if (isUnbrandedToBranded) {
114- Migration (). setMigrationType (MigrationType ::UnbrandedToBranded);
114+ setBrandingType (BrandingType ::UnbrandedToBranded);
115115 }
116- return migrationType () == MigrationType ::UnbrandedToBranded;
116+ return _brandingType == BrandingType ::UnbrandedToBranded;
117117}
118118
119119bool Migration::isUnbrandedToBrandedMigration () const
120120{
121- return isInProgress () && migrationType () == MigrationType ::UnbrandedToBranded;
121+ return isInProgress () && brandingType () == BrandingType ::UnbrandedToBranded;
122122}
123123
124124bool Migration::shouldTryToMigrate ()
@@ -136,9 +136,9 @@ bool Migration::isClientVersionSet() const
136136
137137bool Migration::isInProgress () const
138138{
139- const auto currentPhase = migrationPhase ();
140- return currentPhase != MigrationPhase ::NotStarted
141- && currentPhase != MigrationPhase ::Done;
139+ const auto currentPhase = phase ();
140+ return currentPhase != Phase ::NotStarted
141+ && currentPhase != Phase ::Done;
142142}
143143
144144Migration::LegacyData Migration::legacyData () const
@@ -195,8 +195,7 @@ Migration::LegacyData Migration::legacyData() const
195195 qCInfo (lcMigration) << " Copy settings" << oCSettings->allKeys ().join (" , " );
196196 Migration migration;
197197 migration.setDiscoveredLegacyConfigPath (configFileInfo.canonicalPath ());
198- legacyData.configFile = configFileString;
199- legacyData.settings .create (oCSettings.release ());
198+ legacyData.reset (oCSettings.get ());
200199 migration.setLegacyData (legacyData);
201200 break ;
202201 } else {
@@ -222,10 +221,9 @@ void Migration::setDiscoveredLegacyConfigPath(const QString &discoveredLegacyCon
222221 _discoveredLegacyConfigPath = discoveredLegacyConfigPath;
223222}
224223
225- void Migration::setLegacyData (const LegacyData &LegacyData )
224+ void Migration::setLegacyData (const LegacyData legacyData )
226225{
227- _configSettings.configFile = LegacyData.configFile ;
228- _configSettings.settings = LegacyData.settings ;
226+ _legacyData = legacyData;
229227}
230228
231229}
0 commit comments