src/hbplugins/inputmethods/touchinput/hbinputqwertynumerictouchkeyboard.cpp
changeset 5 627c4a0fd0e7
parent 2 06ff229162e9
child 7 923ff622b8b9
--- a/src/hbplugins/inputmethods/touchinput/hbinputqwertynumerictouchkeyboard.cpp	Thu May 27 13:10:59 2010 +0300
+++ b/src/hbplugins/inputmethods/touchinput/hbinputqwertynumerictouchkeyboard.cpp	Fri Jun 11 13:58:22 2010 +0300
@@ -152,15 +152,20 @@
     HbInputButtonGroup *buttonGroup = static_cast<HbInputButtonGroup*>(q->contentItem());
     if (buttonGroup) {
         int key = 0;
+        int charKeyCount = 0;
+
         QList<HbInputButton*> buttons = buttonGroup->buttons();
         for (int i = 0; i < buttons.count(); ++i) {
             if (keyCode(i) == HbInputButton::ButtonKeyCodeCharacter) {
                 HbInputButton *item = buttons.at(i);
-
-                if (key < characters.count()) { 
+                // digits always comes in the first row
+                if (charKeyCount < 10) {
+                    item->setKeyCode(numberCharacterBoundToKey((charKeyCount + 1) % 10).unicode());
+                    charKeyCount++;
+                } else if (key < characters.count()) {
                     item->setKeyCode(characters.at(key).unicode());
+                    ++key;
                 }
-                ++key;
             }
         }
     }
@@ -176,17 +181,24 @@
     HbInputButtonGroup *buttonGroup = static_cast<HbInputButtonGroup*>(q->contentItem());
     if (buttonGroup) {
         int key = 0;
+        int charKeyCount = 0;
+
         QList<HbInputButton*> buttons = buttonGroup->buttons();
         for (int i = 0; i < buttons.count(); ++i) {
             if (keyCode(i) == HbInputButton::ButtonKeyCodeCharacter) {
                 HbInputButton *item = buttons.at(i);
-
-                if (key < characters.count()) {
-                    item->setText(characters.at(key), HbInputButton::ButtonTextIndexPrimary);
+                if (charKeyCount < 10) {
+                    item->setText(numberCharacterBoundToKey((charKeyCount + 1) % 10),
+                    HbInputButton::ButtonTextIndexPrimary);  
+                    charKeyCount++;					
                 } else {
-                    item->setText(QString(), HbInputButton::ButtonTextIndexPrimary);
-                }
-                ++key;
+                    if (key < characters.count()) {
+                        item->setText(characters.at(key), HbInputButton::ButtonTextIndexPrimary);
+                    } else {
+                        item->setText(QString(), HbInputButton::ButtonTextIndexPrimary);
+                    }
+                    ++key;
+                }					
             }
         }
         buttonGroup->setButtons(buttons);
@@ -195,32 +207,36 @@
 
 void HbQwertyNumericKeyboardPrivate::getCharacters(QString &characters)
 {
-    characters = QString("1234567890");
-
     if (mKeymap) {
         const HbKeyboardMap* keyboardMap = mKeymap->keyboard(HbKeyboardSctLandscape);
         if (!keyboardMap) {
             return;
         }
-
+        QString chars;
+		
         foreach (const HbMappedKey* mappedKey, keyboardMap->keys) {
-            QString chars = mappedKey->characters(HbModifierNone);
-            
+            chars.append(mappedKey->characters(HbModifierNone));
+        }          
             HbInputFocusObject *focusedObject = mOwner->focusObject();
             QString allowedChars;
             if (focusedObject) {
                 focusedObject->filterStringWithEditorFilter(chars, allowedChars);
             }
-
+            // Remove digits from it ( digits always come in the first row )
+            for (int i=0; i < 10; i++) {
+                allowedChars.remove(numberCharacterBoundToKey(i));
+            }	
+			
             foreach (QChar sctChar, allowedChars) {
                 if (!characters.contains(sctChar)) {
                     characters.append(sctChar);
                 }
             }
-        }
+        
     }
 }
 
+
 /*!
 Constructs the object. owner is the owning input method implementation. Keymap
 is key mapping data to be used to display button texts. Key mapping data can be