idlehomescreen/xmluicontroller/src/onlineofflinehelper.cpp
branchRCL_3
changeset 30 b8fae6b8a148
parent 9 f966699dea19
child 59 d721605b30d0
equal deleted inserted replaced
16:9674c1a575e9 30:b8fae6b8a148
   164 // COnlineOfflineHelper::ShowOnlineItem
   164 // COnlineOfflineHelper::ShowOnlineItem
   165 // ----------------------------------------------------------------------------
   165 // ----------------------------------------------------------------------------
   166 //
   166 //
   167 TBool COnlineOfflineHelper::ShowOnlineItem() const
   167 TBool COnlineOfflineHelper::ShowOnlineItem() const
   168     {    
   168     {    
   169     if ( iUiCtl.FwStateHandler()->OnlineStateInUse() )
   169     TInt value ( KErrNotFound );
   170     	{
   170     if ( iUiCtl.SettingsRepository().Get(  KAIWebStatus, value ) == KErrNone )
   171     	TInt value ( KErrNotFound );
   171         {
   172     	if ( iUiCtl.SettingsRepository().Get(  KAIWebStatus, value ) == KErrNone )
   172         return ( !value );
   173     		{
   173         }
   174     		return ( !value );
       
   175     		}
       
   176     	}
       
   177     return EFalse;
   174     return EFalse;
   178     }
   175     }
   179 
   176 
   180 // ----------------------------------------------------------------------------
   177 // ----------------------------------------------------------------------------
   181 // COnlineOfflineHelper::ShowOfflineItem
   178 // COnlineOfflineHelper::ShowOfflineItem
   182 // ----------------------------------------------------------------------------
   179 // ----------------------------------------------------------------------------
   183 //
   180 //
   184 TBool COnlineOfflineHelper::ShowOfflineItem() const
   181 TBool COnlineOfflineHelper::ShowOfflineItem() const
   185     {
   182     {
   186     if ( iUiCtl.FwStateHandler()->OnlineStateInUse() )
   183     TInt value ( KErrNotFound );
   187 		{
   184     if ( iUiCtl.SettingsRepository().Get(  KAIWebStatus, value ) == KErrNone )
   188 		TInt value ( KErrNotFound );
   185         {
   189 		if ( iUiCtl.SettingsRepository().Get(  KAIWebStatus, value ) == KErrNone )
   186         return ( value );
   190 			{
   187         }
   191 			return ( value );
       
   192 			}
       
   193 		}
       
   194      return EFalse;
   188      return EFalse;
   195     }
   189     }
   196 
   190 
   197 // ----------------------------------------------------------------------------
   191 // ----------------------------------------------------------------------------
   198 // COnlineOfflineHelper::ProcessOnlineStateL
   192 // COnlineOfflineHelper::ProcessOnlineStateL
   199 // ----------------------------------------------------------------------------
   193 // ----------------------------------------------------------------------------
   200 //
   194 //
   201 void COnlineOfflineHelper::ProcessOnlineStateL( TBool aOnline )
   195 void COnlineOfflineHelper::ProcessOnlineStateL( TBool aOnline )
   202     {
   196     {
   203     // User has selected online/offline item from menu
   197     // User has selected online/offline item from menu
   204     if( iUiCtl.FwStateHandler()->OnlineStateInUse() )
   198     // Don't show R_YES_NO_HS_ONLINE query as user selected online
   205     	{
   199     if ( aOnline )
   206     	// Don't show R_YES_NO_HS_ONLINE query as user selected online
   200         {
   207     	if ( aOnline )
   201         iFlags.Set( EOnline );
   208     	    {
   202         if ( iCurrentNwStatus == ENWRegisteredRoaming )
   209 			iFlags.Set( EOnline );
   203             {
   210 			}
   204             // When user allready is in foreing network and sets
   211     	else
   205             // HS online we want to disable automatic offline setting and not
   212     	    {
   206             // show note QTN_HS_AUTOMATIC_OFFLINE
   213     		iFlags.Clear( EOnline );
   207             iFlags.Set( ERoamingShown );
   214     		}
   208             }
   215     	 
   209         }
   216     	SetOnline( aOnline );
   210     else
   217     	}
   211         {
       
   212         iFlags.Clear( EOnline );
       
   213         }
       
   214      
       
   215     SetOnline( aOnline );
   218     }
   216     }
   219 
   217 
   220 // ----------------------------------------------------------------------------
   218 // ----------------------------------------------------------------------------
   221 // COnlineOfflineHelper::SetOnline
   219 // COnlineOfflineHelper::SetOnline
   222 // ----------------------------------------------------------------------------
   220 // ----------------------------------------------------------------------------
   262                     _LOG1( _L(" Roaming Network Activated "));
   260                     _LOG1( _L(" Roaming Network Activated "));
   263                     iCurrentNwStatus = aNWInfo.iRegistrationStatus;
   261                     iCurrentNwStatus = aNWInfo.iRegistrationStatus;
   264                     CurrentNetworkSetting();
   262                     CurrentNetworkSetting();
   265                     if( ( iRoamingNetwork == ECmCellularDataUsageConfirm
   263                     if( ( iRoamingNetwork == ECmCellularDataUsageConfirm
   266                           || iRoamingNetwork == ECmCellularDataUsageDisabled )
   264                           || iRoamingNetwork == ECmCellularDataUsageDisabled )
   267                             && iFlags.IsSet( EOnline ) )
   265                           && iFlags.IsSet( EOnline )
       
   266                           && iFlags.IsClear( ERoamingShown ) )
   268                         {
   267                         {
   269                         // Process to offline state. 
   268                         // Process to offline state. 
   270                         // Don't change the user selection.
   269                         // Don't change the user selection.
   271                         SetOnline( EFalse );
   270                         SetOnline( EFalse );
   272                         // Show roaming notification
   271                         // Show roaming notification
   273 						CAknGlobalNote* note = CAknGlobalNote::NewLC();
   272 						CAknGlobalNote* note = CAknGlobalNote::NewLC();
   274 						HBufC* msg( StringLoader::LoadLC( R_QTN_HS_AUTOMATIC_OFFLINE ) );
   273 						HBufC* msg( StringLoader::LoadLC( 
       
   274 						        R_QTN_HS_AUTOMATIC_OFFLINE ) );
   275 						note->SetSoftkeys(R_AVKON_SOFTKEYS_OK_EMPTY); 
   275 						note->SetSoftkeys(R_AVKON_SOFTKEYS_OK_EMPTY); 
   276 						note->ShowNoteL( EAknGlobalInformationNote, *msg );
   276 						note->ShowNoteL( EAknGlobalInformationNote, *msg );
   277 						CleanupStack::PopAndDestroy( 2, note ); // msg    
   277 						CleanupStack::PopAndDestroy( 2, note ); // msg
       
   278 						
       
   279 						// set roming shown flag. We want to show 
       
   280 						// romign note only once while user stays in foreign
       
   281 						// network. If user sets the HS to online this note is 
       
   282 						// not showed again and HS will stay online in foreign
       
   283 						// network.
       
   284 						iFlags.Set( ERoamingShown );
   278                         }
   285                         }
   279                     break;
   286                     break;
   280 
   287 
   281                 case ENWRegisteredOnHomeNetwork:
   288                 case ENWRegisteredOnHomeNetwork:
   282                     _LOG1( _L(" Home Network Activated "));
   289                     _LOG1( _L(" Home Network Activated "));
       
   290                     if ( iFlags.IsSet( ERoamingShown  ) )
       
   291                         {
       
   292                         // Clear ERoamingShown when user returns to home 
       
   293                         // network.
       
   294                         iFlags.Clear( ERoamingShown );
       
   295                         }
       
   296                     
   283                     iCurrentNwStatus = aNWInfo.iRegistrationStatus;
   297                     iCurrentNwStatus = aNWInfo.iRegistrationStatus;
   284                     CurrentNetworkSetting();
   298                     CurrentNetworkSetting();
   285                     if( iHomeNetwork == ECmCellularDataUsageAutomatic )
   299                     if( iHomeNetwork == ECmCellularDataUsageAutomatic )
   286                         {
   300                         {
   287                         // Reset to user selection
   301                         // Reset to user selection