mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
Merge pull request #8633 from Rello/codex/add-cmake-option-to-disable-account-migration
Add CMake option to disable account migration
This commit is contained in:
commit
a382a00b47
@ -63,6 +63,7 @@ else()
|
||||
endif()
|
||||
|
||||
option( APPLICATION_DISPLAY_LEGACY_IMPORT_DIALOG "Display legacy import dialog" ON )
|
||||
option( DISABLE_ACCOUNT_MIGRATION "Exclude legacy account migration and import" OFF )
|
||||
|
||||
# For usage in XML files we preprocess
|
||||
string(REPLACE "&" "&" APPLICATION_NAME_XML_ESCAPED "${APPLICATION_NAME}")
|
||||
|
||||
@ -38,6 +38,7 @@
|
||||
#cmakedefine DO_NOT_USE_PROXY "@DO_NOT_USE_PROXY@"
|
||||
#cmakedefine ENFORCE_SINGLE_ACCOUNT "@ENFORCE_SINGLE_ACCOUNT@"
|
||||
#cmakedefine01 APPLICATION_DISPLAY_LEGACY_IMPORT_DIALOG
|
||||
#cmakedefine01 DISABLE_ACCOUNT_MIGRATION
|
||||
|
||||
#cmakedefine ZLIB_FOUND @ZLIB_FOUND@
|
||||
|
||||
|
||||
@ -153,8 +153,6 @@ set(client_SRCS
|
||||
userinfo.cpp
|
||||
vfsdownloaderrordialog.h
|
||||
vfsdownloaderrordialog.cpp
|
||||
legacyaccountselectiondialog.h
|
||||
legacyaccountselectiondialog.cpp
|
||||
accountstate.h
|
||||
accountstate.cpp
|
||||
addcertificatedialog.h
|
||||
@ -258,6 +256,13 @@ set(client_SRCS
|
||||
wizard/linklabel.cpp
|
||||
)
|
||||
|
||||
if (NOT DISABLE_ACCOUNT_MIGRATION)
|
||||
list(APPEND client_SRCS
|
||||
legacyaccountselectiondialog.h
|
||||
legacyaccountselectiondialog.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
if (WITH_WEBENGINE)
|
||||
list(APPEND client_SRCS
|
||||
wizard/webviewpage.h
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
|
||||
#include "accountmanager.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "sslerrordialog.h"
|
||||
#include "proxyauthhandler.h"
|
||||
#include "creds/credentialsfactory.h"
|
||||
@ -16,7 +17,9 @@
|
||||
#include "libsync/cookiejar.h"
|
||||
#include "libsync/theme.h"
|
||||
#include "libsync/clientproxy.h"
|
||||
#if !DISABLE_ACCOUNT_MIGRATION
|
||||
#include "legacyaccountselectiondialog.h"
|
||||
#endif
|
||||
|
||||
#include <QSettings>
|
||||
#include <QDir>
|
||||
@ -108,10 +111,12 @@ AccountManager::AccountsRestoreResult AccountManager::restore(const bool alsoRes
|
||||
}
|
||||
|
||||
// If there are no accounts, check the old format.
|
||||
#if !DISABLE_ACCOUNT_MIGRATION
|
||||
if (settings->childGroups().isEmpty() && !settings->contains(QLatin1String(versionC)) && alsoRestoreLegacySettings) {
|
||||
restoreFromLegacySettings();
|
||||
return AccountsRestoreSuccessFromLegacyVersion;
|
||||
}
|
||||
#endif
|
||||
|
||||
auto result = AccountsRestoreSuccess;
|
||||
const auto settingsChildGroups = settings->childGroups();
|
||||
@ -166,7 +171,7 @@ void AccountManager::backwardMigrationSettingsKeys(QStringList *deleteKeys, QStr
|
||||
deleteKeys->append(settings->group());
|
||||
}
|
||||
}
|
||||
|
||||
#if !DISABLE_ACCOUNT_MIGRATION
|
||||
bool AccountManager::restoreFromLegacySettings()
|
||||
{
|
||||
qCInfo(lcAccountManager) << "Migrate: restoreFromLegacySettings, checking settings group"
|
||||
@ -314,6 +319,12 @@ bool AccountManager::restoreFromLegacySettings()
|
||||
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
bool AccountManager::restoreFromLegacySettings()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
void AccountManager::save(bool saveCredentials)
|
||||
{
|
||||
|
||||
@ -88,7 +88,9 @@ namespace {
|
||||
" --isvfsenabled : whether to set a VFS or non-VFS folder (1 for 'yes' or 0 for 'no') when creating an account via command-line.\n"
|
||||
" --remotedirpath : (optional) path to a remote subfolder when creating an account via command-line.\n"
|
||||
" --serverurl : a server URL to use when creating an account via command-line.\n"
|
||||
#if !DISABLE_ACCOUNT_MIGRATION
|
||||
" --forcelegacyconfigimport : forcefully import account configurations from legacy clients (if available).\n"
|
||||
#endif
|
||||
" --reverse : use a reverse layout direction.\n";
|
||||
|
||||
QString applicationTrPath()
|
||||
@ -875,9 +877,13 @@ void Application::parseOptions(const QStringList &options)
|
||||
if (it.hasNext() && !it.peekNext().startsWith(QLatin1String("--"))) {
|
||||
_setLanguage = it.next();
|
||||
}
|
||||
} else if (option == QStringLiteral("--forcelegacyconfigimport")) {
|
||||
}
|
||||
#if !DISABLE_ACCOUNT_MIGRATION
|
||||
else if (option == QStringLiteral("--forcelegacyconfigimport")) {
|
||||
AccountManager::instance()->setForceLegacyImport(true);
|
||||
} else {
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
QString errorMessage;
|
||||
if (!AccountSetupCommandLineManager::instance()->parseCommandlineOption(option, it, errorMessage)) {
|
||||
if (!errorMessage.isEmpty()) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user