29 #include <cdblen.h> |
29 #include <cdblen.h> |
30 #include <es_enum.h> |
30 #include <es_enum.h> |
31 #include <platform/mw/browser_platform_variant.hrh> |
31 #include <platform/mw/browser_platform_variant.hrh> |
32 #ifdef BRDO_OCC_ENABLED_FF |
32 #ifdef BRDO_OCC_ENABLED_FF |
33 #include <extendedconnpref.h> |
33 #include <extendedconnpref.h> |
|
34 #include <FeatMgr.h> |
|
35 #include <CentralRepository.h> |
|
36 #include <CoreApplicationUIsSDKCRKeys.h> |
|
37 #include <cmgenconnsettings.h> |
|
38 #include <cmmanagerkeys.h> |
|
39 #include <etelmm.h> |
|
40 #include <rconnmon.h> |
34 #endif |
41 #endif |
35 |
42 |
36 // ================= MEMBER FUNCTIONS ======================= |
43 // ================= MEMBER FUNCTIONS ======================= |
37 |
44 |
38 // --------------------------------------------------------- |
45 // --------------------------------------------------------- |
113 { |
120 { |
114 CLOG(( EConn, 4, _L("Using Internet Snap") )); |
121 CLOG(( EConn, 4, _L("Using Internet Snap") )); |
115 extPref.SetSnapPurpose(CMManager::ESnapPurposeInternet); |
122 extPref.SetSnapPurpose(CMManager::ESnapPurposeInternet); |
116 } |
123 } |
117 |
124 |
|
125 //Default dialog behaviour |
118 extPref.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourConnSilent); |
126 extPref.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourConnSilent); |
|
127 |
|
128 if ( !IsPhoneOfflineL() ) |
|
129 { |
|
130 TInt currentmode = KErrNone; |
|
131 CRepository* rep = CRepository::NewLC( KCRUidCmManager ); |
|
132 rep->Get(KCurrentCellularDataUsage, currentmode ); |
|
133 CleanupStack::PopAndDestroy(); //rep |
|
134 if(ECmCellularDataUsageConfirm == currentmode) |
|
135 { |
|
136 if ( IsRoamingL() || (aIap == 0) ) |
|
137 { |
|
138 CLOG(( EConn, 4, _L("Setting note behaviour as Default") )); |
|
139 extPref.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourDefault); |
|
140 } |
|
141 } |
|
142 } |
|
143 |
119 TConnPrefList prefList; |
144 TConnPrefList prefList; |
120 prefList.AppendL(&extPref); |
145 prefList.AppendL(&extPref); |
121 iConn.Start( prefList, iStatus ); |
146 iConn.Start( prefList, iStatus ); |
122 #else |
147 #else |
123 iConn.Start( iConnPref, iStatus ); |
148 iConn.Start( iConnPref, iStatus ); |
341 CLOG(( EConn, 2, _L("CConnection::Done iStatus(%d)"), iStatus.Int() )); |
366 CLOG(( EConn, 2, _L("CConnection::Done iStatus(%d)"), iStatus.Int() )); |
342 __ASSERT_DEBUG( iParentStatus, CodPanic( ECodInternal ) ); |
367 __ASSERT_DEBUG( iParentStatus, CodPanic( ECodInternal ) ); |
343 User::RequestComplete( iParentStatus, iStatus.Int() ); |
368 User::RequestComplete( iParentStatus, iStatus.Int() ); |
344 iParentStatus = NULL; |
369 iParentStatus = NULL; |
345 } |
370 } |
|
371 |
|
372 #ifdef BRDO_OCC_ENABLED_FF |
|
373 // --------------------------------------------------------- |
|
374 // CConnection::IsPhoneOfflineL |
|
375 // |
|
376 // Checks if phone is in offline mode or not. |
|
377 // Return ETrue if phone is in offline mode. |
|
378 // Return EFalse if phone is not in offline mode. |
|
379 // --------------------------------------------------------- |
|
380 // |
|
381 TBool CConnection::IsPhoneOfflineL() const |
|
382 { |
|
383 if ( FeatureManager::FeatureSupported( KFeatureIdOfflineMode ) ) |
|
384 { |
|
385 CRepository* repository = CRepository::NewLC( KCRUidCoreApplicationUIs ); |
|
386 TInt connAllowed = 1; |
|
387 repository->Get( KCoreAppUIsNetworkConnectionAllowed, connAllowed ); |
|
388 CleanupStack::PopAndDestroy(); // repository |
|
389 if ( !connAllowed ) |
|
390 { |
|
391 CLOG(( EConn, 2, _L("Yes, Phone is in Offline mode") )); |
|
392 return ETrue; |
|
393 } |
|
394 } |
|
395 |
|
396 CLOG(( EConn, 2, _L("Phone is in Online mode") )); |
|
397 return EFalse; |
|
398 } |
|
399 |
|
400 // --------------------------------------------------------- |
|
401 // CConnection::IsRoamingL |
|
402 // |
|
403 // Checks if phone is in home network or in roam network. |
|
404 // Return ETrue if phone is in foriegn network. |
|
405 // Return EFalse if phone is in home network. |
|
406 // --------------------------------------------------------- |
|
407 // |
|
408 TBool CConnection::IsRoamingL() |
|
409 { |
|
410 RTelServer telServer; |
|
411 User::LeaveIfError( telServer.Connect()); |
|
412 |
|
413 RTelServer::TPhoneInfo teleinfo; |
|
414 User::LeaveIfError( telServer.GetPhoneInfo( 0, teleinfo ) ); |
|
415 |
|
416 RMobilePhone phone; |
|
417 User::LeaveIfError( phone.Open( telServer, teleinfo.iName ) ); |
|
418 User::LeaveIfError(phone.Initialise()); |
|
419 |
|
420 RMobilePhone::TMobilePhoneNetworkMode mode; |
|
421 TInt err = phone.GetCurrentMode( mode ); |
|
422 phone.Close(); |
|
423 telServer.Close(); |
|
424 TInt Bearer = EBearerIdGSM ; |
|
425 if( KErrNone == err ) |
|
426 { |
|
427 switch(mode) |
|
428 { |
|
429 case RMobilePhone::ENetworkModeGsm: |
|
430 { |
|
431 Bearer = EBearerIdGSM ; |
|
432 break; |
|
433 } |
|
434 case RMobilePhone::ENetworkModeWcdma: |
|
435 { |
|
436 Bearer = EBearerIdWCDMA ; |
|
437 break; |
|
438 } |
|
439 default: |
|
440 { |
|
441 |
|
442 } |
|
443 } |
|
444 } |
|
445 RConnectionMonitor monitor; |
|
446 TRequestStatus status; |
|
447 // open RConnectionMonitor object |
|
448 monitor.ConnectL(); |
|
449 CleanupClosePushL( monitor ); |
|
450 TInt netwStatus ; |
|
451 monitor.GetIntAttribute( Bearer, 0, KNetworkRegistration, netwStatus, status ); |
|
452 User::WaitForRequest( status ); |
|
453 CleanupStack::PopAndDestroy(); // Destroying monitor |
|
454 if ( status.Int() == KErrNone && netwStatus == ENetworkRegistrationRoaming ) |
|
455 { |
|
456 CLOG(( EConn, 2, _L("Yes, Phone is in Forign network") )); |
|
457 return ETrue; |
|
458 } |
|
459 else //home n/w or some other state in n/w |
|
460 { |
|
461 CLOG(( EConn, 2, _L("Phone is in Home network") )); |
|
462 return EFalse; |
|
463 } |
|
464 } |
|
465 #endif |