screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrindicatorwidget/src/snsrindicatormodel.cpp
changeset 85 35368b604b28
parent 77 4b195f3bea29
equal deleted inserted replaced
77:4b195f3bea29 85:35368b604b28
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 #include <xqsettingsmanager.h>
    18 #include <xqsettingsmanager.h>
    19 #include <xqsettingskey.h>
    19 #include <xqsettingskey.h>
    20 #include <settingsinternalcrkeys.h>
    20 #include <coreapplicationuissdkcrkeys.h>
    21 
    21 //#include <settingsinternalcrkeys.h> //TODO? these don't work in wk30..
    22 
    22 
    23 #include "snsrindicatormodel.h"
    23 #include "snsrindicatormodel.h"
    24 #include "snsrindicatorinfo.h"
    24 #include "snsrindicatorinfo.h"
    25 
    25 
    26 /*!
    26 /*!
   176  */
   176  */
   177 void SnsrIndicatorModel::offlineValueChanged( const XQSettingsKey &key, const QVariant &value )
   177 void SnsrIndicatorModel::offlineValueChanged( const XQSettingsKey &key, const QVariant &value )
   178 {
   178 {
   179     bool previousState(mOfflineStateOn);
   179     bool previousState(mOfflineStateOn);
   180     switch ( key.key() ) {
   180     switch ( key.key() ) {
   181         case KSettingsAirplaneMode:
   181         case KCoreAppUIsNetworkConnectionAllowed:
   182              if( value.toInt() == 1)
   182              if(value.toInt() == ECoreAppUIsNetworkConnectionNotAllowed &&
       
   183                 value.isValid())
   183                  {
   184                  {
   184                  mOfflineStateOn = true;                     
   185                  mOfflineStateOn = true;                     
   185                  }
   186                  }
   186              else
   187              else
   187                  {
   188                  {
   405     
   406     
   406     mSettingsManager = new XQSettingsManager(this);
   407     mSettingsManager = new XQSettingsManager(this);
   407     //connect to offlineValueChanged slot so we get information if the value is changed while screensaver is on
   408     //connect to offlineValueChanged slot so we get information if the value is changed while screensaver is on
   408     connect(mSettingsManager, SIGNAL(valueChanged(XQSettingsKey, QVariant)),
   409     connect(mSettingsManager, SIGNAL(valueChanged(XQSettingsKey, QVariant)),
   409             this, SLOT(offlineValueChanged( const XQSettingsKey, const QVariant)));
   410             this, SLOT(offlineValueChanged( const XQSettingsKey, const QVariant)));
   410     mOfflineKey = new XQSettingsKey(XQSettingsKey::TargetCentralRepository, KCRUidCommunicationSettings.iUid, KSettingsAirplaneMode);
   411     mOfflineKey = new XQSettingsKey(XQSettingsKey::TargetCentralRepository, 
   411     if(mSettingsManager->readItemValue(*mOfflineKey).toInt() == 1)
   412                                     KCRUidCoreApplicationUIs.iUid, 
       
   413                                     KCoreAppUIsNetworkConnectionAllowed);
       
   414     if(mSettingsManager->readItemValue(*mOfflineKey).toInt() == ECoreAppUIsNetworkConnectionNotAllowed)
   412         {
   415         {
   413         mOfflineStateOn = true;
   416         mOfflineStateOn = true;
   414         } 
   417         } 
   415     mSettingsManager->startMonitoring(*mOfflineKey);
   418     mSettingsManager->startMonitoring(*mOfflineKey);
   416 }
   419 }
   418 /*!
   421 /*!
   419     Get current offline status.
   422     Get current offline status.
   420  */
   423  */
   421 void SnsrIndicatorModel::getCurrentOfflineState()
   424 void SnsrIndicatorModel::getCurrentOfflineState()
   422 {
   425 {
   423     if(mSettingsManager->readItemValue(*mOfflineKey).toInt() == 1) {
   426     if(mSettingsManager->readItemValue(*mOfflineKey).toInt() == ECoreAppUIsNetworkConnectionNotAllowed) {
   424         mOfflineStateOn = true;
   427         mOfflineStateOn = true;
   425     }
   428     }
   426     else {
   429     else {
   427        mOfflineStateOn = false;
   430        mOfflineStateOn = false;
   428     }
   431     }