cmmanager/cmmgr/Plugins/cmpluginwlan/src/cmpwlansettingsdlgadv.cpp
branchRCL_3
changeset 24 c45d4fe2ff0a
parent 0 5a93021fdf25
equal deleted inserted replaced
19:22c3c67e5001 24:c45d4fe2ff0a
    67 // Constructs the dialog and runs it.
    67 // Constructs the dialog and runs it.
    68 // --------------------------------------------------------------------------
    68 // --------------------------------------------------------------------------
    69 //
    69 //
    70 TInt CmPluginWlanSettingsDlgAdv::ConstructAndRunLD( )
    70 TInt CmPluginWlanSettingsDlgAdv::ConstructAndRunLD( )
    71     {
    71     {
       
    72     // Set this flag to allow edit continue
       
    73     iCanEditingContinue = ETrue;
       
    74     
    72     CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
    75     CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
    73     cmMgr.WatcherRegisterL( this );
    76     cmMgr.WatcherRegisterL( this );
    74     
    77     
    75     return CmPluginBaseSettingsDlgAdv::ConstructAndRunLD();
    78     return CmPluginBaseSettingsDlgAdv::ConstructAndRunLD();
    76     }
    79     }
   396 // CmPluginWlanSettingsDlgAdv::ProcessCommandL
   399 // CmPluginWlanSettingsDlgAdv::ProcessCommandL
   397 // --------------------------------------------------------------------------
   400 // --------------------------------------------------------------------------
   398 //
   401 //
   399 void CmPluginWlanSettingsDlgAdv:: ProcessCommandL( TInt aCommandId )
   402 void CmPluginWlanSettingsDlgAdv:: ProcessCommandL( TInt aCommandId )
   400     {
   403     {
       
   404     if ( !iCanEditingContinue )
       
   405         {
       
   406         // We have to block all editing activity if database changed by
       
   407         // other application
       
   408         return;
       
   409         }
       
   410     
   401     if ( MenuShowing() )
   411     if ( MenuShowing() )
   402         {
   412         {
   403         HideMenu();
   413         HideMenu();
   404         }
   414         }
   405 
   415     
   406     switch ( aCommandId )
   416     switch ( aCommandId )
   407         {
   417         {
   408         case EPluginBaseCmdExit:
   418         case EPluginBaseCmdExit:
   409             {
   419             {
   410             iExitReason = KDialogUserExit;
   420             iExitReason = KDialogUserExit;
   472 // EEikDialogFlagNotifyEsc flag is not set in the resource.
   482 // EEikDialogFlagNotifyEsc flag is not set in the resource.
   473 // --------------------------------------------------------------------------
   483 // --------------------------------------------------------------------------
   474 //
   484 //
   475 TBool CmPluginWlanSettingsDlgAdv::OkToExitL( TInt aButtonId )
   485 TBool CmPluginWlanSettingsDlgAdv::OkToExitL( TInt aButtonId )
   476     {
   486     {
       
   487     // Database has been changed by other application so exit from this view
       
   488     // without update editings to database
       
   489     if ( !iCanEditingContinue )
       
   490         {
       
   491         if ( iExitReason == KDialogUserExit )
       
   492             {
       
   493             iCmPluginBaseEng.CmMgr().WatcherUnRegister();
       
   494             
       
   495             // Set iExitReason back to KDialogUserBack so as to exit from this view through else in the next call
       
   496             TInt exitValue = KDialogUserExit;
       
   497             iExitReason = KDialogUserBack;
       
   498             // If destination has been deleted by other application
       
   499             // then we may have to exit from Cmmgr
       
   500             TryExitL( exitValue );
       
   501             return EFalse;
       
   502             }
       
   503         else
       
   504             {
       
   505             // Exit from this view here to avoid possible update to databse
       
   506             return ETrue;
       
   507             }
       
   508         }
       
   509 
   477     // Translate the button presses into commands for the appui & current
   510     // Translate the button presses into commands for the appui & current
   478     // view to handle
   511     // view to handle
   479     TBool retval( EFalse );
   512     TBool retval( EFalse );
   480     
   513     
   481     switch ( aButtonId )
   514     switch ( aButtonId )
   519 // CmPluginWlanSettingsDlgAdv::CommsDatChangesL
   552 // CmPluginWlanSettingsDlgAdv::CommsDatChangesL
   520 // --------------------------------------------------------------------------
   553 // --------------------------------------------------------------------------
   521 //
   554 //
   522 void CmPluginWlanSettingsDlgAdv::CommsDatChangesL()
   555 void CmPluginWlanSettingsDlgAdv::CommsDatChangesL()
   523     {
   556     {
       
   557     if ( !iCanEditingContinue )
       
   558         {
       
   559         return;
       
   560         }
       
   561     
   524     CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
   562     CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
   525     CCmDestinationImpl* parentDest = iCmPluginBaseEng.ParentDestination();
   563     CCmDestinationImpl* parentDest = iCmPluginBaseEng.ParentDestination();
   526 
   564 
   527     if ( parentDest )
   565     if ( parentDest )
   528         {
   566         {
   531             if( iParent )
   569             if( iParent )
   532                 {
   570                 {
   533                 iParent->NotifyParentView( KCmNotifiedDestinationDisappear );
   571                 iParent->NotifyParentView( KCmNotifiedDestinationDisappear );
   534                 }
   572                 }
   535             
   573             
   536             cmMgr.WatcherUnRegister();
       
   537             // If parent destination is deleted by somebody then the dialog must exit back to main view
   574             // If parent destination is deleted by somebody then the dialog must exit back to main view
   538             iExitReason = KDialogUserExit;
   575             iExitReason = KDialogUserExit;
   539             TryExitL( iExitReason );
   576             iCanEditingContinue = EFalse;
   540             
   577 
   541             cmMgr.RemoveDestFromPool( parentDest );
   578             cmMgr.RemoveDestFromPool( parentDest );
   542             delete parentDest;
   579             delete parentDest;
   543             return;
   580             return;
   544             }
   581             }
   545         
   582         
   546         if( !cmMgr.IsIapStillInDestL( parentDest, iCmPluginBaseEng ) )
   583         // We may have to go back to parent view if database is changed by other application
   547             {
       
   548             if( iParent )
       
   549                 {
       
   550                 iParent->NotifyParentView( KCmNotifiedIapIsNotInThisDestination );
       
   551                 }
       
   552             
       
   553             cmMgr.WatcherUnRegister();
       
   554             // In this case, the dialog can go back to the parent view
       
   555             TryExitL( iExitReason );
       
   556             
       
   557             cmMgr.RemoveDestFromPool( parentDest );
       
   558             delete parentDest;
       
   559             return;            
       
   560             }
       
   561         
       
   562         // We may have to notify parent view to go back to its parent view even though this is still in CommsDat
       
   563         // for cmMgr ( = iCmPluginBaseEng.CmMgr() ) can not be accessed any more
       
   564         // after this call when some Iap is deleted.
       
   565         if( iParent )
   584         if( iParent )
   566             {
   585             {
   567             iParent->NotifyParentView( KCmNotifiedIapDisappear );
   586             iParent->NotifyParentView( KCmNotifiedIapDisappear );
   568             }
   587             }
   569         cmMgr.WatcherUnRegister();
   588         iCanEditingContinue = EFalse;
   570         TryExitL( iExitReason );
   589 
   571         
       
   572         cmMgr.RemoveDestFromPool( parentDest );
   590         cmMgr.RemoveDestFromPool( parentDest );
   573         delete parentDest;
   591         delete parentDest;
   574         }
   592         }
   575     else
   593     else // Legacy
   576         {
   594         {
   577         if( !cmMgr.IapStillExistedL( iCmPluginBaseEng ) )
   595         // We may have to go back to parent view if database is changed by other application
   578             {
       
   579             if( iParent )
       
   580                 {
       
   581                 iParent->NotifyParentView( KCmNotifiedIapDisappear );
       
   582                 }
       
   583             
       
   584             cmMgr.WatcherUnRegister();
       
   585             // In this case, the dialog can go back to the parent view
       
   586             TryExitL( iExitReason );
       
   587             return;
       
   588             }
       
   589         
       
   590         // We may have to notify parent view to go back to its parent view even though this is still in CommsDat
       
   591         // for cmMgr ( = iCmPluginBaseEng.CmMgr() ) can not be accessed any more
       
   592         // after this call when some Iap is deleted.
       
   593         if( iParent )
   596         if( iParent )
   594             {
   597             {
   595             iParent->NotifyParentView( KCmNotifiedIapDisappear );
   598             iParent->NotifyParentView( KCmNotifiedIapDisappear );
   596             }
   599             }
   597         cmMgr.WatcherUnRegister();
   600         iCanEditingContinue = EFalse;
   598         TryExitL( iExitReason );
       
   599         }
   601         }
   600     }
   602     }
   601 
   603 
   602 // --------------------------------------------------------------------------
   604 // --------------------------------------------------------------------------
   603 // CmPluginWlanSettingsDlgAdv::NotifyParentView
   605 // CmPluginWlanSettingsDlgAdv::NotifyParentView
   616 // --------------------------------------------------------------------------
   618 // --------------------------------------------------------------------------
   617 // CmPluginWlanSettingsDlgAdv::HandleCommsDatChangeL
   619 // CmPluginWlanSettingsDlgAdv::HandleCommsDatChangeL
   618 // --------------------------------------------------------------------------
   620 // --------------------------------------------------------------------------
   619 //
   621 //
   620 void CmPluginWlanSettingsDlgAdv::HandleCommsDatChangeL()
   622 void CmPluginWlanSettingsDlgAdv::HandleCommsDatChangeL()
   621     {    
   623     {
       
   624     if ( iCanEditingContinue )
       
   625         {
       
   626         // Set iCanEditingContinue to False so that exit fromn this view without update editings
       
   627         iCanEditingContinue = EFalse;
       
   628         }
       
   629     
   622     if( iNotifyFromIp == KCmNotifiedIapIsNotInThisDestination || 
   630     if( iNotifyFromIp == KCmNotifiedIapIsNotInThisDestination || 
   623             iNotifyFromIp == KCmNotifiedIapDisappear )
   631             iNotifyFromIp == KCmNotifiedIapDisappear )
   624         {
   632         {
   625         TryExitL( iExitReason );
   633         TryExitL( iExitReason );
   626         }
   634         }