client: Use sentence case for Core Info details
[quassel.git] / src / client / client.cpp
index f8627d0..32f599d 100644 (file)
@@ -101,6 +101,7 @@ Client::Client(QObject *parent)
     _backlogManager(new ClientBacklogManager(this)),
     _bufferViewManager(0),
     _bufferViewOverlay(new BufferViewOverlay(this)),
+    _coreInfo(new CoreInfo(this)),
     _dccConfig(0),
     _ircListHelper(new ClientIrcListHelper(this)),
     _inputHandler(0),
@@ -174,6 +175,9 @@ void Client::init()
 
     coreAccountModel()->load();
 
+    // Attach CoreInfo
+    p->synchronize(coreInfo());
+
     connect(coreConnection(), SIGNAL(stateChanged(CoreConnection::ConnectionState)), SLOT(connectionStateChanged(CoreConnection::ConnectionState)));
     coreConnection()->init();
 }
@@ -205,6 +209,12 @@ bool Client::internalCore()
 }
 
 
+void Client::onDbUpgradeInProgress(bool inProgress)
+{
+    emit dbUpgradeInProgress(inProgress);
+}
+
+
 /*** Network handling ***/
 
 QList<NetworkId> Client::networkIds()
@@ -474,6 +484,27 @@ void Client::requestInitialBacklog()
 }
 
 
+void Client::requestLegacyCoreInfo()
+{
+    // On older cores, the CoreInfo object was only synchronized on demand.  Synchronize now if
+    // needed.
+    if (isConnected() && !isCoreFeatureEnabled(Quassel::Feature::SyncedCoreInfo)) {
+        // Delete the existing core info object (it will always exist as client is single-threaded)
+        _coreInfo->deleteLater();
+        // No need to set to null when creating new one immediately after
+
+        // Create a fresh, unsynchronized CoreInfo object, emulating legacy behavior of CoreInfo not
+        // persisting
+        _coreInfo = new CoreInfo(this);
+        // Synchronize the new object
+        signalProxy()->synchronize(_coreInfo);
+
+        // Let others know signal handlers have been reset
+        emit coreInfoResynchronized();
+    }
+}
+
+
 void Client::disconnectFromCore()
 {
     if (!coreConnection()->isConnected())
@@ -500,6 +531,8 @@ void Client::setDisconnectedFromCore()
         _bufferSyncer = 0;
     }
 
+    _coreInfo->reset();
+
     if (_bufferViewManager) {
         _bufferViewManager->deleteLater();
         _bufferViewManager = 0;
@@ -694,6 +727,12 @@ void Client::markBufferAsRead(BufferId id)
 }
 
 
+void Client::refreshLegacyCoreInfo()
+{
+    instance()->requestLegacyCoreInfo();
+}
+
+
 void Client::changePassword(const QString &oldPassword, const QString &newPassword) {
     CoreAccount account = currentCoreAccount();
     account.setPassword(newPassword);