fixes #484 - issues with ssl status indicator
authorMarcus Eggenberger <egs@quassel-irc.org>
Wed, 14 Jan 2009 20:02:50 +0000 (21:02 +0100)
committerMarcus Eggenberger <egs@quassel-irc.org>
Wed, 14 Jan 2009 20:02:50 +0000 (21:02 +0100)
src/client/client.cpp
src/client/client.h
src/client/clientsyncer.cpp
src/client/clientsyncer.h
src/qtui/coreconnectdlg.cpp
src/qtui/coreconnectdlg.h
src/qtui/mainwin.cpp
src/qtui/mainwin.h

index 41ceb1e..92be56e 100644 (file)
@@ -345,10 +345,6 @@ void Client::createDefaultNetworks() {
   }
 }
 
-void Client::setSecuredConnection() {
-  emit securedConnection();
-}
-
 void Client::disconnectFromCore() {
   if(!isConnected())
     return;
index 684cb58..ea30bcd 100644 (file)
@@ -129,7 +129,6 @@ signals:
   void showConfigWizard(const QVariantMap &coredata);
 
   void connected();
-  void securedConnection();
   void disconnected();
   void coreConnectionStateChanged(bool);
 
@@ -188,8 +187,6 @@ private slots:
   void createDefaultBufferView();
   void createDefaultIdentity();
   void createDefaultNetworks();
-  void setSecuredConnection();
-
 
 private:
   Client(QObject *parent = 0);
index 51b51f1..fb8bebc 100644 (file)
@@ -123,10 +123,10 @@ void ClientSyncer::connectToCore(const QVariantMap &conn) {
 
 #ifdef HAVE_SSL
     QSslSocket *sock = new QSslSocket(Client::instance());
+    connect(sock, SIGNAL(encrypted()), this, SIGNAL(encrypted()));
 #else
     if(conn["useSsl"].toBool()) {
        emit connectionError(tr("<b>This client is built without SSL Support!</b><br />Disable the usage of SSL in the account settings."));
-       emit encrypted(false);
        return;
     }
     QTcpSocket *sock = new QTcpSocket(Client::instance());
@@ -229,11 +229,8 @@ void ClientSyncer::clientInitAck(const QVariantMap &msg) {
       Q_ASSERT(sslSocket);
       connect(sslSocket, SIGNAL(sslErrors(const QList<QSslError> &)), this, SLOT(sslErrors(const QList<QSslError> &)));
       sslSocket->startClientEncryption();
-      emit encrypted(true);
-      Client::instance()->setSecuredConnection();
     } else {
       emit connectionError(tr("<b>The Quassel Core you are trying to connect to does not support SSL!</b><br />If you want to connect anyways, disable the usage of SSL in the account settings."));
-      emit encrypted(false);
       disconnectFromCore();
       return;
     }
index e8cee5a..ea65d48 100644 (file)
@@ -61,7 +61,7 @@ signals:
   void coreSetupSuccess();
   void coreSetupFailed(const QString &error);
 
-  void encrypted(bool);
+  void encrypted(); // relaying encrypted signal of the encapsulated SslSocket
 
   void startInternalCore(ClientSyncer *syncer);
   void connectToInternalCore(SignalProxy *proxy);
index 2e2c094..f44ba0f 100644 (file)
@@ -88,7 +88,6 @@ CoreConnectDlg::CoreConnectDlg(bool autoconnect, QWidget *parent)
   connect(clientSyncer, SIGNAL(socketStateChanged(QAbstractSocket::SocketState)),this, SLOT(initPhaseSocketState(QAbstractSocket::SocketState)));
   connect(clientSyncer, SIGNAL(connectionError(const QString &)), this, SLOT(initPhaseError(const QString &)));
   connect(clientSyncer, SIGNAL(connectionMsg(const QString &)), this, SLOT(initPhaseMsg(const QString &)));
-  connect(clientSyncer, SIGNAL(encrypted(bool)), this, SLOT(encrypted(bool)));
   connect(clientSyncer, SIGNAL(startLogin()), this, SLOT(startLogin()));
   connect(clientSyncer, SIGNAL(loginFailed(const QString &)), this, SLOT(loginFailed(const QString &)));
   connect(clientSyncer, SIGNAL(loginSuccess()), this, SLOT(startSync()));
@@ -96,6 +95,7 @@ CoreConnectDlg::CoreConnectDlg(bool autoconnect, QWidget *parent)
   connect(clientSyncer, SIGNAL(sessionProgress(quint32, quint32)), this, SLOT(coreSessionProgress(quint32, quint32)));
   connect(clientSyncer, SIGNAL(networksProgress(quint32, quint32)), this, SLOT(coreNetworksProgress(quint32, quint32)));
   connect(clientSyncer, SIGNAL(syncFinished()), this, SLOT(syncFinished()));
+  connect(clientSyncer, SIGNAL(encrypted()), ui.secureConnection, SLOT(show()));
 
   connect(ui.user, SIGNAL(textChanged(const QString &)), this, SLOT(setLoginWidgetStates()));
   connect(ui.password, SIGNAL(textChanged(const QString &)), this, SLOT(setLoginWidgetStates()));
@@ -263,13 +263,6 @@ void CoreConnectDlg::initPhaseMsg(const QString &msg) {
   ui.coreInfoLabel->setText(msg);
 }
 
-void CoreConnectDlg::encrypted(bool useSsl) {
-  if(useSsl)
-    ui.secureConnection->show();
-  else
-    ui.secureConnection->hide();
-}
-
 void CoreConnectDlg::initPhaseSocketState(QAbstractSocket::SocketState state) {
   QString s;
   QString host = accountData["Host"].toString();
index 6376d9f..cac4721 100644 (file)
@@ -64,7 +64,6 @@ private slots:
   void initPhaseError(const QString &error);
   void initPhaseMsg(const QString &msg);
   void initPhaseSocketState(QAbstractSocket::SocketState);
-  void encrypted(bool);
 
   /*** Phase Two: Login ***/
   void startLogin();
index dda747d..78f8d38 100644 (file)
@@ -464,7 +464,6 @@ void MainWin::setupStatusBar() {
   connect(Client::signalProxy(), SIGNAL(lagUpdated(int)), this, SLOT(updateLagIndicator(int)));
 
   // SSL indicator
-  connect(Client::instance(), SIGNAL(securedConnection()), this, SLOT(securedConnection()));
   sslLabel->setPixmap(QPixmap());
   statusBar()->addPermanentWidget(sslLabel);
   sslLabel->hide();
@@ -553,8 +552,11 @@ void MainWin::setConnectedState() {
   if(!Client::internalCore())
     statusBar()->showMessage(tr("Connected to core."));
 
-  if(sslLabel->width() == 0)
+  if(Client::signalProxy()->isSecure()) {
+    sslLabel->setPixmap(SmallIcon("security-high"));
+  } else {
     sslLabel->setPixmap(SmallIcon("security-low"));
+  }
 
   sslLabel->setVisible(!Client::internalCore());
   coreLagLabel->setVisible(!Client::internalCore());
@@ -582,12 +584,6 @@ void MainWin::updateLagIndicator(int lag) {
   coreLagLabel->setText(text);
 }
 
-
-void MainWin::securedConnection() {
-  // todo: make status bar entry
-  sslLabel->setPixmap(SmallIcon("security-high"));
-}
-
 void MainWin::disconnectedFromCore() {
   // save core specific layout and remove bufferviews;
   saveLayout();
index c293a90..e3fdb61 100644 (file)
@@ -86,7 +86,6 @@ class MainWin
     void connectedToCore();
     void setConnectedState();
     void updateLagIndicator(int lag = -1);
-    void securedConnection();
     void disconnectedFromCore();
     void setDisconnectedState();
     void systrayActivated(QSystemTrayIcon::ActivationReason);