9 * Initial Contributors: |
9 * Initial Contributors: |
10 * Nokia Corporation - initial contribution. |
10 * Nokia Corporation - initial contribution. |
11 * |
11 * |
12 * Contributors: |
12 * Contributors: |
13 * |
13 * |
14 * Description: Calendar context, info on what's currently focused |
14 * Description: Calendar context, info on what's currently focused |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 |
18 |
|
19 |
19 //debug |
20 //debug |
20 #include "calendarui_debug.h" |
21 #include "calendarui_debug.h" |
|
22 |
21 #include "calencontextimpl.h" |
23 #include "calencontextimpl.h" |
|
24 |
22 #include "calencontextchangeobserver.h" |
25 #include "calencontextchangeobserver.h" |
23 #include "calendateutils.h" |
26 #include <calendateutils.h> |
24 //#include <lbsposition.h> |
27 #include <lbsposition.h> |
25 |
28 |
26 const int KCalenDefaultTimeForViews = 480; // 480 minutes == 8 hours == 8 am. |
29 const TInt KCalenDefaultTimeForViews = 480; // 480 minutes == 8 hours == 8 am. |
27 |
30 |
28 // ---------------------------------------------------------------------------- |
31 // ---------------------------------------------------------------------------- |
29 // CalenContextImpl::CalenContextImpl |
32 // CCalenContextImpl::CCalenContextImpl |
30 // Constructor. |
33 // Constructor. |
31 // (other items were commented in a header). |
34 // (other items were commented in a header). |
32 // ---------------------------------------------------------------------------- |
35 // ---------------------------------------------------------------------------- |
33 // |
36 // |
34 EXPORT_C CalenContextImpl::CalenContextImpl( MCalenContextChangeObserver* observer ) |
37 CCalenContextImpl::CCalenContextImpl( MCalenContextChangeObserver* aObserver ) |
35 : mObserver( observer ), |
38 : iObserver( aObserver ), |
36 mFocusTime( -1 ), |
39 iFocusTime( -1 ), |
37 mInstanceId( TCalenInstanceId::nullInstanceId() ) |
40 iInstanceId( TCalenInstanceId::NullInstanceId() ) |
38 { |
41 { |
39 } |
42 TRACE_ENTRY_POINT; |
40 |
43 TRACE_EXIT_POINT; |
41 // ---------------------------------------------------------------------------- |
44 } |
42 // CalenContextImpl::CalenContextImpl |
45 |
|
46 // ---------------------------------------------------------------------------- |
|
47 // CCalenContextImpl::CCalenContextImpl |
43 // Default Constructor. |
48 // Default Constructor. |
44 // (other items were commented in a header). |
49 // (other items were commented in a header). |
45 // ---------------------------------------------------------------------------- |
50 // ---------------------------------------------------------------------------- |
46 // |
51 // |
47 EXPORT_C CalenContextImpl::CalenContextImpl() |
52 CCalenContextImpl::CCalenContextImpl() |
48 : mInstanceId( TCalenInstanceId::nullInstanceId() ) |
53 : iInstanceId( TCalenInstanceId::NullInstanceId() ) |
49 { |
54 { |
50 } |
55 TRACE_ENTRY_POINT; |
51 |
56 TRACE_EXIT_POINT; |
52 // ---------------------------------------------------------------------------- |
57 } |
53 // CalenContextImpl::CalenContextImpl |
58 |
|
59 // ---------------------------------------------------------------------------- |
|
60 // CCalenContextImpl::CCalenContextImpl |
54 // Copy Constructor. |
61 // Copy Constructor. |
55 // (other items were commented in a header). |
62 // (other items were commented in a header). |
56 // ---------------------------------------------------------------------------- |
63 // ---------------------------------------------------------------------------- |
57 // |
64 // |
58 EXPORT_C CalenContextImpl::CalenContextImpl( const CalenContextImpl& aContext ) |
65 CCalenContextImpl::CCalenContextImpl( const CCalenContextImpl& aContext ) |
59 { |
66 { |
|
67 TRACE_ENTRY_POINT; |
|
68 |
60 // When copying, set the observer to NULL because the only context that |
69 // When copying, set the observer to NULL because the only context that |
61 // should be set is accessed from the global data. |
70 // should be set is accessed from the global data. |
62 mObserver = NULL; |
71 iObserver = NULL; |
63 mFocusTime = aContext.mFocusTime; |
72 iFocusTime = aContext.iFocusTime; |
64 mInstanceId = aContext.mInstanceId; |
73 iInstanceId = aContext.iInstanceId; |
65 mViewId = aContext.mViewId; |
74 iViewId = aContext.iViewId; |
66 } |
75 |
67 |
76 TRACE_EXIT_POINT; |
68 // ---------------------------------------------------------------------------- |
77 } |
69 // CalenContextImpl::~CalenContextImpl |
78 |
|
79 // ---------------------------------------------------------------------------- |
|
80 // CCalenContextImpl::~CCalenContextImpl |
70 // Destructor. |
81 // Destructor. |
71 // (other items were commented in a header). |
82 // (other items were commented in a header). |
72 // ---------------------------------------------------------------------------- |
83 // ---------------------------------------------------------------------------- |
73 // |
84 // |
74 EXPORT_C CalenContextImpl::~CalenContextImpl() |
85 CCalenContextImpl::~CCalenContextImpl() |
75 { |
86 { |
76 if(mMutlipleContextIds.count()) |
87 TRACE_ENTRY_POINT; |
77 { |
88 if(iCalAlarmEntryFileName) |
78 mMutlipleContextIds.clear(); |
89 { |
79 } |
90 delete iCalAlarmEntryFileName; |
80 } |
91 iCalAlarmEntryFileName = NULL; |
81 |
92 } |
82 // ---------------------------------------------------------------------------- |
93 TRACE_EXIT_POINT; |
83 // CalenContextImpl::DefaultTimeForViews |
94 } |
|
95 |
|
96 // ---------------------------------------------------------------------------- |
|
97 // CCalenContextImpl::DefaultTimeForViews |
84 // If a view knows what day they should be looking at, but doesn't know what |
98 // If a view knows what day they should be looking at, but doesn't know what |
85 // time (for example the month view only deals in days), they should set the |
99 // time (for example the month view only deals in days), they should set the |
86 // time to this value. |
100 // time to this value. |
87 // (other items were commented in a header). |
101 // (other items were commented in a header). |
88 // ---------------------------------------------------------------------------- |
102 // ---------------------------------------------------------------------------- |
89 // |
103 // |
90 int CalenContextImpl::defaultTimeForViewsInMinnutes() const |
104 TTimeIntervalMinutes CCalenContextImpl::DefaultTimeForViews() const |
91 { |
105 { |
92 return KCalenDefaultTimeForViews; |
106 TRACE_ENTRY_POINT; |
93 } |
107 TRACE_EXIT_POINT; |
94 |
108 return TTimeIntervalMinutes( KCalenDefaultTimeForViews ); |
95 // ---------------------------------------------------------------------------- |
109 } |
96 // CalenContextImpl::DefaultCalTimeForViewsL |
110 |
|
111 // ---------------------------------------------------------------------------- |
|
112 // CCalenContextImpl::DefaultCalTimeForViewsL |
97 // If a view has no preference as to what time/day to be focused on (e.g. when |
113 // If a view has no preference as to what time/day to be focused on (e.g. when |
98 // a view is the first view loaded), they should set focus to this TCalTime. |
114 // a view is the first view loaded), they should set focus to this TCalTime. |
99 // (other items were commented in a header). |
115 // (other items were commented in a header). |
100 // ---------------------------------------------------------------------------- |
116 // ---------------------------------------------------------------------------- |
101 // |
117 // |
102 QDateTime CalenContextImpl::defaultCalTimeForViewsL() const |
118 TCalTime CCalenContextImpl::DefaultCalTimeForViewsL() const |
103 { |
119 { |
104 QDateTime ret = CalenDateUtils::today(); |
120 TRACE_ENTRY_POINT; |
105 QTime currentTime = ret.time(); |
121 |
106 currentTime.setHMS(7, 0, 0, 0); |
122 TTime today; |
107 ret.setTime(currentTime); |
123 today.HomeTime(); |
108 |
124 today = CalenDateUtils::BeginningOfDay( today ); |
|
125 TCalTime ret; |
|
126 ret.SetTimeLocalL( today + CCalenContextImpl::DefaultTimeForViews() ); |
|
127 |
|
128 TRACE_EXIT_POINT; |
109 return ret; |
129 return ret; |
110 } |
130 } |
111 |
131 |
112 // ---------------------------------------------------------------------------- |
132 // ---------------------------------------------------------------------------- |
113 // CalenContextImpl::SetFocusDateAndTimeL |
133 // CCalenContextImpl::SetFocusDateAndTimeL |
114 // Sets the focus time |
134 // Sets the focus time |
115 // (other items were commented in a header). |
135 // (other items were commented in a header). |
116 // ---------------------------------------------------------------------------- |
136 // ---------------------------------------------------------------------------- |
117 // |
137 // |
118 void CalenContextImpl::setFocusDateAndTime( const QDateTime& focusDateTime) |
138 void CCalenContextImpl::SetFocusDateAndTimeL( const TCalTime& aFocusDateTime, |
119 { |
139 const TVwsViewId& aViewId ) |
120 |
140 { |
121 mFocusDate = focusDateTime; |
141 TRACE_ENTRY_POINT; |
122 mFocusTime = focusDateTime.time().minute() + 1; |
|
123 |
|
124 if( mFocusTime < 0 ) |
|
125 mFocusTime = 0; |
|
126 mInstanceId = TCalenInstanceId::nullInstanceId(); |
|
127 |
142 |
128 // If this fails you're using a context that was constructed yourself. |
143 // If this fails you're using a context that was constructed yourself. |
129 // Use the accessor from the global data instead, or don't try to set |
144 // Use the accessor from the global data instead, or don't try to set |
130 // anything on this context. |
145 // anything on this context. |
131 if(mObserver) |
146 ASSERT( iObserver ); |
132 mObserver->ContextChanged(); |
147 |
133 } |
148 #ifdef _DEBUG |
134 |
149 TDateTime dt = aFocusDateTime.TimeLocalL().DateTime(); |
135 // ---------------------------------------------------------------------------- |
150 #endif |
136 // CalenContextImpl::SetFocusDateL |
151 |
|
152 iFocusDate.SetTimeLocalL( CalenDateUtils::BeginningOfDay( aFocusDateTime.TimeLocalL() ) ); |
|
153 User::LeaveIfError( aFocusDateTime.TimeLocalL().MinutesFrom( iFocusDate.TimeLocalL(), |
|
154 iFocusTime ) ); |
|
155 ASSERT( iFocusTime.Int() >= 0 ); |
|
156 iInstanceId = TCalenInstanceId::NullInstanceId(); |
|
157 iViewId = aViewId; |
|
158 |
|
159 iObserver->ContextChanged(); |
|
160 |
|
161 TRACE_EXIT_POINT; |
|
162 } |
|
163 |
|
164 // ---------------------------------------------------------------------------- |
|
165 // CCalenContextImpl::SetFocusDateL |
137 // Sets the focus date |
166 // Sets the focus date |
138 // (other items were commented in a header). |
167 // (other items were commented in a header). |
139 // ---------------------------------------------------------------------------- |
168 // ---------------------------------------------------------------------------- |
140 // |
169 // |
141 void CalenContextImpl::setFocusDate( const QDateTime& focusDateTime) |
170 void CCalenContextImpl::SetFocusDateL( const TCalTime& aFocusDate, |
142 { |
171 const TVwsViewId& aViewId ) |
143 mFocusDate = focusDateTime; |
172 { |
144 mFocusTime = -1; |
173 TRACE_ENTRY_POINT; |
145 mInstanceId = TCalenInstanceId::nullInstanceId(); |
|
146 |
174 |
147 // If this fails you're using a context that was constructed yourself. |
175 // If this fails you're using a context that was constructed yourself. |
148 // Use the accessor from the global data instead, or don't try to set |
176 // Use the accessor from the global data instead, or don't try to set |
149 // anything on this context. |
177 // anything on this context. |
150 if(mObserver) |
178 ASSERT( iObserver ); |
151 mObserver->ContextChanged(); |
179 |
152 } |
180 #ifdef _DEBUG |
153 |
181 TDateTime dt = aFocusDate.TimeLocalL().DateTime(); |
154 // ---------------------------------------------------------------------------- |
182 #endif |
155 // CalenContextImpl::SetInstanceIdL |
183 |
|
184 iFocusDate.SetTimeLocalL( CalenDateUtils::BeginningOfDay( aFocusDate.TimeLocalL() ) ); |
|
185 iFocusTime = TTimeIntervalMinutes( -1 ); |
|
186 iInstanceId = TCalenInstanceId::NullInstanceId(); |
|
187 iViewId = aViewId; |
|
188 |
|
189 iObserver->ContextChanged(); |
|
190 |
|
191 TRACE_EXIT_POINT; |
|
192 } |
|
193 |
|
194 // ---------------------------------------------------------------------------- |
|
195 // CCalenContextImpl::SetInstanceIdL |
156 // Sets the instance id |
196 // Sets the instance id |
157 // (other items were commented in a header). |
197 // (other items were commented in a header). |
158 // ---------------------------------------------------------------------------- |
198 // ---------------------------------------------------------------------------- |
159 // |
199 // |
160 void CalenContextImpl::setInstanceId( const TCalenInstanceId& aInstanceId ) |
200 void CCalenContextImpl::SetInstanceIdL( const TCalenInstanceId& aInstanceId, |
161 { |
201 const TVwsViewId& aViewId ) |
162 |
202 { |
163 // Set the null date and time |
203 TRACE_ENTRY_POINT; |
164 mFocusDate = QDateTime(); |
|
165 mFocusTime = -1; |
|
166 mInstanceId = aInstanceId; |
|
167 |
204 |
168 // If this fails you're using a context that was constructed yourself. |
205 // If this fails you're using a context that was constructed yourself. |
169 // Use the accessor from the global data instead, or don't try to set |
206 // Use the accessor from the global data instead, or don't try to set |
170 // anything on this context. |
207 // anything on this context. |
171 if(mObserver) |
208 ASSERT( iObserver ); |
172 mObserver->ContextChanged(); |
209 |
173 } |
210 iFocusDate.SetTimeUtcL( Time::NullTTime() ); |
174 |
211 iFocusTime = TTimeIntervalMinutes( -1 ); |
175 // ----------------------------------------------------------------------------- |
212 iInstanceId = aInstanceId; |
176 // CalenContextImpl::SetFocusDateAndTimeAndInstanceL |
213 iViewId = aViewId; |
|
214 |
|
215 iObserver->ContextChanged(); |
|
216 |
|
217 TRACE_EXIT_POINT; |
|
218 } |
|
219 |
|
220 // ----------------------------------------------------------------------------- |
|
221 // CCalenContextImpl::SetFocusDateAndTimeAndInstanceL |
177 // Sets the currently focused time and instance |
222 // Sets the currently focused time and instance |
178 // (other items were commented in a header). |
223 // (other items were commented in a header). |
179 // ----------------------------------------------------------------------------- |
224 // ----------------------------------------------------------------------------- |
180 // |
225 // |
181 void CalenContextImpl::setFocusDateAndTimeAndInstance( const QDateTime& focusDateTime, |
226 void CCalenContextImpl::SetFocusDateAndTimeAndInstanceL( const TCalTime& aFocusDateTime, |
182 const TCalenInstanceId& instanceId ) |
227 const TCalenInstanceId& aInstanceId, |
183 { |
228 const TVwsViewId& aViewId ) |
184 mFocusDate = focusDateTime; |
229 { |
185 mFocusTime = focusDateTime.time().minute() + 1; |
230 TRACE_ENTRY_POINT; |
186 if( mFocusTime < 0 ) |
|
187 mFocusTime = 0; |
|
188 mInstanceId = instanceId; |
|
189 |
231 |
190 // If this fails you're using a context that was constructed yourself. |
232 // If this fails you're using a context that was constructed yourself. |
191 // Use the accessor from the global data instead, or don't try to set |
233 // Use the accessor from the global data instead, or don't try to set |
192 // anything on this context. |
234 // anything on this context. |
193 if(mObserver) |
235 ASSERT( iObserver ); |
194 mObserver->ContextChanged(); |
236 |
195 } |
237 #ifdef _DEBUG |
196 |
238 TDateTime dt = aFocusDateTime.TimeLocalL().DateTime(); |
197 // ----------------------------------------------------------------------------- |
239 #endif |
198 // CalenContextImpl::setStartDateAndTimeForNewInstance |
240 |
199 // Sets start date and time that should be used for creating new instance. |
241 iFocusDate.SetTimeLocalL( CalenDateUtils::BeginningOfDay( aFocusDateTime.TimeLocalL() ) ); |
200 // (other items were commented in a header). |
242 User::LeaveIfError( aFocusDateTime.TimeLocalL().MinutesFrom( iFocusDate.TimeLocalL(), |
201 // ----------------------------------------------------------------------------- |
243 iFocusTime ) ); |
202 // |
244 ASSERT( iFocusTime.Int() >= 0 ); |
203 void CalenContextImpl::setStartDateAndTimeForNewInstance( |
245 iInstanceId = aInstanceId; |
204 const QDateTime &startDateTime) |
246 iViewId = aViewId; |
205 { |
247 |
206 mDateTimeForNewInstance = startDateTime; |
248 iObserver->ContextChanged(); |
207 } |
249 |
208 |
250 TRACE_EXIT_POINT; |
209 // ----------------------------------------------------------------------------- |
251 } |
210 // CalenContextImpl::FocusDateAndTimeL |
252 |
|
253 // ----------------------------------------------------------------------------- |
|
254 // CCalenContextImpl::FocusDateAndTimeL |
211 // Returns the focus time |
255 // Returns the focus time |
212 // (other items were commented in a header). |
256 // (other items were commented in a header). |
213 // ----------------------------------------------------------------------------- |
257 // ----------------------------------------------------------------------------- |
214 // |
258 // |
215 QDateTime CalenContextImpl::focusDateAndTime() const |
259 TCalTime CCalenContextImpl::FocusDateAndTimeL() const |
216 { |
260 { |
217 QDateTime ret; |
261 TRACE_ENTRY_POINT; |
218 |
262 |
219 if( mFocusDate.isValid() ) |
263 TCalTime ret; |
220 { |
264 |
221 ret = mFocusDate; |
265 if( iFocusDate.TimeUtcL() != Time::NullTTime() ) |
|
266 { |
|
267 if ( iFocusTime.Int() >= 0 ) |
|
268 { |
|
269 ret.SetTimeLocalL( iFocusDate.TimeLocalL() + iFocusTime ); |
|
270 } |
|
271 else |
|
272 { |
|
273 ret.SetTimeLocalL( iFocusDate.TimeLocalL() + DefaultTimeForViews() ); |
|
274 } |
222 } |
275 } |
223 else |
276 else |
224 { |
277 { |
225 ret = mInstanceId.mInstanceTime; |
278 ret.SetTimeLocalL( iInstanceId.iInstanceTime ); |
226 } |
279 } |
227 |
280 |
|
281 TRACE_EXIT_POINT; |
228 return ret; |
282 return ret; |
229 } |
283 } |
230 |
284 |
231 // ----------------------------------------------------------------------------- |
285 // ----------------------------------------------------------------------------- |
232 // CalenContextImpl::FocusTime |
286 // CCalenContextImpl::FocusTime |
233 // Returns the focus time |
287 // Returns the focus time |
234 // (other items were commented in a header). |
288 // (other items were commented in a header). |
235 // ----------------------------------------------------------------------------- |
289 // ----------------------------------------------------------------------------- |
236 // |
290 // |
237 int CalenContextImpl::focusTime() const |
291 TTimeIntervalMinutes CCalenContextImpl::FocusTime() const |
238 { |
292 { |
239 TRACE_ENTRY_POINT; |
293 TRACE_ENTRY_POINT; |
240 TRACE_EXIT_POINT; |
294 TRACE_EXIT_POINT; |
241 return mFocusTime; |
295 return iFocusTime; |
242 } |
296 } |
243 |
297 |
244 // ----------------------------------------------------------------------------- |
298 // ----------------------------------------------------------------------------- |
245 // CalenContextImpl::InstanceId |
299 // CCalenContextImpl::InstanceId |
246 // Returns the instance id |
300 // Returns the instance id |
247 // (other items were commented in a header). |
301 // (other items were commented in a header). |
248 // ----------------------------------------------------------------------------- |
302 // ----------------------------------------------------------------------------- |
249 // |
303 // |
250 TCalenInstanceId CalenContextImpl::instanceId() const |
304 TCalenInstanceId CCalenContextImpl::InstanceId() const |
251 { |
305 { |
252 TRACE_ENTRY_POINT; |
306 TRACE_ENTRY_POINT; |
253 TRACE_EXIT_POINT; |
307 TRACE_EXIT_POINT; |
254 return mInstanceId; |
308 return iInstanceId; |
255 } |
309 } |
256 |
310 |
257 // ----------------------------------------------------------------------------- |
311 // ----------------------------------------------------------------------------- |
258 // CalenContextImpl::startDateAndTimeForNewInstance |
312 // CCalenContextImpl::SetStartAndEndTimeForNewInstance |
259 // Returns start date and time that should be used for creating new instance. |
313 // Sets the start and end time of the instance that has to be created. |
260 // (other items were commented in a header). |
314 // (other items were commented in a header). |
261 // ----------------------------------------------------------------------------- |
315 // ----------------------------------------------------------------------------- |
262 // |
316 // |
263 QDateTime CalenContextImpl::startDateAndTimeForNewInstance() const |
317 void CCalenContextImpl::SetStartAndEndTimeForNewInstance( const TTime& aStartTime, |
264 { |
318 const TTime& aEndTime ) |
265 return mDateTimeForNewInstance; |
319 { |
266 } |
320 TRACE_ENTRY_POINT; |
267 |
321 iNewInstStartTime = aStartTime; |
268 // ----------------------------------------------------------------------------- |
322 iNewInstEndTime = aEndTime; |
269 // CalenContextImpl::SetMutlipleContextIds |
323 TRACE_EXIT_POINT; |
|
324 } |
|
325 |
|
326 // ----------------------------------------------------------------------------- |
|
327 // CCalenContextImpl::GetStartAndEndTimeForNewInstance |
|
328 // Gets the start and end time of the instance that has to be created. |
|
329 // (other items were commented in a header). |
|
330 // ----------------------------------------------------------------------------- |
|
331 // |
|
332 void CCalenContextImpl::GetStartAndEndTimeForNewInstance( TTime& aStartTime, |
|
333 TTime& aEndTime ) |
|
334 { |
|
335 TRACE_ENTRY_POINT; |
|
336 aStartTime = iNewInstStartTime; |
|
337 aEndTime = iNewInstEndTime; |
|
338 TRACE_EXIT_POINT; |
|
339 } |
|
340 |
|
341 // ----------------------------------------------------------------------------- |
|
342 // CCalenContextImpl::ViewId |
|
343 // Returns the view id |
|
344 // (other items were commented in a header). |
|
345 // ----------------------------------------------------------------------------- |
|
346 // |
|
347 TVwsViewId CCalenContextImpl::ViewId() const |
|
348 { |
|
349 TRACE_ENTRY_POINT; |
|
350 TRACE_EXIT_POINT; |
|
351 return iViewId; |
|
352 } |
|
353 |
|
354 // ----------------------------------------------------------------------------- |
|
355 // CCalenContextImpl::SetMutlipleContextIds |
270 // Set multiple context ids |
356 // Set multiple context ids |
271 // (other items were commented in a header). |
357 // (other items were commented in a header). |
272 // ----------------------------------------------------------------------------- |
358 // ----------------------------------------------------------------------------- |
273 // |
359 // |
274 void CalenContextImpl::setMutlipleContextIds( |
360 void CCalenContextImpl::SetMutlipleContextIds( |
275 QList<TCalenInstanceId>& mutlipleContextIds) |
361 RArray<TCalenInstanceId>& aMutlipleContextIds) |
276 { |
362 { |
|
363 TRACE_ENTRY_POINT; |
277 |
364 |
278 mMutlipleContextIds.clear(); |
365 iMutlipleContextIds.Reset(); |
279 mMutlipleContextIds = mutlipleContextIds; |
366 iMutlipleContextIds = aMutlipleContextIds; |
280 |
367 |
281 } |
368 TRACE_EXIT_POINT; |
282 |
369 } |
283 // ----------------------------------------------------------------------------- |
370 |
284 // CalenContextImpl::RemoveMultipleContextId |
371 // ----------------------------------------------------------------------------- |
|
372 // CCalenContextImpl::RemoveMultipleContextId |
285 // Remove multiple context id |
373 // Remove multiple context id |
286 // (other items were commented in a header). |
374 // (other items were commented in a header). |
287 // ----------------------------------------------------------------------------- |
375 // ----------------------------------------------------------------------------- |
288 // |
376 // |
289 void CalenContextImpl::removeMultipleContextId(TCalenInstanceId instanceId) |
377 void CCalenContextImpl::RemoveMultipleContextId(TCalenInstanceId aInstanceId) |
290 { |
378 { |
291 |
379 TRACE_ENTRY_POINT; |
292 for(int index = 0;index < mMutlipleContextIds.count();index++) |
380 |
|
381 for(TInt index = 0;index < iMutlipleContextIds.Count();index++) |
293 { |
382 { |
294 if(instanceId == mMutlipleContextIds[index]) |
383 if(aInstanceId == iMutlipleContextIds[index]) |
295 { |
384 { |
296 mMutlipleContextIds.removeAt(index); |
385 iMutlipleContextIds.Remove(index); |
297 } |
386 } |
298 } |
387 } |
299 |
388 |
300 } |
389 TRACE_EXIT_POINT; |
|
390 } |
301 |
391 |
302 // ----------------------------------------------------------------------------- |
392 // ----------------------------------------------------------------------------- |
303 // CalenContextImpl::ResetMultipleContextIds |
393 // CCalenContextImpl::ResetMultipleContextIds |
304 // Resets all the multiple context ids |
394 // Resets all the multiple context ids |
305 // (other items were commented in a header). |
395 // (other items were commented in a header). |
306 // ----------------------------------------------------------------------------- |
396 // ----------------------------------------------------------------------------- |
307 // |
397 // |
308 void CalenContextImpl::resetMultipleContextIds(TInt /*aDbId*/) |
398 void CCalenContextImpl::ResetMultipleContextIds(TInt /*aDbId*/) |
309 { |
399 { |
310 |
400 TRACE_ENTRY_POINT; |
311 if(mMutlipleContextIds.count()) |
401 |
|
402 //if(iMutlipleContextIds.Count()) |
312 { |
403 { |
313 mMutlipleContextIds.clear(); |
404 iMutlipleContextIds.Reset(); |
|
405 iMutlipleContextIds.Close(); |
314 } |
406 } |
315 |
407 |
316 } |
408 TRACE_EXIT_POINT; |
|
409 } |
317 |
410 |
318 // ----------------------------------------------------------------------------- |
411 // ----------------------------------------------------------------------------- |
319 // CalenContextImpl::GetMutlipleContextIds |
412 // CCalenContextImpl::GetMutlipleContextIds |
320 // Getter for multiple context ids |
413 // Getter for multiple context ids |
321 // (other items were commented in a header). |
414 // (other items were commented in a header). |
322 // ----------------------------------------------------------------------------- |
415 // ----------------------------------------------------------------------------- |
323 // |
416 // |
324 QList<TCalenInstanceId>& CalenContextImpl::getMutlipleContextIds(TInt /*aDbId*/) |
417 RArray<TCalenInstanceId>& CCalenContextImpl::GetMutlipleContextIds(TInt /*aDbId*/) |
325 { |
418 { |
326 return mMutlipleContextIds; |
419 TRACE_ENTRY_POINT; |
|
420 TRACE_EXIT_POINT; |
|
421 |
|
422 return iMutlipleContextIds; |
327 } |
423 } |
328 |
424 |
329 // ----------------------------------------------------------------------------- |
425 // ----------------------------------------------------------------------------- |
330 // CalenContextImpl::MutlipleContextIdsCount |
426 // CCalenContextImpl::MutlipleContextIdsCount |
331 // Returns mutliple context's count |
427 // Returns mutliple context's count |
332 // (other items were commented in a header). |
428 // (other items were commented in a header). |
333 // ----------------------------------------------------------------------------- |
429 // ----------------------------------------------------------------------------- |
334 // |
430 // |
335 int CalenContextImpl::mutlipleContextIdsCount() |
431 TInt CCalenContextImpl::MutlipleContextIdsCount() |
336 { |
432 { |
337 return mMutlipleContextIds.count(); |
433 TRACE_ENTRY_POINT; |
338 } |
434 TRACE_EXIT_POINT; |
|
435 |
|
436 return iMutlipleContextIds.Count(); |
|
437 } |
|
438 |
|
439 // ----------------------------------------------------------------------------- |
|
440 // CCalenContextImpl::SetLandMark |
|
441 // Sets the user selected landmark |
|
442 // (other items were commented in a header). |
|
443 // ----------------------------------------------------------------------------- |
|
444 // |
|
445 void CCalenContextImpl::SetLandMark(CPosLandmark* aLandMark) |
|
446 { |
|
447 TRACE_ENTRY_POINT; |
|
448 if(iLandMark) |
|
449 { |
|
450 delete iLandMark; |
|
451 } |
|
452 iLandMark = aLandMark; |
|
453 TRACE_EXIT_POINT; |
|
454 } |
|
455 |
|
456 // ----------------------------------------------------------------------------- |
|
457 // CCalenContextImpl::GetLandMark |
|
458 // Returns the user selected landmark |
|
459 // (other items were commented in a header). |
|
460 // ----------------------------------------------------------------------------- |
|
461 // |
|
462 CPosLandmark* CCalenContextImpl::GetLandMark() |
|
463 { |
|
464 TRACE_ENTRY_POINT; |
|
465 TRACE_EXIT_POINT; |
|
466 |
|
467 return(iLandMark); |
|
468 } |
|
469 |
|
470 // ----------------------------------------------------------------------------- |
|
471 // CCalenContextImpl::ResetLandMark |
|
472 // Resets the landmark |
|
473 // (other items were commented in a header). |
|
474 // ----------------------------------------------------------------------------- |
|
475 // |
|
476 void CCalenContextImpl::ResetLandMark() |
|
477 { |
|
478 TRACE_ENTRY_POINT; |
|
479 if(iLandMark) |
|
480 { |
|
481 delete iLandMark; |
|
482 iLandMark = NULL; |
|
483 } |
|
484 TRACE_EXIT_POINT; |
|
485 } |
|
486 |
|
487 // ---------------------------------------------------------------------------- |
|
488 // CCalenContextImpl::CalenCommandHandlerExtensionL |
|
489 // Dummy implementation. |
|
490 // (other items were commented in a header). |
|
491 // ---------------------------------------------------------------------------- |
|
492 // |
|
493 TAny* CCalenContextImpl::CalenContextExtensionL( TUid /*aExtensionUid*/ ) |
|
494 { |
|
495 TRACE_ENTRY_POINT; |
|
496 TRACE_EXIT_POINT; |
|
497 return NULL; |
|
498 } |
|
499 |
|
500 // ----------------------------------------------------------------------------- |
|
501 // CCalenContextImpl::GetCalendarFileNameL |
|
502 // Get calendar file name |
|
503 // ----------------------------------------------------------------------------- |
|
504 TDesC& CCalenContextImpl::GetCalendarFileNameL() const |
|
505 { |
|
506 TRACE_ENTRY_POINT |
|
507 TRACE_EXIT_POINT |
|
508 if(iCalenFileName) |
|
509 { |
|
510 return *iCalenFileName; |
|
511 } |
|
512 else |
|
513 { |
|
514 return const_cast<TDesC&> (KNullDesC()); |
|
515 } |
|
516 } |
|
517 |
|
518 // ----------------------------------------------------------------------------- |
|
519 // CCalenContextImpl::SetCalendarFileNameL |
|
520 // Set calendar file name to context |
|
521 // ----------------------------------------------------------------------------- |
|
522 void CCalenContextImpl::SetCalendarFileNameL(const TDesC& aCalFileName) |
|
523 { |
|
524 TRACE_ENTRY_POINT |
|
525 |
|
526 if(iCalenFileName) |
|
527 { |
|
528 delete iCalenFileName; |
|
529 iCalenFileName = NULL; |
|
530 } |
|
531 iCalenFileName = aCalFileName.AllocL(); |
|
532 TRACE_EXIT_POINT |
|
533 } |
|
534 |
|
535 // ----------------------------------------------------------------------------- |
|
536 // CCalenContextImpl::ResetCalendarFileName |
|
537 // Resets calendar file name in context |
|
538 // ----------------------------------------------------------------------------- |
|
539 void CCalenContextImpl::ResetCalendarFileName() |
|
540 { |
|
541 TRACE_ENTRY_POINT; |
|
542 if(iCalenFileName) |
|
543 { |
|
544 delete iCalenFileName; |
|
545 iCalenFileName = NULL; |
|
546 } |
|
547 |
|
548 TRACE_EXIT_POINT; |
|
549 } |
|
550 |
|
551 // ----------------------------------------------------------------------------- |
|
552 // CCalenContextImpl::SetCalAlarmEntryFileNameL |
|
553 // Set calendar file name of Alarm entry |
|
554 // ----------------------------------------------------------------------------- |
|
555 void CCalenContextImpl::SetCalAlarmEntryFileNameL(const TDesC& aName) |
|
556 { |
|
557 TRACE_ENTRY_POINT |
|
558 if (iCalAlarmEntryFileName) |
|
559 { |
|
560 delete iCalAlarmEntryFileName; |
|
561 iCalAlarmEntryFileName = NULL; |
|
562 } |
|
563 iCalAlarmEntryFileName = aName.AllocL(); |
|
564 TRACE_EXIT_POINT |
|
565 } |
|
566 |
|
567 // ----------------------------------------------------------------------------- |
|
568 // CCalenContextImpl::GetCalAlarmEntryFileNameL |
|
569 // Get calendar file name of Alarm entry |
|
570 // ----------------------------------------------------------------------------- |
|
571 HBufC* CCalenContextImpl::GetCalAlarmEntryFileNameL() const |
|
572 { |
|
573 TRACE_ENTRY_POINT |
|
574 TRACE_EXIT_POINT |
|
575 |
|
576 return iCalAlarmEntryFileName; |
|
577 } |
|
578 |
|
579 // ----------------------------------------------------------------------------- |
|
580 // CCalenContextImpl::ResetCalAlarmEntryFileName |
|
581 // Resets Alarm Entry file name in context |
|
582 // ----------------------------------------------------------------------------- |
|
583 void CCalenContextImpl::ResetCalAlarmEntryFileName() |
|
584 { |
|
585 TRACE_ENTRY_POINT |
|
586 if(iCalAlarmEntryFileName) |
|
587 { |
|
588 delete iCalAlarmEntryFileName; |
|
589 iCalAlarmEntryFileName = NULL; |
|
590 } |
|
591 |
|
592 TRACE_EXIT_POINT |
|
593 } |
|
594 // ----------------------------------------------------------------------------- |
|
595 // CCalenContextImpl::ResetCalAlarmEntryFileName |
|
596 // set Alarm Entry LocalUid in context |
|
597 // ----------------------------------------------------------------------------- |
|
598 void CCalenContextImpl::SetCalAlarmEntryLocalUid(TCalLocalUid aLocalId) |
|
599 { |
|
600 TRACE_ENTRY_POINT |
|
601 iCalAlarmLocalUid = aLocalId; |
|
602 TRACE_EXIT_POINT |
|
603 } |
|
604 |
|
605 |
|
606 // ----------------------------------------------------------------------------- |
|
607 // CCalenContextImpl::ResetCalAlarmEntryFileName |
|
608 // Get Alarm Entry LocalUid from context |
|
609 // ----------------------------------------------------------------------------- |
|
610 TCalLocalUid CCalenContextImpl::CalAlarmLocalUidL() const |
|
611 { |
|
612 TRACE_ENTRY_POINT |
|
613 TRACE_EXIT_POINT |
|
614 return iCalAlarmLocalUid; |
|
615 } |
339 // End of file |
616 // End of file |