equal
deleted
inserted
replaced
29 #include "CalenDescription.h" |
29 #include "CalenDescription.h" |
30 #include "calenattachmentinfo.h" |
30 #include "calenattachmentinfo.h" |
31 #include "calenattachmentmodel.h" |
31 #include "calenattachmentmodel.h" |
32 #include "CleanupResetAndDestroy.h" |
32 #include "CleanupResetAndDestroy.h" |
33 #include "CalendarPrivateCRKeys.h" |
33 #include "CalendarPrivateCRKeys.h" |
34 #include "KoreanLunarDateEditor.h" |
|
35 #include <featmgr.h> |
|
36 #include "CalenUid.h" |
|
37 |
34 |
38 // system includes |
35 // system includes |
39 #include <coemain.h> |
36 #include <coemain.h> |
40 #include <eikdialg.h> |
37 #include <eikdialg.h> |
41 #include <bacntf.h> |
38 #include <bacntf.h> |
68 #include <calencommands.hrh> // Calendar commands |
65 #include <calencommands.hrh> // Calendar commands |
69 #include <calencontext.h> |
66 #include <calencontext.h> |
70 #include <caleninstanceid.h> // TCalenInstanceId |
67 #include <caleninstanceid.h> // TCalenInstanceId |
71 #include <calenservices.h> |
68 #include <calenservices.h> |
72 #include <calcalendarinfo.h> |
69 #include <calcalendarinfo.h> |
73 #include <vwsdef.h> |
|
74 |
70 |
75 // debug |
71 // debug |
76 #include "calendarui_debug.h" |
72 #include "calendarui_debug.h" |
77 |
73 |
78 const TInt KCalenMaxELAFTextEditorLength(160); |
74 const TInt KCalenMaxELAFTextEditorLength(160); |
173 |
169 |
174 iCollectionIds.Reset(); |
170 iCollectionIds.Reset(); |
175 |
171 |
176 iAsyncCallback->Cancel(); |
172 iAsyncCallback->Cancel(); |
177 delete iAsyncCallback; |
173 delete iAsyncCallback; |
178 |
|
179 // Do not call UnInitializeLib() if InitalizeLib() leaves. |
|
180 if ( iFeatMgrInitialized ) |
|
181 { |
|
182 // Frees the TLS. Must be done after FeatureManager is used. |
|
183 FeatureManager::UnInitializeLib(); |
|
184 } |
|
185 |
|
186 |
174 |
187 TRACE_EXIT_POINT; |
175 TRACE_EXIT_POINT; |
188 } |
176 } |
189 |
177 |
190 // ----------------------------------------------------------------------------- |
178 // ----------------------------------------------------------------------------- |
310 |
298 |
311 iIdle = CIdle::NewL( CActive::EPriorityUserInput ); |
299 iIdle = CIdle::NewL( CActive::EPriorityUserInput ); |
312 iIdle->Start( TCallBack( KeyCallBack, this) ); |
300 iIdle->Start( TCallBack( KeyCallBack, this) ); |
313 iCoeEnv->AddFepObserverL( *this ); |
301 iCoeEnv->AddFepObserverL( *this ); |
314 |
302 |
315 // Sets up TLS, must be done before FeatureManager is used. |
|
316 FeatureManager::InitializeLibL(); |
|
317 // Used in destructor. |
|
318 iFeatMgrInitialized = ETrue; |
|
319 |
|
320 TRACE_EXIT_POINT; |
303 TRACE_EXIT_POINT; |
321 } |
304 } |
322 |
305 |
323 // ----------------------------------------------------------------------------- |
306 // ----------------------------------------------------------------------------- |
324 // CCalenUnifiedEditor::ExecuteViewL |
307 // CCalenUnifiedEditor::ExecuteViewL |
396 |
379 |
397 case ECalenNotifyEntryInstanceViewCreated: |
380 case ECalenNotifyEntryInstanceViewCreated: |
398 break; |
381 break; |
399 case ECalenNotifyCalendarFileDeleted: |
382 case ECalenNotifyCalendarFileDeleted: |
400 { |
383 { |
401 TRAP_IGNORE(HandleCalendarDeleteL()); |
|
402 } |
|
403 break; |
|
404 default: |
|
405 break; |
|
406 } |
|
407 TRACE_EXIT_POINT; |
|
408 } |
|
409 |
|
410 |
|
411 void CCalenUnifiedEditor::HandleCalendarDeleteL() |
|
412 { |
|
413 TPtrC fileNamePtr = iServices->Context().GetCalendarFileNameL(); |
384 TPtrC fileNamePtr = iServices->Context().GetCalendarFileNameL(); |
414 TInt index = iUnifiedEditorControl->GetCalendarNameForEntryL(fileNamePtr); |
385 TInt index = KErrNotFound; |
|
386 TRAP_IGNORE(index = iUnifiedEditorControl->GetCalendarNameForEntryL(fileNamePtr)); |
415 if(index == KErrNotFound) |
387 if(index == KErrNotFound) |
416 { |
388 { |
417 DisplayErrorMsgL( CCalenEditorDataHandler::EFormErrDbConflictEntryDeleted ); |
389 DisplayErrorMsgL( CCalenEditorDataHandler::EFormErrDbConflictEntryDeleted ); |
418 iEntryUiOutParams.iAction = EMeetingDeleted; |
390 iEntryUiOutParams.iAction = EMeetingDeleted; |
419 TryExitL( KCalenButtonIdCloseForm ); |
391 TryExitL( KCalenButtonIdCloseForm ); |
420 } |
392 } |
421 |
393 } |
|
394 break; |
|
395 default: |
|
396 break; |
|
397 } |
|
398 |
|
399 TRACE_EXIT_POINT; |
422 } |
400 } |
423 |
401 |
424 // ----------------------------------------------------------------------------- |
402 // ----------------------------------------------------------------------------- |
425 // CCalenUnifiedEditor::InsertFieldL |
403 // CCalenUnifiedEditor::InsertFieldL |
426 // Inserts dialog line (form field) defined by aResourceI |
404 // Inserts dialog line (form field) defined by aResourceI |
567 else |
545 else |
568 { |
546 { |
569 SetAllDayFieldL( ETrue ); |
547 SetAllDayFieldL( ETrue ); |
570 active = ETrue; |
548 active = ETrue; |
571 } |
549 } |
572 iUnifiedEditorControl->SetAllDayEventL( active ); |
550 iUnifiedEditorControl->SetAllDayEvent( active ); |
573 |
551 |
574 } |
552 } |
575 break; |
553 break; |
576 } |
554 } |
577 case EAknSoftkeyOptions: |
555 case EAknSoftkeyOptions: |
728 } |
706 } |
729 else |
707 else |
730 { |
708 { |
731 iServices->IssueCommandL( ECalenAddAttachment ); |
709 iServices->IssueCommandL( ECalenAddAttachment ); |
732 } |
710 } |
733 } |
|
734 else if ( ctrlid == ECalenEditorAllDayItem ) |
|
735 { |
|
736 // Tap on AllDay field, Switch the status of AllDay field |
|
737 iUnifiedEditorControl->SetAllDayEventL( |
|
738 !( iUnifiedEditorControl->IsAllDayEvent() ) ); |
|
739 } |
|
740 else if ( ctrlid == ECalenEditorReminder ) |
|
741 { |
|
742 TBool active; |
|
743 if( iUnifiedEditorControl->IsAlarmActiveInForm() ) |
|
744 { |
|
745 SetAlarmFieldOnOffL( EFalse ); |
|
746 active = EFalse; |
|
747 } |
|
748 else |
|
749 { |
|
750 SetAlarmFieldOnOffL( ETrue ); |
|
751 active = ETrue; |
|
752 } |
|
753 iUnifiedEditorControl->CheckAlarmActive( active ); |
|
754 } |
|
755 else |
|
756 { |
|
757 keyResponse = CAknForm::OfferKeyEventL( aKeyEvent, aType ); |
|
758 } |
711 } |
759 break; |
712 break; |
760 case EKeyEscape: |
713 case EKeyEscape: |
761 // Calendar relaunched from cmd line - close viewer |
714 // Calendar relaunched from cmd line - close viewer |
762 // NOTE: This was changed from EAknCmdExit to ECalenCmdCloseDialog since launching |
715 // NOTE: This was changed from EAknCmdExit to ECalenCmdCloseDialog since launching |
1036 TRACE_ENTRY_POINT; |
989 TRACE_ENTRY_POINT; |
1037 |
990 |
1038 iUnifiedEditorControl->MakeUnifiedEditorL(); |
991 iUnifiedEditorControl->MakeUnifiedEditorL(); |
1039 // Hides Entry type and Calendar Field for exceptional entry/single |
992 // Hides Entry type and Calendar Field for exceptional entry/single |
1040 // instance of recurrent entry. |
993 // instance of recurrent entry. |
1041 HideFieldsForEditSingleInstanceL(); |
994 HideFieldsForEditSingleInstance(); |
1042 |
995 |
1043 TRACE_EXIT_POINT; |
996 TRACE_EXIT_POINT; |
1044 } |
997 } |
1045 |
998 |
1046 // ----------------------------------------------------------------------------- |
999 // ----------------------------------------------------------------------------- |
1256 |
1209 |
1257 } |
1210 } |
1258 else if ( focusControl == ECalenEditorAllDayItem ) |
1211 else if ( focusControl == ECalenEditorAllDayItem ) |
1259 { |
1212 { |
1260 // Tap on AllDay field, Switch the status of AllDay field |
1213 // Tap on AllDay field, Switch the status of AllDay field |
1261 iUnifiedEditorControl->SetAllDayEventL( |
1214 iUnifiedEditorControl->SetAllDayEvent( |
1262 !( iUnifiedEditorControl->IsAllDayEvent() ) ); |
1215 !( iUnifiedEditorControl->IsAllDayEvent() ) ); |
1263 } |
1216 } |
1264 else if ( focusControl == ECalenEditorReminder ) |
1217 else if ( focusControl == ECalenEditorReminder ) |
1265 { |
1218 { |
1266 TBool active; |
1219 TBool active; |
1520 // ----------------------------------------------------------------------------- |
1473 // ----------------------------------------------------------------------------- |
1521 // |
1474 // |
1522 SEikControlInfo CCalenUnifiedEditor::CreateCustomControlL( TInt aControlType ) |
1475 SEikControlInfo CCalenUnifiedEditor::CreateCustomControlL( TInt aControlType ) |
1523 { |
1476 { |
1524 TRACE_ENTRY_POINT; |
1477 TRACE_ENTRY_POINT; |
1525 if( aControlType == ECalenCtLunarDateEditor && FeatureManager::FeatureSupported( KFeatureIdKorean ) ) |
1478 |
1526 { |
|
1527 SEikControlInfo controlInfo; |
|
1528 controlInfo.iControl = new (ELeave) CKoreanLunarDateEditor(iServices); |
|
1529 controlInfo.iControl->SetParent( this ); |
|
1530 controlInfo.iFlags = 0; |
|
1531 controlInfo.iTrailerTextId = 0; |
|
1532 return controlInfo; |
|
1533 } |
|
1534 __ASSERT_ALWAYS( aControlType==ECalenCtDescriptionField, User::Invariant() ); |
1479 __ASSERT_ALWAYS( aControlType==ECalenCtDescriptionField, User::Invariant() ); |
1535 |
1480 |
1536 TRACE_EXIT_POINT; |
1481 TRACE_EXIT_POINT; |
1537 return iUnifiedEditorControl->Description()->CreateFieldL(); |
1482 return iUnifiedEditorControl->Description()->CreateFieldL(); |
1538 } |
1483 } |
1549 |
1494 |
1550 if( aControlType == ECalenCtDescriptionField ) |
1495 if( aControlType == ECalenCtDescriptionField ) |
1551 { |
1496 { |
1552 TRACE_EXIT_POINT; |
1497 TRACE_EXIT_POINT; |
1553 return MEikDialogPageObserver::EEdwinDerived; |
1498 return MEikDialogPageObserver::EEdwinDerived; |
1554 } |
|
1555 if( aControlType == ECalenCtLunarDateEditor && FeatureManager::FeatureSupported( KFeatureIdKorean ) ) |
|
1556 { |
|
1557 TRACE_EXIT_POINT; |
|
1558 return MEikDialogPageObserver::EMfneDerived; |
|
1559 } |
1499 } |
1560 |
1500 |
1561 TRACE_EXIT_POINT; |
1501 TRACE_EXIT_POINT; |
1562 return MEikDialogPageObserver::EUnknownType; |
1502 return MEikDialogPageObserver::EUnknownType; |
1563 } |
1503 } |
2113 } |
2053 } |
2114 } |
2054 } |
2115 |
2055 |
2116 if ( error == CCalenEditorDataHandler::EFormErrNone ) |
2056 if ( error == CCalenEditorDataHandler::EFormErrNone ) |
2117 { |
2057 { |
2118 ModifyDbFieldL();//default calendar code |
2058 ModifyDbField();//default calendar code |
2119 EditorDataHandler().WriteChangesToEntryL( iRepeatType ); |
2059 EditorDataHandler().WriteChangesToEntryL( iRepeatType ); |
2120 |
2060 |
2121 TCalTime newInstanceStartDate, newInstanceEndDate; |
2061 TCalTime newInstanceStartDate, newInstanceEndDate; |
2122 CalculateNewInstanceStartAndEndDateL( newInstanceStartDate, newInstanceEndDate ); |
2062 CalculateNewInstanceStartAndEndDateL( newInstanceStartDate, newInstanceEndDate ); |
2123 if(EditorDataHandler().IsRepeatRuleEdited() && !IsCreatingNewEntry()) |
|
2124 { |
|
2125 MCalenContext& context = iServices->Context(); |
|
2126 TCalenInstanceId instanceId = context.InstanceId(); |
|
2127 context.SetFocusDateAndTimeL(newInstanceStartDate,TVwsViewId( KUidCalendar, KUidCalenEventView)); |
|
2128 } |
|
2129 |
2063 |
2130 TInt saveErr( 0 ); |
2064 TInt saveErr( 0 ); |
2131 TBool dbChange = iEditorDataHandler->IsCalendarEditedL(); |
2065 TBool dbChange = iEditorDataHandler->IsCalendarEditedL(); |
2132 if( iEditedCalEntry.EntryTypeL() != Edited().EntryType() || dbChange ) |
2066 if( iEditedCalEntry.EntryTypeL() != Edited().EntryType() || dbChange ) |
2133 { |
2067 { |
2226 entry->SetStartAndEndTimeL( newInstanceStartDate, newInstanceEndDate ); |
2160 entry->SetStartAndEndTimeL( newInstanceStartDate, newInstanceEndDate ); |
2227 if(iEditedCalEntry.EntryTypeL() != GetEntryType()) |
2161 if(iEditedCalEntry.EntryTypeL() != GetEntryType()) |
2228 { |
2162 { |
2229 if( entry->EntryTypeL() == CCalEntry::EAnniv ) |
2163 if( entry->EntryTypeL() == CCalEntry::EAnniv ) |
2230 { |
2164 { |
2231 if( !( FeatureManager::FeatureSupported( KFeatureIdKorean ) |
2165 // Set yearly rule to Anniversary entry, to create Annaiversary instance yearly |
2232 && entry->UserInt32L() != ESolar ) ) |
2166 TCalRRule rrule( TCalRRule::EYearly ); |
2233 { |
2167 TCalTime startDate; |
2234 // Set yearly rule to Anniversary entry, to create Annaiversary instance yearly |
2168 rrule.SetDtStart( newInstanceStartDate ); |
2235 TCalRRule rrule( TCalRRule::EYearly ); |
2169 rrule.SetInterval( 1 ); // once a year |
2236 TCalTime startDate; |
2170 entry->SetRRuleL( rrule ); |
2237 rrule.SetDtStart( newInstanceStartDate ); |
|
2238 rrule.SetInterval( 1 ); // once a year |
|
2239 entry->SetRRuleL( rrule ); |
|
2240 } |
|
2241 } |
2171 } |
2242 } |
2172 } |
2243 |
2173 |
2244 |
2174 |
2245 |
2175 |
2319 } |
2249 } |
2320 if ( action == CCalenEditorDataHandler::EActionSave ) |
2250 if ( action == CCalenEditorDataHandler::EActionSave ) |
2321 { |
2251 { |
2322 EditorDataHandler().ForceValidValuesL( iHasChosenRepeatType? iRepeatType |
2252 EditorDataHandler().ForceValidValuesL( iHasChosenRepeatType? iRepeatType |
2323 : CalCommon::EThisAndAll ); |
2253 : CalCommon::EThisAndAll ); |
2324 ModifyDbFieldL();//Default Calendar code |
2254 ModifyDbField();//Default Calendar code |
2325 EditorDataHandler().WriteChangesToEntryL( iHasChosenRepeatType? iRepeatType |
2255 EditorDataHandler().WriteChangesToEntryL( iHasChosenRepeatType? iRepeatType |
2326 : CalCommon::EThisAndAll ); |
2256 : CalCommon::EThisAndAll ); |
2327 |
2257 |
2328 TCalTime newInstanceStartDate, newInstanceEndDate; |
2258 TCalTime newInstanceStartDate, newInstanceEndDate; |
2329 CalculateNewInstanceStartAndEndDateL( newInstanceStartDate, |
2259 CalculateNewInstanceStartAndEndDateL( newInstanceStartDate, |
3222 // ----------------------------------------------------------------------------- |
3152 // ----------------------------------------------------------------------------- |
3223 // CCalenUnifiedEditor::ModifyDbField |
3153 // CCalenUnifiedEditor::ModifyDbField |
3224 // modifies the DB filed in cenrep if user has edited it. |
3154 // modifies the DB filed in cenrep if user has edited it. |
3225 // ----------------------------------------------------------------------------- |
3155 // ----------------------------------------------------------------------------- |
3226 // |
3156 // |
3227 void CCalenUnifiedEditor::ModifyDbFieldL() |
3157 void CCalenUnifiedEditor::ModifyDbField() |
3228 { |
3158 { |
3229 if(IsCreatingNewEntry()) |
3159 if(IsCreatingNewEntry()) |
3230 { |
3160 { |
3231 RPointerArray<CCalCalendarInfo> calendarInfoList; |
3161 RPointerArray<CCalCalendarInfo> calendarInfoList; |
3232 iServices->GetAllCalendarInfoL(calendarInfoList); |
3162 iServices->GetAllCalendarInfoL(calendarInfoList); |
3244 // CCalenUnifiedEditor::HideFieldsForEditSingleInstance |
3174 // CCalenUnifiedEditor::HideFieldsForEditSingleInstance |
3245 // Hides Entry type and Calendar Field for exceptional entry/single |
3175 // Hides Entry type and Calendar Field for exceptional entry/single |
3246 // instance of recurrent entry. |
3176 // instance of recurrent entry. |
3247 // ----------------------------------------------------------------------------- |
3177 // ----------------------------------------------------------------------------- |
3248 // |
3178 // |
3249 void CCalenUnifiedEditor::HideFieldsForEditSingleInstanceL() |
3179 void CCalenUnifiedEditor::HideFieldsForEditSingleInstance() |
3250 { |
3180 { |
3251 TRACE_ENTRY_POINT; |
3181 TRACE_ENTRY_POINT; |
3252 |
3182 |
3253 if( !IsCreatingNewEntry() ) |
3183 if( !IsCreatingNewEntry() ) |
3254 { |
3184 { |