266 // --------------------------------------------------------------------------- |
237 // --------------------------------------------------------------------------- |
267 // |
238 // |
268 CESMREditorDialog::~CESMREditorDialog( ) |
239 CESMREditorDialog::~CESMREditorDialog( ) |
269 { |
240 { |
270 FUNC_LOG; |
241 FUNC_LOG; |
271 if ( iFeatureManagerInitialized ) |
|
272 { |
|
273 FeatureManager::UnInitializeLib(); |
|
274 } |
|
275 |
|
276 if ( iServiceHandler ) |
|
277 { |
|
278 iServiceHandler->DetachMenu ( |
|
279 R_MR_EDITOR_ORGANIZER_MENU, |
|
280 R_PS_AIW_INTEREST ); |
|
281 delete iServiceHandler; |
|
282 } |
|
283 |
242 |
284 delete iESMRSendUI; |
243 delete iESMRSendUI; |
285 if ( iTitlePane ) |
244 if ( iTitlePane ) |
286 { |
245 { |
287 // Returns the previous title back to titlepane |
246 // Returns the previous title back to titlepane |
288 iTitlePane->Rollback(); |
247 iTitlePane->Rollback(); |
289 delete iTitlePane; |
248 delete iTitlePane; |
290 } |
249 } |
291 |
|
292 delete iInterimUtils; |
250 delete iInterimUtils; |
293 |
|
294 delete iLocationPluginHandler; |
251 delete iLocationPluginHandler; |
295 |
|
296 delete iAddressInfoHandler; |
252 delete iAddressInfoHandler; |
297 |
|
298 delete iFeatures; |
253 delete iFeatures; |
|
254 delete iToolbar; |
|
255 delete iFocusStrategy; |
|
256 |
299 // iView is deleted by framework because it uses the |
257 // iView is deleted by framework because it uses the |
300 // custom control mechanism. |
258 // custom control mechanism. |
301 } |
259 } |
302 |
260 |
303 // --------------------------------------------------------------------------- |
261 // --------------------------------------------------------------------------- |
304 // CESMREditorDialog::NewL |
262 // CESMREditorDialog::NewL |
305 // --------------------------------------------------------------------------- |
263 // --------------------------------------------------------------------------- |
306 // |
264 // |
307 EXPORT_C CESMREditorDialog* CESMREditorDialog::NewL( |
265 EXPORT_C CESMREditorDialog* CESMREditorDialog::NewL( |
308 CESMRPolicy* aPolicy, |
266 MMRInfoProvider& aInfoProvider, |
309 MESMRCalEntry& aEntry, |
|
310 MAgnEntryUiCallback& aCallback ) |
267 MAgnEntryUiCallback& aCallback ) |
311 { |
268 { |
312 FUNC_LOG; |
269 FUNC_LOG; |
313 CESMREditorDialog* self = |
270 CESMREditorDialog* self = |
314 new (ELeave) CESMREditorDialog( aEntry, aCallback ); |
271 new (ELeave) CESMREditorDialog( aInfoProvider, aCallback ); |
315 CleanupStack::PushL( self ); |
272 CleanupStack::PushL( self ); |
316 self->ConstructL( aPolicy ); |
273 self->ConstructL(); |
317 CleanupStack::Pop( self ); |
274 CleanupStack::Pop( self ); |
318 return self; |
275 return self; |
319 } |
276 } |
320 |
277 |
321 // --------------------------------------------------------------------------- |
278 // --------------------------------------------------------------------------- |
322 // CESMREditorDialog::ConstructL |
279 // CESMREditorDialog::ConstructL |
323 // --------------------------------------------------------------------------- |
280 // --------------------------------------------------------------------------- |
324 // |
281 // |
325 void CESMREditorDialog::ConstructL( |
282 void CESMREditorDialog::ConstructL() |
326 CESMRPolicy* aPolicy ) |
|
327 { |
283 { |
328 FUNC_LOG; |
284 FUNC_LOG; |
329 CAknDialog::ConstructL ( R_MREDITOR_MENUBAR ); |
285 CAknDialog::ConstructL ( R_MREDITOR_MENUBAR ); |
330 iPolicy = aPolicy; |
|
331 |
286 |
332 iESMRSendUI = CESMRSendUI::NewL (EESMRCmdSendAs ); |
287 iESMRSendUI = CESMRSendUI::NewL (EESMRCmdSendAs ); |
333 |
288 |
334 FeatureManager::InitializeLibL(); |
289 MESMRCalEntry* entry = iInfoProvider.EntryL(); |
335 iFeatureManagerInitialized = ETrue; |
290 CESMRFieldStorage* storage = CreateCorrectStorageLC( |
336 |
291 *this, |
337 // <cmail> remove custom feature KFeatureIdPrintingFrameworkCalendarPlugin |
292 *entry, |
338 // </cmail> |
293 iInfoProvider.PolicyProvider().CurrentPolicy(), |
339 |
294 this ); |
340 CESMRFieldStorage* storage = |
295 |
341 CreateCorrectStorageLC( *this, iEntry, aPolicy, this ); |
296 iStartTimeUtc = entry->Entry().StartTimeL().TimeUtcL(); |
|
297 |
|
298 //clean previous toolbar if there is, and be sure restore toolbar area to EMainPane |
|
299 iToolbar = CMRToolbar::NewL(); |
342 |
300 |
343 TRect clientRect; |
301 TRect clientRect; |
344 AknLayoutUtils::LayoutMetricsRect( |
302 AknLayoutUtils::LayoutMetricsRect( |
345 AknLayoutUtils::EMainPane, |
303 AknLayoutUtils::EMainPane, |
346 clientRect ); |
304 clientRect ); |
347 |
305 |
|
306 // Create focus strategy |
|
307 iFocusStrategy = CMRFocusStrategyEditor::NewL( *storage ); |
|
308 |
348 // storage ownership is transferred to CESMRView |
309 // storage ownership is transferred to CESMRView |
349 iView = CESMRView::NewL( storage, iEntry, clientRect ); |
310 iView = CESMRView::NewL( |
|
311 storage, |
|
312 *entry, |
|
313 clientRect, |
|
314 *iFocusStrategy, |
|
315 *iToolbar ); |
|
316 |
|
317 iView->SetViewMode( EESMREditMR ); |
350 CleanupStack::Pop( storage ); |
318 CleanupStack::Pop( storage ); |
351 |
319 |
352 // try to find subject field and set title pane observer |
320 // try to find subject field and set title pane observer |
353 CESMRField* field = NULL; |
321 CESMRField* field = NULL; |
354 TInt fieldCount( storage->Count() ); |
322 TInt fieldCount( storage->Count() ); |
783 if ( ret == KErrNone ) |
724 if ( ret == KErrNone ) |
784 { |
725 { |
785 if ( iFeatures->FeatureSupported( |
726 if ( iFeatures->FeatureSupported( |
786 CESMRFeatureSettings::EESMRUIPreviousLocationsList ) ) |
727 CESMRFeatureSettings::EESMRUIPreviousLocationsList ) ) |
787 { |
728 { |
788 LocationPluginHandlerL().StoreLocationToHistoryL( iEntry ); |
729 LocationPluginHandlerL().StoreLocationToHistoryL( *entry ); |
789 } |
730 } |
790 |
731 |
791 TInt exitCode = aCommand == |
732 TInt exitCode = aCommand == |
792 EESMRCmdDeleteMR ? EESMRCmdDeleteMR : EAknSoftkeyDone; |
733 EESMRCmdDeleteMR ? EESMRCmdDeleteMR : EAknSoftkeyDone; |
793 TryExitL ( exitCode ); |
734 TryExitL ( exitCode ); |
794 } |
735 } |
795 } |
736 } |
796 break; |
737 break; |
797 |
738 |
798 case EESMRCmdDeleteMR: |
739 case EESMRCmdDeleteMR: |
799 { |
740 case EESMRCmdCalEntryUIDelete: |
800 if ( iEntry.Type () == MESMRCalEntry::EESMRCalEntryMeetingRequest ) |
741 { |
801 { |
742 TBool okToDelete = ETrue; |
802 TBool okToDelete = ETrue; |
743 |
803 |
744 if ( entry->IsRecurrentEventL() ) |
804 if ( iEntry.IsRecurrentEventL() ) |
745 { |
|
746 SetRecurrenceModRuleL( |
|
747 *entry, |
|
748 CESMRListQuery::EESMRDeleteThisOccurenceOrSeriesQuery ); |
|
749 } |
|
750 else |
|
751 { |
|
752 if( CCalenInterimUtils2::IsMeetingRequestL( entry->Entry() ) ) |
805 { |
753 { |
806 SetRecurrenceModRuleL( |
754 okToDelete = CESMRConfirmationQuery::ExecuteL( |
807 iEntry, |
755 CESMRConfirmationQuery::EESMRDeleteMR ); |
808 CESMRListQuery::EESMRDeleteThisOccurenceOrSeriesQuery ); |
|
809 } |
756 } |
810 else |
757 else |
811 { |
758 { |
812 okToDelete = CESMRConfirmationQuery::ExecuteL( |
759 okToDelete = CESMRConfirmationQuery::ExecuteL( |
813 CESMRConfirmationQuery::EESMRDeleteMR ); |
760 CESMRConfirmationQuery::EESMRDeleteEntry ); |
814 |
|
815 } |
761 } |
816 |
762 } |
817 if ( okToDelete ) |
763 |
|
764 if ( okToDelete ) |
|
765 { |
|
766 // When deleting we do not need to externalize entry |
|
767 if( entry->IsStoredL() ) |
818 { |
768 { |
819 // When deleting we do not need to externalize entry |
|
820 TInt res = iCallback.ProcessCommandWithResultL( aCommand ); |
769 TInt res = iCallback.ProcessCommandWithResultL( aCommand ); |
821 if ( res != KErrCancel ) |
770 if ( res != KErrCancel ) |
822 { |
771 { |
823 TInt exitCode = aCommand == EESMRCmdDeleteMR ? |
772 TryExitL( EESMRCmdDeleteMR ); |
824 EESMRCmdDeleteMR : EAknSoftkeyDone; |
|
825 TryExitL ( exitCode ); |
|
826 } |
773 } |
827 } |
774 } |
828 } |
775 else |
829 } |
776 { |
830 break; |
777 TryExitL( EESMRCmdDeleteMR ); |
831 |
778 } |
|
779 } |
|
780 } |
|
781 break; |
|
782 |
832 case EESMRCmdAssignFromMap: |
783 case EESMRCmdAssignFromMap: |
833 case EESMRCmdLandmarks: |
784 case EESMRCmdLandmarks: |
834 case EESMRCmdPreviousLocations: |
785 case EESMRCmdPreviousLocations: |
835 { |
786 { |
836 if ( iFeatures->FeatureSupported( |
787 if ( iFeatures->FeatureSupported( |
837 CESMRFeatureSettings::EESMRUIMnFwIntegration |
788 CESMRFeatureSettings::EESMRUIMnFwIntegration |
838 | CESMRFeatureSettings::EESMRUILandmarksIntegration |
789 | CESMRFeatureSettings::EESMRUILandmarksIntegration |
839 | CESMRFeatureSettings::EESMRUIPreviousLocationsList ) ) |
790 | CESMRFeatureSettings::EESMRUIPreviousLocationsList ) ) |
840 { |
791 { |
841 TBool ignoreQuery = EFalse; |
792 TBool ignoreQuery = EFalse; |
842 |
793 |
843 if ( aCommand == EESMRCmdAssignFromMap ) |
794 if ( aCommand == EESMRCmdAssignFromMap ) |
844 { |
795 { |
845 HBufC* oldLocation = iEntry.Entry().LocationL().AllocLC(); |
796 HBufC* oldLocation = entry->Entry().LocationL().AllocLC(); |
846 iView->ExternalizeL(); |
797 iView->ExternalizeL(); |
847 |
798 |
848 // if old and new locations are different and old location |
799 // if old and new locations are different and old location |
849 // exists, the user is updating existing location. Let's discard |
800 // exists, the user is updating existing location. Let's discard |
850 // the existing coordinates by using command EESMRCmdUpdateFromMap |
801 // the existing coordinates by using command EESMRCmdUpdateFromMap |
851 if ( ( iEntry.Entry().LocationL().Compare( *oldLocation ) != 0 |
802 if ( ( entry->Entry().LocationL().Compare( *oldLocation ) != 0 |
852 && oldLocation->Length() != 0 ) |
803 && oldLocation->Length() != 0 ) |
853 || iLocationModified ) |
804 || iLocationModified ) |
854 { |
805 { |
855 aCommand = EESMRCmdUpdateFromMap; |
806 aCommand = EESMRCmdUpdateFromMap; |
856 } |
807 } |
857 else if ( oldLocation->Length() == 0 ) |
808 else if ( oldLocation->Length() == 0 ) |
858 { |
809 { |
859 // Assigning location from Maps for first time. |
810 // Assigning location from Maps for first time. |
860 ignoreQuery = EFalse; |
811 ignoreQuery = EFalse; |
861 } |
812 } |
862 CleanupStack::PopAndDestroy( oldLocation ); |
813 CleanupStack::PopAndDestroy( oldLocation ); |
863 oldLocation = NULL; |
814 oldLocation = NULL; |
864 } |
815 } |
865 else |
816 else |
866 { |
817 { |
867 iView->ExternalizeL(); |
818 iView->ExternalizeL(); |
868 } |
819 } |
869 |
820 |
870 iLocationModified |= |
821 iLocationModified |= |
871 LocationPluginHandlerL().HandleCommandL( aCommand, |
822 LocationPluginHandlerL().HandleCommandL( aCommand, |
872 iEntry, |
823 *entry, |
873 ignoreQuery ); |
824 ignoreQuery ); |
874 iView->InternalizeL(); |
825 iView->InternalizeL(); |
875 iView->SetControlFocusedL( EESMRFieldLocation ); |
826 iView->SetControlFocusedL( EESMRFieldLocation ); |
876 } |
827 } |
877 break; |
828 break; |
878 } |
829 } |
879 case EESMRCmdSearchFromContacts: |
830 case EESMRCmdSearchFromContacts: |
880 { |
831 { |
881 if ( iFeatures->FeatureSupported( |
832 if ( iFeatures->FeatureSupported( |
882 CESMRFeatureSettings::EESMRUIContactsIntegration ) ) |
833 CESMRFeatureSettings::EESMRUIContactsIntegration ) ) |
883 { |
834 { |
884 iView->ExternalizeL(); |
835 iView->ExternalizeL(); |
885 iLocationModified |= |
836 iLocationModified |= |
886 AddressInfoHandlerL().SearchAddressFromContactsL( iEntry ); |
837 AddressInfoHandlerL().SearchAddressFromContactsL( *entry ); |
887 iView->InternalizeL(); |
838 iView->InternalizeL(); |
888 iView->SetControlFocusedL( EESMRFieldLocation ); |
839 iView->SetControlFocusedL( EESMRFieldLocation ); |
889 } |
840 } |
890 break; |
841 break; |
891 } |
842 } |
892 // Scenarios with viewer location field in editor dialog. |
843 // Scenarios with viewer location field in editor dialog. |
893 case EESMRCmdShowOnMap: |
844 case EESMRCmdShowOnMap: |
894 case EESMRCmdSearchFromMap: |
845 case EESMRCmdSearchFromMap: |
895 { |
846 { |
896 LocationPluginHandlerL().HandleCommandL(aCommand, iEntry ); |
847 if ( iFeatures->FeatureSupported( |
897 break; |
848 CESMRFeatureSettings::EESMRUIMnFwIntegration ) ) |
898 } |
849 { |
|
850 LocationPluginHandlerL().HandleCommandL(aCommand, *entry ); |
|
851 } |
|
852 break; |
|
853 } |
899 case EAknCmdOpen: |
854 case EAknCmdOpen: |
900 { |
855 { |
901 HandleOpenCmdL(); |
856 HandleOpenCmdL(); |
902 break; |
857 break; |
903 } |
858 } |
|
859 case EESMRCmdAttendeeInsertContact: |
|
860 { |
|
861 OkToExitL(EESMRCmdAttendeeInsertContact); |
|
862 break; |
|
863 } |
|
864 /* |
|
865 * Attachment field editor context menu commands |
|
866 */ |
|
867 case EESMREditorOpenAttachment: |
|
868 case EESMREditorRemoveAttachment: |
|
869 case EESMREditorRemoveAllAttachments: |
|
870 case EESMREditorAddAttachment: |
|
871 { |
|
872 iView->ProcessEditorCommandL( aCommand ); |
|
873 break; |
|
874 } |
|
875 |
|
876 case EMRCommandMyLocations: |
|
877 { |
|
878 iView->ExternalizeL(); |
|
879 iLocationModified |= |
|
880 LocationPluginHandlerL().HandleCommandL( aCommand, |
|
881 *entry, |
|
882 EFalse ); |
|
883 iView->InternalizeL(); |
|
884 iView->SetControlFocusedL( EESMRFieldLocation ); |
|
885 break; |
|
886 } |
904 default: |
887 default: |
905 break; |
888 break; |
906 } |
889 } |
907 } |
890 } |
908 |
891 |
913 void CESMREditorDialog::DynInitMenuPaneL( |
896 void CESMREditorDialog::DynInitMenuPaneL( |
914 TInt aResourceId, |
897 TInt aResourceId, |
915 CEikMenuPane* aMenu ) |
898 CEikMenuPane* aMenu ) |
916 { |
899 { |
917 FUNC_LOG; |
900 FUNC_LOG; |
918 |
901 MESMRCalEntry* entry = iInfoProvider.EntryL(); |
919 if ( iServiceHandler && iServiceHandler->HandleSubmenuL ( *aMenu ) ) |
902 |
920 { |
903 TMRMenuStyle menuStyle( EMROptionsMenu ); |
921 return; |
|
922 } |
|
923 |
904 |
924 if ( aResourceId == R_MR_EDITOR_ORGANIZER_MENU ) |
905 if ( aResourceId == R_MR_EDITOR_ORGANIZER_MENU ) |
925 { |
906 { |
|
907 const CESMRPolicy& policy = Policy(); |
|
908 const TInt count(aMenu->NumberOfItemsInPane()); |
|
909 for ( TInt i(0); i < count; i++ ) |
|
910 { |
|
911 CEikMenuPaneItem::SData& item = aMenu->ItemDataByIndexL ( i ); |
|
912 |
|
913 if ( item.iCommandId ) |
|
914 { |
|
915 // Checking from policy for commands that has valid command id and |
|
916 aMenu->SetItemDimmed ( |
|
917 item.iCommandId, |
|
918 !policy.IsDefaultCommand(item.iCommandId) ); |
|
919 } |
|
920 } |
|
921 |
|
922 //Open command |
|
923 if ( iView->IsComponentFocused( EESMRFieldSync ) || |
|
924 iView->IsComponentFocused( EESMRFieldRecurrence ) || |
|
925 iView->IsComponentFocused( EESMRFieldAlarm ) || |
|
926 iView->IsComponentFocused( EESMRFieldPriority )) |
|
927 { |
|
928 aMenu->SetItemDimmed( EAknCmdOpen, EFalse ); |
|
929 } |
|
930 |
|
931 if( iInterimUtils && !(iInterimUtils->MRViewersEnabledL())) |
|
932 { |
|
933 aMenu->SetItemDimmed( EESMRCmdCalEntryUIAddParticipants, ETrue ); |
|
934 } |
|
935 |
926 |
936 |
927 if ( FeatureManager::FeatureSupported( KFeatureIdFfCmailIntegration ) ) |
937 TBool sendEnabled( EFalse ); |
928 { |
938 TBool sentAndStored( EFalse ); |
929 // remove help support in pf5250 |
|
930 aMenu->SetItemDimmed( EAknCmdHelp, ETrue); |
|
931 } |
|
932 |
939 |
933 const TInt count(aMenu->NumberOfItemsInPane()); |
940 if ( MESMRCalEntry::EESMRCalEntryMeetingRequest == entry->Type() ) |
934 for (TInt i(0); i < count; i++ ) |
941 { |
935 { |
942 MESMRMeetingRequestEntry* mrEntry = |
936 CEikMenuPaneItem::SData& item = aMenu->ItemDataByIndexL ( i ); |
943 static_cast<MESMRMeetingRequestEntry*>( iInfoProvider.EntryL() ); |
937 aMenu->SetItemDimmed ( |
|
938 item.iCommandId, |
|
939 !iPolicy->IsDefaultCommand(item.iCommandId) ); |
|
940 } |
|
941 |
944 |
942 //Open command |
945 // if the entry is saved (stored) and sent to recipients, |
943 if ( iView->IsComponentFocused( EESMRFieldSync ) || |
946 // show 'Send update', otherwise just 'Send' |
944 iView->IsComponentFocused( EESMRFieldRecurrence ) || |
947 sentAndStored = mrEntry->IsSentL() && mrEntry->IsStoredL(); |
945 iView->IsComponentFocused( EESMRFieldAlarm ) || |
948 |
946 iView->IsComponentFocused( EESMRFieldPriority )) |
949 // enable send only if attendee editors contain attendees and |
947 { |
950 // entry does not occur in past. |
948 aMenu->SetItemDimmed( EAknCmdOpen, EFalse ); |
951 TBool bOccursInPast( OccursInPast( iStartTimeUtc ) ); |
949 } |
952 |
950 |
953 TBool sendEnabled = ( !bOccursInPast && |
951 if( iInterimUtils && !(iInterimUtils->MRViewersEnabledL())) |
954 ( mrEntry->RoleL() == EESMRRoleOrganizer ) && |
952 { |
955 ( iRequiredAttendeesEnabled | iOptionalAttendeesEnabled ) && |
953 aMenu->SetItemDimmed( EESMRCmdCalEntryUIAddParticipants, ETrue ); |
956 ((( mrEntry->RoleL() == EESMRRoleOrganizer ) && |
954 } |
957 ( iInfoProvider.PolicyProvider().CurrentPolicy().ViewMode() == EESMREditMR )) || |
|
958 ( iInfoProvider.PolicyProvider().CurrentPolicy().ViewMode() == EESMRForwardMR ) |
|
959 )); |
|
960 } |
955 |
961 |
956 // if the entry is saved (stored) and sent to recipients, |
962 if ( policy.IsDefaultCommand( EESMRCmdSendMR ) ) |
957 // show 'Send update', otherwise just 'Send' |
|
958 TBool sentAndStored = iEntry.IsSentL() && iEntry.IsStoredL(); |
|
959 |
|
960 // enable send only if attendee editors contain attendees and |
|
961 // entry does not occur in past (unless if this is forwarded |
|
962 // MR in which case the "in past" sending is also allowed). |
|
963 TBool occurredInPastCheckPassed( !iOccursInPast ); |
|
964 if ( MESMRCalEntry::EESMRCalEntryMeetingRequest == iEntry.Type() ) |
|
965 { |
|
966 // This is meeting request |
|
967 MESMRMeetingRequestEntry* mrEntry = |
|
968 static_cast<MESMRMeetingRequestEntry*>( &iEntry ); |
|
969 occurredInPastCheckPassed = mrEntry->IsForwardedL(); |
|
970 } |
|
971 |
|
972 TBool sendEnabled = |
|
973 ( iRequiredAttendeesEnabled | iOptionalAttendeesEnabled ) && |
|
974 occurredInPastCheckPassed; |
|
975 |
|
976 if ( iPolicy->IsDefaultCommand( EESMRCmdSendMR ) ) |
|
977 { |
963 { |
978 aMenu->SetItemDimmed ( EESMRCmdSendMR, !sendEnabled ); |
964 aMenu->SetItemDimmed ( EESMRCmdSendMR, !sendEnabled ); |
979 } |
965 } |
980 |
966 |
981 if ( iPolicy->IsDefaultCommand(EESMRCmdSendMRUpdate ) ) |
967 if ( policy.IsDefaultCommand(EESMRCmdSendMRUpdate ) ) |
982 { |
968 { |
983 if ( sendEnabled ) |
969 if ( sendEnabled ) |
984 { |
970 { |
985 //EESMRCmdSendMRUpdate and EESMRCmdSendMR shouldn't |
971 //EESMRCmdSendMRUpdate and EESMRCmdSendMR shouldn't |
986 //be visible at the same time |
972 //be visible at the same time |
987 aMenu->SetItemDimmed( EESMRCmdSendMRUpdate, !sentAndStored ); |
973 aMenu->SetItemDimmed( EESMRCmdSendMRUpdate, !sentAndStored ); |
988 if(iPolicy->IsDefaultCommand( EESMRCmdSendMR ) ) |
974 if( policy.IsDefaultCommand( EESMRCmdSendMR ) ) |
989 { |
975 { |
990 aMenu->SetItemDimmed( EESMRCmdSendMR, sentAndStored ); |
976 aMenu->SetItemDimmed( EESMRCmdSendMR, sentAndStored ); |
991 } |
977 } |
992 } |
978 } |
993 else |
979 else |
994 { |
980 { |
995 aMenu->SetItemDimmed( EESMRCmdSendMRUpdate, ETrue ); |
981 aMenu->SetItemDimmed( EESMRCmdSendMRUpdate, ETrue ); |
996 } |
982 } |
997 } |
983 } |
998 |
984 |
999 if(iPolicy->IsDefaultCommand( EESMRCmdViewTrack ) ) |
985 if ( policy.IsDefaultCommand( EESMRCmdAddOptAttendee ) ) |
1000 { |
|
1001 //only show tracking view option when item is sent, stored |
|
1002 //and when cfsmailbox actually supports attendee status |
|
1003 |
|
1004 if (SupportsAttendeeStatusL()) |
|
1005 { |
|
1006 aMenu->SetItemDimmed( EESMRCmdViewTrack, !sentAndStored ); |
|
1007 } |
|
1008 else |
|
1009 { |
|
1010 aMenu->SetItemDimmed( EESMRCmdViewTrack, ETrue ); |
|
1011 } |
|
1012 |
|
1013 } |
|
1014 |
|
1015 if ( iPolicy->IsDefaultCommand( EESMRCmdAddOptAttendee ) ) |
|
1016 { |
986 { |
1017 // if optional attendee (recipient) is already visible, don't show |
987 // if optional attendee (recipient) is already visible, don't show |
1018 // the menu item. |
988 // the menu item. |
1019 TBool isVisible = |
989 TBool isVisible = |
1020 iView->IsComponentVisible( EESMRFieldOptAttendee ); |
990 iView->IsControlVisible( EESMRFieldOptAttendee ); |
1021 aMenu->SetItemDimmed( EESMRCmdAddOptAttendee, isVisible ); |
991 aMenu->SetItemDimmed( EESMRCmdAddOptAttendee, isVisible ); |
1022 } |
992 } |
1023 |
993 |
|
994 if ( policy.IsDefaultCommand( EESMRCmdViewTrack ) ) |
|
995 { |
|
996 //only show tracking view option when item is sent, stored |
|
997 //and when cfsmailbox actually supports attendee status |
|
998 |
|
999 if ( SupportsMailBoxCapabilityL( |
|
1000 MESMRBuilderExtension::EMRCFSAttendeeStatus ) ) |
|
1001 { |
|
1002 aMenu->SetItemDimmed( EESMRCmdViewTrack, !sentAndStored ); |
|
1003 } |
|
1004 else |
|
1005 { |
|
1006 aMenu->SetItemDimmed( EESMRCmdViewTrack, ETrue ); |
|
1007 } |
|
1008 } |
|
1009 |
1024 // Insert send ui menu for all other entry types than meeting request |
1010 // Insert send ui menu for all other entry types than meeting request |
1025 if ( iEntry.Type ( )!= MESMRCalEntry::EESMRCalEntryMeetingRequest ) |
1011 if ( entry->Type ( )!= MESMRCalEntry::EESMRCalEntryMeetingRequest ) |
1026 { |
1012 { |
1027 TryInsertSendMenuL( aMenu ); |
1013 TryInsertSendMenuL( aMenu ); |
1028 } |
1014 } |
1029 |
1015 } |
1030 if ( FeatureManager::FeatureSupported( |
1016 |
1031 KFeatureIdPrintingFrameworkCalendarPlugin ) ) |
|
1032 { |
|
1033 // Initiliaze menu |
|
1034 iServiceHandler->InitializeMenuPaneL( |
|
1035 *aMenu, |
|
1036 aResourceId, |
|
1037 EESMRCmdPrint, |
|
1038 iServiceHandler->InParamListL() ); |
|
1039 } |
|
1040 else |
|
1041 { |
|
1042 aMenu->SetItemDimmed( EESMRCmdPrint, ETrue ); |
|
1043 } |
|
1044 |
|
1045 HandleLocationOptionsL( aResourceId, aMenu ); |
|
1046 } |
|
1047 |
|
1048 if ( aResourceId == R_LOCATION_OPTIONS |
1017 if ( aResourceId == R_LOCATION_OPTIONS |
1049 || aResourceId == R_MR_EDITOR_LOCATION_MENU |
1018 || aResourceId == R_MR_EDITOR_LOCATION_MENU |
1050 || aResourceId == R_MR_VIEWER_LOCATION_MENU ) |
1019 || aResourceId == R_MR_VIEWER_LOCATION_MENU ) |
1051 { |
1020 { |
|
1021 menuStyle = EMRContextMenu; |
1052 HandleLocationOptionsL( aResourceId, aMenu ); |
1022 HandleLocationOptionsL( aResourceId, aMenu ); |
1053 } |
1023 } |
|
1024 if ( aResourceId == R_MR_EDITOR_ATTACHMENT_CONTEXT_MENU |
|
1025 || aResourceId == R_MR_EDITOR_ATTENDEE_CONTEXT_MENU ) |
|
1026 { |
|
1027 menuStyle = EMRContextMenu; |
|
1028 } |
|
1029 |
|
1030 // Field specific context menu |
|
1031 iView->DynInitMenuPaneL( menuStyle, aResourceId, aMenu ); |
1054 } |
1032 } |
1055 |
1033 |
1056 // --------------------------------------------------------------------------- |
1034 // --------------------------------------------------------------------------- |
1057 // CESMREditorDialog::SupportsAttendeeStatusL |
1035 // CESMREditorDialog::SupportsAttendeeStatusL |
1058 // --------------------------------------------------------------------------- |
1036 // --------------------------------------------------------------------------- |
1059 // |
1037 // |
1060 TBool CESMREditorDialog::SupportsAttendeeStatusL( ) |
1038 TBool CESMREditorDialog::SupportsMailBoxCapabilityL( |
1061 { |
1039 MESMRBuilderExtension::TMRCFSMailBoxCapability aCapa ) |
1062 FUNC_LOG; |
1040 { |
1063 TBool supportsAttendeeStatus(EFalse); |
1041 FUNC_LOG; |
|
1042 TBool supportsCapability( EFalse ); |
1064 CESMRFieldBuilderInterface* plugin = NULL; |
1043 CESMRFieldBuilderInterface* plugin = NULL; |
1065 TRAPD( error, |
1044 TRAPD( error, |
1066 plugin = CESMRFieldBuilderInterface::CreatePluginL( |
1045 plugin = CESMRFieldBuilderInterface::CreatePluginL( |
1067 TUid::Uid(KESMRUIFieldBuilderPluginImplUId) ) ); |
1046 TUid::Uid( KESMRUIFieldBuilderPluginImplUId ) ) ); |
1068 CleanupStack::PushL( plugin ); |
1047 CleanupStack::PushL( plugin ); |
1069 |
1048 |
1070 if (error == KErrNone && plugin) |
1049 if ( error == KErrNone && plugin ) |
1071 { |
1050 { |
1072 TUid uid = {0}; |
1051 TUid uid = {0}; |
1073 MESMRBuilderExtension* extension = |
1052 MESMRBuilderExtension* extension = |
1074 static_cast<MESMRBuilderExtension*>( plugin->ExtensionL(uid) ); |
1053 static_cast<MESMRBuilderExtension*>( plugin->ExtensionL( uid ) ); |
1075 |
1054 |
1076 if (extension) |
1055 if ( extension ) |
1077 { |
1056 { |
1078 supportsAttendeeStatus = |
1057 supportsCapability = |
1079 extension->CFSMailBoxCapabilityL( |
1058 extension->CFSMailBoxCapabilityL( aCapa ); |
1080 MESMRBuilderExtension::EMRCFSAttendeeStatus); |
|
1081 } |
1059 } |
1082 } |
1060 } |
1083 |
1061 |
1084 CleanupStack::PopAndDestroy( plugin ); |
1062 CleanupStack::PopAndDestroy( plugin ); |
1085 |
1063 |
1086 return supportsAttendeeStatus; |
1064 return supportsCapability; |
1087 } |
1065 } |
1088 |
|
1089 |
1066 |
1090 // --------------------------------------------------------------------------- |
1067 // --------------------------------------------------------------------------- |
1091 // CESMREditorDialog::ExecuteViewLD |
1068 // CESMREditorDialog::ExecuteViewLD |
1092 // --------------------------------------------------------------------------- |
1069 // --------------------------------------------------------------------------- |
1093 // |
1070 // |
1132 // |
1109 // |
1133 TInt CESMREditorDialog::HandleExitL() // codescanner::intleaves |
1110 TInt CESMREditorDialog::HandleExitL() // codescanner::intleaves |
1134 { |
1111 { |
1135 FUNC_LOG; |
1112 FUNC_LOG; |
1136 TInt res( KErrNone); |
1113 TInt res( KErrNone); |
1137 |
1114 |
1138 iView->ExternalizeL(); // no force validation |
1115 iView->ExternalizeL(); // no force validation |
1139 TBool isStored = iEntry.IsStoredL(); |
1116 |
1140 |
1117 // If no attendees, switch MR to regular meeting |
1141 if ( iEntry.IsEntryEditedL() ) |
1118 VerifyMeetingRequestL(); |
1142 { |
1119 |
1143 if ( IsAllowedToSaveL() ) |
1120 // Get the entry to be confirmed for saving |
|
1121 MESMRCalEntry* entry = iInfoProvider.EntryL(); |
|
1122 |
|
1123 // if entry is stored and type changed, we will always save it |
|
1124 if( entry->IsStoredL() && entry->IsEntryTypeChangedL() ) |
|
1125 { |
|
1126 res = TryToSaveEntryL(); |
|
1127 } |
|
1128 // If entry is new and type changed, we have to see, if something has |
|
1129 // changed, before we save it. |
|
1130 else if( !entry->IsStoredL() && entry->IsEntryTypeChangedL() ) |
|
1131 { |
|
1132 if( entry->IsEntryEditedL() ) |
|
1133 { |
|
1134 res = TryToSaveEntryL(); |
|
1135 } |
|
1136 } |
|
1137 // Entry is not type changed, we will use normal procedure to |
|
1138 // see if entry will be saved or not. |
|
1139 else |
|
1140 { |
|
1141 if( entry->IsEntryEditedL() ) |
|
1142 { |
|
1143 res = TryToSaveEntryL(); |
|
1144 } |
|
1145 } |
|
1146 |
|
1147 return res; |
|
1148 } |
|
1149 |
|
1150 // --------------------------------------------------------------------------- |
|
1151 // CESMREditorDialog::HandleForcedExitL |
|
1152 // --------------------------------------------------------------------------- |
|
1153 // |
|
1154 TInt CESMREditorDialog::HandleForcedExitL( TBool aShowConfirmationQuery ) // codescanner::intleaves |
|
1155 { |
|
1156 FUNC_LOG; |
|
1157 |
|
1158 MESMRCalEntry* entry = iInfoProvider.EntryL(); |
|
1159 |
|
1160 TInt res( KErrNone); |
|
1161 |
|
1162 iView->ExternalizeL ( ETrue ); // force validation should be used |
|
1163 |
|
1164 // If no attendees, switch MR to regular meeting |
|
1165 VerifyMeetingRequestL(); |
|
1166 |
|
1167 // The entry data may be changed by the above function VerifyMeetingRequestL() |
|
1168 entry = iInfoProvider.EntryL(); |
|
1169 |
|
1170 if ( entry->IsEntryEditedL() ) |
|
1171 { |
|
1172 if ( !aShowConfirmationQuery || |
|
1173 CESMRConfirmationQuery::ExecuteL( |
|
1174 CESMRConfirmationQuery::EESMRSaveChanges )) |
1144 { |
1175 { |
1145 res = iCallback.ProcessCommandWithResultL( EESMRCmdSaveMR ); |
1176 res = iCallback.ProcessCommandWithResultL( EESMRCmdSaveMR ); |
1146 |
1177 |
1147 if ( res == KErrNone |
1178 if ( res == KErrNone |
1148 && iFeatures->FeatureSupported( |
1179 && iFeatures->FeatureSupported( |
1149 CESMRFeatureSettings::EESMRUIPreviousLocationsList ) ) |
1180 CESMRFeatureSettings::EESMRUIPreviousLocationsList ) ) |
1150 { |
1181 { |
1151 LocationPluginHandlerL().StoreLocationToHistoryL( iEntry ); |
1182 LocationPluginHandlerL().StoreLocationToHistoryL( *entry ); |
1152 } |
1183 } |
1153 } |
1184 } |
1154 else |
1185 } |
1155 { |
1186 |
1156 res = KErrCancel; |
|
1157 } |
|
1158 } |
|
1159 return res; |
|
1160 } |
|
1161 |
|
1162 // --------------------------------------------------------------------------- |
|
1163 // CESMREditorDialog::HandleForcedExitL |
|
1164 // --------------------------------------------------------------------------- |
|
1165 // |
|
1166 TInt CESMREditorDialog::HandleForcedExitL( TBool aShowConfirmationQuery ) // codescanner::intleaves |
|
1167 { |
|
1168 FUNC_LOG; |
|
1169 TInt res( KErrNone); |
|
1170 |
|
1171 iView->ExternalizeL ( ETrue ); // force validation should be used |
|
1172 |
|
1173 if ( iEntry.IsEntryEditedL() && |
|
1174 iEntry.Type() == MESMRCalEntry::EESMRCalEntryMeetingRequest) |
|
1175 { |
|
1176 if ( !aShowConfirmationQuery || |
|
1177 CESMRConfirmationQuery::ExecuteL( |
|
1178 CESMRConfirmationQuery::EESMRSaveChanges )) |
|
1179 { |
|
1180 res = iCallback.ProcessCommandWithResultL( EESMRCmdSaveMR ); |
|
1181 |
|
1182 if ( res == KErrNone |
|
1183 && iFeatures->FeatureSupported( |
|
1184 CESMRFeatureSettings::EESMRUIPreviousLocationsList ) ) |
|
1185 { |
|
1186 LocationPluginHandlerL().StoreLocationToHistoryL( iEntry ); |
|
1187 } |
|
1188 } |
|
1189 } |
|
1190 return res; |
1187 return res; |
1191 } |
1188 } |
1192 |
1189 |
1193 // --------------------------------------------------------------------------- |
1190 // --------------------------------------------------------------------------- |
1194 // CESMREditorDialog::SendCalendarEntryL |
1191 // CESMREditorDialog::SendCalendarEntryL |
1244 index++; |
1244 index++; |
1245 iESMRSendUI->DisplaySendMenuItemL(*aMenuPane, index); |
1245 iESMRSendUI->DisplaySendMenuItemL(*aMenuPane, index); |
1246 } |
1246 } |
1247 |
1247 |
1248 // --------------------------------------------------------------------------- |
1248 // --------------------------------------------------------------------------- |
1249 // CESMREditorDialog::HandlePrintCommandL |
|
1250 // --------------------------------------------------------------------------- |
|
1251 // |
|
1252 void CESMREditorDialog::HandlePrintCommandL( |
|
1253 TInt aCommand ) |
|
1254 { |
|
1255 FUNC_LOG; |
|
1256 CAiwGenericParamList& inParams = iServiceHandler->InParamListL ( ); |
|
1257 |
|
1258 // Param date |
|
1259 |
|
1260 TCalTime startTime = iEntry.Entry().StartTimeL ( ); |
|
1261 |
|
1262 TAiwGenericParam dateParam( EGenericParamDateTime); |
|
1263 TTime activeDay = startTime.TimeUtcL ( ); |
|
1264 |
|
1265 TAiwGenericParam calendarParam( EGenericParamCalendarItem); |
|
1266 calendarParam.Value().Set ( TUid::Uid (iEntry.Entry().LocalUidL ( ) ) ); |
|
1267 inParams.AppendL ( calendarParam ); |
|
1268 |
|
1269 // Append date param |
|
1270 dateParam.Value().Set ( activeDay ); |
|
1271 inParams.AppendL ( dateParam ); |
|
1272 |
|
1273 const TUid uid( TUid::Uid( KUidCalendarApplication ) ); |
|
1274 TAiwGenericParam uidParam( EGenericParamApplication); |
|
1275 uidParam.Value().Set ( uid ); |
|
1276 inParams.AppendL ( uidParam ); |
|
1277 |
|
1278 // Execute service command with given parameters |
|
1279 iServiceHandler->ExecuteMenuCmdL ( aCommand, |
|
1280 inParams, iServiceHandler->OutParamListL ( ), 0, |
|
1281 NULL ); |
|
1282 } |
|
1283 |
|
1284 // --------------------------------------------------------------------------- |
|
1285 // CESMREditorDialog::HandleOpenCmdL |
1249 // CESMREditorDialog::HandleOpenCmdL |
1286 // --------------------------------------------------------------------------- |
1250 // --------------------------------------------------------------------------- |
1287 // |
1251 // |
1288 void CESMREditorDialog::HandleOpenCmdL() |
1252 void CESMREditorDialog::HandleOpenCmdL() |
1289 { |
1253 { |
1290 FUNC_LOG; |
1254 FUNC_LOG; |
1291 iView->ProcessEditorCommandL( EAknCmdOpen ); |
1255 iView->ProcessEditorCommandL( EAknCmdOpen ); |
1292 } |
1256 } |
1293 |
1257 |
1294 // --------------------------------------------------------------------------- |
1258 // --------------------------------------------------------------------------- |
1295 // CESMREditorDialog::HandleLocationOptionsL |
1259 // CESMREditorDialog::HandleLocationOptionsL |
1296 // --------------------------------------------------------------------------- |
1260 // --------------------------------------------------------------------------- |
1297 // |
1261 // |
1298 void CESMREditorDialog::HandleLocationOptionsL( TInt aResourceId, |
1262 void CESMREditorDialog::HandleLocationOptionsL( TInt aResourceId, |
1299 CEikMenuPane* aMenuPane ) |
1263 CEikMenuPane* aMenuPane ) |
1300 { |
1264 { |
1301 FUNC_LOG; |
1265 FUNC_LOG; |
1302 TInt menuPos = KErrNotFound; |
1266 |
1303 |
1267 MESMRCalEntry* entry = iInfoProvider.EntryL(); |
1304 if ( aResourceId == R_MR_EDITOR_ORGANIZER_MENU ) |
1268 |
1305 { |
|
1306 |
|
1307 if ( FeatureManager::FeatureSupported( KFeatureIdFfCmailIntegration ) ) |
|
1308 { |
|
1309 // remove help support in pf5250 |
|
1310 aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue); |
|
1311 } |
|
1312 |
|
1313 if ( iPolicy->FieldL( EESMRFieldLocation ).iFieldMode == EESMRFieldModeView ) |
|
1314 { |
|
1315 // Dim Location cascade menu with viewer field |
|
1316 aMenuPane->SetItemDimmed( EESMRCmdAddLocation, ETrue ); |
|
1317 |
|
1318 if ( iFeatures->FeatureSupported( |
|
1319 CESMRFeatureSettings::EESMRUIMnFwIntegration ) ) |
|
1320 { |
|
1321 TBool showOnMap = |
|
1322 LocationPluginHandlerL().IsCommandAvailableL( EESMRCmdShowOnMap, |
|
1323 iEntry ); |
|
1324 aMenuPane->SetItemDimmed( EESMRCmdShowOnMap, !showOnMap ); |
|
1325 aMenuPane->SetItemDimmed( EESMRCmdSearchFromMap, showOnMap ); |
|
1326 } |
|
1327 } |
|
1328 else if ( aMenuPane->MenuItemExists( EESMRCmdAddLocation, menuPos ) ) |
|
1329 { |
|
1330 TInt numOptions = 0; // number of sub menu items |
|
1331 TInt commandId = 0; // command id if only one sub menu item |
|
1332 |
|
1333 if ( iFeatures->FeatureSupported( |
|
1334 CESMRFeatureSettings::EESMRUIMnFwIntegration ) ) |
|
1335 { |
|
1336 ++numOptions; |
|
1337 commandId = EESMRCmdAssignFromMap; |
|
1338 } |
|
1339 |
|
1340 if ( iFeatures->FeatureSupported( |
|
1341 CESMRFeatureSettings::EESMRUIContactsIntegration ) ) |
|
1342 { |
|
1343 ++numOptions; |
|
1344 commandId = EESMRCmdSearchFromContacts; |
|
1345 } |
|
1346 |
|
1347 if ( iFeatures->FeatureSupported( |
|
1348 CESMRFeatureSettings::EESMRUILandmarksIntegration) ) |
|
1349 { |
|
1350 ++numOptions; |
|
1351 commandId = EESMRCmdLandmarks; |
|
1352 } |
|
1353 |
|
1354 if ( iFeatures->FeatureSupported( |
|
1355 CESMRFeatureSettings::EESMRUIPreviousLocationsList ) ) |
|
1356 { |
|
1357 ++numOptions; |
|
1358 commandId = EESMRCmdPreviousLocations; |
|
1359 } |
|
1360 |
|
1361 |
|
1362 |
|
1363 if ( numOptions == 0 ) |
|
1364 { |
|
1365 // Delete whole sub menu |
|
1366 aMenuPane->DeleteMenuItem( EESMRCmdAddLocation ); |
|
1367 } |
|
1368 else if ( numOptions == 1 ) |
|
1369 { |
|
1370 // Replace submenu with available command |
|
1371 aMenuPane->DeleteMenuItem( EESMRCmdAddLocation ); |
|
1372 |
|
1373 // Insert new menu item |
|
1374 HBufC* text = LoadOptionsMenuTextLC( commandId ); |
|
1375 CEikMenuPaneItem::SData menuItem; |
|
1376 menuItem.iCommandId = commandId; |
|
1377 menuItem.iCascadeId = 0; |
|
1378 menuItem.iFlags = 0; |
|
1379 menuItem.iText = *text; |
|
1380 CleanupStack::PopAndDestroy( text ); |
|
1381 aMenuPane->InsertMenuItemL( menuItem, menuPos ); |
|
1382 } |
|
1383 } |
|
1384 else if ( aMenuPane->MenuItemExists( EESMRCmdPreviousLocations, menuPos ) |
|
1385 && !LocationPluginHandlerL().IsCommandAvailableL( |
|
1386 EESMRCmdPreviousLocations, iEntry ) ) |
|
1387 { |
|
1388 // No items in location history. Dim item. |
|
1389 aMenuPane->SetItemDimmed( EESMRCmdPreviousLocations, ETrue ); |
|
1390 } |
|
1391 } |
|
1392 |
|
1393 if ( aResourceId == R_LOCATION_OPTIONS |
|
1394 || aResourceId == R_MR_EDITOR_LOCATION_MENU ) |
|
1395 { |
|
1396 TBool assignFromMap = iFeatures->FeatureSupported( |
|
1397 CESMRFeatureSettings::EESMRUIMnFwIntegration ); |
|
1398 aMenuPane->SetItemDimmed( EESMRCmdAssignFromMap, !assignFromMap ); |
|
1399 |
|
1400 TBool searchFromContacts = iFeatures->FeatureSupported( |
|
1401 CESMRFeatureSettings::EESMRUIContactsIntegration ); |
|
1402 aMenuPane->SetItemDimmed( EESMRCmdSearchFromContacts, |
|
1403 !searchFromContacts ); |
|
1404 |
|
1405 TBool landmarks = iFeatures->FeatureSupported( |
|
1406 CESMRFeatureSettings::EESMRUILandmarksIntegration ); |
|
1407 aMenuPane->SetItemDimmed( EESMRCmdLandmarks, |
|
1408 !landmarks ); |
|
1409 |
|
1410 TBool previousLocations = iFeatures->FeatureSupported( |
|
1411 CESMRFeatureSettings::EESMRUIPreviousLocationsList ); |
|
1412 if ( previousLocations |
|
1413 && !LocationPluginHandlerL().IsCommandAvailableL( |
|
1414 EESMRCmdPreviousLocations, iEntry ) ) |
|
1415 { |
|
1416 // No items in history. Dim option. |
|
1417 previousLocations = EFalse; |
|
1418 } |
|
1419 aMenuPane->SetItemDimmed( EESMRCmdPreviousLocations, |
|
1420 !previousLocations ); |
|
1421 } |
|
1422 |
|
1423 if ( aResourceId == R_MR_VIEWER_LOCATION_MENU ) |
1269 if ( aResourceId == R_MR_VIEWER_LOCATION_MENU ) |
1424 { |
1270 { |
1425 TBool showOnMap = |
1271 TBool showOnMap = EFalse; |
1426 LocationPluginHandlerL().IsCommandAvailableL( EESMRCmdShowOnMap, |
1272 TBool searchFromMap = EFalse; |
1427 iEntry ); |
1273 |
1428 |
1274 if ( iFeatures->FeatureSupported( |
|
1275 CESMRFeatureSettings::EESMRUIMnFwIntegration ) ) |
|
1276 { |
|
1277 showOnMap = LocationPluginHandlerL().IsCommandAvailableL( |
|
1278 EESMRCmdShowOnMap, |
|
1279 *entry ); |
|
1280 searchFromMap = !showOnMap; |
|
1281 } |
|
1282 |
1429 aMenuPane->SetItemDimmed( EESMRCmdShowOnMap, !showOnMap ); |
1283 aMenuPane->SetItemDimmed( EESMRCmdShowOnMap, !showOnMap ); |
1430 aMenuPane->SetItemDimmed( EESMRCmdSearchFromMap, showOnMap ); |
1284 aMenuPane->SetItemDimmed( EESMRCmdSearchFromMap, !searchFromMap ); |
1431 |
1285 |
|
1286 const CESMRPolicy& policy = Policy(); |
1432 aMenuPane->SetItemDimmed( EESMRCmdEdit, |
1287 aMenuPane->SetItemDimmed( EESMRCmdEdit, |
1433 !iPolicy->IsDefaultCommand( EESMRCmdEdit ) ); |
1288 !policy.IsDefaultCommand( EESMRCmdEdit ) ); |
1434 aMenuPane->SetItemDimmed( EESMRCmdEditLocal, |
1289 aMenuPane->SetItemDimmed( EESMRCmdEditLocal, |
1435 !iPolicy->IsDefaultCommand( EESMRCmdEditLocal ) ); |
1290 !policy.IsDefaultCommand( EESMRCmdEditLocal ) ); |
1436 aMenuPane->SetItemDimmed( EESMRCmdCalEntryUIEdit, |
1291 aMenuPane->SetItemDimmed( EESMRCmdCalEntryUIEdit, |
1437 !iPolicy->IsDefaultCommand( EESMRCmdCalEntryUIEdit ) ); |
1292 !policy.IsDefaultCommand( EESMRCmdCalEntryUIEdit ) ); |
1438 } |
1293 } |
1439 } |
|
1440 |
|
1441 // --------------------------------------------------------------------------- |
|
1442 // CESMREditorDialog::LoadOptionsMenuTextLC |
|
1443 // --------------------------------------------------------------------------- |
|
1444 // |
|
1445 HBufC* CESMREditorDialog::LoadOptionsMenuTextLC( TInt aCommandId ) |
|
1446 { |
|
1447 FUNC_LOG; |
|
1448 TInt resourceId = 0; |
|
1449 |
|
1450 switch ( aCommandId ) |
|
1451 { |
|
1452 case EESMRCmdAssignFromMap: |
|
1453 { |
|
1454 resourceId = R_MEET_REQ_OPTIONS_ASSIGN_FROM_MAP; |
|
1455 break; |
|
1456 } |
|
1457 case EESMRCmdSearchFromContacts: |
|
1458 { |
|
1459 resourceId = R_MEET_REQ_OPTIONS_SEARCH_FROM_CONTACTS; |
|
1460 break; |
|
1461 } |
|
1462 case EESMRCmdPreviousLocations: |
|
1463 { |
|
1464 resourceId = R_MEET_REQ_OPTIONS_PREVIOUS_LOCATIONS; |
|
1465 break; |
|
1466 } |
|
1467 case EESMRCmdLandmarks: |
|
1468 { |
|
1469 resourceId = R_MEET_REQ_OPTIONS_LANDMARKS; |
|
1470 break; |
|
1471 } |
|
1472 default: |
|
1473 { |
|
1474 User::Leave( KErrArgument ); |
|
1475 } |
|
1476 } |
|
1477 |
|
1478 HBufC* text = StringLoader::LoadLC( resourceId, iCoeEnv ); |
|
1479 return text; |
|
1480 } |
1294 } |
1481 |
1295 |
1482 // --------------------------------------------------------------------------- |
1296 // --------------------------------------------------------------------------- |
1483 // CESMREditorDialog::LocationPluginHandlerL |
1297 // CESMREditorDialog::LocationPluginHandlerL |
1484 // --------------------------------------------------------------------------- |
1298 // --------------------------------------------------------------------------- |
1567 iOptionalAttendeesEnabled = EFalse; |
1382 iOptionalAttendeesEnabled = EFalse; |
1568 break; |
1383 break; |
1569 } |
1384 } |
1570 case EESMRCmdRestoreMiddleSoftKey: |
1385 case EESMRCmdRestoreMiddleSoftKey: |
1571 { |
1386 { |
1572 CEikButtonGroupContainer& cba = ButtonGroupContainer(); |
1387 iContextMenuResourceId = 0; |
1573 |
1388 |
1574 if ( iPolicy->FieldL( iView->FocusedField() ).iFieldMode |
1389 if ( Policy().FieldL( |
1575 == EESMRFieldModeView ) |
1390 iView->FocusedField() ).iFieldMode == EESMRFieldModeView ) |
1576 { |
1391 { |
1577 // Dim default MSK if editor contains viewer fields |
1392 // Dim default MSK if editor contains viewer fields |
1578 cba.MakeCommandVisibleByPosition( |
1393 cba.MakeCommandVisibleByPosition( |
1579 CEikButtonGroupContainer::EMiddleSoftkeyPosition, |
1394 CEikButtonGroupContainer::EMiddleSoftkeyPosition, |
1580 EFalse ); |
1395 EFalse ); |
1581 } |
1396 } |
1582 else |
1397 else |
1583 { |
1398 { |
1584 cba.SetCommandL( |
1399 cba.SetCommandL( |
1585 CEikButtonGroupContainer::EMiddleSoftkeyPosition, |
1400 CEikButtonGroupContainer::EMiddleSoftkeyPosition, |
1586 R_MR_SELECT_SOFTKEY ); |
1401 R_MR_SELECT_SOFTKEY ); |
1587 |
1402 |
1588 cba.MakeCommandVisibleByPosition( |
1403 cba.MakeCommandVisibleByPosition( |
1589 CEikButtonGroupContainer::EMiddleSoftkeyPosition, |
1404 CEikButtonGroupContainer::EMiddleSoftkeyPosition, |
1590 ETrue ); |
1405 ETrue ); |
1591 cba.DrawDeferred(); |
1406 cba.DrawDeferred(); |
1592 } |
1407 } |
1593 } |
1408 } |
1594 break; |
1409 break; |
1595 case EESMRCmdSizeExceeded: |
1410 case EESMRCmdSizeExceeded: |
1596 iView->ProcessEditorCommandL( *command ); |
1411 iView->ProcessEditorCommandL( *command ); |
1597 break; |
1412 break; |
|
1413 |
|
1414 case EMRCommandSwitchToMR: |
|
1415 case EMRCommandSwitchToMeeting: |
|
1416 case EMRCommandSwitchToMemo: |
|
1417 case EMRCommandSwitchToAnniversary: |
|
1418 case EMRCommandSwitchToTodo: |
|
1419 { |
|
1420 TRAPD( err, SwitchEntryTypeL( *command, ETrue ) ) |
|
1421 |
|
1422 if (KErrArgument == err ) |
|
1423 { |
|
1424 // There was validation error --> Just show the |
|
1425 // existing editor. |
|
1426 err = KErrNone; |
|
1427 } |
|
1428 else if ( err ) |
|
1429 { |
|
1430 // UI and engine not consistent. Show error and exit |
|
1431 iCoeEnv->HandleError( err ); |
|
1432 TryExitL( EESMRCmdForceExit ); |
|
1433 } |
|
1434 |
|
1435 break; |
|
1436 } |
|
1437 case EESMRCmdLongtapDetected: |
|
1438 { |
|
1439 OkToExitL(EESMRCmdLongtapDetected); |
|
1440 break; |
|
1441 } |
|
1442 case EMRLaunchAttachmentContextMenu: |
|
1443 case EAknSoftkeyContextOptions: |
|
1444 { |
|
1445 OkToExitL( EAknSoftkeyContextOptions ); |
|
1446 break; |
|
1447 } |
|
1448 case EESMRCmdCalendarChange: |
|
1449 { |
|
1450 DrawDeferred(); |
|
1451 break; |
|
1452 } |
|
1453 case EESMRCmdAssignFromMap: |
|
1454 case EMRCommandMyLocations: |
|
1455 { |
|
1456 DoProcessCommandL( *command ); |
|
1457 break; |
|
1458 } |
1598 default: |
1459 default: |
1599 { |
1460 { |
1600 break; |
1461 break; |
1601 } |
1462 } |
1602 } |
1463 } |
1603 } |
1464 |
1604 |
1465 |
|
1466 MESMRCalEntry* entry = iInfoProvider.EntryL(); |
|
1467 if ( entry->Type() == MESMRCalEntry::EESMRCalEntryMeetingRequest ) |
|
1468 { |
|
1469 MESMRMeetingRequestEntry* mrEntry = |
|
1470 static_cast<MESMRMeetingRequestEntry*>( iInfoProvider.EntryL() ); |
|
1471 |
|
1472 TBool bOccursInPast( OccursInPast( iStartTimeUtc ) ); |
|
1473 |
|
1474 TBool sendEnabled = ( !bOccursInPast && |
|
1475 ( mrEntry->RoleL() == EESMRRoleOrganizer || mrEntry->IsForwardedL() ) && |
|
1476 ( iRequiredAttendeesEnabled | iOptionalAttendeesEnabled ) && |
|
1477 (( ( iInfoProvider.PolicyProvider().CurrentPolicy().ViewMode() == EESMREditMR )) || |
|
1478 ( iInfoProvider.PolicyProvider().CurrentPolicy().ViewMode() == EESMRForwardMR ) |
|
1479 )); |
|
1480 |
|
1481 if( sendEnabled ) |
|
1482 { |
|
1483 cba.SetCommandL( |
|
1484 CEikButtonGroupContainer::ERightSoftkeyPosition, |
|
1485 R_MR_SEND_SOFTKEY); |
|
1486 cba.MakeCommandVisibleByPosition( |
|
1487 CEikButtonGroupContainer::ERightSoftkeyPosition, |
|
1488 ETrue ); |
|
1489 cba.DrawDeferred(); |
|
1490 } |
|
1491 else |
|
1492 { |
|
1493 cba.SetCommandL( |
|
1494 CEikButtonGroupContainer::ERightSoftkeyPosition, |
|
1495 R_MR_DONE_SOFTKEY); |
|
1496 cba.MakeCommandVisibleByPosition( |
|
1497 CEikButtonGroupContainer::ERightSoftkeyPosition, |
|
1498 ETrue ); |
|
1499 cba.DrawDeferred(); |
|
1500 } |
|
1501 } |
|
1502 else |
|
1503 { |
|
1504 cba.SetCommandL( |
|
1505 CEikButtonGroupContainer::ERightSoftkeyPosition, |
|
1506 R_MR_DONE_SOFTKEY); |
|
1507 cba.MakeCommandVisibleByPosition( |
|
1508 CEikButtonGroupContainer::ERightSoftkeyPosition, |
|
1509 ETrue ); |
|
1510 cba.DrawDeferred(); |
|
1511 } |
|
1512 } |
|
1513 |
1605 // --------------------------------------------------------------------------- |
1514 // --------------------------------------------------------------------------- |
1606 // CESMREditorDialog::HandleFieldChangeEventL |
1515 // CESMREditorDialog::HandleFieldChangeEventL |
1607 // --------------------------------------------------------------------------- |
1516 // --------------------------------------------------------------------------- |
1608 // |
1517 // |
1609 void CESMREditorDialog::HandleFieldChangeEventL( |
1518 void CESMREditorDialog::HandleFieldChangeEventL( |
1610 const MESMRFieldEvent& aEvent ) |
1519 const MESMRFieldEvent& aEvent ) |
1611 { |
1520 { |
1612 FUNC_LOG; |
1521 FUNC_LOG; |
|
1522 |
1613 TInt* fieldId = static_cast< TInt* >( aEvent.Param( 0 ) ); |
1523 TInt* fieldId = static_cast< TInt* >( aEvent.Param( 0 ) ); |
|
1524 MESMRCalEntry* entry = iInfoProvider.EntryL(); |
|
1525 |
1614 switch ( *fieldId ) |
1526 switch ( *fieldId ) |
1615 { |
1527 { |
1616 case EESMRFieldLocation: |
1528 case EESMRFieldLocation: |
1617 { |
1529 { |
1618 MESMRFieldEventValue* value = |
1530 MESMRFieldEventValue* value = |
1619 static_cast< MESMRFieldEventValue* >( aEvent.Param( 1 ) ); |
1531 static_cast< MESMRFieldEventValue* >( aEvent.Param( 1 ) ); |
1620 if ( iEntry.Entry().LocationL() != value->StringValue() ) |
1532 if ( entry->Entry().LocationL() != value->StringValue() ) |
1621 { |
1533 { |
1622 // Show query dialog only if entry has geocoordinates. |
1534 // Show query dialog only if entry has geocoordinates. |
1623 // It can be verified by checking if "Show on map" is available |
1535 // It can be verified by checking if "Show on map" is available |
1624 // for iEntry as geocoordinates are required for that. |
1536 // for iEntry as geocoordinates are required for that. |
1625 TBool enableQuery = |
1537 TBool enableQuery = |
1626 LocationPluginHandlerL().IsCommandAvailableL( |
1538 LocationPluginHandlerL().IsCommandAvailableL( |
1627 EESMRCmdShowOnMap, iEntry ); |
1539 EESMRCmdShowOnMap, *entry ); |
1628 |
1540 |
1629 if ( enableQuery |
1541 if ( enableQuery |
1630 && CESMRConfirmationQuery::ExecuteL( |
1542 && CESMRConfirmationQuery::ExecuteL( |
1631 CESMRConfirmationQuery::EESMRAssignUpdatedLocation ) ) |
1543 CESMRConfirmationQuery::EESMRAssignUpdatedLocation ) ) |
1632 { |
1544 { |
1633 HBufC* oldLocation = iEntry.Entry().LocationL().AllocLC(); |
1545 HBufC* oldLocation = entry->Entry().LocationL().AllocLC(); |
1634 iView->ExternalizeL(); |
1546 iView->ExternalizeL(); |
1635 |
1547 |
1636 // if old and new locations are different and old location |
1548 // if old and new locations are different and old location |
1637 // exists, the user is updating existing location. Let's discard |
1549 // exists, the user is updating existing location. Let's discard |
1638 // the existing coordinates by using command EESMRCmdUpdateFromMap |
1550 // the existing coordinates by using command EESMRCmdUpdateFromMap |
1639 if ( iEntry.Entry().LocationL().Compare( *oldLocation ) != 0 && |
1551 if ( entry->Entry().LocationL().Compare( *oldLocation ) != 0 && |
1640 oldLocation->Length() != 0 ) |
1552 oldLocation->Length() != 0 ) |
1641 { |
1553 { |
1642 LocationPluginHandlerL().HandleCommandL( |
1554 LocationPluginHandlerL().HandleCommandL( |
1643 EESMRCmdUpdateFromMap, |
1555 EESMRCmdUpdateFromMap, |
1644 iEntry ); |
1556 *entry ); |
1645 } |
1557 } |
1646 else |
1558 else |
1647 { |
1559 { |
1648 LocationPluginHandlerL().HandleCommandL( |
1560 LocationPluginHandlerL().HandleCommandL( |
1649 EESMRCmdAssignFromMap, |
1561 EESMRCmdAssignFromMap, |
1650 iEntry, |
1562 *entry, |
1651 EFalse ); |
1563 EFalse ); |
1652 } |
1564 } |
1653 |
1565 |
1654 iView->InternalizeL(); |
1566 iView->InternalizeL(); |
1655 iView->SetControlFocusedL( EESMRFieldLocation ); |
1567 iView->SetControlFocusedL( EESMRFieldLocation ); |
1656 |
1568 |
1657 CleanupStack::PopAndDestroy( oldLocation ); |
1569 CleanupStack::PopAndDestroy( oldLocation ); |
1658 oldLocation = NULL; |
1570 oldLocation = NULL; |
1659 } |
1571 } |
1660 else if ( enableQuery ) |
1572 else if ( enableQuery ) |
1661 { |
1573 { |
1662 // Externalize entry, so query won't be displayed |
1574 // Externalize entry, so query won't be displayed |
1663 // again for the same text. |
1575 // again for the same text. |
1664 iView->ExternalizeL(); |
1576 iView->ExternalizeL(); |
1665 } |
1577 } |
1666 } |
1578 } |
1667 break; |
1579 break; |
1668 } |
1580 } |
|
1581 |
1669 case EESMRFieldStartDate: |
1582 case EESMRFieldStartDate: |
1670 { |
1583 { |
1671 if ( iEntry.Type() == MESMRCalEntry::EESMRCalEntryMeetingRequest ) |
1584 // for update iStartTimeUtc when meeting & mr event changing start time |
1672 { |
1585 TBool bOccursInPast( OccursInPastL( aEvent ) ); |
1673 MESMRFieldEventValue* value = |
1586 |
1674 static_cast< MESMRFieldEventValue* >( aEvent.Param( 1 ) ); |
1587 if ( entry->Type() == MESMRCalEntry::EESMRCalEntryMeetingRequest ) |
1675 TTime now; |
1588 { |
1676 now.UniversalTime(); |
1589 MESMRMeetingRequestEntry* mrEntry = |
1677 if ( value->TimeValue() < now ) |
1590 static_cast<MESMRMeetingRequestEntry*>( iInfoProvider.EntryL() ); |
|
1591 TBool bIsOrganizer( mrEntry->RoleL() == EESMRRoleOrganizer ); |
|
1592 |
|
1593 ChangeRightSoftkeyL( bOccursInPast, bIsOrganizer ); |
|
1594 } |
|
1595 break; |
|
1596 } |
|
1597 |
|
1598 case EESMRFieldAllDayEvent: |
|
1599 { |
|
1600 TBool bOccursInPast( OccursInPast( iStartTimeUtc ) ); |
|
1601 TInt* bChecked = static_cast< TInt* >( aEvent.Param( 1 ) ); |
|
1602 if( *bChecked == 1 ) |
|
1603 { |
|
1604 TDateTime startTime = iStartTimeUtc.DateTime(); |
|
1605 startTime.SetHour( 0 ); |
|
1606 startTime.SetMinute( 0 ); |
|
1607 startTime.SetSecond( 0 ); |
|
1608 bOccursInPast = OccursInPast( startTime ); |
|
1609 } |
|
1610 |
|
1611 if ( entry->Type() == MESMRCalEntry::EESMRCalEntryMeetingRequest ) |
|
1612 { |
|
1613 MESMRMeetingRequestEntry* mrEntry = |
|
1614 static_cast<MESMRMeetingRequestEntry*>( iInfoProvider.EntryL() ); |
|
1615 TBool bIsOrganizer( mrEntry->RoleL() == EESMRRoleOrganizer ); |
|
1616 |
|
1617 ChangeRightSoftkeyL( bOccursInPast, bIsOrganizer ); |
|
1618 } |
|
1619 break; |
|
1620 } |
|
1621 default: |
|
1622 { |
|
1623 break; |
|
1624 } |
|
1625 } |
|
1626 } |
|
1627 |
|
1628 // --------------------------------------------------------------------------- |
|
1629 // CESMREditorDialog::SetContextMenuL |
|
1630 // --------------------------------------------------------------------------- |
|
1631 // |
|
1632 TBool CESMREditorDialog::SetContextMenuL() |
|
1633 { |
|
1634 FUNC_LOG; |
|
1635 TInt ret( EFalse ); |
|
1636 |
|
1637 TESMREntryFieldId fieldId = iView->ClickedOrFocusedField(); |
|
1638 |
|
1639 switch( fieldId ) |
|
1640 { |
|
1641 case EESMRFieldLocation: |
|
1642 { |
|
1643 ret = ETrue; |
|
1644 |
|
1645 if ( Policy().FieldL( EESMRFieldLocation ).iFieldMode |
|
1646 == EESMRFieldModeEdit ) |
|
1647 { |
|
1648 iContextMenuResourceId = |
|
1649 R_MR_EDITOR_LOCATION_CONTEXT_MENU; |
|
1650 } |
|
1651 else |
|
1652 { |
|
1653 iContextMenuResourceId = |
|
1654 R_MR_VIEWER_CONTEXT_MENU; |
|
1655 } |
|
1656 |
|
1657 if ( !iFeatures->FeatureSupported( |
|
1658 CESMRFeatureSettings::EESMRUIMnFwIntegration ) |
|
1659 && iContextMenuResourceId == R_MR_EDITOR_LOCATION_CONTEXT_MENU ) |
|
1660 { |
|
1661 #ifndef RD_USE_MYLOCATIONUI |
|
1662 // Maps not supported and My Locations UI disabled |
|
1663 ret = EFalse; |
|
1664 #endif //RD_USE_MYLOCATIONUI |
|
1665 } |
|
1666 } |
|
1667 break; |
|
1668 |
|
1669 case EESMRFieldAttachments: |
|
1670 { |
|
1671 if ( Policy().FieldL( |
|
1672 EESMRFieldAttachments ).iFieldMode |
|
1673 == EESMRFieldModeEdit ) |
|
1674 { |
|
1675 iContextMenuResourceId = R_MR_EDITOR_ATTACHMENT_CONTEXT_MENU; |
|
1676 ret = ETrue; |
|
1677 } |
|
1678 } |
|
1679 break; |
|
1680 case EESMRFieldAttendee: |
|
1681 case EESMRFieldOptAttendee: |
|
1682 { |
|
1683 if ( Policy().FieldL( |
|
1684 EESMRFieldAttendee ).iFieldMode == EESMRFieldModeEdit || |
|
1685 Policy().FieldL( |
|
1686 EESMRFieldOptAttendee ).iFieldMode == EESMRFieldModeEdit ) |
|
1687 { |
|
1688 iContextMenuResourceId = R_MR_EDITOR_ATTENDEE_CONTEXT_MENU; |
|
1689 ret = ETrue; |
|
1690 } |
|
1691 } |
|
1692 break; |
|
1693 default: |
|
1694 break; |
|
1695 } |
|
1696 |
|
1697 if ( ret ) |
|
1698 { |
|
1699 iMenuBar->SetContextMenuTitleResourceId( |
|
1700 iContextMenuResourceId ); |
|
1701 } |
|
1702 else |
|
1703 { |
|
1704 iContextMenuResourceId = 0; |
|
1705 } |
|
1706 |
|
1707 return ret; |
|
1708 } |
|
1709 |
|
1710 // --------------------------------------------------------------------------- |
|
1711 // CESMREditorDialog::SwitchEntryTypeL |
|
1712 // --------------------------------------------------------------------------- |
|
1713 // |
|
1714 void CESMREditorDialog::SwitchEntryTypeL( |
|
1715 TInt aCommand, |
|
1716 TBool aAdjustView ) |
|
1717 { |
|
1718 FUNC_LOG; |
|
1719 TBool change( EFalse ); |
|
1720 MESMRCalEntry* entry = iInfoProvider.EntryL(); |
|
1721 |
|
1722 switch ( aCommand ) |
|
1723 { |
|
1724 case EMRCommandSwitchToMR: |
|
1725 { |
|
1726 TBool ret( ETrue ); |
|
1727 |
|
1728 // Show confirmation note if current mailbox does not |
|
1729 // support attachments and attachments exist in the entry |
|
1730 if( entry->Entry().AttachmentCountL() > 0 && |
|
1731 !SupportsMailBoxCapabilityL( |
|
1732 MESMRBuilderExtension:: |
|
1733 EMRCFSSupportsAttachmentsInMR ) ) |
|
1734 { |
|
1735 if ( !CESMRConfirmationQuery::ExecuteL( |
|
1736 CESMRConfirmationQuery:: |
|
1737 EESMRAttachmentsNotSupported ) ) |
1678 { |
1738 { |
1679 // disable send option |
1739 ret = EFalse; |
1680 iOccursInPast = ETrue; |
|
1681 } |
1740 } |
1682 else |
1741 } |
1683 { |
1742 |
1684 iOccursInPast = EFalse; |
1743 if( ret ) |
1685 } |
1744 { |
1686 } |
1745 change = |
|
1746 ( entry->Type() != |
|
1747 MESMRCalEntry::EESMRCalEntryMeetingRequest ); |
|
1748 } |
|
1749 |
|
1750 break; |
|
1751 } |
|
1752 case EMRCommandSwitchToMeeting: |
|
1753 { |
|
1754 change = |
|
1755 ( entry->Type() != MESMRCalEntry::EESMRCalEntryMeeting ); |
|
1756 break; |
|
1757 } |
|
1758 case EMRCommandSwitchToMemo: |
|
1759 { |
|
1760 change = |
|
1761 ( entry->Type() != MESMRCalEntry::EESMRCalEntryMemo ); |
|
1762 break; |
|
1763 } |
|
1764 case EMRCommandSwitchToAnniversary: |
|
1765 { |
|
1766 change = |
|
1767 ( entry->Type() != MESMRCalEntry::EESMRCalEntryAnniversary ); |
|
1768 break; |
|
1769 } |
|
1770 case EMRCommandSwitchToTodo: |
|
1771 { |
|
1772 change = |
|
1773 ( entry->Type() != MESMRCalEntry::EESMRCalEntryTodo); |
1687 break; |
1774 break; |
1688 } |
1775 } |
1689 default: |
1776 default: |
1690 { |
1777 { |
1691 break; |
1778 break; |
1692 } |
1779 } |
1693 } |
1780 } |
|
1781 |
|
1782 if ( change ) |
|
1783 { |
|
1784 iView->ExternalizeL(ETrue); |
|
1785 iStartTimeUtc = entry->Entry().StartTimeL().TimeUtcL(); |
|
1786 iCallback.ProcessCommandL( aCommand ); |
|
1787 |
|
1788 if( aAdjustView ) |
|
1789 { |
|
1790 MESMRCalEntry* entry = iInfoProvider.EntryL(); |
|
1791 iView->AdjustViewL( entry, Policy() ); |
|
1792 SetTitleL(); |
|
1793 } |
|
1794 } |
|
1795 } |
|
1796 |
|
1797 // --------------------------------------------------------------------------- |
|
1798 // CESMREditorDialog::Policy |
|
1799 // --------------------------------------------------------------------------- |
|
1800 // |
|
1801 const CESMRPolicy& CESMREditorDialog::Policy() const |
|
1802 { |
|
1803 FUNC_LOG; |
|
1804 return iInfoProvider.PolicyProvider().CurrentPolicy(); |
|
1805 } |
|
1806 |
|
1807 // --------------------------------------------------------------------------- |
|
1808 // CESMREditorDialog::DynInitToolbarL |
|
1809 // --------------------------------------------------------------------------- |
|
1810 // |
|
1811 void CESMREditorDialog::DynInitToolbarL ( TInt /*aResourceId*/, |
|
1812 CAknToolbar* /*aToolbar*/ ) |
|
1813 { |
|
1814 // TODO: Not implemented yet |
|
1815 } |
|
1816 |
|
1817 // --------------------------------------------------------------------------- |
|
1818 // CESMREditorDialog::OfferToolbarEventL |
|
1819 // --------------------------------------------------------------------------- |
|
1820 // |
|
1821 void CESMREditorDialog::OfferToolbarEventL ( TInt aCommand ) |
|
1822 { |
|
1823 DoProcessCommandL(aCommand); |
|
1824 } |
|
1825 |
|
1826 |
|
1827 // --------------------------------------------------------------------------- |
|
1828 // CESMREditorDialog::SetTitleL |
|
1829 // --------------------------------------------------------------------------- |
|
1830 // |
|
1831 void CESMREditorDialog::SetTitleL () |
|
1832 { |
|
1833 FUNC_LOG; |
|
1834 |
|
1835 MESMRCalEntry* entry = iInfoProvider.EntryL(); |
|
1836 |
|
1837 // Setting title to status pane's title pane |
|
1838 TInt titleStringId = -1; |
|
1839 switch ( entry->Type() ) |
|
1840 { |
|
1841 case MESMRCalEntry::EESMRCalEntryMeetingRequest: |
|
1842 titleStringId = R_QTN_MEET_REQ_TITLE_MEETING; |
|
1843 break; |
|
1844 case MESMRCalEntry::EESMRCalEntryMeeting: |
|
1845 titleStringId = R_QTN_CALENDAR_TITLE_MEETING; |
|
1846 break; |
|
1847 case MESMRCalEntry::EESMRCalEntryTodo: |
|
1848 titleStringId = R_QTN_CALENDAR_TITLE_TODO; |
|
1849 break; |
|
1850 case MESMRCalEntry::EESMRCalEntryMemo: |
|
1851 titleStringId = R_QTN_CALENDAR_TITLE_MEMO; |
|
1852 break; |
|
1853 case MESMRCalEntry::EESMRCalEntryReminder: |
|
1854 break; |
|
1855 case MESMRCalEntry::EESMRCalEntryAnniversary: |
|
1856 titleStringId = R_QTN_CALENDAR_TITLE_ANNIVERSARY; |
|
1857 break; |
|
1858 default: |
|
1859 break; |
|
1860 } |
|
1861 |
|
1862 if ( titleStringId != -1 ) |
|
1863 { |
|
1864 if( !iTitlePane ) |
|
1865 { |
|
1866 iTitlePane = CESMRTitlePaneHandler::NewL( *iEikonEnv ); |
|
1867 } |
|
1868 |
|
1869 HBufC* titleText = StringLoader::LoadLC( titleStringId, iCoeEnv ); |
|
1870 iTitlePane->SetNewTitle( titleText ); |
|
1871 CleanupStack::PopAndDestroy( titleText ); |
|
1872 } |
|
1873 |
|
1874 // If subject does not exist, let's update the title also |
|
1875 // to main window |
|
1876 if( entry->Entry().SummaryL().Length() <= 0 ) |
|
1877 { |
|
1878 HBufC* title ; |
|
1879 switch( entry->Type() ) |
|
1880 { |
|
1881 case MESMRCalEntry::EESMRCalEntryTodo: |
|
1882 { |
|
1883 title = StringLoader::LoadLC ( R_QTN_CALENDAR_TITLE_NEW_TODO ); |
|
1884 break; |
|
1885 } |
|
1886 case MESMRCalEntry::EESMRCalEntryMemo: |
|
1887 { |
|
1888 title = StringLoader::LoadLC ( R_QTN_CALENDAR_TITLE_NEW_MEMO ); |
|
1889 break; |
|
1890 } |
|
1891 case MESMRCalEntry::EESMRCalEntryAnniversary: |
|
1892 { |
|
1893 title = StringLoader::LoadLC(R_QTN_CALENDAR_TITLE_NEW_ANNIVERSARY); |
|
1894 break; |
|
1895 } |
|
1896 case MESMRCalEntry::EESMRCalEntryMeetingRequest: // Fall through |
|
1897 case MESMRCalEntry::EESMRCalEntryMeeting: // Fall through |
|
1898 case MESMRCalEntry::EESMRCalEntryReminder: // Fall through |
|
1899 default: |
|
1900 { |
|
1901 title = StringLoader::LoadLC( R_QTN_MEET_REQ_TITLE ); |
|
1902 break; |
|
1903 } |
|
1904 } |
|
1905 iView->SetTitleL( *title ); |
|
1906 CleanupStack::PopAndDestroy( title ); |
|
1907 } |
|
1908 } |
|
1909 |
|
1910 // --------------------------------------------------------------------------- |
|
1911 // CESMREditorDialog::VerifyMeetingRequestL |
|
1912 // --------------------------------------------------------------------------- |
|
1913 // |
|
1914 void CESMREditorDialog::VerifyMeetingRequestL() |
|
1915 { |
|
1916 FUNC_LOG; |
|
1917 |
|
1918 MESMRCalEntry* entry = iInfoProvider.EntryL(); |
|
1919 |
|
1920 // If entry is meeting request, but no attendees have been added, |
|
1921 // entry is switched to and saved as regular meeting |
|
1922 if( CCalenInterimUtils2::IsMeetingRequestL( entry->Entry() ) ) |
|
1923 { |
|
1924 RPointerArray<CCalAttendee>& attendees( |
|
1925 entry->Entry().AttendeesL() ); |
|
1926 |
|
1927 TInt attendeeCount = attendees.Count(); |
|
1928 |
|
1929 if( ( attendeeCount == 0 ) && |
|
1930 (iInfoProvider.PolicyProvider().CurrentPolicy().ViewMode() != EESMRForwardMR) ) |
|
1931 { |
|
1932 TRAPD( err, SwitchEntryTypeL( EMRCommandSwitchToMeeting, EFalse ) ) |
|
1933 |
|
1934 if ( err ) |
|
1935 { |
|
1936 // UI and engine not consistent. Show error and exit |
|
1937 iCoeEnv->HandleError( err ); |
|
1938 TryExitL( EESMRCmdForceExit ); |
|
1939 } |
|
1940 } |
|
1941 } |
|
1942 } |
|
1943 |
|
1944 // ----------------------------------------------------------------------------- |
|
1945 // CESMREditorDialog::ShowContextMenuL |
|
1946 // ----------------------------------------------------------------------------- |
|
1947 // |
|
1948 void CESMREditorDialog::ShowContextMenuL() |
|
1949 { |
|
1950 FUNC_LOG; |
|
1951 |
|
1952 if ( iMenuBar ) |
|
1953 { |
|
1954 iMenuBar->TryDisplayContextMenuBarL(); |
|
1955 } |
|
1956 } |
|
1957 |
|
1958 |
|
1959 // ----------------------------------------------------------------------------- |
|
1960 // CESMREditorDialog::OccursInPast |
|
1961 // ----------------------------------------------------------------------------- |
|
1962 // |
|
1963 TBool CESMREditorDialog::OccursInPastL( const MESMRFieldEvent& aEvent ) |
|
1964 { |
|
1965 FUNC_LOG; |
|
1966 MESMRFieldEventValue* value = static_cast< MESMRFieldEventValue* >( aEvent.Param( 1) ); |
|
1967 |
|
1968 TCalTime startCalTime; |
|
1969 startCalTime.SetTimeLocalL( value->TimeValue() ); |
|
1970 |
|
1971 iStartTimeUtc = startCalTime.TimeUtcL(); |
|
1972 |
|
1973 return OccursInPast( iStartTimeUtc ); |
|
1974 } |
|
1975 |
|
1976 // ----------------------------------------------------------------------------- |
|
1977 // CESMREditorDialog::OccursInPast |
|
1978 // ----------------------------------------------------------------------------- |
|
1979 // |
|
1980 TBool CESMREditorDialog::OccursInPast( const TTime& aStartUtc ) |
|
1981 { |
|
1982 FUNC_LOG; |
|
1983 TBool bOccursInPast(EFalse); |
|
1984 |
|
1985 TTime now; |
|
1986 now.UniversalTime(); |
|
1987 |
|
1988 if ( aStartUtc < now ) |
|
1989 { |
|
1990 bOccursInPast = ETrue; |
|
1991 } |
|
1992 |
|
1993 return bOccursInPast; |
|
1994 } |
|
1995 |
|
1996 // ----------------------------------------------------------------------------- |
|
1997 // CESMREditorDialog::ChangeRightSoftkeyL |
|
1998 // ----------------------------------------------------------------------------- |
|
1999 // |
|
2000 void CESMREditorDialog::ChangeRightSoftkeyL( TBool aOccursInPast, TBool aIsOrganizer ) |
|
2001 { |
|
2002 FUNC_LOG; |
|
2003 TBool sendEnabled = |
|
2004 ( iRequiredAttendeesEnabled | iOptionalAttendeesEnabled ) && |
|
2005 !aOccursInPast && aIsOrganizer; |
|
2006 |
|
2007 CEikButtonGroupContainer& cba = ButtonGroupContainer(); |
|
2008 |
|
2009 if( sendEnabled ) |
|
2010 { |
|
2011 cba.SetCommandL( |
|
2012 CEikButtonGroupContainer::ERightSoftkeyPosition, |
|
2013 R_MR_SEND_SOFTKEY); |
|
2014 cba.DrawDeferred(); |
|
2015 } |
|
2016 else |
|
2017 { |
|
2018 cba.SetCommandL( |
|
2019 CEikButtonGroupContainer::ERightSoftkeyPosition, |
|
2020 R_MR_DONE_SOFTKEY); |
|
2021 cba.DrawDeferred(); |
|
2022 } |
|
2023 } |
|
2024 |
|
2025 // ----------------------------------------------------------------------------- |
|
2026 // CESMREditorDialog::TryToSaveEntryL |
|
2027 // ----------------------------------------------------------------------------- |
|
2028 // |
|
2029 TInt CESMREditorDialog::TryToSaveEntryL() |
|
2030 { |
|
2031 FUNC_LOG; |
|
2032 TInt res( KErrNone ); |
|
2033 |
|
2034 MESMRCalEntry* entry = iInfoProvider.EntryL(); |
|
2035 |
|
2036 if ( IsAllowedToSaveL() ) |
|
2037 { |
|
2038 res = iCallback.ProcessCommandWithResultL( EESMRCmdSaveMR ); |
|
2039 |
|
2040 if ( res == KErrNone |
|
2041 && iFeatures->FeatureSupported( |
|
2042 CESMRFeatureSettings::EESMRUIPreviousLocationsList ) ) |
|
2043 { |
|
2044 LocationPluginHandlerL().StoreLocationToHistoryL( *entry ); |
|
2045 } |
|
2046 if ( entry->Type() == MESMRCalEntry::EESMRCalEntryTodo ) |
|
2047 { |
|
2048 CESMRGlobalNote* note = |
|
2049 CESMRGlobalNote::NewL( |
|
2050 CESMRGlobalNote::EESMRTodoEntrySaved ); |
|
2051 note->ExecuteLD(); |
|
2052 } |
|
2053 else |
|
2054 { |
|
2055 CESMRGlobalNote* note = |
|
2056 CESMRGlobalNote::NewL( |
|
2057 CESMRGlobalNote::EESMREntrySaved ); |
|
2058 note->ExecuteLD(); |
|
2059 } |
|
2060 } |
|
2061 else |
|
2062 { |
|
2063 res = KErrCancel; |
|
2064 } |
|
2065 |
|
2066 return res; |
1694 } |
2067 } |
1695 |
2068 |
1696 // EOF |
2069 // EOF |
1697 |
|