Bug 103596 - Requesting quit from tray icon displays docking message
Summary: Requesting quit from tray icon displays docking message
Status: RESOLVED FIXED
Alias: None
Product: akregator
Classification: Applications
Component: general (show other bugs)
Version: 1.0
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
: 104097 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-04-10 11:16 UTC by N.Cat
Modified: 2005-05-16 09:50 UTC (History)
1 user (show)

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 N.Cat 2005-04-10 11:16:42 UTC
Version:           1.0 (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc version 3.3.6 20050123 (prerelease) 
OS:                Linux

Selecting Quit from Akregator's system tray menu will produce an erroneous informational messagebox stating Akregator is "Docking in System Tray" - the same message produced by closing the main window normally.

(This is not Bug #101743 - which is the new quit confirmation dialog).

The problem is due to a quirk of the KSystemTray widget. It's now documented in the kdelibs TODO ("Make KSystemTray's Quit option in the context menu call kapp->quit() instead of closing all windows"...).

The workaround would be to delete the system tray in the function called while exiting the app (looks like queryExit()), so it doesn't try to close the main window. I applied this to Kaffeine several months ago.
Comment 1 Frank Osterfeld 2005-04-22 22:53:09 UTC
*** Bug 104097 has been marked as a duplicate of this bug. ***
Comment 2 Frank Osterfeld 2005-05-16 09:35:07 UTC
SVN commit 414502 by osterfeld:

Don't display "running in systray" message when exiting from systray
BUG: 103596


 M  +2 -2      trunk/KDE/kdepim/akregator/src/Makefile.am  
 M  +23 -9     trunk/KDE/kdepim/akregator/src/akregator.cpp  
 M  +6 -1      trunk/KDE/kdepim/akregator/src/akregator.h  
 M  +10 -15    trunk/KDE/kdepim/akregator/src/akregator_part.cpp  
 M  +4 -8      trunk/KDE/kdepim/akregator/src/akregator_part.h  
 M  +17 -3     trunk/KDE/kdepim/akregator/src/trayicon.cpp  
 M  +5 -0      trunk/KDE/kdepim/akregator/src/trayicon.h  
Comment 3 Frank Osterfeld 2005-05-16 09:50:27 UTC
SVN commit 414506 by osterfeld:

backport 103596 (Don't show "running in systray" box when quitting from systray)
CCBUG: 103596


 M  +1 -0      branches/KDE/3.4/kdepim/akregator/ChangeLog  
 M  +1 -2      branches/KDE/3.4/kdepim/akregator/src/Makefile.am  
 M  +10 -2     branches/KDE/3.4/kdepim/akregator/src/akregator.cpp  
 M  +4 -0      branches/KDE/3.4/kdepim/akregator/src/akregator.h  
 M  +5 -0      branches/KDE/3.4/kdepim/akregator/src/akregator_part.cpp  
 M  +2 -0      branches/KDE/3.4/kdepim/akregator/src/akregator_part.h  


--- branches/KDE/3.4/kdepim/akregator/ChangeLog #414505:414506
@@ -9,6 +9,7 @@
        - Changed prev/next unread article actions to cycle through all unread articles -fo	
        
 Bug fixes:
+        - Don't show "running in systray" message box when quitting from systray (#105396) -fo
 	- make BrowserRun delete itself when the Viewer gets destroyed (#101413) -tpr
         - tolerate leading and trailing whitespace in the Add Feed Dialog (#101988) -fo
         - fixed confusion of "disable archiving" and expiry by age (#101907) -fo
--- branches/KDE/3.4/kdepim/akregator/src/Makefile.am #414505:414506
@@ -39,7 +39,7 @@
 
 # this is a lib shared by both the KPart and the main application
 lib_LTLIBRARIES = libakregatorprivate.la
-libakregatorprivate_la_SOURCES = akregatorconfig.kcfgc aboutdata.cpp
+libakregatorprivate_la_SOURCES = akregatorconfig.kcfgc aboutdata.cpp trayicon.cpp
 libakregatorprivate_la_LDFLAGS = $(all_libraries) -avoid-version -no-undefined
 libakregatorprivate_la_LIBADD = $(top_builddir)/akregator/src/librss/librsslocal.la $(LIB_KHTML)
 
@@ -95,7 +95,6 @@
 	settings_general.ui \
 	settings_archive.ui \
 	settings_browser.ui \
-	trayicon.cpp \
 	feediconmanager.skel \
 	akregator_partiface.skel \
 	akregator_part.cpp \
--- branches/KDE/3.4/kdepim/akregator/src/akregator.cpp #414505:414506
@@ -26,12 +26,14 @@
 #include "akregator.h"
 #include "akregator_part.h"
 #include "akregatorconfig.h"
+#include "trayicon.h"
 
 //settings
 
 #include <dcopclient.h>
 
 #include <kaction.h>
+#include <kapplication.h>
 #include <kconfig.h>
 #include <kdebug.h>
 #include <kedittoolbar.h>
@@ -116,7 +118,7 @@
             setCentralWidget(m_part->widget());
 
             connect(m_part, SIGNAL(setWindowCaption (const QString &)), this, SLOT(setCaption (const QString &)));
-
+            connect(m_part->trayIcon(), SIGNAL(quitSelected()), this, SLOT(slotQuit()));
             // and integrate the part's GUI with the shell's
             connectActionCollection(m_part->actionCollection());
             createGUI(m_part);
@@ -212,6 +214,12 @@
 }
 
 
+void MainWindow::slotQuit()
+{
+    if (m_part->trayIcon())
+        m_part->trayIcon()->hide();
+    kapp->quit();
+}
 
 void MainWindow::applyNewToolbarConfig()
 {
@@ -245,7 +253,7 @@
 
 bool MainWindow::queryClose()
 {
-    if ( kapp->sessionSaving() || !m_part->isTrayIconEnabled() )
+    if ( kapp->sessionSaving() || m_part->trayIcon() == 0 || m_part->trayIcon()->isHidden() )
          return true;
     else
     {
--- branches/KDE/3.4/kdepim/akregator/src/akregator.h #414505:414506
@@ -120,6 +120,10 @@
      */
     virtual bool queryClose(); 
 
+protected slots:
+
+    void slotQuit();
+
 private:
      void setupActions();
     void connectActionCollection(KActionCollection *coll);
--- branches/KDE/3.4/kdepim/akregator/src/akregator_part.cpp #414505:414506
@@ -541,6 +541,11 @@
     return Settings::showTrayIcon();
 }
 
+TrayIcon* Part::trayIcon()
+{
+    return m_trayIcon;
+}
+
 QPixmap Part::takeTrayIconScreenshot() const
 {
     return m_trayIcon->takeScreenshot();
--- branches/KDE/3.4/kdepim/akregator/src/akregator_part.h #414505:414506
@@ -142,6 +142,8 @@
              @return Screenshot of the trayicon */
             virtual QPixmap takeTrayIconScreenshot() const;
 
+            virtual TrayIcon* trayIcon();
+
             /** merges a nested part's GUI into the gui of this part
             @return true iff merging was successful, i.e. the GUI factory was not NULL */
             virtual bool mergePart(KParts::Part*);