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

List:       kde-core-devel
Subject:    [PATCH] KLineEdit pasting problems (#39181)
From:       Scott Wheeler <scott () slackorama ! net>
Date:       2002-03-12 6:25:27
[Download RAW message or body]

Well, actually it's a problem with all cut, copy, paste, etc.  

The problem is that KLineEdit was doing something like:

if ( KStdAccel::copy().contains( key ) )
   copy();

[...]

and then at the end of the keyPressEvent() method:

QLineEdit::keyPressEvent ( e );

Which passes the key to QLineEdit to repeat the action (assuming they use the 
same accelerator).  This was most noticeable when paste() happened twice.  
The following patch adds a return to each of the event tests.  This is how 
all of the other events are handled.

-Scott
["klineedit.cpp.patch" (text/x-diff)]

--- klineedit.cpp.back	Tue Mar 12 01:17:42 2002
+++ klineedit.cpp	Tue Mar 12 01:18:54 2002
@@ -173,16 +173,26 @@
 {
     KKey key( e );
 
-    if ( KStdAccel::copy().contains( key ) )
+    if ( KStdAccel::copy().contains( key ) ) {
         copy();
-    else if ( KStdAccel::paste().contains( key ) )
+	return;
+    }
+    else if ( KStdAccel::paste().contains( key ) ) {
         paste();
-    else if ( KStdAccel::cut().contains( key ) )
+	return;
+    }
+    else if ( KStdAccel::cut().contains( key ) ) {
         cut();
-    else if ( KStdAccel::undo().contains( key ) )
+	return;
+    }
+    else if ( KStdAccel::undo().contains( key ) ) {
         undo();
-    else if ( KStdAccel::redo().contains( key ) )
+	return;
+    }
+    else if ( KStdAccel::redo().contains( key ) ) {
         redo();
+	return;
+    }
     else if ( KStdAccel::deleteWordBack().contains( key ) )
     {
         cursorWordBackward(TRUE);


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

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