cmmanager/cmmgr/Plugins/cmpluginwlan/src/cmpwlansettingsdlgipv6.cpp
branchRCL_3
changeset 24 c45d4fe2ff0a
parent 0 5a93021fdf25
equal deleted inserted replaced
19:22c3c67e5001 24:c45d4fe2ff0a
    82 // CmPluginWlanSettingsDlgIpv6::ConstructAndRunLD
    82 // CmPluginWlanSettingsDlgIpv6::ConstructAndRunLD
    83 // --------------------------------------------------------------------------
    83 // --------------------------------------------------------------------------
    84 //
    84 //
    85 TInt CmPluginWlanSettingsDlgIpv6::ConstructAndRunLD()
    85 TInt CmPluginWlanSettingsDlgIpv6::ConstructAndRunLD()
    86     {
    86     {
       
    87     // Set this flag to allow edit continue
       
    88     iCanEditingContinue = ETrue;
       
    89     
    87     CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
    90     CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
    88     cmMgr.WatcherRegisterL( this );
    91     cmMgr.WatcherRegisterL( this );
    89     
    92     
    90     return CmPluginBaseSettingsDlgIp::ConstructAndRunLD();
    93     return CmPluginBaseSettingsDlgIp::ConstructAndRunLD();
    91     }
    94     }
   188 // CmPluginWlanSettingsDlgIpv6::ProcessCommandL
   191 // CmPluginWlanSettingsDlgIpv6::ProcessCommandL
   189 // --------------------------------------------------------------------------
   192 // --------------------------------------------------------------------------
   190 //
   193 //
   191 void CmPluginWlanSettingsDlgIpv6:: ProcessCommandL( TInt aCommandId )
   194 void CmPluginWlanSettingsDlgIpv6:: ProcessCommandL( TInt aCommandId )
   192     {
   195     {
       
   196     if ( !iCanEditingContinue )
       
   197         {
       
   198         // We have to block all editing activity if database changed by
       
   199         // other application
       
   200         return;
       
   201         }
       
   202     
   193     if ( MenuShowing() )
   203     if ( MenuShowing() )
   194         {
   204         {
   195         HideMenu();
   205         HideMenu();
   196         }
   206         }
   197 
   207     
   198     switch ( aCommandId )
   208     switch ( aCommandId )
   199         {
   209         {
   200         case EPluginBaseCmdExit:
   210         case EPluginBaseCmdExit:
   201             {
   211             {
   202             iExitReason = KDialogUserExit;
   212             iExitReason = KDialogUserExit;
   229 // CmPluginWlanSettingsDlgIpv6::OkToExitL
   239 // CmPluginWlanSettingsDlgIpv6::OkToExitL
   230 // --------------------------------------------------------------------------
   240 // --------------------------------------------------------------------------
   231 //
   241 //
   232 TBool CmPluginWlanSettingsDlgIpv6::OkToExitL( TInt aButtonId )
   242 TBool CmPluginWlanSettingsDlgIpv6::OkToExitL( TInt aButtonId )
   233     {
   243     {
       
   244     // Database has been changed by other application so exit from this view
       
   245     // without update editings to database
       
   246     if ( !iCanEditingContinue )
       
   247         {
       
   248         if ( iExitReason == KDialogUserExit )
       
   249             {
       
   250             iCmPluginBaseEng.CmMgr().WatcherUnRegister();
       
   251             
       
   252             // Set iExitReason back to KDialogUserBack so as to exit from this view through else in the next call
       
   253             TInt exitValue = KDialogUserExit;
       
   254             iExitReason = KDialogUserBack;
       
   255             // If destination has been deleted by other application
       
   256             // then we may have to exit from Cmmgr
       
   257             TryExitL( exitValue );
       
   258             return EFalse;
       
   259             }
       
   260         else
       
   261             {
       
   262             // Exit from this view here to avoid possible update to databse
       
   263             return ETrue;
       
   264             }
       
   265         }
       
   266 
   234     TBool retval( EFalse );
   267     TBool retval( EFalse );
   235     
   268     
   236     switch ( aButtonId )
   269     switch ( aButtonId )
   237         {
   270         {
   238         case EAknSoftkeyBack:
   271         case EAknSoftkeyBack:
   239         case EAknSoftkeyExit:
   272         case EAknSoftkeyExit:
   240         case KDialogUserExit:
   273         case KDialogUserExit:
   241             {
   274             {
   242             CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
   275             CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
   243             cmMgr.WatcherUnRegister();
   276             cmMgr.WatcherUnRegister();
   244             } // Continue to call base setting dialog view
   277             
       
   278             iExitReason = KDialogUserBack;
       
   279             retval = ETrue;
       
   280             }
       
   281             break;
   245         default:
   282         default:
   246             {
   283             {
   247             retval = CmPluginBaseSettingsDlgIp::OkToExitL( aButtonId );
   284             retval = CmPluginBaseSettingsDlgIp::OkToExitL( aButtonId );
   248             break;
   285             break;
   249             }
   286             }
   264 // CmPluginWlanSettingsDlgIpv6::CommsDatChangesL
   301 // CmPluginWlanSettingsDlgIpv6::CommsDatChangesL
   265 // --------------------------------------------------------------------------
   302 // --------------------------------------------------------------------------
   266 //
   303 //
   267 void CmPluginWlanSettingsDlgIpv6::CommsDatChangesL()
   304 void CmPluginWlanSettingsDlgIpv6::CommsDatChangesL()
   268     {
   305     {
       
   306     if ( !iCanEditingContinue )
       
   307         {
       
   308         return;
       
   309         }
       
   310     
   269     CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
   311     CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
   270     CCmDestinationImpl* parentDest = iCmPluginBaseEng.ParentDestination();
   312     CCmDestinationImpl* parentDest = iCmPluginBaseEng.ParentDestination();
   271     
   313     
   272     if ( parentDest )
   314     if ( parentDest )
   273         {
   315         {
   276             if( iParent )
   318             if( iParent )
   277                 {
   319                 {
   278                 iParent->NotifyParentView( KCmNotifiedDestinationDisappear );
   320                 iParent->NotifyParentView( KCmNotifiedDestinationDisappear );
   279                 }
   321                 }
   280             
   322             
   281             // cmMgr.WatcherUnRegister();
       
   282             // If parent destination is deleted by somebody then the dialog must exit back to main view
   323             // If parent destination is deleted by somebody then the dialog must exit back to main view
   283             iExitReason = KDialogUserExit; // cmMgr.WatcherUnRegister will be done in function OkToExitL in this case
   324             iExitReason = KDialogUserExit; 
   284             TryExitL( iExitReason );
   325             iCanEditingContinue = EFalse;
   285                 
   326 
   286             cmMgr.RemoveDestFromPool( parentDest );
   327             cmMgr.RemoveDestFromPool( parentDest );
   287             delete parentDest;
   328             delete parentDest;
   288             return;
   329             return;
   289             }
   330             }
   290             
   331 
   291         if( !cmMgr.IsIapStillInDestL( parentDest, iCmPluginBaseEng ) )
   332         // We may have to go back to parent view if database is changed by other application
   292             {
       
   293             if( iParent )
       
   294                 {
       
   295                 iParent->NotifyParentView( KCmNotifiedIapIsNotInThisDestination );
       
   296                 }
       
   297             
       
   298             cmMgr.WatcherUnRegister();
       
   299             // In this case, the dialog can go back to the parent view
       
   300             TryExitL( iExitReason );
       
   301             
       
   302             cmMgr.RemoveDestFromPool( parentDest );
       
   303             delete parentDest;
       
   304             return;
       
   305             }
       
   306         
       
   307         // We may have to notify parent view to go back to its parent view even though this Iap is still in CommsDat
       
   308         // for cmMgr ( = iCmPluginBaseEng.CmMgr() ) can not be accessed any more
       
   309         // after this call when some Iap is deleted.
       
   310         if( iParent )
   333         if( iParent )
   311             {
   334             {
   312             iParent->NotifyParentView( KCmNotifiedIapDisappear );
   335             iParent->NotifyParentView( KCmNotifiedIapDisappear );
   313             }
   336             }
   314         cmMgr.WatcherUnRegister();
   337         iCanEditingContinue = EFalse;
   315         TryExitL( iExitReason );
   338 
   316         
       
   317         cmMgr.RemoveDestFromPool( parentDest );
   339         cmMgr.RemoveDestFromPool( parentDest );
   318         delete parentDest;
   340         delete parentDest;
   319         }
   341         }
   320     else
   342     else
   321         {
   343         {
   322         if( !cmMgr.IapStillExistedL( iCmPluginBaseEng ) )
   344         // We may have to go back to parent view if database is changed by other application
   323             {
       
   324             if( iParent )
       
   325                 {
       
   326                 iParent->NotifyParentView( KCmNotifiedIapDisappear );
       
   327                 }
       
   328             
       
   329             cmMgr.WatcherUnRegister();
       
   330             // In this case, the dialog can go back to the parent view
       
   331             TryExitL( iExitReason );
       
   332             return;
       
   333             }
       
   334         
       
   335         // We may have to notify parent view to go back to its parent view even though this Iap is still in CommsDat
       
   336         // for cmMgr ( = iCmPluginBaseEng.CmMgr() ) can not be accessed any more
       
   337         // after this call when some Iap is deleted.
       
   338         if( iParent )
   345         if( iParent )
   339             {
   346             {
   340             iParent->NotifyParentView( KCmNotifiedIapDisappear );
   347             iParent->NotifyParentView( KCmNotifiedIapDisappear );
   341             }
   348             }
   342         cmMgr.WatcherUnRegister();
   349         iCanEditingContinue = EFalse;
   343         TryExitL( iExitReason );
   350         }
   344         }
   351     }
   345     }