From 04a16a5946c58cadcadfe2e92f718610361e970f Mon Sep 17 00:00:00 2001 From: Camila Ayres Date: Tue, 10 Dec 2024 17:40:08 +0100 Subject: [PATCH 1/2] Include Nextcloud in the search for legacy config when the client is branded. Signed-off-by: Camila Ayres --- src/gui/accountmanager.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/gui/accountmanager.cpp b/src/gui/accountmanager.cpp index 6619e70fee725..a661f3eb3f253 100644 --- a/src/gui/accountmanager.cpp +++ b/src/gui/accountmanager.cpp @@ -73,6 +73,9 @@ constexpr auto networkProxyPasswordKeychainKeySuffixC = "_proxy_password"; constexpr auto legacyRelativeConfigLocationC = "/ownCloud/owncloud.cfg"; constexpr auto legacyCfgFileNameC = "owncloud.cfg"; +constexpr auto unbrandedRelativeConfigLocationC = "/Nextcloud/nextcloud.cfg"; +constexpr auto unbrandedCfgFileNameC = "nextcloud.cfg"; + // The maximum versions that this client can read constexpr auto maxAccountsVersion = 2; constexpr auto maxAccountVersion = 1; @@ -192,10 +195,16 @@ bool AccountManager::restoreFromLegacySettings() const auto legacyCfgFileNamePath = QString(QStringLiteral("/") + legacyCfgFileNameC); const auto legacyCfgFileRelativePath = QString(legacyRelativeConfigLocationC); - const auto legacyLocations = QVector{legacy2_4CfgFileParentFolder + legacyCfgFileRelativePath, - legacy2_5CfgFileParentFolder + legacyCfgFileRelativePath, - legacyCfgFileParentFolder + legacyCfgFileNamePath, - legacyCfgFileGrandParentFolder + legacyCfgFileRelativePath}; + auto legacyLocations = QVector{legacy2_4CfgFileParentFolder + legacyCfgFileRelativePath, + legacy2_5CfgFileParentFolder + legacyCfgFileRelativePath, + legacyCfgFileParentFolder + legacyCfgFileNamePath, + legacyCfgFileGrandParentFolder + legacyCfgFileRelativePath}; + + if (Theme::instance()->isBranded()) { + const auto unbrandedCfgFileNamePath = QString(QStringLiteral("/") + unbrandedCfgFileNameC); + const auto unbrandedCfgFileRelativePath = QString(unbrandedRelativeConfigLocationC); + legacyLocations.append({legacyCfgFileParentFolder + unbrandedCfgFileNamePath, legacyCfgFileGrandParentFolder + unbrandedCfgFileRelativePath}); + } for (const auto &configFile : legacyLocations) { auto oCSettings = std::make_unique(configFile, QSettings::IniFormat); From b095670635ea380e621ca15a12b10340a7330e4d Mon Sep 17 00:00:00 2001 From: Camila Ayres Date: Tue, 10 Dec 2024 18:30:15 +0100 Subject: [PATCH 2/2] Do not display any notification when import was successful, only log it. Signed-off-by: Camila Ayres --- src/gui/application.cpp | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/src/gui/application.cpp b/src/gui/application.cpp index 4b2f600afdaf7..1bf8cffea81ef 100644 --- a/src/gui/application.cpp +++ b/src/gui/application.cpp @@ -484,23 +484,31 @@ void Application::setupAccountsAndFolders() if (const auto accounts = AccountManager::instance()->accounts(); accountsRestoreResult == AccountManager::AccountsRestoreSuccessFromLegacyVersion && !accounts.isEmpty()) { + const auto accountsListSize = accounts.size(); - const auto accountsRestoreMessage = accountsListSize > 1 - ? tr("%1 accounts", "number of accounts imported").arg(QString::number(accountsListSize)) - : tr("1 account"); - const auto foldersRestoreMessage = foldersListSize > 1 - ? tr("%1 folders", "number of folders imported").arg(QString::number(foldersListSize)) - : tr("1 folder"); - const auto messageBox = new QMessageBox(QMessageBox::Information, - tr("Legacy import"), - tr("Imported %1 and %2 from a legacy desktop client.\n%3", - "number of accounts and folders imported. list of users.") - .arg(accountsRestoreMessage, - foldersRestoreMessage, - prettyNamesList(accounts)) - ); - messageBox->setWindowModality(Qt::NonModal); - messageBox->open(); + if (Theme::instance()->displayLegacyImportDialog()) { + const auto accountsRestoreMessage = accountsListSize > 1 + ? tr("%1 accounts", "number of accounts imported").arg(QString::number(accountsListSize)) + : tr("1 account"); + const auto foldersRestoreMessage = foldersListSize > 1 + ? tr("%1 folders", "number of folders imported").arg(QString::number(foldersListSize)) + : tr("1 folder"); + const auto messageBox = new QMessageBox(QMessageBox::Information, + tr("Legacy import"), + tr("Imported %1 and %2 from a legacy desktop client.\n%3", + "number of accounts and folders imported. list of users.") + .arg(accountsRestoreMessage, + foldersRestoreMessage, + prettyNamesList(accounts)) + ); + messageBox->setWindowModality(Qt::NonModal); + messageBox->open(); + } + + qCWarning(lcApplication) << "Migration result AccountManager::AccountsRestoreResult:" << accountsRestoreResult; + qCWarning(lcApplication) << "Folders migrated: " << foldersListSize; + qCWarning(lcApplication) << accountsListSize << "account(s) were migrated:" << prettyNamesList(accounts); + } else { qCWarning(lcApplication) << "Migration result AccountManager::AccountsRestoreResult: " << accountsRestoreResult; qCWarning(lcApplication) << "Folders migrated: " << foldersListSize;