|
1 /* |
|
2 * Copyright (c) 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 : Aiw provider class provide menuservice which launched calendar |
|
15 * list dialog with multiple calendars. |
|
16 * |
|
17 */ |
|
18 |
|
19 // System includes. |
|
20 #include <AiwMenu.h> |
|
21 #include <calenaiwprovidermenu.rsg> |
|
22 #include <AiwGenericParam.hrh> |
|
23 #include <AiwCommon.hrh> |
|
24 #include <CalenImporter.h> |
|
25 #include <s32file.h> |
|
26 #include <CalenInterimUtils2.h> |
|
27 #include <calentryview.h> |
|
28 #include <sysutil.h> |
|
29 #include <aknnotewrappers.h> |
|
30 #include <calcalendariterator.h> |
|
31 #include <StringLoader.h> |
|
32 #include <CalenInterimUtils2.h> |
|
33 #include <calentry.h> |
|
34 #include <bautils.h> |
|
35 #include <data_caging_path_literals.hrh> |
|
36 #include <aknnavide.h> |
|
37 #include <akntitle.h> |
|
38 |
|
39 // User inlcudes. |
|
40 #include "calenaiwprovider.h" |
|
41 #include "multicaluidialog.h" |
|
42 #include "calendarui_debug.h" |
|
43 #include "calsession.h" |
|
44 #include "calendar.hrh" |
|
45 // Literals. |
|
46 _LIT( KResourceFileName, "calenaiwprovidermenu.rsc" ); |
|
47 // Recognition string for ical |
|
48 _LIT8(KVersionICal, "VERSION:2.0"); |
|
49 // Recognition string for vcal |
|
50 _LIT8(KVersionVCal, "VERSION:1.0"); |
|
51 |
|
52 // Constants. |
|
53 const TInt KReadDataAmount = 256; |
|
54 const TInt KVCalBcLeaveCodeCorrupt = -90; |
|
55 |
|
56 // --------------------------------------------------------------------------- |
|
57 // CCalenAiwProvider::NewL |
|
58 // (rest of the details are commented in the header) |
|
59 // --------------------------------------------------------------------------- |
|
60 // |
|
61 CCalenAiwProvider* CCalenAiwProvider::NewL() |
|
62 { |
|
63 TRACE_ENTRY_POINT |
|
64 |
|
65 CCalenAiwProvider* self = CCalenAiwProvider::NewLC(); |
|
66 CleanupStack::Pop(self); |
|
67 |
|
68 TRACE_EXIT_POINT |
|
69 return self; |
|
70 } |
|
71 |
|
72 // --------------------------------------------------------------------------- |
|
73 // CCalenAiwProvider::NewLC |
|
74 // (rest of the details are commented in the header) |
|
75 // --------------------------------------------------------------------------- |
|
76 // |
|
77 CCalenAiwProvider* CCalenAiwProvider::NewLC() |
|
78 { |
|
79 TRACE_ENTRY_POINT |
|
80 |
|
81 CCalenAiwProvider* self = new (ELeave) CCalenAiwProvider; |
|
82 CleanupStack::PushL(self); |
|
83 self->ConstructL(); |
|
84 |
|
85 TRACE_EXIT_POINT |
|
86 return self; |
|
87 } |
|
88 |
|
89 // --------------------------------------------------------------------------- |
|
90 // CCalenAiwProvider::~CCalenAiwProvider |
|
91 // (rest of the details are commented in the header) |
|
92 // --------------------------------------------------------------------------- |
|
93 // |
|
94 CCalenAiwProvider::~CCalenAiwProvider() |
|
95 { |
|
96 TRACE_ENTRY_POINT |
|
97 |
|
98 if(iCalEntryArray.Count()) |
|
99 { |
|
100 iCalEntryArray.ResetAndDestroy(); |
|
101 } |
|
102 if( iCalEntryView ) |
|
103 { |
|
104 delete iCalEntryView; |
|
105 iCalEntryView = NULL; |
|
106 } |
|
107 if( iCalSession ) |
|
108 { |
|
109 delete iCalSession; |
|
110 iCalSession = NULL; |
|
111 } |
|
112 if( iResourceFileOffset ) |
|
113 { |
|
114 CCoeEnv::Static()->DeleteResourceFile( iResourceFileOffset ); |
|
115 } |
|
116 if(iInterimUtils) |
|
117 { |
|
118 delete iInterimUtils; |
|
119 iInterimUtils = NULL; |
|
120 } |
|
121 |
|
122 TRACE_EXIT_POINT |
|
123 } |
|
124 |
|
125 // --------------------------------------------------------------------------- |
|
126 // CCalenAiwProvider::InitialiseL |
|
127 // (rest of the details are commented in the header) |
|
128 // --------------------------------------------------------------------------- |
|
129 // |
|
130 void CCalenAiwProvider::InitialiseL( MAiwNotifyCallback& /*aFrameworkCallback*/, |
|
131 const RCriteriaArray& /*aInterest*/ ) |
|
132 { |
|
133 TRACE_ENTRY_POINT |
|
134 |
|
135 // No implementation yet. |
|
136 |
|
137 TRACE_EXIT_POINT |
|
138 } |
|
139 |
|
140 // --------------------------------------------------------------------------- |
|
141 // CCalenAiwProvider::HandleServiceCmdL |
|
142 // Handles the menu item command. |
|
143 // (rest of the details are commented in the header) |
|
144 // --------------------------------------------------------------------------- |
|
145 // |
|
146 void CCalenAiwProvider::HandleServiceCmdL( const TInt& aCmdId, |
|
147 const CAiwGenericParamList& aInParamList, |
|
148 CAiwGenericParamList& /*aOutParamList*/, |
|
149 TUint /*aCmdOptions*/, |
|
150 const MAiwNotifyCallback* /*aCallback*/ ) |
|
151 { |
|
152 TRACE_ENTRY_POINT |
|
153 |
|
154 switch( aCmdId ) |
|
155 { |
|
156 case KAiwCmdSaveToCalendar: |
|
157 { |
|
158 // Parsing the parameters sent by consumer. |
|
159 TInt count = aInParamList.Count(); |
|
160 TInt index = 0; |
|
161 TInt errTrapVal( KErrNone ); |
|
162 TInt errVal( KErrNone ); |
|
163 const TAiwGenericParam* uidParam = aInParamList.FindFirst( index, |
|
164 EGenericParamFile, |
|
165 EVariantTypeFileHandle); |
|
166 |
|
167 if( index >= 0 ) |
|
168 { |
|
169 // Get the data. |
|
170 const TAiwVariant& val = uidParam->Value(); |
|
171 RFile fileHandle ( val.AsFileHandle() ); |
|
172 |
|
173 // Get the entries from filehandle. |
|
174 ImportVCalendarL( fileHandle ); |
|
175 |
|
176 if( HasMorethanOneCalendarL() ) |
|
177 { |
|
178 TRAP( errTrapVal, errVal = SaveWithDialogL() ); |
|
179 if( !errTrapVal && ( -2 == errVal || errVal == ECalenSelectCmdOk ) ) |
|
180 { |
|
181 CAknInformationNote* calSavenote = new( ELeave )CAknInformationNote; |
|
182 HBufC* calSaveNote = StringLoader::LoadLC( R_SAVECALENDARNOTE_TEXT, |
|
183 CCoeEnv::Static() ); |
|
184 |
|
185 calSavenote->ExecuteLD( *calSaveNote ); |
|
186 CleanupStack::PopAndDestroy( calSaveNote ); |
|
187 } |
|
188 } |
|
189 else |
|
190 { |
|
191 TRAP( errTrapVal, errVal = SaveWithoutDialogL() ); |
|
192 if( !errTrapVal && ( 0 == errVal ) ) |
|
193 { |
|
194 CAknInformationNote* calSavenote = new( ELeave )CAknInformationNote; |
|
195 HBufC* calSaveNote = StringLoader::LoadLC( R_SAVECALENDARNOTE_TEXT, |
|
196 CCoeEnv::Static() ); |
|
197 |
|
198 calSavenote->ExecuteLD( *calSaveNote ); |
|
199 CleanupStack::PopAndDestroy( calSaveNote ); |
|
200 } |
|
201 } |
|
202 |
|
203 } |
|
204 else |
|
205 { |
|
206 // RFile param not found param not found. Error handling could be added here. |
|
207 } |
|
208 } |
|
209 break; |
|
210 |
|
211 default: |
|
212 { |
|
213 // no implementation yet. |
|
214 } |
|
215 break; |
|
216 } |
|
217 |
|
218 TRACE_EXIT_POINT |
|
219 } |
|
220 |
|
221 // --------------------------------------------------------------------------- |
|
222 // CCalenAiwProvider::InitializeMenuPaneL |
|
223 // (rest of the details are commented in the header) |
|
224 // --------------------------------------------------------------------------- |
|
225 // |
|
226 void CCalenAiwProvider::InitializeMenuPaneL( CAiwMenuPane& aMenuPane, |
|
227 TInt aIndex, |
|
228 TInt /*aCascadeId*/, |
|
229 const CAiwGenericParamList& /*aInParamList*/ ) |
|
230 { |
|
231 TRACE_ENTRY_POINT |
|
232 |
|
233 // Append the item to the menu pane. |
|
234 aMenuPane.AddMenuItemsL( iResourceFileName, |
|
235 R_CALEN_AIW_PROVIDER_MENU_PANE, |
|
236 KAiwCmdSaveToCalendar, |
|
237 aIndex ); |
|
238 TRACE_EXIT_POINT |
|
239 } |
|
240 |
|
241 // --------------------------------------------------------------------------- |
|
242 // CCalenAiwProvider::HandleMenuCmdL |
|
243 // (rest of the details are commented in the header) |
|
244 // --------------------------------------------------------------------------- |
|
245 // |
|
246 void CCalenAiwProvider::HandleMenuCmdL( TInt aMenuCmdId, |
|
247 const CAiwGenericParamList& aInParamList, |
|
248 CAiwGenericParamList& aOutParamList, |
|
249 TUint aCmdOptions, |
|
250 const MAiwNotifyCallback* aCallback ) |
|
251 { |
|
252 TRACE_ENTRY_POINT |
|
253 |
|
254 // Handle it in HandleServiceCmdL. |
|
255 HandleServiceCmdL( aMenuCmdId, |
|
256 aInParamList, |
|
257 aOutParamList, |
|
258 aCmdOptions, |
|
259 aCallback ); |
|
260 |
|
261 TRACE_EXIT_POINT |
|
262 } |
|
263 |
|
264 // --------------------------------------------------------------------------- |
|
265 // CCalenAiwProvider::Progress |
|
266 // (rest of the details are commented in the header) |
|
267 // --------------------------------------------------------------------------- |
|
268 // |
|
269 void CCalenAiwProvider::Progress( TInt /* aPercentageCompleted */ ) |
|
270 { |
|
271 // No implementation yet. |
|
272 } |
|
273 |
|
274 // --------------------------------------------------------------------------- |
|
275 // CCalenAiwProvider::Completed |
|
276 // (rest of the details are commented in the header) |
|
277 // --------------------------------------------------------------------------- |
|
278 // |
|
279 void CCalenAiwProvider::Completed( TInt aError ) |
|
280 { |
|
281 iCalEntryViewInitErrno = aError; |
|
282 } |
|
283 |
|
284 // --------------------------------------------------------------------------- |
|
285 // CCalenAiwProvider::NotifyProgress |
|
286 // (rest of the details are commented in the header) |
|
287 // --------------------------------------------------------------------------- |
|
288 // |
|
289 TBool CCalenAiwProvider::NotifyProgress() |
|
290 { |
|
291 // Return ETrue if you want progress information. |
|
292 return EFalse; |
|
293 } |
|
294 |
|
295 // --------------------------------------------------------------------------- |
|
296 // CCalenAiwProvider::ImportVCalendarL |
|
297 // (rest of the details are commented in the header) |
|
298 // --------------------------------------------------------------------------- |
|
299 // |
|
300 #if defined (__I_CAL_SUPPORT) && defined (RD_MESSAGING_ICAL_IMPORT) |
|
301 void CCalenAiwProvider::ImportVCalendarL( RFile& aFileHandle ) |
|
302 { |
|
303 TRACE_ENTRY_POINT |
|
304 |
|
305 CCalenImporter* calImporter = CCalenImporter::NewL( *iCalSession ); |
|
306 CleanupStack::PushL( calImporter ); |
|
307 calImporter->SetImportMode( ECalenImportModeExtended ); |
|
308 |
|
309 RFileReadStream stream( aFileHandle,0 ); |
|
310 CleanupClosePushL( stream ); |
|
311 |
|
312 TBuf8<KReadDataAmount> vcalData; |
|
313 |
|
314 TInt errRead( KErrNone ); |
|
315 TRAP( errRead,stream.ReadL( vcalData, KReadDataAmount ) ); |
|
316 |
|
317 if( errRead != KErrEof && errRead != KErrNone ) |
|
318 { |
|
319 User::Leave( KVCalBcLeaveCodeCorrupt ); |
|
320 } |
|
321 |
|
322 // Return the read stream back to the beginning for import |
|
323 stream.Source()->SeekL( MStreamBuf::ERead, EStreamBeginning, 0 ); |
|
324 |
|
325 TInt errImport( KErrNone ); |
|
326 //Reset the array if its already imported. |
|
327 if(iCalEntryArray.Count()) |
|
328 { |
|
329 iCalEntryArray.ResetAndDestroy(); |
|
330 } |
|
331 |
|
332 |
|
333 if ( vcalData.FindF( KVersionVCal ) == KErrNotFound ) |
|
334 { |
|
335 //using the ICAl import API |
|
336 TRAP( errImport, calImporter->ImportICalendarL( stream, iCalEntryArray ) ); |
|
337 } |
|
338 else if ( vcalData.FindF( KVersionICal ) == KErrNotFound ) |
|
339 { |
|
340 //using the VCAL import API |
|
341 TRAP( errImport, calImporter->ImportVCalendarL( stream, iCalEntryArray ) ); |
|
342 } |
|
343 // Cleaning up calImproter and stream. |
|
344 CleanupStack::PopAndDestroy( 2, calImporter ); |
|
345 |
|
346 if( errImport != KErrNone || iCalEntryArray.Count() == 0 ) |
|
347 { |
|
348 // the data was corrupt |
|
349 User::Leave( KVCalBcLeaveCodeCorrupt ); |
|
350 } |
|
351 |
|
352 // BIO viewer always sets the local UID to 0 in imported entry |
|
353 iCalEntryArray[0]->SetLocalUidL( TCalLocalUid( 0 ) ); |
|
354 |
|
355 TRACE_EXIT_POINT |
|
356 } |
|
357 #else |
|
358 void CCalenAiwProvider::ImportVCalendarL( RFile& aFileHandle ) |
|
359 { |
|
360 TRACE_ENTRY_POINT |
|
361 |
|
362 CCalenImporter* calImporter = CCalenImporter::NewL( *iCalSession ); |
|
363 CleanupStack::PushL( calImporter ); |
|
364 calImporter->SetImportMode( ECalenImportModeExtended ); |
|
365 |
|
366 RFileReadStream stream( aFileHandle,0 ); |
|
367 CleanupClosePushL( stream ); |
|
368 |
|
369 iCalEntryArray.ResetAndDestroy(); |
|
370 TRAPD( err, calImporter->ImportVCalendarL( stream, iCalEntryArray ) ); |
|
371 |
|
372 // Cleaning up calImproter and stream. |
|
373 CleanupStack::PopAndDestroy( 2,calImporter );//stream, calImporter |
|
374 if( err != KErrNone || iCalEntryArray.Count() == 0 ) |
|
375 { |
|
376 // The data was corrupt |
|
377 User::Leave( KVCalBcLeaveCodeCorrupt ); |
|
378 } |
|
379 |
|
380 // BIO viewer always sets the local UID to 0 in imported entry |
|
381 iCalEntryArray[0]->SetLocalUidL( TCalLocalUid( 0 ) ); |
|
382 |
|
383 TRACE_EXIT_POINT |
|
384 } |
|
385 #endif |
|
386 |
|
387 // ---------------------------------------------------------------------------- |
|
388 // CCalenListDialogModel::HasMorethanOneCalendar |
|
389 // Rest of the details are commented in header. |
|
390 // ---------------------------------------------------------------------------- |
|
391 // |
|
392 TBool CCalenAiwProvider::HasMorethanOneCalendarL() |
|
393 { |
|
394 TRACE_ENTRY_POINT |
|
395 |
|
396 TInt retVal( EFalse ); |
|
397 if(iCalSession) |
|
398 { |
|
399 CCalCalendarIterator* calIter = CCalCalendarIterator::NewL( *iCalSession ); |
|
400 CleanupStack::PushL( calIter ); |
|
401 if ( calIter->Count()> 1 ) |
|
402 { |
|
403 retVal = ETrue; |
|
404 } |
|
405 CleanupStack::PopAndDestroy(calIter); |
|
406 } |
|
407 |
|
408 |
|
409 TRACE_EXIT_POINT |
|
410 return retVal; |
|
411 } |
|
412 |
|
413 // ---------------------------------------------------------------------------- |
|
414 // CCalenListDialogModel::SaveWithDialogL |
|
415 // Rest of the details are commented in header. |
|
416 // ---------------------------------------------------------------------------- |
|
417 // |
|
418 TInt CCalenAiwProvider::SaveWithDialogL() |
|
419 { |
|
420 TRACE_ENTRY_POINT |
|
421 |
|
422 TInt errVal( KErrNone ); |
|
423 |
|
424 if( SysUtil::FFSSpaceBelowCriticalLevelL( NULL ) ) |
|
425 { |
|
426 errVal = KErrDiskFull ; |
|
427 User::LeaveIfError( errVal ); |
|
428 } |
|
429 // Handle the command here. |
|
430 |
|
431 // Create settings own titlepane and navipane, and swap with existing ones |
|
432 CEikStatusPane* sp = CEikonEnv::Static()->AppUiFactory()->StatusPane(); |
|
433 |
|
434 // Titlepane |
|
435 CAknTitlePane* newtp = new( ELeave ) CAknTitlePane(); |
|
436 CleanupStack::PushL( newtp ); |
|
437 CCoeControl* oldtp = sp->SwapControlL( TUid::Uid(EEikStatusPaneUidTitle), newtp ); |
|
438 CleanupStack::Pop( newtp ); // ownership is passed to statuspane |
|
439 TRect oldRect( 0, 0, 0, 0 ); |
|
440 if( oldtp ) |
|
441 { |
|
442 CleanupStack::PushL( oldtp ); |
|
443 oldRect = oldtp->Rect(); |
|
444 CCoeControl* ctrl = sp->ContainerControlL( TUid::Uid( EEikStatusPaneUidTitle )); |
|
445 newtp->SetContainerWindowL( *ctrl ); |
|
446 newtp->ConstructL(); |
|
447 newtp->SetRect(oldRect); |
|
448 newtp->ActivateL(); |
|
449 } |
|
450 |
|
451 // NaviPane |
|
452 CAknNavigationControlContainer* newnp = new( ELeave )CAknNavigationControlContainer(); |
|
453 CleanupStack::PushL( newnp ); |
|
454 CCoeControl* oldnp = sp->SwapControlL( TUid::Uid( EEikStatusPaneUidNavi ), newnp ); |
|
455 CleanupStack::Pop( newnp ); // ownership is passed to statuspane |
|
456 if( oldnp ) |
|
457 { |
|
458 CleanupStack::PushL( oldnp ); |
|
459 oldRect = oldnp->Rect(); |
|
460 CCoeControl* ctrl = sp->ContainerControlL( TUid::Uid( EEikStatusPaneUidNavi ) ); |
|
461 newnp->SetContainerWindowL( *ctrl ); |
|
462 newnp->ConstructL(); |
|
463 newnp->SetRect( oldRect ); |
|
464 newnp->PushDefaultL(); |
|
465 newnp->ActivateL(); |
|
466 } |
|
467 |
|
468 CMultiCalUiDialog* multiCalUiDialog = CMultiCalUiDialog::NewLC( iCalEntryArray ); |
|
469 errVal = multiCalUiDialog->LaunchL(); |
|
470 CleanupStack::PopAndDestroy( multiCalUiDialog ); |
|
471 |
|
472 |
|
473 // When setting is closed, swap back old titlepane and navipane |
|
474 if( oldnp && sp->SwapControlL( TUid::Uid(EEikStatusPaneUidNavi), oldnp ) ) |
|
475 { |
|
476 CleanupStack::Pop( oldnp ); |
|
477 delete newnp; |
|
478 oldnp->ActivateL(); |
|
479 } |
|
480 |
|
481 if( oldtp && sp->SwapControlL( TUid::Uid(EEikStatusPaneUidTitle), oldtp ) ) |
|
482 { |
|
483 CleanupStack::Pop( oldtp ); |
|
484 delete newtp; |
|
485 oldtp->ActivateL(); |
|
486 } |
|
487 |
|
488 return errVal; |
|
489 |
|
490 TRACE_EXIT_POINT |
|
491 } |
|
492 |
|
493 // ---------------------------------------------------------------------------- |
|
494 // CCalenListDialogModel::SaveWithoutDialogL |
|
495 // Rest of the details are commented in header. |
|
496 // ---------------------------------------------------------------------------- |
|
497 // |
|
498 TInt CCalenAiwProvider::SaveWithoutDialogL() |
|
499 { |
|
500 TRACE_ENTRY_POINT |
|
501 |
|
502 TInt errVal( KErrNone ); |
|
503 if( ! iCalEntryView ) |
|
504 { |
|
505 iCalEntryView = CCalEntryView::NewL( *iCalSession ); |
|
506 User::LeaveIfError( iCalEntryViewInitErrno ); |
|
507 } |
|
508 |
|
509 if( SysUtil::FFSSpaceBelowCriticalLevelL( NULL ) ) |
|
510 { |
|
511 errVal = KErrDiskFull ; |
|
512 return errVal; |
|
513 } |
|
514 |
|
515 TInt numSuccessfulEntry(0); |
|
516 if( iCalEntryView ) |
|
517 { |
|
518 // Get the guid changed for every entires. |
|
519 CreateCopyWithNewGuidL( iCalEntryArray ); |
|
520 TRAP( errVal, iCalEntryView->StoreL( iCalEntryArray, numSuccessfulEntry ) ); |
|
521 |
|
522 if( numSuccessfulEntry != iCalEntryArray.Count() ) |
|
523 { |
|
524 errVal = KErrCompletion ; |
|
525 } |
|
526 } |
|
527 |
|
528 |
|
529 TRACE_EXIT_POINT |
|
530 |
|
531 return errVal; |
|
532 } |
|
533 |
|
534 // ---------------------------------------------------------------------------- |
|
535 // CCalenListDialogModel::CreateCopyWithNewGuidL |
|
536 // Rest of the details are commented in header. |
|
537 // ---------------------------------------------------------------------------- |
|
538 // |
|
539 void CCalenAiwProvider::CreateCopyWithNewGuidL( RPointerArray<CCalEntry>& aSrcDesEntryArray ) |
|
540 { |
|
541 TRACE_ENTRY_POINT; |
|
542 |
|
543 for( TInt count = 0; count< aSrcDesEntryArray.Count(); count++ ) |
|
544 { |
|
545 CCalEntry* sourceEnrty = aSrcDesEntryArray[count]; |
|
546 HBufC8* guid = iInterimUtils->GlobalUidL(); |
|
547 CleanupStack::PushL(guid); |
|
548 CCalEntry* entry = CCalEntry::NewL( sourceEnrty->EntryTypeL(), guid, CCalEntry::EMethodNone, 0 ); |
|
549 |
|
550 // ownership was passed |
|
551 CleanupStack::Pop( guid ); |
|
552 CleanupStack::PushL( entry ); |
|
553 // make sure entry is fully loaded. |
|
554 sourceEnrty->DescriptionL(); |
|
555 entry->CopyFromL( *sourceEnrty, CCalEntry::EDontCopyId ); |
|
556 // make sure entry is fully copied |
|
557 entry->DescriptionL(); |
|
558 |
|
559 // Remove the entry at current "count" and insert the new entry in same place. |
|
560 aSrcDesEntryArray.Remove(count); |
|
561 delete sourceEnrty; |
|
562 aSrcDesEntryArray.Insert( entry, count ); |
|
563 CleanupStack::Pop( entry ); |
|
564 } |
|
565 |
|
566 |
|
567 TRACE_EXIT_POINT; |
|
568 } |
|
569 |
|
570 // --------------------------------------------------------------------------- |
|
571 // CCalenAiwProvider::ConstructL |
|
572 // (rest of the details are commented in the header) |
|
573 // --------------------------------------------------------------------------- |
|
574 // |
|
575 void CCalenAiwProvider::ConstructL() |
|
576 { |
|
577 TRACE_ENTRY_POINT |
|
578 |
|
579 if( !iCalSession ) |
|
580 { |
|
581 iCalSession = CCalSession::NewL(); |
|
582 } |
|
583 |
|
584 // Which calendar file should be used. |
|
585 TRAPD( err, iCalSession->OpenL( iCalSession->DefaultFileNameL() ) ); |
|
586 if ( err == KErrNotFound ) |
|
587 { |
|
588 // TODO : what to do with this code ?????? |
|
589 // If calendar file was not found, should we create it or not? |
|
590 // I think is not BIO control's responsibility to create it. |
|
591 // |
|
592 iCalSession->CreateCalFileL( iCalSession->DefaultFileNameL() ); |
|
593 iCalSession->OpenL( iCalSession->DefaultFileNameL() ); |
|
594 } |
|
595 else |
|
596 { |
|
597 User::LeaveIfError( err ); |
|
598 } |
|
599 |
|
600 // Load the required the resource file. |
|
601 TFileName resFile; |
|
602 |
|
603 // We take the drive in which the dll is being used from append the same |
|
604 // drive name to the beginning of the resource file path. |
|
605 TFileName dllName; |
|
606 Dll::FileName( dllName ); |
|
607 // Two characters for the drive name. For e.g: (C:) |
|
608 TBuf< 2 > driveLetter = dllName.Left( 2 ); |
|
609 resFile.Insert( 0, driveLetter ); |
|
610 resFile.Append( KDC_APP_RESOURCE_DIR ); |
|
611 resFile.Append( KResourceFileName ); |
|
612 |
|
613 iResourceFileName = resFile; |
|
614 |
|
615 BaflUtils::NearestLanguageFile( CCoeEnv::Static()->FsSession(), iResourceFileName ); |
|
616 |
|
617 iResourceFileOffset = CCoeEnv::Static()->AddResourceFileL( iResourceFileName ); |
|
618 |
|
619 iInterimUtils = CCalenInterimUtils2::NewL(); |
|
620 |
|
621 TRACE_EXIT_POINT |
|
622 } |
|
623 |
|
624 // --------------------------------------------------------------------------- |
|
625 // CCalenAiwProvider::CCalenAiwProvider |
|
626 // (rest of the details are commented in the header) |
|
627 // --------------------------------------------------------------------------- |
|
628 // |
|
629 CCalenAiwProvider::CCalenAiwProvider() |
|
630 { |
|
631 TRACE_ENTRY_POINT |
|
632 |
|
633 // No implementation yet. |
|
634 |
|
635 TRACE_EXIT_POINT |
|
636 } |
|
637 |
|
638 // End of file --Don't delete this. |