[Pkg-owncloud-commits] [owncloud-client] 229/498: SslButton: Only show menu when info is available.

Sandro Knauß hefee-guest at moszumanska.debian.org
Tue Aug 11 14:48:53 UTC 2015


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 1b31f45435ff2643272ee2d0f0b66dea6a5600d5
Author: Christian Kamm <kamm at incasoftware.de>
Date:   Thu Jul 2 10:49:18 2015 +0200

    SslButton: Only show menu when info is available.
    
    For unencrypted connections there used to be a small arrow indicating
    that more information was available, but clicking the button had no
    effect. That indicator is now gone because we unset the SslButton's
    menu for these cases.
---
 src/gui/sslbutton.cpp | 12 +++++++-----
 src/gui/sslbutton.h   |  1 +
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/gui/sslbutton.cpp b/src/gui/sslbutton.cpp
index 11b6288..133c902 100644
--- a/src/gui/sslbutton.cpp
+++ b/src/gui/sslbutton.cpp
@@ -32,8 +32,8 @@ SslButton::SslButton(QWidget *parent) :
     setPopupMode(QToolButton::InstantPopup);
     setAutoRaise(true);
 
-    setMenu(new QMenu(this));
-    QObject::connect(menu(), SIGNAL(aboutToShow()),
+    _menu = new QMenu(this);
+    QObject::connect(_menu, SIGNAL(aboutToShow()),
                      this, SLOT(slotUpdateMenu()));
 }
 
@@ -190,14 +190,16 @@ void SslButton::updateAccountState(AccountState *accountState)
         setIcon(QIcon(pm));
         QSslCipher cipher = account->sslConfiguration().sessionCipher();
         setToolTip(tr("This connection is encrypted using %1 bit %2.\n").arg(cipher.usedBits()).arg(cipher.name()));
+        setMenu(_menu);
     } else {
         setIcon(QIcon(QPixmap(Theme::hidpiFileName(":/client/resources/lock-http.png"))));
         setToolTip(tr("This connection is NOT secure as it is not encrypted.\n"));
+        setMenu(nullptr);
     }
 }
 
 void SslButton::slotUpdateMenu() {
-    menu()->clear();
+    _menu->clear();
 
     if (!_accountState) {
         return;
@@ -214,7 +216,7 @@ void SslButton::slotUpdateMenu() {
             return;
         }
 
-        menu()->addAction(tr("Certificate information:"))->setEnabled(false);
+        _menu->addAction(tr("Certificate information:"))->setEnabled(false);
 
         QList<QSslCertificate> tmpChain;
         foreach(QSslCertificate cert, chain) {
@@ -237,7 +239,7 @@ void SslButton::slotUpdateMenu() {
         it.toBack();
         int i = 0;
         while (it.hasPrevious()) {
-            menu()->addMenu(buildCertMenu(menu(), it.previous(), account->approvedCerts(), i));
+            _menu->addMenu(buildCertMenu(_menu, it.previous(), account->approvedCerts(), i));
             i++;
         }
     }
diff --git a/src/gui/sslbutton.h b/src/gui/sslbutton.h
index b201805..6de7999 100644
--- a/src/gui/sslbutton.h
+++ b/src/gui/sslbutton.h
@@ -45,6 +45,7 @@ private:
     QMenu* buildCertMenu(QMenu *parent, const QSslCertificate& cert,
                          const QList<QSslCertificate>& userApproved, int pos);
     QPointer<AccountState> _accountState;
+    QMenu* _menu;
 };
 
 } // namespace OCC

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list