X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Fclientsettings.h;h=9a935977da683c7ba5e54c703306ac4e2b226968;hp=3b03c4c9bf8af3a027e77a870b548b3b40b5f952;hb=ee6e4f90ce63d7eb3a54937cffb33510398d2349;hpb=8c38d6c5248c1b364bf56e25be0069f32c4f0408 diff --git a/src/client/clientsettings.h b/src/client/clientsettings.h index 3b03c4c9..9a935977 100644 --- a/src/client/clientsettings.h +++ b/src/client/clientsettings.h @@ -22,6 +22,7 @@ #define _CLIENTSETTINGS_H_ #include "settings.h" +#include "types.h" class ClientSettings : public Settings { @@ -33,25 +34,35 @@ class ClientSettings : public Settings { }; -// TODO accountid, account-specific settings +// Deriving from CoreAccountSettings: +// MySettings() : CoreAccountSettings("MyGroup") {}; +// Then use accountValue() / setAccountValue() to retrieve/store data associated to the currently +// connected account. This is stored in CoreAccounts/$ACCID/MyGroup/$KEY) then. +// +// Note that you'll get invalid data (and setting is ignored) if you are not connected to a core! class CoreAccountSettings : public ClientSettings { public: - CoreAccountSettings(); + // stores account-specific data in CoreAccounts/$ACCID/$SUBGROUP/$KEY) + CoreAccountSettings(const QString &subgroup = "General"); - QStringList knownAccounts(); - QString lastAccount(); - void setLastAccount(const QString &account); - QString autoConnectAccount(); - void setAutoConnectAccount(const QString &account); + QList knownAccounts(); + AccountId lastAccount(); + void setLastAccount(AccountId); + AccountId autoConnectAccount(); + void setAutoConnectAccount(AccountId); - void storeAccount(const QString name, const QVariantMap &data); - QVariantMap retrieveAccount(const QString &name); - void storeAllAccounts(const QHash accounts); - QHash retrieveAllAccounts(); - void removeAccount(const QString &account); + void storeAccountData(AccountId id, const QVariantMap &data); + QVariantMap retrieveAccountData(AccountId); + void removeAccount(AccountId); + protected: + void setAccountValue(const QString &key, const QVariant &data); + QVariant accountValue(const QString &key, const QVariant &def = QVariant()); + + private: + QString _subgroup; }; #endif