64
|
1 |
/*
|
|
2 |
* Copyright (c) 2007-2009 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: ESMR service policy checker
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef CESMRRECURRENCEINFOHANDLER_H
|
|
20 |
#define CESMRRECURRENCEINFOHANDLER_H
|
|
21 |
|
|
22 |
#include <e32base.h>
|
|
23 |
//<cmail>
|
|
24 |
#include "esmrdef.h"
|
|
25 |
//</cmail>
|
|
26 |
#include <caltime.h>
|
|
27 |
#include <calcommon.h>
|
|
28 |
|
|
29 |
class CCalEntry;
|
|
30 |
class TCalRRule;
|
|
31 |
class MESMRCalDbMgr;
|
|
32 |
|
|
33 |
/**
|
|
34 |
* CESMRRecurrenceInfoHandler is responsible for handling recurrence related
|
|
35 |
* issues.
|
|
36 |
*
|
|
37 |
* @lib esmrservices.lib
|
|
38 |
*/
|
|
39 |
NONSHARABLE_CLASS(CESMRRecurrenceInfoHandler) :
|
|
40 |
public CBase
|
|
41 |
{
|
|
42 |
public: // Construction and destruction
|
|
43 |
/**
|
|
44 |
* Two-phased constructor. Creates and initializes
|
|
45 |
* CESMRRecurrenceInfoHandler object. Ownership transferred to caller.
|
|
46 |
*
|
|
47 |
* @param aEntry Reference to calendar entry.
|
|
48 |
* @param aCalDb Reference to caldb manager
|
|
49 |
* @return Pointer to esmr recurrence handler object.
|
|
50 |
*/
|
|
51 |
IMPORT_C static CESMRRecurrenceInfoHandler* NewL(
|
|
52 |
CCalEntry& aEntry );
|
|
53 |
|
|
54 |
/**
|
|
55 |
* Two-phased constructor. Creates and initializes
|
|
56 |
* CESMRRecurrenceInfoHandler object. Ownership transferred to caller.
|
|
57 |
* Created object is left to cleanup stack.
|
|
58 |
*
|
|
59 |
* @param aEntry Reference to calendar entry.
|
|
60 |
* @param aCalDb Pointer to caldb manager. Ownership not transferred.
|
|
61 |
* @return Pointer to esmr recurrence handler object.
|
|
62 |
*/
|
|
63 |
IMPORT_C static CESMRRecurrenceInfoHandler* NewL(
|
|
64 |
CCalEntry& aEntry,
|
|
65 |
MESMRCalDbMgr* aCalDb );
|
|
66 |
|
|
67 |
/**
|
|
68 |
* Two-phased constructor. Creates and initializes
|
|
69 |
* CESMRRecurrenceInfoHandler object. Ownership transferred to caller.
|
|
70 |
*
|
|
71 |
* @param aEntry Reference to calendar entry.
|
|
72 |
* @param aCalDb Reference to caldb manager
|
|
73 |
* @return Pointer to esmr recurrence handler object.
|
|
74 |
*/
|
|
75 |
IMPORT_C static CESMRRecurrenceInfoHandler* NewLC(
|
|
76 |
CCalEntry& aEntry );
|
|
77 |
|
|
78 |
/**
|
|
79 |
* Two-phased constructor. Creates and initializes
|
|
80 |
* CESMRRecurrenceInfoHandler object. Ownership transferred to caller.
|
|
81 |
* Created object is left to cleanup stack.
|
|
82 |
*
|
|
83 |
* @param aEntry Reference to calendar entry.
|
|
84 |
* @param aCalDb Reference to caldb manager
|
|
85 |
* @return Pointer to esmr recurrence handler object.
|
|
86 |
*/
|
|
87 |
IMPORT_C static CESMRRecurrenceInfoHandler* NewLC(
|
|
88 |
CCalEntry& aEntry,
|
|
89 |
MESMRCalDbMgr* aCalDb );
|
|
90 |
|
|
91 |
/**
|
|
92 |
* C++ Destructor.
|
|
93 |
*/
|
|
94 |
IMPORT_C ~CESMRRecurrenceInfoHandler();
|
|
95 |
|
|
96 |
public: // Interface
|
|
97 |
|
|
98 |
/**
|
|
99 |
* Sets recurrence to ES MR entry. If until time is not set
|
|
100 |
* (i.e, it is null time), then until time is implementation
|
|
101 |
* dependent.
|
|
102 |
*
|
|
103 |
* When recurrence is set to ERecurrenceNot, then aUntil parameter
|
|
104 |
* is ignored.
|
|
105 |
*
|
|
106 |
* @param aRecurrece Recurrece value.
|
|
107 |
* @param aUntil Recurrence valid until in UTC format.
|
|
108 |
*/
|
|
109 |
IMPORT_C void SetRecurrenceL(
|
|
110 |
TESMRRecurrenceValue aRecurrence,
|
|
111 |
TTime aUntil );
|
|
112 |
|
|
113 |
/**
|
|
114 |
* Fetches entry's recurrence value.
|
|
115 |
*
|
|
116 |
* @param aRecurrence On return contains entry's recurrence information
|
|
117 |
* @param aUntil On return contains time in UTC until recurrence is valid.
|
|
118 |
*/
|
|
119 |
IMPORT_C void GetRecurrenceL(
|
|
120 |
TESMRRecurrenceValue& aRecurrence,
|
|
121 |
TTime& aUntil) const;
|
|
122 |
|
|
123 |
/**
|
|
124 |
* Removes instance from series.
|
|
125 |
* @param aInstanceTime Instance to be removed
|
|
126 |
*/
|
|
127 |
IMPORT_C void RemoveInstanceL(
|
|
128 |
TCalTime aInstanceTime );
|
|
129 |
|
|
130 |
/**
|
|
131 |
* Removes calendar instance from entry.
|
|
132 |
* @param aNewInstanceTime New instance time
|
|
133 |
* @param aOrginalInstanceTime Orginal instance time
|
|
134 |
*/
|
|
135 |
IMPORT_C void AddExceptionL(
|
|
136 |
TCalTime aNewInstanceTime,
|
|
137 |
TCalTime aOrginalInstanceTime );
|
|
138 |
|
|
139 |
/**
|
|
140 |
* Copies recurrence information to entry given as parameter.
|
|
141 |
* @param aDestination Reference to destination calendar entry
|
|
142 |
*/
|
|
143 |
IMPORT_C void CopyRecurrenceInformationToL(
|
|
144 |
CCalEntry& aDestination );
|
|
145 |
|
|
146 |
/**
|
|
147 |
* Copies recurrence information from entry given as parameter.
|
|
148 |
* @param aSource Reference to source calendar entry
|
|
149 |
*/
|
|
150 |
IMPORT_C void CopyRecurrenceInformationFromL(
|
|
151 |
const CCalEntry& aSource );
|
|
152 |
|
|
153 |
/**
|
|
154 |
* Gets first instances start and end time.
|
|
155 |
* @param aStart Reference to start time.
|
|
156 |
* @param aEnd Reference to end time.
|
|
157 |
*/
|
|
158 |
IMPORT_C void GetFirstInstanceTimeL(
|
|
159 |
TCalTime& aStart,
|
|
160 |
TCalTime& aEnd );
|
|
161 |
|
|
162 |
/**
|
|
163 |
* Gets the start and end times of the previous instance.
|
|
164 |
* @param aStart Reference to start time.
|
|
165 |
* @param aEnd Reference to end time.
|
|
166 |
*/
|
|
167 |
IMPORT_C void GetPreviousInstanceTimeL( TCalTime& aPreviousStartTime,
|
|
168 |
TCalTime& aPreviousEndTime,
|
|
169 |
TTime aInstanceDateTime );
|
|
170 |
|
|
171 |
/**
|
|
172 |
* Gets the start and end times of the next instance.
|
|
173 |
* @param aStart Reference to start time.
|
|
174 |
* @param aEnd Reference to end time.
|
|
175 |
*/
|
|
176 |
IMPORT_C void GetNextInstanceTimeL( TCalTime& aNextStartTime,
|
|
177 |
TCalTime& aNextEndTime,
|
|
178 |
TTime aInstanceDateTime );
|
|
179 |
|
|
180 |
private: // Implementation
|
|
181 |
CESMRRecurrenceInfoHandler(
|
|
182 |
CCalEntry& aEntry,
|
|
183 |
MESMRCalDbMgr* aCalDb );
|
|
184 |
void ConstructL();
|
|
185 |
|
|
186 |
void CalculateRecurrenceUntilDateL(
|
|
187 |
TESMRRecurrenceValue aRecurrenceType,
|
|
188 |
TTime& aUntil,
|
|
189 |
TCalRRule& aRule,
|
|
190 |
const CCalEntry& aEntry ) const;
|
|
191 |
|
|
192 |
void HandleDailyRecurrenceL(
|
|
193 |
TESMRRecurrenceValue& aRecurrenceValue,
|
|
194 |
TCalRRule& aRule ) const;
|
|
195 |
|
|
196 |
void HandleWeeklyRecurrenceL(
|
|
197 |
TESMRRecurrenceValue& aRecurrenceValue,
|
|
198 |
TCalRRule& aRule ) const;
|
|
199 |
|
|
200 |
void HandleMonthlyRecurrenceL(
|
|
201 |
TESMRRecurrenceValue& aRecurrenceValue,
|
|
202 |
TCalRRule& aRule ) const;
|
|
203 |
|
|
204 |
void HandleYearlyRecurrenceL(
|
|
205 |
TESMRRecurrenceValue& aRecurrenceValue,
|
|
206 |
TCalRRule& aRule ) const;
|
|
207 |
|
|
208 |
TBool NeedToSetRecurrenceL(
|
|
209 |
TESMRRecurrenceValue aRecurrence,
|
|
210 |
TTime aUntil ) const;
|
|
211 |
|
|
212 |
TTime GetPreviousInstanceForRepeatOtherL(
|
|
213 |
CCalEntry& aEntry,
|
|
214 |
const CalCommon::TCalTimeRange& timeRange );
|
|
215 |
|
|
216 |
TTime GetNextInstanceForRepeatOtherL(
|
|
217 |
CCalEntry& aEntry,
|
|
218 |
const CalCommon::TCalTimeRange& timeRange );
|
|
219 |
|
|
220 |
TESMRRecurrenceValue RepeatIndexL( const CCalEntry& aEntry );
|
|
221 |
|
|
222 |
|
|
223 |
|
|
224 |
private:
|
|
225 |
/// Ref: Reference to meeting request entry
|
|
226 |
CCalEntry& iEntry;
|
|
227 |
/// Ref: Reference to caldb manager
|
|
228 |
MESMRCalDbMgr* iCalDb;
|
|
229 |
};
|
|
230 |
|
|
231 |
#endif // CESMRRECURRENCEINFOHANDLER_H
|
|
232 |
|
|
233 |
// EOF
|