1 /***************************************************************************
2 * Copyright (C) 2005-08 by the Quassel Project *
3 * devel@quassel-irc.org *
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) version 3. *
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. *
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 ***************************************************************************/
22 #include "clientsettings.h"
25 #include <QStringList>
27 ClientSettings::ClientSettings(QString g) : Settings(g, Global::clientApplicationName) {
32 ClientSettings::~ClientSettings() {
37 QStringList ClientSettings::sessionKeys() {
38 return Client::sessionDataKeys();
41 void ClientSettings::setSessionValue(const QString &key, const QVariant &data) {
42 Client::storeSessionData(key, data);
45 QVariant ClientSettings::sessionValue(const QString &key, const QVariant &def) {
46 return Client::retrieveSessionData(key, def);
49 /***********************************************************************************************/
51 AccountSettings::AccountSettings() : ClientSettings("Accounts") {
56 QStringList AccountSettings::knownAccounts() {
57 return localChildGroups();
60 QString AccountSettings::lastAccount() {
61 return localValue("LastAccount", "").toString();
64 void AccountSettings::setLastAccount(const QString &account) {
65 setLocalValue("LastAccount", account);
68 QString AccountSettings::autoConnectAccount() {
69 return localValue("AutoConnectAccount", "").toString();
72 void AccountSettings::setAutoConnectAccount(const QString &account) {
73 setLocalValue("AutoConnectAccount", account);
76 void AccountSettings::setValue(const QString &account, const QString &key, const QVariant &data) {
77 setLocalValue(QString("%1/%2").arg(account).arg(key), data);
80 QVariant AccountSettings::value(const QString &account, const QString &key, const QVariant &def) {
81 return localValue(QString("%1/%2").arg(account).arg(key), def);
84 void AccountSettings::removeAccount(const QString &account) {
85 removeLocalKey(account);