|
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: Functional implementation of PIM service (for vCalendar, vCard) |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "HtiPIMServicePlugin.h" |
|
21 #include "PIMHandler.h" |
|
22 |
|
23 #include <HtiDispatcherInterface.h> |
|
24 #include <HTILogging.h> |
|
25 |
|
26 #include <utf.h> |
|
27 #include <calcommon.h> |
|
28 #include <calsession.h> |
|
29 #include <calenimporter.h> |
|
30 #include <calentryview.h> |
|
31 |
|
32 #include <CVPbkContactLinkArray.h> |
|
33 #include <CVPbkContactManager.h> |
|
34 #include <CVPbkContactViewDefinition.h> |
|
35 #include <CVPbkContactStoreUriArray.h> |
|
36 #include <CVPbkSortOrder.h> |
|
37 #include <CVPbkVCardEng.h> |
|
38 #include <MVPbkContactLinkArray.h> |
|
39 #include <MVPbkContactOperationBase.h> |
|
40 #include <MVPbkContactStore.h> |
|
41 #include <MVPbkContactStoreList.h> |
|
42 #include <MVPbkContactStoreObserver.h> |
|
43 #include <MVPbkContactStoreProperties.h> |
|
44 #include <MVPbkContactView.h> |
|
45 #include <MVPbkContactViewBase.h> |
|
46 #include <MVPbkViewContact.h> |
|
47 #include <TVPbkContactStoreUriPtr.h> |
|
48 #include <VPbkContactStoreUris.h> |
|
49 |
|
50 // CONSTANTS |
|
51 _LIT8( KErrorUnrecognizedCommand, "Unrecognized command" ); |
|
52 _LIT8( KErrorVCardImportFailed, "vCard import failed" ); |
|
53 _LIT8( KErrorVCalendarImportFailed, "vCalendar import failed" ); |
|
54 _LIT8( KErrorMissingVCalendar, "Missing vCalendar object" ); |
|
55 _LIT8( KErrorMissingVCard, "Missing vCard object" ); |
|
56 _LIT8( KErrorInvalidId, "Invalid ID parameter" ); |
|
57 _LIT8( KErrorItemNotFound, "Item not found" ); |
|
58 _LIT8( KErrorFailedDelete, "Failed to delete item" ); |
|
59 _LIT8( KErrorFailedDeleteAll, "Failed to delete all items" ); |
|
60 _LIT8( KErrorIdDeleteNotSupported, "Deleting with ID not supported anymore" ); |
|
61 |
|
62 _LIT8( KErrorMissingText, "Text parameter missing" ); |
|
63 _LIT8( KErrorMissingFilepath, "Filepath parameter missing" ); |
|
64 _LIT8( KErrorNotepadAddMemoFailed, "Notepad add memo failed" ); |
|
65 _LIT8( KErrorNotepadAddMemoFromFileFailed, "Notepad add memo from file failed" ); |
|
66 _LIT8( KErrorNotepadDeleteAllFailed, "Notepad delete all failed" ); |
|
67 |
|
68 _LIT( KHtiNpdHlpExe, "HtiNpdHlp.exe" ); |
|
69 _LIT( KCmdAddMemo, "AddMemo" ); |
|
70 _LIT( KCmdAddMemoFromFile, "AddMemoFromFile" ); |
|
71 _LIT( KCmdDeleteAll, "DeleteAll" ); |
|
72 _LIT( KCmdDelim, " " ); |
|
73 |
|
74 _LIT( KDefaultAgendaFile, "" ); // A default file is opened if fileName is KNullDesC |
|
75 |
|
76 |
|
77 // ---------------------------------------------------------------------------- |
|
78 CPIMHandler* CPIMHandler::NewL() |
|
79 { |
|
80 HTI_LOG_FUNC_IN( "CPIMHandler::NewL" ); |
|
81 CPIMHandler* self = new (ELeave) CPIMHandler(); |
|
82 CleanupStack::PushL ( self ); |
|
83 self->ConstructL(); |
|
84 CleanupStack::Pop(); |
|
85 HTI_LOG_FUNC_OUT( "CPIMHandler::Done" ); |
|
86 return self; |
|
87 } |
|
88 |
|
89 // ---------------------------------------------------------------------------- |
|
90 CPIMHandler::CPIMHandler():iIsBusy( EFalse ), iEntryViewErr( KErrNone ) |
|
91 { |
|
92 } |
|
93 |
|
94 // ---------------------------------------------------------------------------- |
|
95 CPIMHandler::~CPIMHandler() |
|
96 { |
|
97 HTI_LOG_TEXT( "CPIMHandler destroy" ); |
|
98 HTI_LOG_TEXT( "Deleting iEntryView" ); |
|
99 delete iEntryView; |
|
100 HTI_LOG_TEXT( "Deleting iCalSession" ); |
|
101 delete iCalSession; |
|
102 if ( iContactView ) |
|
103 { |
|
104 HTI_LOG_TEXT( "Deleting iContactView" ); |
|
105 iContactView->RemoveObserver( *this ); |
|
106 delete iContactView; |
|
107 } |
|
108 HTI_LOG_TEXT( "Deleting iVCardEngine" ); |
|
109 delete iVCardEngine; |
|
110 HTI_LOG_TEXT( "Deleting iContactManager" ); |
|
111 delete iContactManager; |
|
112 HTI_LOG_TEXT( "Deleting iBuffer" ); |
|
113 delete iBuffer; |
|
114 HTI_LOG_TEXT( "Deleting iWaiter" ); |
|
115 delete iWaiter; |
|
116 } |
|
117 |
|
118 // ---------------------------------------------------------------------------- |
|
119 void CPIMHandler::ConstructL() |
|
120 { |
|
121 HTI_LOG_TEXT( "CPIMHandler::ConstructL" ); |
|
122 iWaiter = new ( ELeave ) CActiveSchedulerWait; |
|
123 |
|
124 } |
|
125 |
|
126 // ---------------------------------------------------------------------------- |
|
127 void CPIMHandler::SetDispatcher( MHtiDispatcher* aDispatcher ) |
|
128 { |
|
129 iDispatcher = aDispatcher; |
|
130 } |
|
131 |
|
132 // ---------------------------------------------------------------------------- |
|
133 void CPIMHandler::ProcessMessageL( const TDesC8& aMessage, |
|
134 THtiMessagePriority /*aPriority*/ ) |
|
135 { |
|
136 HTI_LOG_FUNC_IN( "CPIMHandler::ProcessMessageL" ); |
|
137 |
|
138 iIsBusy = ETrue; |
|
139 TInt err = KErrNone; |
|
140 |
|
141 // Zero legth of aMessage tested already in CHtiPIMServicePlugin. |
|
142 // Other sanity checks must be done here. |
|
143 |
|
144 iCommand = aMessage.Ptr()[0]; |
|
145 switch ( iCommand ) |
|
146 { |
|
147 case CHtiPIMServicePlugin::EImportVCard: |
|
148 { |
|
149 TRAP( err, HandleVCardImportFuncL( |
|
150 aMessage.Right( aMessage.Length() - 1 ) ) ); |
|
151 break; |
|
152 } |
|
153 case CHtiPIMServicePlugin::EImportVCalendar: |
|
154 { |
|
155 TRAP( err, HandleVCalendarImportFuncL( |
|
156 aMessage.Right( aMessage.Length() - 1 ) ) ); |
|
157 break; |
|
158 } |
|
159 case CHtiPIMServicePlugin::EDeleteContact: |
|
160 { |
|
161 TRAP( err, HandleContactDeleteFuncL( |
|
162 aMessage.Right( aMessage.Length() - 1 ) ) ); |
|
163 break; |
|
164 } |
|
165 case CHtiPIMServicePlugin::EDeleteCalendar: |
|
166 { |
|
167 TRAP( err, HandleCalendarDeleteFuncL( |
|
168 aMessage.Right( aMessage.Length() - 1 ) ) ); |
|
169 break; |
|
170 } |
|
171 case CHtiPIMServicePlugin::ENotepadAddMemo: |
|
172 { |
|
173 TRAP( err, HandleNotepadAddMemoFuncL( aMessage.Mid( 1 ) ) ); |
|
174 break; |
|
175 } |
|
176 case CHtiPIMServicePlugin::ENotepadAddMemoFromFile: |
|
177 { |
|
178 TRAP( err, HandleNotepadAddMemoFromFileFuncL( aMessage.Mid( 1 ) ) ); |
|
179 break; |
|
180 } |
|
181 case CHtiPIMServicePlugin::ENotepadDeleteAll: |
|
182 { |
|
183 TRAP( err, HandleNotepadDeleteAllFuncL() ); |
|
184 break; |
|
185 } |
|
186 default: |
|
187 { |
|
188 TRAP( err, SendErrorMessageL( |
|
189 KErrArgument, KErrorUnrecognizedCommand ) ); |
|
190 break; |
|
191 } |
|
192 } |
|
193 |
|
194 if ( err != KErrNone ) |
|
195 { |
|
196 iIsBusy = EFalse; |
|
197 User::Leave( err ); |
|
198 } |
|
199 |
|
200 HTI_LOG_FUNC_OUT( "CPIMHandler::ProcessMessageL: Done" ); |
|
201 } |
|
202 |
|
203 // ---------------------------------------------------------------------------- |
|
204 TBool CPIMHandler::IsBusy() |
|
205 { |
|
206 return iIsBusy; |
|
207 } |
|
208 |
|
209 // ---------------------------------------------------------------------------- |
|
210 void CPIMHandler::HandleVCardImportFuncL( const TDesC8& aData ) |
|
211 { |
|
212 HTI_LOG_FUNC_IN( "CPIMHandler::HandleVCardImportFuncL" ); |
|
213 |
|
214 if ( aData.Length() == 0 ) |
|
215 { |
|
216 SendErrorMessageL( KErrArgument, KErrorMissingVCard ); |
|
217 return; |
|
218 } |
|
219 |
|
220 if ( iBuffer ) // delete if exists (just to be sure) |
|
221 { |
|
222 delete iBuffer; |
|
223 iBuffer = NULL; |
|
224 } |
|
225 iBuffer = CBufFlat::NewL( aData.Length() ); |
|
226 iBuffer->ExpandL( 0, aData.Length() ); |
|
227 |
|
228 HTI_LOG_FORMAT( "Data length = %d", aData.Length() ); |
|
229 HTI_LOG_FORMAT( "Buffer length = %d", iBuffer->Ptr( 0 ).MaxLength() ); |
|
230 iBuffer->Ptr( 0 ).Copy( aData ); |
|
231 |
|
232 if ( iContactManager == NULL ) |
|
233 { |
|
234 CVPbkContactStoreUriArray* uriArray = CVPbkContactStoreUriArray::NewLC(); |
|
235 uriArray->AppendL( TVPbkContactStoreUriPtr( |
|
236 VPbkContactStoreUris::DefaultCntDbUri() ) ); |
|
237 iContactManager = CVPbkContactManager::NewL( *uriArray ); |
|
238 CleanupStack::PopAndDestroy( uriArray ); |
|
239 } |
|
240 |
|
241 if ( iVCardEngine == NULL ) |
|
242 { |
|
243 iVCardEngine = CVPbkVCardEng::NewL( *iContactManager ); |
|
244 } |
|
245 |
|
246 MVPbkContactStoreList& stores = iContactManager->ContactStoresL(); |
|
247 iContactStore = &stores.At( 0 ); |
|
248 iContactStore->OpenL( *this ); |
|
249 |
|
250 HTI_LOG_FUNC_OUT( "CPIMHandler::HandleVCardImportFuncL: Done" ); |
|
251 } |
|
252 |
|
253 // ---------------------------------------------------------------------------- |
|
254 void CPIMHandler::HandleVCalendarImportFuncL( const TDesC8& aData ) |
|
255 { |
|
256 HTI_LOG_FUNC_IN( "CPIMHandler::HandleVCalendarImportFuncL" ); |
|
257 |
|
258 if ( aData.Length() == 0 ) |
|
259 { |
|
260 HTI_LOG_TEXT( "CPIMHandler::HandleVCalendarImportFuncL: Error: length of data is zero" ) |
|
261 SendErrorMessageL( KErrArgument, KErrorMissingVCalendar ); |
|
262 return; |
|
263 } |
|
264 |
|
265 if ( iBuffer ) // delete if exists (just to be sure) |
|
266 { |
|
267 delete iBuffer; |
|
268 iBuffer = NULL; |
|
269 } |
|
270 iBuffer = CBufFlat::NewL( aData.Length() ); |
|
271 iBuffer->ExpandL( 0, aData.Length() ); |
|
272 iBuffer->Ptr( 0 ).Copy( aData ); |
|
273 RBufReadStream readStream; |
|
274 readStream.Open( *iBuffer, 0 ); |
|
275 CleanupClosePushL( readStream ); |
|
276 |
|
277 if ( iCalSession == NULL ) |
|
278 { |
|
279 HTI_LOG_TEXT( "CPIMHandler: Creating Calendar session" ); |
|
280 iCalSession = CCalSession::NewL(); |
|
281 iCalSession->OpenL( KDefaultAgendaFile ); |
|
282 HTI_LOG_TEXT( "CPIMHandler: Calendar session open" ); |
|
283 } |
|
284 |
|
285 CCalenImporter* importer = CCalenImporter::NewL( *iCalSession ); |
|
286 CleanupStack::PushL( importer ); |
|
287 HTI_LOG_TEXT( "CPIMHandler: Calendar importer created" ); |
|
288 |
|
289 RPointerArray<CCalEntry> entryArray; |
|
290 CleanupClosePushL( entryArray ); |
|
291 |
|
292 TInt err = KErrNone; |
|
293 TInt size = 0; |
|
294 importer->SetImportMode( ECalenImportModeExtended ); |
|
295 // First try to import as iCalendar |
|
296 TRAP( err, importer->ImportICalendarL( readStream, entryArray ) ); |
|
297 HTI_LOG_FORMAT( "ImportICalendarL return value %d", err ); |
|
298 size = entryArray.Count(); |
|
299 HTI_LOG_FORMAT( "Import ICalendarL imported %d entries", size ); |
|
300 // If import didn't succeed, try as vCalendar |
|
301 if ( err != KErrNone || size == 0 ) |
|
302 { |
|
303 readStream.Close(); |
|
304 readStream.Open( *iBuffer, 0 ); // reset read stream |
|
305 entryArray.ResetAndDestroy(); // avoid double imports |
|
306 TRAP( err, importer->ImportVCalendarL( readStream, entryArray ) ); |
|
307 HTI_LOG_FORMAT( "ImportVCalendarL return value %d", err ); |
|
308 size = entryArray.Count(); |
|
309 HTI_LOG_FORMAT( "Import VCalendarL imported %d entries", size ); |
|
310 } |
|
311 TCalLocalUid uniqueId = 0; |
|
312 TInt success = 0; |
|
313 if ( size > 0 ) |
|
314 { |
|
315 iEntryView = CCalEntryView::NewL( *iCalSession, *this ); |
|
316 iWaiter->Start(); |
|
317 if ( iEntryViewErr == KErrNone ) |
|
318 { |
|
319 TRAP( err, iEntryView->StoreL( entryArray, success ) ); |
|
320 HTI_LOG_FORMAT( "StoreL return value %d", err ); |
|
321 HTI_LOG_FORMAT( "Successfully stored %d entries", success ); |
|
322 uniqueId = entryArray[0]->LocalUidL(); |
|
323 } |
|
324 delete iEntryView; |
|
325 iEntryView = NULL; |
|
326 } |
|
327 entryArray.ResetAndDestroy(); |
|
328 CleanupStack::PopAndDestroy(); // entryArray |
|
329 |
|
330 if ( err == KErrNone && success > 0 ) |
|
331 { |
|
332 TBuf8<8> uniqueIdStr; |
|
333 uniqueIdStr.Copy( ( TUint8* ) ( &uniqueId ), sizeof( uniqueId ) ); |
|
334 SendOkMsgL( uniqueIdStr ); |
|
335 } |
|
336 else |
|
337 { |
|
338 if ( err == KErrNone ) err = KErrGeneral; |
|
339 SendErrorMessageL( err, KErrorVCalendarImportFailed ); |
|
340 } |
|
341 |
|
342 CleanupStack::PopAndDestroy( 2 ); // readStream, importer |
|
343 delete iCalSession; |
|
344 iCalSession = NULL; |
|
345 delete iBuffer; |
|
346 iBuffer = NULL; |
|
347 HTI_LOG_FUNC_OUT( "CPIMHandler::HandleVCalendarImportFuncL: Done" ); |
|
348 } |
|
349 |
|
350 // ---------------------------------------------------------------------------- |
|
351 void CPIMHandler::HandleContactDeleteFuncL( const TDesC8& aData ) |
|
352 { |
|
353 HTI_LOG_FUNC_IN( "CPIMHandler::HandleContactDeleteFuncL" ); |
|
354 |
|
355 TInt dataLength = aData.Length(); |
|
356 if ( dataLength != 0 && dataLength != 4 ) |
|
357 { |
|
358 HTI_LOG_TEXT( "CPIMHandler: Error: wrong length of data" ) |
|
359 SendErrorMessageL( KErrArgument, KErrorInvalidId ); |
|
360 return; |
|
361 } |
|
362 |
|
363 if ( dataLength == 4 ) |
|
364 { |
|
365 SendErrorMessageL( KErrNotSupported, KErrorIdDeleteNotSupported ); |
|
366 return; |
|
367 } |
|
368 |
|
369 if ( iContactManager == NULL ) |
|
370 { |
|
371 CVPbkContactStoreUriArray* uriArray = CVPbkContactStoreUriArray::NewLC(); |
|
372 uriArray->AppendL( TVPbkContactStoreUriPtr( |
|
373 VPbkContactStoreUris::DefaultCntDbUri() ) ); |
|
374 iContactManager = CVPbkContactManager::NewL( *uriArray ); |
|
375 CleanupStack::PopAndDestroy( uriArray ); |
|
376 } |
|
377 |
|
378 if ( iContactStore == NULL ) |
|
379 { |
|
380 MVPbkContactStoreList& stores = iContactManager->ContactStoresL(); |
|
381 iContactStore = &stores.At( 0 ); |
|
382 } |
|
383 |
|
384 iContactStore->OpenL( *this ); |
|
385 |
|
386 HTI_LOG_FUNC_OUT( "CPIMHandler::HandleContactDeleteFuncL" ); |
|
387 } |
|
388 |
|
389 // ---------------------------------------------------------------------------- |
|
390 void CPIMHandler::HandleCalendarDeleteFuncL( const TDesC8& aData ) |
|
391 { |
|
392 HTI_LOG_FUNC_IN( "CPIMHandler::HandleVCalendarDeleteFuncL" ); |
|
393 |
|
394 TInt dataLength = aData.Length(); |
|
395 if ( dataLength != 0 && dataLength != 4 ) |
|
396 { |
|
397 HTI_LOG_TEXT( "CPIMHandler: Error: wrong length of data" ) |
|
398 SendErrorMessageL( KErrArgument, KErrorInvalidId ); |
|
399 return; |
|
400 } |
|
401 |
|
402 if ( iBuffer ) // delete if exists (just to be sure) |
|
403 { |
|
404 delete iBuffer; |
|
405 iBuffer = NULL; |
|
406 } |
|
407 if ( aData.Length() > 0 ) |
|
408 { |
|
409 iBuffer = CBufFlat::NewL( aData.Length() ); |
|
410 iBuffer->ExpandL( 0, aData.Length() ); |
|
411 iBuffer->Ptr( 0 ).Copy( aData ); |
|
412 } |
|
413 |
|
414 if ( iCalSession == NULL ) |
|
415 { |
|
416 HTI_LOG_TEXT( "CPIMHandler: Creating Calendar session" ); |
|
417 iCalSession = CCalSession::NewL(); |
|
418 iCalSession->OpenL( KDefaultAgendaFile ); |
|
419 HTI_LOG_TEXT( "CPIMHandler: Calendar session open" ); |
|
420 } |
|
421 |
|
422 HTI_LOG_TEXT( "CPIMHandler: Creating entry view" ); |
|
423 iEntryView = CCalEntryView::NewL( *iCalSession, *this ); |
|
424 iWaiter->Start(); |
|
425 if ( iEntryViewErr != KErrNone ) |
|
426 { |
|
427 delete iEntryView; |
|
428 iEntryView = NULL; |
|
429 delete iCalSession; |
|
430 iCalSession = NULL; |
|
431 delete iBuffer; |
|
432 iBuffer = NULL; |
|
433 User::Leave( iEntryViewErr ); |
|
434 } |
|
435 |
|
436 // If iBuffer is NULL, no ID given, delete all calendar entries |
|
437 if ( iBuffer == NULL ) |
|
438 { |
|
439 HTI_LOG_TEXT( "CPIMHandler: Deleting all calendar entries" ); |
|
440 TCalTime minTime; |
|
441 TCalTime maxTime; |
|
442 minTime.SetTimeUtcL( TCalTime::MinTime() ); |
|
443 maxTime.SetTimeUtcL( TCalTime::MaxTime() ); |
|
444 CalCommon::TCalTimeRange timeRange( minTime, maxTime ); |
|
445 TRAPD( err, iEntryView->DeleteL( timeRange, |
|
446 CalCommon::EIncludeAll, *this ) ); |
|
447 iWaiter->Start(); |
|
448 if ( err == KErrNone && iEntryViewErr == KErrNone ) |
|
449 { |
|
450 SendOkMsgL( KNullDesC8 ); |
|
451 } |
|
452 else |
|
453 { |
|
454 SendErrorMessageL( KErrGeneral, KErrorFailedDeleteAll ); |
|
455 } |
|
456 } |
|
457 |
|
458 // If id given, delete only calendar entry having that id |
|
459 else |
|
460 { |
|
461 TPtr8 data = iBuffer->Ptr( 0 ); |
|
462 TCalLocalUid id = data[0] + ( data[1] << 8 ) |
|
463 + ( data[2] << 16 ) |
|
464 + ( data[3] << 24 ); |
|
465 HTI_LOG_FORMAT( "CPIMHandler: Deleting one calendar entry %d", id ); |
|
466 CCalEntry* entryToDelete = NULL; |
|
467 TRAPD( err, entryToDelete = iEntryView->FetchL( id ) ); |
|
468 |
|
469 if ( err || entryToDelete == NULL ) |
|
470 { |
|
471 HTI_LOG_TEXT( "CPIMHandler: Calendar entry not found" ); |
|
472 SendErrorMessageL( KErrNotFound, KErrorItemNotFound ); |
|
473 } |
|
474 else |
|
475 { |
|
476 CleanupStack::PushL( entryToDelete ); |
|
477 TRAP( err, iEntryView->DeleteL( *entryToDelete ) ); |
|
478 if ( err == KErrNone ) |
|
479 { |
|
480 SendOkMsgL( KNullDesC8 ); |
|
481 } |
|
482 else |
|
483 { |
|
484 HTI_LOG_TEXT( "CPIMHandler: Error deleting calendar entry" ) |
|
485 SendErrorMessageL( KErrGeneral, KErrorFailedDelete ); |
|
486 } |
|
487 CleanupStack::PopAndDestroy( entryToDelete ); |
|
488 } |
|
489 } |
|
490 delete iEntryView; |
|
491 iEntryView = NULL; |
|
492 delete iCalSession; |
|
493 iCalSession = NULL; |
|
494 delete iBuffer; |
|
495 iBuffer = NULL; |
|
496 HTI_LOG_FUNC_OUT( "CPIMHandler::HandleVCalendarDeleteFuncL" ); |
|
497 } |
|
498 |
|
499 // ---------------------------------------------------------------------------- |
|
500 void CPIMHandler::SendOkMsgL( const TDesC8& aData ) |
|
501 { |
|
502 HTI_LOG_FUNC_IN( "CPIMHandler::SendOkMsgL: Starting" ); |
|
503 |
|
504 User::LeaveIfNull( iDispatcher ); |
|
505 |
|
506 HBufC8* temp = HBufC8::NewL( aData.Length() + 1 ); |
|
507 TPtr8 response = temp->Des(); |
|
508 response.Append( ( TChar ) CHtiPIMServicePlugin::EResultOk ); |
|
509 response.Append( aData ); |
|
510 User::LeaveIfError( iDispatcher->DispatchOutgoingMessage( |
|
511 temp, KPIMServiceUid ) ); |
|
512 iIsBusy = EFalse; |
|
513 HTI_LOG_FUNC_OUT( "CPIMHandler::SendOkMsgL: Done" ); |
|
514 } |
|
515 |
|
516 // ---------------------------------------------------------------------------- |
|
517 void CPIMHandler::SendErrorMessageL( TInt aError, const TDesC8& aDescription ) |
|
518 { |
|
519 HTI_LOG_FUNC_IN( "CPIMHandler::SendErrorMessageL: Starting" ); |
|
520 User::LeaveIfNull( iDispatcher ); |
|
521 User::LeaveIfError( iDispatcher->DispatchOutgoingErrorMessage( |
|
522 aError, aDescription, KPIMServiceUid ) ); |
|
523 iIsBusy = EFalse; |
|
524 HTI_LOG_FUNC_OUT( "CPIMHandler::SendErrorMessageL: Done" ); |
|
525 } |
|
526 |
|
527 // ---------------------------------------------------------------------------- |
|
528 TInt CallNpdHlp( const TDesC& aCmd ) |
|
529 { |
|
530 HTI_LOG_FUNC_IN( "CallNpdHlp" ); |
|
531 |
|
532 RProcess HtiNpdHlp; |
|
533 TInt err = HtiNpdHlp.Create( KHtiNpdHlpExe, aCmd ); |
|
534 if ( err ) |
|
535 { |
|
536 HTI_LOG_FORMAT( "Could not create HtiNpdHlp.Exe process %d", err ); |
|
537 return err; |
|
538 } |
|
539 |
|
540 TRequestStatus status; |
|
541 HtiNpdHlp.Logon( status ); |
|
542 HtiNpdHlp.Resume(); |
|
543 User::WaitForRequest( status ); |
|
544 if ( status.Int() != KErrNone ) |
|
545 { |
|
546 HTI_LOG_FORMAT( "status %d", status.Int() ); |
|
547 HTI_LOG_FORMAT( "ExitReason %d", HtiNpdHlp.ExitReason() ); |
|
548 HTI_LOG_FORMAT( "ExitType %d", HtiNpdHlp.ExitType() ); |
|
549 HtiNpdHlp.Close(); |
|
550 return status.Int(); |
|
551 } |
|
552 |
|
553 HtiNpdHlp.Close(); |
|
554 |
|
555 HTI_LOG_FUNC_OUT( "CallNpdHlp" ); |
|
556 return KErrNone; |
|
557 } |
|
558 |
|
559 // ---------------------------------------------------------------------------- |
|
560 void CPIMHandler::SendNotepadOkMsgL( CHtiPIMServicePlugin::TCommand aCommand ) |
|
561 { |
|
562 HTI_LOG_FUNC_IN( "CPIMHandler::SendNotepadOkMsgL" ); |
|
563 TBuf8<1> msg; |
|
564 msg.Append( aCommand ); |
|
565 User::LeaveIfError( iDispatcher->DispatchOutgoingMessage( |
|
566 msg.AllocL(), KPIMServiceUid ) ); |
|
567 iIsBusy = EFalse; |
|
568 HTI_LOG_FUNC_OUT( "CPIMHandler::SendNotepadOkMsgL" ); |
|
569 } |
|
570 |
|
571 // ---------------------------------------------------------------------------- |
|
572 void CPIMHandler::HandleNotepadAddMemoFuncL( const TDesC8& aData ) |
|
573 { |
|
574 HTI_LOG_FUNC_IN( "CPIMHandler::HandleNotepadAddMemoFuncL" ); |
|
575 |
|
576 if ( aData.Length() < 1 ) |
|
577 { |
|
578 SendErrorMessageL( KErrArgument, KErrorMissingText ); |
|
579 return; |
|
580 } |
|
581 |
|
582 // convert text from TDesC8 -> TDesC |
|
583 // expecting the input TDesC8 contains UTF-8 data |
|
584 HBufC* text = CnvUtfConverter::ConvertToUnicodeFromUtf8L( aData ); |
|
585 HTI_LOG_TEXT( "CPIMHandler: Conversion to Unicode done" ); |
|
586 CleanupStack::PushL( text ); |
|
587 |
|
588 HBufC* cmd = HBufC::NewLC( KCmdAddMemo().Length() + 1 + ( *text ).Length() ); |
|
589 cmd->Des().Copy( KCmdAddMemo ); |
|
590 cmd->Des().Append( KCmdDelim ); |
|
591 cmd->Des().Append( *text ); |
|
592 |
|
593 TInt err = CallNpdHlp( *cmd ); |
|
594 if ( err ) |
|
595 { |
|
596 SendErrorMessageL( err, KErrorNotepadAddMemoFailed ); |
|
597 } |
|
598 else |
|
599 { |
|
600 SendNotepadOkMsgL( CHtiPIMServicePlugin::ENotepadAddMemo ); |
|
601 } |
|
602 |
|
603 CleanupStack::PopAndDestroy( 2 ); // text, cmd |
|
604 |
|
605 HTI_LOG_FUNC_OUT( "CPIMHandler::HandleNotepadAddMemoFuncL" ); |
|
606 } |
|
607 |
|
608 // ---------------------------------------------------------------------------- |
|
609 void CPIMHandler::HandleNotepadAddMemoFromFileFuncL( const TDesC8& aData ) |
|
610 { |
|
611 HTI_LOG_FUNC_IN( "CPIMHandler::HandleNotepadAddMemoFromFileFuncL" ); |
|
612 |
|
613 if ( aData.Length() < 1 ) |
|
614 { |
|
615 SendErrorMessageL( KErrArgument, KErrorMissingFilepath ); |
|
616 return; |
|
617 } |
|
618 |
|
619 // convert filename from TDesC8 -> TDesC |
|
620 // expecting the input TDesC8 contains UTF-8 data |
|
621 HBufC* filename = CnvUtfConverter::ConvertToUnicodeFromUtf8L( aData ); |
|
622 HTI_LOG_TEXT( "CPIMHandler: Conversion to Unicode done" ); |
|
623 CleanupStack::PushL( filename ); |
|
624 |
|
625 HBufC* cmd = HBufC::NewLC( KCmdAddMemoFromFile().Length() + 1 + ( *filename ).Length() ); |
|
626 cmd->Des().Copy( KCmdAddMemoFromFile ); |
|
627 cmd->Des().Append( KCmdDelim ); |
|
628 cmd->Des().Append( *filename ); |
|
629 |
|
630 TInt err = CallNpdHlp( *cmd ); |
|
631 if ( err ) |
|
632 { |
|
633 SendErrorMessageL( err, KErrorNotepadAddMemoFromFileFailed ); |
|
634 } |
|
635 else |
|
636 { |
|
637 SendNotepadOkMsgL( CHtiPIMServicePlugin::ENotepadAddMemoFromFile ); |
|
638 } |
|
639 |
|
640 CleanupStack::PopAndDestroy( 2 ); // filename, cmd |
|
641 |
|
642 HTI_LOG_FUNC_OUT( "CPIMHandler::HandleNotepadAddMemoFromFileFuncL" ); |
|
643 } |
|
644 |
|
645 // ---------------------------------------------------------------------------- |
|
646 void CPIMHandler::HandleNotepadDeleteAllFuncL() |
|
647 { |
|
648 HTI_LOG_FUNC_IN( "CPIMHandler::HandleNotepadDeleteAllFuncL" ); |
|
649 |
|
650 TInt err = CallNpdHlp( KCmdDeleteAll() ); |
|
651 if ( err ) |
|
652 { |
|
653 SendErrorMessageL( err, KErrorNotepadDeleteAllFailed ); |
|
654 } |
|
655 else |
|
656 { |
|
657 SendNotepadOkMsgL( CHtiPIMServicePlugin::ENotepadDeleteAll ); |
|
658 } |
|
659 |
|
660 HTI_LOG_FUNC_OUT( "CPIMHandler::HandleNotepadDeleteAllFuncL" ); |
|
661 } |
|
662 |
|
663 // ---------------------------------------------------------------------------- |
|
664 // CPIMHandler::CreateContactDeleteViewL |
|
665 // Creates a contact view containing the contacts to be deleted. |
|
666 // ---------------------------------------------------------------------------- |
|
667 void CPIMHandler::CreateContactDeleteViewL() |
|
668 { |
|
669 HTI_LOG_FUNC_IN( "CPIMHandler::CreateContactDeleteViewL" ); |
|
670 |
|
671 if ( iContactView ) |
|
672 { |
|
673 iContactView->RemoveObserver( *this ); |
|
674 delete iContactView; |
|
675 iContactView = NULL; |
|
676 } |
|
677 |
|
678 CVPbkContactViewDefinition* viewDef = CVPbkContactViewDefinition::NewL(); |
|
679 CleanupStack::PushL( viewDef ); |
|
680 viewDef->SetType( EVPbkContactsView ); |
|
681 viewDef->SetSharing( EVPbkLocalView ); |
|
682 viewDef->SetSortPolicy( EVPbkSortedContactView ); |
|
683 CVPbkSortOrder* sortOrder = CVPbkSortOrder::NewL( |
|
684 iContactStore->StoreProperties().SupportedFields() ); |
|
685 CleanupStack::PushL( sortOrder ); |
|
686 iContactView = iContactStore->CreateViewLC( *viewDef, *this, *sortOrder ); |
|
687 CleanupStack::Pop(); // view; |
|
688 CleanupStack::PopAndDestroy( 2 ); // sortOrder, viewDef |
|
689 |
|
690 HTI_LOG_FUNC_OUT( "CPIMHandler::CreateContactDeleteViewL" ); |
|
691 } |
|
692 |
|
693 // ---------------------------------------------------------------------------- |
|
694 // CPIMHandler::DeleteContactsInViewL |
|
695 // Deletes the contacts that are currently in iContactView. |
|
696 // ---------------------------------------------------------------------------- |
|
697 void CPIMHandler::DeleteContactsInViewL() |
|
698 { |
|
699 HTI_LOG_FUNC_IN( "CPIMHandler::DeleteContactsInViewL" ); |
|
700 |
|
701 TInt cntCount( iContactView->ContactCountL() ); |
|
702 HTI_LOG_FORMAT( "Contact count in view = %d", cntCount ); |
|
703 if ( cntCount > 0 ) |
|
704 { |
|
705 CVPbkContactLinkArray* contactLinks = CVPbkContactLinkArray::NewLC(); |
|
706 for ( TInt i = 0; i < cntCount; ++i ) |
|
707 { |
|
708 MVPbkContactLink* link = |
|
709 iContactView->ContactAtL( i ).CreateLinkLC(); |
|
710 contactLinks->AppendL( link ); |
|
711 CleanupStack::Pop(); // link |
|
712 } |
|
713 // Following DeleteContactsL will result in calls to StepComplete |
|
714 // and finally OperationComplete (StepFailed if error occurs) |
|
715 iOp = iContactManager->DeleteContactsL( *contactLinks, *this ); |
|
716 CleanupStack::PopAndDestroy(); // contactLinks |
|
717 } |
|
718 else |
|
719 { |
|
720 // Nothing to delete |
|
721 iContactStore->Close( *this ); |
|
722 SendOkMsgL( KNullDesC8 ); |
|
723 } |
|
724 |
|
725 // We don't need the view anymore |
|
726 HTI_LOG_TEXT( "Deleting the contact view" ); |
|
727 iContactView->RemoveObserver( *this ); |
|
728 delete iContactView; |
|
729 iContactView = NULL; |
|
730 |
|
731 HTI_LOG_FUNC_OUT( "CPIMHandler::DeleteContactsInViewL" ); |
|
732 } |
|
733 |
|
734 // ---------------------------------------------------------------------------- |
|
735 // CPIMHandler::StoreReady |
|
736 // Called when a contact store is ready to use. |
|
737 // From MVPbkContactStoreObserver |
|
738 // ---------------------------------------------------------------------------- |
|
739 void CPIMHandler::StoreReady( MVPbkContactStore& aContactStore ) |
|
740 { |
|
741 HTI_LOG_FUNC_IN( "CPIMHandler::StoreReady" ); |
|
742 if ( iIsBusy && iContactStore == &aContactStore ) |
|
743 { |
|
744 if ( iCommand == CHtiPIMServicePlugin::EImportVCard ) |
|
745 { |
|
746 iReadStream.Open( *iBuffer, 0 ); |
|
747 HTI_LOG_TEXT( "Starting vCard import" ); |
|
748 TRAPD( err, iOp = iVCardEngine->ImportVCardL( |
|
749 *iContactStore, iReadStream, *this ) ); |
|
750 HTI_LOG_FORMAT( "ImpoortVCardL returned %d", err ); |
|
751 if ( err != KErrNone ) |
|
752 { |
|
753 delete iOp; |
|
754 iOp = NULL; |
|
755 iReadStream.Close(); |
|
756 delete iBuffer; |
|
757 iBuffer = NULL; |
|
758 iContactStore->Close( *this ); |
|
759 TRAP_IGNORE( SendErrorMessageL( err, KErrorVCardImportFailed ) ); |
|
760 } |
|
761 } |
|
762 else if ( iCommand == CHtiPIMServicePlugin::EDeleteContact ) |
|
763 { |
|
764 TRAPD( err, CreateContactDeleteViewL() ); |
|
765 if ( err != KErrNone ) |
|
766 { |
|
767 iContactStore->Close( *this ); |
|
768 TRAP_IGNORE( SendErrorMessageL( err, KErrorFailedDelete ) ); |
|
769 } |
|
770 } |
|
771 } |
|
772 HTI_LOG_FUNC_OUT( "CPIMHandler::StoreReady" ); |
|
773 } |
|
774 |
|
775 // ---------------------------------------------------------------------------- |
|
776 // CPIMHandler::StoreUnavailable |
|
777 // Called when a contact store becomes unavailable. |
|
778 // From MVPbkContactStoreObserver |
|
779 // ---------------------------------------------------------------------------- |
|
780 void CPIMHandler::StoreUnavailable( MVPbkContactStore& aContactStore, |
|
781 TInt aReason ) |
|
782 { |
|
783 HTI_LOG_FUNC_IN( "CPIMHandler::StoreUnavailable" ); |
|
784 |
|
785 if ( iIsBusy && iContactStore == &aContactStore ) |
|
786 { |
|
787 delete iBuffer; |
|
788 iBuffer = NULL; |
|
789 TRAP_IGNORE( SendErrorMessageL( aReason, KErrorVCardImportFailed ) ); |
|
790 } |
|
791 |
|
792 HTI_LOG_FUNC_OUT( "CPIMHandler::StoreUnavailable" ); |
|
793 } |
|
794 |
|
795 // ---------------------------------------------------------------------------- |
|
796 // CPIMHandler::HandleStoreEventL |
|
797 // Called when changes occur in the contact store. |
|
798 // From MVPbkContactStoreObserver |
|
799 // ---------------------------------------------------------------------------- |
|
800 void CPIMHandler::HandleStoreEventL( MVPbkContactStore& /*aContactStore*/, |
|
801 TVPbkContactStoreEvent /*aStoreEvent*/ ) |
|
802 { |
|
803 HTI_LOG_FUNC_IN( "CPIMHandler::HandleStoreEventL" ); |
|
804 HTI_LOG_FUNC_OUT( "CPIMHandler::HandleStoreEventL" ); |
|
805 } |
|
806 |
|
807 // ---------------------------------------------------------------------------- |
|
808 // CPIMHandler::ContactsSaved |
|
809 // Called when the contact has been successfully commited or copied. |
|
810 // From MVPbkContactCopyObserver |
|
811 // ---------------------------------------------------------------------------- |
|
812 void CPIMHandler::ContactsSaved( MVPbkContactOperationBase& aOperation, |
|
813 MVPbkContactLinkArray* aResults ) |
|
814 { |
|
815 HTI_LOG_FUNC_IN( "CPIMHandler::ContactsSaved" ); |
|
816 |
|
817 if ( iIsBusy && iOp == &aOperation ) |
|
818 { |
|
819 TInt count = aResults->Count(); |
|
820 HTI_LOG_FORMAT( "%d contact(s) added", count ); |
|
821 delete aResults; |
|
822 delete iOp; |
|
823 iOp = NULL; |
|
824 iReadStream.Close(); |
|
825 delete iBuffer; |
|
826 iBuffer = NULL; |
|
827 iContactStore->Close( *this ); |
|
828 TInt entryId = 0; // We can't get the ID, just send zero |
|
829 TBuf8<4> idBuf; |
|
830 idBuf.Append( ( TUint8* ) &entryId, 4 ); |
|
831 TRAP_IGNORE( SendOkMsgL( idBuf ) ); |
|
832 } |
|
833 |
|
834 HTI_LOG_FUNC_OUT( "CPIMHandler::ContactsSaved" ); |
|
835 } |
|
836 |
|
837 // ---------------------------------------------------------------------------- |
|
838 // CPIMHandler::ContactsSavingFailed |
|
839 // Called when there was en error while saving contact(s). |
|
840 // From MVPbkContactCopyObserver |
|
841 // ---------------------------------------------------------------------------- |
|
842 void CPIMHandler::ContactsSavingFailed( |
|
843 MVPbkContactOperationBase& aOperation, TInt aError ) |
|
844 { |
|
845 HTI_LOG_FUNC_IN( "CPIMHandler::ContactsSavingFailed" ); |
|
846 |
|
847 if ( iIsBusy && iOp == &aOperation ) |
|
848 { |
|
849 delete iOp; |
|
850 iOp = NULL; |
|
851 iReadStream.Close(); |
|
852 delete iBuffer; |
|
853 iBuffer = NULL; |
|
854 iContactStore->Close( *this ); |
|
855 TRAP_IGNORE( SendErrorMessageL( aError, KErrorVCardImportFailed ) ); |
|
856 } |
|
857 |
|
858 HTI_LOG_FUNC_OUT( "CPIMHandler::ContactsSavingFailed" ); |
|
859 } |
|
860 |
|
861 // ---------------------------------------------------------------------------- |
|
862 // CPIMHandler::ContactViewReady |
|
863 // Called when a view is ready for use. |
|
864 // From MVPbkContactViewObserver |
|
865 // ---------------------------------------------------------------------------- |
|
866 void CPIMHandler::ContactViewReady( MVPbkContactViewBase& aView ) |
|
867 { |
|
868 HTI_LOG_FUNC_IN( "CPIMHandler::ContactViewReady" ); |
|
869 |
|
870 if ( iContactView == &aView && iIsBusy && |
|
871 iCommand == CHtiPIMServicePlugin::EDeleteContact ) |
|
872 { |
|
873 TRAPD( err, DeleteContactsInViewL() ); |
|
874 if ( err != KErrNone ) |
|
875 { |
|
876 TRAP_IGNORE( SendErrorMessageL( err, KErrorFailedDelete ) ); |
|
877 } |
|
878 } |
|
879 |
|
880 HTI_LOG_FUNC_OUT( "CPIMHandler::ContactViewReady" ); |
|
881 } |
|
882 |
|
883 // ---------------------------------------------------------------------------- |
|
884 // CHtiSimDirHandlerVPbk::ContactViewUnavailable |
|
885 // Called when a view is unavailable for a while. |
|
886 // From MVPbkContactViewObserver |
|
887 // ---------------------------------------------------------------------------- |
|
888 void CPIMHandler::ContactViewUnavailable( MVPbkContactViewBase& /*aView*/ ) |
|
889 { |
|
890 HTI_LOG_FUNC_IN( "CPIMHandler::ContactViewUnavailable" ); |
|
891 HTI_LOG_FUNC_OUT( "CPIMHandler::ContactViewUnavailable" ); |
|
892 } |
|
893 |
|
894 // ---------------------------------------------------------------------------- |
|
895 // CPIMHandler::ContactAddedToView |
|
896 // Called when a contact has been added to the view. |
|
897 // From MVPbkContactViewObserver |
|
898 // ---------------------------------------------------------------------------- |
|
899 void CPIMHandler::ContactAddedToView( MVPbkContactViewBase& /*aView*/, |
|
900 TInt /*aIndex*/, const MVPbkContactLink& /*aContactLink*/ ) |
|
901 { |
|
902 HTI_LOG_FUNC_IN( "CPIMHandler::ContactAddedToView" ); |
|
903 HTI_LOG_FUNC_OUT( "CPIMHandler::ContactAddedToView" ); |
|
904 } |
|
905 |
|
906 // ---------------------------------------------------------------------------- |
|
907 // CPIMHandler::ContactRemovedFromView |
|
908 // Called when a contact has been removed from a view. |
|
909 // From MVPbkContactViewObserver |
|
910 // ---------------------------------------------------------------------------- |
|
911 void CPIMHandler::ContactRemovedFromView( MVPbkContactViewBase& /*aView*/, |
|
912 TInt /*aIndex*/, const MVPbkContactLink& /*aContactLink*/ ) |
|
913 { |
|
914 HTI_LOG_FUNC_IN( "CPIMHandler::ContactRemovedFromView" ); |
|
915 HTI_LOG_FUNC_OUT( "CPIMHandler::ContactRemovedFromView" ); |
|
916 } |
|
917 |
|
918 // ---------------------------------------------------------------------------- |
|
919 // CPIMHandler::ContactViewError |
|
920 // Called when an error occurs in the view. |
|
921 // From MVPbkContactViewObserver |
|
922 // ---------------------------------------------------------------------------- |
|
923 void CPIMHandler::ContactViewError( MVPbkContactViewBase& aView, |
|
924 TInt aError, TBool aErrorNotified ) |
|
925 { |
|
926 HTI_LOG_FUNC_IN( "CPIMHandler::ContactViewError" ); |
|
927 HTI_LOG_FORMAT( "CPIMHandler::ContactViewError: %d", aError ); |
|
928 HTI_LOG_FORMAT( "ErrorNotified = %d", aErrorNotified ); |
|
929 if ( iContactView == &aView ) |
|
930 { |
|
931 iContactView->RemoveObserver( *this ); |
|
932 delete iContactView; |
|
933 iContactView = NULL; |
|
934 if ( iIsBusy && iCommand == CHtiPIMServicePlugin::EDeleteContact ) |
|
935 { |
|
936 SendErrorMessageL( aError, KErrorFailedDelete ); |
|
937 } |
|
938 iContactStore->Close( *this ); |
|
939 } |
|
940 aErrorNotified = aErrorNotified; // avoid compiler warning |
|
941 HTI_LOG_FUNC_OUT( "CPIMHandler::ContactViewError" ); |
|
942 } |
|
943 |
|
944 // ---------------------------------------------------------------------------- |
|
945 // CPIMHandler::StepComplete |
|
946 // Called when one step of the batch operation is complete. |
|
947 // From MVPbkBatchOperationObserver |
|
948 // ---------------------------------------------------------------------------- |
|
949 void CPIMHandler::StepComplete( MVPbkContactOperationBase& /*aOperation*/, |
|
950 TInt /*aStepSize*/ ) |
|
951 { |
|
952 HTI_LOG_FUNC_IN( "CPIMHandler::StepComplete" ); |
|
953 HTI_LOG_FUNC_OUT( "CPIMHandler::StepComplete" ); |
|
954 } |
|
955 |
|
956 // ---------------------------------------------------------------------------- |
|
957 // CPIMHandler::StepFailed |
|
958 // Called when one step of the batch operation fails. |
|
959 // From MVPbkBatchOperationObserver |
|
960 // ---------------------------------------------------------------------------- |
|
961 TBool CPIMHandler::StepFailed( MVPbkContactOperationBase& aOperation, |
|
962 TInt /*aStepSize*/, TInt aError ) |
|
963 { |
|
964 HTI_LOG_FUNC_IN( "CPIMHandler::StepFailed" ); |
|
965 HTI_LOG_FORMAT( "Error %d", aError ); |
|
966 if ( iOp == &aOperation ) |
|
967 { |
|
968 // We are returning EFalse (= do not continue) we can delete |
|
969 // the operation. OperationComplete() won't be called. |
|
970 delete iOp; |
|
971 iOp = NULL; |
|
972 iContactStore->Close( *this ); |
|
973 TRAP_IGNORE( SendErrorMessageL( aError, KErrorFailedDelete ) ); |
|
974 } |
|
975 HTI_LOG_FUNC_OUT( "CPIMHandler::StepFailed" ); |
|
976 return EFalse; // do not continue |
|
977 } |
|
978 |
|
979 // ---------------------------------------------------------------------------- |
|
980 // CPIMHandler::OperationComplete |
|
981 // Called when operation is completed. |
|
982 // From MVPbkBatchOperationObserver |
|
983 // ---------------------------------------------------------------------------- |
|
984 void CPIMHandler::OperationComplete( |
|
985 MVPbkContactOperationBase& aOperation ) |
|
986 { |
|
987 HTI_LOG_FUNC_IN( "CPIMHandler::OperationComplete" ); |
|
988 // Operation is complete -> delete it |
|
989 if ( iOp == &aOperation ) |
|
990 { |
|
991 delete iOp; |
|
992 iOp = NULL; |
|
993 iContactStore->Close( *this ); |
|
994 if ( iIsBusy && iCommand == CHtiPIMServicePlugin::EDeleteContact ) |
|
995 { |
|
996 // Delete operation has completed |
|
997 TRAP_IGNORE( SendOkMsgL( KNullDesC8 ) ); |
|
998 } |
|
999 } |
|
1000 HTI_LOG_FUNC_OUT( "CPIMHandler::OperationComplete" ); |
|
1001 } |
|
1002 |
|
1003 |
|
1004 // ---------------------------------------------------------------------------- |
|
1005 // CPIMHandler::Progress |
|
1006 // Called during calendar entry view creation and operations. |
|
1007 // Called only if NotifyProgress returns ETrue. |
|
1008 // From MCalProgressCallBack |
|
1009 // ---------------------------------------------------------------------------- |
|
1010 void CPIMHandler::Progress( TInt /*aProgress*/ ) |
|
1011 { |
|
1012 } |
|
1013 |
|
1014 // ---------------------------------------------------------------------------- |
|
1015 // CPIMHandler::Completed |
|
1016 // Called on completion of calendar entry view creation and operations |
|
1017 // From MCalProgressCallBack |
|
1018 // ---------------------------------------------------------------------------- |
|
1019 void CPIMHandler::Completed( TInt aError ) |
|
1020 { |
|
1021 HTI_LOG_FUNC_IN( "CPIMHandler::Completed" ); |
|
1022 HTI_LOG_FORMAT( "Completed with error code %d", aError ); |
|
1023 iEntryViewErr = aError; |
|
1024 iWaiter->AsyncStop(); |
|
1025 HTI_LOG_FUNC_OUT( "CPIMHandler::Completed" ); |
|
1026 } |
|
1027 |
|
1028 // ---------------------------------------------------------------------------- |
|
1029 // CPIMHandler::NotifyProgress |
|
1030 // Returns whether or not progress notification is required |
|
1031 // From MCalProgressCallBack |
|
1032 // ---------------------------------------------------------------------------- |
|
1033 TBool CPIMHandler::NotifyProgress() |
|
1034 { |
|
1035 HTI_LOG_FUNC_IN( "CPIMHandler::NotifyProgress" ); |
|
1036 HTI_LOG_FUNC_OUT( "CPIMHandler::NotifyProgress" ); |
|
1037 return EFalse; // Don't notify about progress |
|
1038 } |