mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
fix(migration): import proxy and general settings from legacy config.
Signed-off-by: Camila Ayres <hello@camilasan.com>
This commit is contained in:
parent
de757bcdfb
commit
645dd4e0d8
@ -23,6 +23,7 @@
|
||||
#include "libsync/configfile.h"
|
||||
#include "libsync/cookiejar.h"
|
||||
#include "libsync/theme.h"
|
||||
#include "libsync/clientproxy.h"
|
||||
|
||||
#include <QSettings>
|
||||
#include <QDir>
|
||||
@ -60,7 +61,6 @@ constexpr auto networkDownloadLimitSettingC = "networkDownloadLimitSetting";
|
||||
constexpr auto networkUploadLimitC = "networkUploadLimit";
|
||||
constexpr auto networkDownloadLimitC = "networkDownloadLimit";
|
||||
constexpr auto encryptionCertificateSha256FingerprintC = "encryptionCertificateSha256Fingerprint";
|
||||
constexpr auto generalC = "General";
|
||||
|
||||
constexpr auto dummyAuthTypeC = "dummy";
|
||||
constexpr auto httpAuthTypeC = "http";
|
||||
@ -82,6 +82,15 @@ constexpr auto maxAccountsVersion = 13;
|
||||
constexpr auto maxAccountVersion = 13;
|
||||
|
||||
constexpr auto serverHasValidSubscriptionC = "serverHasValidSubscription";
|
||||
|
||||
constexpr auto generalC = "General";
|
||||
constexpr auto isVfsEnabledC = "isVfsEnabled";
|
||||
constexpr auto launchOnSystemStartupC = "launchOnSystemStartup";
|
||||
constexpr auto optionalServerNotificationsC = "optionalServerNotifications";
|
||||
constexpr auto promptDeleteC = "promptDeleteAllFiles";
|
||||
constexpr auto showCallNotificationsC = "showCallNotifications";
|
||||
constexpr auto showChatNotificationsC = "showChatNotifications";
|
||||
constexpr auto showInExplorerNavigationPaneC = "showInExplorerNavigationPane";
|
||||
}
|
||||
|
||||
|
||||
@ -251,6 +260,16 @@ bool AccountManager::restoreFromLegacySettings()
|
||||
}
|
||||
}
|
||||
|
||||
ConfigFile configFile;
|
||||
configFile.setVfsEnabled(settings->value(QLatin1String(isVfsEnabledC)).toBool());
|
||||
configFile.setLaunchOnSystemStartup(settings->value(QLatin1String(launchOnSystemStartupC)).toBool());
|
||||
configFile.setOptionalServerNotifications(settings->value(QLatin1String(optionalServerNotificationsC)).toBool());
|
||||
configFile.setPromptDeleteFiles(settings->value(QLatin1String(promptDeleteC)).toBool());
|
||||
configFile.setShowCallNotifications(settings->value(QLatin1String(showCallNotificationsC)).toBool());
|
||||
configFile.setShowChatNotifications(settings->value(QLatin1String(showChatNotificationsC)).toBool());
|
||||
configFile.setShowInExplorerNavigationPane(settings->value(QLatin1String(showInExplorerNavigationPaneC)).toBool());
|
||||
ClientProxy().setupQtProxyFromSettings(*settings);
|
||||
|
||||
// Try to load the single account.
|
||||
if (!settings->childKeys().isEmpty()) {
|
||||
settings->beginGroup(accountsC);
|
||||
|
||||
@ -18,6 +18,17 @@
|
||||
#include <QLoggingCategory>
|
||||
#include <QUrl>
|
||||
#include <QThreadPool>
|
||||
#include <QSettings>
|
||||
|
||||
namespace {
|
||||
constexpr auto proxyC = "Proxy";
|
||||
constexpr auto proxyTypeC = "Proxy/type";
|
||||
constexpr auto proxyHostC = "Proxy/host";
|
||||
constexpr auto proxyPortC = "Proxy/port";
|
||||
constexpr auto proxyUserC = "Proxy/user";
|
||||
constexpr auto proxyPassC = "Proxy/pass";
|
||||
constexpr auto proxyNeedsAuthC = "Proxy/needsAuth";
|
||||
}
|
||||
|
||||
namespace OCC {
|
||||
|
||||
@ -128,6 +139,23 @@ void ClientProxy::setupQtProxyFromConfig()
|
||||
}
|
||||
}
|
||||
|
||||
void ClientProxy::setupQtProxyFromSettings(const QSettings &settings)
|
||||
{
|
||||
if (settings.value(QLatin1String(proxyTypeC)).isNull()) {
|
||||
qCInfo(lcClientProxy) << "No Proxy settings found.";
|
||||
return;
|
||||
}
|
||||
|
||||
OCC::ConfigFile configFile;
|
||||
const auto proxyType = settings.value(QLatin1String(proxyTypeC)).toInt();
|
||||
configFile.setProxyType(proxyType,
|
||||
settings.value(QLatin1String(proxyHostC)).toString(),
|
||||
settings.value(QLatin1String(proxyPortC)).toInt(),
|
||||
settings.value(QLatin1String(proxyNeedsAuthC)).toBool(),
|
||||
settings.value(QLatin1String(proxyUserC)).toString(),
|
||||
settings.value(QLatin1String(proxyPassC)).toString());
|
||||
}
|
||||
|
||||
void ClientProxy::lookupSystemProxyAsync(const QUrl &url, QObject *dst, const char *slot)
|
||||
{
|
||||
auto *runnable = new SystemProxyRunnable(url);
|
||||
|
||||
@ -46,6 +46,7 @@ public:
|
||||
|
||||
public slots:
|
||||
void setupQtProxyFromConfig();
|
||||
void setupQtProxyFromSettings(const QSettings &settings);
|
||||
};
|
||||
|
||||
class OWNCLOUDSYNC_EXPORT SystemProxyRunnable : public QObject, public QRunnable
|
||||
|
||||
Loading…
Reference in New Issue
Block a user