src/hbplugins/inputmethods/touchinput/hbinput12keytouchkeyboard.cpp
changeset 21 4633027730f5
parent 7 923ff622b8b9
child 23 e6ad4ef83b23
equal deleted inserted replaced
7:923ff622b8b9 21:4633027730f5
   194             if (keyCode(i) == HbInputButton::ButtonKeyCodeCharacter) {
   194             if (keyCode(i) == HbInputButton::ButtonKeyCodeCharacter) {
   195 
   195 
   196                 if (mMode == EModeNumeric) {
   196                 if (mMode == EModeNumeric) {
   197                     QChar numChr;
   197                     QChar numChr;
   198                     const HbKeyboardMap *labelMap = mKeymap->keyboard(HbKeyboardVirtual12KeyLabels);
   198                     const HbKeyboardMap *labelMap = mKeymap->keyboard(HbKeyboardVirtual12KeyLabels);
   199                     const HbKeyboardMap *keyMap = mKeymap->keyboard(HbKeyboardVirtual12Key);
   199                     const HbKeyboardMap *keyboardMap; 
       
   200                     if (mOwner->focusObject() && mOwner->focusObject()->editorInterface().editorClass() == HbInputEditorClassEmail) {
       
   201                         keyboardMap = mKeymap->keyboard(HbKeyboardVirtual12KeyEmail);
       
   202                     } else if (mOwner->focusObject() && mOwner->focusObject()->editorInterface().editorClass() == HbInputEditorClassUrl) {
       
   203                         keyboardMap = mKeymap->keyboard(HbKeyboardVirtual12KeyUrl);
       
   204                     } else {
       
   205                         keyboardMap = mKeymap->keyboard(HbKeyboardVirtual12Key);
       
   206                     }
       
   207 
   200                     if (labelMap && key < labelMap->keys.count()) {
   208                     if (labelMap && key < labelMap->keys.count()) {
   201                         numChr = labelMap->keys.at(key)->keycode;
   209                         numChr = labelMap->keys.at(key)->keycode;
   202                     }
   210                     }
   203 
   211 
   204                     // Fallback to normal keymappings if key labels are not present
   212                     // Fallback to normal keymappings if key labels are not present
   205                     if (keyMap && key < keyMap->keys.count() && numChr.isNull()) {
   213                     if (keyboardMap && key < keyboardMap->keys.count() && numChr.isNull()) {
   206                         numChr = numberCharacterBoundToKey(key);
   214                         numChr = numberCharacterBoundToKey(key);
   207                     }
   215                     }
   208 
   216 
   209                     item->setText(numChr, HbInputButton::ButtonTextIndexPrimary);
   217                     item->setText(numChr, HbInputButton::ButtonTextIndexPrimary);
   210                     item->setText(QString(), HbInputButton::ButtonTextIndexSecondaryFirstRow);
   218                     item->setText(QString(), HbInputButton::ButtonTextIndexSecondaryFirstRow);
   215                 } else if (mMode == EModeAbc) {
   223                 } else if (mMode == EModeAbc) {
   216                     QString firstRow;
   224                     QString firstRow;
   217                     QString secondRow;
   225                     QString secondRow;
   218                     QChar numChr;
   226                     QChar numChr;
   219                     const HbKeyboardMap *labelMap = mKeymap->keyboard(HbKeyboardVirtual12KeyLabels);
   227                     const HbKeyboardMap *labelMap = mKeymap->keyboard(HbKeyboardVirtual12KeyLabels);
   220                     const HbKeyboardMap *keyMap = mKeymap->keyboard(HbKeyboardVirtual12Key);
   228                     const HbKeyboardMap *keyboardMap;
       
   229                     
       
   230                     if (mOwner->focusObject() && mOwner->focusObject()->editorInterface().editorClass() == HbInputEditorClassEmail) {
       
   231                         keyboardMap = mKeymap->keyboard(HbKeyboardVirtual12KeyEmail);
       
   232                     } else if (mOwner->focusObject() && mOwner->focusObject()->editorInterface().editorClass() == HbInputEditorClassUrl) {
       
   233                         keyboardMap = mKeymap->keyboard(HbKeyboardVirtual12KeyUrl);
       
   234                     } else {
       
   235                         keyboardMap = mKeymap->keyboard(HbKeyboardVirtual12Key);
       
   236                     }
       
   237 
   221                     if (labelMap && key < labelMap->keys.count()) {
   238                     if (labelMap && key < labelMap->keys.count()) {
   222                         firstRow = keyLabel(labelMap->keys.at(key)->chars, HbFirstRowIndex | mModifiers);
   239                         firstRow = keyLabel(labelMap->keys.at(key)->chars, HbFirstRowIndex | mModifiers);
   223                         secondRow = keyLabel(labelMap->keys.at(key)->chars, HbSecondRowIndex | mModifiers);
   240                         secondRow = keyLabel(labelMap->keys.at(key)->chars, HbSecondRowIndex | mModifiers);
   224                         numChr = labelMap->keys.at(key)->keycode;
   241                         numChr = labelMap->keys.at(key)->keycode;
   225                     }
   242                     }
   226 
   243 
   227                     // Fallback to normal keymappings if key labels are not present
   244                     // Fallback to normal keymappings if key labels are not present
   228                     if (keyMap && key < keyMap->keys.count()) {
   245                     if (keyboardMap && key < keyboardMap->keys.count()) {
   229                         if (firstRow.isEmpty()) {
   246                         if (firstRow.isEmpty()) {
   230                             firstRow = keyMap->keys.at(key)->characters(mModifiers);
   247                             firstRow = keyboardMap->keys.at(key)->characters(mModifiers);
   231                             if (mOwner->focusObject()) {
   248                             if (mOwner->focusObject()) {
   232                                 QString allowedData;
   249                                 QString allowedData;
   233                                 mOwner->focusObject()->filterStringWithEditorFilter(firstRow, allowedData);
   250                                 mOwner->focusObject()->filterStringWithEditorFilter(firstRow, allowedData);
   234                                 firstRow = allowedData.left(3);
   251                                 firstRow = allowedData.left(3);
   235                             } else {
   252                             } else {
   334 /*!
   351 /*!
   335 Returns keyboard type.
   352 Returns keyboard type.
   336 */
   353 */
   337 HbKeyboardType Hb12KeyTouchKeyboard::keyboardType() const
   354 HbKeyboardType Hb12KeyTouchKeyboard::keyboardType() const
   338 {
   355 {
       
   356     Q_D(const Hb12KeyTouchKeyboard);
       
   357 
       
   358     if (d->mOwner->focusObject())
       
   359     {
       
   360         if (d->mOwner->focusObject()->editorInterface().editorClass() == HbInputEditorClassEmail) {
       
   361             return HbKeyboardVirtual12KeyEmail;
       
   362         } else if (d->mOwner->focusObject()->editorInterface().editorClass() == HbInputEditorClassUrl) {
       
   363             return HbKeyboardVirtual12KeyUrl;
       
   364         }
       
   365     }
   339     return HbKeyboardVirtual12Key;
   366     return HbKeyboardVirtual12Key;
   340 }
   367 }
   341 
   368 
   342 /*!
   369 /*!
   343 Returns preferred keyboard size. HbVkbHost uses this information when it opens the keyboard.
   370 Returns preferred keyboard size. HbVkbHost uses this information when it opens the keyboard.