postponed backlog loading until custom views are loaded and the buffersyncer knows...
authorMarcus Eggenberger <egs@quassel-irc.org>
Tue, 25 Nov 2008 22:25:14 +0000 (23:25 +0100)
committerMarcus Eggenberger <egs@quassel-irc.org>
Sat, 29 Nov 2008 15:42:38 +0000 (16:42 +0100)
src/client/client.cpp
src/client/client.h
src/qtui/mainwin.cpp

index 0ccde84..1643757 100644 (file)
@@ -277,17 +277,25 @@ void Client::setSyncedToCore() {
   connect(bufferSyncer(), SIGNAL(lastSeenMsgSet(BufferId, MsgId)), _networkModel, SLOT(setLastSeenMsgId(BufferId, MsgId)));
   connect(bufferSyncer(), SIGNAL(bufferRemoved(BufferId)), this, SLOT(bufferRemoved(BufferId)));
   connect(bufferSyncer(), SIGNAL(bufferRenamed(BufferId, QString)), this, SLOT(bufferRenamed(BufferId, QString)));
   connect(bufferSyncer(), SIGNAL(lastSeenMsgSet(BufferId, MsgId)), _networkModel, SLOT(setLastSeenMsgId(BufferId, MsgId)));
   connect(bufferSyncer(), SIGNAL(bufferRemoved(BufferId)), this, SLOT(bufferRemoved(BufferId)));
   connect(bufferSyncer(), SIGNAL(bufferRenamed(BufferId, QString)), this, SLOT(bufferRenamed(BufferId, QString)));
+  connect(bufferSyncer(), SIGNAL(initDone()), this, SLOT(requestInitialBacklog()));
   connect(networkModel(), SIGNAL(setLastSeenMsg(BufferId, MsgId)), bufferSyncer(), SLOT(requestSetLastSeenMsg(BufferId, const MsgId &)));
   signalProxy()->synchronize(bufferSyncer());
 
   // create a new BufferViewManager
   connect(networkModel(), SIGNAL(setLastSeenMsg(BufferId, MsgId)), bufferSyncer(), SLOT(requestSetLastSeenMsg(BufferId, const MsgId &)));
   signalProxy()->synchronize(bufferSyncer());
 
   // create a new BufferViewManager
+  Q_ASSERT(!_bufferViewManager);
   _bufferViewManager = new BufferViewManager(signalProxy(), this);
   _bufferViewManager = new BufferViewManager(signalProxy(), this);
+  connect(bufferViewManager(), SIGNAL(initDone()), this, SLOT(requestInitialBacklog()));
 
   _syncedToCore = true;
   emit connected();
   emit coreConnectionStateChanged(true);
 }
 
 
   _syncedToCore = true;
   emit connected();
   emit coreConnectionStateChanged(true);
 }
 
+void Client::requestInitialBacklog() {
+  if(bufferViewManager()->isInitialized() && bufferSyncer()->isInitialized())
+    Client::backlogManager()->requestInitialBacklog();
+}
+
 void Client::setSecuredConnection() {
   emit securedConnection();
 }
 void Client::setSecuredConnection() {
   emit securedConnection();
 }
index 8a68d99..40086ac 100644 (file)
@@ -176,6 +176,7 @@ private slots:
 
   void setConnectedToCore(AccountId id, QIODevice *socket = 0);
   void setSyncedToCore();
 
   void setConnectedToCore(AccountId id, QIODevice *socket = 0);
   void setSyncedToCore();
+  void requestInitialBacklog();
   void setSecuredConnection();
 
 
   void setSecuredConnection();
 
 
index b7a6181..24b89dc 100644 (file)
@@ -481,9 +481,8 @@ void MainWin::connectedToCore() {
   connect(Client::bufferViewManager(), SIGNAL(bufferViewConfigAdded(int)), this, SLOT(addBufferView(int)));
   connect(Client::bufferViewManager(), SIGNAL(bufferViewConfigDeleted(int)), this, SLOT(removeBufferView(int)));
   connect(Client::bufferViewManager(), SIGNAL(initDone()), this, SLOT(loadLayout()));
   connect(Client::bufferViewManager(), SIGNAL(bufferViewConfigAdded(int)), this, SLOT(addBufferView(int)));
   connect(Client::bufferViewManager(), SIGNAL(bufferViewConfigDeleted(int)), this, SLOT(removeBufferView(int)));
   connect(Client::bufferViewManager(), SIGNAL(initDone()), this, SLOT(loadLayout()));
-
+  
   setConnectedState();
   setConnectedState();
-  Client::backlogManager()->requestInitialBacklog();
 }
 
 void MainWin::setConnectedState() {
 }
 
 void MainWin::setConnectedState() {