phoneengine/networkhandlingstarter/src/cnetworklistener.cpp
changeset 65 2a5d4ab426d3
parent 60 1eef62f5c541
equal deleted inserted replaced
60:1eef62f5c541 65:2a5d4ab426d3
    19 #include <BTSapDomainPSKeys.h>
    19 #include <BTSapDomainPSKeys.h>
    20 #include <startupdomainpskeys.h>
    20 #include <startupdomainpskeys.h>
    21 #include <PsetContainer.h>
    21 #include <PsetContainer.h>
    22 #include <PsetNetwork.h>
    22 #include <PsetNetwork.h>
    23 #include <PsetSAObserver.h>
    23 #include <PsetSAObserver.h>
       
    24 #include <centralrepository.h>
       
    25 #include <CoreApplicationUIsSDKCRKeys.h>
    24 
    26 
    25 #include "cnetworklistener.h"
    27 #include "cnetworklistener.h"
    26 #include "mnetworklistenerobserver.h"
    28 #include "mnetworklistenerobserver.h"
    27 #include "networkhandlingstarterlogging.h"
    29 #include "networkhandlingstarterlogging.h"
    28 
    30 
   194     if (iInfo.iSelectionSetting == ENWNetworkSelectionManual) {
   196     if (iInfo.iSelectionSetting == ENWNetworkSelectionManual) {
   195         // See if we were registered before
   197         // See if we were registered before
   196         if (iRegistered) {
   198         if (iRegistered) {
   197             iRegistered = EFalse;
   199             iRegistered = EFalse;
   198 
   200 
   199             if (!IsOffLineMode() &&
   201             if (IsNetworkConnectionAllowed() &&
   200                 !IsBluetoothSAPConnected() &&
   202                 !IsBluetoothSAPConnected() &&
   201                 IsSimOk()) {
   203                 IsSimOk()) {
   202                 // Start 60 second timer and when expired show the
   204                 // Start 60 second timer and when expired show the
   203                 // notifier
   205                 // notifier
   204                 iTimer->Cancel();
   206                 iTimer->Cancel();
   211     
   213     
   212     DPRINT << ": OUT";
   214     DPRINT << ": OUT";
   213 }
   215 }
   214 
   216 
   215 /*!
   217 /*!
   216     CNetworkListener::IsOffLineMode
   218     CNetworkListener::IsNetworkConnectionAllowed
   217  */
   219  */
   218 TBool CNetworkListener::IsOffLineMode() const
   220 TBool CNetworkListener::IsNetworkConnectionAllowed() const
   219 {
   221 {
   220     DPRINT << ": IN";
   222     DPRINT << ": IN";
   221     
   223     // Key indicates whether network connections are allowed.
   222     TInt result = KErrNone;
   224     // E.g. is Offline Mode active or not.
   223     TBool isOffLineMode = EFalse;
   225     TInt nwConnectionAllowed( ECoreAppUIsNetworkConnectionAllowed );
   224     QT_TRYCATCH_ERROR(result, isOffLineMode =
   226     CRepository* repository = CRepository::NewL( KCRUidCoreApplicationUIs );
   225         QSystemDeviceInfo::OfflineProfile == iDeviceInfo->currentProfile())
   227     repository->Get(KCoreAppUIsNetworkConnectionAllowed,nwConnectionAllowed);
   226     
   228     delete repository;
   227     DPRINT << ": OUT, result: " << result;
   229     repository = NULL;
   228     return (isOffLineMode && (KErrNone == result));
   230 
   229     }
   231     DPRINT << ": OUT, nwConnectionAllowed: " << nwConnectionAllowed;
   230     
   232     return nwConnectionAllowed == ECoreAppUIsNetworkConnectionAllowed;
       
   233 }
       
   234 
   231 /*!
   235 /*!
   232     CNetworkListener::IsBluetoothSAPConnected
   236     CNetworkListener::IsBluetoothSAPConnected
   233  */
   237  */
   234 TBool CNetworkListener::IsBluetoothSAPConnected() const
   238 TBool CNetworkListener::IsBluetoothSAPConnected() const
   235 {
   239 {