40 #include <calentoolbar.h> |
40 #include <calentoolbar.h> |
41 #include <calcalendarinfo.h> |
41 #include <calcalendarinfo.h> |
42 #include <CalenInterimUtils2.h> |
42 #include <CalenInterimUtils2.h> |
43 #include <calenmulticalutil.h> |
43 #include <calenmulticalutil.h> |
44 #include <calenmulticaluids.hrh> |
44 #include <calenmulticaluids.hrh> |
|
45 #include <featmgr.h> |
|
46 #include <hlplch.h> |
|
47 #include <csxhelp/cale.hlp.hrh> |
45 |
48 |
46 // User includes |
49 // User includes |
47 #include "calendarui_debug.h" |
50 #include "calendarui_debug.h" |
48 #include "calenmultipledbui.h" |
51 #include "calenmultipledbui.h" |
49 #include "calendar.hrh" |
52 #include "calendar.hrh" |
50 #include "calenmultidbeditor.h" |
53 #include "calenmultidbeditor.h" |
51 #include "CalendarPrivateCRKeys.h" |
54 #include "CalendarPrivateCRKeys.h" |
52 #include "calencontroller.h" |
55 #include "calencontroller.h" |
|
56 #include "CalenUid.h" |
53 |
57 |
54 // Constants |
58 // Constants |
55 _LIT( KListSeparatorFormat, "\t" ); |
59 _LIT( KListSeparatorFormat, "\t" ); |
56 const TInt KMultiDbMaxLength = 300; |
60 const TInt KMultiDbMaxLength = 300; |
57 const TInt KBuffLength = 24; |
61 const TInt KBuffLength = 24; |
215 void CCalenMultipleDbUi::ConstructL() |
219 void CCalenMultipleDbUi::ConstructL() |
216 { |
220 { |
217 TRACE_ENTRY_POINT; |
221 TRACE_ENTRY_POINT; |
218 CAknDialog::ConstructL( R_CALEN_MULTIPLEDB_MENUBAR ); |
222 CAknDialog::ConstructL( R_CALEN_MULTIPLEDB_MENUBAR ); |
219 SetTitlePaneL(); |
223 SetTitlePaneL(); |
220 TCallBack callBack(CCalenMultipleDbUi::DoAsyncExit,this); |
224 |
221 iAsyncExit = new(ELeave) CAsyncCallBack(callBack,CActive::EPriorityStandard); |
225 TCallBack actionCallBack(CCalenMultipleDbUi::AsyncCallBackL, this); |
222 |
226 iAsyncAction = new(ELeave) CAsyncCallBack(actionCallBack,CActive::EPriorityStandard); |
|
227 |
223 // register for calendar file change notifications |
228 // register for calendar file change notifications |
224 RArray<TCalenNotification> notificationArray; |
229 RArray<TCalenNotification> notificationArray; |
225 notificationArray.Append(ECalenNotifyCalendarInfoCreated); |
230 notificationArray.Append(ECalenNotifyCalendarInfoCreated); |
226 notificationArray.Append(ECalenNotifyCalendarInfoUpdated); |
231 notificationArray.Append(ECalenNotifyCalendarInfoUpdated); |
227 notificationArray.Append(ECalenNotifyCalendarFileDeleted); |
232 notificationArray.Append(ECalenNotifyCalendarFileDeleted); |
229 |
234 |
230 notificationArray.Close(); |
235 notificationArray.Close(); |
231 |
236 |
232 iConflictOccured = EFalse; |
237 iConflictOccured = EFalse; |
233 |
238 |
234 TCallBack callBackDeleteQuery(CCalenMultipleDbUi::DoAsyncDeleteTemL, this); |
|
235 iAsyncDeletequery = new(ELeave) CAsyncCallBack(callBackDeleteQuery,CActive::EPriorityStandard); |
|
236 |
|
237 TRACE_EXIT_POINT; |
239 TRACE_EXIT_POINT; |
238 } |
240 } |
239 |
241 |
240 // ---------------------------------------------------------------------------- |
242 // ---------------------------------------------------------------------------- |
241 // CCalenMultipleDbUi::~CCalenMultipleDbUi |
243 // CCalenMultipleDbUi::~CCalenMultipleDbUi |
267 iColorUidArray.Close(); |
269 iColorUidArray.Close(); |
268 |
270 |
269 iIconIndices.Reset(); |
271 iIconIndices.Reset(); |
270 iIconIndices.Close(); |
272 iIconIndices.Close(); |
271 |
273 |
272 iAsyncExit->Cancel(); |
274 iAsyncAction->Cancel(); |
273 delete iAsyncExit; |
275 delete iAsyncAction; |
274 iAsyncExit = NULL; |
276 iAsyncAction = NULL; |
275 |
|
276 iAsyncDeletequery->Cancel(); |
|
277 delete iAsyncDeletequery; |
|
278 iAsyncDeletequery = NULL; |
|
279 |
277 |
280 if(iCalendarInfoNew) |
278 if(iCalendarInfoNew) |
281 { |
279 { |
282 delete iCalendarInfoNew; |
280 delete iCalendarInfoNew; |
283 iCalendarInfoNew = NULL; |
281 iCalendarInfoNew = NULL; |
552 switch(aCommandId) |
550 switch(aCommandId) |
553 { |
551 { |
554 case ECalenCmdEdit: |
552 case ECalenCmdEdit: |
555 { |
553 { |
556 TInt retValue = EditItemL(); |
554 TInt retValue = EditItemL(); |
557 |
|
558 if(retValue == EAknCmdExit || retValue == EAknSoftkeyExit ) |
555 if(retValue == EAknCmdExit || retValue == EAknSoftkeyExit ) |
559 { |
556 { |
560 iAsyncExitCmd = retValue; |
557 DoAsyncActionL(retValue); |
561 iAsyncExit->CallBack(); |
|
562 } |
558 } |
563 } |
559 } |
564 break; |
560 break; |
565 case ECalenCmdAdd: |
561 case ECalenCmdAdd: |
566 { |
562 { |
567 TInt retValue = AddItemL(); |
563 TInt retValue = AddItemL(); |
568 |
|
569 if(retValue == EAknCmdExit || retValue == EAknSoftkeyExit ) |
564 if(retValue == EAknCmdExit || retValue == EAknSoftkeyExit ) |
570 { |
565 { |
571 iAsyncExitCmd = retValue; |
566 DoAsyncActionL(retValue); |
572 iAsyncExit->CallBack(); |
|
573 } |
567 } |
574 } |
568 } |
575 break; |
569 break; |
576 case ECalenCmdDelete: |
570 case ECalenCmdDelete: |
577 { |
571 { |
578 iAsyncDeletequery->CallBack(); |
572 DoAsyncActionL(ECalenCmdDelete); |
579 } |
573 } |
580 break; |
574 break; |
581 case ECalenCmdItemSelect: |
575 case ECalenCmdItemSelect: |
582 case ECalenCmdShow: |
576 case ECalenCmdShow: |
583 { |
577 { |
584 DoSelectionL(ETrue); |
578 DoSelectionL(ETrue); |
591 } |
585 } |
592 break; |
586 break; |
593 case EAknCmdExit: |
587 case EAknCmdExit: |
594 case EAknSoftkeyExit: |
588 case EAknSoftkeyExit: |
595 { |
589 { |
596 iAsyncExitCmd = EAknSoftkeyExit; |
590 DoAsyncActionL(EAknSoftkeyExit); |
597 iAsyncExit->CallBack(); |
|
598 } |
591 } |
|
592 break; |
|
593 case EAknCmdHelp: |
|
594 if (FeatureManager::FeatureSupported(KFeatureIdHelp)) //ravi |
|
595 { |
|
596 HlpLauncher::LaunchHelpApplicationL( |
|
597 iCoeEnv->WsSession(),iAvkonAppUi->AppHelpContextL()); |
|
598 } |
599 break; |
599 break; |
600 default: |
600 default: |
601 break; |
601 break; |
602 } |
602 } |
|
603 TRACE_EXIT_POINT; |
|
604 } |
|
605 |
|
606 // ---------------------------------------------------------------------------- |
|
607 // CCalenMultipleDbUi::GetHelpContext |
|
608 // Gets help context |
|
609 // (other items were commented in a header). |
|
610 // ---------------------------------------------------------------------------- |
|
611 // |
|
612 void CCalenMultipleDbUi::GetHelpContext( TCoeHelpContext& aContext ) const |
|
613 { |
|
614 TRACE_ENTRY_POINT; |
|
615 |
|
616 aContext.iMajor = KUidCalendar; |
|
617 // This is specified in HRH file. |
|
618 aContext.iContext = KCALE_HLP_DAY_VIEW; //KCALE_HLP_DAY_VIEW should be replaced with MultipleDbUi related help id |
|
619 |
603 TRACE_EXIT_POINT; |
620 TRACE_EXIT_POINT; |
604 } |
621 } |
605 |
622 |
606 // ---------------------------------------------------------------------------- |
623 // ---------------------------------------------------------------------------- |
607 // CCalenMultipleDbUi::DoSelectionL |
624 // CCalenMultipleDbUi::DoSelectionL |
710 // ---------------------------------------------------------------------------- |
727 // ---------------------------------------------------------------------------- |
711 // |
728 // |
712 void CCalenMultipleDbUi::ExitDialogL() |
729 void CCalenMultipleDbUi::ExitDialogL() |
713 { |
730 { |
714 TRACE_ENTRY_POINT |
731 TRACE_ENTRY_POINT |
715 iAsyncExitCmd = EAknSoftkeyExit; |
732 iAsyncActionCmd = EAknSoftkeyExit; |
716 iAsyncExit->CallBack(); |
733 iAsyncAction->CallBack(); |
717 TRACE_EXIT_POINT |
734 TRACE_EXIT_POINT |
718 } |
735 } |
719 |
736 |
720 // ---------------------------------------------------------------------------- |
737 // ---------------------------------------------------------------------------- |
721 // CCalenMultipleDbUi::EditItemL |
738 // CCalenMultipleDbUi::EditItemL |
773 // |
790 // |
774 TInt CCalenMultipleDbUi::DeleteItemL() |
791 TInt CCalenMultipleDbUi::DeleteItemL() |
775 { |
792 { |
776 TRACE_ENTRY_POINT; |
793 TRACE_ENTRY_POINT; |
777 |
794 |
778 TInt currentIndex = iListBox->CurrentItemIndex(); |
795 TInt currentIndex = iCurrentIndex; |
779 |
796 |
780 RPointerArray<CCalCalendarInfo> calendarInfoList; |
797 RPointerArray<CCalCalendarInfo> calendarInfoList; |
781 iController.GetAllCalendarInfoL(calendarInfoList); |
798 iController.GetAllCalendarInfoL(calendarInfoList); |
782 CleanupClosePushL(calendarInfoList); |
799 CleanupClosePushL(calendarInfoList); |
783 |
800 |
885 TKeyResponse exitCode(EKeyWasNotConsumed); |
902 TKeyResponse exitCode(EKeyWasNotConsumed); |
886 if(aType == EEventKey ) |
903 if(aType == EEventKey ) |
887 { |
904 { |
888 if( aKeyEvent.iCode == EKeyEscape ) |
905 if( aKeyEvent.iCode == EKeyEscape ) |
889 { |
906 { |
890 TryExitL( EKeyEscape ); |
907 TryExitL( EKeyNo ); |
891 return exitCode; // Chain this one up to the main app so it closes calendar app. |
908 return exitCode; // Chain this one up to the main app so it closes calendar app. |
892 } |
909 } |
893 else if(aType == EEventKey && TChar(aKeyEvent.iCode).IsPrint() ) |
910 else if(aType == EEventKey && TChar(aKeyEvent.iCode).IsPrint() ) |
894 { |
911 { |
895 ProcessCommandL(ECalenCmdAdd); |
912 ProcessCommandL(ECalenCmdAdd); |
1155 CAknDialog::HandleResourceChange( aType ); |
1178 CAknDialog::HandleResourceChange( aType ); |
1156 TRACE_EXIT_POINT; |
1179 TRACE_EXIT_POINT; |
1157 } |
1180 } |
1158 |
1181 |
1159 // ---------------------------------------------------------------------------- |
1182 // ---------------------------------------------------------------------------- |
1160 // CCalenMultipleDbUi::CallBackForAddAndDeleteL |
1183 // CCalenMultipleDbUi::AsyncCallBackL |
1161 // (other items were commented in a header). |
1184 // (other items were commented in a header). |
1162 // ---------------------------------------------------------------------------- |
1185 // ---------------------------------------------------------------------------- |
1163 // |
1186 // |
1164 TInt CCalenMultipleDbUi::DoAsyncExit(TAny* aPtr) |
1187 TInt CCalenMultipleDbUi::AsyncCallBackL(TAny* aThisPtr) |
1165 { |
1188 { |
1166 TRACE_ENTRY_POINT |
1189 TRACE_ENTRY_POINT |
1167 CCalenMultipleDbUi* self = static_cast<CCalenMultipleDbUi*>(aPtr); |
1190 CCalenMultipleDbUi* self = static_cast<CCalenMultipleDbUi*>(aThisPtr); |
1168 self->TryExitL(self->iAsyncExitCmd); |
1191 self->HandleAsyncCommandL(self->iAsyncActionCmd); |
1169 TRACE_EXIT_POINT |
1192 TRACE_EXIT_POINT |
1170 return 0; |
1193 return 0; |
1171 } |
1194 } |
1172 // ---------------------------------------------------------------------------- |
1195 |
1173 // CCalenMultipleDbUi::CallBackForDeleteItemL |
1196 // ---------------------------------------------------------------------------- |
1174 // (other items were commented in a header). |
1197 // CCalenMultipleDbUi::DoAsyncActionL |
1175 // ---------------------------------------------------------------------------- |
1198 // (other items were commented in a header). |
1176 // |
1199 // ---------------------------------------------------------------------------- |
1177 TInt CCalenMultipleDbUi::DoAsyncDeleteTemL(TAny* aPtr) |
1200 // |
1178 { |
1201 void CCalenMultipleDbUi::DoAsyncActionL(const TInt aCommand) |
1179 TRACE_ENTRY_POINT |
1202 { |
1180 CCalenMultipleDbUi* self = static_cast<CCalenMultipleDbUi*>(aPtr); |
1203 TRACE_ENTRY_POINT |
1181 self->DeleteItemL(); |
1204 iCurrentIndex = iListBox->CurrentItemIndex(); |
|
1205 iAsyncActionCmd = aCommand; |
|
1206 iAsyncAction->CallBack(); |
1182 TRACE_EXIT_POINT |
1207 TRACE_EXIT_POINT |
1183 return 0; |
1208 } |
|
1209 |
|
1210 // ---------------------------------------------------------------------------- |
|
1211 // CCalenMultipleDbUi::DoAsyncActionL |
|
1212 // (other items were commented in a header). |
|
1213 // ---------------------------------------------------------------------------- |
|
1214 // |
|
1215 void CCalenMultipleDbUi::HandleAsyncCommandL(const TInt aCommand) |
|
1216 { |
|
1217 TRACE_ENTRY_POINT |
|
1218 |
|
1219 switch(aCommand) |
|
1220 { |
|
1221 case EAknSoftkeyExit: |
|
1222 case EAknCmdExit: |
|
1223 { |
|
1224 TryExitL(aCommand); |
|
1225 } |
|
1226 break; |
|
1227 case ECalenCmdDelete: |
|
1228 { |
|
1229 DeleteItemL(); |
|
1230 } |
|
1231 break; |
|
1232 default: |
|
1233 break; |
|
1234 } |
|
1235 |
|
1236 TRACE_EXIT_POINT |
1184 } |
1237 } |
1185 |
1238 |
1186 // ---------------------------------------------------------------------------- |
1239 // ---------------------------------------------------------------------------- |
1187 // CCalenMultipleDbUi::CreateButtonL |
1240 // CCalenMultipleDbUi::CreateButtonL |
1188 // (other items were commented in a header). |
1241 // (other items were commented in a header). |