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