Summary: | kmix window does not minimize from system tray icon | ||
---|---|---|---|
Product: | [Applications] kmix | Reporter: | ndeb |
Component: | general | Assignee: | schimmi |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | 1.90 | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: |
Description
ndeb
2003-03-31 01:05:07 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. 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 |