fixes #484 - issues with ssl status indicator
[quassel.git] / src / qtui / mainwin.cpp
index fcd854e..78f8d38 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2005-08 by the Quassel Project                          *
+ *   Copyright (C) 2005-09 by the Quassel Project                          *
  *   devel@quassel-irc.org                                                 *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
@@ -458,13 +458,12 @@ void MainWin::setupStatusBar() {
   connect(Client::messageProcessor(), SIGNAL(progressUpdated(int, int)), msgProcessorStatusWidget, SLOT(setProgress(int, int)));
 
   // Core Lag:
-  updateLagIndicator(0);
+  updateLagIndicator();
   statusBar()->addPermanentWidget(coreLagLabel);
   coreLagLabel->hide();
   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());
@@ -574,13 +576,12 @@ void MainWin::saveLayout() {
 }
 
 void MainWin::updateLagIndicator(int lag) {
-  coreLagLabel->setText(QString(tr("Core Lag: %1 msec")).arg(lag));
-}
-
-
-void MainWin::securedConnection() {
-  // todo: make status bar entry
-  sslLabel->setPixmap(SmallIcon("security-high"));
+  QString text = tr("Core Lag: %1");
+  if(lag == -1)
+    text = text.arg('-');
+  else
+    text = text.arg("%1 msec").arg(lag);
+  coreLagLabel->setText(text);
 }
 
 void MainWin::disconnectedFromCore() {
@@ -614,6 +615,7 @@ void MainWin::setDisconnectedState() {
   statusBar()->showMessage(tr("Not connected to core."));
   sslLabel->setPixmap(QPixmap());
   sslLabel->hide();
+  updateLagIndicator();
   coreLagLabel->hide();
   updateIcon();
 }