544 case ECancelling: |
545 case ECancelling: |
545 { |
546 { |
546 ProcessDone( KErrCancel ); |
547 ProcessDone( KErrCancel ); |
547 break; |
548 break; |
548 } |
549 } |
|
550 case EReleaseResource: |
|
551 { |
|
552 CPbk2AttachmentFileArray& fileArray = iConverter->AttachmentFileArray(); |
|
553 TInt count = fileArray.Count(); |
|
554 TInt deleteIndex = count -1; |
|
555 CPbk2AttachmentFile * file = fileArray.At(deleteIndex); |
|
556 fileArray.Delete(deleteIndex); |
|
557 delete file; |
|
558 |
|
559 if ( count > 1) |
|
560 { |
|
561 IssueRequest(); |
|
562 } |
|
563 else |
|
564 { |
|
565 iWaiter->AsyncStop(); |
|
566 } |
|
567 break; |
|
568 } |
549 } |
569 } |
550 } |
570 } |
551 |
571 |
552 // -------------------------------------------------------------------------- |
572 // -------------------------------------------------------------------------- |
553 // CPbk2SendContactCmd::RunError |
573 // CPbk2SendContactCmd::RunError |
554 // -------------------------------------------------------------------------- |
574 // -------------------------------------------------------------------------- |
555 // |
575 // |
556 TInt CPbk2SendContactCmd::RunError(TInt aError) |
576 TInt CPbk2SendContactCmd::RunError(TInt aError) |
557 { |
577 { |
|
578 if( iWaiter && iWaiter->IsStarted() ) |
|
579 iWaiter->AsyncStop(); |
|
580 |
558 return FilterErrors(aError); |
581 return FilterErrors(aError); |
559 } |
582 } |
560 |
583 |
561 // -------------------------------------------------------------------------- |
584 // -------------------------------------------------------------------------- |
562 // CPbk2SendContactCmd::DoCancel |
585 // CPbk2SendContactCmd::DoCancel |
563 // -------------------------------------------------------------------------- |
586 // -------------------------------------------------------------------------- |
564 // |
587 // |
565 void CPbk2SendContactCmd::DoCancel() |
588 void CPbk2SendContactCmd::DoCancel() |
566 { |
589 { |
|
590 if( iWaiter && iWaiter->IsStarted() ) |
|
591 iWaiter->AsyncStop(); |
|
592 |
567 delete iRetrieveOperation; |
593 delete iRetrieveOperation; |
568 iRetrieveOperation = NULL; |
594 iRetrieveOperation = NULL; |
569 } |
595 } |
570 |
596 |
571 // -------------------------------------------------------------------------- |
597 // -------------------------------------------------------------------------- |
1257 result = ETrue; |
1283 result = ETrue; |
1258 } |
1284 } |
1259 return result; |
1285 return result; |
1260 } |
1286 } |
1261 |
1287 |
|
1288 // -------------------------------------------------------------------------- |
|
1289 // CPbk2SendContactCmd::CommandExtension |
|
1290 // -------------------------------------------------------------------------- |
|
1291 // |
|
1292 TAny* CPbk2SendContactCmd::CommandExtension(TUid aExtensionUid ) |
|
1293 { |
|
1294 if( aExtensionUid == TUid::Uid(MPbk2ResourceReleaseUID) ) |
|
1295 { |
|
1296 return static_cast<MPbk2ResourceRelease *>(this); |
|
1297 } |
|
1298 else |
|
1299 { |
|
1300 return NULL; |
|
1301 } |
|
1302 } |
|
1303 |
|
1304 // -------------------------------------------------------------------------- |
|
1305 // CPbk2SendContactCmd::ReleaseResource |
|
1306 // -------------------------------------------------------------------------- |
|
1307 // |
|
1308 void CPbk2SendContactCmd::ReleaseResource() |
|
1309 { |
|
1310 Cancel(); |
|
1311 if (iConverter) |
|
1312 { |
|
1313 iConverter->Cancel(); |
|
1314 CPbk2AttachmentFileArray& fileArray = iConverter->AttachmentFileArray(); |
|
1315 if (fileArray.Count() > 0) |
|
1316 { |
|
1317 if ( !iWaiter ) |
|
1318 { |
|
1319 TInt err( KErrNone ); |
|
1320 TRAP( err,iWaiter = new (ELeave) CActiveSchedulerWait()); |
|
1321 if ( err != KErrNone ) |
|
1322 { |
|
1323 fileArray.ResetAndDestroy(); |
|
1324 return; |
|
1325 } |
|
1326 } |
|
1327 |
|
1328 iState = EReleaseResource; |
|
1329 IssueRequest(); |
|
1330 iWaiter->Start(); |
|
1331 } |
|
1332 } |
|
1333 } |
|
1334 |
1262 // End of File |
1335 // End of File |