OK Folks, my first commit after quite a while, and while Quassel looks the same as...
[quassel.git] / src / client / clientsettings.cpp
diff --git a/src/client/clientsettings.cpp b/src/client/clientsettings.cpp
new file mode 100644 (file)
index 0000000..6f40a23
--- /dev/null
@@ -0,0 +1,87 @@
+/***************************************************************************
+ *   Copyright (C) 2005-07 by The Quassel IRC Development Team             *
+ *   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.                                   *
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU General Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU General Public License     *
+ *   along with this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ ***************************************************************************/
+
+#include "client.h"
+#include "clientsettings.h"
+
+#include <QStringList>
+
+ClientSettings::ClientSettings(QString g) : Settings(g) {
+
+
+}
+
+ClientSettings::~ClientSettings() {
+
+
+}
+
+QStringList ClientSettings::sessionKeys() {
+  return Client::sessionDataKeys();
+}
+
+void ClientSettings::setSessionValue(const QString &key, const QVariant &data) {
+  Client::storeSessionData(key, data);
+}
+
+QVariant ClientSettings::sessionValue(const QString &key, const QVariant &def) {
+  return Client::retrieveSessionData(key, def);
+}
+
+/***********************************************************************************************/
+
+AccountSettings::AccountSettings() : ClientSettings("Accounts") {
+
+
+}
+
+QStringList AccountSettings::knownAccounts() {
+  return localChildGroups();
+}
+
+QString AccountSettings::lastAccount() {
+  return localValue("LastAccount", "").toString();
+}
+
+void AccountSettings::setLastAccount(const QString &account) {
+  setLocalValue("LastAccount", account);
+}
+
+QString AccountSettings::autoConnectAccount() {
+  return localValue("AutoConnectAccount", "").toString();
+}
+
+void AccountSettings::setAutoConnectAccount(const QString &account) {
+  setLocalValue("AutoConnectAccount", account);
+}
+
+void AccountSettings::setValue(const QString &account, const QString &key, const QVariant &data) {
+  setLocalValue(QString("%1/%2").arg(account).arg(key), data);
+}
+
+QVariant AccountSettings::value(const QString &account, const QString &key, const QVariant &def) {
+  return localValue(QString("%1/%2").arg(account).arg(key), def);
+}
+
+void AccountSettings::removeAccount(const QString &account) {
+  removeLocalKey(account);
+}
+
+