diff -r 923ff622b8b9 -r 4633027730f5 src/hbcore/inputfw/hbinputsettingproxy.cpp --- a/src/hbcore/inputfw/hbinputsettingproxy.cpp Tue Jul 06 14:36:53 2010 +0300 +++ b/src/hbcore/inputfw/hbinputsettingproxy.cpp Wed Aug 18 10:05:37 2010 +0300 @@ -35,6 +35,7 @@ #include #include "hbinputmodecache_p.h" +#include "hbinputmethod.h" #include "hbinputfilter.h" #ifdef Q_OS_SYMBIAN @@ -226,23 +227,18 @@ HbSettingProxyInternalData *prData = proxyData(); if (prData) { prData->iReferences = 0; - prData->iOrientationChangeCompleted = true; - // Default values, real ones should be set by calling initializeOrientation() - prData->iScreenOrientation = Qt::Vertical; if (!wasLoaded) { // There was no permanent storage version, so initialize to defaults. prData->iVersion = HbProxyDataRequiredVersion; prData->iGlobalPrimaryInputLanguage = HbInputLanguage(QLocale::English, QLocale::UnitedKingdom); - prData->iGlobalSecondaryInputLanguage = QLocale::Language(0); - prData->iActiveKeyboard = HbKeyboardVirtual12Key; - prData->iTouchKeyboard = HbKeyboardVirtual12Key; - prData->iHwKeyboard = HbKeyboardQwerty; + prData->iGlobalSecondaryInputLanguage = QLocale::Language(0); prData->iPredictiveInputState = (HbKeyboardSettingFlags)HbKeyboardSetting12key | HbKeyboardSettingQwerty; prData->iDigitType = HbDigitTypeLatin; prData->iQwertyTextCasing = true; prData->iQwertyCharacterPreview = true; prData->iRegionalCorrectionStatus = true; + prData->iFlipStatus = false; prData->iKeypressTimeout = 1000; prData->iAutocompletion = (HbKeyboardSettingFlags)(HbKeyboardSetting12key | HbKeyboardSettingQwerty); prData->iTypingCorrectionLevel = HbTypingCorrectionLevelHigh; @@ -251,6 +247,8 @@ prData->iPreferredMethodHorizontal.setData(QByteArray()); prData->iPreferredMethodVertical = HbInputMethodDescriptor(); prData->iPreferredMethodVertical.setData(QByteArray()); + prData->iHwrSpeed = HbHwrSpeedNormal; + prData->iCangjieMode = HbCangjieNormal; } } unlock(); @@ -271,7 +269,6 @@ HbSettingProxyInternalData *prData = proxyData(); memcpy((void *)prData, (void *)ldData, sizeof(HbSettingProxyInternalData)); - prData->iActiveKeyboard = ldData->iActiveKeyboard; // Temporarily like this, will be moved as part of shared data later... int numItems = 0; @@ -340,40 +337,14 @@ return static_cast(iSharedMemory->data()); } -void HbInputSettingProxyPrivate::flipToggle() -{ - setFlipStatus(!flipStatus()); -} - -bool HbInputSettingProxyPrivate::flipStatus() -{ - HbSettingProxyInternalData *prData = proxyData(); - return prData->iFlipStatus; -} - -void HbInputSettingProxyPrivate::setFlipStatus(bool flipStatus) +Qt::Orientation HbInputSettingProxyPrivate::inputFrameworkScreenOrientation() const { - HbSettingProxyInternalData *prData = proxyData(); - prData->iFlipStatus = flipStatus; - - handleDeviceSpecificOriantationAndFlipChange(); -} - -void HbInputSettingProxyPrivate::handleDeviceSpecificOriantationAndFlipChange() -{ - HbKeyboardType keyboard = HbKeyboardNone; - - if (HbInputSettingProxy::instance()->screenOrientation() == Qt::Vertical) { - keyboard = HbKeyboardVirtual12Key; - } else { - if (flipStatus()) { - keyboard = HbKeyboardQwerty; - } else { - keyboard = HbKeyboardVirtualQwerty; - } + HbInputMethod *activeInputMethod = HbInputMethod::activeInputMethod(); + if (activeInputMethod && activeInputMethod->focusObject()) { + return activeInputMethod->focusObject()->orientation(); } - HbInputSettingProxy::instance()->setActiveKeyboard(keyboard); + return Qt::Horizontal; } /// @endcond @@ -422,10 +393,14 @@ */ void HbInputSettingProxy::togglePrediction() { - if (activeKeyboard() & HbQwertyKeyboardMask) { - setPredictiveInputStatus(HbKeyboardSettingQwerty, !predictiveInputStatus(HbKeyboardSettingQwerty)); - } else { - setPredictiveInputStatus(HbKeyboardSetting12key, !predictiveInputStatus(HbKeyboardSetting12key)); + HbInputMethod *im = HbInputMethod::activeInputMethod(); + if (im) { + HbInputState state = im->inputState(); + if (state.keyboard() & HbQwertyKeyboardMask) { + setPredictiveInputStatus(HbKeyboardSettingQwerty, !predictiveInputStatus(HbKeyboardSettingQwerty)); + } else { + setPredictiveInputStatus(HbKeyboardSetting12key, !predictiveInputStatus(HbKeyboardSetting12key)); + } } } @@ -450,8 +425,6 @@ connect(this, SIGNAL(globalInputLanguageChanged(const HbInputLanguage &)), aObserver, SLOT(globalInputLanguageChanged(const HbInputLanguage &))); connect(this, SIGNAL(globalSecondaryInputLanguageChanged(const HbInputLanguage &)), aObserver, SLOT(globalSecondaryInputLanguageChanged(const HbInputLanguage &))); connect(this, SIGNAL(activeKeyboardChanged(HbKeyboardType)), aObserver, SLOT(activeKeyboardChanged(HbKeyboardType))); - connect(this, SIGNAL(orientationAboutToChange()), aObserver, SLOT(orientationAboutToChange())); - connect(this, SIGNAL(orientationChanged(Qt::Orientation)), aObserver, SLOT(orientationChanged(Qt::Orientation))); } } @@ -466,8 +439,6 @@ disconnect(this, SIGNAL(globalInputLanguageChanged(const HbInputLanguage &)), aObserver, SLOT(globalInputLanguageChanged(const HbInputLanguage &))); disconnect(this, SIGNAL(globalSecondaryInputLanguageChanged(const HbInputLanguage &)), aObserver, SLOT(globalSecondaryInputLanguageChanged(const HbInputLanguage &))); disconnect(this, SIGNAL(activeKeyboardChanged(HbKeyboardType)), aObserver, SLOT(activeKeyboardChanged(HbKeyboardType))); - disconnect(this, SIGNAL(orientationAboutToChange()), aObserver, SLOT(orientationAboutToChange())); - disconnect(this, SIGNAL(orientationChanged(Qt::Orientation)), aObserver, SLOT(orientationChanged(Qt::Orientation))); } } @@ -524,59 +495,117 @@ } /*! +\deprecated HbInputSettingProxy::activeHwKeyboard() const + is deprecated. Use HbInputSettingProxy::activeKeyboard(Qt::Orientation) instead. Returns active hardware keyboard type. - -\sa setActiveHwKeyboard -\sa activeTouchKeyboard */ HbKeyboardType HbInputSettingProxy::activeHwKeyboard() const { + return HbKeyboardNone; +} + +/*! +\deprecated HbInputSettingProxy::activeTouchKeyboard() const + is deprecated. Use HbInputSettingProxy::activeKeyboard(Qt::Orientation) instead. +Returns active touch keyboard type. +*/ +HbKeyboardType HbInputSettingProxy::activeTouchKeyboard() const +{ + return HbKeyboardNone; +} + +void HbInputSettingProxy::setHwrWritingSpeed(HbHwrWritingSpeed speed) +{ + Q_D(HbInputSettingProxy); + HbSettingProxyInternalData *prData = d->proxyData(); + if (prData) { + bool notify = false; + d->lock(); + if (prData->iHwrSpeed != speed) { + prData->iHwrSpeed = speed; + notify = true; + } + d->unlock(); + if (notify) { + emit hwrWritingSpeedChanged(speed); + } + } +} + +HbHwrWritingSpeed HbInputSettingProxy::hwrWritingSpeed() const +{ Q_D(const HbInputSettingProxy); - HbKeyboardType res = HbKeyboardNone; + HbHwrWritingSpeed res = HbHwrSpeedNormal; HbSettingProxyInternalData *prData = d->proxyData(); if (prData) { - res = prData->iHwKeyboard; + res = prData->iHwrSpeed; + } + + return res; +} + +void HbInputSettingProxy::setDetailedCangjieMode(HbCangjieDetailMode cangjieDetail) +{ + Q_D(HbInputSettingProxy); + HbSettingProxyInternalData *prData = d->proxyData(); + if (prData) { + bool notify = false; + d->lock(); + if (prData->iCangjieMode != cangjieDetail) { + prData->iCangjieMode = cangjieDetail; + notify = true; + } + d->unlock(); + if (notify) { + emit detailedCangjieModeChanged(cangjieDetail); + } + } +} + +HbCangjieDetailMode HbInputSettingProxy::detailedCangjieMode() const +{ + Q_D(const HbInputSettingProxy); + HbCangjieDetailMode res = HbCangjieNormal; + + HbSettingProxyInternalData *prData = d->proxyData(); + if (prData) { + res = prData->iCangjieMode; } return res; } /*! -Returns active touch keyboard type. - -\sa setActiveTouchKeyboard -\sa activeHwKeyboard -*/ -HbKeyboardType HbInputSettingProxy::activeTouchKeyboard() const -{ - Q_D(const HbInputSettingProxy); - HbKeyboardType res = HbKeyboardNone; - - HbSettingProxyInternalData *prData = d->proxyData(); - if (prData) { - res = prData->iTouchKeyboard; - } - - return res; -} - -/*! -Returns active keyboard type. - -\sa setActiveKeyboard +\deprecated HbInputSettingProxy::activeKeyboard() const + is deprecated. Use HbInputSettingProxy::activeKeyboard(Qt::Orientation) instead. */ HbKeyboardType HbInputSettingProxy::activeKeyboard() const { Q_D(const HbInputSettingProxy); - HbKeyboardType res = HbKeyboardNone; + return activeKeyboard(d->inputFrameworkScreenOrientation()); +} + +/*! +Returns active keyboard for given screen oriention. +*/ +HbKeyboardType HbInputSettingProxy::activeKeyboard(Qt::Orientation orientation) const +{ + Q_D(const HbInputSettingProxy); - HbSettingProxyInternalData *prData = d->proxyData(); - if (prData) { - res = prData->iActiveKeyboard; + if (orientation == Qt::Horizontal) { + HbSettingProxyInternalData *prData = d->proxyData(); + if (prData) { + d->lock(); + if (prData->iFlipStatus == true) { + return HbKeyboardHardwareLandcape; + } + d->unlock(); + } + return HbKeyboardTouchLandscape; + } else { + return HbKeyboardTouchPortrait; } - - return res; } /*! @@ -606,10 +635,8 @@ } /*! -Returns the preferred input method for current screen orientation. Initially this value is empty -and the framework will resolve the default handler. - -\sa setPreferredInputMethod +\deprecated HbInputSettingProxy::preferredInputMethod() const + is deprecated. Use HbInputSettingProxy::preferredInputMethod(Qt::Orientation) const instead. */ HbInputMethodDescriptor HbInputSettingProxy::preferredInputMethod() const { @@ -620,7 +647,7 @@ HbSettingProxyInternalData *prData = d->proxyData(); if (prData) { d->lock(); - if (prData->iScreenOrientation == Qt::Horizontal) { + if (d->inputFrameworkScreenOrientation() == Qt::Horizontal) { result = prData->iPreferredMethodHorizontal.descriptor(); } else { result = prData->iPreferredMethodVertical.descriptor(); @@ -729,81 +756,30 @@ } /*! -Sets active hardware keyboard type. Will emit signal activeHwKeyboardChanged if keyboard is changed. - -\sa activeHwKeyboard -\sa activeTouchKeyboard -\sa setActiveTouchKeyboard -\sa setActiveHwKeyboard +\deprecated HbInputSettingProxy::setActiveHwKeyboard(HbKeyboardType) + is deprecated. */ void HbInputSettingProxy::setActiveHwKeyboard(HbKeyboardType keyboard) { - Q_D(HbInputSettingProxy); - HbSettingProxyInternalData *prData = d->proxyData(); - if (prData) { - bool notify = false; - d->lock(); - if (prData->iHwKeyboard != keyboard) { - prData->iHwKeyboard = keyboard; - notify = true; - } - d->unlock(); - if (notify) { - emit activeHwKeyboardChanged(keyboard); - } - } + Q_UNUSED(keyboard); } /*! -Sets active touch keyboard type. Will emit signal activeTouchKeyboardChanged keyboard is changed. - -\sa activeTouchKeyboard -\sa activeHwKeyboard -\sa setActiveTouchKeyboard -\sa setActiveHwKeyboard +\deprecated HbInputSettingProxy::setActiveTouchKeyboard(HbKeyboardType) + is deprecated. */ void HbInputSettingProxy::setActiveTouchKeyboard(HbKeyboardType keyboard) { - Q_D(HbInputSettingProxy); - HbSettingProxyInternalData *prData = d->proxyData(); - if (prData) { - bool notify = false; - d->lock(); - if (prData->iTouchKeyboard != keyboard) { - prData->iTouchKeyboard = keyboard; - notify = true; - } - d->unlock(); - if (notify) { - emit activeTouchKeyboardChanged(keyboard); - } - } + Q_UNUSED(keyboard); } /*! -Sets active keyboard type. Will emit signal activeKeyboardChanged if keyboard is changed. - -\sa activeKeyboard -\sa activeHwKeyboard -\sa setactiveKeyboard -\sa setActiveHwKeyboard +\deprecated HbInputSettingProxy::setActiveKeyboard(HbKeyboardType) + is deprecated. */ void HbInputSettingProxy::setActiveKeyboard(HbKeyboardType keyboard) { - Q_D(HbInputSettingProxy); - HbSettingProxyInternalData *prData = d->proxyData(); - if (prData) { - bool notify = false; - d->lock(); - if (prData->iActiveKeyboard != keyboard) { - prData->iActiveKeyboard = keyboard; - notify = true; - } - d->unlock(); - if (notify) { - emit activeKeyboardChanged(keyboard); - } - } + Q_UNUSED(keyboard); } /*! @@ -869,11 +845,15 @@ HbSettingProxyInternalData *prData = d->proxyData(); if (prData) { - if (activeKeyboard() & HbQwertyKeyboardMask) { - res = prData->iPredictiveInputState & HbKeyboardSettingQwerty; - } else { - res = prData->iPredictiveInputState & HbKeyboardSetting12key; - } + HbInputMethod *im = HbInputMethod::activeInputMethod(); + if (im) { + HbInputState state = im->inputState(); + if (state.keyboard() & HbQwertyKeyboardMask) { + res = prData->iPredictiveInputState & HbKeyboardSettingQwerty; + } else { + res = prData->iPredictiveInputState & HbKeyboardSetting12key; + } + } } return res; @@ -886,10 +866,14 @@ */ void HbInputSettingProxy::setPredictiveInputStatusForActiveKeyboard(bool newStatus) { - if (activeKeyboard() & HbQwertyKeyboardMask) { - setPredictiveInputStatus(HbKeyboardSettingQwerty, newStatus); - } else { - setPredictiveInputStatus(HbKeyboardSetting12key, newStatus); + HbInputMethod *im = HbInputMethod::activeInputMethod(); + if (im) { + HbInputState state = im->inputState(); + if (state.keyboard() & HbQwertyKeyboardMask) { + setPredictiveInputStatus(HbKeyboardSettingQwerty, newStatus); + } else { + setPredictiveInputStatus(HbKeyboardSetting12key, newStatus); + } } } @@ -1155,113 +1139,48 @@ } /*! -Returns the current screen orientation in settings +\deprecated HbInputSettingProxy::screenOrientation() + is deprecated. Use HbInputFocusObject::screenOrientation() instead. */ Qt::Orientation HbInputSettingProxy::screenOrientation() { Q_D(HbInputSettingProxy); - - Qt::Orientation orientation = Qt::Vertical; - HbSettingProxyInternalData *prData = d->proxyData(); - if (prData) { - orientation = prData->iScreenOrientation; - } - return orientation; + return d->inputFrameworkScreenOrientation(); } /*! -Sets the current screen orientation in settings. This completes orientation change -started with notifyScreenOrientationChange. Nothing is done, If - notifyScreenOrientationChange has not been called before calling this. +\deprecated HbInputSettingProxy::setScreenOrientation(Qt::Orientation) + is deprecated. */ void HbInputSettingProxy::setScreenOrientation(Qt::Orientation screenOrientation) { - Q_D(HbInputSettingProxy); - - HbSettingProxyInternalData *prData = d->proxyData(); - if (prData) { - d->lock(); - if (prData->iOrientationChangeCompleted) { - d->unlock(); - return; - } - prData->iScreenOrientation = screenOrientation; - d->unlock(); - - // notify everyone that the orientation has changed. - d->handleDeviceSpecificOriantationAndFlipChange(); - emit orientationChanged(screenOrientation); - - // set orientation change operation completed. - d->lock(); - prData->iOrientationChangeCompleted = true; - d->unlock(); - } + Q_UNUSED(screenOrientation); } /*! -Starts screen orientation change sequence. Emits orientationAboutToChange signal -and set internal orientation change flag to true. Whoever calls this -method, must also complete the orientation change sequence by calling setScreenOrientation. -Generally this mechanims is connected to operating system level screen orientation attribute -begind the scenes and there is no need to call this directly from application or input -method. +\deprecated HbInputSettingProxy::notifyScreenOrientationChange() + is deprecated. */ void HbInputSettingProxy::notifyScreenOrientationChange() { - Q_D(HbInputSettingProxy); - - HbSettingProxyInternalData *prData = d->proxyData(); - if (prData) { - bool notify = false; - d->lock(); - if (prData->iOrientationChangeCompleted) { - prData->iOrientationChangeCompleted = false; - notify = true; - } - d->unlock(); - if (notify) { - emit orientationAboutToChange(); - } - } - } /*! -Returns true if the orientation change is completed +\deprecated HbInputSettingProxy::orientationChangeCompleted() const + is deprecated. */ bool HbInputSettingProxy::orientationChangeCompleted() const { - Q_D(const HbInputSettingProxy); - - bool completed = true; - HbSettingProxyInternalData *prData = d->proxyData(); - if (prData) { - completed = prData->iOrientationChangeCompleted; - } - return completed; + return false; } /*! -Method for initializing orientation state of the input framework. Needed only on -framework level, should not be called by applications. +\deprecated HbInputSettingProxy::initializeOrientation(Qt::Orientation) + is deprecated. */ void HbInputSettingProxy::initializeOrientation(Qt::Orientation screenOrientation) { - Q_D(HbInputSettingProxy); - - // call handleDeviceSpecificOriantationAndFlipChange method - HbSettingProxyInternalData *prData = d->proxyData(); - if (prData) { - d->lock(); - prData->iScreenOrientation = screenOrientation; - if (screenOrientation == Qt::Vertical) { - prData->iActiveKeyboard = HbKeyboardVirtual12Key; - } else { - prData->iActiveKeyboard = HbKeyboardVirtualQwerty; - } - d->unlock(); - } + Q_UNUSED(screenOrientation); } /*!