Bug 56641 - kmix window does not minimize from system tray icon
Summary: kmix window does not minimize from system tray icon
Status: RESOLVED FIXED
Alias: None
Product: kmix
Classification: Applications
Component: general (show other bugs)
Version: 1.90
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: schimmi
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-03-31 01:05 UTC by ndeb
Modified: 2003-04-03 18:12 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ndeb 2003-03-31 01:05:07 UTC
Version:           1.90 (using KDE 3.1.0)
Compiler:          gcc version 3.2.2 (Mandrake Linux 9.1 3.2.2-3mdk)
OS:          Linux (i686) release 2.4.21-0.13mdk

1. Start kmix. Make sure that the kmix icon appears in system tray.
2. Do not quit kmix but simply close the kmix window. Confirm that the system
tray still has kmix icon.
3. Right click on kmix icon on system tray. Select "Show mixer window". Kmix window reappears.
4. Right click on kmix icon on system tray. Select "Hide mixer window". The kmix window definitely does not minimize/vanish. Worse, if it was in the background, it comes to the foreground.
Comment 1 Thiago Macieira 2003-03-31 01:41:50 UTC
Confirm on HEAD 20030312 
 
If the mixer window has focus, selecting Hide Mixer Window hides it. If not, it gets 
raised and focused, as the reporter says. 
Comment 2 Lubos Lunak 2003-04-03 18:12:15 UTC
Subject: kdelibs/kdeui

CVS commit by lunakl: 

Fix #56641.
CCMAIL: 56641-done@bugs.kde.org


  M +26 -6     ksystemtray.cpp   1.26
  M +3 -1      ksystemtray.h   1.10


--- kdelibs/kdeui/ksystemtray.cpp  #1.25:1.26
@@ -84,5 +84,5 @@ KSystemTray::KSystemTray( QWidget* paren
         connect(quitAction, SIGNAL(activated()), parentWidget(), SLOT(close()));
         new KAction(i18n("Minimize"), KShortcut(),
-                    this, SLOT( toggleMinimizeRestore() ),
+                    this, SLOT( minimizeRestoreAction() ),
                     d->actionCollection, "minimizeRestore");
     }
@@ -149,5 +149,5 @@ void KSystemTray::mousePressEvent( QMous
     switch ( e->button() ) {
     case LeftButton:
-        toggleMinimizeRestore();
+        activateOrHide();
         break;
     case MidButton:
@@ -181,5 +179,19 @@ void KSystemTray::contextMenuAboutToShow
 }
 
-void KSystemTray::toggleMinimizeRestore()
+// called from the popup menu - always do what the menu entry says,
+// i.e. if the window is shown, no matter if active or not, the menu
+// entry is "minimize", otherwise it's "restore"
+void KSystemTray::minimizeRestoreAction()
+{
+    if ( parentWidget() ) {
+        bool restore = !( parentWidget()->isVisible() );
+        minimizeRestore( restore );
+    }
+}
+
+// called when left-clicking the tray icon
+// if the window is not the active one, show it if needed, and activate it
+// (just like taskbar); otherwise hide it
+void KSystemTray::activateOrHide()
 {
     QWidget *pw = parentWidget();
@@ -200,10 +212,18 @@ void KSystemTray::toggleMinimizeRestore(
         return;
     }
+    minimizeRestore( !visible );
+}
 
-    if ( !visible )
+void KSystemTray::minimizeRestore( bool restore )
+{
+    QWidget* pw = parentWidget();
+    if( !pw )
+        return;
+    if ( restore )
     {
 #ifndef Q_WS_QWS //FIXME
         // TODO what to do with OnAllDesktops windows? (#32783)
         KWin::setOnDesktop( pw->winId(), KWin::currentDesktop());
+        KWin::Info info = KWin::info( pw->winId() );
         pw->move( info.geometry.topLeft() ); // avoid placement policies
         pw->show();

--- kdelibs/kdeui/ksystemtray.h  #1.9:1.10
@@ -144,6 +144,8 @@ signals:
 
 private slots:
-    void toggleMinimizeRestore();
+    void minimizeRestoreAction();
 private:
+    void activateOrHide();
+    void minimizeRestore( bool restore );
     KPopupMenu* menu;
     // minimizeRestoreId is no longer needed. remove in KDE 4.0