15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 |
18 |
19 // INCLUDE FILES |
19 // INCLUDE FILES |
20 //<cmail> |
|
21 #include "emailtrace.h" |
|
22 #include "cesmralarminfohandler.h" |
|
23 #include "cesmrrecurrenceinfohandler.h" |
|
24 //</cmail> |
|
25 #include <centralrepository.h> |
|
26 #include <calalarm.h> |
|
27 |
|
28 #include "cesmrmeetingrequestentry.h" |
20 #include "cesmrmeetingrequestentry.h" |
29 #include "cesmrfsmailboxutils.h" |
21 #include "cesmrfsmailboxutils.h" |
30 #include "cesmrcaldbmgr.h" |
22 #include "cesmrcaldbmgr.h" |
31 #include "esmrhelper.h" |
23 #include "esmrhelper.h" |
32 #include "esmrentryhelper.h" |
24 #include "esmrentryhelper.h" |
33 #include "cesmrconflictchecker.h" |
25 #include "cesmrconflictchecker.h" |
34 #include "cesmrcaluserutil.h" |
26 #include "cesmrcaluserutil.h" |
|
27 #include "cesmralarminfohandler.h" |
|
28 #include "cesmrrecurrenceinfohandler.h" |
|
29 #include "mmrinfoobject.h" |
|
30 #include "mmrattendee.h" |
|
31 |
|
32 #include "CFSMailMessage.h" |
|
33 |
35 #include "esmrconfig.hrh" |
34 #include "esmrconfig.hrh" |
|
35 #include "cesmrfeaturesettings.h" |
|
36 |
|
37 #include "emailtrace.h" |
36 |
38 |
37 #include <esmralarminfo.rsg> |
39 #include <esmralarminfo.rsg> |
38 #include <calentry.h> |
40 #include <calentry.h> |
39 #include <calinstance.h> |
41 #include <calinstance.h> |
40 #include <calinstanceview.h> |
42 #include <calinstanceview.h> |
41 #include <caluser.h> |
43 #include <caluser.h> |
42 #include <CalenInterimUtils2.h> |
44 #include <calattachment.h> |
|
45 #include <caleninterimutils2.h> |
43 #include <cmrmailboxutils.h> |
46 #include <cmrmailboxutils.h> |
44 #include <calrrule.h> |
47 #include <calrrule.h> |
45 //<cmail> |
48 #include <centralrepository.h> |
46 #include "mmrinfoobject.h" |
49 #include <calalarm.h> |
47 #include "mmrattendee.h" |
50 #include <calendarinternalcrkeys.h> |
48 //</cmail> |
|
49 #include <CalendarInternalCRKeys.h> |
|
50 #include <data_caging_path_literals.hrh> |
51 #include <data_caging_path_literals.hrh> |
51 #include <coemain.h> |
52 #include <coemain.h> |
52 #include <calentryview.h> |
53 #include <calentryview.h> |
53 #include <ct/rcpointerarray.h> |
54 #include <ct/rcpointerarray.h> |
|
55 #include <apmstd.h> |
|
56 #include <apgcli.h> |
|
57 #include <apmrec.h> |
54 |
58 |
55 /// Unnamed namespace for local definitions |
59 /// Unnamed namespace for local definitions |
56 namespace { |
60 namespace { |
57 |
61 |
58 // Alarm resource file location |
62 // Alarm resource file location |
59 _LIT( KAlarmInfoResource, "esmralarminfo.rsc" ); |
63 _LIT( KAlarmInfoResource, "esmralarminfo.rsc" ); |
60 |
64 |
61 // Definition for first index |
|
62 const TInt KFirstIndex = 0; |
|
63 |
|
64 // Definition for 0 |
|
65 const TInt KZero = 0; |
|
66 |
|
67 // Definition for 1 |
|
68 const TInt KOne = 1; |
|
69 |
|
70 // Definition for number of hours within day |
|
71 const TInt KHoursInDay = 24; |
|
72 |
|
73 // Definition for default alarm time for meeting |
65 // Definition for default alarm time for meeting |
74 const TInt KDefaultMeetingAlarmMinutes( 15 ); |
66 const TInt KDefaultMeetingAlarmMinutes( 15 ); |
75 |
67 |
76 _LIT( KReplaceLineFeedChar, "\n" ); |
68 _LIT( KReplaceLineFeedChar, "\n" ); |
77 _LIT( KLineFeed, "\x2029"); |
69 _LIT( KLineFeed, "\x2029"); |
78 |
70 |
79 /** |
71 /** |
80 * Finds matching calendar instance from calendar db. Ownership is |
72 * Sets phone owner to entry. |
81 * transferred, If instance cannot be found, NULL is returned. |
73 * @param aMbUtils Reference to mailbox utils. |
82 * |
74 * @param aEntry Reference to calendar entry. |
83 * @param aCalDb Reference to cal db manager. |
|
84 * @param aEntry Reference to calendar entry |
|
85 * @return Pointer to calendar entry instance. |
|
86 */ |
75 */ |
87 CCalInstance* FindInstanceL( |
76 void SetPhoneOwnerL( |
88 MESMRCalDbMgr& aCalDb, |
77 CMRMailboxUtils& aMbUtils, |
89 CCalEntry& aEntry ) |
78 CCalEntry& aEntry ) |
90 { |
79 { |
91 CCalInstance* instance = NULL; |
80 CESMRFsMailboxUtils* fsMbUtils = |
92 RCPointerArray<CCalInstance> calInstances; |
81 CESMRFsMailboxUtils::NewL( aMbUtils ); |
93 CleanupClosePushL( calInstances ); |
82 CleanupStack::PushL( fsMbUtils ); |
94 |
83 |
95 CCalInstanceView* instanceView = |
84 fsMbUtils->SetPhoneOwnerL( aEntry ); |
96 aCalDb.NormalDbInstanceView(); |
85 CleanupStack::PopAndDestroy( fsMbUtils ); |
97 |
86 fsMbUtils = NULL; |
98 CalCommon::TCalViewFilter instanceFilter = |
87 } |
99 CalCommon::EIncludeAppts | |
88 |
100 CalCommon::EIncludeEvents; |
89 /** |
101 |
90 * Makes copy of the entry and sets phone owner accordingly |
102 // Removing one seconds from start time and adding one second to stop |
91 * @param aMbUtils Reference to mailbox utils. |
103 // time. Otherwise wanted entry is not included into results. |
92 * @param aEntry Reference to calendar entry. |
104 TCalTime startTime; |
93 */ |
105 startTime.SetTimeLocalL( |
94 CCalEntry* CopyEntryL( |
106 aEntry.StartTimeL().TimeLocalL() - TTimeIntervalSeconds(KOne) ); |
95 CMRMailboxUtils& aMbUtils, |
107 TCalTime endTime; |
96 const CCalEntry& aEntry ) |
108 endTime.SetTimeLocalL( |
97 { |
109 aEntry.EndTimeL().TimeLocalL() + TTimeIntervalSeconds(KOne) ); |
98 CCalEntry* entry = ESMRHelper::CopyEntryL( |
110 |
99 aEntry, |
111 TDateTime start = startTime.TimeLocalL().DateTime(); |
100 aEntry.MethodL(), |
112 TDateTime end = endTime.TimeLocalL().DateTime(); |
101 ESMRHelper::ECopyFull, |
113 |
102 EESMREventTypeMeetingRequest ); |
114 CalCommon::TCalTimeRange timeRange( |
103 |
115 startTime, |
104 SetPhoneOwnerL( aMbUtils, *entry ); |
116 endTime ); |
105 |
117 |
106 return entry; |
118 instanceView->FindInstanceL( |
|
119 calInstances, |
|
120 instanceFilter, |
|
121 timeRange); |
|
122 |
|
123 TInt instanceCount( calInstances.Count() ); |
|
124 for (TInt i = 0; (i < instanceCount && !instance); ++i) |
|
125 { |
|
126 CCalEntry& entry = calInstances[i]->Entry(); |
|
127 |
|
128 // Finding the entry we are intrested for |
|
129 if ( !entry.UidL().Compare( aEntry.UidL() ) ) |
|
130 { |
|
131 instance = calInstances[i]; |
|
132 calInstances.Remove( i ); |
|
133 } |
|
134 } |
|
135 CleanupStack::PopAndDestroy(); // arrayCleanup |
|
136 return instance; |
|
137 } |
107 } |
138 |
108 |
139 #ifdef _DEBUG |
109 #ifdef _DEBUG |
140 |
110 |
141 // Definition for panic text |
111 // Definition for panic text |
181 TBool aConflictsExists, |
151 TBool aConflictsExists, |
182 TESMRInputParams* aESMRInputParams ) |
152 TESMRInputParams* aESMRInputParams ) |
183 : iMRMailboxUtils( aMRMailboxUtils ), |
153 : iMRMailboxUtils( aMRMailboxUtils ), |
184 iConflictsExists( aConflictsExists), |
154 iConflictsExists( aConflictsExists), |
185 iCalDb( aCalDb ), |
155 iCalDb( aCalDb ), |
186 iESMRInputParams( aESMRInputParams ) |
156 iESMRInputParams( aESMRInputParams ), |
|
157 iSendCanellation( ETrue ) |
187 { |
158 { |
188 FUNC_LOG; |
159 FUNC_LOG; |
189 // Not yet implementation |
160 // Not yet implementation |
190 } |
161 } |
191 |
162 |
192 // --------------------------------------------------------------------------- |
163 // --------------------------------------------------------------------------- |
193 // CESMRMeetingRequestEntry::~CESMRMeetingRequestEntry |
164 // CESMRMeetingRequestEntry::~CESMRMeetingRequestEntry |
194 // --------------------------------------------------------------------------- |
165 // --------------------------------------------------------------------------- |
195 // |
166 // |
196 CESMRMeetingRequestEntry::~CESMRMeetingRequestEntry() |
167 EXPORT_C CESMRMeetingRequestEntry::~CESMRMeetingRequestEntry() |
197 { |
168 { |
198 FUNC_LOG; |
169 FUNC_LOG; |
199 delete iEntry; |
170 delete iEntry; |
200 delete iForwardEntry; |
171 delete iForwardEntry; |
201 delete iOrginalEntry; |
172 delete iOrginalEntry; |
202 delete iParameterEntry; |
173 delete iParameterEntry; |
203 delete iBackupEntry; |
|
204 } |
174 } |
205 |
175 |
206 // --------------------------------------------------------------------------- |
176 // --------------------------------------------------------------------------- |
207 // CESMRMeetingRequestEntry::NewL |
177 // CESMRMeetingRequestEntry::NewL |
208 // --------------------------------------------------------------------------- |
178 // --------------------------------------------------------------------------- |
209 // |
179 // |
210 CESMRMeetingRequestEntry* CESMRMeetingRequestEntry::NewL( |
180 EXPORT_C CESMRMeetingRequestEntry* CESMRMeetingRequestEntry::NewL( |
211 const CCalEntry& aEntry, |
181 const CCalEntry& aEntry, |
212 CMRMailboxUtils& aMRMailboxUtils, |
182 CMRMailboxUtils& aMRMailboxUtils, |
213 MESMRCalDbMgr& aCalDb, |
183 MESMRCalDbMgr& aCalDb, |
214 TBool aConflictsExists, |
184 TBool aConflictsExists, |
215 TESMRInputParams* aESMRInputParams ) |
185 TESMRInputParams* aESMRInputParams ) |
279 iEntry->SetMethodL( CCalEntry::EMethodRequest ); |
230 iEntry->SetMethodL( CCalEntry::EMethodRequest ); |
280 iOrginalEntry->SetMethodL( CCalEntry::EMethodRequest ); |
231 iOrginalEntry->SetMethodL( CCalEntry::EMethodRequest ); |
281 } |
232 } |
282 |
233 |
283 HBufC* newDescription = ReplaceCharactersFromBufferLC( |
234 HBufC* newDescription = ReplaceCharactersFromBufferLC( |
284 iEntry->DescriptionL(), |
235 iEntry->DescriptionL(), |
285 KReplaceLineFeedChar(), |
236 KReplaceLineFeedChar(), |
286 KLineFeed() ); |
237 KLineFeed() ); |
287 iEntry->SetDescriptionL( *newDescription ); |
238 iEntry->SetDescriptionL( *newDescription ); |
|
239 iOrginalEntry->SetDescriptionL( *newDescription ); |
|
240 |
288 CleanupStack::PopAndDestroy( newDescription ); |
241 CleanupStack::PopAndDestroy( newDescription ); |
289 |
242 |
|
243 __ASSERT_DEBUG( iEntry->PhoneOwnerL(), Panic( EESMRPhoneOwnerNotSet) ); |
|
244 |
|
245 CESMRFeatureSettings* settings = CESMRFeatureSettings::NewL(); |
|
246 if ( settings->FeatureSupported( |
|
247 CESMRFeatureSettings::EMRUIMeetingRequestViewerCmailOnly ) ) |
|
248 { |
|
249 // Meeting request viewer available only from email. |
|
250 // Remove attachments from entry. |
|
251 iRemoveAttachments = ETrue; |
|
252 } |
|
253 delete settings; |
290 } |
254 } |
291 |
255 |
292 // --------------------------------------------------------------------------- |
256 // --------------------------------------------------------------------------- |
293 // CESMRMeetingRequestEntry::ReplaceCharactersFromBufferL |
257 // CESMRMeetingRequestEntry::ReplaceCharactersFromBufferL |
294 // --------------------------------------------------------------------------- |
258 // --------------------------------------------------------------------------- |
295 // |
259 // |
296 HBufC* CESMRMeetingRequestEntry::ReplaceCharactersFromBufferLC( const TDesC& aTarget, |
260 HBufC* CESMRMeetingRequestEntry::ReplaceCharactersFromBufferLC( const TDesC& aTarget, |
297 const TDesC& aFindString, |
261 const TDesC& aFindString, |
298 const TDesC& aReplacement ) |
262 const TDesC& aReplacement ) |
299 { |
263 { |
300 FUNC_LOG; |
264 FUNC_LOG; |
301 HBufC* newBuffer = aTarget.AllocLC(); |
265 HBufC* newBuffer = aTarget.AllocLC(); |
302 TPtr16 ptr = newBuffer->Des(); |
266 TPtr16 ptr = newBuffer->Des(); |
303 |
267 |
304 // find next occurance: |
268 // find next occurance: |
305 TInt offset = ptr.Find(aFindString); |
269 TInt offset = ptr.Find(aFindString); |
306 while ( offset != KErrNotFound ) |
270 while ( offset != KErrNotFound ) |
307 { |
271 { |
308 // replace the data: |
272 // replace the data: |
309 ptr.Replace( offset, aFindString.Length(), aReplacement); |
273 ptr.Replace( offset, aFindString.Length(), aReplacement); |
310 |
274 |
311 // find next occurance: |
275 // find next occurance: |
312 offset = ptr.Find(aFindString); |
276 offset = ptr.Find(aFindString); |
313 } |
277 } |
314 |
278 |
315 return newBuffer; |
279 return newBuffer; |
316 } |
280 } |
317 |
281 |
318 // --------------------------------------------------------------------------- |
282 // --------------------------------------------------------------------------- |
319 // CESMRMeetingRequestEntry::Type |
283 // CESMRMeetingRequestEntry::Type |
320 // --------------------------------------------------------------------------- |
284 // --------------------------------------------------------------------------- |
321 // |
285 // |
609 if ( instance ) |
567 if ( instance ) |
610 { |
568 { |
611 CleanupStack::PushL( instance ); |
569 CleanupStack::PushL( instance ); |
612 |
570 |
613 CCalEntry::TMethod entryMethod( iEntry->MethodL() ); |
571 CCalEntry::TMethod entryMethod( iEntry->MethodL() ); |
614 CCalEntry* iBackupEntry=ESMRHelper::CopyEntryL( |
572 |
615 *iEntry, |
573 delete iEntry; |
616 entryMethod, |
|
617 ESMRHelper::ECopyFull); |
|
618 delete iEntry; |
|
619 iEntry = NULL; |
574 iEntry = NULL; |
620 |
575 |
621 delete iForwardEntry; |
576 delete iForwardEntry; |
622 iForwardEntry = NULL; |
577 iForwardEntry = NULL; |
623 |
578 |
624 delete iOrginalEntry; |
579 delete iOrginalEntry; |
625 iOrginalEntry = NULL; |
580 iOrginalEntry = NULL; |
626 |
581 |
627 RCPointerArray<CCalEntry> entries; |
582 RCPointerArray<CCalEntry> entries; |
628 CleanupClosePushL( entries ); |
583 CleanupClosePushL( entries ); |
629 |
584 |
630 iCalDb.NormalDbEntryView()->FetchL( |
585 iCalDb.EntryViewL( instance->Entry() )->FetchL( |
631 instance->Entry().UidL(), entries ); |
586 instance->Entry().UidL(), entries ); |
632 |
587 |
633 TInt parentIndex( KErrNotFound ); |
588 TInt parentIndex( KErrNotFound ); |
634 TInt entryCount( entries.Count() ); |
589 TInt entryCount( entries.Count() ); |
635 for ( TInt i(0); i < entryCount && KErrNotFound == parentIndex; ++i ) |
590 for ( TInt i(0); i < entryCount && KErrNotFound == parentIndex; ++i ) |
636 { |
591 { |
637 TBool modifyingEntry( ESMREntryHelper::IsModifyingEntryL( *entries[i]) ); |
592 TBool modifyingEntry( ESMREntryHelper::IsModifyingEntryL( *entries[i]) ); |
638 if ( !modifyingEntry ) |
593 if ( !modifyingEntry ) |
639 { |
594 { |
640 parentIndex = i; |
595 parentIndex = i; |
641 } |
596 } |
642 } |
597 } |
643 |
598 |
644 __ASSERT_DEBUG( KErrNotFound != parentIndex, Panic(EESMRParentNotFound) ); |
599 __ASSERT_DEBUG( KErrNotFound != parentIndex, Panic(EESMRParentNotFound) ); |
645 |
600 |
646 CCalEntry& parent = *entries[parentIndex]; |
601 CCalEntry& parent = *entries[parentIndex]; |
647 |
602 |
648 TPtrC description( parent.DescriptionL() ); |
603 TPtrC description( parent.DescriptionL() ); |
649 |
604 |
650 iEntry = ESMRHelper::CopyEntryL( |
605 iEntry = CopyEntryL( iMRMailboxUtils, parent ); |
651 parent, |
606 |
652 parent.MethodL(), |
|
653 ESMRHelper::ECopyFull ); |
|
654 |
|
655 CESMRFsMailboxUtils* fsMbUtils = |
|
656 CESMRFsMailboxUtils::NewL( iMRMailboxUtils ); |
|
657 CleanupStack::PushL( fsMbUtils ); |
|
658 |
|
659 fsMbUtils->SetPhoneOwnerL( *iBackupEntry ); |
|
660 CleanupStack::PopAndDestroy( fsMbUtils ); |
|
661 fsMbUtils = NULL; |
|
662 |
|
663 // Adjust parent entry's start and end time to entry |
607 // Adjust parent entry's start and end time to entry |
664 TCalTime start; |
608 TCalTime start; |
665 TCalTime end; |
609 TCalTime end; |
666 |
610 |
667 CESMRRecurrenceInfoHandler* recurrenceHandler = |
611 CESMRRecurrenceInfoHandler* recurrenceHandler = |
726 |
674 |
727 // set the start time to 0:00 |
675 // set the start time to 0:00 |
728 start.Set( aStartDate.DateTime().Year(), |
676 start.Set( aStartDate.DateTime().Year(), |
729 aStartDate.DateTime().Month(), |
677 aStartDate.DateTime().Month(), |
730 aStartDate.DateTime().Day(), |
678 aStartDate.DateTime().Day(), |
731 KZero, |
679 0, |
732 KZero, |
680 0, |
733 KZero, |
681 0, |
734 KZero); |
682 0); |
735 |
683 |
736 // set the end date to next day from given end date since |
684 // set the end date to next day from given end date since |
737 // all day event should last 24 hours. |
685 // all day event should last 24 hours. |
738 TTime endDate = aEndDate + TTimeIntervalDays( 1 ); |
686 TTime endDate = aEndDate + TTimeIntervalDays( 1 ); |
739 end.Set( endDate.DateTime().Year(), |
687 end.Set( endDate.DateTime().Year(), |
740 endDate.DateTime().Month(), |
688 endDate.DateTime().Month(), |
741 endDate.DateTime().Day(), |
689 endDate.DateTime().Day(), |
742 KZero, |
690 0, |
743 KZero, |
691 0, |
744 KZero, |
692 0, |
745 KZero ); |
693 0 ); |
746 |
694 |
747 startTime.SetTimeLocalL( start ); |
695 startTime.SetTimeLocalL( start ); |
748 stopTime.SetTimeLocalL( end ); |
696 stopTime.SetTimeLocalL( end ); |
749 |
697 |
750 iEntry->SetStartAndEndTimeL( startTime, stopTime ); |
698 iEntry->SetStartAndEndTimeL( startTime, stopTime ); |
999 { |
944 { |
1000 FUNC_LOG; |
945 FUNC_LOG; |
1001 return *iOrginalEntry; |
946 return *iOrginalEntry; |
1002 } |
947 } |
1003 |
948 |
|
949 |
|
950 // --------------------------------------------------------------------------- |
|
951 // CESMRMeetingRequestEntry::UpdateEntryAfterStoringL |
|
952 // --------------------------------------------------------------------------- |
|
953 // |
|
954 void CESMRMeetingRequestEntry::UpdateEntryAfterStoringL() |
|
955 { |
|
956 FUNC_LOG; |
|
957 |
|
958 __ASSERT_DEBUG( iEntry, Panic(EESMREntryNotExist ) ); |
|
959 |
|
960 CCalEntry* storedEntry = NULL; |
|
961 |
|
962 |
|
963 if ( IsRecurrentEventL() && |
|
964 EESMRThisOnly == iRecurrenceModRule && |
|
965 !IsForwardedL() && IsStoredL() && |
|
966 !ESMREntryHelper::IsModifyingEntryL(*iEntry) ) |
|
967 { |
|
968 // We have stored one instance of series. |
|
969 storedEntry = iCalDb.FetchEntryL( |
|
970 iEntry->UidL(), |
|
971 iOrginalEntry->StartTimeL() ); |
|
972 } |
|
973 else |
|
974 { |
|
975 // We are dealing with single instance or with the series |
|
976 storedEntry = iCalDb.FetchEntryL( |
|
977 iEntry->UidL(), |
|
978 iEntry->RecurrenceIdL() ); |
|
979 } |
|
980 |
|
981 |
|
982 __ASSERT_DEBUG( storedEntry, Panic( EESMREntryNotExist ) ); |
|
983 CleanupStack::PushL( storedEntry ); |
|
984 |
|
985 // Description needs to be fecthed explicitly into memory |
|
986 TPtrC description( storedEntry->DescriptionL() ); |
|
987 |
|
988 |
|
989 delete iEntry; |
|
990 iEntry = NULL; |
|
991 iEntry = CopyEntryL( iMRMailboxUtils, *storedEntry ); |
|
992 |
|
993 if ( MESMRCalEntry::EESMRAllInSeries == iRecurrenceModRule && |
|
994 IsRecurrentEventL() ) |
|
995 { |
|
996 // Adjust parent entry's start and end time to entry |
|
997 TCalTime start; |
|
998 TCalTime end; |
|
999 |
|
1000 CESMRRecurrenceInfoHandler* recurrenceHandler = |
|
1001 CESMRRecurrenceInfoHandler::NewLC( *iEntry ); |
|
1002 |
|
1003 recurrenceHandler->GetFirstInstanceTimeL( start, end ); |
|
1004 CleanupStack::PopAndDestroy( recurrenceHandler ); |
|
1005 recurrenceHandler = NULL; |
|
1006 |
|
1007 iEntry->SetStartAndEndTimeL( start, end ); |
|
1008 iEntry->SetDescriptionL( description ); |
|
1009 } |
|
1010 |
|
1011 CCalEntry* temp = CopyEntryL( iMRMailboxUtils, *iEntry ); |
|
1012 |
|
1013 delete iOrginalEntry; |
|
1014 iOrginalEntry = temp; |
|
1015 |
|
1016 CleanupStack::PopAndDestroy( storedEntry ); |
|
1017 } |
|
1018 |
|
1019 // ---------------------------------------------------------------------------- |
|
1020 // CMRCalEntry::UpdateComparativeEntry |
|
1021 // ---------------------------------------------------------------------------- |
|
1022 // |
|
1023 void CESMRMeetingRequestEntry::UpdateComparativeEntry( |
|
1024 CCalEntry* aNewComparativeEntry ) |
|
1025 { |
|
1026 FUNC_LOG; |
|
1027 |
|
1028 if( iOrginalEntry ) // Update comparative entry |
|
1029 { |
|
1030 delete iOrginalEntry; |
|
1031 iOrginalEntry = NULL; |
|
1032 |
|
1033 iOrginalEntry = aNewComparativeEntry; |
|
1034 } |
|
1035 |
|
1036 } |
|
1037 |
|
1038 // --------------------------------------------------------------------------- |
|
1039 // CESMRMeetingRequestEntry::SetDefaultValuesToEntryL |
|
1040 // --------------------------------------------------------------------------- |
|
1041 // |
|
1042 void CESMRMeetingRequestEntry::SetDefaultValuesToEntryL() |
|
1043 { |
|
1044 FUNC_LOG; |
|
1045 |
|
1046 if ( !IsStoredL() ) |
|
1047 { |
|
1048 SetPriorityL( EFSCalenMRPriorityNormal ); |
|
1049 |
|
1050 // Get default alarm time from central repository |
|
1051 TInt defaultAlarmTime=0; |
|
1052 CRepository* repository = CRepository::NewLC( KCRUidCalendar ); |
|
1053 |
|
1054 TInt err = KErrNotFound; |
|
1055 |
|
1056 if ( repository ) |
|
1057 { |
|
1058 err = repository->Get( |
|
1059 KCalendarDefaultAlarmTime, |
|
1060 defaultAlarmTime ); |
|
1061 CleanupStack::PopAndDestroy( repository ); |
|
1062 } |
|
1063 |
|
1064 if ( err != KErrNone ) |
|
1065 { |
|
1066 // By default 15 minutes if not found from central repository |
|
1067 defaultAlarmTime = KDefaultMeetingAlarmMinutes; |
|
1068 } |
|
1069 |
|
1070 // Getting current time |
|
1071 TTime currentTime; |
|
1072 currentTime.HomeTime(); |
|
1073 |
|
1074 // Getting meeting start time |
|
1075 TTime start = iEntry->StartTimeL().TimeLocalL(); |
|
1076 |
|
1077 // Create default alarm |
|
1078 CCalAlarm* alarm = CCalAlarm::NewL(); |
|
1079 CleanupStack::PushL( alarm ); |
|
1080 |
|
1081 TTimeIntervalMinutes alarmOffset( defaultAlarmTime ); |
|
1082 |
|
1083 // If alarm time is in past |
|
1084 if ( ( start - alarmOffset ) < currentTime ) |
|
1085 { |
|
1086 // Setting alarm off |
|
1087 iEntry->SetAlarmL( NULL ); |
|
1088 } |
|
1089 else |
|
1090 { |
|
1091 // Set default alarm time |
|
1092 alarm->SetTimeOffset( alarmOffset ); |
|
1093 iEntry->SetAlarmL( alarm ); |
|
1094 } |
|
1095 CleanupStack::PopAndDestroy( alarm ); |
|
1096 } |
|
1097 |
|
1098 // Set the default end time if not set by client |
|
1099 if ( iEntry->StartTimeL().TimeUtcL() == iEntry->EndTimeL().TimeUtcL() ) |
|
1100 { |
|
1101 // This value might also be read from cenrep |
|
1102 TTimeIntervalHours KDefaultMeetingDuration(1); |
|
1103 |
|
1104 TCalTime newEndTime; |
|
1105 newEndTime.SetTimeUtcL( |
|
1106 iEntry->StartTimeL().TimeUtcL() + KDefaultMeetingDuration ); |
|
1107 iEntry->SetStartAndEndTimeL(iEntry->StartTimeL(), newEndTime); |
|
1108 } |
|
1109 |
|
1110 iEntry->SetReplicationStatusL( CCalEntry::EOpen ); |
|
1111 |
|
1112 //Original entry must be stored after the default values are set. |
|
1113 //Otherwise it looks like settings are changed even though they haven't |
|
1114 CCalEntry* temp = CopyEntryL( iMRMailboxUtils, *iEntry ); |
|
1115 |
|
1116 delete iOrginalEntry; |
|
1117 iOrginalEntry = temp; |
|
1118 } |
|
1119 |
|
1120 // --------------------------------------------------------------------------- |
|
1121 // CESMRMeetingRequestEntry::CloneEntryLC |
|
1122 // --------------------------------------------------------------------------- |
|
1123 // |
|
1124 CCalEntry* CESMRMeetingRequestEntry::CloneEntryLC( |
|
1125 TESMRCalEntryType aType ) const |
|
1126 { |
|
1127 CCalEntry* entry = |
|
1128 ESMRHelper::CopyEntryLC( *iEntry, |
|
1129 iEntry->MethodL(), |
|
1130 ESMRHelper::ECopyFull, |
|
1131 TESMRCalendarEventType( aType ) ); |
|
1132 |
|
1133 return entry; |
|
1134 } |
1004 |
1135 |
1005 // --------------------------------------------------------------------------- |
1136 // --------------------------------------------------------------------------- |
1006 // CESMRMeetingRequestEntry::RoleL |
1137 // CESMRMeetingRequestEntry::RoleL |
1007 // --------------------------------------------------------------------------- |
1138 // --------------------------------------------------------------------------- |
1008 // |
1139 // |
1504 // create new (child) entry |
1627 // create new (child) entry |
1505 entry = CCalEntry::NewL( |
1628 entry = CCalEntry::NewL( |
1506 parent.EntryTypeL(), |
1629 parent.EntryTypeL(), |
1507 guid, |
1630 guid, |
1508 parent.MethodL(), |
1631 parent.MethodL(), |
1509 KZero, |
1632 0, |
1510 iOrginalEntry->StartTimeL(), |
1633 iOrginalEntry->StartTimeL(), |
1511 CalCommon::EThisOnly ); |
1634 CalCommon::EThisOnly ); |
1512 |
1635 |
1513 CleanupStack::Pop( guid ); |
1636 CleanupStack::Pop( guid ); |
1514 guid = NULL; // ownership transferred |
1637 guid = NULL; // ownership transferred |
1515 } |
1638 } |
1516 |
1639 |
1517 CleanupStack::PopAndDestroy( instance ); |
1640 CleanupStack::PopAndDestroy( instance ); |
1518 instance = NULL; // instance |
1641 instance = NULL; // instance |
1519 CleanupStack::PushL( entry ); |
1642 CleanupStack::PushL( entry ); |
1520 |
1643 |
1521 |
1644 |
1522 CCalEntry::TMethod method( iEntry->MethodL() ); |
1645 CCalEntry::TMethod method( iEntry->MethodL() ); |
1523 |
1646 |
1524 entry->CopyFromL( *iEntry, CCalEntry::EDontCopyId ); |
1647 entry->CopyFromL( *iEntry, CCalEntry::EDontCopyId ); |
1525 entry->SetSequenceNumberL( KZero ); |
1648 entry->SetSequenceNumberL( 0 ); |
1526 entry->SetMethodL( method ); |
1649 entry->SetMethodL( method ); |
1527 entry->SetSummaryL( iEntry->SummaryL() ); |
1650 entry->SetSummaryL( iEntry->SummaryL() ); |
1528 entry->SetLocalUidL( TCalLocalUid( 0 ) ); |
1651 entry->SetLocalUidL( TCalLocalUid( 0 ) ); |
1529 entry->ClearRepeatingPropertiesL(); |
1652 entry->ClearRepeatingPropertiesL(); |
|
1653 iMRMailboxUtils.SetPhoneOwnerL( *entry ); |
1530 |
1654 |
1531 CleanupStack::Pop( entry ); |
1655 CleanupStack::Pop( entry ); |
1532 } |
1656 } |
1533 } |
1657 } |
1534 |
1658 |
1535 if ( !entry ) |
1659 if ( !entry ) |
1536 { |
1660 { |
1537 |
1661 entry = CopyEntryL( iMRMailboxUtils, *iEntry ); |
1538 entry = ESMRHelper::CopyEntryL( |
1662 } |
1539 *iEntry, |
1663 |
1540 iEntry->MethodL(), |
1664 if ( iRemoveAttachments ) |
1541 ESMRHelper::ECopyFull ); |
1665 { |
1542 |
1666 // Remove attachments from the entry |
1543 } |
1667 TInt count( entry->AttachmentCountL() ); |
1544 |
1668 |
|
1669 for ( TInt i = 0; i < count; ++i ) |
|
1670 { |
|
1671 CCalAttachment* attachment = entry->AttachmentL( i ); |
|
1672 entry->DeleteAttachmentL( *attachment ); |
|
1673 } |
|
1674 } |
1545 |
1675 |
1546 return entry; |
1676 return entry; |
1547 } |
1677 } |
1548 |
1678 |
1549 // --------------------------------------------------------------------------- |
1679 // --------------------------------------------------------------------------- |
1777 |
1906 |
1778 return retEntry; |
1907 return retEntry; |
1779 } |
1908 } |
1780 |
1909 |
1781 // --------------------------------------------------------------------------- |
1910 // --------------------------------------------------------------------------- |
1782 // CESMRMeetingRequestEntry::SetDefaultValuesToEntryL |
|
1783 // --------------------------------------------------------------------------- |
|
1784 // |
|
1785 void CESMRMeetingRequestEntry::SetDefaultValuesToEntryL() |
|
1786 { |
|
1787 FUNC_LOG; |
|
1788 |
|
1789 if ( !IsStoredL() ) |
|
1790 { |
|
1791 SetPriorityL( EFSCalenMRPriorityNormal ); |
|
1792 |
|
1793 // Get default alarm time from central repository |
|
1794 TInt defaultAlarmTime=0; |
|
1795 CRepository* repository = CRepository::NewLC( KCRUidCalendar ); |
|
1796 |
|
1797 TInt err = KErrNotFound; |
|
1798 |
|
1799 if ( repository ) |
|
1800 { |
|
1801 err = repository->Get( |
|
1802 KCalendarDefaultAlarmTime, |
|
1803 defaultAlarmTime ); |
|
1804 CleanupStack::PopAndDestroy( repository ); |
|
1805 } |
|
1806 |
|
1807 if ( err != KErrNone ) |
|
1808 { |
|
1809 // By default 15 minutes if not found from central repository |
|
1810 defaultAlarmTime = KDefaultMeetingAlarmMinutes; |
|
1811 } |
|
1812 |
|
1813 // Getting current time |
|
1814 TTime currentTime; |
|
1815 currentTime.HomeTime(); |
|
1816 |
|
1817 // Getting meeting start time |
|
1818 TTime start = iEntry->StartTimeL().TimeLocalL(); |
|
1819 |
|
1820 // Create default alarm |
|
1821 CCalAlarm* alarm = CCalAlarm::NewL(); |
|
1822 CleanupStack::PushL( alarm ); |
|
1823 |
|
1824 TTimeIntervalMinutes alarmOffset( defaultAlarmTime ); |
|
1825 |
|
1826 // If alarm time is in past |
|
1827 if ( ( start - alarmOffset ) < currentTime ) |
|
1828 { |
|
1829 // Setting alarm off |
|
1830 iEntry->SetAlarmL( NULL ); |
|
1831 } |
|
1832 else |
|
1833 { |
|
1834 // Set default alarm time |
|
1835 alarm->SetTimeOffset( alarmOffset ); |
|
1836 iEntry->SetAlarmL( alarm ); |
|
1837 } |
|
1838 CleanupStack::PopAndDestroy( alarm ); |
|
1839 } |
|
1840 |
|
1841 // Set the default end time if not set by client |
|
1842 if ( iEntry->StartTimeL().TimeUtcL() == iEntry->EndTimeL().TimeUtcL() ) |
|
1843 { |
|
1844 // This value might also be read from cenrep |
|
1845 TTimeIntervalHours KDefaultMeetingDuration(1); |
|
1846 |
|
1847 TCalTime newEndTime; |
|
1848 newEndTime.SetTimeUtcL( |
|
1849 iEntry->StartTimeL().TimeUtcL() + KDefaultMeetingDuration ); |
|
1850 iEntry->SetStartAndEndTimeL(iEntry->StartTimeL(), newEndTime); |
|
1851 } |
|
1852 |
|
1853 iEntry->SetReplicationStatusL( CCalEntry::EOpen ); |
|
1854 |
|
1855 //Original entry must be stored after the default values are set. |
|
1856 //Otherwise it looks like settings are changed even though they haven't |
|
1857 |
|
1858 CCalEntry* temp = ESMRHelper::CopyEntryL( |
|
1859 *iEntry, |
|
1860 iEntry->MethodL(), |
|
1861 ESMRHelper::ECopyFull ); |
|
1862 |
|
1863 delete iOrginalEntry; |
|
1864 iOrginalEntry = temp; |
|
1865 |
|
1866 } |
|
1867 |
|
1868 |
|
1869 // --------------------------------------------------------------------------- |
|
1870 // CESMRMeetingRequestEntry::IsOpenedFromMail |
1911 // CESMRMeetingRequestEntry::IsOpenedFromMail |
1871 // --------------------------------------------------------------------------- |
1912 // --------------------------------------------------------------------------- |
1872 // |
1913 // |
1873 TBool CESMRMeetingRequestEntry::IsOpenedFromMail() const |
1914 TBool CESMRMeetingRequestEntry::IsOpenedFromMail() const |
1874 { |
1915 { |
1998 CleanupStack::PopAndDestroy( ¤tAttendees ); |
2039 CleanupStack::PopAndDestroy( ¤tAttendees ); |
1999 |
2040 |
2000 } |
2041 } |
2001 |
2042 |
2002 // --------------------------------------------------------------------------- |
2043 // --------------------------------------------------------------------------- |
2003 // CESMRMeetingRequestEntry::UpdateEntryAfterStoringL |
|
2004 // --------------------------------------------------------------------------- |
|
2005 // |
|
2006 void CESMRMeetingRequestEntry::UpdateEntryAfterStoringL() |
|
2007 { |
|
2008 FUNC_LOG; |
|
2009 |
|
2010 __ASSERT_DEBUG( iEntry, Panic(EESMREntryNotExist ) ); |
|
2011 |
|
2012 CCalEntry* temp = ESMRHelper::CopyEntryL( |
|
2013 *iEntry, |
|
2014 iEntry->MethodL(), |
|
2015 ESMRHelper::ECopyFull ); |
|
2016 |
|
2017 delete iOrginalEntry; |
|
2018 iOrginalEntry = temp; |
|
2019 |
|
2020 } |
|
2021 |
|
2022 // --------------------------------------------------------------------------- |
|
2023 // CESMRMeetingRequestEntry::UpdateChildEntriesSeqNumbersL |
2044 // CESMRMeetingRequestEntry::UpdateChildEntriesSeqNumbersL |
2024 // --------------------------------------------------------------------------- |
2045 // --------------------------------------------------------------------------- |
2025 // |
2046 // |
2026 void CESMRMeetingRequestEntry::UpdateChildEntriesSeqNumbersL() |
2047 void CESMRMeetingRequestEntry::UpdateChildEntriesSeqNumbersL() |
2027 { |
2048 { |
2028 FUNC_LOG; |
2049 FUNC_LOG; |
2029 |
2050 |
2030 if ( MESMRCalEntry::EESMRAllInSeries == iRecurrenceModRule && |
2051 if ( MESMRCalEntry::EESMRAllInSeries == iRecurrenceModRule && |
2031 IsStoredL() ) |
2052 IsStoredL() ) |
2032 { |
2053 { |
2033 RCPointerArray<CCalEntry> childEntries; |
2054 RCPointerArray<CCalEntry> childEntries; |
2034 CleanupClosePushL( childEntries ); |
2055 CleanupClosePushL( childEntries ); |
2035 |
2056 |
2036 // Fetch all entries (this and child entries |
2057 // Fetch all entries (this and child entries |
2037 iCalDb.NormalDbEntryView()->FetchL( |
2058 iCalDb.EntryView()->FetchL( |
2038 iEntry->UidL(), |
2059 iEntry->UidL(), |
2039 childEntries ); |
2060 childEntries ); |
2040 |
2061 |
2041 // Next: Remove parent entry from the array |
2062 // Next: Remove parent entry from the array |
2042 TBool removed( EFalse ); |
2063 TBool removed( EFalse ); |
2043 TInt entryCount( childEntries.Count() ); |
2064 TInt entryCount( childEntries.Count() ); |
2044 for ( TInt i(0); (i < entryCount) && !removed; ++i ) |
2065 for ( TInt i(0); (i < entryCount) && !removed; ++i ) |
2045 { |
2066 { |
2046 CCalEntry* entry = childEntries[i]; |
2067 CCalEntry* entry = childEntries[i]; |
2047 |
2068 |
2048 if ( !ESMREntryHelper::IsModifyingEntryL( *entry) ) |
2069 if ( !ESMREntryHelper::IsModifyingEntryL( *entry) ) |
2049 { |
2070 { |
2050 removed = ETrue; |
2071 removed = ETrue; |
2051 childEntries.Remove( i ); |
2072 childEntries.Remove( i ); |
2052 delete entry; |
2073 delete entry; |
2053 } |
2074 } |
2054 entry = NULL; |
2075 entry = NULL; |
2055 } |
2076 } |
2056 |
2077 |
2057 TInt childCount( childEntries.Count() ); |
2078 TInt childCount( childEntries.Count() ); |
2058 if ( childCount ) |
2079 if ( childCount ) |
2059 { |
2080 { |
2060 for (TInt i(0); i < childCount; ++i ) |
2081 for (TInt i(0); i < childCount; ++i ) |
2061 { |
2082 { |
2062 CCalEntry* child = childEntries[i]; |
2083 CCalEntry* child = childEntries[i]; |
2063 TInt childSeqNo( child->SequenceNumberL() ); |
2084 TInt childSeqNo( child->SequenceNumberL() ); |
2064 child->SetSequenceNumberL( childSeqNo + 1); |
2085 child->SetSequenceNumberL( childSeqNo + 1); |
2065 } |
2086 } |
2066 |
2087 |
2067 TInt updatedChilds; |
2088 TInt updatedChilds; |
2068 iCalDb.NormalDbEntryView()->StoreL(childEntries, updatedChilds); |
2089 iCalDb.EntryView()->StoreL(childEntries, updatedChilds); |
2069 } |
2090 } |
2070 |
2091 |
2071 CleanupStack::PopAndDestroy(); // childEntries |
2092 CleanupStack::PopAndDestroy(); // childEntries |
2072 } |
2093 } |
2073 |
2094 |
2074 } |
2095 } |
2075 |
2096 |
2076 // --------------------------------------------------------------------------- |
2097 // --------------------------------------------------------------------------- |
2077 // CESMRMeetingRequestEntry::CurrentPluginL |
2098 // CESMRMeetingRequestEntry::CurrentPluginL |
2078 // --------------------------------------------------------------------------- |
2099 // --------------------------------------------------------------------------- |
2079 // |
2100 // |
2081 { |
2102 { |
2082 FUNC_LOG; |
2103 FUNC_LOG; |
2083 |
2104 |
2084 if ( EESMRUnknownPlugin == iCurrentFSEmailPlugin) |
2105 if ( EESMRUnknownPlugin == iCurrentFSEmailPlugin) |
2085 { |
2106 { |
2086 CESMRFsMailboxUtils* fsMbUtils = |
2107 CESMRFsMailboxUtils* fsMbUtils = |
2087 CESMRFsMailboxUtils::NewL( iMRMailboxUtils ); |
2108 CESMRFsMailboxUtils::NewL( iMRMailboxUtils ); |
2088 CleanupStack::PushL( fsMbUtils ); |
2109 CleanupStack::PushL( fsMbUtils ); |
2089 |
2110 |
2090 iCurrentFSEmailPlugin = fsMbUtils->FSEmailPluginForEntryL( *iEntry ); |
2111 iCurrentFSEmailPlugin = fsMbUtils->FSEmailPluginForEntryL( *iEntry ); |
2091 CleanupStack::PopAndDestroy( fsMbUtils ); |
2112 CleanupStack::PopAndDestroy( fsMbUtils ); |
2092 fsMbUtils = NULL; |
2113 fsMbUtils = NULL; |
2093 } |
2114 } |
2094 |
|
2095 |
2115 |
2096 return iCurrentFSEmailPlugin; |
2116 return iCurrentFSEmailPlugin; |
2097 } |
2117 } |
2098 |
2118 |
2099 // --------------------------------------------------------------------------- |
2119 // --------------------------------------------------------------------------- |
2100 // CESMRMeetingRequestEntry::CurrentMailBoxIdL |
|
2101 // --------------------------------------------------------------------------- |
|
2102 // |
|
2103 TFSMailMsgId CESMRMeetingRequestEntry::CurrentMailBoxIdL() |
|
2104 { |
|
2105 FUNC_LOG; |
|
2106 CESMRFsMailboxUtils* fsMbUtils = |
|
2107 CESMRFsMailboxUtils::NewL( iMRMailboxUtils ); |
|
2108 CleanupStack::PushL( fsMbUtils ); |
|
2109 TFSMailMsgId retVal = fsMbUtils->FSEmailMailBoxForEntryL( *iEntry ); |
|
2110 CleanupStack::PopAndDestroy( fsMbUtils ); |
|
2111 return retVal; |
|
2112 } |
|
2113 |
|
2114 // --------------------------------------------------------------------------- |
|
2115 // CESMRMeetingRequestEntry::UpdateTimeStampL |
2120 // CESMRMeetingRequestEntry::UpdateTimeStampL |
2116 // --------------------------------------------------------------------------- |
2121 // --------------------------------------------------------------------------- |
2117 // |
2122 // |
2118 void CESMRMeetingRequestEntry::UpdateTimeStampL() |
2123 void CESMRMeetingRequestEntry::UpdateTimeStampL() |
2119 { |
2124 { |
2120 FUNC_LOG; |
2125 FUNC_LOG; |
2121 __ASSERT_DEBUG( iEntry, Panic(EESMREntryNotExist ) ); |
2126 __ASSERT_DEBUG( iEntry, Panic(EESMREntryNotExist ) ); |
2122 |
2127 |
2123 TTime currentUTCTime; |
2128 TTime currentUTCTime; |
2124 currentUTCTime.UniversalTime(); |
2129 currentUTCTime.UniversalTime(); |
2125 |
2130 |
2126 TCalTime currentTime; |
2131 TCalTime currentTime; |
2127 currentTime.SetTimeUtcL( currentUTCTime ); |
2132 currentTime.SetTimeUtcL( currentUTCTime ); |
2128 |
2133 |
2129 iEntry->SetDTStampL( currentTime ); |
2134 iEntry->SetDTStampL( currentTime ); |
2130 } |
2135 } |
2131 |
2136 |
2132 // --------------------------------------------------------------------------- |
2137 // --------------------------------------------------------------------------- |
2133 // CESMRMeetingRequestEntry::UpdateTimeStampL |
2138 // CESMRMeetingRequestEntry::AnyInstancesBetweenTimePeriodL |
2134 // --------------------------------------------------------------------------- |
2139 // --------------------------------------------------------------------------- |
2135 // |
2140 // |
2136 TBool CESMRMeetingRequestEntry::AnyInstanceOnDayL( |
2141 TBool CESMRMeetingRequestEntry::AnyInstancesBetweenTimePeriodL( |
2137 TTime& aStart, |
2142 TTime& aStart, |
2138 TTime& aEnd ) |
2143 TTime& aEnd ) |
2139 { |
2144 { |
2140 FUNC_LOG; |
2145 FUNC_LOG; |
|
2146 |
|
2147 __ASSERT_DEBUG( iEntry, Panic(EESMREntryNotExist ) ); |
|
2148 __ASSERT_DEBUG( iOrginalEntry, Panic(EESMREntryNotExist ) ); |
|
2149 |
|
2150 TBool retValue( EFalse ); |
|
2151 |
|
2152 RCPointerArray<CCalEntry> entries; |
|
2153 CleanupClosePushL( entries ); |
|
2154 |
|
2155 CESMRConflictChecker* conflictCheckker = |
|
2156 CESMRConflictChecker::NewL( iCalDb ); |
|
2157 CleanupStack::PushL( conflictCheckker ); |
|
2158 |
|
2159 CCalInstance* instance = InstanceL(); |
|
2160 CleanupStack::PushL( instance ); |
|
2161 |
|
2162 TCalCollectionId colId = instance->InstanceIdL().iCollectionId; |
|
2163 CleanupStack::PopAndDestroy( instance ); |
|
2164 |
|
2165 conflictCheckker->FindInstancesForEntryL( aStart, |
|
2166 aEnd, |
|
2167 *iEntry, |
|
2168 colId, |
|
2169 entries ); |
|
2170 |
|
2171 if ( entries.Count() ) |
|
2172 { |
|
2173 retValue = ETrue; |
|
2174 } |
|
2175 |
|
2176 CleanupStack::PopAndDestroy( conflictCheckker ); |
|
2177 CleanupStack::PopAndDestroy(); // entries |
|
2178 |
|
2179 return retValue; |
|
2180 } |
|
2181 |
|
2182 // --------------------------------------------------------------------------- |
|
2183 // CESMRMeetingRequestEntry::GetFirstInstanceStartAndEndTimeL |
|
2184 // --------------------------------------------------------------------------- |
|
2185 // |
|
2186 void CESMRMeetingRequestEntry::GetFirstInstanceStartAndEndTimeL( |
|
2187 TTime& aStart, |
|
2188 TTime& aEnd ) |
|
2189 { |
|
2190 FUNC_LOG; |
|
2191 |
|
2192 __ASSERT_DEBUG( iEntry, Panic(EESMREntryNotExist ) ); |
|
2193 |
|
2194 // This fetches the parent entry |
|
2195 TCalTime recurrenceId; |
|
2196 recurrenceId.SetTimeLocalL( Time::NullTTime() ); |
|
2197 CCalEntry* parent = iCalDb.FetchEntryL( |
|
2198 iEntry->UidL(), |
|
2199 recurrenceId ); |
|
2200 |
|
2201 CleanupStack::PushL( parent ); |
|
2202 |
|
2203 aStart = parent->StartTimeL().TimeLocalL(); |
|
2204 aEnd = parent->EndTimeL().TimeLocalL(); |
|
2205 |
|
2206 CleanupStack::PopAndDestroy( parent ); |
|
2207 } |
|
2208 |
|
2209 // --------------------------------------------------------------------------- |
|
2210 // CESMRMeetingRequestEntry::CalendarOwnerAddressL |
|
2211 // --------------------------------------------------------------------------- |
|
2212 // |
|
2213 const TDesC& CESMRMeetingRequestEntry::CalendarOwnerAddressL() const |
|
2214 { |
|
2215 FUNC_LOG; |
|
2216 |
|
2217 __ASSERT_DEBUG( iEntry, Panic( EESMREntryNotExist ) ); |
|
2218 |
|
2219 CCalUser* po = iEntry->PhoneOwnerL(); |
|
2220 |
|
2221 __ASSERT_DEBUG( po, Panic( EESMRPhoneOwnerNotSet ) ); |
|
2222 |
|
2223 return po->Address(); |
|
2224 } |
|
2225 |
|
2226 // --------------------------------------------------------------------------- |
|
2227 // CESMRMeetingRequestEntry::MailboxUtils |
|
2228 // --------------------------------------------------------------------------- |
|
2229 // |
|
2230 CMRMailboxUtils& CESMRMeetingRequestEntry::MailboxUtils() const |
|
2231 { |
|
2232 return iMRMailboxUtils; |
|
2233 } |
|
2234 |
|
2235 // --------------------------------------------------------------------------- |
|
2236 // CESMRMeetingRequestEntry::GetDBMgr |
|
2237 // --------------------------------------------------------------------------- |
|
2238 // |
|
2239 MESMRCalDbMgr& CESMRMeetingRequestEntry::GetDBMgr() |
|
2240 { |
|
2241 return iCalDb; |
|
2242 } |
|
2243 |
|
2244 // --------------------------------------------------------------------------- |
|
2245 // CESMRMeetingRequestEntry::SupportsCapabilityL |
|
2246 // --------------------------------------------------------------------------- |
|
2247 // |
|
2248 TBool CESMRMeetingRequestEntry::SupportsCapabilityL( |
|
2249 MESMRCalEntry::TMREntryCapability aCapability ) const |
|
2250 { |
2141 TBool retValue( EFalse ); |
2251 TBool retValue( EFalse ); |
2142 |
2252 |
2143 RCPointerArray<CCalEntry> entries; |
2253 switch( aCapability ) |
2144 CleanupClosePushL( entries ); |
2254 { |
2145 |
2255 case MESMRCalEntry::EMRCapabilityAttachments: |
2146 CESMRConflictChecker* conflictCheckker = |
2256 { |
2147 CESMRConflictChecker::NewL( iCalDb ); |
2257 CESMRFsMailboxUtils* fsMbUtils = |
2148 CleanupStack::PushL( conflictCheckker ); |
2258 CESMRFsMailboxUtils::NewL( iMRMailboxUtils ); |
2149 |
2259 CleanupStack::PushL( fsMbUtils ); |
2150 conflictCheckker->FindInstancesForEntryL( aStart, |
2260 |
2151 aEnd, |
2261 retValue = fsMbUtils->DefaultMailboxSupportCapabilityL( |
2152 *iEntry, |
2262 CESMRFsMailboxUtils::EMRCapabilityAttachment ); |
2153 entries ); |
2263 CleanupStack::PopAndDestroy( fsMbUtils ); |
2154 |
2264 } |
2155 if ( entries.Count() ) |
2265 break; |
2156 { |
2266 } |
2157 retValue = ETrue; |
|
2158 } |
|
2159 |
|
2160 CleanupStack::PopAndDestroy( conflictCheckker ); |
|
2161 CleanupStack::PopAndDestroy(); // entries |
|
2162 |
2267 |
2163 return retValue; |
2268 return retValue; |
2164 } |
2269 } |
2165 |
2270 |
|
2271 // --------------------------------------------------------------------------- |
|
2272 // CESMRMeetingRequestEntry::ContainsRemoteAttachmentsL |
|
2273 // --------------------------------------------------------------------------- |
|
2274 // |
|
2275 TBool CESMRMeetingRequestEntry::ContainsRemoteAttachmentsL() |
|
2276 { |
|
2277 FUNC_LOG; |
|
2278 |
|
2279 TBool retValue( EFalse ); |
|
2280 |
|
2281 TInt attachmentCount( iEntry->AttachmentCountL() ); |
|
2282 |
|
2283 for ( TInt i(0); i < attachmentCount && !retValue; ++i ) |
|
2284 { |
|
2285 CCalAttachment* attachment = iEntry->AttachmentL(i); |
|
2286 CCalAttachment::TType type( attachment->Type() ); |
|
2287 |
|
2288 if ( CCalAttachment::EFile != type ) |
|
2289 { |
|
2290 retValue = ETrue; |
|
2291 } |
|
2292 } |
|
2293 |
|
2294 return retValue; |
|
2295 } |
|
2296 |
|
2297 // --------------------------------------------------------------------------- |
|
2298 // CESMRMeetingRequestEntry::SendCanellationAvailable |
|
2299 // --------------------------------------------------------------------------- |
|
2300 // |
|
2301 TBool CESMRMeetingRequestEntry::SendCanellationAvailable () |
|
2302 { |
|
2303 return iSendCanellation; |
|
2304 } |
|
2305 |
|
2306 // --------------------------------------------------------------------------- |
|
2307 // CESMRMeetingRequestEntry::SetSendCanellationAvailable |
|
2308 // --------------------------------------------------------------------------- |
|
2309 // |
|
2310 void CESMRMeetingRequestEntry::SetSendCanellationAvailable ( |
|
2311 TBool aSendCanellation ) |
|
2312 { |
|
2313 iSendCanellation = aSendCanellation; |
|
2314 } |
|
2315 |
|
2316 // --------------------------------------------------------------------------- |
|
2317 // CESMRMeetingRequestEntry::SetTypeChanged |
|
2318 // --------------------------------------------------------------------------- |
|
2319 // |
|
2320 void CESMRMeetingRequestEntry::SetTypeChanged( TBool aTypeChanged ) |
|
2321 { |
|
2322 FUNC_LOG; |
|
2323 |
|
2324 iTypeChanged = aTypeChanged; |
|
2325 } |
|
2326 |
2166 // EOF |
2327 // EOF |
2167 |
|