src/hbinput/inputwidgets/hbinputvkbwidget.cpp
changeset 2 06ff229162e9
parent 1 f7ac710697a9
child 3 11d3954df52a
equal deleted inserted replaced
1:f7ac710697a9 2:06ff229162e9
    27 #include <QPainter>
    27 #include <QPainter>
    28 #include <QGraphicsItemAnimation>
    28 #include <QGraphicsItemAnimation>
    29 #include <QGraphicsSceneMouseEvent>
    29 #include <QGraphicsSceneMouseEvent>
    30 #include <QGraphicsProxyWidget>
    30 #include <QGraphicsProxyWidget>
    31 #include <QTimeLine>
    31 #include <QTimeLine>
       
    32 #include <QGraphicsScene>
    32 #include <QGraphicsGridLayout>
    33 #include <QGraphicsGridLayout>
    33 #include <QGraphicsScene>
       
    34 #include <QGraphicsLinearLayout>
    34 #include <QGraphicsLinearLayout>
    35 
    35 
    36 #include <hbapplication.h>
    36 #include <hbapplication.h>
    37 #include <hbmainwindow.h>
    37 #include <hbmainwindow.h>
    38 #include <hbaction.h>
    38 #include <hbaction.h>
    39 #include <hbview.h>
    39 #include <hbview.h>
    40 #include <hbwidget.h>
    40 #include <hbwidget.h>
    41 #include <hbpushbutton.h>
       
    42 #include <hbinputsettingproxy.h>
       
    43 #include <hbdialog.h>
    41 #include <hbdialog.h>
    44 #include <hbeffect.h>
    42 #include <hbeffect.h>
    45 #include <hbstackedwidget.h>
       
    46 #include <hbframedrawer.h>
    43 #include <hbframedrawer.h>
    47 #include <hbevent.h>
    44 #include <hbevent.h>
    48 #include <hbdataform.h>
    45 #include <hbdataform.h>
    49 
    46 
    50 #include <hbinputmethod.h>
    47 #include <hbinputmethod.h>
    56 #include <hbinputcommondialogs.h>
    53 #include <hbinputcommondialogs.h>
    57 #include <hbinputkeymap.h>
    54 #include <hbinputkeymap.h>
    58 #include <hbinputkeymapfactory.h>
    55 #include <hbinputkeymapfactory.h>
    59 #include <hbwidgetfeedback.h>
    56 #include <hbwidgetfeedback.h>
    60 #include <hbinputpredictionfactory.h>
    57 #include <hbinputpredictionfactory.h>
       
    58 #include <hbinputbuttongroup.h>
       
    59 #include <hbinputbutton.h>
    61 #include <HbSwipeGesture>
    60 #include <HbSwipeGesture>
    62 #include <HbTapGesture>
    61 #include <HbTapGesture>
    63 #include "hbinputvirtualrocker.h"
    62 #include "hbinputvirtualrocker.h"
    64 #include "hbinputvkbwidget.h"
    63 #include "hbinputvkbwidget.h"
    65 #include "hbinputvkbwidget_p.h"
    64 #include "hbinputvkbwidget_p.h"
    66 #include "hbinputtouchkeypadbutton.h"
       
    67 #include "hbinputsettinglist.h"
    65 #include "hbinputsettinglist.h"
    68 #include "hbinputmodeindicator.h"
    66 #include "hbinputmodeindicator.h"
    69 #include <hbfeedbackmanager.h>
    67 #include <hbfeedbackmanager.h>
    70 #include "hbinputsmileypicker.h"
    68 #include "hbinputsmileypicker.h"
    71 #include "hbinputscreenshotwidget.h"
    69 #include "hbinputscreenshotwidget.h"
    72 const qreal HbMouseDragDelta = 0.4;
    70 
    73 const qreal HbRockerWidth = 50.0;
    71 const qreal HbRockerWidth = 50.0;
    74 
       
    75 const int MaxSweepTime = 500;
       
    76 const int SweepLength = 150;
       
    77 
    72 
    78 
    73 
    79 /*!
    74 /*!
    80 @proto
    75 @proto
    81 @hbinput
    76 @hbinput
   103 : mOwner(0),
    98 : mOwner(0),
   104 mMode(EModeAbc),
    99 mMode(EModeAbc),
   105 mKeymap(0),
   100 mKeymap(0),
   106 mModifiers(0),
   101 mModifiers(0),
   107 mInputModeIndicator(0),
   102 mInputModeIndicator(0),
   108 mApplicationButton(0),
       
   109 mSettingsButton(0),
       
   110 mSettingList(0),
   103 mSettingList(0),
   111 mButtonLayout(0),
   104 mButtonLayout(0),
   112 mRocker(0),
   105 mRocker(0),
   113 mBackgroundDrawer(0),
   106 mBackgroundDrawer(0),
   114 mIconDrawer(0),
   107 mIconDrawer(0),
   146     delete mIconDrawer;
   139     delete mIconDrawer;
   147     delete mSmileyPicker;
   140     delete mSmileyPicker;
   148     delete mScreenshotWidget;
   141     delete mScreenshotWidget;
   149 }
   142 }
   150 
   143 
       
   144 void HbInputVkbWidgetPrivate::initLayout()
       
   145 {
       
   146     Q_Q(HbInputVkbWidget);
       
   147 
       
   148     mLayout = new QGraphicsLinearLayout(Qt::Vertical);
       
   149     mLayout->setContentsMargins(0.0, 0.0, 0.0, 0.0);
       
   150     mLayout->setSpacing(0.0);
       
   151 
       
   152     qreal unitValue = HbDeviceProfile::profile(q->mainWindow()).unitValue();
       
   153     mCloseHandleHeight = HbCloseHandleHeightInUnits * unitValue;
       
   154     mCloseHandleWidth = HbCloseHandleWidthInUnits * unitValue;
       
   155 
       
   156     mCloseHandle = new QGraphicsWidget();
       
   157     mCloseHandle->setObjectName("vkbHandle");
       
   158     mCloseHandle->setMinimumHeight(mCloseHandleHeight);
       
   159     mCloseHandle->setMaximumHeight(mCloseHandleHeight);
       
   160     mLayout->addItem(mCloseHandle);
       
   161 
       
   162     q->setContentItem(new HbInputButtonGroup());
       
   163     q->setLayout(mLayout);
       
   164 }
       
   165 
   151 void HbInputVkbWidgetPrivate::init()
   166 void HbInputVkbWidgetPrivate::init()
   152 {
   167 {
   153     Q_Q(HbInputVkbWidget);
   168     Q_Q(HbInputVkbWidget);
   154 
   169 
   155     mRocker = new HbInputVirtualRocker(q);
   170     mRocker = new HbInputVirtualRocker(q);
   166 
   181 
   167     mBackgroundDrawer = new HbFrameDrawer();
   182     mBackgroundDrawer = new HbFrameDrawer();
   168     mBackgroundDrawer->setFrameGraphicsName(backgroundGraphics);
   183     mBackgroundDrawer->setFrameGraphicsName(backgroundGraphics);
   169     mBackgroundDrawer->setFrameType(HbFrameDrawer::ThreePiecesVertical);
   184     mBackgroundDrawer->setFrameType(HbFrameDrawer::ThreePiecesVertical);
   170     mBackgroundDrawer->setFillWholeRect(true);
   185     mBackgroundDrawer->setFillWholeRect(true);
   171     mBackgroundDrawer->setBorderWidths(0.0, HbCloseHandleHeight, 0.0, HbCloseHandleHeight);
   186     mBackgroundDrawer->setBorderWidths(0.0, mCloseHandleHeight, 0.0, mCloseHandleHeight);
   172 
   187 
   173     mIconDrawer = new HbFrameDrawer();
   188     mIconDrawer = new HbFrameDrawer();
   174     mIconDrawer->setFrameType(HbFrameDrawer::OnePiece);
   189     mIconDrawer->setFrameType(HbFrameDrawer::OnePiece);
   175     mIconDrawer->setFrameGraphicsName(HbInputVkbHandleIcon);
   190     mIconDrawer->setFrameGraphicsName(HbInputVkbHandleIcon);
   176 
   191 
   240 void HbInputVkbWidgetPrivate::redirectMouseReleaseEvent(QGraphicsSceneMouseEvent *aEvent)
   255 void HbInputVkbWidgetPrivate::redirectMouseReleaseEvent(QGraphicsSceneMouseEvent *aEvent)
   241 {
   256 {
   242     q_ptr->mouseReleaseEvent(aEvent);
   257     q_ptr->mouseReleaseEvent(aEvent);
   243 }
   258 }
   244 
   259 
   245 void HbInputVkbWidgetPrivate::applyEditorConstraints() {
   260 void HbInputVkbWidgetPrivate::applyEditorConstraints()
       
   261 {
   246     // no default implementaiton as of now.
   262     // no default implementaiton as of now.
       
   263 }
       
   264 
       
   265 void HbInputVkbWidgetPrivate::updateKeyCodes()
       
   266 {
       
   267     Q_Q(HbInputVkbWidget);
       
   268 
       
   269     HbInputButtonGroup *buttonGroup = static_cast<HbInputButtonGroup*>(q->contentItem());
       
   270     if (buttonGroup) {
       
   271         int key = 0;
       
   272         QList<HbInputButton*> buttons = buttonGroup->buttons();
       
   273         for (int i = 0; i < buttons.count(); ++i) {
       
   274             if (keyCode(i) == HbInputButton::ButtonKeyCodeCharacter) {
       
   275                 HbInputButton *item = buttons.at(i);
       
   276 
       
   277                 const HbKeyboardMap *keyboardMap = mKeymap->keyboard(q->keyboardType());
       
   278                 if (keyboardMap && key < keyboardMap->keys.count()) {
       
   279                     item->setKeyCode(keyboardMap->keys.at(key)->keycode.unicode());
       
   280                 } else {
       
   281                     item->setKeyCode(-1);
       
   282                 }
       
   283                 ++key;
       
   284             }
       
   285         }
       
   286     }
       
   287 }
       
   288 
       
   289 void HbInputVkbWidgetPrivate::updateButtons()
       
   290 {
       
   291     Q_Q(HbInputVkbWidget);
       
   292 
       
   293     HbInputButtonGroup *buttonGroup = static_cast<HbInputButtonGroup*>(q->contentItem());
       
   294     if (buttonGroup) {
       
   295         int key = 0;
       
   296         QList<HbInputButton*> buttons = buttonGroup->buttons();
       
   297         for (int i = 0; i < buttons.count(); ++i) {
       
   298             if (keyCode(i) == HbInputButton::ButtonKeyCodeCharacter) {
       
   299                 HbInputButton *item = buttons.at(i);
       
   300 
       
   301                 const HbKeyboardMap *keyboardMap = mKeymap->keyboard(q->keyboardType());
       
   302                 if (keyboardMap && key < keyboardMap->keys.count()) {
       
   303                     QString keydata = keyboardMap->keys.at(key)->characters(mModifiers);
       
   304                     item->setText(keydata.at(0), HbInputButton::ButtonTextIndexPrimary);
       
   305 
       
   306                     QString mappedCharacters;
       
   307                     keydata.append(keyboardMap->keys.at(key)->characters(mModifiers | HbModifierFnPressed));
       
   308                     for (int i = 0; i < keydata.length(); ++i) {
       
   309                         if (mOwner->focusObject() &&
       
   310                             mOwner->focusObject()->characterAllowedInEditor(keydata.at(i))) {
       
   311                             mappedCharacters.append(keydata.at(i));
       
   312                         }
       
   313                     }
       
   314                     item->setMappedCharacters(mappedCharacters);
       
   315                 } else {
       
   316                     item->setText("", HbInputButton::ButtonTextIndexPrimary);
       
   317                     item->setMappedCharacters("");
       
   318                 }
       
   319                 ++key;
       
   320             }
       
   321         }
       
   322         buttonGroup->setButtons(buttons);
       
   323     }
       
   324 }
       
   325 
       
   326 void HbInputVkbWidgetPrivate::settingListPosition(QPointF &position, HbPopup::Placement &placement)
       
   327 {
       
   328     Q_Q(HbInputVkbWidget);
       
   329 
       
   330     HbInputButtonGroup *buttonGroup = static_cast<HbInputButtonGroup*>(q->contentItem());
       
   331     if (buttonGroup) {
       
   332         HbInputButton *item = buttonGroup->button(HbInputButton::ButtonKeyCodeSettings);
       
   333         if (item) {
       
   334             position.setX(buttonGroup->scenePos().x() + item->boundingRect().x() + item->boundingRect().width());
       
   335             position.setY(buttonGroup->scenePos().y() + item->boundingRect().y());
       
   336             placement = HbPopup::BottomRightCorner;
       
   337         }
       
   338     }
   247 }
   339 }
   248 
   340 
   249 void HbInputVkbWidgetPrivate::setRockerPosition()
   341 void HbInputVkbWidgetPrivate::setRockerPosition()
   250 {
   342 {
   251     Q_Q(HbInputVkbWidget);
   343     Q_Q(HbInputVkbWidget);
   254     QSizeF padArea = q->keypadButtonAreaSize();
   346     QSizeF padArea = q->keypadButtonAreaSize();
   255     QPointF point((padArea.width() * 0.5) - (mRocker->size().width() * 0.5),
   347     QPointF point((padArea.width() * 0.5) - (mRocker->size().width() * 0.5),
   256         (padArea.height() * 0.5) - (mRocker->size().height() * 0.5));
   348         (padArea.height() * 0.5) - (mRocker->size().height() * 0.5));
   257     point.setY(point.y() + mCloseHandleHeight);
   349     point.setY(point.y() + mCloseHandleHeight);
   258 
   350 
   259     if (q->keypadLayout() && q->keypadLayout()->geometry().height()) {
       
   260         point.setX(((padArea.width() * 0.5) - (mRocker->size().width() * 0.5)));
       
   261         point.setY(((q->keypadLayout()->geometry().height() * 0.5) - (mRocker->size().height() * 0.5) + mCloseHandleHeight));
       
   262     }
       
   263     mRocker->setPos(point);
   351     mRocker->setPos(point);
   264 }
   352 }
   265 
   353 
   266 void HbInputVkbWidgetPrivate::captureScreenshot()
   354 void HbInputVkbWidgetPrivate::captureScreenshot()
   267 {
   355 {
   330 HbInputVkbWidget::HbInputVkbWidget(QGraphicsItem* parent)
   418 HbInputVkbWidget::HbInputVkbWidget(QGraphicsItem* parent)
   331     : HbWidget(*new HbInputVkbWidgetPrivate, parent)
   419     : HbWidget(*new HbInputVkbWidgetPrivate, parent)
   332 {
   420 {
   333     Q_D(HbInputVkbWidget);
   421     Q_D(HbInputVkbWidget);
   334     d->q_ptr = this;
   422     d->q_ptr = this;
       
   423     d->initLayout();
   335     d->init();
   424     d->init();
   336 
   425 
   337     setFocusPolicy(Qt::ClickFocus);
   426     setFocusPolicy(Qt::ClickFocus);
   338     setPos(QPointF(0,0));
   427     setPos(QPointF(0,0));
   339 
   428 
   352 HbInputVkbWidget::HbInputVkbWidget(HbInputVkbWidgetPrivate& dd, QGraphicsItem* parent)
   441 HbInputVkbWidget::HbInputVkbWidget(HbInputVkbWidgetPrivate& dd, QGraphicsItem* parent)
   353   : HbWidget(dd, parent)
   442   : HbWidget(dd, parent)
   354 {
   443 {
   355     Q_D(HbInputVkbWidget);
   444     Q_D(HbInputVkbWidget);
   356     d->q_ptr = this;
   445     d->q_ptr = this;
       
   446     d->initLayout();
   357     d->init();
   447     d->init();
   358 
   448 
   359     setFocusPolicy(Qt::ClickFocus);
   449     setFocusPolicy(Qt::ClickFocus);
   360     setPos(QPointF(0,0));
   450     setPos(QPointF(0,0));
   361 
   451 
   413     Q_D(HbInputVkbWidget);
   503     Q_D(HbInputVkbWidget);
   414     d->mFlickDirection = HbFlickDirectionNone;
   504     d->mFlickDirection = HbFlickDirectionNone;
   415 }
   505 }
   416 
   506 
   417 /*!
   507 /*!
   418 \deprecated HbInputVkbWidget::mousePressEvent(QGraphicsSceneMouseEvent*)
       
   419     is deprecated.
       
   420 */
       
   421 void HbInputVkbWidget::mousePressEvent(QGraphicsSceneMouseEvent* event)
       
   422 {
       
   423     Q_UNUSED(event);
       
   424 }
       
   425 
       
   426 /*!
       
   427 \deprecated HbInputVkbWidget::mappedKeyPress(int)
       
   428     is deprecated.
       
   429 */
       
   430 void HbInputVkbWidget::mappedKeyPress(int buttonid)
       
   431 {
       
   432     Q_D(HbInputVkbWidget);
       
   433     d->handleStandardButtonPress(buttonid);
       
   434 }
       
   435 
       
   436 /*!
       
   437 \deprecated HbInputVkbWidget::mappedKeyRelease(int)
       
   438     is deprecated.
       
   439 */
       
   440 void HbInputVkbWidget::mappedKeyRelease(int buttonid)
       
   441 {
       
   442     Q_D(HbInputVkbWidget);
       
   443     d->handleStandardButtonRelease(buttonid);
       
   444 }
       
   445 
       
   446 
       
   447 /*!
       
   448 The paint method. Draws the widget.
   508 The paint method. Draws the widget.
   449 */
   509 */
   450 void HbInputVkbWidget::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
   510 void HbInputVkbWidget::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
   451 {
   511 {
   452     Q_UNUSED(option);
   512     Q_UNUSED(option);
   457     QRectF rect = boundingRect();
   517     QRectF rect = boundingRect();
   458     if (d->mDrawbackground) {
   518     if (d->mDrawbackground) {
   459         d->mBackgroundDrawer->paint(painter, rect);
   519         d->mBackgroundDrawer->paint(painter, rect);
   460     }
   520     }
   461 
   521 
   462     rect.setLeft(rect.width()/2 - d->mCloseHandleHeight*3);
   522     painter->save();
   463     rect.setWidth(d->mCloseHandleHeight*6);
   523     painter->translate(rect.width() / 2 - d->mCloseHandleWidth / 2, 0);
       
   524     rect.setWidth(d->mCloseHandleWidth);
   464     rect.setHeight(d->mCloseHandleHeight);
   525     rect.setHeight(d->mCloseHandleHeight);
   465     d->mIconDrawer->paint(painter, rect);
   526     d->mIconDrawer->paint(painter, rect);
       
   527     painter->restore();
       
   528 }
       
   529 
       
   530 /*!
       
   531 Sets the content item which will fill the content area of this widget. Content item is
       
   532 a single input button group by default.
       
   533 If null is given then the old content item is deleted and content area is cleared.
       
   534 Takes ownership of the given item.
       
   535 
       
   536 \sa updateKeyCodes
       
   537 \sa updateButtons
       
   538 \sa setKeyboardDimmed
       
   539 \sa probableKeypresses
       
   540 */
       
   541 void HbInputVkbWidget::setContentItem(QGraphicsLayoutItem *item)
       
   542 {
       
   543     Q_D(HbInputVkbWidget);
       
   544     if (d->mLayout->count() > 1) {
       
   545         QGraphicsLayoutItem *oldItem = d->mLayout->itemAt(d->mLayout->count() - 1);
       
   546         d->mLayout->removeItem(oldItem);
       
   547         delete oldItem;
       
   548     }
       
   549     if (item) {
       
   550         d->mLayout->addItem(item);
       
   551     }
       
   552 }
       
   553 
       
   554 /*!
       
   555 Returns current content item or null if not set.
       
   556 Ownership is not transferred.
       
   557 */
       
   558 QGraphicsLayoutItem *HbInputVkbWidget::contentItem() const
       
   559 {
       
   560     Q_D(const HbInputVkbWidget);
       
   561 
       
   562     QGraphicsLayoutItem *item(0);
       
   563     if (d->mLayout->count() > 1) {
       
   564         item = d->mLayout->itemAt(d->mLayout->count() - 1);
       
   565     }
       
   566     return item;
   466 }
   567 }
   467 
   568 
   468 /*!
   569 /*!
   469 Sets virtual rocker visibility.
   570 Sets virtual rocker visibility.
   470 */
   571 */
   509 Sets the keypad to given mode. Possible values are EModeAbc, EModeNumeric and EModeSct.
   610 Sets the keypad to given mode. Possible values are EModeAbc, EModeNumeric and EModeSct.
   510 */
   611 */
   511 void HbInputVkbWidget::setMode(HbKeypadMode mode, HbModifiers modifiers)
   612 void HbInputVkbWidget::setMode(HbKeypadMode mode, HbModifiers modifiers)
   512 {
   613 {
   513     Q_D(HbInputVkbWidget);
   614     Q_D(HbInputVkbWidget);
       
   615     d->mMode = mode;
   514     d->mModifiers = modifiers;
   616     d->mModifiers = modifiers;
   515     d->mMode = mode;
   617 
       
   618     d->updateButtons();
       
   619     d->applyEditorConstraints();
       
   620 
       
   621     HbInputButtonGroup *buttonGroup = static_cast<HbInputButtonGroup*>(contentItem());
       
   622     if (buttonGroup && d->mOwner->focusObject()) {
       
   623         buttonGroup->setCustomButtonActions(d->mOwner->focusObject()->editorInterface().actions());
       
   624     }
       
   625 
       
   626     if (d->mInputModeIndicator) {
       
   627         d->mInputModeIndicator->updateIndicator();
       
   628     }
   516 }
   629 }
   517 
   630 
   518 /*!
   631 /*!
   519 Sets key map data object. Given key map data will be used as a source for button titles.
   632 Sets key map data object. Given key map data will be used as a source for button titles.
   520 Usually the key map data for active input language is used.
   633 Usually the key map data for active input language is used.
   522 void HbInputVkbWidget::setKeymap(const HbKeymap* keymap)
   635 void HbInputVkbWidget::setKeymap(const HbKeymap* keymap)
   523 {
   636 {
   524     Q_D(HbInputVkbWidget);
   637     Q_D(HbInputVkbWidget);
   525     if (keymap) {
   638     if (keymap) {
   526         d->mKeymap = keymap;
   639         d->mKeymap = keymap;
       
   640         d->updateKeyCodes();
       
   641 
       
   642         HbInputState newState = d->mOwner->inputState();
       
   643         if (newState.textCase() == HbTextCaseUpper || newState.textCase() == HbTextCaseAutomatic) {
       
   644             setMode(d->mMode, HbModifierShiftPressed);
       
   645         } else {
       
   646             setMode(d->mMode, HbModifierNone);
       
   647         }
   527     }
   648     }
   528 }
   649 }
   529 
   650 
   530 /*!
   651 /*!
   531 \reimp
   652 \reimp
   533 void HbInputVkbWidget::aboutToOpen(HbVkbHost *host)
   654 void HbInputVkbWidget::aboutToOpen(HbVkbHost *host)
   534 {
   655 {
   535     Q_D(HbInputVkbWidget);
   656     Q_D(HbInputVkbWidget);
   536 
   657 
   537     d->mCurrentHost = host;
   658     d->mCurrentHost = host;
   538 
       
   539     if (!d->mLayout) {
       
   540         // get preferred size from vkbhost and set it to vkb.
       
   541         // Keypad buttons will flicker while vkb opening (when we open keypad for first time )
       
   542         // if we dont set size to vkb before seting layout to vkb.
       
   543         resize(preferredKeyboardSize());
       
   544         d->mLayout = new QGraphicsLinearLayout(Qt::Vertical);
       
   545         d->mLayout->setContentsMargins(0.0, 0.0, 0.0, 0.0);
       
   546         d->mLayout->setSpacing(0.0);
       
   547 
       
   548         setLayout(d->mLayout);
       
   549 
       
   550         d->mCloseHandle = new QGraphicsWidget();
       
   551         d->mCloseHandle->setObjectName("vkbHandle");
       
   552         d->mCloseHandleHeight = (int)HbCloseHandleHeight;
       
   553         d->mCloseHandle->setMinimumHeight(d->mCloseHandleHeight);
       
   554         d->mCloseHandle->setMaximumHeight(d->mCloseHandleHeight);
       
   555 
       
   556         d->mLayout->addItem(d->mCloseHandle);
       
   557         d->mLayout->addItem(keypadLayout());
       
   558     }
       
   559 
       
   560 
   659 
   561     if (d->mOwner && d->mOwner->focusObject()) {
   660     if (d->mOwner && d->mOwner->focusObject()) {
   562         qreal vkbZValue = d->mOwner->focusObject()->findVkbZValue();
   661         qreal vkbZValue = d->mOwner->focusObject()->findVkbZValue();
   563         setZValue(vkbZValue);
   662         setZValue(vkbZValue);
   564         d->mRocker->setZValue(vkbZValue+0.5);
   663         d->mRocker->setZValue(vkbZValue + 0.5);
   565     }
   664     }
   566 
   665 
   567     show();
   666     show();
   568 }
   667 }
   569 
   668 
   585 /*!
   684 /*!
   586 Enables or disabled all buttons in the keyboard that have not been disabled directly.
   685 Enables or disabled all buttons in the keyboard that have not been disabled directly.
   587 */
   686 */
   588 void HbInputVkbWidget::setKeyboardDimmed(bool dimmed)
   687 void HbInputVkbWidget::setKeyboardDimmed(bool dimmed)
   589 {
   688 {
   590     Q_D(HbInputVkbWidget);
   689     HbInputButtonGroup *buttonGroup = static_cast<HbInputButtonGroup*>(contentItem());
   591     d->mKeyboardDimmed = dimmed;
   690     if (buttonGroup) {
   592     if (keypadLayout()) {
   691         buttonGroup->setEnabled(!dimmed);
   593         int itemCount = keypadLayout()->count();
   692     }
   594         for (int i=0; i<itemCount; i++) {
       
   595             HbTouchKeypadButton* button = static_cast<HbTouchKeypadButton*>(keypadLayout()->itemAt(i));
       
   596             button->setFade(dimmed);
       
   597         }
       
   598     }
       
   599     if (!dimmed) {
       
   600         // when we undimmed the keyboard, all the buttons will be enabled by default.
       
   601         // we need to call applyEditorConstraints on the keyboard to apply constraints
       
   602         d->applyEditorConstraints();
       
   603     }
       
   604 
       
   605 }
   693 }
   606 
   694 
   607 /*!
   695 /*!
   608 Shows settings list
   696 Shows settings list
   609 */
   697 */
   628         d->mSettingList->setPredictionSelectionEnabled(true);
   716         d->mSettingList->setPredictionSelectionEnabled(true);
   629     } else {
   717     } else {
   630         d->mSettingList->setPredictionSelectionEnabled(false);
   718         d->mSettingList->setPredictionSelectionEnabled(false);
   631     }
   719     }
   632 
   720 
   633     d->mSettingsButton->setBackgroundAttributes(HbTouchKeypadButton::HbTouchButtonLatched);
   721     HbInputButtonGroup *buttonGroup = static_cast<HbInputButtonGroup*>(contentItem());
   634     qreal x = d->mSettingsButton->scenePos().x() + d->mSettingsButton->rect().width();
   722     if (buttonGroup) {
   635     qreal y = d->mSettingsButton->scenePos().y();
   723         HbInputButton *item = buttonGroup->button(HbInputButton::ButtonKeyCodeSettings);
   636     d->mSettingList->setPreferredPos(QPointF(x, y), HbPopup::BottomRightCorner);
   724         if (item) {
       
   725             item->setState(HbInputButton::ButtonStateLatched);
       
   726             buttonGroup->setButton(item, HbInputButton::ButtonKeyCodeSettings);
       
   727         }
       
   728     }
       
   729 
       
   730     QPointF position;
       
   731     HbPopup::Placement placement;
       
   732     d->settingListPosition(position, placement);
       
   733     d->mSettingList->setPreferredPos(position, placement);
   637     d->mSettingList->updateSettingList();
   734     d->mSettingList->updateSettingList();
   638     d->mSettingList->open(this, SLOT(settingsClosed()));
   735     d->mSettingList->open(this, SLOT(settingsClosed()));
   639 }
   736 }
   640 
   737 
   641 /*!
   738 /*!
   643 */
   740 */
   644 void HbInputVkbWidget::settingsClosed()
   741 void HbInputVkbWidget::settingsClosed()
   645 {
   742 {
   646     Q_D(HbInputVkbWidget);
   743     Q_D(HbInputVkbWidget);
   647 
   744 
   648     d->mSettingsButton->setBackgroundAttributes(HbTouchKeypadButton::HbTouchButtonReleased);
   745     HbInputButtonGroup *buttonGroup = static_cast<HbInputButtonGroup*>(contentItem());
       
   746     if (buttonGroup) {
       
   747         HbInputButton *item = buttonGroup->button(HbInputButton::ButtonKeyCodeSettings);
       
   748         if (item) {
       
   749             item->setState(HbInputButton::ButtonStateReleased);
       
   750             buttonGroup->setButton(item, HbInputButton::ButtonKeyCodeSettings);
       
   751         }
       
   752     }
   649 
   753 
   650     d->mSettingsListOpen = false;
   754     d->mSettingsListOpen = false;
   651     if ( d->mAnimateWhenDialogCloses ) {
   755     if ( d->mAnimateWhenDialogCloses ) {
   652         animKeyboardChange();
   756         animKeyboardChange();
   653         d->mAnimateWhenDialogCloses = false;
   757         d->mAnimateWhenDialogCloses = false;
   661 */
   765 */
   662 void HbInputVkbWidget::closeSettingList()
   766 void HbInputVkbWidget::closeSettingList()
   663 {
   767 {
   664     Q_D(HbInputVkbWidget);
   768     Q_D(HbInputVkbWidget);
   665     d->mSettingList->close();
   769     d->mSettingList->close();
   666     d->mSettingsButton->setBackgroundAttributes(HbTouchKeypadButton::HbTouchButtonReleased);
       
   667 }
       
   668 
       
   669 /*!
       
   670 \deprecated HbInputVkbWidget::togglePredictionStatus()
       
   671     is deprecated.
       
   672 */
       
   673 void HbInputVkbWidget::togglePredictionStatus()
       
   674 {
       
   675     closeSettingList();
       
   676     HbInputSettingProxy::instance()->togglePrediction();
       
   677     update();
       
   678 }
       
   679 
       
   680 /*!
       
   681 \deprecated HbInputVkbWidget::executeSettingsDialog()
       
   682     is deprecated. Use showSettingsView instead.
       
   683 */
       
   684 void HbInputVkbWidget::executeSettingsDialog()
       
   685 {
       
   686 }
   770 }
   687 
   771 
   688 /*!
   772 /*!
   689 Shows settings view
   773 Shows settings view
   690 */
   774 */
   739         d->mOwner->activateInputMethod(method);
   823         d->mOwner->activateInputMethod(method);
   740     }
   824     }
   741 }
   825 }
   742 
   826 
   743 /*!
   827 /*!
   744 \deprecated HbInputVkbWidget::keypadLayout()
       
   745     is deprecated.
       
   746 */
       
   747 QGraphicsLayout *HbInputVkbWidget::keypadLayout()
       
   748 {
       
   749     Q_D(HbInputVkbWidget);
       
   750     return d->mButtonLayout;
       
   751 }
       
   752 
       
   753 /*!
       
   754 \reimp
   828 \reimp
   755 */
   829 */
   756 QWidget* HbInputVkbWidget::asWidget()
   830 QWidget* HbInputVkbWidget::asWidget()
   757 {
   831 {
   758     return HbInputUtils::createWrapperWidget(this);
   832     return HbInputUtils::createWrapperWidget(this);
   818 {
   892 {
   819     Q_D(HbInputVkbWidget);
   893     Q_D(HbInputVkbWidget);
   820     d->mDrawbackground = backgroundEnabled;
   894     d->mDrawbackground = backgroundEnabled;
   821 }
   895 }
   822 
   896 
       
   897 
   823 /*!
   898 /*!
   824 Returns all possible keys those the user could have intended to press
   899 Returns all possible keys those the user could have intended to press
   825 for the last registered touch along with their corresponding probability.
   900 for the last registered touch along with their corresponding probability.
   826 One issue of thecurrent API implementation is that it does not always
       
   827 sum up the probabilities to 1.0, but sometimes it returns.999999899 etc.
       
   828 Need to be careful about it!
       
   829 */
   901 */
   830 QList<HbKeyPressProbability> HbInputVkbWidget::probableKeypresses()
   902 QList<HbKeyPressProbability> HbInputVkbWidget::probableKeypresses()
   831 {
   903 {
   832     Q_D(HbInputVkbWidget);
   904     QList<HbKeyPressProbability> probabilities;
   833 
   905     HbInputButtonGroup *buttonGroup = static_cast<HbInputButtonGroup*>(contentItem());
   834     QList<HbKeyPressProbability> probableKeys;
   906     if (buttonGroup) {
   835     int totalItems = d->mButtonLayout->count();
   907         probabilities = buttonGroup->buttonProbabilities(); 
   836     QRectF buttonRect = d->mMostRecentlyAccessedButton->geometry();
   908     }
   837     //The overlaying rectangle is the test rectangle that is used for finding
   909     return probabilities;
   838     //intersactions with other buttons.
       
   839     QRectF overlayingRect(d->mMostRecentlyClickedLocation.x()-buttonRect.width()/2,d->mMostRecentlyClickedLocation.y()-buttonRect.height()/2, buttonRect.width(), buttonRect.height());
       
   840     QPainterPath path(overlayingRect.topLeft());
       
   841     path.addRect(overlayingRect);
       
   842     for(int count=0; count < totalItems; count++) {
       
   843         QGraphicsItem *item = d->mButtonLayout->itemAt(count)->graphicsItem();
       
   844         QPainterPath testPath = item->mapFromScene(path);
       
   845         HbTouchKeypadButton *buttonItem = 0;
       
   846         if(item->isWidget()){
       
   847             buttonItem =  qobject_cast<HbTouchKeypadButton *>(static_cast<QGraphicsWidget *>(item));
       
   848         }
       
   849         if(!buttonItem) {
       
   850             continue;
       
   851         }
       
   852 
       
   853         //Checkif the button collides with the path, if yes,it means that the colliding
       
   854         //key also could have been clicked by the user. The probability of the button being
       
   855         //clickedin that case willdependon the area of the intersaction rectangle.
       
   856         if(buttonItem->collidesWithPath(testPath)) {
       
   857             //Initiallylet the intersaction be same as the overlaying rectangle,later we will
       
   858             //shrink the rectangle and find the actual intersected rectangle.
       
   859             QRectF intersactionRect = overlayingRect;
       
   860             //The overlaying rectangle is in scene coordinates, map it to the item coordinates.
       
   861             intersactionRect.moveTopLeft(buttonItem->mapFromScene(overlayingRect.topLeft()));
       
   862             int width = (int)intersactionRect.width();
       
   863             int height = (int)intersactionRect.height();
       
   864             qreal probability = 0.0;
       
   865             //Shrink based on the size of the intersaction
       
   866             if (intersactionRect.topLeft().x() > 0) {
       
   867                 width -= (int)intersactionRect.topLeft().x();
       
   868             } else {
       
   869                 width += (int)intersactionRect.topLeft().x();
       
   870             }
       
   871             if (intersactionRect.topLeft().y() > 0) {
       
   872                 height -= (int)intersactionRect.topLeft().y();
       
   873             } else {
       
   874                 height += (int)intersactionRect.topLeft().y();
       
   875             }
       
   876             //The probabilty of the key is based on the intersaction area.
       
   877             probability = (height * width) / (intersactionRect.width()* intersactionRect.height());
       
   878             HbKeyPressProbability probablekey;
       
   879             probablekey.keycode = d->keyCode(buttonItem);
       
   880             probablekey.probability = probability;
       
   881 
       
   882             if(probablekey.keycode && (probablekey.probability>0)) {
       
   883                 probableKeys.append(probablekey);
       
   884             }
       
   885         }
       
   886     }
       
   887     //Normalize makes sure that all probability summation is 1.0.
       
   888     d->normalizeProbabilities(probableKeys);
       
   889     return probableKeys;
       
   890 }
       
   891 
       
   892 /*!
       
   893 \deprecated HbInputVkbWidget::setupToolCluster()
       
   894     is deprecated.
       
   895 */
       
   896 void HbInputVkbWidget::setupToolCluster()
       
   897 {
       
   898     Q_D(HbInputVkbWidget);
       
   899     if(!d->mOwner || !d->mOwner->focusObject()) {
       
   900         return;
       
   901     }
       
   902 
       
   903     // Create settings button if it does not exist
       
   904     if (!d->mSettingsButton) {
       
   905         d->mSettingsButton = new HbTouchKeypadButton(this, QString(""));
       
   906         d->mInputModeIndicator = new HbInputModeIndicator(*d->mSettingsButton, this);
       
   907         d->mSettingsButton->setButtonType(HbTouchKeypadButton::HbTouchButtonFunction);
       
   908         d->mSettingsButton->setBackgroundAttributes(HbTouchKeypadButton::HbTouchButtonReleased);
       
   909 
       
   910         connect(d->mSettingsButton, SIGNAL(clicked()), this, SLOT(showSettingList()));
       
   911 
       
   912         connect(d->mSettingsButton, SIGNAL(pressed()), d->mPressMapper, SLOT(map()));
       
   913         connect(d->mSettingsButton, SIGNAL(released()), d->mReleaseMapper, SLOT(map()));
       
   914         d->mPressMapper->setMapping(d->mSettingsButton, -1);
       
   915         d->mReleaseMapper->setMapping(d->mSettingsButton, -1);
       
   916     } else {
       
   917         d->mInputModeIndicator->updateIndicator();
       
   918     }
       
   919 
       
   920     // If there's a application specific button defined, create new button with the properties
       
   921     // or update the existing one. Otherwise create an empty button or clean the properties of an existing one.
       
   922     if (!d->mOwner->focusObject()->editorInterface().actions().isEmpty()) {
       
   923         QList<HbAction*> actions = d->mOwner->focusObject()->editorInterface().actions();
       
   924         if (d->mApplicationButtonAction != actions.first()) {
       
   925             if (d->mApplicationButton) {
       
   926                 d->mApplicationButton->setText(actions.first()->text());
       
   927                 d->mApplicationButton->setIcon(actions.first()->icon());
       
   928                 d->mApplicationButton->disconnect(SIGNAL(clicked()));
       
   929                 d->mApplicationButton->disconnect(SIGNAL(pressed()));
       
   930                 d->mApplicationButton->disconnect(SIGNAL(released()));
       
   931 
       
   932                 // disconnects old signal
       
   933                 disconnect(d->mApplicationButtonAction, SIGNAL(changed()), this, SLOT(refreshApplicationButton()));
       
   934                 disconnect(d->mApplicationButton, SIGNAL(clicked()), d->mApplicationButtonAction, SLOT(trigger()));
       
   935             } else {
       
   936                 d->mApplicationButton = new HbTouchKeypadButton(this, actions.first()->icon(), actions.first()->text());
       
   937             }
       
   938             d->mApplicationButtonAction = actions.first();
       
   939             // Connect to enabling signal and check its value
       
   940             connect(actions.first(), SIGNAL(changed()), this, SLOT(refreshApplicationButton()));
       
   941 
       
   942             if (actions.first()->isEnabled()) {
       
   943                 // action is enabled
       
   944                 connect(d->mApplicationButton, SIGNAL(clicked()), d->mApplicationButtonAction, SLOT(trigger()));
       
   945 
       
   946                 connect(d->mApplicationButton, SIGNAL(pressed()), d->mPressMapper, SLOT(map()));
       
   947                 connect(d->mApplicationButton, SIGNAL(released()), d->mReleaseMapper, SLOT(map()));
       
   948                 d->mPressMapper->setMapping(d->mApplicationButton, -1);
       
   949                 d->mReleaseMapper->setMapping(d->mApplicationButton, -1);
       
   950 
       
   951                 d->mApplicationButton->setToolTip(actions.first()->toolTip());
       
   952                 d->mApplicationButton->setButtonType(HbTouchKeypadButton::HbTouchButtonFunction);
       
   953                 d->mApplicationButton->setBackgroundAttributes(HbTouchKeypadButton::HbTouchButtonReleased);
       
   954             } else {
       
   955                 // action is disabled
       
   956                 d->mApplicationButton->setButtonType(HbTouchKeypadButton::HbTouchButtonFnInActive);
       
   957                 d->mApplicationButton->setBackgroundAttributes(HbTouchKeypadButton::HbTouchButtonPressed);
       
   958             }
       
   959             d->mApplicationButton->setToolTip(actions.first()->toolTip());
       
   960         }
       
   961     } else {
       
   962         if (d->mApplicationButton) {
       
   963             if (d->mApplicationButtonAction) {
       
   964                 disconnect(d->mApplicationButtonAction, SIGNAL(changed()), this, SLOT(refreshApplicationButton()));
       
   965             }
       
   966             d->mApplicationButton->disconnect(SIGNAL(clicked()));
       
   967             d->mApplicationButton->disconnect(SIGNAL(pressed()));
       
   968             d->mApplicationButton->disconnect(SIGNAL(released()));
       
   969             d->mApplicationButton->setText(QString());
       
   970             d->mApplicationButton->setIcon(HbIcon());
       
   971             d->mApplicationButton->setToolTip(QString());
       
   972             d->mApplicationButtonAction = 0;
       
   973         } else {
       
   974             d->mApplicationButton = new HbTouchKeypadButton(this, QString());
       
   975             d->mApplicationButton->setButtonType(HbTouchKeypadButton::HbTouchButtonFunction);
       
   976             d->mApplicationButton->setBackgroundAttributes(HbTouchKeypadButton::HbTouchButtonReleased);
       
   977         }
       
   978         d->mApplicationButtonAction = 0;
       
   979     }
       
   980 }
   910 }
   981 
   911 
   982 /*!
   912 /*!
   983 Refines the bounding rect. This function is used for collision detection
   913 Refines the bounding rect. This function is used for collision detection
   984 and hit test.
   914 and hit test.
  1032 
   962 
  1033     if (d->mSmileyPicker) {
   963     if (d->mSmileyPicker) {
  1034         d->mSmileyPicker->setGeometry(QRectF(0, pos().y(), geometry().width(),
   964         d->mSmileyPicker->setGeometry(QRectF(0, pos().y(), geometry().width(),
  1035             geometry().height()));
   965             geometry().height()));
  1036         d->mSmileyPicker->show();
   966         d->mSmileyPicker->show();
  1037     }
   967 
  1038 }
   968         HbInputButtonGroup *buttonGroup = static_cast<HbInputButtonGroup*>(contentItem());
  1039 
   969         if (buttonGroup) {
  1040 /*!
   970             buttonGroup->cancelButtonPress();
  1041 \deprecated HbInputVkbWidget::flickDirection()
   971         }
  1042     is deprecated.
   972     }
  1043 */
   973 }
       
   974 
  1044 HbInputVkbWidget::HbFlickDirection HbInputVkbWidget::flickDirection()
   975 HbInputVkbWidget::HbFlickDirection HbInputVkbWidget::flickDirection()
  1045 {
   976 {
  1046     Q_D(HbInputVkbWidget);
   977     Q_D(HbInputVkbWidget);
  1047     return d->mFlickDirection;
   978     return d->mFlickDirection;
  1048 }
   979 }
  1049 
   980 
  1050 /*!
   981 /*!
  1051 \deprecated HbInputVkbWidget::refreshApplicationButton()
   982 Sends key event to owning input method.
  1052     is deprecated.
   983 */
  1053 */
   984 void HbInputVkbWidget::sendKeyPressEvent(const QKeyEvent &event)
  1054 void HbInputVkbWidget::refreshApplicationButton()
   985 {
  1055 {
   986     Q_D(HbInputVkbWidget);
  1056     Q_D(HbInputVkbWidget);
   987 
  1057 
   988     if (d->mOwner) {
  1058     d->mApplicationButton->setText(d->mApplicationButtonAction->text());
   989         d->mOwner->filterEvent(&event);
  1059     d->mApplicationButton->setIcon(d->mApplicationButtonAction->icon());
   990     }
  1060 
   991 }
  1061     if (d->mApplicationButton->getButtonType() == HbTouchKeypadButton::HbTouchButtonFnInActive
   992 
  1062         && d->mApplicationButtonAction->isEnabled()) {
   993 /*!
  1063         // action has been enabled
   994 Sends key event to owning input method.
  1064         connect(d->mApplicationButton, SIGNAL(clicked()), d->mApplicationButtonAction, SLOT(trigger()));
   995 */
  1065         d->mApplicationButton->setToolTip(d->mApplicationButtonAction->toolTip());
   996 void HbInputVkbWidget::sendKeyDoublePressEvent(const QKeyEvent &event)
  1066         d->mApplicationButton->setFade(false);
   997 {
  1067     } else if (d->mApplicationButton->getButtonType() == HbTouchKeypadButton::HbTouchButtonFunction
   998     Q_D(HbInputVkbWidget);
  1068         && !d->mApplicationButtonAction->isEnabled()) {
   999 
  1069         // action has been disabled
  1000     if (d->mOwner) {
  1070         d->mApplicationButton->disconnect(SIGNAL(clicked()));
  1001         d->mOwner->filterEvent(&event);
  1071         d->mApplicationButton->setFade(true);
  1002     }
       
  1003 }
       
  1004 
       
  1005 /*!
       
  1006 Sends key event to owning input method.
       
  1007 */
       
  1008 void HbInputVkbWidget::sendKeyReleaseEvent(const QKeyEvent &event)
       
  1009 {
       
  1010     Q_D(HbInputVkbWidget);
       
  1011 
       
  1012     if (event.key() == HbInputButton::ButtonKeyCodeSettings) {
       
  1013         showSettingList();
       
  1014     } else {
       
  1015         if (d->mOwner) {
       
  1016             d->mOwner->filterEvent(&event);
       
  1017         }
       
  1018     }
       
  1019 }
       
  1020 
       
  1021 /*!
       
  1022 Sends key event to owning input method.
       
  1023 */
       
  1024 void HbInputVkbWidget::sendLongPressEvent(const QKeyEvent &event)
       
  1025 {
       
  1026     Q_D(HbInputVkbWidget);
       
  1027 
       
  1028     if (d->mOwner) {
       
  1029         d->mOwner->filterEvent(&event);
       
  1030     }
       
  1031 }
       
  1032 
       
  1033 /*!
       
  1034 Sends key event to owning input method.
       
  1035 Releae event is ignored.
       
  1036 */
       
  1037 void HbInputVkbWidget::sendKeyChangeEvent(const QKeyEvent &releaseEvent, const QKeyEvent &pressEvent)
       
  1038 {
       
  1039     Q_D(HbInputVkbWidget);
       
  1040     Q_UNUSED(releaseEvent);
       
  1041 
       
  1042     if (d->mOwner) {
       
  1043         d->mOwner->filterEvent(&pressEvent);
  1072     }
  1044     }
  1073 }
  1045 }
  1074 
  1046 
  1075 void HbInputVkbWidget::keypadLanguageChangeAnimationUpdate(qreal value)
  1047 void HbInputVkbWidget::keypadLanguageChangeAnimationUpdate(qreal value)
  1076 {
  1048 {
  1077     Q_D(HbInputVkbWidget);
  1049     Q_D(HbInputVkbWidget);
  1078 
  1050 
  1079     int direction = 1;
  1051     int direction = 1;
  1080     if (flickDirection() == HbFlickDirectionLeft) {
  1052     if (d->mFlickDirection == HbFlickDirectionLeft) {
  1081         direction = -1;
  1053         direction = -1;
  1082     }
  1054     }
  1083 
  1055 
  1084     QRectF rect = boundingRect();
  1056     QRectF rect = boundingRect();
  1085     QPointF position = pos();
  1057     QPointF position = pos();
  1165 
  1137 
  1166     if(HbSwipeGesture *gesture = qobject_cast<HbSwipeGesture *>(event->gesture(Qt::SwipeGesture))) {
  1138     if(HbSwipeGesture *gesture = qobject_cast<HbSwipeGesture *>(event->gesture(Qt::SwipeGesture))) {
  1167         if (gesture->state() == Qt::GestureFinished) {
  1139         if (gesture->state() == Qt::GestureFinished) {
  1168             HbWidgetFeedback::triggered(this, Hb::InstantFlicked);
  1140             HbWidgetFeedback::triggered(this, Hb::InstantFlicked);
  1169             // vertical swipes
  1141             // vertical swipes
  1170             if (gesture->sceneSwipeAngle() > 250 && gesture->sceneSwipeAngle() < 290 &&
  1142             if (gesture->sceneVerticalDirection() == QSwipeGesture::Down) {
  1171                     gesture->sceneVerticalDirection() == QSwipeGesture::Down) {
       
  1172                 d->mFlickDirection = HbFlickDirectionDown;
  1143                 d->mFlickDirection = HbFlickDirectionDown;
       
  1144                 emit flickEvent(d->mFlickDirection);
  1173                 emit keypadCloseEventDetected(HbVkbCloseMethodCloseGesture);
  1145                 emit keypadCloseEventDetected(HbVkbCloseMethodCloseGesture);
  1174             } else if (gesture->sceneSwipeAngle() > 70 && gesture->sceneSwipeAngle() < 110 &&
  1146             } else if (gesture->sceneVerticalDirection() == QSwipeGesture::Up) {
  1175                            gesture->sceneVerticalDirection() == QSwipeGesture::Up) {
       
  1176                 d->mFlickDirection = HbFlickDirectionUp;
  1147                 d->mFlickDirection = HbFlickDirectionUp;
       
  1148                 emit flickEvent(d->mFlickDirection);
  1177                 d->mCurrentHost->openKeypad(d->mCurrentHost->activeKeypad(), d->mOwner);
  1149                 d->mCurrentHost->openKeypad(d->mCurrentHost->activeKeypad(), d->mOwner);
  1178             } else {
  1150             } else {
  1179                 d->mFlickDirection = (HbInputVkbWidget::HbFlickDirection)gesture->sceneHorizontalDirection();
  1151                 d->mFlickDirection = (HbInputVkbWidget::HbFlickDirection)gesture->sceneHorizontalDirection();
  1180                 // horizontal swipes
  1152                 // horizontal swipes
  1181                 if (d->mFlickAnimation){
  1153                 if (d->mFlickAnimation){