diff -r ea4b2e4f7cac -r 220a17280356 browserutilities/downloadmgr/DownloadMgrServEng/Src/HttpConnHandler.cpp --- a/browserutilities/downloadmgr/DownloadMgrServEng/Src/HttpConnHandler.cpp Fri Feb 19 23:55:03 2010 +0200 +++ b/browserutilities/downloadmgr/DownloadMgrServEng/Src/HttpConnHandler.cpp Fri Mar 12 15:48:51 2010 +0200 @@ -35,6 +35,13 @@ #include #ifdef BRDO_OCC_ENABLED_FF #include +#include +#include +#include +#include +#include +#include +#include #endif // EXTERNAL DATA STRUCTURES @@ -357,7 +364,6 @@ TName connName; connName.Copy( *iConnName ); - User::LeaveIfError( iConnection.Open( iClientApp->Engine()->SocketServ(), connName ) ); CLOG_WRITE( "connection open" ); @@ -400,8 +406,25 @@ CLOG_WRITE( "Using Internet Snap"); extPref.SetSnapPurpose(CMManager::ESnapPurposeInternet); } - + //Default dialog behaviour extPref.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourConnSilent); + + if ( !IsPhoneOfflineL() ) + { + TInt currentmode = KErrNone; + CRepository* rep = CRepository::NewLC( KCRUidCmManager ); + rep->Get(KCurrentCellularDataUsage, currentmode ); + CleanupStack::PopAndDestroy(); //rep + if(ECmCellularDataUsageConfirm == currentmode) + { + if ( IsRoamingL() || (iIapId == 0) ) + { + CLOG_WRITE( "Setting note behaviour as Default"); + extPref.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourDefault); + } + } + } + TConnPrefList prefList; prefList.AppendL(&extPref); iConnection.Start( prefList, iStatus ); @@ -994,4 +1017,100 @@ } } +#ifdef BRDO_OCC_ENABLED_FF +// --------------------------------------------------------- +// CHttpConnHandler::IsPhoneOfflineL +// +// Checks if phone is in offline mode or not. +// Return ETrue if phone is in offline mode. +// Return EFalse if phone is not in offline mode. +// --------------------------------------------------------- +// +TBool CHttpConnHandler::IsPhoneOfflineL() const + { + LOGGER_ENTERFN( "CHttpConnHandler::IsPhoneOfflineL" ); + if ( FeatureManager::FeatureSupported( KFeatureIdOfflineMode ) ) + { + CRepository* repository = CRepository::NewLC( KCRUidCoreApplicationUIs ); + TInt connAllowed = 1; + repository->Get( KCoreAppUIsNetworkConnectionAllowed, connAllowed ); + CleanupStack::PopAndDestroy(); // repository + if ( !connAllowed ) + { + CLOG_WRITE( "Yes, Phone is in Offline mode" ); + return ETrue; + } + } + CLOG_WRITE( "Phone is in Online mode" ); + return EFalse; + } + +// --------------------------------------------------------- +// CHttpConnHandler::IsRoamingL +// +// Checks if phone is in home network or in roam network. +// Return ETrue if phone is in foriegn network. +// Return EFalse if phone is in home network. +// --------------------------------------------------------- +// +TBool CHttpConnHandler::IsRoamingL() + { + LOGGER_ENTERFN( "CHttpConnHandler::IsRoamingL" ); + RTelServer telServer; + User::LeaveIfError( telServer.Connect()); + + RTelServer::TPhoneInfo teleinfo; + User::LeaveIfError( telServer.GetPhoneInfo( 0, teleinfo ) ); + + RMobilePhone phone; + User::LeaveIfError( phone.Open( telServer, teleinfo.iName ) ); + User::LeaveIfError(phone.Initialise()); + + RMobilePhone::TMobilePhoneNetworkMode mode; + TInt err = phone.GetCurrentMode( mode ); + phone.Close(); + telServer.Close(); + TInt Bearer = EBearerIdGSM ; + if( KErrNone == err ) + { + switch(mode) + { + case RMobilePhone::ENetworkModeGsm: + { + Bearer = EBearerIdGSM ; + break; + } + case RMobilePhone::ENetworkModeWcdma: + { + Bearer = EBearerIdWCDMA ; + break; + } + default: + { + + } + } + } + RConnectionMonitor monitor; + TRequestStatus status; + // open RConnectionMonitor object + monitor.ConnectL(); + CleanupClosePushL( monitor ); + TInt netwStatus ; + monitor.GetIntAttribute( Bearer, 0, KNetworkRegistration, netwStatus, status ); + User::WaitForRequest( status ); + CleanupStack::PopAndDestroy(); // Destroying monitor + if ( status.Int() == KErrNone && netwStatus == ENetworkRegistrationRoaming ) + { + CLOG_WRITE( "Yes, Phone is in Forign network" ); + return ETrue; + } + else //home n/w or some other state in n/w + { + CLOG_WRITE( "Phone is in Home network" ); + return EFalse; + } + } +#endif + // End of File