part of [CoreUser], which is much nicer than what we had before.
src/core/coresession.h
src/core/coresettings.cpp
src/core/coresettings.h
+src/core/coreusersettings.cpp
+src/core/coreusersettings.h
src/core/ctcphandler.cpp
src/core/ctcphandler.h
src/core/ircserverhandler.cpp
void awayReasonSet(const QString &awayReason);
void returnMessageSet(const QString &returnMessage);
+ void updatedRemotely();
+
private:
bool _initialized;
IdentityId _identityId;
ncs.setValue("Core/DatabaseSettings", os.value("Core/DatabaseSettings"));
os.beginGroup("SessionData");
foreach(QString group, os.childGroups()) {
- ncs.setValue(QString("SessionData/%1/Identities").arg(group), os.value(QString("%1/Identities").arg(group)));
- ncs.setValue(QString("SessionData/%1/Networks").arg(group), os.value(QString("%1/Networks").arg(group)));
+ ncs.setValue(QString("CoreUser/%1/SessionData/Identities").arg(group), os.value(QString("%1/Identities").arg(group)));
+ ncs.setValue(QString("CoreUser/%1/SessionData/Networks").arg(group), os.value(QString("%1/Networks").arg(group)));
}
os.endGroup();
DEPMOD = common
QT_MOD = core network sql script
SRCS = core.cpp coresession.cpp coresettings.cpp server.cpp sqlitestorage.cpp storage.cpp basichandler.cpp \
- ircserverhandler.cpp userinputhandler.cpp ctcphandler.cpp sessionsettings.cpp
+ ircserverhandler.cpp userinputhandler.cpp ctcphandler.cpp coreusersettings.cpp
HDRS = core.h coresession.h coresettings.h server.h sqlitestorage.h storage.h basichandler.h \
- ircserverhandler.h userinputhandler.h ctcphandler.h sessionsettings.h
+ ircserverhandler.h userinputhandler.h ctcphandler.h coreusersettings.h
#include "identity.h"
#include "util.h"
-#include "sessionsettings.h"
+#include "coreusersettings.h"
#include <QtScript>
SignalProxy *p = signalProxy();
- SessionSettings s(user);
- sessionData = s.sessionData(); qDebug() << sessionData;
- /*
- QSettings s; // FIXME don't use QSettings anymore
- mutex.lock();
- s.beginGroup(QString("SessionData/%1").arg(user));
- foreach(QString key, s.allKeys()) { qDebug() << key;
- sessionData[key] = s.value(key);
- }
- s.endGroup();
- mutex.unlock(); // FIXME remove
- */
- /* temporarily disabled
- s.beginGroup(QString("Identities/%1").arg(user));
- foreach(QString id, s.childKeys()) {
- Identity *i = new Identity(s.value(id).value<Identity>(), this);
+ CoreUserSettings s(user);
+ sessionData = s.sessionData();
+/*
+ CoreSettings cs;
+ foreach(QString id, cs.localChildKeys(QString("Identities/%1").arg(user))) {
+ Identity *i = new Identity(cs.localValue(QString("Identities/%1/%2").arg(user).arg(id)).value<Identity>(), this);
if(i->id() < 1) {
qDebug() << QString("Invalid identity!");
continue;
void CoreSession::storeSessionData(const QString &key, const QVariant &data) {
- SessionSettings s(user);
+ CoreUserSettings s(user);
mutex.lock();
s.setSessionValue(key, data);
sessionData[key] = data;
// update
_identities[id.id()]->update(id);
}
- Q_ASSERT(false); // FIX QSettings first!
- QSettings s; // FIXME don't use QSettings
+/*
+ CoreSettings s;
s.beginGroup(QString("Identities/%1").arg(user));
s.setValue(QString::number(id.id()), QVariant::fromValue<Identity>(*_identities[id.id()]));
- s.endGroup();
+ s.endGroup();*/
}
void CoreSession::removeIdentity(IdentityId id) {
/***************************************************************************
- * Copyright (C) 2005-08 by the Quassel Project *
+ * Copyright (C) 2005-08 by the Quassel IRC Team *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
-#include "sessionsettings.h"
+#include "coreusersettings.h"
-#include <QStringList>
-#include <QDebug>
+CoreUserSettings::CoreUserSettings(UserId uid) : CoreSettings(QString("CoreUser/%1").arg(uid)), user(uid) {
-SessionSettings::SessionSettings(UserId uid) : CoreSettings("SessionData"), user(uid) {
}
-QVariantMap SessionSettings::sessionData() {
+
+
+
+QVariantMap CoreUserSettings::sessionData() {
QVariantMap res;
- foreach(QString key, localChildKeys(QString("%1").arg(user))) {
- res[key] = localValue(QString("%1/%2").arg(user).arg(key));
+ foreach(QString key, localChildKeys(QString("SessionData"))) {
+ res[key] = localValue(QString("SessionData/%1").arg(key));
}
return res;
}
-void SessionSettings::setSessionValue(const QString &key, const QVariant &data) {
- setLocalValue(QString("%1/%2").arg(user).arg(key), data);
+void CoreUserSettings::setSessionValue(const QString &key, const QVariant &data) {
+ setLocalValue(QString("SessionData/%1").arg(key), data);
}
-QVariant SessionSettings::sessionValue(const QString &key, const QVariant &def) {
- return localValue(QString("%1/%2").arg(user).arg(key), def);
+QVariant CoreUserSettings::sessionValue(const QString &key, const QVariant &def) {
+ return localValue(QString("SessionData/%1").arg(key), def);
}
/***************************************************************************
- * Copyright (C) 2005-08 by the Quassel Project *
+ * Copyright (C) 2005-08 by the Quassel IRC Team *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
-#ifndef _SESSIONSETTINGS_H_
-#define _SESSIONSETTINGS_H_
+#ifndef _COREUSERSETTINGS_H_
+#define _COREUSERSETTINGS_H_
#include "coresettings.h"
+#include "identity.h"
#include "types.h"
#include <QVariantMap>
-// this class should only be used from CoreSession!
-//! This class stores and retrieves data from permanent storage for the use in SessionData.
-/** \Note Data stored here is not propagated into the actual SessionData!
- */
-class SessionSettings : public CoreSettings {
+class CoreUserSettings : public CoreSettings {
- private:
- explicit SessionSettings(UserId user);
+ public:
+ CoreUserSettings(UserId user);
+
+ void setIdentity(const Identity &identity);
+ Identity identity(IdentityId id);
+
+ private:
+ // this stuff should only be accessed by CoreSession!
QVariantMap sessionData();
QVariant sessionValue(const QString &key, const QVariant &def = QVariant());
void setSessionValue(const QString &key, const QVariant &value);