src/hbcore/inputfw/hbinputsettingproxy.cpp
changeset 1 f7ac710697a9
parent 0 16d8024aca5e
child 2 06ff229162e9
equal deleted inserted replaced
0:16d8024aca5e 1:f7ac710697a9
    31 #include <QVector>
    31 #include <QVector>
    32 #include <QDir>
    32 #include <QDir>
    33 
    33 
    34 #include "hbinputsettingproxy.h"
    34 #include "hbinputsettingproxy.h"
    35 #include "hbinputsettingproxy_p.h"
    35 #include "hbinputsettingproxy_p.h"
    36 #include "hbinputmodecache_p.h" 
    36 #include "hbinputmodecache_p.h"
    37 #include "hbinputbasepaths_p.h"
       
    38 #include "hbinputfilter.h"
    37 #include "hbinputfilter.h"
       
    38 
       
    39 #ifdef Q_OS_SYMBIAN
       
    40 
       
    41 #define HBI_BASE_PATH QString("\\resource\\plugins")
       
    42 #define HBI_BASE_WRITABLE_PATH QString("c:\\data\\hbinputs")
       
    43 
       
    44 #else
       
    45 
       
    46 #ifndef Q_OS_UNIX
       
    47 #define HBI_BASE_WRITABLE_PATH QString("c:\\Hb\\lib")
       
    48 #endif
       
    49 
       
    50 #endif
    39 
    51 
    40 /*!
    52 /*!
    41 @alpha
    53 @alpha
    42 @hbcore
    54 @hbcore
    43 \class HbInputSettingProxy
    55 \class HbInputSettingProxy
   158             prData->iActiveKeyboard = HbKeyboardVirtual12Key;
   170             prData->iActiveKeyboard = HbKeyboardVirtual12Key;
   159             prData->iTouchKeyboard = HbKeyboardVirtual12Key;
   171             prData->iTouchKeyboard = HbKeyboardVirtual12Key;
   160             prData->iHwKeyboard = HbKeyboardQwerty;
   172             prData->iHwKeyboard = HbKeyboardQwerty;
   161             prData->iActiveCustomMethodName[0] = 0;
   173             prData->iActiveCustomMethodName[0] = 0;
   162             prData->iActiveCustomMethodKey[0] = 0;
   174             prData->iActiveCustomMethodKey[0] = 0;
   163             prData->iPredictiveInputState = 0;
   175             prData->iPredictiveInputState = HbKeyboardSettingNone;
   164             prData->iDigitType = HbDigitTypeLatin;
   176             prData->iDigitType = HbDigitTypeLatin;
   165             prData->iQwertyTextCasing = true;
   177             prData->iQwertyTextCasing = true;
   166             prData->iQwertyCharacterPreview = true;
   178             prData->iQwertyCharacterPreview = true;
   167             prData->iRegionalCorrectionStatus = true;
   179             prData->iRegionalCorrectionStatus = true;
       
   180             prData->iKeypressTimeout = 1000;
       
   181             prData->iAutocompletion = (HbKeyboardSettingFlags)(HbKeyboardSetting12key | HbKeyboardSettingQwerty);
       
   182             prData->iTypingCorrectionLevel = HbTypingCorrectionLevelHigh;
       
   183             prData->iPrimaryCandidateMode = HbPrimaryCandidateModeBestPrediction;
   168         }
   184         }
   169     }
   185     }
   170     unlock();
   186     unlock();
   171 }
   187 }
   172 
   188 
   336 /*!
   352 /*!
   337 Toggles prediction mode
   353 Toggles prediction mode
   338 */
   354 */
   339 void HbInputSettingProxy::togglePrediction()
   355 void HbInputSettingProxy::togglePrediction()
   340 {
   356 {
   341     if (predictiveInputStatus()) {
   357     if (activeKeyboard() & HbQwertyKeyboardMask) {
   342         setPredictiveInputStatus(0);
   358         setPredictiveInputStatus(HbKeyboardSettingQwerty, !predictiveInputStatus(HbKeyboardSettingQwerty));
   343     } else {
   359     } else {
   344         setPredictiveInputStatus(1);
   360         setPredictiveInputStatus(HbKeyboardSetting12key, !predictiveInputStatus(HbKeyboardSetting12key));
   345     }
   361     }
   346 }
   362 }
   347 
   363 
   348 /*!
   364 /*!
   349 Setting proxy emits a signal when any of the monitored settings changes. This
   365 Setting proxy emits a signal when any of the monitored settings changes. This
   353 \sa globalInputLanguageChanged
   369 \sa globalInputLanguageChanged
   354 \sa activeHwKeyboardChanged
   370 \sa activeHwKeyboardChanged
   355 \sa predictiveInputStateChanged
   371 \sa predictiveInputStateChanged
   356 \sa orientationAboutToChange
   372 \sa orientationAboutToChange
   357 \sa orientationChanged
   373 \sa orientationChanged
       
   374 \sa characterPreviewStateForQwertyChanged
       
   375 \sa keypressTimeoutChanged
       
   376 \sa autocompletionStateChanged
       
   377 \sa typingCorrectionLevelChanged
       
   378 \sa primaryCandidateModeChanged
   358 */
   379 */
   359 void HbInputSettingProxy::connectObservingObject(QObject* aObserver)
   380 void HbInputSettingProxy::connectObservingObject(QObject* aObserver)
   360 {
   381 {
   361     if (aObserver) {
   382     if (aObserver) {
   362         connect(this, SIGNAL(globalInputLanguageChanged(const HbInputLanguage &)), aObserver, SLOT(globalInputLanguageChanged(const HbInputLanguage &)));
   383         connect(this, SIGNAL(globalInputLanguageChanged(const HbInputLanguage &)), aObserver, SLOT(globalInputLanguageChanged(const HbInputLanguage &)));
   363         connect(this, SIGNAL(globalSecondaryInputLanguageChanged(const HbInputLanguage &)), aObserver, SLOT(globalSecondaryInputLanguageChanged(const HbInputLanguage &)));
   384         connect(this, SIGNAL(globalSecondaryInputLanguageChanged(const HbInputLanguage &)), aObserver, SLOT(globalSecondaryInputLanguageChanged(const HbInputLanguage &)));
   364         connect(this, SIGNAL(activeKeyboardChanged(HbKeyboardType)), aObserver, SLOT(activeKeyboardChanged(HbKeyboardType)));
   385         connect(this, SIGNAL(activeKeyboardChanged(HbKeyboardType)), aObserver, SLOT(activeKeyboardChanged(HbKeyboardType)));
   365         connect(this, SIGNAL(activeHwKeyboardChanged(HbKeyboardType)), aObserver, SLOT(activeHwKeyboardChanged(HbKeyboardType)));
   386         connect(this, SIGNAL(activeHwKeyboardChanged(HbKeyboardType)), aObserver, SLOT(activeHwKeyboardChanged(HbKeyboardType)));
   366         connect(this, SIGNAL(activeTouchKeyboardChanged(HbKeyboardType)), aObserver, SLOT(activeTouchKeyboardChanged(HbKeyboardType)));
   387         connect(this, SIGNAL(activeTouchKeyboardChanged(HbKeyboardType)), aObserver, SLOT(activeTouchKeyboardChanged(HbKeyboardType)));
   367         connect(this, SIGNAL(predictiveInputStateChanged(int)), aObserver, SLOT(predictiveInputStateChanged(int)));
   388         connect(this, SIGNAL(predictiveInputStateChanged(HbKeyboardSettingFlags, bool)), aObserver, SLOT(predictiveInputStateChanged(HbKeyboardSettingFlags, bool)));
   368         connect(this, SIGNAL(orientationAboutToChange()), aObserver, SLOT(orientationAboutToChange()));
   389         connect(this, SIGNAL(orientationAboutToChange()), aObserver, SLOT(orientationAboutToChange()));
   369         connect(this, SIGNAL(orientationChanged(Qt::Orientation)), aObserver, SLOT(orientationChanged(Qt::Orientation)));
   390         connect(this, SIGNAL(orientationChanged(Qt::Orientation)), aObserver, SLOT(orientationChanged(Qt::Orientation)));
       
   391 /* Setting listeners not implemented yet
       
   392         connect(this, SIGNAL(characterPreviewStateForQwertyChanged(bool)), aObserver, SLOT(characterPreviewStateForQwertyChanged(bool)));
       
   393         connect(this, SIGNAL(keypressTimeoutChanged(int)), aObserver, SLOT(keypressTimeoutChanged(int)));
       
   394         connect(this, SIGNAL(autocompletionStateChanged(HbKeyboardSettingFlags, bool)), aObserver, SLOT(autocompletionStateChanged(HbKeyboardSettingFlags, bool)));
       
   395         connect(this, SIGNAL(typingCorrectionLevelChanged(HbTypingCorrectionLevel)), aObserver, SLOT(typingCorrectionLevelChanged(HbTypingCorrectionLevel)));
       
   396         connect(this, SIGNAL(primaryCandidateModeChanged(HbPrimaryCandidateMode)), aObserver, SLOT(primaryCandidateModeChanged(HbPrimaryCandidateMode)));
       
   397 */
   370     }
   398     }
   371 }
   399 }
   372 
   400 
   373 /*!
   401 /*!
   374 Disconnects given object from the setting proxy.
   402 Disconnects given object from the setting proxy.
   378 void HbInputSettingProxy::disconnectObservingObject(QObject* aObserver)
   406 void HbInputSettingProxy::disconnectObservingObject(QObject* aObserver)
   379 {
   407 {
   380     if (aObserver) {
   408     if (aObserver) {
   381         disconnect(this, SIGNAL(globalInputLanguageChanged(const HbInputLanguage &)), aObserver, SLOT(globalInputLanguageChanged(const HbInputLanguage &)));
   409         disconnect(this, SIGNAL(globalInputLanguageChanged(const HbInputLanguage &)), aObserver, SLOT(globalInputLanguageChanged(const HbInputLanguage &)));
   382         disconnect(this, SIGNAL(globalSecondaryInputLanguageChanged(const HbInputLanguage &)), aObserver, SLOT(globalSecondaryInputLanguageChanged(const HbInputLanguage &)));
   410         disconnect(this, SIGNAL(globalSecondaryInputLanguageChanged(const HbInputLanguage &)), aObserver, SLOT(globalSecondaryInputLanguageChanged(const HbInputLanguage &)));
   383         disconnect(this, SIGNAL(predictiveInputStateChanged(int)), aObserver, SLOT(predictiveInputStateChanged(int)));
   411         disconnect(this, SIGNAL(predictiveInputStateChanged(HbKeyboardSettingFlags, bool)), aObserver, SLOT(predictiveInputStateChanged(HbKeyboardSettingFlags, bool)));
   384         disconnect(this, SIGNAL(activeKeyboardChanged(HbKeyboardType)), aObserver, SLOT(activeKeyboardChanged(HbKeyboardType)));
   412         disconnect(this, SIGNAL(activeKeyboardChanged(HbKeyboardType)), aObserver, SLOT(activeKeyboardChanged(HbKeyboardType)));
   385         disconnect(this, SIGNAL(activeHwKeyboardChanged(HbKeyboardType)), aObserver, SLOT(activeHwKeyboardChanged(HbKeyboardType)));
   413         disconnect(this, SIGNAL(activeHwKeyboardChanged(HbKeyboardType)), aObserver, SLOT(activeHwKeyboardChanged(HbKeyboardType)));
   386         disconnect(this, SIGNAL(activeTouchKeyboardChanged(HbKeyboardType)), aObserver, SLOT(activeTouchKeyboardChanged(HbKeyboardType)));
   414         disconnect(this, SIGNAL(activeTouchKeyboardChanged(HbKeyboardType)), aObserver, SLOT(activeTouchKeyboardChanged(HbKeyboardType)));
   387         disconnect(this, SIGNAL(orientationAboutToChange()), aObserver, SLOT(orientationAboutToChange()));
   415         disconnect(this, SIGNAL(orientationAboutToChange()), aObserver, SLOT(orientationAboutToChange()));
   388         disconnect(this, SIGNAL(orientationChanged(Qt::Orientation)), aObserver, SLOT(orientationChanged(Qt::Orientation)));
   416         disconnect(this, SIGNAL(orientationChanged(Qt::Orientation)), aObserver, SLOT(orientationChanged(Qt::Orientation)));
       
   417 /* Setting listeners not implemented yet
       
   418         disconnect(this, SIGNAL(characterPreviewStateForQwertyChanged(bool)), aObserver, SLOT(characterPreviewStateForQwertyChanged(bool)));
       
   419         disconnect(this, SIGNAL(keypressTimeoutChanged(int)), aObserver, SLOT(keypressTimeoutChanged(int)));
       
   420         disconnect(this, SIGNAL(autocompletionStateChanged(HbKeyboardSettingFlags, bool)), aObserver, SLOT(autocompletionStateChanged(HbKeyboardSettingFlags, bool)));
       
   421         disconnect(this, SIGNAL(typingCorrectionLevelChanged(HbTypingCorrectionLevel)), aObserver, SLOT(typingCorrectionLevelChanged(HbTypingCorrectionLevel)));
       
   422         disconnect(this, SIGNAL(primaryCandidateModeChanged(HbPrimaryCandidateMode)), aObserver, SLOT(primaryCandidateModeChanged(HbPrimaryCandidateMode)));
       
   423 */
   389     }
   424     }
   390 }
   425 }
   391 
   426 
   392 /*!
   427 /*!
   393 Returns active input language. This is system wide value, an editor and input state machine may override this by defining
   428 Returns active input language. This is system wide value, an editor and input state machine may override this by defining
   498 
   533 
   499     return res;
   534     return res;
   500 }
   535 }
   501 
   536 
   502 /*!
   537 /*!
   503 Sets system wide input language. Will emit signal globalInputLanguageChanged.
   538 Sets system wide input language. Will emit signal globalInputLanguageChanged if language is changed.
   504 
   539 
   505 \sa globalInputLanguage
   540 \sa globalInputLanguage
   506 */
   541 */
   507 void HbInputSettingProxy::setGlobalInputLanguage(const HbInputLanguage& language)
   542 void HbInputSettingProxy::setGlobalInputLanguage(const HbInputLanguage& language)
   508 {
   543 {
   509     Q_D(HbInputSettingProxy);
   544     Q_D(HbInputSettingProxy);
   510     HbSettingProxyInternalData* prData = d->proxyData();
   545     HbSettingProxyInternalData* prData = d->proxyData();
   511     if (prData) {
   546     if (prData) {
   512         d->lock();
   547         bool notify = false;
   513         prData->iGlobalPrimaryInputLanguage = language;
   548         d->lock();
   514         d->unlock();
   549         if (prData->iGlobalPrimaryInputLanguage != language) {
   515         emit globalInputLanguageChanged(language);
   550             prData->iGlobalPrimaryInputLanguage = language;
   516     }
   551             notify = true;
   517 }
   552         }
   518 
   553         d->unlock();
   519 /*!
   554         if (notify) {
   520 Sets system wide secondary input language. Will emit signal globalSecondaryInputLanguageChanged.
   555             emit globalInputLanguageChanged(language);
       
   556         }
       
   557     }
       
   558 }
       
   559 
       
   560 /*!
       
   561 Sets system wide secondary input language. Will emit signal globalSecondaryInputLanguageChanged if language is changed.
   521 
   562 
   522 \sa globalSecondaryInputLanguage
   563 \sa globalSecondaryInputLanguage
   523 */
   564 */
   524 void HbInputSettingProxy::setGlobalSecondaryInputLanguage(const HbInputLanguage &language)
   565 void HbInputSettingProxy::setGlobalSecondaryInputLanguage(const HbInputLanguage &language)
   525 {
   566 {
   526     Q_D(HbInputSettingProxy);
   567     Q_D(HbInputSettingProxy);
   527     HbSettingProxyInternalData* prData = d->proxyData();
   568     HbSettingProxyInternalData* prData = d->proxyData();
   528     if (prData) {
   569     if (prData) {
   529         d->lock();
   570         bool notify = false;
   530         prData->iGlobalSecondaryInputLanguage = language;
   571         d->lock();
   531         d->unlock();
   572         if (prData->iGlobalSecondaryInputLanguage != language) {
   532         emit globalSecondaryInputLanguageChanged(language);
   573             prData->iGlobalSecondaryInputLanguage = language;
   533     }
   574             notify = true;
   534 }
   575         }
   535 
   576         d->unlock();
   536 /*!
   577         if (notify) {
   537 Sets active hardware keyboard type. Will emit signal activeHwKeyboardChanged.
   578             emit globalSecondaryInputLanguageChanged(language);
       
   579         }
       
   580     }
       
   581 }
       
   582 
       
   583 /*!
       
   584 Sets active hardware keyboard type. Will emit signal activeHwKeyboardChanged if keyboard is changed.
   538 
   585 
   539 \sa activeHwKeyboard
   586 \sa activeHwKeyboard
   540 \sa activeTouchKeyboard
   587 \sa activeTouchKeyboard
   541 \sa setActiveTouchKeyboard
   588 \sa setActiveTouchKeyboard
   542 \sa setActiveHwKeyboard
   589 \sa setActiveHwKeyboard
   544 void HbInputSettingProxy::setActiveHwKeyboard(HbKeyboardType keyboard)
   591 void HbInputSettingProxy::setActiveHwKeyboard(HbKeyboardType keyboard)
   545 {
   592 {
   546     Q_D(HbInputSettingProxy);
   593     Q_D(HbInputSettingProxy);
   547     HbSettingProxyInternalData* prData = d->proxyData();
   594     HbSettingProxyInternalData* prData = d->proxyData();
   548     if (prData) {
   595     if (prData) {
   549         d->lock();
   596         bool notify = false;
   550         prData->iHwKeyboard = keyboard;
   597         d->lock();
   551         d->unlock();
   598         if (prData->iHwKeyboard != keyboard) {
   552         emit activeHwKeyboardChanged(keyboard);
   599             prData->iHwKeyboard = keyboard;
   553     }
   600             notify = true;
   554 }
   601         }
   555 
   602         d->unlock();
   556 /*!
   603         if (notify) {
   557 Sets active touch keyboard type. Will emit signal activeTouchKeyboardChanged.
   604             emit activeHwKeyboardChanged(keyboard);
       
   605         }
       
   606     }
       
   607 }
       
   608 
       
   609 /*!
       
   610 Sets active touch keyboard type. Will emit signal activeTouchKeyboardChanged keyboard is changed.
   558 
   611 
   559 \sa activeTouchKeyboard
   612 \sa activeTouchKeyboard
   560 \sa activeHwKeyboard
   613 \sa activeHwKeyboard
   561 \sa setActiveTouchKeyboard
   614 \sa setActiveTouchKeyboard
   562 \sa setActiveHwKeyboard
   615 \sa setActiveHwKeyboard
   564 void HbInputSettingProxy::setActiveTouchKeyboard(HbKeyboardType keyboard)
   617 void HbInputSettingProxy::setActiveTouchKeyboard(HbKeyboardType keyboard)
   565 {
   618 {
   566     Q_D(HbInputSettingProxy);
   619     Q_D(HbInputSettingProxy);
   567     HbSettingProxyInternalData* prData = d->proxyData();
   620     HbSettingProxyInternalData* prData = d->proxyData();
   568     if (prData) {
   621     if (prData) {
   569         d->lock();
   622         bool notify = false;
   570         prData->iTouchKeyboard = keyboard;
   623         d->lock();
   571         d->unlock();
   624         if (prData->iTouchKeyboard != keyboard) {
   572         emit activeTouchKeyboardChanged(keyboard);
   625             prData->iTouchKeyboard = keyboard;
   573     }
   626             notify = true;
   574 }
   627         }
   575 
   628         d->unlock();
   576 /*!
   629         if (notify) {
   577 Sets active keyboard type. Will emit signal activeKeyboardChanged.
   630             emit activeTouchKeyboardChanged(keyboard);
       
   631         }
       
   632     }
       
   633 }
       
   634 
       
   635 /*!
       
   636 Sets active keyboard type. Will emit signal activeKeyboardChanged if keyboard is changed.
   578 
   637 
   579 \sa activeKeyboard
   638 \sa activeKeyboard
   580 \sa activeHwKeyboard
   639 \sa activeHwKeyboard
   581 \sa setactiveKeyboard
   640 \sa setactiveKeyboard
   582 \sa setActiveHwKeyboard
   641 \sa setActiveHwKeyboard
   584 void HbInputSettingProxy::setActiveKeyboard(HbKeyboardType keyboard)
   643 void HbInputSettingProxy::setActiveKeyboard(HbKeyboardType keyboard)
   585 {
   644 {
   586     Q_D(HbInputSettingProxy);
   645     Q_D(HbInputSettingProxy);
   587     HbSettingProxyInternalData* prData = d->proxyData();
   646     HbSettingProxyInternalData* prData = d->proxyData();
   588     if (prData) {
   647     if (prData) {
   589         d->lock();
   648         bool notify = false;
   590         prData->iActiveKeyboard = keyboard;
   649         d->lock();
   591         d->unlock();
   650         if (prData->iActiveKeyboard != keyboard) {
   592         emit activeKeyboardChanged(keyboard);
   651             prData->iActiveKeyboard = keyboard;
   593     }
   652             notify = true;
   594 }
   653         }
   595 
   654         d->unlock();
   596 /*!
   655         if (notify) {
   597 Returns the status of predictive input feature. An editor instance
   656             emit activeKeyboardChanged(keyboard);
       
   657         }
       
   658     }
       
   659 }
       
   660 
       
   661 /*!
       
   662 \deprecated HbInputSettingProxy::predictiveInputStatus()
       
   663     is deprecated. Use predictiveInputStatusForITUT or predictiveInputStatusForQwerty instead.
       
   664 */
       
   665 int HbInputSettingProxy::predictiveInputStatus() const
       
   666 {
       
   667     return predictiveInputStatusForActiveKeyboard();
       
   668 }
       
   669 
       
   670 /*!
       
   671 \deprecated HbInputSettingProxy::setPredictiveInputStatus(int newStatus)
       
   672     is deprecated. Use setPredictiveInputStatusForITUT or setPredictiveInputStatusForQwerty instead.
       
   673 */
       
   674 void HbInputSettingProxy::setPredictiveInputStatus(int newStatus)
       
   675 {
       
   676     setPredictiveInputStatusForActiveKeyboard(newStatus);
       
   677 }
       
   678 
       
   679 /*!
       
   680 Returns the status of predictive input feature. Returns true if any one of given
       
   681 keyboard types has the prediction enabled. An editor instance may still forbid
       
   682 predictive input feature, even if the device wide status allows it.
       
   683 
       
   684 \sa setPredictiveInputStatus.
       
   685 */
       
   686 bool HbInputSettingProxy::predictiveInputStatus(HbKeyboardSettingFlags keyboardType) const
       
   687 {
       
   688     Q_D(const HbInputSettingProxy);
       
   689     bool res = false;
       
   690 
       
   691     HbSettingProxyInternalData* prData = d->proxyData();
       
   692     if (prData) {
       
   693         res = prData->iPredictiveInputState & keyboardType;
       
   694     }
       
   695 
       
   696     return res;
       
   697 }
       
   698 
       
   699 /*!
       
   700 Sets the status of predictive text input feature. Will emit signal predictiveInputStateChanged if status is changed.
       
   701 
       
   702 \sa predictiveInputStatus
       
   703 */
       
   704 void HbInputSettingProxy::setPredictiveInputStatus(HbKeyboardSettingFlags keyboardType, bool newStatus)
       
   705 {
       
   706     Q_D(HbInputSettingProxy);
       
   707     HbSettingProxyInternalData* prData = d->proxyData();
       
   708     if (prData) {
       
   709         bool notify = false;
       
   710         d->lock();
       
   711         
       
   712         HbKeyboardSettingFlags newValue = prData->iPredictiveInputState;
       
   713         if (newStatus) {
       
   714             newValue |= keyboardType;
       
   715         } else {
       
   716             newValue &= ~keyboardType;
       
   717         }
       
   718         if (prData->iPredictiveInputState != newValue) {
       
   719             prData->iPredictiveInputState = newValue;
       
   720             notify = true;
       
   721         }
       
   722         d->unlock();
       
   723         if (notify) {
       
   724             emit predictiveInputStateChanged(keyboardType, newStatus);
       
   725         }
       
   726     }
       
   727 }
       
   728 
       
   729 /*!
       
   730 Returns the status of predictive input feature for active keyboard. An editor instance
   598 may still forbid predictive input feature, even if the device wide status allows it.
   731 may still forbid predictive input feature, even if the device wide status allows it.
   599 
   732 
   600 \sa setPredictiveInputStatus.
   733 \sa setPredictiveInputStatusForActiveKeyboard.
   601 */
   734 */
   602 int HbInputSettingProxy::predictiveInputStatus() const
   735 bool HbInputSettingProxy::predictiveInputStatusForActiveKeyboard() const
   603 {
   736 {
   604     Q_D(const HbInputSettingProxy);
   737     Q_D(const HbInputSettingProxy);
   605     int res = 0;
   738     bool res = false;
   606 
   739 
   607     HbSettingProxyInternalData* prData = d->proxyData();
   740     HbSettingProxyInternalData* prData = d->proxyData();
   608     if (prData) {
   741     if (prData) {
   609         res = prData->iPredictiveInputState;
   742         if (activeKeyboard() & HbQwertyKeyboardMask) {
       
   743             res = prData->iPredictiveInputState & HbKeyboardSettingQwerty;
       
   744         } else {
       
   745             res = prData->iPredictiveInputState & HbKeyboardSetting12key;
       
   746         }
   610     }
   747     }
   611 
   748 
   612     return res;
   749     return res;
   613 }
   750 }
   614 
   751 
   615 /*!
   752 /*!
   616 Sets the status of predictive text input feature.
   753 Sets the status of predictive text input feature for active keyboard.
   617 
   754 
   618 \sa predictiveInputStatus
   755 \sa predictiveInputStatusForActiveKeyboard
   619 */
   756 */
   620 void HbInputSettingProxy::setPredictiveInputStatus(int newStatus)
   757 void HbInputSettingProxy::setPredictiveInputStatusForActiveKeyboard(bool newStatus)
   621 {
   758 {
   622     Q_D(HbInputSettingProxy);
   759     if (activeKeyboard() & HbQwertyKeyboardMask) {
   623 
   760         setPredictiveInputStatus(HbKeyboardSettingQwerty, newStatus);
   624     if (newStatus != 0) {
   761     } else {
   625         newStatus = 1;
   762         setPredictiveInputStatus(HbKeyboardSetting12key, newStatus);
   626     }
       
   627 
       
   628     HbSettingProxyInternalData* prData = d->proxyData();
       
   629     if (prData) {
       
   630         d->lock();
       
   631         prData->iPredictiveInputState = newStatus;
       
   632         d->unlock();
       
   633         emit predictiveInputStateChanged(newStatus);
       
   634     }
   763     }
   635 }
   764 }
   636 
   765 
   637 /*!
   766 /*!
   638 Returns path to a writable location that should be used as a base storage folder for
   767 Returns path to a writable location that should be used as a base storage folder for
   767 \sa globalDigitType
   896 \sa globalDigitType
   768 */
   897 */
   769 void HbInputSettingProxy::setGlobalDigitType(HbInputDigitType digitType)
   898 void HbInputSettingProxy::setGlobalDigitType(HbInputDigitType digitType)
   770 {
   899 {
   771     Q_D(HbInputSettingProxy);
   900     Q_D(HbInputSettingProxy);
   772     d->lock();
   901     HbSettingProxyInternalData* prData = d->proxyData();
   773     HbSettingProxyInternalData* prData = d->proxyData();
   902     if (prData) {
   774     if (prData) {
   903         d->lock();
   775         prData->iDigitType = digitType;
   904         if (prData->iDigitType != digitType) {
   776     }
   905             prData->iDigitType = digitType;
   777     d->unlock();
   906         }
       
   907         d->unlock();
       
   908     }
   778 }
   909 }
   779 
   910 
   780 /*!
   911 /*!
   781 Returns true if automatic text casing should be used with qwerty keyboards.
   912 Returns true if automatic text casing should be used with qwerty keyboards.
   782 
   913 
   794 
   925 
   795     return res;
   926     return res;
   796 }
   927 }
   797 
   928 
   798 /*!
   929 /*!
   799 Sets automatic text casing for qwerty keyboards.
   930 Sets automatic text casing for qwerty keyboards. Will emit signal automaticTextCasingStateForQwertyChanged if status is changed.
   800 
   931 
   801 \sa automaticTextCasingForQwerty
   932 \sa automaticTextCasingForQwerty
   802 */
   933 */
   803 void HbInputSettingProxy::setAutomaticTextCasingForQwerty(bool status)
   934 void HbInputSettingProxy::setAutomaticTextCasingForQwerty(bool status)
   804 {
   935 {
   805     Q_D(HbInputSettingProxy);
   936     Q_D(HbInputSettingProxy);
   806     d->lock();
   937     HbSettingProxyInternalData* prData = d->proxyData();
   807     HbSettingProxyInternalData* prData = d->proxyData();
   938     if (prData) {
   808     if (prData) {
   939         bool notify = false;
   809         prData->iQwertyTextCasing = status;
   940         d->lock();
   810     }
   941         if (prData->iQwertyTextCasing != status) {
   811     d->unlock();
   942             prData->iQwertyTextCasing = status;
   812 }
   943             notify = true;
   813 
   944         }
   814 /*!
   945         d->unlock();
   815 Enables/Disables character preview in Qwerty keypad.
   946         if (notify) {
       
   947             emit automaticTextCasingStateForQwertyChanged(status);
       
   948         }
       
   949     }
       
   950     
       
   951 }
       
   952 
       
   953 /*!
       
   954 Enables/Disables character preview in Qwerty keypad. Will emit signal characterPreviewStateForQwertyChanged if status is changed.
   816 
   955 
   817 \sa characterPreviewForQwerty
   956 \sa characterPreviewForQwerty
   818 */
   957 */
   819 void HbInputSettingProxy::setCharacterPreviewForQwerty(bool previewEnabled)
   958 void HbInputSettingProxy::setCharacterPreviewForQwerty(bool previewEnabled)
   820 {
   959 {
   821     Q_D(HbInputSettingProxy);
   960     Q_D(HbInputSettingProxy);
   822 
   961     HbSettingProxyInternalData* prData = d->proxyData();
   823     d->lock();
   962     if (prData) {
   824     HbSettingProxyInternalData* prData = d->proxyData();
   963         bool notify = false;
   825     if (prData) {
   964         d->lock();
   826         prData->iQwertyCharacterPreview = previewEnabled;
   965         if (prData->iQwertyCharacterPreview != previewEnabled) {
   827     }
   966             prData->iQwertyCharacterPreview = previewEnabled;
   828     d->unlock();
   967             notify = true;
       
   968         }
       
   969         d->unlock();
       
   970         if (notify) {
       
   971             emit characterPreviewStateForQwertyChanged(previewEnabled);
       
   972         }
       
   973     }
       
   974     
   829 }
   975 }
   830 
   976 
   831 /*!
   977 /*!
   832 Returns true if the character preview is enabled in Qwerty keypad.
   978 Returns true if the character preview is enabled in Qwerty keypad.
   833 
   979 
  1005     }
  1151     }
  1006     return res;
  1152     return res;
  1007 }
  1153 }
  1008 
  1154 
  1009 /*!
  1155 /*!
  1010 Sets the status of regional input correction feature. 
  1156 Sets the status of regional input correction feature. Will emit signal regionalCorretionStatusChanged if status is changed.
  1011 
  1157 
  1012 \sa regionalCorrectionEnabled.
  1158 \sa regionalCorrectionEnabled.
  1013 */
  1159 */
  1014 void HbInputSettingProxy::enableRegionalCorrection(bool newStatus)
  1160 void HbInputSettingProxy::enableRegionalCorrection(bool newStatus)
  1015 {
  1161 {
  1016     Q_D(HbInputSettingProxy);
  1162     Q_D(HbInputSettingProxy);
  1017     HbSettingProxyInternalData* prData = d->proxyData();
  1163     HbSettingProxyInternalData* prData = d->proxyData();
  1018     if (prData) {
  1164     if (prData) {
  1019         d->lock();
  1165         bool notify = false;
  1020         prData->iRegionalCorrectionStatus = newStatus;
  1166         d->lock();
  1021         d->unlock();
  1167         if (prData->iRegionalCorrectionStatus != newStatus) {
  1022         emit regionalCorretionStatusChanged(newStatus);
  1168             prData->iRegionalCorrectionStatus = newStatus;
  1023     }
  1169             notify = true;
       
  1170         }
       
  1171         d->unlock();
       
  1172         if (notify) {
       
  1173             emit regionalCorretionStatusChanged(newStatus);
       
  1174         }
       
  1175     }
       
  1176 }
       
  1177 
       
  1178 /*!
       
  1179 Sets the keypress timeout value. Will emit signal keypressTimeoutChanged if timeout is changed.
       
  1180 
       
  1181 \sa keypressTimeout.
       
  1182 */
       
  1183 void HbInputSettingProxy::setKeypressTimeout(int timeout)
       
  1184 {
       
  1185     Q_D(HbInputSettingProxy);
       
  1186     HbSettingProxyInternalData* prData = d->proxyData();
       
  1187     if (prData) {
       
  1188         bool notify = false;
       
  1189         d->lock();
       
  1190         if (prData->iKeypressTimeout != timeout) {
       
  1191             prData->iKeypressTimeout = timeout;
       
  1192             notify = true;
       
  1193         }
       
  1194         d->unlock();
       
  1195         if (notify) {
       
  1196             emit keypressTimeoutChanged(timeout);
       
  1197         }
       
  1198     }
       
  1199 }
       
  1200 
       
  1201 /*!
       
  1202 Returns the keypress timeout value. 
       
  1203 
       
  1204 \sa setKeypressTimeout.
       
  1205 */
       
  1206 int HbInputSettingProxy::keypressTimeout() const
       
  1207 {
       
  1208     Q_D(const HbInputSettingProxy);
       
  1209     int res = 0;
       
  1210     HbSettingProxyInternalData* prData = d->proxyData();
       
  1211     if (prData) {
       
  1212         res = prData->iKeypressTimeout;
       
  1213     }
       
  1214     return res;
       
  1215 }
       
  1216 
       
  1217 /*!
       
  1218 Sets the autocompletion status. Will emit signal autocompletionStateChanged if status is changed.
       
  1219 
       
  1220 \sa isAutocompletionEnabled.
       
  1221 */
       
  1222 void HbInputSettingProxy::setAutocompletionStatus(HbKeyboardSettingFlags keyboardType, bool state)
       
  1223 {
       
  1224     Q_D(HbInputSettingProxy);
       
  1225     HbSettingProxyInternalData* prData = d->proxyData();
       
  1226     if (prData) {
       
  1227         bool notify = false;
       
  1228         d->lock();
       
  1229         HbKeyboardSettingFlags newValue = prData->iAutocompletion;
       
  1230         if (state) {
       
  1231             newValue |= keyboardType;
       
  1232         } else {
       
  1233             newValue &= ~keyboardType;
       
  1234         }
       
  1235         if (prData->iAutocompletion != newValue) {
       
  1236             prData->iAutocompletion = newValue;
       
  1237             notify = true;
       
  1238         }
       
  1239         d->unlock();
       
  1240         if (notify) {
       
  1241             emit autocompletionStateChanged(keyboardType, state);
       
  1242         }
       
  1243     }
       
  1244 }
       
  1245 
       
  1246 /*!
       
  1247 Returns the autocompletion status for ITUT. Returns true if any of given
       
  1248 keyboards have autocompletion enabled.
       
  1249 
       
  1250 \sa setAutocompletionStatus.
       
  1251 */
       
  1252 bool HbInputSettingProxy::isAutocompletionEnabled(HbKeyboardSettingFlags keyboardType) const
       
  1253 {
       
  1254     Q_D(const HbInputSettingProxy);
       
  1255     bool res = false;
       
  1256     HbSettingProxyInternalData* prData = d->proxyData();
       
  1257     if (prData) {
       
  1258         res = prData->iAutocompletion & keyboardType;
       
  1259     }
       
  1260     return res;
       
  1261 }
       
  1262 
       
  1263 /*!
       
  1264 Sets the typing correction level. Will emit signal typingCorrectionLevelChanged if level is changed.
       
  1265 
       
  1266 \sa typingCorrectionLevel.
       
  1267 */
       
  1268 void HbInputSettingProxy::setTypingCorrectionLevel(HbTypingCorrectionLevel level)
       
  1269 {
       
  1270     Q_D(HbInputSettingProxy);
       
  1271     HbSettingProxyInternalData* prData = d->proxyData();
       
  1272     if (prData) {
       
  1273         bool notify = false;
       
  1274         d->lock();
       
  1275         if (prData->iTypingCorrectionLevel != level) {
       
  1276             prData->iTypingCorrectionLevel = level;
       
  1277             notify = true;
       
  1278         }
       
  1279         d->unlock();
       
  1280         if (notify) {
       
  1281             emit typingCorrectionLevelChanged(level);
       
  1282         }
       
  1283         enableRegionalCorrection(level == HbTypingCorrectionLevelHigh);
       
  1284     }
       
  1285 }
       
  1286 
       
  1287 /*!
       
  1288 Returns the typing correction level
       
  1289 
       
  1290 \sa setTypingCorrectionLevel.
       
  1291 */
       
  1292 HbTypingCorrectionLevel HbInputSettingProxy::typingCorrectionLevel() const
       
  1293 {
       
  1294     Q_D(const HbInputSettingProxy);
       
  1295     HbTypingCorrectionLevel res = HbTypingCorrectionLevelHigh;
       
  1296     HbSettingProxyInternalData* prData = d->proxyData();
       
  1297     if (prData) {
       
  1298         res = prData->iTypingCorrectionLevel;
       
  1299     }
       
  1300     return res;
       
  1301 }
       
  1302 
       
  1303 /*!
       
  1304 Sets the primary candidate mode. Will emit signal primaryCandidateModeChanged if mode is changed.
       
  1305 
       
  1306 \sa primaryCandidateMode.
       
  1307 */
       
  1308 void HbInputSettingProxy::setPrimaryCandidateMode(HbPrimaryCandidateMode mode)
       
  1309 {
       
  1310     Q_D(HbInputSettingProxy);
       
  1311     HbSettingProxyInternalData* prData = d->proxyData();
       
  1312     if (prData) {
       
  1313         bool notify = false;
       
  1314         d->lock();
       
  1315         if (prData->iPrimaryCandidateMode != mode) {
       
  1316             prData->iPrimaryCandidateMode = mode;
       
  1317             notify = true;
       
  1318         }
       
  1319         d->unlock();
       
  1320         if (notify) {
       
  1321             emit primaryCandidateModeChanged(mode);
       
  1322         }
       
  1323     }
       
  1324 }
       
  1325 
       
  1326 /*!
       
  1327 Returns the primary candidate mode
       
  1328 
       
  1329 \sa setPrimaryCandidateMode.
       
  1330 */
       
  1331 HbPrimaryCandidateMode HbInputSettingProxy::primaryCandidateMode() const
       
  1332 {
       
  1333     Q_D(const HbInputSettingProxy);
       
  1334     HbPrimaryCandidateMode res = HbPrimaryCandidateModeExactTyping;
       
  1335     HbSettingProxyInternalData* prData = d->proxyData();
       
  1336     if (prData) {
       
  1337         res = prData->iPrimaryCandidateMode;
       
  1338     }
       
  1339     return res;
  1024 }
  1340 }
  1025 
  1341 
  1026 // End of file
  1342 // End of file