Use Keyring in the login dialog

This commit is contained in:
Petr Mrázek
2013-03-26 17:43:49 +01:00
parent d24c4823ef
commit 737273348f
6 changed files with 88 additions and 18 deletions

View File

@ -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; }

View File

@ -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")
{

View File

@ -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();