src/hbplugins/inputmethods/touchinput/hbinput12keytouchkeyboard.cpp
changeset 28 b7da29130b0e
parent 23 e6ad4ef83b23
equal deleted inserted replaced
23:e6ad4ef83b23 28:b7da29130b0e
    40 const qreal HbKeyboardHeightInUnits = 36.9;
    40 const qreal HbKeyboardHeightInUnits = 36.9;
    41 const qreal HbKeyboardWidthInUnits = 53.8;
    41 const qreal HbKeyboardWidthInUnits = 53.8;
    42 
    42 
    43 const int HbFirstRowIndex = 0;
    43 const int HbFirstRowIndex = 0;
    44 const int HbSecondRowIndex = 2;
    44 const int HbSecondRowIndex = 2;
       
    45 const int HbNumberIndex = 4;
    45 const int HbVirtual12KeyNumberOfRows = 4;
    46 const int HbVirtual12KeyNumberOfRows = 4;
    46 const int HbVirtual12KeyNumberOfColumns = 4;
    47 const int HbVirtual12KeyNumberOfColumns = 4;
    47 const int HbButtonKeyCodeTable[HbVirtual12KeyNumberOfRows * HbVirtual12KeyNumberOfColumns] =
    48 const int HbButtonKeyCodeTable[HbVirtual12KeyNumberOfRows * HbVirtual12KeyNumberOfColumns] =
    48 {
    49 {
    49     HbInputButton::ButtonKeyCodeCharacter,
    50     HbInputButton::ButtonKeyCodeCharacter,
   210                         }
   211                         }
   211                     } else {
   212                     } else {
   212                         keyboardMap = mKeymap->keyboard(HbKeyboardVirtual12Key);
   213                         keyboardMap = mKeymap->keyboard(HbKeyboardVirtual12Key);
   213                     }
   214                     }
   214 
   215 
   215                     if (labelMap && key < labelMap->keys.count()) {
   216                     if (labelMap && key < labelMap->keys.count() &&
   216                         numChr = labelMap->keys.at(key)->keycode;
   217                         !(mOwner->focusObject() && mOwner->focusObject()->editorInterface().isNumericEditor())) {
       
   218                         numChr = keyLabel(labelMap->keys.at(key)->chars, HbNumberIndex).at(0);
   217                     }
   219                     }
   218 
   220 
   219                     // Fallback to normal keymappings if key labels are not present
   221                     // Fallback to normal keymappings if key labels are not present
   220                     if (keyboardMap && key < keyboardMap->keys.count() && numChr.isNull()) {
   222                     if (keyboardMap && key < keyboardMap->keys.count() && numChr.isNull()) {
   221                         numChr = numberCharacterBoundToKey(key);
   223                         numChr = numberCharacterBoundToKey(key);
   249                     }
   251                     }
   250 
   252 
   251                     if (labelMap && key < labelMap->keys.count()) {
   253                     if (labelMap && key < labelMap->keys.count()) {
   252                         firstRow = keyLabel(labelMap->keys.at(key)->chars, HbFirstRowIndex | mModifiers);
   254                         firstRow = keyLabel(labelMap->keys.at(key)->chars, HbFirstRowIndex | mModifiers);
   253                         secondRow = keyLabel(labelMap->keys.at(key)->chars, HbSecondRowIndex | mModifiers);
   255                         secondRow = keyLabel(labelMap->keys.at(key)->chars, HbSecondRowIndex | mModifiers);
   254                         numChr = labelMap->keys.at(key)->keycode;
   256                         if (!(mOwner->focusObject() && mOwner->focusObject()->editorInterface().isNumericEditor())) {
       
   257                             numChr = keyLabel(labelMap->keys.at(key)->chars, HbNumberIndex).at(0);
       
   258                         }
   255                     }
   259                     }
   256 
   260 
   257                     // Fallback to normal keymappings if key labels are not present
   261                     // Fallback to normal keymappings if key labels are not present
   258                     if (keyboardMap && key < keyboardMap->keys.count()) {
   262                     if (keyboardMap && key < keyboardMap->keys.count()) {
   259                         if (firstRow.isEmpty()) {
   263                         if (firstRow.isEmpty()) {
   319     }
   323     }
   320 }
   324 }
   321 
   325 
   322 QString Hb12KeyTouchKeyboardPrivate::keyLabel(const QStringList &labels, int index)
   326 QString Hb12KeyTouchKeyboardPrivate::keyLabel(const QStringList &labels, int index)
   323 {
   327 {
   324     if (index == HbFirstRowIndex && labels.count() >= 2) {
   328     if (index == HbNumberIndex && labels.count() >= 1) {
       
   329         return labels.at(0);
       
   330     } else if (index == HbFirstRowIndex && labels.count() >= 2) {
   325         return labels.at(1);
   331         return labels.at(1);
   326     } else if (index == (HbFirstRowIndex | HbModifierShiftPressed) && labels.count() >= 3) {
   332     } else if (index == (HbFirstRowIndex | HbModifierShiftPressed) && labels.count() >= 3) {
   327         return labels.at(2);
   333         return labels.at(2);
   328     } else if (index == HbSecondRowIndex && labels.count() >= 4) {
   334     } else if (index == HbSecondRowIndex && labels.count() >= 4) {
   329         return labels.at(3);
   335         return labels.at(3);