116 // CmPluginWlanSettingsDlg::ConstructAndRunLD |
116 // CmPluginWlanSettingsDlg::ConstructAndRunLD |
117 // -------------------------------------------------------------------------- |
117 // -------------------------------------------------------------------------- |
118 // |
118 // |
119 TInt CmPluginWlanSettingsDlg::ConstructAndRunLD( ) |
119 TInt CmPluginWlanSettingsDlg::ConstructAndRunLD( ) |
120 { |
120 { |
|
121 // Set this flag to allow edit continue |
|
122 iCanEditingContinue = ETrue; |
|
123 |
|
124 CleanupStack::PushL( this ); |
121 LoadResourceL( KPluginWlanResDirAndFileName ); |
125 LoadResourceL( KPluginWlanResDirAndFileName ); |
|
126 CleanupStack::Pop( this ); |
122 |
127 |
123 CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr(); |
128 CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr(); |
124 cmMgr.WatcherRegisterL( this ); |
129 cmMgr.WatcherRegisterL( this ); |
125 |
130 |
126 return CmPluginBaseSettingsDlg::ConstructAndRunLD( ); |
131 return CmPluginBaseSettingsDlg::ConstructAndRunLD( ); |
767 // EEikDialogFlagNotifyEsc flag is not set in the resource. |
772 // EEikDialogFlagNotifyEsc flag is not set in the resource. |
768 // -------------------------------------------------------------------------- |
773 // -------------------------------------------------------------------------- |
769 // |
774 // |
770 TBool CmPluginWlanSettingsDlg::OkToExitL( TInt aButtonId ) |
775 TBool CmPluginWlanSettingsDlg::OkToExitL( TInt aButtonId ) |
771 { |
776 { |
|
777 // Database has been changed by other application so exit from this view |
|
778 // without update editings to database |
|
779 if ( !iCanEditingContinue ) |
|
780 { |
|
781 if ( iExitReason == KDialogUserExit ) |
|
782 { |
|
783 iCmPluginBaseEng.CmMgr().WatcherUnRegister(); |
|
784 |
|
785 // Set iExitReason back to KDialogUserBack so as to exit from this view through else in the next call |
|
786 TInt exitValue = KDialogUserExit; |
|
787 iExitReason = KDialogUserBack; |
|
788 // If destination has been deleted by other application |
|
789 // then we may have to exit from Cmmgr |
|
790 TryExitL( exitValue ); |
|
791 return EFalse; |
|
792 } |
|
793 else |
|
794 { |
|
795 // Exit from this view here to avoid possible update to databse |
|
796 return ETrue; |
|
797 } |
|
798 } |
|
799 |
772 // Translate the button presses into commands for the appui & current |
800 // Translate the button presses into commands for the appui & current |
773 // view to handle |
801 // view to handle |
774 TBool retval( EFalse ); |
802 TBool retval( EFalse ); |
775 |
803 |
776 switch ( aButtonId ) |
804 switch ( aButtonId ) |
815 // CmPluginWlanSettingsDlg::ProcessCommandL |
843 // CmPluginWlanSettingsDlg::ProcessCommandL |
816 // -------------------------------------------------------------------------- |
844 // -------------------------------------------------------------------------- |
817 // |
845 // |
818 void CmPluginWlanSettingsDlg::ProcessCommandL( TInt aCommandId ) |
846 void CmPluginWlanSettingsDlg::ProcessCommandL( TInt aCommandId ) |
819 { |
847 { |
|
848 if ( !iCanEditingContinue ) |
|
849 { |
|
850 // We have to block all editing activity if database changed by |
|
851 // other application |
|
852 return; |
|
853 } |
|
854 |
820 if ( MenuShowing() ) |
855 if ( MenuShowing() ) |
821 { |
856 { |
822 HideMenu(); |
857 HideMenu(); |
823 } |
858 } |
824 |
859 |
825 switch ( aCommandId ) |
860 switch ( aCommandId ) |
826 { |
861 { |
827 case EPluginBaseCmdExit: |
862 case EPluginBaseCmdExit: |
828 { |
863 { |
829 iExitReason = KDialogUserExit; |
864 iExitReason = KDialogUserExit; |
871 // CmPluginWlanSettingsDlg::CommsDatChangesL |
906 // CmPluginWlanSettingsDlg::CommsDatChangesL |
872 // -------------------------------------------------------------------------- |
907 // -------------------------------------------------------------------------- |
873 // |
908 // |
874 void CmPluginWlanSettingsDlg::CommsDatChangesL() |
909 void CmPluginWlanSettingsDlg::CommsDatChangesL() |
875 { |
910 { |
|
911 if ( !iCanEditingContinue ) |
|
912 { |
|
913 return; |
|
914 } |
|
915 |
876 CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr(); |
916 CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr(); |
877 CCmDestinationImpl* parentDest = iCmPluginBaseEng.ParentDestination(); |
917 CCmDestinationImpl* parentDest = iCmPluginBaseEng.ParentDestination(); |
878 |
918 |
879 if ( parentDest ) |
919 if ( parentDest ) |
880 { |
920 { |
881 if( !cmMgr.DestinationStillExistedL( parentDest ) ) |
921 if( !cmMgr.DestinationStillExistedL( parentDest ) ) |
882 { |
922 { |
883 cmMgr.WatcherUnRegister(); |
|
884 // If parent destination is deleted by somebody then the dialog must exit back to main view |
923 // If parent destination is deleted by somebody then the dialog must exit back to main view |
885 iExitReason = KDialogUserExit; |
924 iExitReason = KDialogUserExit; |
886 TryExitL( iExitReason ); |
925 iCanEditingContinue = EFalse; |
887 |
926 |
888 cmMgr.RemoveDestFromPool( parentDest ); |
927 cmMgr.RemoveDestFromPool( parentDest ); |
889 delete parentDest; |
928 delete parentDest; |
890 return; |
929 return; |
891 } |
930 } |
892 |
931 |
893 if( !cmMgr.IsIapStillInDestL( parentDest, iCmPluginBaseEng ) ) |
932 // We may have to go back to parent view if database is changed by other application |
894 { |
933 iCanEditingContinue = EFalse; |
895 cmMgr.WatcherUnRegister(); |
934 |
896 // In this case, the dialog can go back to the parent view |
|
897 TryExitL( iExitReason ); |
|
898 |
|
899 cmMgr.RemoveDestFromPool( parentDest ); |
|
900 delete parentDest; |
|
901 return; |
|
902 } |
|
903 |
|
904 // We may have to go back to parent view even though this Iap is still in CommsDat |
|
905 // for cmMgr ( = iCmPluginBaseEng.CmMgr() ) can not be accessed any more |
|
906 // after this call when some Iap is deleted. |
|
907 cmMgr.WatcherUnRegister(); |
|
908 TryExitL( iExitReason ); |
|
909 |
|
910 cmMgr.RemoveDestFromPool( parentDest ); |
935 cmMgr.RemoveDestFromPool( parentDest ); |
911 delete parentDest; |
936 delete parentDest; |
912 } |
937 } |
913 else |
938 else // Legacy |
914 { |
939 { |
915 if( !cmMgr.IapStillExistedL( iCmPluginBaseEng ) ) |
940 // We may have to go back to parent view if database is changed by other application |
916 { |
941 iCanEditingContinue = EFalse; |
917 cmMgr.WatcherUnRegister(); |
|
918 // In this case, the dialog can go back to the parent view |
|
919 TryExitL( iExitReason ); |
|
920 return; |
|
921 } |
|
922 |
|
923 // We may have to go back to parent view even though this Iap is still in CommsDat |
|
924 // for cmMgr ( = iCmPluginBaseEng.CmMgr() ) can not be accessed any more |
|
925 // after this call when some Iap is deleted. |
|
926 cmMgr.WatcherUnRegister(); |
|
927 TryExitL( iExitReason ); |
|
928 } |
942 } |
929 } |
943 } |
930 |
944 |
931 // -------------------------------------------------------------------------- |
945 // -------------------------------------------------------------------------- |
932 // CmPluginWlanSettingsDlg::NotifyParentView |
946 // CmPluginWlanSettingsDlg::NotifyParentView |
941 // CmPluginWlanSettingsDlg::HandleCommsDatChangeL |
955 // CmPluginWlanSettingsDlg::HandleCommsDatChangeL |
942 // -------------------------------------------------------------------------- |
956 // -------------------------------------------------------------------------- |
943 // |
957 // |
944 void CmPluginWlanSettingsDlg::HandleCommsDatChangeL() |
958 void CmPluginWlanSettingsDlg::HandleCommsDatChangeL() |
945 { |
959 { |
946 //CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr(); |
960 if ( iCanEditingContinue ) |
|
961 { |
|
962 // Set iCanEditingContinue to False so that exit fromn this view without update editings |
|
963 iCanEditingContinue = EFalse; |
|
964 } |
947 |
965 |
948 if( iNotifyFromAdv == KCmNotifiedIapIsNotInThisDestination || |
966 if( iNotifyFromAdv == KCmNotifiedIapIsNotInThisDestination || |
949 iNotifyFromAdv == KCmNotifiedIapDisappear ) |
967 iNotifyFromAdv == KCmNotifiedIapDisappear ) |
950 { |
968 { |
951 TryExitL( iExitReason ); |
969 TryExitL( iExitReason ); |