src/hbcore/inputfw/hbinputsettingproxy.cpp
changeset 6 c3690ec91ef8
parent 5 627c4a0fd0e7
child 21 4633027730f5
child 34 ed14f46c0e55
equal deleted inserted replaced
5:627c4a0fd0e7 6:c3690ec91ef8
    20 **
    20 **
    21 ** If you have questions regarding the use of this file, please contact
    21 ** If you have questions regarding the use of this file, please contact
    22 ** Nokia at developer.feedback@nokia.com.
    22 ** Nokia at developer.feedback@nokia.com.
    23 **
    23 **
    24 ****************************************************************************/
    24 ****************************************************************************/
       
    25 #include "hbinputsettingproxy.h"
       
    26 #include "hbinputsettingproxy_p.h"
       
    27 
    25 #include <qbytearray.h>
    28 #include <qbytearray.h>
    26 #include <QFile>
    29 #include <QFile>
    27 #include <QBuffer>
    30 #include <QBuffer>
    28 #include <QDataStream>
    31 #include <QDataStream>
    29 #include <QCoreApplication>
    32 #include <QCoreApplication>
    30 #include <QSharedMemory>
    33 #include <QSharedMemory>
    31 #include <QVector>
    34 #include <QVector>
    32 #include <QDir>
    35 #include <QDir>
    33 
    36 
    34 #include "hbinputsettingproxy.h"
       
    35 #include "hbinputsettingproxy_p.h"
       
    36 #include "hbinputmodecache_p.h"
    37 #include "hbinputmodecache_p.h"
    37 #include "hbinputfilter.h"
    38 #include "hbinputfilter.h"
    38 
    39 
    39 #ifdef Q_OS_SYMBIAN
    40 #ifdef Q_OS_SYMBIAN
    40 
    41 
    87     displayNameSize = 0;
    88     displayNameSize = 0;
    88 
    89 
    89     if (!descriptor.pluginNameAndPath().isEmpty() &&
    90     if (!descriptor.pluginNameAndPath().isEmpty() &&
    90         (descriptor.pluginNameAndPath().size() * sizeof(QChar) < HbActiveMethodNameMax)) {
    91         (descriptor.pluginNameAndPath().size() * sizeof(QChar) < HbActiveMethodNameMax)) {
    91         pluginNameAndPathSize = descriptor.pluginNameAndPath().size();
    92         pluginNameAndPathSize = descriptor.pluginNameAndPath().size();
    92         memcpy((void*)pluginNameAndPath, (void*)descriptor.pluginNameAndPath().unicode(), descriptor.pluginNameAndPath().size() * sizeof(QChar));
    93         memcpy((void *)pluginNameAndPath, (void *)descriptor.pluginNameAndPath().unicode(), descriptor.pluginNameAndPath().size() * sizeof(QChar));
    93     }
    94     }
    94     if (!descriptor.key().isEmpty() &&
    95     if (!descriptor.key().isEmpty() &&
    95         (descriptor.key().size() * sizeof(QChar) < HbActiveMethodKeyMax)) {
    96         (descriptor.key().size() * sizeof(QChar) < HbActiveMethodKeyMax)) {
    96         memcpy((void*)key, (void*)descriptor.key().unicode(), descriptor.key().size() * sizeof(QChar));
    97         memcpy((void *)key, (void *)descriptor.key().unicode(), descriptor.key().size() * sizeof(QChar));
    97         keySize = descriptor.key().size();
    98         keySize = descriptor.key().size();
    98     }
    99     }
    99     if (!descriptor.displayName().isEmpty() &&
   100     if (!descriptor.displayName().isEmpty() &&
   100         (descriptor.displayName().size() * sizeof(QChar) < HbActiveMethodKeyMax)) {
   101         (descriptor.displayName().size() * sizeof(QChar) < HbActiveMethodKeyMax)) {
   101         memcpy((void*)displayName, (void*)descriptor.displayName().unicode(), descriptor.displayName().size() * sizeof(QChar));
   102         memcpy((void *)displayName, (void *)descriptor.displayName().unicode(), descriptor.displayName().size() * sizeof(QChar));
   102         displayNameSize = descriptor.displayName().size();
   103         displayNameSize = descriptor.displayName().size();
   103     }
   104     }
   104 }
   105 }
   105 
   106 
   106 HbInputMethodDescriptor HbSettingProxyInputMethodDescriptor::descriptor() const
   107 HbInputMethodDescriptor HbSettingProxyInputMethodDescriptor::descriptor() const
   143 // of how popular a SC is.
   144 // of how popular a SC is.
   144 class HbScClassifier
   145 class HbScClassifier
   145 {
   146 {
   146 public:
   147 public:
   147     HbScClassifier(QChar aChar = 0, int aCount = 0)
   148     HbScClassifier(QChar aChar = 0, int aCount = 0)
   148         : mChar(aChar), mCount(aCount)
   149         : mChar(aChar), mCount(aCount) {
   149     {
   150     }
   150     }
   151 
   151 
   152     void operator=(const HbScClassifier &aOther) {
   152     void operator=(const HbScClassifier& aOther)
       
   153     {
       
   154         mChar = aOther.mChar;
   153         mChar = aOther.mChar;
   155         mCount = aOther.mCount;
   154         mCount = aOther.mCount;
   156     }
   155     }
   157 
   156 
   158 public:
   157 public:
   159     QChar mChar;
   158     QChar mChar;
   160     int mCount;
   159     int mCount;
   161 };
   160 };
   162 
   161 
   163 /// @endcond
       
   164 
       
   165 HbInputSettingProxyPrivate::HbInputSettingProxyPrivate()
   162 HbInputSettingProxyPrivate::HbInputSettingProxyPrivate()
   166 {
   163 {
   167     iSharedMemory = new QSharedMemory(KInputSettingProxyKey);
   164     iSharedMemory = new QSharedMemory(KInputSettingProxyKey);
   168 
   165 
   169     if (!iSharedMemory->attach()) {
   166     if (!iSharedMemory->attach()) {
   180         initializeDataArea();
   177         initializeDataArea();
   181     }
   178     }
   182 
   179 
   183     lock();
   180     lock();
   184 
   181 
   185     HbSettingProxyInternalData* prData = proxyData();
   182     HbSettingProxyInternalData *prData = proxyData();
   186     if (prData) {
   183     if (prData) {
   187         ++prData->iReferences;
   184         ++prData->iReferences;
   188     }
   185     }
   189 
   186 
   190     unlock();
   187     unlock();
   199 }
   196 }
   200 
   197 
   201 void HbInputSettingProxyPrivate::shutdownDataArea()
   198 void HbInputSettingProxyPrivate::shutdownDataArea()
   202 {
   199 {
   203     lock();
   200     lock();
   204     HbSettingProxyInternalData* prData = proxyData();
   201     HbSettingProxyInternalData *prData = proxyData();
   205     if (prData) {
   202     if (prData) {
   206         prData->iReferences--;
   203         prData->iReferences--;
   207         if (prData->iReferences <= 0) {
   204         if (prData->iReferences <= 0) {
   208             save();
   205             save();
   209         }
   206         }
   211     unlock();
   208     unlock();
   212 }
   209 }
   213 
   210 
   214 QString HbInputSettingProxyPrivate::dataFilePath()
   211 QString HbInputSettingProxyPrivate::dataFilePath()
   215 {
   212 {
   216     return HbInputSettingProxy::writablePath()+QDir::separator()+QString("settings");
   213     return HbInputSettingProxy::writablePath() + QDir::separator() + QString("settings");
   217 }
   214 }
   218 
   215 
   219 QString HbInputSettingProxyPrivate::dataFileNameAndPath()
   216 QString HbInputSettingProxyPrivate::dataFileNameAndPath()
   220 {
   217 {
   221     return dataFilePath()+QDir::separator()+QString("proxy.dat");
   218     return dataFilePath() + QDir::separator() + QString("proxy.dat");
   222 }
   219 }
   223 
   220 
   224 void HbInputSettingProxyPrivate::initializeDataArea()
   221 void HbInputSettingProxyPrivate::initializeDataArea()
   225 {
   222 {
   226     lock();
   223     lock();
   227     bool wasLoaded = load();
   224     bool wasLoaded = load();
   228 
   225 
   229     HbSettingProxyInternalData* prData = proxyData();
   226     HbSettingProxyInternalData *prData = proxyData();
   230     if (prData) {
   227     if (prData) {
   231         prData->iReferences = 0;
   228         prData->iReferences = 0;
   232         prData->iOrientationChangeCompleted = true;
   229         prData->iOrientationChangeCompleted = true;
   233         // Default values, real ones should be set by calling initializeOrientation()
   230         // Default values, real ones should be set by calling initializeOrientation()
   234         prData->iScreenOrientation = Qt::Vertical;
   231         prData->iScreenOrientation = Qt::Vertical;
   238             prData->iVersion = HbProxyDataRequiredVersion;
   235             prData->iVersion = HbProxyDataRequiredVersion;
   239             prData->iGlobalPrimaryInputLanguage = HbInputLanguage(QLocale::English, QLocale::UnitedKingdom);
   236             prData->iGlobalPrimaryInputLanguage = HbInputLanguage(QLocale::English, QLocale::UnitedKingdom);
   240             prData->iGlobalSecondaryInputLanguage = QLocale::Language(0);
   237             prData->iGlobalSecondaryInputLanguage = QLocale::Language(0);
   241             prData->iActiveKeyboard = HbKeyboardVirtual12Key;
   238             prData->iActiveKeyboard = HbKeyboardVirtual12Key;
   242             prData->iTouchKeyboard = HbKeyboardVirtual12Key;
   239             prData->iTouchKeyboard = HbKeyboardVirtual12Key;
   243             prData->iHwKeyboard = HbKeyboardQwerty;           
   240             prData->iHwKeyboard = HbKeyboardQwerty;
   244             prData->iPredictiveInputState = (HbKeyboardSettingFlags)HbKeyboardSetting12key|HbKeyboardSettingQwerty;
   241             prData->iPredictiveInputState = (HbKeyboardSettingFlags)HbKeyboardSetting12key | HbKeyboardSettingQwerty;
   245             prData->iDigitType = HbDigitTypeLatin;
   242             prData->iDigitType = HbDigitTypeLatin;
   246             prData->iQwertyTextCasing = true;
   243             prData->iQwertyTextCasing = true;
   247             prData->iQwertyCharacterPreview = true;
   244             prData->iQwertyCharacterPreview = true;
   248             prData->iRegionalCorrectionStatus = true;
   245             prData->iRegionalCorrectionStatus = true;
   249             prData->iKeypressTimeout = 1000;
   246             prData->iKeypressTimeout = 1000;
   250             prData->iAutocompletion = (HbKeyboardSettingFlags)(HbKeyboardSetting12key | HbKeyboardSettingQwerty);
   247             prData->iAutocompletion = (HbKeyboardSettingFlags)(HbKeyboardSetting12key | HbKeyboardSettingQwerty);
   251             prData->iTypingCorrectionLevel = HbTypingCorrectionLevelHigh;
   248             prData->iTypingCorrectionLevel = HbTypingCorrectionLevelHigh;
   252             prData->iPrimaryCandidateMode = HbPrimaryCandidateModeBestPrediction;           
   249             prData->iPrimaryCandidateMode = HbPrimaryCandidateModeBestPrediction;
   253             prData->iPreferredMethodHorizontal = HbInputMethodDescriptor();
   250             prData->iPreferredMethodHorizontal = HbInputMethodDescriptor();
   254             prData->iPreferredMethodHorizontal.setData(QByteArray());
   251             prData->iPreferredMethodHorizontal.setData(QByteArray());
   255             prData->iPreferredMethodVertical = HbInputMethodDescriptor();
   252             prData->iPreferredMethodVertical = HbInputMethodDescriptor();
   256             prData->iPreferredMethodVertical.setData(QByteArray());
   253             prData->iPreferredMethodVertical.setData(QByteArray());
   257         }
   254         }
   266         return false;
   263         return false;
   267     }
   264     }
   268 
   265 
   269     QByteArray rawData = file.read(sizeof(HbSettingProxyInternalData));
   266     QByteArray rawData = file.read(sizeof(HbSettingProxyInternalData));
   270     if (rawData.size() == sizeof(HbSettingProxyInternalData)) {
   267     if (rawData.size() == sizeof(HbSettingProxyInternalData)) {
   271         HbSettingProxyInternalData* ldData = (HbSettingProxyInternalData*)rawData.constData();
   268         HbSettingProxyInternalData *ldData = (HbSettingProxyInternalData *)rawData.constData();
   272         if (ldData) {
   269         if (ldData) {
   273             if (ldData->iVersion == HbProxyDataRequiredVersion) {
   270             if (ldData->iVersion == HbProxyDataRequiredVersion) {
   274 
   271 
   275                 HbSettingProxyInternalData* prData = proxyData();
   272                 HbSettingProxyInternalData *prData = proxyData();
   276                 memcpy((void*)prData, (void*)ldData, sizeof(HbSettingProxyInternalData));
   273                 memcpy((void *)prData, (void *)ldData, sizeof(HbSettingProxyInternalData));
   277                 prData->iActiveKeyboard = ldData->iActiveKeyboard;
   274                 prData->iActiveKeyboard = ldData->iActiveKeyboard;
   278 
   275 
   279                 // Temporarily like this, will be moved as part of shared data later...
   276                 // Temporarily like this, will be moved as part of shared data later...
   280                 int numItems = 0;
   277                 int numItems = 0;
   281                 file.read((char *)&numItems, sizeof(int));
   278                 file.read((char *)&numItems, sizeof(int));
   282                 iTopScs.clear();
   279                 iTopScs.clear();
   283                 for (int jj = 0; jj < numItems; jj++) {
   280                 for (int jj = 0; jj < numItems; jj++) {
   284                     HbScClassifier tmpItem;
   281                     HbScClassifier tmpItem;
   285                     file.read((char*)&tmpItem, sizeof(HbScClassifier));
   282                     file.read((char *)&tmpItem, sizeof(HbScClassifier));
   286                     iTopScs.append(tmpItem);
   283                     iTopScs.append(tmpItem);
   287                 }
   284                 }
   288 
   285 
   289                 file.close();
   286                 file.close();
   290                 return true;
   287                 return true;
   300 {
   297 {
   301     // Make sure that the path exists
   298     // Make sure that the path exists
   302     QDir settingDir;
   299     QDir settingDir;
   303     settingDir.mkpath(dataFilePath());
   300     settingDir.mkpath(dataFilePath());
   304 
   301 
   305     HbSettingProxyInternalData* prData = proxyData();
   302     HbSettingProxyInternalData *prData = proxyData();
   306     if (prData) {
   303     if (prData) {
   307         QFile file(iSaveFile);
   304         QFile file(iSaveFile);
   308         if (!file.open(QIODevice::WriteOnly)) {
   305         if (!file.open(QIODevice::WriteOnly)) {
   309             return;
   306             return;
   310         }
   307         }
   311 
   308 
   312         file.write((const char*)prData, sizeof(HbSettingProxyInternalData));
   309         file.write((const char *)prData, sizeof(HbSettingProxyInternalData));
   313 
   310 
   314         // Temporarily like this, will be moved to shared data later...
   311         // Temporarily like this, will be moved to shared data later...
   315         int numItems = iTopScs.count();
   312         int numItems = iTopScs.count();
   316         file.write((const char*)&numItems, sizeof(int));
   313         file.write((const char *)&numItems, sizeof(int));
   317         file.write((const char*)iTopScs.constData(), numItems * sizeof(HbScClassifier));
   314         file.write((const char *)iTopScs.constData(), numItems * sizeof(HbScClassifier));
   318         file.close();
   315         file.close();
   319     }
   316     }
   320 }
   317 }
   321 
   318 
   322 QString HbInputSettingProxyPrivate::stringFromProxyDataElement(QChar *string) const
   319 QString HbInputSettingProxyPrivate::stringFromProxyDataElement(QChar *string) const
   336         string[i] = source[i];
   333         string[i] = source[i];
   337     }
   334     }
   338     string[i] = 0;
   335     string[i] = 0;
   339 }
   336 }
   340 
   337 
   341 HbSettingProxyInternalData* HbInputSettingProxyPrivate::proxyData() const
   338 HbSettingProxyInternalData *HbInputSettingProxyPrivate::proxyData() const
   342 {
   339 {
   343     return static_cast<HbSettingProxyInternalData*>(iSharedMemory->data());
   340     return static_cast<HbSettingProxyInternalData *>(iSharedMemory->data());
   344 }
   341 }
   345 
   342 
   346 void HbInputSettingProxyPrivate::flipToggle()
   343 void HbInputSettingProxyPrivate::flipToggle()
   347 {
   344 {
   348     setFlipStatus(!flipStatus());
   345     setFlipStatus(!flipStatus());
   349 }
   346 }
   350 
   347 
   351 bool HbInputSettingProxyPrivate::flipStatus()
   348 bool HbInputSettingProxyPrivate::flipStatus()
   352 {
   349 {
   353     HbSettingProxyInternalData* prData = proxyData();
   350     HbSettingProxyInternalData *prData = proxyData();
   354     return prData->iFlipStatus;
   351     return prData->iFlipStatus;
   355 }
   352 }
   356 
   353 
   357 void HbInputSettingProxyPrivate::setFlipStatus(bool flipStatus)
   354 void HbInputSettingProxyPrivate::setFlipStatus(bool flipStatus)
   358 {
   355 {
   359     HbSettingProxyInternalData* prData = proxyData();
   356     HbSettingProxyInternalData *prData = proxyData();
   360     prData->iFlipStatus = flipStatus;
   357     prData->iFlipStatus = flipStatus;
   361 
   358 
   362     handleDeviceSpecificOriantationAndFlipChange();
   359     handleDeviceSpecificOriantationAndFlipChange();
   363 }
   360 }
   364 
   361 
   367     HbKeyboardType  keyboard = HbKeyboardNone;
   364     HbKeyboardType  keyboard = HbKeyboardNone;
   368 
   365 
   369     if (HbInputSettingProxy::instance()->screenOrientation() == Qt::Vertical) {
   366     if (HbInputSettingProxy::instance()->screenOrientation() == Qt::Vertical) {
   370         keyboard = HbKeyboardVirtual12Key;
   367         keyboard = HbKeyboardVirtual12Key;
   371     } else {
   368     } else {
   372         if(flipStatus()) {
   369         if (flipStatus()) {
   373             keyboard = HbKeyboardQwerty;
   370             keyboard = HbKeyboardQwerty;
   374         } else {
   371         } else {
   375             keyboard = HbKeyboardVirtualQwerty;
   372             keyboard = HbKeyboardVirtualQwerty;
   376         }
   373         }
   377     }
   374     }
   378 
   375 
   379     HbInputSettingProxy::instance()->setActiveKeyboard(keyboard);
   376     HbInputSettingProxy::instance()->setActiveKeyboard(keyboard);
   380 }
   377 }
   381 
   378 
   382 //
   379 /// @endcond
   383 // HbInputSettingProxy
       
   384 //
       
   385 
   380 
   386 /*!
   381 /*!
   387 Returns pointer to the singleton object.
   382 Returns pointer to the singleton object.
   388 */
   383 */
   389 HbInputSettingProxy* HbInputSettingProxy::instance()
   384 HbInputSettingProxy *HbInputSettingProxy::instance()
   390 {
   385 {
   391     static HbInputSettingProxy theProxy;
   386     static HbInputSettingProxy theProxy;
   392     return &theProxy;
   387     return &theProxy;
   393 }
   388 }
   394 
   389 
   447 \sa keypressTimeoutChanged
   442 \sa keypressTimeoutChanged
   448 \sa autocompletionStateChanged
   443 \sa autocompletionStateChanged
   449 \sa typingCorrectionLevelChanged
   444 \sa typingCorrectionLevelChanged
   450 \sa primaryCandidateModeChanged
   445 \sa primaryCandidateModeChanged
   451 */
   446 */
   452 void HbInputSettingProxy::connectObservingObject(QObject* aObserver)
   447 void HbInputSettingProxy::connectObservingObject(QObject *aObserver)
   453 {
   448 {
   454     if (aObserver) {
   449     if (aObserver) {
   455         connect(this, SIGNAL(globalInputLanguageChanged(const HbInputLanguage &)), aObserver, SLOT(globalInputLanguageChanged(const HbInputLanguage &)));
   450         connect(this, SIGNAL(globalInputLanguageChanged(const HbInputLanguage &)), aObserver, SLOT(globalInputLanguageChanged(const HbInputLanguage &)));
   456         connect(this, SIGNAL(globalSecondaryInputLanguageChanged(const HbInputLanguage &)), aObserver, SLOT(globalSecondaryInputLanguageChanged(const HbInputLanguage &)));
   451         connect(this, SIGNAL(globalSecondaryInputLanguageChanged(const HbInputLanguage &)), aObserver, SLOT(globalSecondaryInputLanguageChanged(const HbInputLanguage &)));
   457         connect(this, SIGNAL(activeKeyboardChanged(HbKeyboardType)), aObserver, SLOT(activeKeyboardChanged(HbKeyboardType)));
   452         connect(this, SIGNAL(activeKeyboardChanged(HbKeyboardType)), aObserver, SLOT(activeKeyboardChanged(HbKeyboardType)));
   463 /*!
   458 /*!
   464 Disconnects given object from the setting proxy.
   459 Disconnects given object from the setting proxy.
   465 
   460 
   466 \sa connectObservingObject
   461 \sa connectObservingObject
   467 */
   462 */
   468 void HbInputSettingProxy::disconnectObservingObject(QObject* aObserver)
   463 void HbInputSettingProxy::disconnectObservingObject(QObject *aObserver)
   469 {
   464 {
   470     if (aObserver) {
   465     if (aObserver) {
   471         disconnect(this, SIGNAL(globalInputLanguageChanged(const HbInputLanguage &)), aObserver, SLOT(globalInputLanguageChanged(const HbInputLanguage &)));
   466         disconnect(this, SIGNAL(globalInputLanguageChanged(const HbInputLanguage &)), aObserver, SLOT(globalInputLanguageChanged(const HbInputLanguage &)));
   472         disconnect(this, SIGNAL(globalSecondaryInputLanguageChanged(const HbInputLanguage &)), aObserver, SLOT(globalSecondaryInputLanguageChanged(const HbInputLanguage &)));
   467         disconnect(this, SIGNAL(globalSecondaryInputLanguageChanged(const HbInputLanguage &)), aObserver, SLOT(globalSecondaryInputLanguageChanged(const HbInputLanguage &)));
   473         disconnect(this, SIGNAL(activeKeyboardChanged(HbKeyboardType)), aObserver, SLOT(activeKeyboardChanged(HbKeyboardType)));
   468         disconnect(this, SIGNAL(activeKeyboardChanged(HbKeyboardType)), aObserver, SLOT(activeKeyboardChanged(HbKeyboardType)));
   487 {
   482 {
   488     Q_D(const HbInputSettingProxy);
   483     Q_D(const HbInputSettingProxy);
   489     HbInputLanguage res;
   484     HbInputLanguage res;
   490 
   485 
   491     d->lock();
   486     d->lock();
   492     HbSettingProxyInternalData* prData = d->proxyData();
   487     HbSettingProxyInternalData *prData = d->proxyData();
   493     if (prData) {
   488     if (prData) {
   494         res = prData->iGlobalPrimaryInputLanguage;
   489         res = prData->iGlobalPrimaryInputLanguage;
   495     }
   490     }
   496     d->unlock();
   491     d->unlock();
   497 
   492 
   508 {
   503 {
   509     Q_D(const HbInputSettingProxy);
   504     Q_D(const HbInputSettingProxy);
   510     HbInputLanguage res;
   505     HbInputLanguage res;
   511 
   506 
   512     d->lock();
   507     d->lock();
   513     HbSettingProxyInternalData* prData = d->proxyData();
   508     HbSettingProxyInternalData *prData = d->proxyData();
   514     if (prData) {
   509     if (prData) {
   515         res = prData->iGlobalSecondaryInputLanguage;
   510         res = prData->iGlobalSecondaryInputLanguage;
   516     }
   511     }
   517     d->unlock();
   512     d->unlock();
   518 
   513 
   537 HbKeyboardType HbInputSettingProxy::activeHwKeyboard() const
   532 HbKeyboardType HbInputSettingProxy::activeHwKeyboard() const
   538 {
   533 {
   539     Q_D(const HbInputSettingProxy);
   534     Q_D(const HbInputSettingProxy);
   540     HbKeyboardType res = HbKeyboardNone;
   535     HbKeyboardType res = HbKeyboardNone;
   541 
   536 
   542     HbSettingProxyInternalData* prData = d->proxyData();
   537     HbSettingProxyInternalData *prData = d->proxyData();
   543     if (prData) {
   538     if (prData) {
   544         res = prData->iHwKeyboard;
   539         res = prData->iHwKeyboard;
   545     }
   540     }
   546 
   541 
   547     return res;
   542     return res;
   556 HbKeyboardType HbInputSettingProxy::activeTouchKeyboard() const
   551 HbKeyboardType HbInputSettingProxy::activeTouchKeyboard() const
   557 {
   552 {
   558     Q_D(const HbInputSettingProxy);
   553     Q_D(const HbInputSettingProxy);
   559     HbKeyboardType res = HbKeyboardNone;
   554     HbKeyboardType res = HbKeyboardNone;
   560 
   555 
   561     HbSettingProxyInternalData* prData = d->proxyData();
   556     HbSettingProxyInternalData *prData = d->proxyData();
   562     if (prData) {
   557     if (prData) {
   563         res = prData->iTouchKeyboard;
   558         res = prData->iTouchKeyboard;
   564     }
   559     }
   565 
   560 
   566     return res;
   561     return res;
   574 HbKeyboardType HbInputSettingProxy::activeKeyboard() const
   569 HbKeyboardType HbInputSettingProxy::activeKeyboard() const
   575 {
   570 {
   576     Q_D(const HbInputSettingProxy);
   571     Q_D(const HbInputSettingProxy);
   577     HbKeyboardType res = HbKeyboardNone;
   572     HbKeyboardType res = HbKeyboardNone;
   578 
   573 
   579     HbSettingProxyInternalData* prData = d->proxyData();
   574     HbSettingProxyInternalData *prData = d->proxyData();
   580     if (prData) {
   575     if (prData) {
   581         res = prData->iActiveKeyboard;
   576         res = prData->iActiveKeyboard;
   582     }
   577     }
   583 
   578 
   584     return res;
   579     return res;
   594 {
   589 {
   595     Q_D(const HbInputSettingProxy);
   590     Q_D(const HbInputSettingProxy);
   596 
   591 
   597     HbInputMethodDescriptor result;
   592     HbInputMethodDescriptor result;
   598 
   593 
   599     HbSettingProxyInternalData* prData = d->proxyData();
   594     HbSettingProxyInternalData *prData = d->proxyData();
   600     if (prData) {
   595     if (prData) {
   601         d->lock();
   596         d->lock();
   602         if (orientation == Qt::Horizontal) {
   597         if (orientation == Qt::Horizontal) {
   603             result = prData->iPreferredMethodHorizontal.descriptor();
   598             result = prData->iPreferredMethodHorizontal.descriptor();
   604         } else {
   599         } else {
   620 {
   615 {
   621     Q_D(const HbInputSettingProxy);
   616     Q_D(const HbInputSettingProxy);
   622 
   617 
   623     HbInputMethodDescriptor result;
   618     HbInputMethodDescriptor result;
   624 
   619 
   625     HbSettingProxyInternalData* prData = d->proxyData();
   620     HbSettingProxyInternalData *prData = d->proxyData();
   626     if (prData) {
   621     if (prData) {
   627         d->lock();
   622         d->lock();
   628         if (prData->iScreenOrientation == Qt::Horizontal) {
   623         if (prData->iScreenOrientation == Qt::Horizontal) {
   629             result = prData->iPreferredMethodHorizontal.descriptor();
   624             result = prData->iPreferredMethodHorizontal.descriptor();
   630         } else {
   625         } else {
   645 {
   640 {
   646     Q_D(const HbInputSettingProxy);
   641     Q_D(const HbInputSettingProxy);
   647 
   642 
   648     QByteArray result;
   643     QByteArray result;
   649 
   644 
   650     HbSettingProxyInternalData* prData = d->proxyData();
   645     HbSettingProxyInternalData *prData = d->proxyData();
   651     if (prData) {
   646     if (prData) {
   652         d->lock();
   647         d->lock();
   653         if (orientation == Qt::Horizontal) {
   648         if (orientation == Qt::Horizontal) {
   654             result = prData->iPreferredMethodHorizontal.data();
   649             result = prData->iPreferredMethodHorizontal.data();
   655         } else {
   650         } else {
   671 \sa preferredInputMethod
   666 \sa preferredInputMethod
   672 */
   667 */
   673 void HbInputSettingProxy::setPreferredInputMethod(Qt::Orientation orientation, const HbInputMethodDescriptor &inputMethod, const QByteArray &customData)
   668 void HbInputSettingProxy::setPreferredInputMethod(Qt::Orientation orientation, const HbInputMethodDescriptor &inputMethod, const QByteArray &customData)
   674 {
   669 {
   675     Q_D(HbInputSettingProxy);
   670     Q_D(HbInputSettingProxy);
   676     HbSettingProxyInternalData* prData = d->proxyData();
   671     HbSettingProxyInternalData *prData = d->proxyData();
   677     if (prData) {
   672     if (prData) {
   678         d->lock();
   673         d->lock();
   679         if (orientation == Qt::Horizontal) {
   674         if (orientation == Qt::Horizontal) {
   680             prData->iPreferredMethodHorizontal = inputMethod;
   675             prData->iPreferredMethodHorizontal = inputMethod;
   681             prData->iPreferredMethodHorizontal.setData(customData);
   676             prData->iPreferredMethodHorizontal.setData(customData);
   690 /*!
   685 /*!
   691 Sets system wide input language. Will emit signal globalInputLanguageChanged if language is changed.
   686 Sets system wide input language. Will emit signal globalInputLanguageChanged if language is changed.
   692 
   687 
   693 \sa globalInputLanguage
   688 \sa globalInputLanguage
   694 */
   689 */
   695 void HbInputSettingProxy::setGlobalInputLanguage(const HbInputLanguage& language)
   690 void HbInputSettingProxy::setGlobalInputLanguage(const HbInputLanguage &language)
   696 {
   691 {
   697     Q_D(HbInputSettingProxy);
   692     Q_D(HbInputSettingProxy);
   698     HbSettingProxyInternalData* prData = d->proxyData();
   693     HbSettingProxyInternalData *prData = d->proxyData();
   699     if (prData) {
   694     if (prData) {
   700         bool notify = false;
   695         bool notify = false;
   701         d->lock();
   696         d->lock();
   702         if (prData->iGlobalPrimaryInputLanguage != language) {
   697         if (prData->iGlobalPrimaryInputLanguage != language) {
   703             prData->iGlobalPrimaryInputLanguage = language;
   698             prData->iGlobalPrimaryInputLanguage = language;
   716 \sa globalSecondaryInputLanguage
   711 \sa globalSecondaryInputLanguage
   717 */
   712 */
   718 void HbInputSettingProxy::setGlobalSecondaryInputLanguage(const HbInputLanguage &language)
   713 void HbInputSettingProxy::setGlobalSecondaryInputLanguage(const HbInputLanguage &language)
   719 {
   714 {
   720     Q_D(HbInputSettingProxy);
   715     Q_D(HbInputSettingProxy);
   721     HbSettingProxyInternalData* prData = d->proxyData();
   716     HbSettingProxyInternalData *prData = d->proxyData();
   722     if (prData) {
   717     if (prData) {
   723         bool notify = false;
   718         bool notify = false;
   724         d->lock();
   719         d->lock();
   725         if (prData->iGlobalSecondaryInputLanguage != language) {
   720         if (prData->iGlobalSecondaryInputLanguage != language) {
   726             prData->iGlobalSecondaryInputLanguage = language;
   721             prData->iGlobalSecondaryInputLanguage = language;
   742 \sa setActiveHwKeyboard
   737 \sa setActiveHwKeyboard
   743 */
   738 */
   744 void HbInputSettingProxy::setActiveHwKeyboard(HbKeyboardType keyboard)
   739 void HbInputSettingProxy::setActiveHwKeyboard(HbKeyboardType keyboard)
   745 {
   740 {
   746     Q_D(HbInputSettingProxy);
   741     Q_D(HbInputSettingProxy);
   747     HbSettingProxyInternalData* prData = d->proxyData();
   742     HbSettingProxyInternalData *prData = d->proxyData();
   748     if (prData) {
   743     if (prData) {
   749         bool notify = false;
   744         bool notify = false;
   750         d->lock();
   745         d->lock();
   751         if (prData->iHwKeyboard != keyboard) {
   746         if (prData->iHwKeyboard != keyboard) {
   752             prData->iHwKeyboard = keyboard;
   747             prData->iHwKeyboard = keyboard;
   768 \sa setActiveHwKeyboard
   763 \sa setActiveHwKeyboard
   769 */
   764 */
   770 void HbInputSettingProxy::setActiveTouchKeyboard(HbKeyboardType keyboard)
   765 void HbInputSettingProxy::setActiveTouchKeyboard(HbKeyboardType keyboard)
   771 {
   766 {
   772     Q_D(HbInputSettingProxy);
   767     Q_D(HbInputSettingProxy);
   773     HbSettingProxyInternalData* prData = d->proxyData();
   768     HbSettingProxyInternalData *prData = d->proxyData();
   774     if (prData) {
   769     if (prData) {
   775         bool notify = false;
   770         bool notify = false;
   776         d->lock();
   771         d->lock();
   777         if (prData->iTouchKeyboard != keyboard) {
   772         if (prData->iTouchKeyboard != keyboard) {
   778             prData->iTouchKeyboard = keyboard;
   773             prData->iTouchKeyboard = keyboard;
   794 \sa setActiveHwKeyboard
   789 \sa setActiveHwKeyboard
   795 */
   790 */
   796 void HbInputSettingProxy::setActiveKeyboard(HbKeyboardType keyboard)
   791 void HbInputSettingProxy::setActiveKeyboard(HbKeyboardType keyboard)
   797 {
   792 {
   798     Q_D(HbInputSettingProxy);
   793     Q_D(HbInputSettingProxy);
   799     HbSettingProxyInternalData* prData = d->proxyData();
   794     HbSettingProxyInternalData *prData = d->proxyData();
   800     if (prData) {
   795     if (prData) {
   801         bool notify = false;
   796         bool notify = false;
   802         d->lock();
   797         d->lock();
   803         if (prData->iActiveKeyboard != keyboard) {
   798         if (prData->iActiveKeyboard != keyboard) {
   804             prData->iActiveKeyboard = keyboard;
   799             prData->iActiveKeyboard = keyboard;
   821 bool HbInputSettingProxy::predictiveInputStatus(HbKeyboardSettingFlags keyboardType) const
   816 bool HbInputSettingProxy::predictiveInputStatus(HbKeyboardSettingFlags keyboardType) const
   822 {
   817 {
   823     Q_D(const HbInputSettingProxy);
   818     Q_D(const HbInputSettingProxy);
   824     bool res = false;
   819     bool res = false;
   825 
   820 
   826     HbSettingProxyInternalData* prData = d->proxyData();
   821     HbSettingProxyInternalData *prData = d->proxyData();
   827     if (prData) {
   822     if (prData) {
   828         res = prData->iPredictiveInputState & keyboardType;
   823         res = prData->iPredictiveInputState & keyboardType;
   829     }
   824     }
   830 
   825 
   831     return res;
   826     return res;
   837 \sa predictiveInputStatus
   832 \sa predictiveInputStatus
   838 */
   833 */
   839 void HbInputSettingProxy::setPredictiveInputStatus(HbKeyboardSettingFlags keyboardType, bool newStatus)
   834 void HbInputSettingProxy::setPredictiveInputStatus(HbKeyboardSettingFlags keyboardType, bool newStatus)
   840 {
   835 {
   841     Q_D(HbInputSettingProxy);
   836     Q_D(HbInputSettingProxy);
   842     HbSettingProxyInternalData* prData = d->proxyData();
   837     HbSettingProxyInternalData *prData = d->proxyData();
   843     if (prData) {
   838     if (prData) {
   844         bool notify = false;
   839         bool notify = false;
   845         d->lock();
   840         d->lock();
   846         
   841 
   847         HbKeyboardSettingFlags newValue = prData->iPredictiveInputState;
   842         HbKeyboardSettingFlags newValue = prData->iPredictiveInputState;
   848         if (newStatus) {
   843         if (newStatus) {
   849             newValue |= keyboardType;
   844             newValue |= keyboardType;
   850         } else {
   845         } else {
   851             newValue &= ~keyboardType;
   846             newValue &= ~keyboardType;
   870 bool HbInputSettingProxy::predictiveInputStatusForActiveKeyboard() const
   865 bool HbInputSettingProxy::predictiveInputStatusForActiveKeyboard() const
   871 {
   866 {
   872     Q_D(const HbInputSettingProxy);
   867     Q_D(const HbInputSettingProxy);
   873     bool res = false;
   868     bool res = false;
   874 
   869 
   875     HbSettingProxyInternalData* prData = d->proxyData();
   870     HbSettingProxyInternalData *prData = d->proxyData();
   876     if (prData) {
   871     if (prData) {
   877         if (activeKeyboard() & HbQwertyKeyboardMask) {
   872         if (activeKeyboard() & HbQwertyKeyboardMask) {
   878             res = prData->iPredictiveInputState & HbKeyboardSettingQwerty;
   873             res = prData->iPredictiveInputState & HbKeyboardSettingQwerty;
   879         } else {
   874         } else {
   880             res = prData->iPredictiveInputState & HbKeyboardSetting12key;
   875             res = prData->iPredictiveInputState & HbKeyboardSetting12key;
   910     if (QString(HB_BUILD_DIR) == QString(HB_INSTALL_DIR)) {
   905     if (QString(HB_BUILD_DIR) == QString(HB_INSTALL_DIR)) {
   911         // This is local build so also use local writable path.
   906         // This is local build so also use local writable path.
   912         return QString(HB_INSTALL_DIR) + QDir::separator() + QString(".hbinputs");
   907         return QString(HB_INSTALL_DIR) + QDir::separator() + QString(".hbinputs");
   913     } else {
   908     } else {
   914 #ifdef Q_OS_UNIX
   909 #ifdef Q_OS_UNIX
   915     return QDir::homePath() + QDir::separator() + QString(".hbinputs");
   910         return QDir::homePath() + QDir::separator() + QString(".hbinputs");
   916 #else
   911 #else
   917     return HBI_BASE_WRITABLE_PATH ;
   912     return HBI_BASE_WRITABLE_PATH ;
   918 #endif
   913 #endif
   919     }
   914     }
   920 #endif
   915 #endif
   946 {
   941 {
   947     QStringList result;
   942     QStringList result;
   948     QFileInfoList list = QDir::drives();
   943     QFileInfoList list = QDir::drives();
   949 
   944 
   950 #ifdef Q_OS_SYMBIAN
   945 #ifdef Q_OS_SYMBIAN
   951     for(int counter = 0; counter < list.count(); counter ++) {
   946     for (int counter = 0; counter < list.count(); counter ++) {
   952         result.append(list.at(counter).absoluteFilePath() + QString("/resource/keymaps"));
   947         result.append(list.at(counter).absoluteFilePath() + QString("/resource/keymaps"));
   953     }
   948     }
   954 #else
   949 #else
   955     result.append(HB_RESOURCES_DIR + (QDir::separator() + QString("keymaps")));
   950     result.append(HB_RESOURCES_DIR + (QDir::separator() + QString("keymaps")));
   956     for(int counter = 0; counter < list.count(); counter ++) {
   951     for (int counter = 0; counter < list.count(); counter ++) {
   957         result.append(list.at(counter).absoluteFilePath() + QString("resource/keymaps"));
   952         result.append(list.at(counter).absoluteFilePath() + QString("resource/keymaps"));
   958     }
   953     }
   959 #endif
   954 #endif
   960     result.sort();
   955     result.sort();
   961     //Append the default resource at the end
   956     //Append the default resource at the end
  1024 HbInputDigitType HbInputSettingProxy::globalDigitType() const
  1019 HbInputDigitType HbInputSettingProxy::globalDigitType() const
  1025 {
  1020 {
  1026     Q_D(const HbInputSettingProxy);
  1021     Q_D(const HbInputSettingProxy);
  1027     HbInputDigitType res = HbDigitTypeLatin;
  1022     HbInputDigitType res = HbDigitTypeLatin;
  1028 
  1023 
  1029     HbSettingProxyInternalData* prData = d->proxyData();
  1024     HbSettingProxyInternalData *prData = d->proxyData();
  1030     if (prData) {
  1025     if (prData) {
  1031         res = prData->iDigitType;
  1026         res = prData->iDigitType;
  1032     }
  1027     }
  1033 
  1028 
  1034     return res;
  1029     return res;
  1040 \sa globalDigitType
  1035 \sa globalDigitType
  1041 */
  1036 */
  1042 void HbInputSettingProxy::setGlobalDigitType(HbInputDigitType digitType)
  1037 void HbInputSettingProxy::setGlobalDigitType(HbInputDigitType digitType)
  1043 {
  1038 {
  1044     Q_D(HbInputSettingProxy);
  1039     Q_D(HbInputSettingProxy);
  1045     HbSettingProxyInternalData* prData = d->proxyData();
  1040     HbSettingProxyInternalData *prData = d->proxyData();
  1046     if (prData) {
  1041     if (prData) {
  1047         d->lock();
  1042         d->lock();
  1048         if (prData->iDigitType != digitType) {
  1043         if (prData->iDigitType != digitType) {
  1049             prData->iDigitType = digitType;
  1044             prData->iDigitType = digitType;
  1050         }
  1045         }
  1060 bool HbInputSettingProxy::automaticTextCasingForQwerty()
  1055 bool HbInputSettingProxy::automaticTextCasingForQwerty()
  1061 {
  1056 {
  1062     Q_D(HbInputSettingProxy);
  1057     Q_D(HbInputSettingProxy);
  1063     bool res = false;
  1058     bool res = false;
  1064 
  1059 
  1065     HbSettingProxyInternalData* prData = d->proxyData();
  1060     HbSettingProxyInternalData *prData = d->proxyData();
  1066     if (prData) {
  1061     if (prData) {
  1067         res = prData->iQwertyTextCasing;
  1062         res = prData->iQwertyTextCasing;
  1068     }
  1063     }
  1069 
  1064 
  1070     return res;
  1065     return res;
  1076 \sa automaticTextCasingForQwerty
  1071 \sa automaticTextCasingForQwerty
  1077 */
  1072 */
  1078 void HbInputSettingProxy::setAutomaticTextCasingForQwerty(bool status)
  1073 void HbInputSettingProxy::setAutomaticTextCasingForQwerty(bool status)
  1079 {
  1074 {
  1080     Q_D(HbInputSettingProxy);
  1075     Q_D(HbInputSettingProxy);
  1081     HbSettingProxyInternalData* prData = d->proxyData();
  1076     HbSettingProxyInternalData *prData = d->proxyData();
  1082     if (prData) {
  1077     if (prData) {
  1083         bool notify = false;
  1078         bool notify = false;
  1084         d->lock();
  1079         d->lock();
  1085         if (prData->iQwertyTextCasing != status) {
  1080         if (prData->iQwertyTextCasing != status) {
  1086             prData->iQwertyTextCasing = status;
  1081             prData->iQwertyTextCasing = status;
  1089         d->unlock();
  1084         d->unlock();
  1090         if (notify) {
  1085         if (notify) {
  1091             emit automaticTextCasingStateForQwertyChanged(status);
  1086             emit automaticTextCasingStateForQwertyChanged(status);
  1092         }
  1087         }
  1093     }
  1088     }
  1094     
  1089 
  1095 }
  1090 }
  1096 
  1091 
  1097 /*!
  1092 /*!
  1098 Enables/Disables character preview in Qwerty keypad. Will emit signal characterPreviewStateForQwertyChanged if status is changed.
  1093 Enables/Disables character preview in Qwerty keypad. Will emit signal characterPreviewStateForQwertyChanged if status is changed.
  1099 
  1094 
  1100 \sa characterPreviewForQwerty
  1095 \sa characterPreviewForQwerty
  1101 */
  1096 */
  1102 void HbInputSettingProxy::setCharacterPreviewForQwerty(bool previewEnabled)
  1097 void HbInputSettingProxy::setCharacterPreviewForQwerty(bool previewEnabled)
  1103 {
  1098 {
  1104     Q_D(HbInputSettingProxy);
  1099     Q_D(HbInputSettingProxy);
  1105     HbSettingProxyInternalData* prData = d->proxyData();
  1100     HbSettingProxyInternalData *prData = d->proxyData();
  1106     if (prData) {
  1101     if (prData) {
  1107         bool notify = false;
  1102         bool notify = false;
  1108         d->lock();
  1103         d->lock();
  1109         if (prData->iQwertyCharacterPreview != previewEnabled) {
  1104         if (prData->iQwertyCharacterPreview != previewEnabled) {
  1110             prData->iQwertyCharacterPreview = previewEnabled;
  1105             prData->iQwertyCharacterPreview = previewEnabled;
  1113         d->unlock();
  1108         d->unlock();
  1114         if (notify) {
  1109         if (notify) {
  1115             emit characterPreviewStateForQwertyChanged(previewEnabled);
  1110             emit characterPreviewStateForQwertyChanged(previewEnabled);
  1116         }
  1111         }
  1117     }
  1112     }
  1118     
  1113 
  1119 }
  1114 }
  1120 
  1115 
  1121 /*!
  1116 /*!
  1122 Returns true if the character preview is enabled in Qwerty keypad.
  1117 Returns true if the character preview is enabled in Qwerty keypad.
  1123 
  1118 
  1127 {
  1122 {
  1128     Q_D(HbInputSettingProxy);
  1123     Q_D(HbInputSettingProxy);
  1129 
  1124 
  1130     bool res = false;
  1125     bool res = false;
  1131 
  1126 
  1132     HbSettingProxyInternalData* prData = d->proxyData();
  1127     HbSettingProxyInternalData *prData = d->proxyData();
  1133     if (prData) {
  1128     if (prData) {
  1134         res = prData->iQwertyCharacterPreview;
  1129         res = prData->iQwertyCharacterPreview;
  1135     }
  1130     }
  1136 
  1131 
  1137     return res;
  1132     return res;
  1138 }
  1133 }
  1139 
  1134 
  1140 /*!
  1135 /*!
       
  1136 \deprecated HbInputSettingProxy::activeCustomInputMethod() const
       
  1137     is deprecated. Use preferredInputMethod instead.
  1141 Returns active custom input method. The pluginNameAndPath field is empty if no custom input methid is active.
  1138 Returns active custom input method. The pluginNameAndPath field is empty if no custom input methid is active.
  1142 
  1139 
  1143 \sa setActiveCustomInputMethod
  1140 \sa setActiveCustomInputMethod
  1144 */
  1141 */
  1145 HbInputMethodDescriptor HbInputSettingProxy::activeCustomInputMethod() const
  1142 HbInputMethodDescriptor HbInputSettingProxy::activeCustomInputMethod() const
  1146 {
  1143 {
  1147     return HbInputMethodDescriptor();
  1144     return HbInputMethodDescriptor();
  1148 }
  1145 }
  1149 
  1146 
  1150 /*!
  1147 /*!
       
  1148 \deprecated HbInputSettingProxy::setActiveCustomInputMethod(const HbInputMethodDescriptor&)
       
  1149     is deprecated. Use setPreferredInputMethod instead.
  1151 \sa activeCustomInputMethod
  1150 \sa activeCustomInputMethod
  1152 */
  1151 */
  1153 void HbInputSettingProxy::setActiveCustomInputMethod(const HbInputMethodDescriptor &inputMethod)
  1152 void HbInputSettingProxy::setActiveCustomInputMethod(const HbInputMethodDescriptor &inputMethod)
  1154 {
  1153 {
  1155     Q_UNUSED(inputMethod)
  1154     Q_UNUSED(inputMethod)
  1156 }
  1155 }
  1157 
  1156 
  1158 /*!
  1157 /*!
  1159 Returns the current screen orientation in settings 
  1158 Returns the current screen orientation in settings
  1160 */
  1159 */
  1161 Qt::Orientation HbInputSettingProxy::screenOrientation()
  1160 Qt::Orientation HbInputSettingProxy::screenOrientation()
  1162 {
  1161 {
  1163     Q_D(HbInputSettingProxy);
  1162     Q_D(HbInputSettingProxy);
  1164 
  1163 
  1165     Qt::Orientation orientation = Qt::Vertical;
  1164     Qt::Orientation orientation = Qt::Vertical;
  1166     HbSettingProxyInternalData* prData = d->proxyData();
  1165     HbSettingProxyInternalData *prData = d->proxyData();
  1167     if (prData) {
  1166     if (prData) {
  1168         orientation = prData->iScreenOrientation;
  1167         orientation = prData->iScreenOrientation;
  1169     }
  1168     }
  1170     return orientation;
  1169     return orientation;
  1171 }
  1170 }
  1172 
  1171 
  1173 /*!
  1172 /*!
  1174 Sets the current screen orientation in settings. This completes orientation change
  1173 Sets the current screen orientation in settings. This completes orientation change
  1175 started with notifyScreenOrientationChange.
  1174 started with notifyScreenOrientationChange. Nothing is done, If
       
  1175  notifyScreenOrientationChange has not been called before calling this.
  1176 */
  1176 */
  1177 void HbInputSettingProxy::setScreenOrientation(Qt::Orientation screenOrientation)
  1177 void HbInputSettingProxy::setScreenOrientation(Qt::Orientation screenOrientation)
  1178 {
  1178 {
  1179     Q_D(HbInputSettingProxy);
  1179     Q_D(HbInputSettingProxy);
  1180 
  1180 
  1181     HbSettingProxyInternalData* prData = d->proxyData();
  1181     HbSettingProxyInternalData *prData = d->proxyData();
  1182     if (prData) {
  1182     if (prData) {
  1183         bool notify = false;
  1183         d->lock();
  1184 
  1184         if (prData->iOrientationChangeCompleted) {
  1185         d->lock();
       
  1186         if (screenOrientation != prData->iScreenOrientation) {
       
  1187             prData->iScreenOrientation = screenOrientation;
       
  1188             notify = true;
       
  1189         }
       
  1190         d->unlock();
       
  1191 
       
  1192         if (notify) {  
       
  1193             // notify everyone that the orientation has changed.
       
  1194             d->handleDeviceSpecificOriantationAndFlipChange();
       
  1195             emit orientationChanged(screenOrientation);
       
  1196             // set orientation change operation completed.
       
  1197             d->lock();
       
  1198             prData->iOrientationChangeCompleted = true;
       
  1199             d->unlock();
  1185             d->unlock();
  1200         }
  1186             return;
       
  1187         }
       
  1188         prData->iScreenOrientation = screenOrientation;
       
  1189         d->unlock();
       
  1190 
       
  1191         // notify everyone that the orientation has changed.
       
  1192         d->handleDeviceSpecificOriantationAndFlipChange();
       
  1193         emit orientationChanged(screenOrientation);
       
  1194 
       
  1195         // set orientation change operation completed.
       
  1196         d->lock();
       
  1197         prData->iOrientationChangeCompleted = true;
       
  1198         d->unlock();
  1201     }
  1199     }
  1202 }
  1200 }
  1203 
  1201 
  1204 /*!
  1202 /*!
  1205 Starts screen orientation change sequence. Emits orientationAboutToChange signal
  1203 Starts screen orientation change sequence. Emits orientationAboutToChange signal
  1211 */
  1209 */
  1212 void HbInputSettingProxy::notifyScreenOrientationChange()
  1210 void HbInputSettingProxy::notifyScreenOrientationChange()
  1213 {
  1211 {
  1214     Q_D(HbInputSettingProxy);
  1212     Q_D(HbInputSettingProxy);
  1215 
  1213 
  1216     HbSettingProxyInternalData* prData = d->proxyData();
  1214     HbSettingProxyInternalData *prData = d->proxyData();
  1217     if (prData) {
  1215     if (prData) {
  1218         d->lock();
  1216         bool notify = false;
  1219         prData->iOrientationChangeCompleted = false;
  1217         d->lock();
  1220         d->unlock();
  1218         if (prData->iOrientationChangeCompleted) {
  1221     }
  1219             prData->iOrientationChangeCompleted = false;
  1222     emit orientationAboutToChange();
  1220             notify = true;
       
  1221         }
       
  1222         d->unlock();
       
  1223         if (notify) {
       
  1224             emit orientationAboutToChange();
       
  1225         }
       
  1226     }
       
  1227     
  1223 }
  1228 }
  1224 
  1229 
  1225 /*!
  1230 /*!
  1226 Returns true if the orientation change is completed
  1231 Returns true if the orientation change is completed
  1227 */
  1232 */
  1228 bool HbInputSettingProxy::orientationChangeCompleted() const
  1233 bool HbInputSettingProxy::orientationChangeCompleted() const
  1229 {
  1234 {
  1230     Q_D(const HbInputSettingProxy);
  1235     Q_D(const HbInputSettingProxy);
  1231 
  1236 
  1232     bool completed = true;
  1237     bool completed = true;
  1233     HbSettingProxyInternalData* prData = d->proxyData();
  1238     HbSettingProxyInternalData *prData = d->proxyData();
  1234     if (prData) {
  1239     if (prData) {
  1235         completed = prData->iOrientationChangeCompleted;
  1240         completed = prData->iOrientationChangeCompleted;
  1236     }
  1241     }
  1237     return completed;
  1242     return completed;
  1238 }
  1243 }
  1244 void HbInputSettingProxy::initializeOrientation(Qt::Orientation screenOrientation)
  1249 void HbInputSettingProxy::initializeOrientation(Qt::Orientation screenOrientation)
  1245 {
  1250 {
  1246     Q_D(HbInputSettingProxy);
  1251     Q_D(HbInputSettingProxy);
  1247 
  1252 
  1248     // call handleDeviceSpecificOriantationAndFlipChange method
  1253     // call handleDeviceSpecificOriantationAndFlipChange method
  1249     HbSettingProxyInternalData* prData = d->proxyData();
  1254     HbSettingProxyInternalData *prData = d->proxyData();
  1250     if (prData) {
  1255     if (prData) {
  1251         d->lock();
  1256         d->lock();
  1252         prData->iScreenOrientation = screenOrientation;
  1257         prData->iScreenOrientation = screenOrientation;
  1253         if (screenOrientation == Qt::Vertical) {
  1258         if (screenOrientation == Qt::Vertical) {
  1254             prData->iActiveKeyboard = HbKeyboardVirtual12Key;
  1259             prData->iActiveKeyboard = HbKeyboardVirtual12Key;
  1258         d->unlock();
  1263         d->unlock();
  1259     }
  1264     }
  1260 }
  1265 }
  1261 
  1266 
  1262 /*!
  1267 /*!
  1263 Returns the status of regional input correction feature. 
  1268 Returns the status of regional input correction feature.
  1264 
  1269 
  1265 \sa enableRegionalCorrection.
  1270 \sa enableRegionalCorrection.
  1266 */
  1271 */
  1267 bool HbInputSettingProxy::regionalCorrectionEnabled()
  1272 bool HbInputSettingProxy::regionalCorrectionEnabled()
  1268 {
  1273 {
  1269     Q_D(const HbInputSettingProxy);
  1274     Q_D(const HbInputSettingProxy);
  1270     bool res = false;
  1275     bool res = false;
  1271     HbSettingProxyInternalData* prData = d->proxyData();
  1276     HbSettingProxyInternalData *prData = d->proxyData();
  1272     if (prData) {
  1277     if (prData) {
  1273         res = prData->iRegionalCorrectionStatus;
  1278         res = prData->iRegionalCorrectionStatus;
  1274     }
  1279     }
  1275     return res;
  1280     return res;
  1276 }
  1281 }
  1281 \sa regionalCorrectionEnabled.
  1286 \sa regionalCorrectionEnabled.
  1282 */
  1287 */
  1283 void HbInputSettingProxy::enableRegionalCorrection(bool newStatus)
  1288 void HbInputSettingProxy::enableRegionalCorrection(bool newStatus)
  1284 {
  1289 {
  1285     Q_D(HbInputSettingProxy);
  1290     Q_D(HbInputSettingProxy);
  1286     HbSettingProxyInternalData* prData = d->proxyData();
  1291     HbSettingProxyInternalData *prData = d->proxyData();
  1287     if (prData) {
  1292     if (prData) {
  1288         bool notify = false;
  1293         bool notify = false;
  1289         d->lock();
  1294         d->lock();
  1290         if (prData->iRegionalCorrectionStatus != newStatus) {
  1295         if (prData->iRegionalCorrectionStatus != newStatus) {
  1291             prData->iRegionalCorrectionStatus = newStatus;
  1296             prData->iRegionalCorrectionStatus = newStatus;
  1304 \sa keypressTimeout.
  1309 \sa keypressTimeout.
  1305 */
  1310 */
  1306 void HbInputSettingProxy::setKeypressTimeout(int timeout)
  1311 void HbInputSettingProxy::setKeypressTimeout(int timeout)
  1307 {
  1312 {
  1308     Q_D(HbInputSettingProxy);
  1313     Q_D(HbInputSettingProxy);
  1309     HbSettingProxyInternalData* prData = d->proxyData();
  1314     HbSettingProxyInternalData *prData = d->proxyData();
  1310     if (prData) {
  1315     if (prData) {
  1311         bool notify = false;
  1316         bool notify = false;
  1312         d->lock();
  1317         d->lock();
  1313         if (prData->iKeypressTimeout != timeout) {
  1318         if (prData->iKeypressTimeout != timeout) {
  1314             prData->iKeypressTimeout = timeout;
  1319             prData->iKeypressTimeout = timeout;
  1320         }
  1325         }
  1321     }
  1326     }
  1322 }
  1327 }
  1323 
  1328 
  1324 /*!
  1329 /*!
  1325 Returns the keypress timeout value. 
  1330 Returns the keypress timeout value.
  1326 
  1331 
  1327 \sa setKeypressTimeout.
  1332 \sa setKeypressTimeout.
  1328 */
  1333 */
  1329 int HbInputSettingProxy::keypressTimeout() const
  1334 int HbInputSettingProxy::keypressTimeout() const
  1330 {
  1335 {
  1331     Q_D(const HbInputSettingProxy);
  1336     Q_D(const HbInputSettingProxy);
  1332     int res = 0;
  1337     int res = 0;
  1333     HbSettingProxyInternalData* prData = d->proxyData();
  1338     HbSettingProxyInternalData *prData = d->proxyData();
  1334     if (prData) {
  1339     if (prData) {
  1335         res = prData->iKeypressTimeout;
  1340         res = prData->iKeypressTimeout;
  1336     }
  1341     }
  1337     return res;
  1342     return res;
  1338 }
  1343 }
  1343 \sa isAutocompletionEnabled.
  1348 \sa isAutocompletionEnabled.
  1344 */
  1349 */
  1345 void HbInputSettingProxy::setAutocompletionStatus(HbKeyboardSettingFlags keyboardType, bool state)
  1350 void HbInputSettingProxy::setAutocompletionStatus(HbKeyboardSettingFlags keyboardType, bool state)
  1346 {
  1351 {
  1347     Q_D(HbInputSettingProxy);
  1352     Q_D(HbInputSettingProxy);
  1348     HbSettingProxyInternalData* prData = d->proxyData();
  1353     HbSettingProxyInternalData *prData = d->proxyData();
  1349     if (prData) {
  1354     if (prData) {
  1350         bool notify = false;
  1355         bool notify = false;
  1351         d->lock();
  1356         d->lock();
  1352         HbKeyboardSettingFlags newValue = prData->iAutocompletion;
  1357         HbKeyboardSettingFlags newValue = prData->iAutocompletion;
  1353         if (state) {
  1358         if (state) {
  1374 */
  1379 */
  1375 bool HbInputSettingProxy::isAutocompletionEnabled(HbKeyboardSettingFlags keyboardType) const
  1380 bool HbInputSettingProxy::isAutocompletionEnabled(HbKeyboardSettingFlags keyboardType) const
  1376 {
  1381 {
  1377     Q_D(const HbInputSettingProxy);
  1382     Q_D(const HbInputSettingProxy);
  1378     bool res = false;
  1383     bool res = false;
  1379     HbSettingProxyInternalData* prData = d->proxyData();
  1384     HbSettingProxyInternalData *prData = d->proxyData();
  1380     if (prData) {
  1385     if (prData) {
  1381         res = prData->iAutocompletion & keyboardType;
  1386         res = prData->iAutocompletion & keyboardType;
  1382     }
  1387     }
  1383     return res;
  1388     return res;
  1384 }
  1389 }
  1389 \sa typingCorrectionLevel.
  1394 \sa typingCorrectionLevel.
  1390 */
  1395 */
  1391 void HbInputSettingProxy::setTypingCorrectionLevel(HbTypingCorrectionLevel level)
  1396 void HbInputSettingProxy::setTypingCorrectionLevel(HbTypingCorrectionLevel level)
  1392 {
  1397 {
  1393     Q_D(HbInputSettingProxy);
  1398     Q_D(HbInputSettingProxy);
  1394     HbSettingProxyInternalData* prData = d->proxyData();
  1399     HbSettingProxyInternalData *prData = d->proxyData();
  1395     if (prData) {
  1400     if (prData) {
  1396         bool notify = false;
  1401         bool notify = false;
  1397         d->lock();
  1402         d->lock();
  1398         if (prData->iTypingCorrectionLevel != level) {
  1403         if (prData->iTypingCorrectionLevel != level) {
  1399             prData->iTypingCorrectionLevel = level;
  1404             prData->iTypingCorrectionLevel = level;
  1414 */
  1419 */
  1415 HbTypingCorrectionLevel HbInputSettingProxy::typingCorrectionLevel() const
  1420 HbTypingCorrectionLevel HbInputSettingProxy::typingCorrectionLevel() const
  1416 {
  1421 {
  1417     Q_D(const HbInputSettingProxy);
  1422     Q_D(const HbInputSettingProxy);
  1418     HbTypingCorrectionLevel res = HbTypingCorrectionLevelHigh;
  1423     HbTypingCorrectionLevel res = HbTypingCorrectionLevelHigh;
  1419     HbSettingProxyInternalData* prData = d->proxyData();
  1424     HbSettingProxyInternalData *prData = d->proxyData();
  1420     if (prData) {
  1425     if (prData) {
  1421         res = prData->iTypingCorrectionLevel;
  1426         res = prData->iTypingCorrectionLevel;
  1422     }
  1427     }
  1423     return res;
  1428     return res;
  1424 }
  1429 }
  1429 \sa primaryCandidateMode.
  1434 \sa primaryCandidateMode.
  1430 */
  1435 */
  1431 void HbInputSettingProxy::setPrimaryCandidateMode(HbPrimaryCandidateMode mode)
  1436 void HbInputSettingProxy::setPrimaryCandidateMode(HbPrimaryCandidateMode mode)
  1432 {
  1437 {
  1433     Q_D(HbInputSettingProxy);
  1438     Q_D(HbInputSettingProxy);
  1434     HbSettingProxyInternalData* prData = d->proxyData();
  1439     HbSettingProxyInternalData *prData = d->proxyData();
  1435     if (prData) {
  1440     if (prData) {
  1436         bool notify = false;
  1441         bool notify = false;
  1437         d->lock();
  1442         d->lock();
  1438         if (prData->iPrimaryCandidateMode != mode) {
  1443         if (prData->iPrimaryCandidateMode != mode) {
  1439             prData->iPrimaryCandidateMode = mode;
  1444             prData->iPrimaryCandidateMode = mode;
  1453 */
  1458 */
  1454 HbPrimaryCandidateMode HbInputSettingProxy::primaryCandidateMode() const
  1459 HbPrimaryCandidateMode HbInputSettingProxy::primaryCandidateMode() const
  1455 {
  1460 {
  1456     Q_D(const HbInputSettingProxy);
  1461     Q_D(const HbInputSettingProxy);
  1457     HbPrimaryCandidateMode res = HbPrimaryCandidateModeExactTyping;
  1462     HbPrimaryCandidateMode res = HbPrimaryCandidateModeExactTyping;
  1458     HbSettingProxyInternalData* prData = d->proxyData();
  1463     HbSettingProxyInternalData *prData = d->proxyData();
  1459     if (prData) {
  1464     if (prData) {
  1460         res = prData->iPrimaryCandidateMode;
  1465         res = prData->iPrimaryCandidateMode;
  1461     }
  1466     }
  1462     return res;
  1467     return res;
  1463 }
  1468 }