src/hbcore/inputfw/hbinputsettingproxy.cpp
changeset 28 b7da29130b0e
parent 23 e6ad4ef83b23
child 30 80e4d18b72f5
equal deleted inserted replaced
23:e6ad4ef83b23 28:b7da29130b0e
   175             return;
   175             return;
   176         }
   176         }
   177 
   177 
   178         initializeDataArea();
   178         initializeDataArea();
   179     }
   179     }
   180 
   180 #ifdef Q_OS_UNIX
   181     lock();
   181 #ifndef Q_OS_SYMBIAN
   182 
   182     else if (proxyData()->iVersion != HbProxyDataRequiredVersion) {
   183     HbSettingProxyInternalData *prData = proxyData();
   183         // In unix systems, the shared memory may be left dangling with an outdated version
   184     if (prData) {
   184         // In that case, update all the values with defaults to make sure 
   185         ++prData->iReferences;
   185         initializeDataArea();
   186     }
   186     }
   187 
   187 #endif // Q_OS_SYMBIAN
   188     unlock();
   188 #endif // Q_OS_UNIX
   189 
   189 
   190     // This is needed because qApp doesn't not exist anymore when singleton destructs.
   190     // This is needed because qApp doesn't not exist anymore when singleton destructs.
   191     iSaveFile = dataFileNameAndPath();
   191     iSaveFile = dataFileNameAndPath();
   192 }
   192 }
   193 
   193 
   197 }
   197 }
   198 
   198 
   199 void HbInputSettingProxyPrivate::shutdownDataArea()
   199 void HbInputSettingProxyPrivate::shutdownDataArea()
   200 {
   200 {
   201     lock();
   201     lock();
   202     HbSettingProxyInternalData *prData = proxyData();
   202     save();
   203     if (prData) {
       
   204         prData->iReferences--;
       
   205         if (prData->iReferences <= 0) {
       
   206             save();
       
   207         }
       
   208     }
       
   209     unlock();
   203     unlock();
   210 }
   204 }
   211 
   205 
   212 QString HbInputSettingProxyPrivate::dataFilePath()
   206 QString HbInputSettingProxyPrivate::dataFilePath()
   213 {
   207 {
   224     lock();
   218     lock();
   225     bool wasLoaded = load();
   219     bool wasLoaded = load();
   226 
   220 
   227     HbSettingProxyInternalData *prData = proxyData();
   221     HbSettingProxyInternalData *prData = proxyData();
   228     if (prData) {
   222     if (prData) {
   229         prData->iReferences = 0;
       
   230 
       
   231         if (!wasLoaded) {
   223         if (!wasLoaded) {
   232             // There was no permanent storage version, so initialize to defaults.
   224             // There was no permanent storage version, so initialize to defaults.
   233             prData->iVersion = HbProxyDataRequiredVersion;
   225             prData->iVersion = HbProxyDataRequiredVersion;
   234             prData->iGlobalPrimaryInputLanguage = HbInputLanguage(QLocale::English, QLocale::UnitedKingdom);
   226             prData->iGlobalPrimaryInputLanguage = HbInputLanguage(QLocale::English, QLocale::UnitedKingdom);
   235             prData->iGlobalSecondaryInputLanguage = QLocale::Language(0);                  
   227             prData->iGlobalSecondaryInputLanguage = QLocale::Language(0);