[Pkg-running-devel] [openambit] 90/131: Avoid "docking" mode if no systray is present

Christian Perrier bubulle at moszumanska.debian.org
Thu Jul 17 20:19:14 UTC 2014


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

bubulle pushed a commit to branch master
in repository openambit.

commit c4f17935e7130d6ba68817bcfb0ed2108e49b8fd
Author: Emil Ljungdahl <emil at kratern.se>
Date:   Sat Feb 15 15:51:58 2014 +0100

    Avoid "docking" mode if no systray is present
---
 src/openambit/mainwindow.cpp | 13 +++++++++----
 src/openambit/mainwindow.h   |  2 ++
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/openambit/mainwindow.cpp b/src/openambit/mainwindow.cpp
index 13aa1b4..d91fa81 100644
--- a/src/openambit/mainwindow.cpp
+++ b/src/openambit/mainwindow.cpp
@@ -134,7 +134,7 @@ void MainWindow::singleApplicationMsgRecv(QString msg)
 {
     if (msg == "focus") {
         // Another instance of application has asked use to gain focus, let's do so!
-        if (isHidden()) {
+        if (sysTraySupported() && isHidden()) {
             showHideWindow();
         }
         else {
@@ -147,7 +147,7 @@ void MainWindow::singleApplicationMsgRecv(QString msg)
 void MainWindow::changeEvent(QEvent *event)
 {
     if (event->type() == QEvent::WindowStateChange) {
-        if (isMinimized()) {
+        if (sysTraySupported() && isMinimized()) {
             QTimer::singleShot(0, this, SLOT(hide()));
         }
     }
@@ -168,7 +168,7 @@ void MainWindow::hideEvent(QHideEvent *event)
 
 void MainWindow::closeEvent(QCloseEvent *event)
 {
-    if (forceClose) {
+    if (!sysTraySupported() || forceClose) {
         trayIcon->setVisible(false);
         event->accept();
     }
@@ -186,7 +186,7 @@ void MainWindow::closeRequested()
 
 void MainWindow::showHideWindow()
 {
-    if (isHidden()) {
+    if (!sysTraySupported() || isHidden()) {
         showNormal();
     }
     else {
@@ -485,6 +485,11 @@ void MainWindow::movesCountSetup()
     settings.endGroup();
 }
 
+bool MainWindow::sysTraySupported()
+{
+    return QSystemTrayIcon::isSystemTrayAvailable();
+}
+
 MainWindow::LogMessageRow::LogMessageRow(QWidget *parent) :
     QHBoxLayout(parent)
 {
diff --git a/src/openambit/mainwindow.h b/src/openambit/mainwindow.h
index 496ca51..40c871b 100644
--- a/src/openambit/mainwindow.h
+++ b/src/openambit/mainwindow.h
@@ -87,6 +87,8 @@ private:
 
     void movesCountSetup();
 
+    bool sysTraySupported();
+
     Ui::MainWindow *ui;
     bool forceClose;
 

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



More information about the Pkg-running-devel mailing list