summaryrefslogtreecommitdiffstats
path: root/libsettings
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2013-03-26 17:43:49 +0100
committerPetr Mrázek <peterix@gmail.com>2013-03-26 17:43:49 +0100
commit737273348faa598af906bef2d96e6520a85cbc88 (patch)
treebf418b4e877c1d78561752e6dcdc5575a269b784 /libsettings
parentd24c4823ef8e144a3ffefc208c5a15e86b0b31b1 (diff)
downloadMultiMC-737273348faa598af906bef2d96e6520a85cbc88.tar
MultiMC-737273348faa598af906bef2d96e6520a85cbc88.tar.gz
MultiMC-737273348faa598af906bef2d96e6520a85cbc88.tar.lz
MultiMC-737273348faa598af906bef2d96e6520a85cbc88.tar.xz
MultiMC-737273348faa598af906bef2d96e6520a85cbc88.zip
Use Keyring in the login dialog
Diffstat (limited to 'libsettings')
-rw-r--r--libsettings/include/keyring.h8
-rw-r--r--libsettings/src/stubkeyring.cpp6
-rw-r--r--libsettings/src/stubkeyring.h2
3 files changed, 15 insertions, 1 deletions
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();