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

List:       kde-commits
Subject:    KDE/kdebase/workspace/plasma/applets/kickoff/ui
From:       Aaron J. Seigo <aseigo () kde ! org>
Date:       2007-10-24 4:44:01
Message-ID: 1193201041.374538.5540.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 728735 by aseigo:

only send left/right key events up if the search edit is empty. very annoying to hit \
left/right one too many times (or just holding it down to get to the start/end) and \
have the active view change on you. arg!


 M  +5 -11     searchbar.cpp  


--- trunk/KDE/kdebase/workspace/plasma/applets/kickoff/ui/searchbar.cpp \
#728734:728735 @@ -85,22 +85,16 @@
 }
 bool SearchBar::eventFilter(QObject *watched,QEvent *event)
 {
-    // left and right arrow key presses in the search edit which will
-    // have no effect (because the cursor is already at the start or 
-    // end of the text) are propagated up to the parent widget
-    //
+    // left and right arrow key presses in the search edit when the
+    // edit is empty are propagated up to the parent widget
     // this allows views in the Launcher to use left and right arrows for
     // navigation whilst the search bar still has the focus
     if (watched == d->editWidget && event->type() == QEvent::KeyPress) {
-        QKeyEvent *keyEvent = (QKeyEvent*)event;
-        if (keyEvent->key() == Qt::Key_Left && d->editWidget->cursorPosition()==0) {
+        QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
+        if ((keyEvent->key() == Qt::Key_Left || keyEvent->key() == Qt::Key_Right) &&
+            d->editWidget->text().isEmpty()) {
             QCoreApplication::sendEvent(this,event);
             return true;
-
-        } else if (keyEvent->key() == Qt::Key_Right &&
-                   d->editWidget->cursorPosition() == \
                d->editWidget->text().length()) {
-            QCoreApplication::sendEvent(this,event);
-            return true;
         }
     }
     return false; 


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

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