Index: ksystemtray.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdeui/ksystemtray.cpp,v
retrieving revision 1.20
diff -u -U10 -r1.20 ksystemtray.cpp
--- ksystemtray.cpp	2002/04/11 01:05:13	1.20
+++ ksystemtray.cpp	2002/06/18 12:11:51
@@ -56,28 +56,30 @@
 KSystemTray::~KSystemTray()
 {
 
 }
 
 
 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,SLOT(reEmitQuit()));
 	hasQuit = 1;
     }
 }
 
 void KSystemTray::enterEvent( QEvent* )
 {
 #ifndef Q_WS_QWS
     // FIXME(E): Implement for Qt Embedded
     if ( !qApp->focusWidget() ) {
 	XEvent ev;
@@ -151,17 +153,22 @@
 	parentWidget()->move( info.geometry.topLeft() );
 #endif
 	parentWidget()->show();
 #ifndef Q_WS_QWS //FIXME
         KWin::deIconifyWindow( parentWidget()->winId() );
 	KWin::setActiveWindow( parentWidget()->winId() );
 #endif
     } else {
 	parentWidget()->hide();
     }
+}
+
+void KSystemTray::reEmitQuit()
+{
+    emit quitSelected();
 }
 
 void KSystemTray::virtual_hook( int, void* )
 { /*BASE::virtual_hook( id, data );*/ }
 
 #include "ksystemtray.moc"
 #include "kdockwindow.moc"
Index: ksystemtray.h
===================================================================
RCS file: /home/kde/kdelibs/kdeui/ksystemtray.h,v
retrieving revision 1.5
diff -u -U10 -r1.5 ksystemtray.h
--- ksystemtray.h	2002/03/04 00:51:51	1.5
+++ ksystemtray.h	2002/06/18 12:11:51
@@ -119,23 +119,30 @@
     /**
        Reimplemented for internal reasons.
      */
     void showEvent( QShowEvent * );
     
     /**
        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(void);
+
 private slots:
     void toggleMinimizeRestore();
-
+    void reEmitQuit();
 private:
     KPopupMenu* menu;
     int minimizeRestoreId;
     uint hasQuit :1;
 protected:
     virtual void virtual_hook( int id, void* data );
 private:
     KSystemTrayPrivate* d;
 };
 
