Index: ksystemtray.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdeui/ksystemtray.cpp,v
retrieving revision 1.20
diff -u -U5 -r1.20 ksystemtray.cpp
--- ksystemtray.cpp	2002/04/11 01:05:13	1.20
+++ ksystemtray.cpp	2002/06/19 08:37:47
@@ -61,18 +61,20 @@
 
 void KSystemTray::showEvent( QShowEvent * )
 {
     if ( !hasQuit ) {
 	menu->insertSeparator();
+	int quitID;
 	if ( parentWidget() ) {
 	    minimizeRestoreId = menu->insertItem(i18n("Minimize"), this, SLOT( toggleMinimizeRestore() ) );
-	    menu->insertItem(SmallIcon("exit"), i18n("&Quit"), parentWidget(), SLOT(close() ) );
+	    quitID=menu->insertItem(SmallIcon("exit"), i18n("&Quit"), parentWidget(), SLOT(close() ) );
 	}
 	else {
 	    minimizeRestoreId = -1;
-	    menu->insertItem(SmallIcon("exit"), i18n("&Quit"), qApp, SLOT(closeAllWindows() ) );
+	    quitID=menu->insertItem(SmallIcon("exit"), i18n("&Quit"), qApp, SLOT(closeAllWindows() ) );
 	}
+	menu->connectItem(quitID,this,SIGNAL(quitSelected()));
 	hasQuit = 1;
     }
 }
 
 void KSystemTray::enterEvent( QEvent* )
@@ -156,10 +158,15 @@
 	KWin::setActiveWindow( parentWidget()->winId() );
 #endif
     } else {
 	parentWidget()->hide();
     }
+}
+
+void KSystemTray::reEmitQuit()
+{
+    emit quitSelected();
 }
 
 void KSystemTray::virtual_hook( int, void* )
 { /*BASE::virtual_hook( id, data );*/ }
 
Index: ksystemtray.h
===================================================================
RCS file: /home/kde/kdelibs/kdeui/ksystemtray.h,v
retrieving revision 1.5
diff -u -U5 -r1.5 ksystemtray.h
--- ksystemtray.h	2002/03/04 00:51:51	1.5
+++ ksystemtray.h	2002/06/19 08:37:47
@@ -123,13 +123,20 @@
     
     /**
        Reimplemented for internal reasons.
      */
     void enterEvent( QEvent* );
-    
+
+signals:
+    /**
+      Emitted when quit is selected in the menu. If you want to perform any other
+      action than to close the main application window please connect to this signal.
+    */
+    void quitSelected();
+
 private slots:
     void toggleMinimizeRestore();
 
 private:
     KPopupMenu* menu;
     int minimizeRestoreId;
