src/hbinput/inputwidgets/hbinputsctkeyboard.cpp
changeset 23 e6ad4ef83b23
parent 21 4633027730f5
child 28 b7da29130b0e
--- a/src/hbinput/inputwidgets/hbinputsctkeyboard.cpp	Wed Aug 18 10:05:37 2010 +0300
+++ b/src/hbinput/inputwidgets/hbinputsctkeyboard.cpp	Thu Sep 02 20:44:51 2010 +0300
@@ -34,6 +34,7 @@
 #include <hbinpututils.h>
 #include <hbframedrawer.h>
 #include <hbinputsettingproxy.h>
+#include <hbmainwindow.h>
 
 #include "hbinputbuttongroup.h"
 #include "hbinputbutton.h"
@@ -156,7 +157,12 @@
 
     HbInputVkbWidgetPrivate::init();
 
-    if (HbInputSettingProxy::instance()->activeKeyboard() & HbQwertyKeyboardMask) {
+    Qt::Orientation orientation = Qt::Horizontal;
+    if (q->mainWindow()) {
+        orientation = q->mainWindow()->orientation();
+    }
+
+    if (HbInputSettingProxy::instance()->activeKeyboard(orientation) & HbQwertyKeyboardMask) {
         mType = HbKeyboardSctLandscape;
     } else {
         mType = HbKeyboardSctPortrait;
@@ -193,7 +199,7 @@
             } else if (keyCode(i) == HbInputButton::ButtonKeyCodeAlphabet) {
                 // Button that is used to return to normal keypad should be shown as latched
                 item->setState(HbInputButton::ButtonStateLatched);
-				if (mType == HbKeyboardSctPortrait || mType == HbKeyboardSctEmail || mType == HbKeyboardSctUrl ) {
+                if (mType == HbKeyboardSctPortrait || mType == HbKeyboardSctEmail || mType == HbKeyboardSctUrl ) {
                     // Portrait SCT has different symbol icon from the default one
                     item->setIcon(HbIcon(HbInputButtonIconSymbol2), HbInputButton::ButtonIconIndexPrimary);
                 }
@@ -275,16 +281,24 @@
 void HbSctKeyboardPrivate::updateKeyCodes()
 {
     Q_Q(HbSctKeyboard);
+
     HbInputFocusObject *focusedObject = mOwner->focusObject();
     if (!focusedObject) {
         return;
     }
 
-    if (HbInputSettingProxy::instance()->activeKeyboard() & HbQwertyKeyboardMask){
+    Qt::Orientation orientation = Qt::Horizontal;
+    if (q->mainWindow()) {
+        orientation = q->mainWindow()->orientation();
+    }
+
+    if (HbInputSettingProxy::instance()->activeKeyboard(orientation) & HbQwertyKeyboardMask){
         mType = HbKeyboardSctLandscape;
-    } else if (focusedObject && focusedObject->editorInterface().editorClass() == HbInputEditorClassEmail) {
+    } else if (focusedObject && focusedObject->editorInterface().editorClass() == HbInputEditorClassEmail &&
+               mKeymap->keyboard(HbKeyboardSctEmail)) {
         mType = HbKeyboardSctEmail;
-    } else if (focusedObject && focusedObject->editorInterface().editorClass() == HbInputEditorClassUrl) {
+    } else if (focusedObject && focusedObject->editorInterface().editorClass() == HbInputEditorClassUrl &&
+               mKeymap->keyboard(HbKeyboardSctUrl)) {
         mType = HbKeyboardSctUrl;
     } else {
         mType = HbKeyboardSctPortrait;
@@ -309,13 +323,13 @@
                 if (keyboardMap && key < keyboardMap->keys.count()) {
                     // Replace space and enter markers with correct keycodes
                     if (focusedObject->characterAllowedInEditor(keyboardMap->keys.at(key)->characters(HbModifierNone).at(0)) || mType == HbKeyboardSctLandscape){
-	                    if (keyboardMap->keys.at(key)->keycode.unicode() == HbSctSpaceMarker) {
-    	                    item->setKeyCode(HbInputButton::ButtonKeyCodeSpace);
-        	            } else if (keyboardMap->keys.at(key)->keycode.unicode() == HbSctEnterMarker) {
-            	            item->setKeyCode(HbInputButton::ButtonKeyCodeEnter);
-                	    } else {
-                    	    item->setKeyCode(keyboardMap->keys.at(key)->keycode.unicode());
-                    	}
+                        if (keyboardMap->keys.at(key)->keycode.unicode() == HbSctSpaceMarker) {
+                            item->setKeyCode(HbInputButton::ButtonKeyCodeSpace);
+                        } else if (keyboardMap->keys.at(key)->keycode.unicode() == HbSctEnterMarker) {
+                            item->setKeyCode(HbInputButton::ButtonKeyCodeEnter);
+                        } else {
+                            item->setKeyCode(keyboardMap->keys.at(key)->keycode.unicode());
+                        }
                     } else {
                         i--;
                     }
@@ -390,7 +404,7 @@
         if (keyboardMap && totalKeys < keyboardMap->keys.count()) {
             while (index){
                 if (focusedObject->characterAllowedInEditor(keyboardMap->keys.at(totalKeys)->characters(HbModifierNone).at(0))){
-                    index--;		            
+                    index--;                    
                 }
                 totalKeys++;
             }