1 /***************************************************************************
2 * Copyright (C) 2005-07 by the Quassel IRC Team *
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 <QStringList>
27 #include <QCoreApplication>
32 Settings::Settings(QString g) : group(g) {
37 // FIXME sandboxDir() is not currently working correctly...
38 //if(Qtopia::sandboxDir().isEmpty()) QSettings();
39 //else QSettings(Qtopia::sandboxDir() + "/etc/QuasselIRC.conf", QSettings::NativeFormat);
40 // ...so we have to use a workaround:
41 QString appPath = QCoreApplication::applicationFilePath();
42 if(appPath.startsWith(Qtopia::packagePath())) {
43 QString sandboxPath = appPath.left(Qtopia::packagePath().length() + 32);
44 QSettings(sandboxPath + "/etc/QuasselIRC.conf", QSettings::IniFormat);
45 qDebug() << sandboxPath + "/etc/QuasselIRC.conf";
52 Settings::~Settings() {
56 void Settings::setGroup(QString g) {
61 QStringList Settings::allLocalKeys() {
63 QStringList res = allKeys();
68 QStringList Settings::localChildKeys(const QString &rootkey) {
70 if(rootkey.isEmpty()) g = group;
71 else g = QString("%1/%2").arg(group, rootkey);
73 QStringList res = childKeys();
78 QStringList Settings::localChildGroups(const QString &rootkey) {
80 if(rootkey.isEmpty()) g = group;
81 else g = QString("%1/%2").arg(group, rootkey);
83 QStringList res = childGroups();
88 void Settings::setLocalValue(const QString &key, const QVariant &data) {
94 QVariant Settings::localValue(const QString &key, const QVariant &def) {
96 QVariant res = value(key, def);
101 void Settings::removeLocalKey(const QString &key) {