|
1 /* |
|
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 #ifndef __CREATORCALENDARINTERIM_H__ |
|
23 #define __CREATORCALENDARINTERIM_H__ |
|
24 |
|
25 #include "engine.h" |
|
26 #include "creator_modulebase.h" |
|
27 #include "creator_calendarbase.h" |
|
28 |
|
29 #include <e32base.h> |
|
30 #include <e32std.h> |
|
31 |
|
32 //#include <calenlauncher.h> |
|
33 #include <calentry.h> |
|
34 #include <calentryview.h> |
|
35 #include <caltime.h> |
|
36 #include <calsession.h> |
|
37 #include <calprogresscallback.h> |
|
38 #include <calcategory.h> |
|
39 #include <caluser.h> |
|
40 #include <calrrule.h> |
|
41 |
|
42 |
|
43 class CCreatorEngine; |
|
44 class CCalenderInterimParameters; |
|
45 class CAsyncWaiter; |
|
46 |
|
47 class CCreatorInterimCalendar : public CCreatorCalendarBase, public MCalProgressCallBack |
|
48 { |
|
49 enum TCreatorCalendarStatus{ |
|
50 ECreatorCalendarDelete = 0, |
|
51 ECreatorCalendarStart, |
|
52 ECreatorCalendarGetWeeklyEntries, |
|
53 ECreatorCalendarGetAttendies, |
|
54 ECreatorCalendarGetStartDate, |
|
55 ECreatorCalendarGetEndDate, |
|
56 ECreatorCalendarAddDefaultAlarm |
|
57 }; |
|
58 |
|
59 public: |
|
60 static CCreatorInterimCalendar* NewL(CCreatorEngine* aEngine); |
|
61 static CCreatorInterimCalendar* NewLC(CCreatorEngine* aEngine); |
|
62 ~CCreatorInterimCalendar(); |
|
63 |
|
64 private: |
|
65 CCreatorInterimCalendar(); |
|
66 void ConstructL(CCreatorEngine* aEngine); // from MCreatorModuleBase |
|
67 void AddRepeatingRuleL(const TCalTime& aStartTime, CCalEntry& aCalEntry, CCalenderInterimParameters* parameters=0); |
|
68 void SetRandomAlarmL(CCalEntry& aCalEntry); |
|
69 void SetAlarmL(CCalEntry& aCalEntry, CCalenderInterimParameters* params); |
|
70 void AddAttendeesL(CCalEntry& aCalEntry, CCalenderInterimParameters* parameters=0); |
|
71 void SetPhoneOwnerL(CCalEntry& aCalEntry, const TDesC& aCN, const TDesC& aEmail, const TDesC& aSentBy ); |
|
72 void SetOrganizerL(CCalEntry& aCalEntry, const TDesC& aCN, const TDesC& aEmail, const TDesC& aSentBy); |
|
73 void SetOrganizerL(CCalEntry& aCalEntry, CCalenderInterimParameters* parameters ); |
|
74 |
|
75 public: |
|
76 TBool AskDataFromUserL( TInt aCommand ); // from MCreatorModuleBase |
|
77 void QueryDialogClosedL(TBool aPositiveAction, TInt aUserData); //from MUIObserver |
|
78 |
|
79 TInt CreateAppointmentEntryL(CCreatorModuleBaseParameters *aParameters); |
|
80 TInt CreateEventEntryL(CCreatorModuleBaseParameters *aParameters); |
|
81 TInt CreateAnniversaryEntryL(CCreatorModuleBaseParameters *aParameters); |
|
82 TInt CreateTodoEntryL(CCreatorModuleBaseParameters *aParameters); |
|
83 TInt CreateReminderEntryL(CCreatorModuleBaseParameters *aParameters); |
|
84 |
|
85 void GenerateRandomId(TDes8& aText); |
|
86 void DeleteAllL(); |
|
87 void DeleteAllCreatedByCreatorL(); |
|
88 |
|
89 private: |
|
90 |
|
91 CCalenderInterimParameters* iParameters; |
|
92 TTime iRandomModeStartTime; |
|
93 TTime iRandomModeEndTime; |
|
94 TInt iNumberRepeatingEntries; |
|
95 TInt iNumberOfAttendees; |
|
96 CCalEntryView* iCalEntryView; |
|
97 CCalSession* iCalSession; |
|
98 TBool iSetAlarm; |
|
99 CDesCArrayFlat* iSoundFileArray; |
|
100 CAsyncWaiter* iWaiter; |
|
101 HBufC* iTmpCN; |
|
102 HBufC* iTmpEmail; |
|
103 RArray<TUint32> iEntryIds; // TCalLocalUid ( == TUint32 ) CCalEntry::LocalUidL |
|
104 |
|
105 public: |
|
106 |
|
107 //Observer implementation for MCalProgressCallBack |
|
108 void Progress(TInt aPercentageCompleted); |
|
109 |
|
110 void Completed(TInt aError); |
|
111 |
|
112 TBool NotifyProgress(); |
|
113 |
|
114 }; |
|
115 |
|
116 class CCreatorCalenderAttendee : public CBase |
|
117 { |
|
118 public: |
|
119 virtual ~CCreatorCalenderAttendee(); |
|
120 static CCreatorCalenderAttendee* NewL(); |
|
121 void SetCommonNameL(const TDesC& aName); |
|
122 void SetEmailAddressL(const TDesC& aEmail); |
|
123 void SetRole(CCalAttendee::TCalRole aRole); |
|
124 void SetStatus(CCalAttendee::TCalStatus); |
|
125 |
|
126 const TDesC& CommonName() const; |
|
127 const TDesC& EmailAddress() const; |
|
128 CCalAttendee::TCalRole Role() const; |
|
129 CCalAttendee::TCalStatus Status() const; |
|
130 |
|
131 private: |
|
132 CCreatorCalenderAttendee(); |
|
133 TPtrC iDummy; |
|
134 HBufC* iCommonName; |
|
135 HBufC* iEmailAddress; |
|
136 CCalAttendee::TCalRole iRole; |
|
137 CCalAttendee::TCalStatus iStatus; |
|
138 }; |
|
139 |
|
140 class CCalenderInterimParameters : public CCreatorModuleBaseParameters |
|
141 { |
|
142 public: |
|
143 |
|
144 void ParseL(CCommandParser* parser, TParseParams aCase); |
|
145 TBool IsAllowedEntryStatus(CCalEntry::TType aType, CCalEntry::TStatus aStatus); |
|
146 |
|
147 TCalRRule::TType iRecurrentFrequency; |
|
148 TInt iRecurrentInterval; |
|
149 TTime iRecurrentStartTime; |
|
150 TTime iRecurrentEndTime; |
|
151 TInt iRepeatingCount; // This is used when running a script... |
|
152 TTime iAlarmTime; // NullTTime means no alarm |
|
153 TBool iUseRandomAlarmTime; // ETrue if random alarm should be set. Overwrites the iAlarmTime. |
|
154 |
|
155 RPointerArray<CCreatorCalenderAttendee> iAttendees; |
|
156 RArray<TLinkIdParam> iAttendeeLinkIds; // For attendees. Stores the linked contact ids. |
|
157 HBufC* iOrganizerName; |
|
158 HBufC* iOrganizerEmail; |
|
159 |
|
160 HBufC* iDescription; |
|
161 HBufC* iSummary; |
|
162 HBufC* iLocation; |
|
163 TTime iStartTime; |
|
164 TTime iEndTime; |
|
165 TInt iNumberRepeatingEntries; // This is used when user input is used... |
|
166 TInt iNumberOfAttendees; // Number of randomly generated attendees |
|
167 TInt iNumberOfExistingAttendees; // Number of attendees selected from existing contacts. |
|
168 |
|
169 //An appointment, which has a start time and end time. |
|
170 TTime iAppointmentStartTime; |
|
171 TTime iAppointmentEndTime; |
|
172 HBufC* iAppointmentLocation; |
|
173 HBufC* iAppointmentReason; |
|
174 |
|
175 //An event, which has a start time and end time. |
|
176 |
|
177 TTime iEventStartTime; |
|
178 TTime iEventEndTime; |
|
179 HBufC* iEventReason; |
|
180 |
|
181 //A reminder, which has a start time only. |
|
182 TTime iReminderStartTime; |
|
183 HBufC* iReminderReason; |
|
184 |
|
185 //An anniversary, which has a start time and end time. |
|
186 TTime iAnniversaryStartTime; |
|
187 TTime iAnniversaryEndTime; |
|
188 HBufC* iAnniversaryReason; |
|
189 |
|
190 //A to-do, which can have a start time and end time (the end time is the due date), or can be undated. |
|
191 TTime iTodoStartTime;//optional |
|
192 TTime iTodoDueTime;//also end time (optional) |
|
193 HBufC* iTodoTask; |
|
194 TInt iTodoPriority; |
|
195 |
|
196 TTime iRandomModeStartTime; |
|
197 TTime iRandomModeEndTime; |
|
198 |
|
199 CCalEntry::TStatus iStatus; |
|
200 |
|
201 public: |
|
202 CCalenderInterimParameters(); |
|
203 ~CCalenderInterimParameters(); |
|
204 |
|
205 }; |
|
206 |
|
207 |
|
208 |
|
209 #endif // __CREATORCALENDARINTERIM_H__ |