[PATCH] kicker clock applet closeable with ESC key

Helge Deller deller at gmx.de
Tue Oct 8 22:23:22 BST 2002


The following small patch adds a usability feature to close the
datepicker applet (which is opened by left-clicking on the kicker clock)
with simply pressing the ESC key.

/me uses the clock and date applet a lot at work and moving the mouse to the
 small "X" or pressing Alt-F4 to close the applet just take too long....

OK to commit ?

Helge
-------------- next part --------------
Index: datepicker.cpp
===================================================================
RCS file: /home/kde/kdebase/kicker/applets/clock/datepicker.cpp,v
retrieving revision 1.1
diff -u -p -r1.1 datepicker.cpp
--- datepicker.cpp	2002/05/23 14:26:16	1.1
+++ datepicker.cpp	2002/10/08 21:19:35
@@ -39,3 +39,10 @@ DatePicker::DatePicker(QWidget *parent)
     setCaption(i18n("Calendar"));
     setIcon(SmallIcon("date"));
 }
+
+void DatePicker::keyReleaseEvent(QKeyEvent *e)
+{
+	DATEPICKER_INHERITED::keyReleaseEvent(e);
+	if (e->key() == Qt::Key_Escape)
+		close();
+}
Index: datepicker.h
===================================================================
RCS file: /home/kde/kdebase/kicker/applets/clock/datepicker.h,v
retrieving revision 1.1
diff -u -p -r1.1 datepicker.h
--- datepicker.h	2002/05/23 14:26:16	1.1
+++ datepicker.h	2002/10/08 21:19:35
@@ -28,12 +28,14 @@ CONNECTION WITH THE SOFTWARE OR THE USE 
 
 class KDatePicker;
 
+#define DATEPICKER_INHERITED  QVBox
 class DatePicker : public QVBox
 {
 public:
 	DatePicker(QWidget*);
 private:
 	KDatePicker *picker;
+	void keyReleaseEvent(QKeyEvent *e);
 };
 	
 #endif


More information about the kde-core-devel mailing list