Finishing the switch to types.h and the resulting cleanup.
[quassel.git] / src / client / clientsettings.cpp
1 /***************************************************************************
2  *   Copyright (C) 2005-07 by The Quassel IRC Development Team             *
3  *   devel@quassel-irc.org                                                 *
4  *                                                                         *
5  *   This program is free software; you can redistribute it and/or modify  *
6  *   it under the terms of the GNU General Public License as published by  *
7  *   the Free Software Foundation; either version 2 of the License, or     *
8  *   (at your option) any later version.                                   *
9  *                                                                         *
10  *   This program is distributed in the hope that it will be useful,       *
11  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
13  *   GNU General Public License for more details.                          *
14  *                                                                         *
15  *   You should have received a copy of the GNU General Public License     *
16  *   along with this program; if not, write to the                         *
17  *   Free Software Foundation, Inc.,                                       *
18  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
19  ***************************************************************************/
20
21 #include "client.h"
22 #include "clientsettings.h"
23
24 #include <QStringList>
25
26 ClientSettings::ClientSettings(QString g) : Settings(g) {
27
28
29 }
30
31 ClientSettings::~ClientSettings() {
32
33
34 }
35
36 QStringList ClientSettings::sessionKeys() {
37   return Client::sessionDataKeys();
38 }
39
40 void ClientSettings::setSessionValue(const QString &key, const QVariant &data) {
41   Client::storeSessionData(key, data);
42 }
43
44 QVariant ClientSettings::sessionValue(const QString &key, const QVariant &def) {
45   return Client::retrieveSessionData(key, def);
46 }
47
48 /***********************************************************************************************/
49
50 AccountSettings::AccountSettings() : ClientSettings("Accounts") {
51
52
53 }
54
55 QStringList AccountSettings::knownAccounts() {
56   return localChildGroups();
57 }
58
59 QString AccountSettings::lastAccount() {
60   return localValue("LastAccount", "").toString();
61 }
62
63 void AccountSettings::setLastAccount(const QString &account) {
64   setLocalValue("LastAccount", account);
65 }
66
67 QString AccountSettings::autoConnectAccount() {
68   return localValue("AutoConnectAccount", "").toString();
69 }
70
71 void AccountSettings::setAutoConnectAccount(const QString &account) {
72   setLocalValue("AutoConnectAccount", account);
73 }
74
75 void AccountSettings::setValue(const QString &account, const QString &key, const QVariant &data) {
76   setLocalValue(QString("%1/%2").arg(account).arg(key), data);
77 }
78
79 QVariant AccountSettings::value(const QString &account, const QString &key, const QVariant &def) {
80   return localValue(QString("%1/%2").arg(account).arg(key), def);
81 }
82
83 void AccountSettings::removeAccount(const QString &account) {
84   removeLocalKey(account);
85 }
86
87