src/hbinput/inputwidgets/hbinputsctkeyboard.cpp
changeset 2 06ff229162e9
child 5 627c4a0fd0e7
equal deleted inserted replaced
1:f7ac710697a9 2:06ff229162e9
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (developer.feedback@nokia.com)
       
     6 **
       
     7 ** This file is part of the HbInput module of the UI Extensions for Mobile.
       
     8 **
       
     9 ** GNU Lesser General Public License Usage
       
    10 ** This file may be used under the terms of the GNU Lesser General Public
       
    11 ** License version 2.1 as published by the Free Software Foundation and
       
    12 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
       
    13 ** Please review the following information to ensure the GNU Lesser General
       
    14 ** Public License version 2.1 requirements will be met:
       
    15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    16 **
       
    17 ** In addition, as a special exception, Nokia gives you certain additional
       
    18 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    20 **
       
    21 ** If you have questions regarding the use of this file, please contact
       
    22 ** Nokia at developer.feedback@nokia.com.
       
    23 **
       
    24 ****************************************************************************/
       
    25 
       
    26 #include <math.h>
       
    27 
       
    28 #include <hbdeviceprofile.h>
       
    29 
       
    30 #include <hbinputmethod.h>
       
    31 #include <hbinputkeymap.h>
       
    32 #include <hbinpututils.h>
       
    33 #include <hbframedrawer.h>
       
    34 #include <hbinputsettingproxy.h>
       
    35 
       
    36 #include "hbinputsctkeyboard.h"
       
    37 #include "hbinputsctkeyboard_p.h"
       
    38 #include "hbinputbuttongroup.h"
       
    39 #include "hbinputbutton.h"
       
    40 
       
    41 const qreal HbPortraitKeyboardHeightInUnits = 46.8;
       
    42 const qreal HbPortraitKeyboardWidthInUnits = 53.8;
       
    43 const qreal HbLandscapeKeyboardHeightInUnits = 34.6;
       
    44 const qreal HbLandscapeKeyboardWidthInUnits = 95.5;
       
    45 
       
    46 const int HbSctPortraitNumberOfRows = 5;
       
    47 const int HbSctPortraitNumberOfColumns = 5;
       
    48 const int HbPortraitButtonKeyCodeTable[HbSctPortraitNumberOfRows * HbSctPortraitNumberOfColumns] =
       
    49 {
       
    50     HbInputButton::ButtonKeyCodeCharacter,
       
    51     HbInputButton::ButtonKeyCodeCharacter,
       
    52     HbInputButton::ButtonKeyCodeCharacter,
       
    53     HbInputButton::ButtonKeyCodeCharacter,
       
    54     HbInputButton::ButtonKeyCodeDelete,
       
    55     HbInputButton::ButtonKeyCodeCharacter,
       
    56     HbInputButton::ButtonKeyCodeCharacter,
       
    57     HbInputButton::ButtonKeyCodeCharacter,
       
    58     HbInputButton::ButtonKeyCodeCharacter,
       
    59     HbInputButton::ButtonKeyCodeAlphabet,
       
    60     HbInputButton::ButtonKeyCodeCharacter,
       
    61     HbInputButton::ButtonKeyCodeCharacter,
       
    62     HbInputButton::ButtonKeyCodeCharacter,
       
    63     HbInputButton::ButtonKeyCodeCharacter,
       
    64     HbInputButton::ButtonKeyCodePageChange,
       
    65     HbInputButton::ButtonKeyCodeCharacter,
       
    66     HbInputButton::ButtonKeyCodeCharacter,
       
    67     HbInputButton::ButtonKeyCodeCharacter,
       
    68     HbInputButton::ButtonKeyCodeCharacter,
       
    69     HbInputButton::ButtonKeyCodeSmiley,
       
    70     HbInputButton::ButtonKeyCodeCharacter,
       
    71     HbInputButton::ButtonKeyCodeCharacter,
       
    72     HbInputButton::ButtonKeyCodeCharacter,
       
    73     HbInputButton::ButtonKeyCodeCharacter,
       
    74     HbInputButton::ButtonKeyCodeCustom
       
    75 };
       
    76 
       
    77 const int HbSctLandscapeNumberOfRows = 4;
       
    78 const int HbSctLandscapeNumberOfColumns = 10;
       
    79 const int HbLandscapeButtonKeyCodeTable[HbSctLandscapeNumberOfRows * HbSctLandscapeNumberOfColumns] =
       
    80 {
       
    81     HbInputButton::ButtonKeyCodeCharacter,
       
    82     HbInputButton::ButtonKeyCodeCharacter,
       
    83     HbInputButton::ButtonKeyCodeCharacter,
       
    84     HbInputButton::ButtonKeyCodeCharacter,
       
    85     HbInputButton::ButtonKeyCodeCharacter,
       
    86     HbInputButton::ButtonKeyCodeCharacter,
       
    87     HbInputButton::ButtonKeyCodeCharacter,
       
    88     HbInputButton::ButtonKeyCodeCharacter,
       
    89     HbInputButton::ButtonKeyCodeCharacter,
       
    90     HbInputButton::ButtonKeyCodeSmiley,
       
    91     HbInputButton::ButtonKeyCodeCharacter,
       
    92     HbInputButton::ButtonKeyCodeCharacter,
       
    93     HbInputButton::ButtonKeyCodeCharacter,
       
    94     HbInputButton::ButtonKeyCodeCharacter,
       
    95     HbInputButton::ButtonKeyCodeCharacter,
       
    96     HbInputButton::ButtonKeyCodeCharacter,
       
    97     HbInputButton::ButtonKeyCodeCharacter,
       
    98     HbInputButton::ButtonKeyCodeCharacter,
       
    99     HbInputButton::ButtonKeyCodeCharacter,
       
   100     HbInputButton::ButtonKeyCodeDelete,
       
   101     HbInputButton::ButtonKeyCodeCharacter,
       
   102     HbInputButton::ButtonKeyCodeCharacter,
       
   103     HbInputButton::ButtonKeyCodeCharacter,
       
   104     HbInputButton::ButtonKeyCodeCharacter,
       
   105     HbInputButton::ButtonKeyCodeCharacter,
       
   106     HbInputButton::ButtonKeyCodeCharacter,
       
   107     HbInputButton::ButtonKeyCodeCharacter,
       
   108     HbInputButton::ButtonKeyCodeCharacter,
       
   109     HbInputButton::ButtonKeyCodeCharacter,
       
   110     HbInputButton::ButtonKeyCodeEnter,
       
   111     HbInputButton::ButtonKeyCodePageChange,
       
   112     HbInputButton::ButtonKeyCodeAlphabet,
       
   113     HbInputButton::ButtonKeyCodeCharacter,
       
   114     HbInputButton::ButtonKeyCodeCharacter,
       
   115     HbInputButton::ButtonKeyCodeSpace,
       
   116     HbInputButton::ButtonKeyCodeCharacter,
       
   117     HbInputButton::ButtonKeyCodeCharacter,
       
   118     HbInputButton::ButtonKeyCodeCharacter,
       
   119     HbInputButton::ButtonKeyCodeCustom
       
   120 };
       
   121 
       
   122 /*!
       
   123 @proto
       
   124 @hbinput
       
   125 \class HbSctKeyboard
       
   126 \brief Touch keyboard for special characters
       
   127 
       
   128 Implements special character keyboard. The keyboard knows how to set up button titles according to
       
   129 given key map data object and it also supports editor specific custom buttons.
       
   130 
       
   131 \sa HbInputVkbWidget
       
   132 */
       
   133 
       
   134 HbSctKeyboardPrivate::HbSctKeyboardPrivate()
       
   135  : mType(HbKeyboardSctPortrait), mColumns(0), mRows(0),
       
   136    mCharacterButtons(0), mPages(0), mActivePage(0)
       
   137 {
       
   138 }
       
   139 
       
   140 HbSctKeyboardPrivate::~HbSctKeyboardPrivate()
       
   141 {
       
   142 }
       
   143 
       
   144 void HbSctKeyboardPrivate::init()
       
   145 {
       
   146     Q_Q(HbSctKeyboard);
       
   147 
       
   148     HbInputVkbWidgetPrivate::init();
       
   149 
       
   150     if (HbInputSettingProxy::instance()->activeKeyboard() & HbQwertyKeyboardMask) {
       
   151         mType = HbKeyboardSctLandscape;
       
   152     }
       
   153 
       
   154     HbInputButtonGroup *buttonGroup = static_cast<HbInputButtonGroup*>(q->contentItem());
       
   155     if (buttonGroup) {
       
   156         mColumns = HbSctPortraitNumberOfColumns;
       
   157         mRows = HbSctPortraitNumberOfRows;
       
   158         if (mType == HbKeyboardSctLandscape) {
       
   159             mColumns = HbSctLandscapeNumberOfColumns;
       
   160             mRows = HbSctLandscapeNumberOfRows;
       
   161 
       
   162             buttonGroup->setButtonPreviewEnabled(HbInputSettingProxy::instance()->isCharacterPreviewForQwertyEnabled());
       
   163         }
       
   164 
       
   165         buttonGroup->setGridSize(QSize(mColumns, mRows));
       
   166 
       
   167         int key = 0;
       
   168         QList<HbInputButton*> buttons;
       
   169         for (int i = 0; i < mColumns * mRows; ++i) {
       
   170             HbInputButton *item = new HbInputButton(keyCode(i), QPoint(key % mColumns, key / mColumns));
       
   171             buttons.append(item);
       
   172  
       
   173             if (keyCode(i) == HbInputButton::ButtonKeyCodeCharacter) {
       
   174                 ++mCharacterButtons;
       
   175             } else if (keyCode(i) == HbInputButton::ButtonKeyCodeSpace) {
       
   176                 item->setSize(QSize(2, 1));
       
   177                 ++key;
       
   178             } else if (keyCode(i) == HbInputButton::ButtonKeyCodeDelete &&
       
   179                        mType == HbKeyboardSctPortrait) {
       
   180                 item->setIcon(HbIcon(HbInputButtonIconDelete2), HbInputButton::ButtonIconIndexPrimary);
       
   181             } else if (keyCode(i) == HbInputButton::ButtonKeyCodePageChange &&
       
   182                        mType == HbKeyboardSctPortrait) {
       
   183                 item->setIcon(HbIcon(HbInputButtonIconPageChange2), HbInputButton::ButtonIconIndexPrimary);
       
   184             }
       
   185             ++key;
       
   186         }
       
   187         buttonGroup->setButtons(buttons);
       
   188 
       
   189         QObject::connect(buttonGroup, SIGNAL(buttonPressed(const QKeyEvent&)), q, SLOT(sendKeyPressEvent(const QKeyEvent&)));
       
   190         QObject::connect(buttonGroup, SIGNAL(buttonDoublePressed(const QKeyEvent&)), q, SLOT(sendKeyDoublePressEvent(const QKeyEvent&)));
       
   191         QObject::connect(buttonGroup, SIGNAL(buttonReleased(const QKeyEvent&)), q, SLOT(sendKeyReleaseEvent(const QKeyEvent&)));
       
   192         QObject::connect(buttonGroup, SIGNAL(buttonLongPressed(const QKeyEvent&)), q, SLOT(sendLongPressEvent(const QKeyEvent&)));
       
   193         QObject::connect(buttonGroup, SIGNAL(pressedButtonChanged(const QKeyEvent&, const QKeyEvent&)), q, SLOT(sendKeyChangeEvent(const QKeyEvent&, const QKeyEvent&)));
       
   194     }
       
   195  
       
   196     QObject::connect(q, SIGNAL(flickEvent(HbInputVkbWidget::HbFlickDirection)), buttonGroup, SLOT(cancelButtonPress()));
       
   197 }
       
   198 
       
   199 int HbSctKeyboardPrivate::keyCode(int buttonId)
       
   200 {
       
   201     if (mType == HbKeyboardSctPortrait) {
       
   202         return HbPortraitButtonKeyCodeTable[buttonId];
       
   203     } else {
       
   204         return HbLandscapeButtonKeyCodeTable[buttonId];
       
   205     }
       
   206 }
       
   207 
       
   208 void HbSctKeyboardPrivate::applyEditorConstraints()
       
   209 {
       
   210     Q_Q(HbSctKeyboard);
       
   211 
       
   212     HbInputFocusObject *focusedObject = mOwner->focusObject();
       
   213     if (!focusedObject) {
       
   214         return;
       
   215     }
       
   216 
       
   217     HbInputButtonGroup *buttonGroup = static_cast<HbInputButtonGroup*>(q->contentItem());
       
   218     if (buttonGroup) {
       
   219         QList<HbInputButton*> buttons = buttonGroup->buttons();
       
   220         for (int i = 0; i < buttons.count(); ++i) {
       
   221             HbInputButton *item = buttons.at(i);
       
   222 
       
   223             HbInputButton::HbInputButtonState state = item->state();
       
   224             if (keyCode(i) == HbInputButton::ButtonKeyCodeCharacter) {
       
   225                 QString data = item->text(HbInputButton::ButtonTextIndexPrimary);
       
   226                 if (data.isEmpty() || !focusedObject->characterAllowedInEditor(data.at(0))) {
       
   227                     state = HbInputButton::ButtonStateDisabled;
       
   228                 } else if (item->state() == HbInputButton::ButtonStateDisabled) {
       
   229                     state = HbInputButton::ButtonStateReleased;
       
   230                 }
       
   231             } else if (keyCode(i) == HbInputButton::ButtonKeyCodeSmiley) {
       
   232                 if (focusedObject->editorInterface().isNumericEditor() ||
       
   233                     !focusedObject->editorInterface().editorClass() == HbInputEditorClassUnknown ||
       
   234                     !isSmileysEnabled()) {
       
   235                     state = HbInputButton::ButtonStateDisabled;
       
   236                 } else if (item->state() == HbInputButton::ButtonStateDisabled) {
       
   237                     state = HbInputButton::ButtonStateReleased;
       
   238                 }
       
   239             }
       
   240             item->setState(state);
       
   241         }
       
   242         buttonGroup->setButtons(buttons);
       
   243     }
       
   244 }
       
   245 
       
   246 void HbSctKeyboardPrivate::updateKeyCodes()
       
   247 {
       
   248     Q_Q(HbSctKeyboard);
       
   249 
       
   250     mPages = 0;
       
   251     const HbKeyboardMap *keyboardMap = mKeymap->keyboard(q->keyboardType());
       
   252     if (keyboardMap) {
       
   253         mPages = (int)ceil((float)(keyboardMap->keys.count() / mCharacterButtons));
       
   254     }
       
   255 
       
   256     if (mPages > 1) {
       
   257         mFlickAnimation = true;
       
   258     }
       
   259 
       
   260     HbInputButtonGroup *buttonGroup = static_cast<HbInputButtonGroup*>(q->contentItem());
       
   261     if (buttonGroup) {
       
   262         int key = mActivePage * mCharacterButtons;
       
   263         QList<HbInputButton*> buttons = buttonGroup->buttons();
       
   264         for (int i = 0; i < buttons.count(); ++i) {
       
   265             if (keyCode(i) == HbInputButton::ButtonKeyCodeCharacter) {
       
   266                 HbInputButton *item = buttons.at(i);
       
   267 
       
   268                 if (keyboardMap && key < keyboardMap->keys.count()) {
       
   269                     item->setKeyCode(keyboardMap->keys.at(key)->keycode.unicode());
       
   270                 } else {
       
   271                     item->setKeyCode(-1);
       
   272                 }
       
   273                 ++key;
       
   274             }
       
   275         }
       
   276     }
       
   277 }
       
   278 
       
   279 void HbSctKeyboardPrivate::updateButtons()
       
   280 {
       
   281     Q_Q(HbSctKeyboard);
       
   282 
       
   283     HbInputButtonGroup *buttonGroup = static_cast<HbInputButtonGroup*>(q->contentItem());
       
   284     if (buttonGroup) {
       
   285         int key = mActivePage * mCharacterButtons;
       
   286         QList<HbInputButton*> buttons = buttonGroup->buttons();
       
   287         for (int i = 0; i < buttons.count(); ++i) {
       
   288             if (keyCode(i) == HbInputButton::ButtonKeyCodeCharacter) {
       
   289                 HbInputButton *item = buttons.at(i);
       
   290 
       
   291                 const HbKeyboardMap *keyboardMap = mKeymap->keyboard(q->keyboardType());
       
   292                 if (keyboardMap && key < keyboardMap->keys.count()) {
       
   293                     QString keydata = keyboardMap->keys.at(key)->characters(HbModifierNone);
       
   294                     item->setText(keydata.at(0), HbInputButton::ButtonTextIndexPrimary);
       
   295                 } else {
       
   296                     item->setText("", HbInputButton::ButtonTextIndexPrimary);
       
   297                 }
       
   298 
       
   299                 ++key;
       
   300             }
       
   301         }
       
   302         buttonGroup->setButtons(buttons);
       
   303     }
       
   304 }
       
   305 
       
   306 /*!
       
   307 Constructs the object. owner is the owning input method implementation. Keymap
       
   308 is key mapping data to be used to display button texts. Key mapping data can be
       
   309 changed later (for example when the input language changes) by calling
       
   310 setKeymap.
       
   311 */
       
   312 HbSctKeyboard::HbSctKeyboard(HbInputMethod *owner, const HbKeymap *keymap, QGraphicsItem *parent)
       
   313  : HbInputVkbWidget(*new HbSctKeyboardPrivate, parent)
       
   314 {
       
   315     if (!owner) {
       
   316         return;
       
   317     }
       
   318     Q_D(HbSctKeyboard);
       
   319     d->mOwner = owner;    
       
   320     setKeymap(keymap);
       
   321 
       
   322     const HbKeyboardMap *keyboardMap = keymap->keyboard(keyboardType());
       
   323     if (keyboardMap) {
       
   324         d->mPages = (int)ceil((float)(keyboardMap->keys.count() / d->mCharacterButtons));
       
   325     }
       
   326 
       
   327     if (d->mPages > 1) {
       
   328         d->mFlickAnimation = true;
       
   329     }
       
   330 
       
   331     if (d->mType == HbKeyboardSctLandscape) {
       
   332         connect(HbInputSettingProxy::instance(), SIGNAL(characterPreviewStateForQwertyChanged(bool)), this, SLOT(updateButtonPreviewStatus(bool)));
       
   333     }
       
   334     connect(this, SIGNAL(flickEvent(HbInputVkbWidget::HbFlickDirection)), this, SLOT(changePage(HbInputVkbWidget::HbFlickDirection)));
       
   335 }
       
   336 
       
   337 /*!
       
   338 Constructs the object. owner is the owning input method implementation. Keymap
       
   339 is key mapping data to be used to display button texts. Key mapping data can be
       
   340 changed later (for example when the input language changes) by calling
       
   341 setKeymap.
       
   342 */
       
   343 HbSctKeyboard::HbSctKeyboard(HbSctKeyboardPrivate &dd, HbInputMethod *owner,
       
   344                              const HbKeymap *keymap, QGraphicsItem* parent)
       
   345  : HbInputVkbWidget(dd, parent)
       
   346 {
       
   347     if (!owner) {
       
   348         return;
       
   349     }
       
   350     Q_D(HbSctKeyboard);
       
   351     d->mOwner = owner;    
       
   352     setKeymap(keymap);
       
   353 
       
   354     const HbKeyboardMap *keyboardMap = keymap->keyboard(keyboardType());
       
   355     if (keyboardMap) {
       
   356         d->mPages = (int)ceil((float)(keyboardMap->keys.count() / d->mCharacterButtons));
       
   357     }
       
   358 
       
   359     if (d->mPages > 1) {
       
   360         d->mFlickAnimation = true;
       
   361     }
       
   362 
       
   363     if (d->mType == HbKeyboardSctLandscape) {
       
   364         connect(HbInputSettingProxy::instance(), SIGNAL(characterPreviewStateForQwertyChanged(bool)), this, SLOT(updateButtonPreviewStatus(bool)));
       
   365     }
       
   366     connect(this, SIGNAL(flickEvent(HbInputVkbWidget::HbFlickDirection)), this, SLOT(changePage(HbInputVkbWidget::HbFlickDirection)));
       
   367 }
       
   368 
       
   369 /*!
       
   370 Destructs the object.
       
   371 */
       
   372 HbSctKeyboard::~HbSctKeyboard()
       
   373 {
       
   374 }
       
   375 
       
   376 /*!
       
   377 Returns keyboard type.
       
   378 */
       
   379 HbKeyboardType HbSctKeyboard::keyboardType() const
       
   380 {
       
   381     Q_D(const HbSctKeyboard);
       
   382 
       
   383     return d->mType;
       
   384 }
       
   385 
       
   386 /*!
       
   387 Returns preferred keyboard size. HbVkbHost uses this information when it opens the keyboard.
       
   388 */
       
   389 QSizeF HbSctKeyboard::preferredKeyboardSize()
       
   390 {
       
   391     Q_D(HbSctKeyboard);
       
   392 
       
   393     QSizeF result;
       
   394     qreal unitValue = HbDeviceProfile::profile(mainWindow()).unitValue();
       
   395 
       
   396     if (d->mType == HbKeyboardSctLandscape) {
       
   397         result.setHeight(HbLandscapeKeyboardHeightInUnits * unitValue + d->mCloseHandleHeight);
       
   398         result.setWidth(HbLandscapeKeyboardWidthInUnits * unitValue);
       
   399     } else {
       
   400         result.setHeight(HbPortraitKeyboardHeightInUnits * unitValue + d->mCloseHandleHeight);
       
   401         result.setWidth(HbPortraitKeyboardWidthInUnits * unitValue);
       
   402     }
       
   403 
       
   404     return QSizeF(result);
       
   405 }
       
   406 
       
   407 /*!
       
   408 Sets the keypad to given mode. Possible values are EModeAbc, EModeNumeric and EModeSct.
       
   409 */
       
   410 void HbSctKeyboard::setMode(HbKeypadMode mode, HbModifiers modifiers)
       
   411 {
       
   412     Q_D(HbSctKeyboard);
       
   413 
       
   414     d->mActivePage = 0;
       
   415     d->updateKeyCodes();
       
   416 
       
   417     HbInputVkbWidget::setMode(mode, modifiers);
       
   418 }
       
   419 
       
   420 /*!
       
   421 Updates button preview status.
       
   422 */
       
   423 void HbSctKeyboard::updateButtonPreviewStatus(bool status)
       
   424 {
       
   425     HbInputButtonGroup *buttonGroup = static_cast<HbInputButtonGroup*>(contentItem());
       
   426     if (buttonGroup) {
       
   427         buttonGroup->setButtonPreviewEnabled(status);   
       
   428     }
       
   429 }
       
   430 
       
   431 /*!
       
   432 Handles flick gesture
       
   433 */
       
   434 void HbSctKeyboard::changePage(HbInputVkbWidget::HbFlickDirection flickDirection)
       
   435 {
       
   436     Q_D(HbSctKeyboard);
       
   437 
       
   438     if (flickDirection == HbInputVkbWidget::HbFlickDirectionRight ||
       
   439         flickDirection == HbInputVkbWidget::HbFlickDirectionLeft) {
       
   440         int direction = -1;
       
   441         if (flickDirection == HbInputVkbWidget::HbFlickDirectionRight) {
       
   442             direction = 1;
       
   443         }
       
   444 
       
   445         d->mActivePage = (d->mActivePage + direction) % d->mPages;
       
   446         if (d->mActivePage < 0) {
       
   447             d->mActivePage = d->mPages - 1;
       
   448         }
       
   449         d->updateKeyCodes();
       
   450         d->updateButtons();
       
   451         d->applyEditorConstraints();
       
   452     }
       
   453 }
       
   454 
       
   455 /*!
       
   456 Sends key event to owning input method.
       
   457 */
       
   458 void HbSctKeyboard::sendKeyPressEvent(const QKeyEvent &event)
       
   459 {
       
   460     if (event.key() != HbInputButton::ButtonKeyCodePageChange &&
       
   461         event.key() != HbInputButton::ButtonKeyCodeSmiley) {
       
   462         HbInputVkbWidget::sendKeyPressEvent(event);
       
   463     }
       
   464 }
       
   465 
       
   466 /*!
       
   467 Sends key event to owning input method.
       
   468 */
       
   469 void HbSctKeyboard::sendKeyReleaseEvent(const QKeyEvent &event)
       
   470 {
       
   471     Q_D(HbSctKeyboard);
       
   472 
       
   473     if (event.key() == HbInputButton::ButtonKeyCodePageChange) {
       
   474         changePage(HbInputVkbWidget::HbFlickDirectionRight);
       
   475     } else if (event.key() == HbInputButton::ButtonKeyCodeSmiley) {
       
   476         showSmileyPicker(d->mRows, d->mColumns);
       
   477     } else {
       
   478         HbInputVkbWidget::sendKeyReleaseEvent(event);
       
   479     }
       
   480 }
       
   481 
       
   482 /*!
       
   483 Sends key event to owning input method.
       
   484 Release event is ignored.
       
   485 */
       
   486 void HbSctKeyboard::sendKeyChangeEvent(const QKeyEvent &releaseEvent, const QKeyEvent &pressEvent)
       
   487 {
       
   488     if (pressEvent.key() != HbInputButton::ButtonKeyCodePageChange && 
       
   489         pressEvent.key() != HbInputButton::ButtonKeyCodeSmiley) {
       
   490         HbInputVkbWidget::sendKeyChangeEvent(releaseEvent, pressEvent);
       
   491     }
       
   492 }
       
   493 
       
   494 // End of file