src/hbplugins/inputmethods/common/hbinputabstractbase.cpp
changeset 5 627c4a0fd0e7
parent 2 06ff229162e9
child 21 4633027730f5
child 34 ed14f46c0e55
--- a/src/hbplugins/inputmethods/common/hbinputabstractbase.cpp	Thu May 27 13:10:59 2010 +0300
+++ b/src/hbplugins/inputmethods/common/hbinputabstractbase.cpp	Fri Jun 11 13:58:22 2010 +0300
@@ -27,6 +27,8 @@
 #include <hbinputvkbwidget.h>
 #include <hbinputcandidatelist.h>
 #include <hbmainwindow.h>
+#include <hbaction.h>
+#include <hbinputsettingproxy.h>
 
 #include "hbinputabstractbase.h"
 
@@ -38,6 +40,7 @@
 // ---------------------------------------------------------------------------
 HbInputAbstractMethod::HbInputAbstractMethod()
 {
+    mVanillQwertySwitch = new HbAction(QString("QTY"));
 }
 
 // ---------------------------------------------------------------------------
@@ -46,6 +49,7 @@
 // ---------------------------------------------------------------------------
 HbInputAbstractMethod::~HbInputAbstractMethod()
 {
+    delete mVanillQwertySwitch;
 }
 
 // ---------------------------------------------------------------------------
@@ -156,18 +160,60 @@
     }
 }
 
-void HbInputAbstractMethod::showThaiSpecialCharacters(uint buttonId)
-{
-	Q_UNUSED(buttonId);
-}
 
 bool HbInputAbstractMethod::isSctModeActive() const
 {
 	return false;
 }
 
+
 HbKeyboardType HbInputAbstractMethod::currentKeyboardType() const
 {
     return HbKeyboardNone;
 }
+
+void HbInputAbstractMethod::focusReceived()
+{
+    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)));
+            connect(mVanillQwertySwitch, SIGNAL(triggered(bool)), this, SLOT(switchKeypad(bool)));
+            focusObject()->editorInterface().addAction(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);
+    }
+}
+
+// EOF
+
+
+
    
+QChar HbInputAbstractMethod ::previousChar()
+{
+	return QChar();
+}
+
+
+// EOF
+