Add server info to menu
authorDaniel Kesselberg <mail@danielkesselberg.de>
Tue, 1 Oct 2019 14:08:31 +0000 (16:08 +0200)
committerDaniel Kesselberg <mail@danielkesselberg.de>
Tue, 1 Oct 2019 14:16:20 +0000 (16:16 +0200)
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
src/gui/sslbutton.cpp

index ffa0228a87c0b41091cb5838f236e7eba2b1d160..98db319e610be6044f7eaeef1bf9b527670f69d7 100644 (file)
@@ -37,6 +37,7 @@ SslButton::SslButton(QWidget *parent)
     _menu = new QMenu(this);
     QObject::connect(_menu, &QMenu::aboutToShow,
         this, &SslButton::slotUpdateMenu);
+    setMenu(_menu);
 }
 
 static QString addCertDetailsField(const QString &key, const QString &value)
@@ -171,11 +172,9 @@ void SslButton::updateAccountState(AccountState *accountState)
         setIcon(QIcon(QLatin1String(":/client/resources/lock-https.png")));
         QSslCipher cipher = account->_sessionCipher;
         setToolTip(tr("This connection is encrypted using %1 bit %2.\n").arg(cipher.usedBits()).arg(cipher.name()));
-        setMenu(_menu);
     } else {
         setIcon(QIcon(QLatin1String(":/client/resources/lock-http.png")));
         setToolTip(tr("This connection is NOT secure as it is not encrypted.\n"));
-        setMenu(nullptr);
     }
 }
 
@@ -189,6 +188,8 @@ void SslButton::slotUpdateMenu()
 
     AccountPtr account = _accountState->account();
 
+    _menu->addAction(tr("Server version: %1").arg(account->serverVersion()))->setEnabled(false);
+
     if (account->isHttp2Supported()) {
         _menu->addAction("HTTP/2")->setEnabled(false);
     }
@@ -239,6 +240,8 @@ void SslButton::slotUpdateMenu()
             _menu->addMenu(buildCertMenu(_menu, it.previous(), account->approvedCerts(), i, systemCerts));
             i++;
         }
+    } else {
+        _menu->addAction(tr("The connection is not secure"))->setEnabled(false);
     }
 }