src/hbplugins/inputmethods/common/hbinputabstractbase.cpp
changeset 21 4633027730f5
parent 5 627c4a0fd0e7
child 23 e6ad4ef83b23
--- a/src/hbplugins/inputmethods/common/hbinputabstractbase.cpp	Tue Jul 06 14:36:53 2010 +0300
+++ b/src/hbplugins/inputmethods/common/hbinputabstractbase.cpp	Wed Aug 18 10:05:37 2010 +0300
@@ -193,14 +193,38 @@
     }
 }
 
+
+void HbInputAbstractMethod::focusLost()
+{
+    bool isVannilaApp = false;
+    QInputContext* context = qApp->inputContext();
+    if (context && context->focusWidget()) {
+        QWidget *focusedWidget = context->focusWidget();
+        if (!focusedWidget->inherits("HbMainWindow")) {
+            isVannilaApp = true;
+        }
+    }
+    
+    if(isVannilaApp &&  focusObject()) {
+        QList<HbAction*> customActions= focusObject()->editorInterface().actions();
+        if(customActions.contains(mVanillQwertySwitch)) {
+            disconnect(mVanillQwertySwitch, SIGNAL(triggered(bool)));
+            disconnect(mVanillQwertySwitch, SIGNAL(triggered(bool)), this, SLOT(switchKeypad(bool)));
+            focusObject()->editorInterface().removeAction(mVanillQwertySwitch);            
+        }
+    }
+}
+
 void HbInputAbstractMethod::switchKeypad(bool isActive)
 {
     Q_UNUSED(isActive);
-    HbKeyboardType keyboard = HbInputSettingProxy::instance()->activeKeyboard();
-    if (keyboard == HbKeyboardVirtual12Key) {
-        HbInputSettingProxy::instance()->setActiveKeyboard(HbKeyboardVirtualQwerty);
-    } else if (keyboard == HbKeyboardVirtualQwerty) {
-        HbInputSettingProxy::instance()->setActiveKeyboard(HbKeyboardVirtual12Key);
+    HbInputState state = inputState();
+    if (currentKeyboardType() == HbKeyboardVirtual12Key) {
+        state.setKeyboard(HbKeyboardVirtualQwerty);
+        activateState(state);
+    } else if (currentKeyboardType() == HbKeyboardVirtualQwerty) {
+        state.setKeyboard(HbKeyboardVirtual12Key);
+        activateState(state);
     }
 }