--- a/cmmanager/cmmgr/Plugins/cmpluginvpn/src/cmpvpnsettingsdlg.cpp Tue Apr 27 17:03:25 2010 +0300
+++ b/cmmanager/cmmgr/Plugins/cmpluginvpn/src/cmpvpnsettingsdlg.cpp Tue May 11 16:35:05 2010 +0300
@@ -77,6 +77,10 @@
TInt CmPluginVpnSettingsDlg::ConstructAndRunLD( )
{
LOGGER_ENTERFN( "CmPluginVpnSettingsDlg::ConstructAndRunLD" );
+
+ // Set this flag to allow edit continue
+ iCanEditingContinue = ETrue;
+
CleanupStack::PushL( this );
LoadResourceL( KPluginVPNResDirAndFileName );
@@ -365,11 +369,18 @@
//
void CmPluginVpnSettingsDlg::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 EAknSoftkeyOk:
@@ -472,6 +483,29 @@
//
TBool CmPluginVpnSettingsDlg::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;
+ }
+ }
+
// Translate the button presses into commands for the appui & current
// view to handle
TBool retval( EFalse );
@@ -556,6 +590,11 @@
//
void CmPluginVpnSettingsDlg::CommsDatChangesL()
{
+ if ( !iCanEditingContinue )
+ {
+ return;
+ }
+
CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
CCmDestinationImpl* parentDest = iCmPluginBaseEng.ParentDestination();
@@ -563,52 +602,26 @@
{
if( !cmMgr.DestinationStillExistedL( parentDest ) )
{
- cmMgr.WatcherUnRegister();
// If parent destination diappears with some reason
// then the view must exit back to main view for it
// may be danger if going back to parent view
iExitReason = KDialogUserExit;
- TryExitL( iExitReason );
-
+ iCanEditingContinue = EFalse;
+
cmMgr.RemoveDestFromPool( parentDest );
delete parentDest;
return;
}
- if( !cmMgr.IsIapStillInDestL( parentDest, iCmPluginBaseEng ) )
- {
- cmMgr.WatcherUnRegister();
- // In this case, the view can go back to the parent view
- TryExitL( iExitReason );
-
- cmMgr.RemoveDestFromPool( parentDest );
- delete parentDest;
- return;
- }
-
- // We may have to go back to 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.
- cmMgr.WatcherUnRegister();
- TryExitL( iExitReason );
-
+ // We may have to go back to parent view if database is changed by other application
+ iCanEditingContinue = EFalse;
+
cmMgr.RemoveDestFromPool( parentDest );
delete parentDest;
}
- else
+ else // Legacy
{
- if( !cmMgr.IapStillExistedL( iCmPluginBaseEng ) )
- {
- cmMgr.WatcherUnRegister();
- // In this case, the dialog can go back to the parent view
- TryExitL( iExitReason );
- return;
- }
-
- // We may have to go back to 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.
- cmMgr.WatcherUnRegister();
- TryExitL( iExitReason );
+ // We may have to go back to parent view if database is changed by other application
+ iCanEditingContinue = EFalse;
}
}