diff options
Diffstat (limited to 'framework/src/keyring.cpp')
-rw-r--r-- | framework/src/keyring.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/framework/src/keyring.cpp b/framework/src/keyring.cpp index e3fdb1cb..7bd406c0 100644 --- a/framework/src/keyring.cpp +++ b/framework/src/keyring.cpp | |||
@@ -20,18 +20,31 @@ | |||
20 | 20 | ||
21 | #include <sink/secretstore.h> | 21 | #include <sink/secretstore.h> |
22 | #include <QSettings> | 22 | #include <QSettings> |
23 | #include <QtGlobal> | ||
23 | 24 | ||
24 | using namespace Kube; | 25 | using namespace Kube; |
25 | 26 | ||
27 | Q_GLOBAL_STATIC(Keyring, sKeyring); | ||
28 | |||
26 | Keyring::Keyring() | 29 | Keyring::Keyring() |
27 | : QObject() | 30 | : QObject() |
28 | { | 31 | { |
29 | 32 | ||
30 | } | 33 | } |
31 | 34 | ||
35 | Keyring *Keyring::instance() | ||
36 | { | ||
37 | return sKeyring; | ||
38 | } | ||
39 | |||
32 | bool Keyring::isUnlocked(const QByteArray &accountId) | 40 | bool Keyring::isUnlocked(const QByteArray &accountId) |
33 | { | 41 | { |
34 | return false; | 42 | return mUnlocked.contains(accountId); |
43 | } | ||
44 | |||
45 | void Keyring::unlock(const QByteArray &accountId) | ||
46 | { | ||
47 | mUnlocked.insert(accountId); | ||
35 | } | 48 | } |
36 | 49 | ||
37 | AccountKeyring::AccountKeyring(const QByteArray &accountId, QObject *parent) | 50 | AccountKeyring::AccountKeyring(const QByteArray &accountId, QObject *parent) |
@@ -45,6 +58,7 @@ void AccountKeyring::storePassword(const QByteArray &resourceId, const QString & | |||
45 | QSettings settings{mAccountIdentifier + ".keyring", QSettings::IniFormat}; | 58 | QSettings settings{mAccountIdentifier + ".keyring", QSettings::IniFormat}; |
46 | settings.setValue(resourceId, password); | 59 | settings.setValue(resourceId, password); |
47 | Sink::SecretStore::instance().insert(resourceId, password); | 60 | Sink::SecretStore::instance().insert(resourceId, password); |
61 | Keyring::instance()->unlock(mAccountIdentifier); | ||
48 | } | 62 | } |
49 | 63 | ||
50 | void AccountKeyring::unlock() | 64 | void AccountKeyring::unlock() |