src/hbplugins/inputmethods/common/hbinputnumerichandler.cpp
changeset 2 06ff229162e9
parent 0 16d8024aca5e
child 6 c3690ec91ef8
equal deleted inserted replaced
1:f7ac710697a9 2:06ff229162e9
    20 **
    20 **
    21 ** If you have questions regarding the use of this file, please contact
    21 ** If you have questions regarding the use of this file, please contact
    22 ** Nokia at developer.feedback@nokia.com.
    22 ** Nokia at developer.feedback@nokia.com.
    23 **
    23 **
    24 ****************************************************************************/
    24 ****************************************************************************/
       
    25 #include <hbinputbutton.h>
       
    26 
    25 #include "hbinputnumerichandler_p.h"
    27 #include "hbinputnumerichandler_p.h"
    26 #include "hbinputabstractbase.h"
    28 #include "hbinputabstractbase.h"
    27 
    29 
    28 HbInputNumericHandlerPrivate::HbInputNumericHandlerPrivate()
    30 HbInputNumericHandlerPrivate::HbInputNumericHandlerPrivate()
    29 {
    31 {
    51 bool HbInputNumericHandler::filterEvent(const QKeyEvent *event)
    53 bool HbInputNumericHandler::filterEvent(const QKeyEvent *event)
    52 {
    54 {
    53     bool ret = true;
    55     bool ret = true;
    54     switch (event->key()) {
    56     switch (event->key()) {
    55     case Qt::Key_Backspace:
    57     case Qt::Key_Backspace:
    56     case Qt::Key_Delete: {
    58     case HbInputButton::ButtonKeyCodeDelete: {
    57         QKeyEvent keyEvent(QEvent::KeyPress, Qt::Key_Backspace, Qt::NoModifier);
    59         QKeyEvent keyEvent(QEvent::KeyPress, Qt::Key_Backspace, Qt::NoModifier);
    58         sendAndUpdate(keyEvent);
    60         sendAndUpdate(keyEvent);
    59         // return false since the event is sent forward
    61         // return false since the event is sent forward
    60         ret = false;
    62         ret = false;
    61         break;
    63         break;
    62     }
    64     }
    63     case Qt::Key_Return:
    65     case HbInputButton::ButtonKeyCodeEnter:
    64     case Qt::Key_Enter:
    66     case HbInputButton::ButtonKeyCodeSpace:
    65     case Qt::Key_Space:
       
    66     case Qt::Key_Period:
    67     case Qt::Key_Period:
    67     case Qt::Key_Comma: {
    68     case Qt::Key_Comma: {
    68         QChar qc(event->key());
    69         QChar qc(event->key());
    69         if (qc == Qt::Key_Enter || qc == Qt::Key_Return) {
    70         if (qc == Qt::Key_Enter || qc == Qt::Key_Return) {
    70             qc = QChar('\n');  // Editor expects normal line feed.
    71             qc = QChar('\n');  // Editor expects normal line feed.