telutils/dialpad/src/dialpadhasheventfilter.cpp
changeset 33 8d5d7fcf9b59
parent 32 1f002146abb4
--- a/telutils/dialpad/src/dialpadhasheventfilter.cpp	Tue Jul 06 14:53:02 2010 +0300
+++ b/telutils/dialpad/src/dialpadhasheventfilter.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -38,20 +38,18 @@
     Q_UNUSED(watched)
     bool keyEventEaten(false);
 
-    QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
-    const int keyCode = keyEvent->key();
-    const int eventType = event->type();
-        
-    if (eventType == QEvent::KeyPress) {
-        if ((isLongKeyPressSupported(keyCode)) &&
-                !(mDialpad->editor().text().length() >= 1)) {
+    if (event->type() == QEvent::KeyPress) {
+        QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);        
+        if ((isLongKeyPressSupported(keyEvent->key())) &&
+            !(mDialpad->editor().text().length() >= 1)) {
             //Check that there is only one item in dialpad, if there is more than one
             //do not handle long key press.
             mLongPressTimer->stop();
             mLongPressTimer->start(DialpadLongKeyPressTimeOut);
         }
-    } else if (eventType == QEvent::KeyRelease) {
-        if (isLongKeyPressSupported(keyCode)){
+    } else if (event->type() == QEvent::KeyRelease) {
+        QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
+        if (isLongKeyPressSupported(keyEvent->key())){
             mLongPressTimer->stop();
         }
     }