[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: Behaviour of KSystemTray Quit
From:       Henrik Johnson <hpj () globecom ! se>
Date:       2002-06-19 8:43:46
[Download RAW message or body]

Sorry, this doesn't compile I screwed up... This one should work better.

/Mauritz
Underscore AB

Henrik Johnson wrote:

> I had no idea that you could connect signals to other signals, but 
> apparently you can (I just tested it). Applied a new patch, is this ok?
>
> /Mauritz
> Underscore AB
>
> Hans Meine wrote:
>
>> AFAIK you can directly
>> menu->connectItem(quitID,this,SIGNAL(quitSelected()));
>>
>>  
>>


["ksystray.patch" (text/plain)]

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:48:39
@@ -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* )
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:48:39
@@ -123,11 +123,18 @@
     
     /**
        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;



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic