Refactor Config.
Replaces all string configuration options with enum types that can be checked by the compiler. This prevents spelling errors, in-place configuration definitions, and inconsistent default values. The default value config getter signature was removed in favour of consistently and centrally default-initialised configuration values. Individual default values were adjusted for better security, such as the default password length, which was increased from 16 characters to 32. The already existing config option deprecation map was extended by a general migration procedure using configuration versioning. Settings were split into Roaming and Local settings, which go to their respective AppData locations on Windows. Fixes #2574 Fixes #2193
This commit is contained in:
@@ -43,7 +43,7 @@ SSHAgent* SSHAgent::instance()
|
||||
|
||||
bool SSHAgent::isEnabled() const
|
||||
{
|
||||
return config()->get("SSHAgent").toBool();
|
||||
return config()->get(Config::SSHAgent_Enabled).toBool();
|
||||
}
|
||||
|
||||
void SSHAgent::setEnabled(bool enabled)
|
||||
@@ -52,30 +52,30 @@ void SSHAgent::setEnabled(bool enabled)
|
||||
removeAllIdentities();
|
||||
}
|
||||
|
||||
config()->set("SSHAgent", enabled);
|
||||
config()->set(Config::SSHAgent_Enabled, enabled);
|
||||
|
||||
emit enabledChanged(enabled);
|
||||
}
|
||||
|
||||
QString SSHAgent::authSockOverride() const
|
||||
{
|
||||
return config()->get("SSHAuthSockOverride").toString();
|
||||
return config()->get(Config::SSHAgent_AuthSockOverride).toString();
|
||||
}
|
||||
|
||||
void SSHAgent::setAuthSockOverride(QString& authSockOverride)
|
||||
{
|
||||
config()->set("SSHAuthSockOverride", authSockOverride);
|
||||
config()->set(Config::SSHAgent_AuthSockOverride, authSockOverride);
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
bool SSHAgent::useOpenSSH() const
|
||||
{
|
||||
return config()->get("SSHAgentOpenSSH").toBool();
|
||||
return config()->get(Config::SSHAgent_UseOpenSSH).toBool();
|
||||
}
|
||||
|
||||
void SSHAgent::setUseOpenSSH(bool useOpenSSH)
|
||||
{
|
||||
config()->set("SSHAgentOpenSSH", useOpenSSH);
|
||||
config()->set(Config::SSHAgent_UseOpenSSH, useOpenSSH);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user