browserutilities/downloadmgr/DownloadMgrServEng/Src/HttpConnHandler.cpp
branchRCL_3
changeset 58 220a17280356
parent 42 d39add9822e2
child 62 c711bdda59f4
equal deleted inserted replaced
46:ea4b2e4f7cac 58:220a17280356
    33 //#include <deflatefilterinterface.h>
    33 //#include <deflatefilterinterface.h>
    34 #include <cookiefilterinterface.h>
    34 #include <cookiefilterinterface.h>
    35 #include <platform/mw/browser_platform_variant.hrh>
    35 #include <platform/mw/browser_platform_variant.hrh>
    36 #ifdef BRDO_OCC_ENABLED_FF
    36 #ifdef BRDO_OCC_ENABLED_FF
    37 #include <extendedconnpref.h>
    37 #include <extendedconnpref.h>
       
    38 #include <FeatMgr.h>
       
    39 #include <CentralRepository.h>
       
    40 #include <CoreApplicationUIsSDKCRKeys.h>
       
    41 #include <cmgenconnsettings.h>
       
    42 #include <cmmanagerkeys.h>
       
    43 #include <etelmm.h>
       
    44 #include <rconnmon.h>
    38 #endif
    45 #endif
    39 
    46 
    40 // EXTERNAL DATA STRUCTURES
    47 // EXTERNAL DATA STRUCTURES
    41 //extern  ?external_data;
    48 //extern  ?external_data;
    42 
    49 
   355             CLOG_WRITE_1("ConnName set: [%S]", iConnName);
   362             CLOG_WRITE_1("ConnName set: [%S]", iConnName);
   356             
   363             
   357             TName connName;
   364             TName connName;
   358 
   365 
   359             connName.Copy( *iConnName );
   366             connName.Copy( *iConnName );
   360 
       
   361             User::LeaveIfError( iConnection.Open( iClientApp->Engine()->SocketServ(), connName ) );
   367             User::LeaveIfError( iConnection.Open( iClientApp->Engine()->SocketServ(), connName ) );
   362 
   368 
   363             CLOG_WRITE( "connection open" );
   369             CLOG_WRITE( "connection open" );
   364             
   370             
   365             TNifProgress progress;
   371             TNifProgress progress;
   398            else
   404            else
   399            {
   405            {
   400               CLOG_WRITE( "Using Internet Snap");
   406               CLOG_WRITE( "Using Internet Snap");
   401               extPref.SetSnapPurpose(CMManager::ESnapPurposeInternet);
   407               extPref.SetSnapPurpose(CMManager::ESnapPurposeInternet);
   402            }
   408            }
   403 
   409            //Default dialog behaviour
   404            extPref.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourConnSilent);
   410            extPref.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourConnSilent);
       
   411            
       
   412            if ( !IsPhoneOfflineL() )
       
   413            {
       
   414               TInt currentmode = KErrNone;
       
   415               CRepository* rep = CRepository::NewLC( KCRUidCmManager );
       
   416               rep->Get(KCurrentCellularDataUsage, currentmode );
       
   417               CleanupStack::PopAndDestroy(); //rep
       
   418               if(ECmCellularDataUsageConfirm == currentmode)
       
   419               {
       
   420                  if ( IsRoamingL() || (iIapId == 0) )
       
   421                  {
       
   422                     CLOG_WRITE( "Setting note behaviour as Default");
       
   423                     extPref.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourDefault);
       
   424                  }
       
   425               }
       
   426            }
       
   427            
   405            TConnPrefList prefList;
   428            TConnPrefList prefList;
   406            prefList.AppendL(&extPref);
   429            prefList.AppendL(&extPref);
   407            iConnection.Start( prefList, iStatus );
   430            iConnection.Start( prefList, iStatus );
   408         #else
   431         #else
   409             iConnection.Start( iPref, iStatus );
   432             iConnection.Start( iPref, iStatus );
   992         query.Format( _L("%s\\%s"), IAP, COMMDB_ID );
  1015         query.Format( _L("%s\\%s"), IAP, COMMDB_ID );
   993         iConnection.GetIntSetting( query, iIapId );
  1016         iConnection.GetIntSetting( query, iIapId );
   994         }
  1017         }
   995     }
  1018     }
   996 
  1019 
       
  1020 #ifdef BRDO_OCC_ENABLED_FF
       
  1021 // ---------------------------------------------------------
       
  1022 // CHttpConnHandler::IsPhoneOfflineL
       
  1023 //
       
  1024 // Checks if phone is in offline mode or not.
       
  1025 // Return ETrue if phone is in offline mode.
       
  1026 // Return EFalse if phone is not in offline mode.
       
  1027 // ---------------------------------------------------------
       
  1028 //
       
  1029 TBool CHttpConnHandler::IsPhoneOfflineL() const
       
  1030      {
       
  1031      LOGGER_ENTERFN( "CHttpConnHandler::IsPhoneOfflineL" );
       
  1032      if ( FeatureManager::FeatureSupported( KFeatureIdOfflineMode ) )
       
  1033          {
       
  1034          CRepository* repository = CRepository::NewLC( KCRUidCoreApplicationUIs );
       
  1035          TInt connAllowed = 1;
       
  1036          repository->Get( KCoreAppUIsNetworkConnectionAllowed, connAllowed );
       
  1037          CleanupStack::PopAndDestroy();  // repository
       
  1038          if ( !connAllowed )
       
  1039              {
       
  1040              CLOG_WRITE( "Yes, Phone is in Offline mode" );
       
  1041              return ETrue;
       
  1042              }
       
  1043          }
       
  1044      CLOG_WRITE( "Phone is in Online mode" );
       
  1045      return EFalse;
       
  1046      }
       
  1047 
       
  1048 // ---------------------------------------------------------
       
  1049 // CHttpConnHandler::IsRoamingL
       
  1050 //
       
  1051 // Checks if phone is in home network or in roam network.
       
  1052 // Return ETrue if phone is in foriegn network.
       
  1053 // Return EFalse if phone is in home network.
       
  1054 // ---------------------------------------------------------
       
  1055 //
       
  1056 TBool CHttpConnHandler::IsRoamingL()
       
  1057     {
       
  1058         LOGGER_ENTERFN( "CHttpConnHandler::IsRoamingL" );
       
  1059         RTelServer telServer;
       
  1060         User::LeaveIfError( telServer.Connect());
       
  1061         
       
  1062         RTelServer::TPhoneInfo teleinfo;
       
  1063         User::LeaveIfError( telServer.GetPhoneInfo( 0, teleinfo ) );
       
  1064         
       
  1065         RMobilePhone phone;
       
  1066         User::LeaveIfError( phone.Open( telServer, teleinfo.iName ) );
       
  1067         User::LeaveIfError(phone.Initialise()); 
       
  1068         
       
  1069         RMobilePhone::TMobilePhoneNetworkMode mode;                     
       
  1070         TInt err = phone.GetCurrentMode( mode );
       
  1071         phone.Close();
       
  1072         telServer.Close();
       
  1073         TInt Bearer = EBearerIdGSM ;
       
  1074         if( KErrNone == err )
       
  1075         {
       
  1076            switch(mode)
       
  1077            {
       
  1078                 case RMobilePhone::ENetworkModeGsm:     
       
  1079                 {           
       
  1080                 Bearer = EBearerIdGSM ;
       
  1081                     break;      
       
  1082                 }
       
  1083                 case RMobilePhone::ENetworkModeWcdma:
       
  1084                 {                                   
       
  1085                     Bearer = EBearerIdWCDMA  ;
       
  1086                     break;  
       
  1087                 }   
       
  1088                 default: 
       
  1089                 {                   
       
  1090                 
       
  1091                 }                       
       
  1092             }
       
  1093         }   
       
  1094         RConnectionMonitor monitor;
       
  1095         TRequestStatus status;
       
  1096         // open RConnectionMonitor object
       
  1097         monitor.ConnectL();
       
  1098         CleanupClosePushL( monitor );
       
  1099         TInt netwStatus ;
       
  1100         monitor.GetIntAttribute( Bearer, 0, KNetworkRegistration, netwStatus, status );
       
  1101         User::WaitForRequest( status );
       
  1102         CleanupStack::PopAndDestroy(); // Destroying monitor
       
  1103         if ( status.Int() == KErrNone && netwStatus == ENetworkRegistrationRoaming )
       
  1104         {
       
  1105             CLOG_WRITE( "Yes, Phone is in Forign network" );
       
  1106             return ETrue;
       
  1107         }
       
  1108         else //home n/w or some other state in n/w
       
  1109         {
       
  1110             CLOG_WRITE( "Phone is in Home network" );
       
  1111             return EFalse;
       
  1112         }
       
  1113    }
       
  1114 #endif
       
  1115 
   997 //  End of File  
  1116 //  End of File