75 // -------------------------------------------------------------------------- |
75 // -------------------------------------------------------------------------- |
76 // |
76 // |
77 TInt CmPluginVpnSettingsDlg::ConstructAndRunLD( ) |
77 TInt CmPluginVpnSettingsDlg::ConstructAndRunLD( ) |
78 { |
78 { |
79 LOGGER_ENTERFN( "CmPluginVpnSettingsDlg::ConstructAndRunLD" ); |
79 LOGGER_ENTERFN( "CmPluginVpnSettingsDlg::ConstructAndRunLD" ); |
|
80 |
|
81 // Set this flag to allow edit continue |
|
82 iCanEditingContinue = ETrue; |
|
83 |
80 CleanupStack::PushL( this ); |
84 CleanupStack::PushL( this ); |
81 LoadResourceL( KPluginVPNResDirAndFileName ); |
85 LoadResourceL( KPluginVPNResDirAndFileName ); |
82 |
86 |
83 // check if VPN is available, as if not, we can not show the details... |
87 // check if VPN is available, as if not, we can not show the details... |
84 RVpnServ ps; |
88 RVpnServ ps; |
363 // CmPluginVpnSettingsDlg::ProcessCommandL |
367 // CmPluginVpnSettingsDlg::ProcessCommandL |
364 // -------------------------------------------------------------------------- |
368 // -------------------------------------------------------------------------- |
365 // |
369 // |
366 void CmPluginVpnSettingsDlg::ProcessCommandL( TInt aCommandId ) |
370 void CmPluginVpnSettingsDlg::ProcessCommandL( TInt aCommandId ) |
367 { |
371 { |
|
372 if ( !iCanEditingContinue ) |
|
373 { |
|
374 // We have to block all editing activity if database changed by |
|
375 // other application |
|
376 return; |
|
377 } |
|
378 |
368 if ( MenuShowing() ) |
379 if ( MenuShowing() ) |
369 { |
380 { |
370 HideMenu(); |
381 HideMenu(); |
371 } |
382 } |
372 |
383 |
373 switch ( aCommandId ) |
384 switch ( aCommandId ) |
374 { |
385 { |
375 case EAknSoftkeyOk: |
386 case EAknSoftkeyOk: |
376 case EPluginBaseCmdChange: |
387 case EPluginBaseCmdChange: |
377 { |
388 { |
470 // EEikDialogFlagNotifyEsc flag is not set in the resource. |
481 // EEikDialogFlagNotifyEsc flag is not set in the resource. |
471 // -------------------------------------------------------------------------- |
482 // -------------------------------------------------------------------------- |
472 // |
483 // |
473 TBool CmPluginVpnSettingsDlg::OkToExitL( TInt aButtonId ) |
484 TBool CmPluginVpnSettingsDlg::OkToExitL( TInt aButtonId ) |
474 { |
485 { |
|
486 // Database has been changed by other application so exit from this view |
|
487 // without update editings to database |
|
488 if ( !iCanEditingContinue ) |
|
489 { |
|
490 if ( iExitReason == KDialogUserExit ) |
|
491 { |
|
492 iCmPluginBaseEng.CmMgr().WatcherUnRegister(); |
|
493 |
|
494 // Set iExitReason back to KDialogUserBack so as to exit from this view through else in the next call |
|
495 TInt exitValue = KDialogUserExit; |
|
496 iExitReason = KDialogUserBack; |
|
497 // If destination has been deleted by other application |
|
498 // then we may have to exit from Cmmgr |
|
499 TryExitL( exitValue ); |
|
500 return EFalse; |
|
501 } |
|
502 else |
|
503 { |
|
504 // Exit from this view here to avoid possible update to databse |
|
505 return ETrue; |
|
506 } |
|
507 } |
|
508 |
475 // Translate the button presses into commands for the appui & current |
509 // Translate the button presses into commands for the appui & current |
476 // view to handle |
510 // view to handle |
477 TBool retval( EFalse ); |
511 TBool retval( EFalse ); |
478 |
512 |
479 switch ( aButtonId ) |
513 switch ( aButtonId ) |
554 // CmPluginVpnSettingsDlg::CommsDatChangesL |
588 // CmPluginVpnSettingsDlg::CommsDatChangesL |
555 // -------------------------------------------------------------------------- |
589 // -------------------------------------------------------------------------- |
556 // |
590 // |
557 void CmPluginVpnSettingsDlg::CommsDatChangesL() |
591 void CmPluginVpnSettingsDlg::CommsDatChangesL() |
558 { |
592 { |
|
593 if ( !iCanEditingContinue ) |
|
594 { |
|
595 return; |
|
596 } |
|
597 |
559 CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr(); |
598 CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr(); |
560 CCmDestinationImpl* parentDest = iCmPluginBaseEng.ParentDestination(); |
599 CCmDestinationImpl* parentDest = iCmPluginBaseEng.ParentDestination(); |
561 |
600 |
562 if ( parentDest ) |
601 if ( parentDest ) |
563 { |
602 { |
564 if( !cmMgr.DestinationStillExistedL( parentDest ) ) |
603 if( !cmMgr.DestinationStillExistedL( parentDest ) ) |
565 { |
604 { |
566 cmMgr.WatcherUnRegister(); |
|
567 // If parent destination diappears with some reason |
605 // If parent destination diappears with some reason |
568 // then the view must exit back to main view for it |
606 // then the view must exit back to main view for it |
569 // may be danger if going back to parent view |
607 // may be danger if going back to parent view |
570 iExitReason = KDialogUserExit; |
608 iExitReason = KDialogUserExit; |
571 TryExitL( iExitReason ); |
609 iCanEditingContinue = EFalse; |
572 |
610 |
573 cmMgr.RemoveDestFromPool( parentDest ); |
611 cmMgr.RemoveDestFromPool( parentDest ); |
574 delete parentDest; |
612 delete parentDest; |
575 return; |
613 return; |
576 } |
614 } |
577 |
615 |
578 if( !cmMgr.IsIapStillInDestL( parentDest, iCmPluginBaseEng ) ) |
616 // We may have to go back to parent view if database is changed by other application |
579 { |
617 iCanEditingContinue = EFalse; |
580 cmMgr.WatcherUnRegister(); |
618 |
581 // In this case, the view can go back to the parent view |
|
582 TryExitL( iExitReason ); |
|
583 |
|
584 cmMgr.RemoveDestFromPool( parentDest ); |
|
585 delete parentDest; |
|
586 return; |
|
587 } |
|
588 |
|
589 // We may have to go back to parent view even though this Iap is still in CommsDat |
|
590 // for cmMgr ( = iCmPluginBaseEng.CmMgr() ) can not be accessed any more |
|
591 // after this call when some Iap is deleted. |
|
592 cmMgr.WatcherUnRegister(); |
|
593 TryExitL( iExitReason ); |
|
594 |
|
595 cmMgr.RemoveDestFromPool( parentDest ); |
619 cmMgr.RemoveDestFromPool( parentDest ); |
596 delete parentDest; |
620 delete parentDest; |
597 } |
621 } |
598 else |
622 else // Legacy |
599 { |
623 { |
600 if( !cmMgr.IapStillExistedL( iCmPluginBaseEng ) ) |
624 // We may have to go back to parent view if database is changed by other application |
601 { |
625 iCanEditingContinue = EFalse; |
602 cmMgr.WatcherUnRegister(); |
626 } |
603 // In this case, the dialog can go back to the parent view |
627 } |
604 TryExitL( iExitReason ); |
|
605 return; |
|
606 } |
|
607 |
|
608 // We may have to go back to parent view even though this Iap is still in CommsDat |
|
609 // for cmMgr ( = iCmPluginBaseEng.CmMgr() ) can not be accessed any more |
|
610 // after this call when some Iap is deleted. |
|
611 cmMgr.WatcherUnRegister(); |
|
612 TryExitL( iExitReason ); |
|
613 } |
|
614 } |
|