QChar HbInputVkbWidgetPrivate::numberCharacterBoundToKey(int key) { QChar numChr; if (!mKeymap || !mOwner) { return numChr; } HbInputFocusObject *focusObject = mOwner->focusObject(); if (!focusObject) { return numChr; } HbInputLanguage language = mKeymap->language(); if (language.language() != (QLocale::Language)0) { HbInputDigitType digitType = HbInputUtils::inputDigitType(language); // In number editors, show the native digits only when both device and writing languages are same, // else show latin digits if (focusObject->editorInterface().isNumericEditor()) { QLocale::Language systemLanguage = QLocale::system().language(); if (language.language() != systemLanguage) { digitType = HbDigitTypeLatin; } } HbKeyboardType keyboardType = mOwner->inputState().keyboard(); if (keyboardType == HbKeyboardVirtual12Key) { numChr = HbInputUtils::findFirstNumberCharacterBoundToKey( mKeymap->keyboard(keyboardType)->keys.at(key), language, digitType); } else if (keyboardType == HbKeyboardVirtualQwerty) { switch (digitType) { case HbDigitTypeLatin: numChr = HB_DIGIT_LATIN_START_VALUE + key; break; case HbDigitTypeArabicIndic: numChr = HB_DIGIT_ARABIC_INDIC_START_VALUE + key; break; case HbDigitTypeEasternArabic: numChr = HB_DIGIT_EASTERN_ARABIC_START_VALUE + key; break; case HbDigitTypeDevanagari: numChr = HB_DIGIT_DEVANAGARI_START_VALUE + key; break; default: break; } } } return numChr; }
// ---------------------------------------------------------------------------- // C12keyKeyMap::ReadExtraCharacters // The special chars that are listed in HbKeyboardSctPortrait, but not in // HbKeyboardVirtual12Key, are mapped to key-* except the hardcoded characters // "+*#". // ---------------------------------------------------------------------------- TInt C12keyKeyMap::ReadExtraCharacters(const HbInputLanguage& aLanguage) { PRINT(_L("C12keyKeyMap::ReadExtraCharacters")); TInt count(0); // How many new keys have been mapped #if defined(NEW_KEYMAP_FACTORY_API) // Takes ownership QScopedPointer<const HbKeymap> keymap( HbKeymapFactory::instance()->keymap(aLanguage, HbKeymapFactory::NoCaching)); #else const HbKeymap* keymap = HbKeymapFactory::instance()->keymap(aLanguage, HbKeymapFactory::Default); #endif if (keymap) { TInt i(0); const HbMappedKey* mappedKey = keymap->keyForIndex(HbKeyboardSctPortrait, i); while (mappedKey) { AddNewKeyToMap(EKeyStar, mappedKey->characters(HbModifierNone), count); mappedKey = keymap->keyForIndex(HbKeyboardSctPortrait, ++i); } } else { PRINT1(_L("no keymap for language %d"), aLanguage.language()); } PRINT1(_L("End C12keyKeyMap::ReadExtraCharacters added %d chars"), count); return count; }