/***************************************************************************
- * Copyright (C) 2005-07 by The Quassel IRC Development Team *
+ * Copyright (C) 2005-08 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
+ * (at your option) version 3. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
#define _CLIENTSETTINGS_H_
#include "settings.h"
+#include "types.h"
class ClientSettings : public Settings {
- Q_OBJECT
public:
virtual ~ClientSettings();
protected:
ClientSettings(QString group = "General");
- //virtual QStringList allSessionKeys() = 0;
- virtual QStringList sessionKeys();
-
- virtual void setSessionValue(const QString &key, const QVariant &data);
- virtual QVariant sessionValue(const QString &key, const QVariant &def = QVariant());
-
};
-class AccountSettings : public ClientSettings {
- Q_OBJECT
+// 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:
- AccountSettings();
+ // stores account-specific data in CoreAccounts/$ACCID/$SUBGROUP/$KEY)
+ CoreAccountSettings(const QString &subgroup = "General");
+
+ QList<AccountId> knownAccounts();
+ AccountId lastAccount();
+ void setLastAccount(AccountId);
+ AccountId autoConnectAccount();
+ void setAutoConnectAccount(AccountId);
+
+ void storeAccountData(AccountId id, const QVariantMap &data);
+ QVariantMap retrieveAccountData(AccountId);
+ void removeAccount(AccountId);
- QStringList knownAccounts();
- QString lastAccount();
- void setLastAccount(const QString &account);
- QString autoConnectAccount();
- void setAutoConnectAccount(const QString &account);
+ void setJumpKeyMap(const QHash<int, BufferId> &keyMap);
+ QHash<int, BufferId> jumpKeyMap();
+
+ protected:
+ void setAccountValue(const QString &key, const QVariant &data);
+ QVariant accountValue(const QString &key, const QVariant &def = QVariant());
+
+ private:
+ QString _subgroup;
+};
- void setValue(const QString &account, const QString &key, const QVariant &data);
- QVariant value(const QString &account, const QString &key, const QVariant &def = QVariant());
- void removeAccount(const QString &account);
+class BufferSettings : public CoreAccountSettings {
+public:
+ BufferSettings(BufferId bufferId);
+ void setLastSeen(QDateTime);
+ QDateTime lastSeen();
};
#endif