src/hbplugins/inputmethods/common/hbinputabstractbase.cpp
changeset 5 627c4a0fd0e7
parent 2 06ff229162e9
child 21 4633027730f5
child 34 ed14f46c0e55
equal deleted inserted replaced
3:11d3954df52a 5:627c4a0fd0e7
    25 
    25 
    26 #include <qglobal.h>
    26 #include <qglobal.h>
    27 #include <hbinputvkbwidget.h>
    27 #include <hbinputvkbwidget.h>
    28 #include <hbinputcandidatelist.h>
    28 #include <hbinputcandidatelist.h>
    29 #include <hbmainwindow.h>
    29 #include <hbmainwindow.h>
       
    30 #include <hbaction.h>
       
    31 #include <hbinputsettingproxy.h>
    30 
    32 
    31 #include "hbinputabstractbase.h"
    33 #include "hbinputabstractbase.h"
    32 
    34 
    33 const qreal HbDeltaHeight = 2.0;
    35 const qreal HbDeltaHeight = 2.0;
    34 
    36 
    36 // HbInputAbstractMethod::HbInputAbstractMethod
    38 // HbInputAbstractMethod::HbInputAbstractMethod
    37 //
    39 //
    38 // ---------------------------------------------------------------------------
    40 // ---------------------------------------------------------------------------
    39 HbInputAbstractMethod::HbInputAbstractMethod()
    41 HbInputAbstractMethod::HbInputAbstractMethod()
    40 {
    42 {
       
    43     mVanillQwertySwitch = new HbAction(QString("QTY"));
    41 }
    44 }
    42 
    45 
    43 // ---------------------------------------------------------------------------
    46 // ---------------------------------------------------------------------------
    44 // HbInputAbstractMethod::~HbInputAbstractMethod
    47 // HbInputAbstractMethod::~HbInputAbstractMethod
    45 //
    48 //
    46 // ---------------------------------------------------------------------------
    49 // ---------------------------------------------------------------------------
    47 HbInputAbstractMethod::~HbInputAbstractMethod()
    50 HbInputAbstractMethod::~HbInputAbstractMethod()
    48 {
    51 {
       
    52     delete mVanillQwertySwitch;
    49 }
    53 }
    50 
    54 
    51 // ---------------------------------------------------------------------------
    55 // ---------------------------------------------------------------------------
    52 // HbInputAbstractMethod::launchCandidatePopup
    56 // HbInputAbstractMethod::launchCandidatePopup
    53 //
    57 //
   154         // can not fit candidate popup to the right side of inline edit text.
   158         // can not fit candidate popup to the right side of inline edit text.
   155         pos.setX(abs((int)viewport.width()) - size.width());
   159         pos.setX(abs((int)viewport.width()) - size.width());
   156     }
   160     }
   157 }
   161 }
   158 
   162 
   159 void HbInputAbstractMethod::showThaiSpecialCharacters(uint buttonId)
       
   160 {
       
   161 	Q_UNUSED(buttonId);
       
   162 }
       
   163 
   163 
   164 bool HbInputAbstractMethod::isSctModeActive() const
   164 bool HbInputAbstractMethod::isSctModeActive() const
   165 {
   165 {
   166 	return false;
   166 	return false;
   167 }
   167 }
   168 
   168 
       
   169 
   169 HbKeyboardType HbInputAbstractMethod::currentKeyboardType() const
   170 HbKeyboardType HbInputAbstractMethod::currentKeyboardType() const
   170 {
   171 {
   171     return HbKeyboardNone;
   172     return HbKeyboardNone;
   172 }
   173 }
       
   174 
       
   175 void HbInputAbstractMethod::focusReceived()
       
   176 {
       
   177     bool isVannilaApp = false;
       
   178     QInputContext* context = qApp->inputContext();
       
   179     if (context && context->focusWidget()) {
       
   180         QWidget *focusedWidget = context->focusWidget();
       
   181         if (!focusedWidget->inherits("HbMainWindow")) {
       
   182             isVannilaApp = true;
       
   183         }
       
   184     }
       
   185     
       
   186     if(isVannilaApp && focusObject() ) {
       
   187         QList<HbAction*> customActions= focusObject()->editorInterface().actions();
       
   188         if(!customActions.contains(mVanillQwertySwitch)) {
       
   189             disconnect(mVanillQwertySwitch, SIGNAL(triggered(bool)));
       
   190             connect(mVanillQwertySwitch, SIGNAL(triggered(bool)), this, SLOT(switchKeypad(bool)));
       
   191             focusObject()->editorInterface().addAction(mVanillQwertySwitch);
       
   192         }
       
   193     }
       
   194 }
       
   195 
       
   196 void HbInputAbstractMethod::switchKeypad(bool isActive)
       
   197 {
       
   198     Q_UNUSED(isActive);
       
   199     HbKeyboardType keyboard = HbInputSettingProxy::instance()->activeKeyboard();
       
   200     if (keyboard == HbKeyboardVirtual12Key) {
       
   201         HbInputSettingProxy::instance()->setActiveKeyboard(HbKeyboardVirtualQwerty);
       
   202     } else if (keyboard == HbKeyboardVirtualQwerty) {
       
   203         HbInputSettingProxy::instance()->setActiveKeyboard(HbKeyboardVirtual12Key);
       
   204     }
       
   205 }
       
   206 
       
   207 // EOF
       
   208 
       
   209 
       
   210 
   173    
   211    
       
   212 QChar HbInputAbstractMethod ::previousChar()
       
   213 {
       
   214 	return QChar();
       
   215 }
       
   216 
       
   217 
       
   218 // EOF
       
   219