maybe clicking the tray icon toggles minimize to tray again. maybe it won't. maybe...
authorMarcus Eggenberger <egs@quassel-irc.org>
Tue, 20 Jan 2009 23:33:08 +0000 (00:33 +0100)
committerMarcus Eggenberger <egs@quassel-irc.org>
Tue, 20 Jan 2009 23:33:08 +0000 (00:33 +0100)
I didn't test it, as I don't want to mess up my settings. (meaning: it compiled but I didn't even started quassel afterwards)

src/qtui/mainwin.cpp
src/qtui/mainwin.h

index 4c39b12..cb33a01 100644 (file)
@@ -694,7 +694,7 @@ void MainWin::closeEvent(QCloseEvent *event) {
 
 void MainWin::systrayActivated(QSystemTrayIcon::ActivationReason activationReason) {
   if(activationReason == QSystemTrayIcon::Trigger) {
 
 void MainWin::systrayActivated(QSystemTrayIcon::ActivationReason activationReason) {
   if(activationReason == QSystemTrayIcon::Trigger) {
-    restoreFromTray();
+    toggleMinimizedToTray();
   }
 }
 
   }
 }
 
@@ -709,10 +709,15 @@ void MainWin::hideToTray() {
   systemTrayIcon()->show();
 }
 
   systemTrayIcon()->show();
 }
 
-void MainWin::restoreFromTray() {
-  setWindowState(windowState() & ~Qt::WindowMinimized | Qt::WindowActive);
-  show();
-  raise();
+void MainWin::toggleMinimizedToTray() {
+  if(windowState() & Qt::WindowMinimized) {
+    // restore
+    setWindowState(windowState() & ~Qt::WindowMinimized | Qt::WindowActive);
+    show();
+    raise();
+  } else {
+    setWindowState(windowState() & ~Qt::WindowActive | Qt::WindowMinimized);
+  }
 }
 
 void MainWin::messagesInserted(const QModelIndex &parent, int start, int end) {
 }
 
 void MainWin::messagesInserted(const QModelIndex &parent, int start, int end) {
index 59c0e2c..682b37b 100644 (file)
@@ -150,7 +150,7 @@ class MainWin
 
     void updateIcon();
     void hideToTray();
 
     void updateIcon();
     void hideToTray();
-    void restoreFromTray();
+    void toggleMinimizedToTray();
     void enableMenus();
 
     QSystemTrayIcon *_trayIcon;
     void enableMenus();
 
     QSystemTrayIcon *_trayIcon;