src/hbinput/inputwidgets/hbinputsctkeyboard.cpp
changeset 30 80e4d18b72f5
parent 28 b7da29130b0e
equal deleted inserted replaced
28:b7da29130b0e 30:80e4d18b72f5
    33 #include <hbinputkeymap.h>
    33 #include <hbinputkeymap.h>
    34 #include <hbinpututils.h>
    34 #include <hbinpututils.h>
    35 #include <hbframedrawer.h>
    35 #include <hbframedrawer.h>
    36 #include <hbinputsettingproxy.h>
    36 #include <hbinputsettingproxy.h>
    37 #include <hbmainwindow.h>
    37 #include <hbmainwindow.h>
       
    38 #include <hbwidgetfeedback.h>
    38 
    39 
    39 #include "hbinputbuttongroup.h"
    40 #include "hbinputbuttongroup.h"
    40 #include "hbinputbutton.h"
    41 #include "hbinputbutton.h"
    41 
    42 
    42 const qreal HbPortraitKeyboardHeightInUnits = 45.9;
    43 const qreal HbPortraitKeyboardHeightInUnits = 45.9;
   128 const QChar HbSctSpaceGlyph = ' ';
   129 const QChar HbSctSpaceGlyph = ' ';
   129 const QChar HbSctEnterGlyph = ' ';
   130 const QChar HbSctEnterGlyph = ' ';
   130 #endif
   131 #endif
   131 
   132 
   132 /*!
   133 /*!
   133 @proto
   134 @stable
   134 @hbinput
   135 @hbinput
   135 \class HbSctKeyboard
   136 \class HbSctKeyboard
   136 \brief Touch keyboard for special characters
   137 \brief Touch keyboard for special characters
   137 
   138 
   138 Implements special character keyboard. The keyboard knows how to set up button titles according to
   139 Implements special character keyboard. The keyboard knows how to set up button titles according to
   434         }
   435         }
   435     }
   436     }
   436     return totalKeys;
   437     return totalKeys;
   437 }
   438 }
   438 
   439 
       
   440 void HbSctKeyboardPrivate::changePage(HbInputVkbWidget::HbFlickDirection flickDirection)
       
   441 {
       
   442     if (mFlickAnimation) {
       
   443         int direction = 1;
       
   444         if (flickDirection == HbInputVkbWidget::HbFlickDirectionRight) {
       
   445             direction = -1;
       
   446         }
       
   447 
       
   448         mActivePage = (mActivePage + direction) % mPages;
       
   449         if (mActivePage < 0) {
       
   450             mActivePage = mPages - 1;
       
   451         }
       
   452         updateButtons();
       
   453         updateKeyCodes();
       
   454     }
       
   455 }
       
   456 
   439 /*!
   457 /*!
   440 Constructs the object. owner is the owning input method implementation. Keymap
   458 Constructs the object. owner is the owning input method implementation. Keymap
   441 is key mapping data to be used to display button texts. Key mapping data can be
   459 is key mapping data to be used to display button texts. Key mapping data can be
   442 changed later (for example when the input language changes) by calling
   460 changed later (for example when the input language changes) by calling
   443 setKeymap.
   461 setKeymap.
   562 */
   580 */
   563 void HbSctKeyboard::changePage(HbInputVkbWidget::HbFlickDirection flickDirection)
   581 void HbSctKeyboard::changePage(HbInputVkbWidget::HbFlickDirection flickDirection)
   564 {
   582 {
   565     Q_D(HbSctKeyboard);
   583     Q_D(HbSctKeyboard);
   566 
   584 
   567     if (d->mFlickAnimation) {
   585     if (d->mFlickAnimation &&
   568         int direction = 1;
   586         (flickDirection == HbInputVkbWidget::HbFlickDirectionRight ||
   569         if (flickDirection == HbInputVkbWidget::HbFlickDirectionRight) {
   587         flickDirection == HbInputVkbWidget::HbFlickDirectionLeft)) {
   570             direction = -1;
   588         
   571         }
   589         HbWidgetFeedback::triggered(this, Hb::InstantFlicked);
   572 
   590         d->changePage(flickDirection);
   573         d->mActivePage = (d->mActivePage + direction) % d->mPages;
       
   574         if (d->mActivePage < 0) {
       
   575             d->mActivePage = d->mPages - 1;
       
   576         }
       
   577         d->updateButtons();
       
   578         d->updateKeyCodes();
       
   579     }
   591     }
   580 }
   592 }
   581 
   593 
   582 /*!
   594 /*!
   583 Sends key event to owning input method.
   595 Sends key event to owning input method.
   593 /*!
   605 /*!
   594 Sends key event to owning input method.
   606 Sends key event to owning input method.
   595 */
   607 */
   596 void HbSctKeyboard::sendKeyReleaseEvent(const QKeyEvent &event)
   608 void HbSctKeyboard::sendKeyReleaseEvent(const QKeyEvent &event)
   597 {
   609 {
       
   610     Q_D(HbSctKeyboard);
       
   611 
   598     if (event.key() == HbInputButton::ButtonKeyCodePageChange) {
   612     if (event.key() == HbInputButton::ButtonKeyCodePageChange) {
   599         changePage(HbInputVkbWidget::HbFlickDirectionLeft);
   613         d->changePage(HbInputVkbWidget::HbFlickDirectionLeft);
   600     } else if (event.key() == HbInputButton::ButtonKeyCodeSmiley) {
   614     } else if (event.key() == HbInputButton::ButtonKeyCodeSmiley) {
   601         showSmileyPicker();
   615         showSmileyPicker();
   602     } else {
   616     } else {
   603         HbInputVkbWidget::sendKeyReleaseEvent(event);
   617         HbInputVkbWidget::sendKeyReleaseEvent(event);
   604     }
   618     }