[Pkg-owncloud-commits] [owncloud-client] 52/218: Tray: Clicks work even with Qt 5.5.0 workaround #3722

Sandro Knauß hefee-guest at moszumanska.debian.org
Sat Oct 17 14:30:41 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 d8939184db9744424e33deaebe2b7c3885e38d2d
Author: Christian Kamm <kamm at incasoftware.de>
Date:   Wed Sep 2 11:10:01 2015 +0200

    Tray: Clicks work even with Qt 5.5.0 workaround #3722
---
 src/gui/application.cpp |  2 +-
 src/gui/owncloudgui.cpp | 43 +++++++++++++++++++++++++++----------------
 src/gui/owncloudgui.h   |  2 +-
 3 files changed, 29 insertions(+), 18 deletions(-)

diff --git a/src/gui/application.cpp b/src/gui/application.cpp
index 7810267..36b4c00 100644
--- a/src/gui/application.cpp
+++ b/src/gui/application.cpp
@@ -229,7 +229,7 @@ void Application::slotCheckConnection()
 
     if (list.isEmpty()) {
         // let gui open the setup wizard
-        _gui->slotOpenSettingsDialog( true );
+        _gui->slotOpenSettingsDialog();
 
         _checkConnectionTimer.stop(); // don't popup the wizard on interval;
     }
diff --git a/src/gui/owncloudgui.cpp b/src/gui/owncloudgui.cpp
index 4df744d..6281630 100644
--- a/src/gui/owncloudgui.cpp
+++ b/src/gui/owncloudgui.cpp
@@ -42,6 +42,16 @@
 #include <QX11Info>
 #endif
 
+// Enables workarounds for bugs introduced in Qt 5.5.0
+// In particular QTBUG-47863 #3672 (tray menu fails to update and
+// becomes unresponsive) and QTBUG-48068 #3722 (click signal is
+// emitted several times)
+#ifdef Q_OS_LINUX
+#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)
+#define WORKAROUND_QT_TRAY_DBUS
+#endif
+#endif
+
 namespace OCC {
 
 const char propertyAccountC[] = "oc_account";
@@ -145,16 +155,14 @@ void ownCloudGui::setupOverlayIcons()
 }
 
 // This should rather be in application.... or rather in ConfigFile?
-void ownCloudGui::slotOpenSettingsDialog( bool openSettings )
+void ownCloudGui::slotOpenSettingsDialog()
 {
     // if account is set up, start the configuration wizard.
     if( !AccountManager::instance()->accounts().isEmpty() ) {
-        if( openSettings ) {
-            if (_settingsDialog.isNull() || !_settingsDialog->isVisible()) {
-                slotShowSettings();
-            } else {
-                _settingsDialog->close();
-            }
+        if (_settingsDialog.isNull() || !_settingsDialog->isVisible()) {
+            slotShowSettings();
+        } else {
+            _settingsDialog->close();
         }
     } else {
         qDebug() << "No configured folders yet, starting setup wizard";
@@ -164,11 +172,20 @@ void ownCloudGui::slotOpenSettingsDialog( bool openSettings )
 
 void ownCloudGui::slotTrayClicked( QSystemTrayIcon::ActivationReason reason )
 {
+#ifdef WORKAROUND_QT_TRAY_DBUS
+    static QElapsedTimer last_click;
+    if (last_click.isValid() && last_click.elapsed() < 200) {
+        return;
+    }
+    last_click.start();
+#endif
+
     // A click on the tray icon should only open the status window on Win and
     // Linux, not on Mac. They want a menu entry.
 #if !defined Q_OS_MAC
     if( reason == QSystemTrayIcon::Trigger ) {
-        slotOpenSettingsDialog(true); // start settings if config is existing.
+        // Start settings if config is existing.
+        slotOpenSettingsDialog();
     }
 #else
     // On Mac, if the settings dialog is already visible but hidden
@@ -368,12 +385,9 @@ void ownCloudGui::setupContextMenu()
         }
     }
 
-    // Workaround for #3656, Qt 5.5.0 + dbus based tray integration.
-#ifdef Q_OS_LINUX
-#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)
+#ifdef WORKAROUND_QT_TRAY_DBUS
     _tray->hide();
 #endif
-#endif
 
     if ( _contextMenu ) {
         _contextMenu->clear();
@@ -438,12 +452,9 @@ void ownCloudGui::setupContextMenu()
     }
     _contextMenu->addAction(_actionQuit);
 
-    // Workaround for #3656, Qt 5.5.0 + dbus based tray integration.
-#ifdef Q_OS_LINUX
-#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)
+#ifdef WORKAROUND_QT_TRAY_DBUS
     _tray->show();
 #endif
-#endif
 }
 
 
diff --git a/src/gui/owncloudgui.h b/src/gui/owncloudgui.h
index 003c6b1..3f4e09f 100644
--- a/src/gui/owncloudgui.h
+++ b/src/gui/owncloudgui.h
@@ -72,7 +72,7 @@ public slots:
     void slotTrayClicked( QSystemTrayIcon::ActivationReason reason );
     void slotToggleLogBrowser();
     void slotOpenOwnCloud();
-    void slotOpenSettingsDialog( bool openSettings );
+    void slotOpenSettingsDialog();
     void slotHelp();
     void slotOpenPath(const QString& path);
     void slotAccountStateChanged();

-- 
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