mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-12-28 00:39:43 -05:00
Store defaults in Config.
This commit is contained in:
parent
4a2ca8c7c8
commit
7194a3d7a8
@ -21,6 +21,11 @@
|
|||||||
#include <QtCore/QSettings>
|
#include <QtCore/QSettings>
|
||||||
#include <QtGui/QDesktopServices>
|
#include <QtGui/QDesktopServices>
|
||||||
|
|
||||||
|
QVariant Config::get(const QString& key)
|
||||||
|
{
|
||||||
|
return m_settings->value(key, m_defaults.value(key));
|
||||||
|
}
|
||||||
|
|
||||||
QVariant Config::get(const QString& key, const QVariant& defaultValue)
|
QVariant Config::get(const QString& key, const QVariant& defaultValue)
|
||||||
{
|
{
|
||||||
return m_settings->value(key, defaultValue);
|
return m_settings->value(key, defaultValue);
|
||||||
@ -61,6 +66,9 @@ Config::Config()
|
|||||||
userPath += "keepassx2.ini";
|
userPath += "keepassx2.ini";
|
||||||
|
|
||||||
m_settings.reset(new QSettings(userPath, QSettings::IniFormat));
|
m_settings.reset(new QSettings(userPath, QSettings::IniFormat));
|
||||||
|
|
||||||
|
m_defaults.insert("security/clearclipboard", true);
|
||||||
|
m_defaults.insert("security/clearclipboardtimeout", 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
Config* config()
|
Config* config()
|
||||||
|
@ -26,13 +26,15 @@ class QSettings;
|
|||||||
class Config
|
class Config
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QVariant get(const QString& key, const QVariant& defaultValue = QVariant());
|
QVariant get(const QString& key);
|
||||||
|
QVariant get(const QString& key, const QVariant& defaultValue);
|
||||||
void set(const QString& key, const QVariant& value);
|
void set(const QString& key, const QVariant& value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Config();
|
Config();
|
||||||
|
|
||||||
QScopedPointer<QSettings> m_settings;
|
QScopedPointer<QSettings> m_settings;
|
||||||
|
QHash<QString, QVariant> m_defaults;
|
||||||
|
|
||||||
Q_DISABLE_COPY(Config)
|
Q_DISABLE_COPY(Config)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user