X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fcoresession.cpp;h=1e7d2a1e4cc236e6737b0fa65e858ea0deb03024;hp=841ae7c1a31cc77b39f42bd45357cc88d9af5652;hb=93800658bba5dcbeca7f3deb02dd7091c455efe8;hpb=7897b8623a42967511e31c68d5c102033a1dcdb9 diff --git a/src/core/coresession.cpp b/src/core/coresession.cpp index 841ae7c1..1e7d2a1e 100644 --- a/src/core/coresession.cpp +++ b/src/core/coresession.cpp @@ -51,7 +51,6 @@ CoreSession::CoreSession(UserId uid, bool restoreState, QObject *parent) _coreInfo(this), scriptEngine(new QScriptEngine(this)) { - SignalProxy *p = signalProxy(); connect(p, SIGNAL(peerRemoved(QIODevice *)), this, SLOT(removeClient(QIODevice *))); @@ -75,29 +74,18 @@ CoreSession::CoreSession(UserId uid, bool restoreState, QObject *parent) loadSettings(); initScriptEngine(); - // init BufferSyncer - QHash lastSeenHash = Core::bufferLastSeenMsgIds(user()); - foreach(BufferId id, lastSeenHash.keys()) - _bufferSyncer->requestSetLastSeenMsg(id, lastSeenHash[id]); + connect(&(Core::instance()->syncTimer()), SIGNAL(timeout()), _bufferSyncer, SLOT(storeDirtyIds())); + connect(&(Core::instance()->syncTimer()), SIGNAL(timeout()), _bufferViewManager, SLOT(saveBufferViews())); - connect(_bufferSyncer, SIGNAL(lastSeenMsgSet(BufferId, MsgId)), this, SLOT(storeBufferLastSeenMsg(BufferId, MsgId))); p->synchronize(_bufferSyncer); - - - // init alias manager p->synchronize(&aliasManager()); - - // init BacklogManager p->synchronize(_backlogManager); - - // init IrcListHelper p->synchronize(ircListHelper()); - - // init CoreInfo p->synchronize(&_coreInfo); // Restore session state - if(restoreState) restoreSessionState(); + if(restoreState) + restoreSessionState(); emit initialized(); } @@ -145,12 +133,6 @@ void CoreSession::loadSettings() { foreach(CoreIdentity identity, Core::identities(user())) { createIdentity(identity); } - if(!_identities.count()) { - Identity identity; - identity.setToDefaults(); - identity.setIdentityName(tr("Default Identity")); - createIdentity(identity, QVariantMap()); - } foreach(NetworkInfo info, Core::networks(user())) { createNetwork(info); @@ -158,6 +140,8 @@ void CoreSession::loadSettings() { } void CoreSession::saveSessionState() const { + _bufferSyncer->storeDirtyIds(); + _bufferViewManager->saveBufferViews(); } void CoreSession::restoreSessionState() { @@ -263,10 +247,6 @@ QVariant CoreSession::sessionState() { return v; } -void CoreSession::storeBufferLastSeenMsg(BufferId buffer, const MsgId &msgId) { - Core::setBufferLastSeenMsg(user(), buffer, msgId); -} - void CoreSession::initScriptEngine() { signalProxy()->attachSlot(SIGNAL(scriptRequest(QString)), this, SLOT(scriptRequest(QString))); signalProxy()->attachSignal(this, SIGNAL(scriptResult(QString))); @@ -384,8 +364,10 @@ void CoreSession::destroyNetwork(NetworkId id) { } void CoreSession::renameBuffer(const NetworkId &networkId, const QString &newName, const QString &oldName) { - BufferInfo bufferInfo = Core::bufferInfo(user(), networkId, BufferInfo::QueryBuffer, oldName); - _bufferSyncer->renameBuffer(bufferInfo.bufferId(), newName); + BufferInfo bufferInfo = Core::bufferInfo(user(), networkId, BufferInfo::QueryBuffer, oldName, false); + if(bufferInfo.isValid()) { + _bufferSyncer->renameBuffer(bufferInfo.bufferId(), newName); + } } void CoreSession::clientsConnected() {