here's the patch...

Ellis Whitehead ellis at kde.org
Wed Oct 2 16:03:04 BST 2002


On Tuesday 01 October 2002 16:59, Ellis Whitehead wrote:
> And here's the actual patch...

Commit or not to commit?  I leave any extention of accel overriding to konsole 
maintainers, but this shows how it needs to be done.

Cheers,
Ellis

Index: TEWidget.cpp
===================================================================
RCS file: /home/kde/kdebase/konsole/konsole/TEWidget.cpp,v
retrieving revision 1.166
diff -u -3 -d -p -b -B -r1.166 TEWidget.cpp
--- TEWidget.cpp	2002/08/24 21:43:35	1.166
+++ TEWidget.cpp	2002/10/01 14:12:38
@@ -1436,6 +1436,22 @@ bool TEWidget::eventFilter( QObject *obj
   return QFrame::eventFilter( obj, e );
 }
 
+// Override any accelerator with shortcut = Ctrl+D when pressed with the 
keyboard
+// focus in TEWidget, so that Ctrl+D will still work as 'exit'.
+bool TEWidget::event( QEvent *e )
+{
+  if ( e->type() == QEvent::AccelOverride )
+  {
+    QKeyEvent *ke = static_cast<QKeyEvent *>( e );
+    if ( ke->key() == Qt::Key_D && ke->state() == Qt::ControlButton )
+    {
+      ke->accept();
+      return true;
+    }
+  }
+  return QFrame::event( e );
+}
+
 /* ------------------------------------------------------------------------- 
*/
 /*                                                                           
*/
 /*                                  Frame                                    
*/
Index: TEWidget.h
===================================================================
RCS file: /home/kde/kdebase/konsole/konsole/TEWidget.h,v
retrieving revision 1.60
diff -u -3 -d -p -b -B -r1.60 TEWidget.h
--- TEWidget.h	2002/08/18 20:42:16	1.60
+++ TEWidget.h	2002/10/01 14:12:38
@@ -129,6 +129,7 @@ protected:
     virtual void styleChange( QStyle& );
 
     bool eventFilter( QObject *, QEvent * );
+    bool event( QEvent * );
 
     void drawAttrStr(QPainter &paint, QRect rect,
                      QString& str, ca attr, bool pm, bool clear);





More information about the kde-core-devel mailing list