cmmanager/cmmgr/Plugins/cmpluginwlan/src/cmpwlansettingsdlgipv4.cpp
branchRCL_3
changeset 24 c45d4fe2ff0a
parent 0 5a93021fdf25
--- a/cmmanager/cmmgr/Plugins/cmpluginwlan/src/cmpwlansettingsdlgipv4.cpp	Tue Apr 27 17:03:25 2010 +0300
+++ b/cmmanager/cmmgr/Plugins/cmpluginwlan/src/cmpwlansettingsdlgipv4.cpp	Tue May 11 16:35:05 2010 +0300
@@ -69,6 +69,9 @@
 //
 TInt CmPluginWlanSettingsDlgIpv4::ConstructAndRunLD()
     {
+    // Set this flag to allow edit continue
+    iCanEditingContinue = ETrue;
+    
     CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
     cmMgr.WatcherRegisterL( this );
     
@@ -157,10 +160,18 @@
 //
 void CmPluginWlanSettingsDlgIpv4::ProcessCommandL( TInt aCommandId )
     {
+    if ( !iCanEditingContinue )
+        {
+        // We have to block all editing activity if database changed by
+        // other application
+        return;
+        }
+
     if ( MenuShowing() )
         {
         HideMenu();
         }
+    
     switch ( aCommandId )
         {
         case EPluginBaseCmdExit:
@@ -196,6 +207,29 @@
 //
 TBool CmPluginWlanSettingsDlgIpv4::OkToExitL( TInt aButtonId )
     {
+    // Database has been changed by other application so exit from this view
+    // without update editings to database
+    if ( !iCanEditingContinue )
+        {
+        if ( iExitReason == KDialogUserExit )
+            {
+            iCmPluginBaseEng.CmMgr().WatcherUnRegister();
+            
+            // Set iExitReason back to KDialogUserBack so as to exit from this view through else in the next call
+            TInt exitValue = KDialogUserExit;
+            iExitReason = KDialogUserBack;
+            // If destination has been deleted by other application
+            // then we may have to exit from Cmmgr
+            TryExitL( exitValue );
+            return EFalse;
+            }
+        else
+            {
+            // Exit from this view here to avoid possible update to databse
+            return ETrue;
+            }
+        }
+    
     TBool retval( EFalse );
     
     switch ( aButtonId )
@@ -315,6 +349,11 @@
 //
 void CmPluginWlanSettingsDlgIpv4::CommsDatChangesL()
     {
+    if ( !iCanEditingContinue )
+        {
+        return;
+        }
+    
     CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
     CCmDestinationImpl* parentDest = iCmPluginBaseEng.ParentDestination();
     
@@ -327,68 +366,32 @@
                 iParent->NotifyParentView( KCmNotifiedDestinationDisappear );
                 }
             
-            cmMgr.WatcherUnRegister();
             // If parent destination is deleted by somebody then the dialog must exit back to main view
             iExitReason = KDialogUserExit;
-            TryExitL( iExitReason );
-                
-            cmMgr.RemoveDestFromPool( parentDest );
-            delete parentDest;
-            return;
-            }
-            
-        if( !cmMgr.IsIapStillInDestL( parentDest, iCmPluginBaseEng ) )
-            {
-            if( iParent )
-                {
-                iParent->NotifyParentView( KCmNotifiedIapIsNotInThisDestination );
-                }
-            
-            cmMgr.WatcherUnRegister();
-            // In this case, the dialog can go back to the parent view
-            TryExitL( iExitReason );
-            
+            iCanEditingContinue = EFalse;
+     
             cmMgr.RemoveDestFromPool( parentDest );
             delete parentDest;
             return;
             }
         
-        // We may have to notify parent view to go back to its parent view even though this Iap is still in CommsDat
-        // for cmMgr ( = iCmPluginBaseEng.CmMgr() ) can not be accessed any more
-        // after this call when some Iap is deleted.
+        // We may have to go back to parent view if database is changed by other application
         if( iParent )
             {
             iParent->NotifyParentView( KCmNotifiedIapDisappear );
             }
-        cmMgr.WatcherUnRegister();
-        TryExitL( iExitReason );
-            
+        iCanEditingContinue = EFalse;
+
         cmMgr.RemoveDestFromPool( parentDest );
         delete parentDest;
         }
-    else
+    else // Legacy
         {
-        if( !cmMgr.IapStillExistedL( iCmPluginBaseEng ) )
-            {
-            if( iParent )
-            {
-            iParent->NotifyParentView( KCmNotifiedIapDisappear );
-            }
-            
-            cmMgr.WatcherUnRegister();
-            // In this case, the dialog can go back to the parent view
-            TryExitL( iExitReason );
-            return;
-            }
-        
-        // We may have to notify parent view to go back to its parent view even though this Iap is still in CommsDat
-        // for cmMgr ( = iCmPluginBaseEng.CmMgr() ) can not be accessed any more
-        // after this call when some Iap is deleted.
+        // We may have to go back to parent view if database is changed by other application
         if( iParent )
             {
             iParent->NotifyParentView( KCmNotifiedIapDisappear );
             }
-        cmMgr.WatcherUnRegister();
-        TryExitL( iExitReason );
+        iCanEditingContinue = EFalse;
         }
     }