From 737273348faa598af906bef2d96e6520a85cbc88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Tue, 26 Mar 2013 17:43:49 +0100 Subject: Use Keyring in the login dialog --- libsettings/include/keyring.h | 8 ++++++++ libsettings/src/stubkeyring.cpp | 6 ++++++ libsettings/src/stubkeyring.h | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) (limited to 'libsettings') diff --git a/libsettings/include/keyring.h b/libsettings/include/keyring.h index 5774e287..299b14b0 100644 --- a/libsettings/include/keyring.h +++ b/libsettings/include/keyring.h @@ -72,6 +72,14 @@ public: */ virtual QStringList getStoredAccounts(QString service) = 0; + /** + * @brief Remove the specified account from storage + * @param service the service name + * @param username the account name + * @return + */ + virtual void removeStoredAccount(QString service, QString username) = 0; + protected: /// fall back to StubKeyring if false virtual bool isValid() { return false; } diff --git a/libsettings/src/stubkeyring.cpp b/libsettings/src/stubkeyring.cpp index 963f3dd9..cb03bf79 100644 --- a/libsettings/src/stubkeyring.cpp +++ b/libsettings/src/stubkeyring.cpp @@ -90,6 +90,12 @@ QStringList StubKeyring::getStoredAccounts(QString service) return out; } +void StubKeyring::removeStoredAccount ( QString service, QString username ) +{ + QString key = generateKey(service, username); + m_settings.remove(key); +} + StubKeyring::StubKeyring() : m_settings(QSettings::UserScope, "Orochimarufan", "Keyring") { diff --git a/libsettings/src/stubkeyring.h b/libsettings/src/stubkeyring.h index b5f04e4c..45791c85 100644 --- a/libsettings/src/stubkeyring.h +++ b/libsettings/src/stubkeyring.h @@ -29,7 +29,7 @@ public: virtual QString getPassword(QString service, QString username); virtual bool hasPassword(QString service, QString username); virtual QStringList getStoredAccounts(QString service); - + virtual void removeStoredAccount(QString service, QString username); private: friend class Keyring; explicit StubKeyring(); -- cgit v1.2.3