23 #include <ccsclientconversation.h> |
23 #include <ccsclientconversation.h> |
24 #include <ccsconversationentry.h> |
24 #include <ccsconversationentry.h> |
25 #include <ccsdefs.h> |
25 #include <ccsdefs.h> |
26 #include <telconfigcrkeys.h> // KCRUidTelephonyConfiguration |
26 #include <telconfigcrkeys.h> // KCRUidTelephonyConfiguration |
27 #include <centralrepository.h> |
27 #include <centralrepository.h> |
28 |
28 #include <xqconversions.h> |
29 // USER INCLUDE FILES |
29 // USER INCLUDE FILES |
30 #include "ccsconversationcache.h" |
30 #include "ccsconversationcache.h" |
31 #include "ccsconversationcachehelper.h" |
31 #include "ccsconversationcachehelper.h" |
32 #include "ccsconversationcontact.h" |
32 #include "ccsconversationcontact.h" |
33 #include "ccsconversation.h" |
33 #include "ccsconversation.h" |
34 #include "ccscontactsmanager.h" |
34 #include "ccscontactsmanager.h" |
35 #include "ccscontactsresolver.h" |
35 #include "ccscontactsresolver.h" |
36 #include "ccsconversationevent.h" |
36 #include "ccsconversationevent.h" |
37 #include "ccsserver.h" |
37 #include "ccsserver.h" |
38 #include "s60qconversions.h" |
|
39 #include "ccsdebug.h" |
38 #include "ccsdebug.h" |
40 |
39 |
41 // ============================== MEMBER FUNCTIONS ============================ |
40 // ============================== MEMBER FUNCTIONS ============================ |
42 |
41 |
43 // ---------------------------------------------------------------------------- |
42 // ---------------------------------------------------------------------------- |
404 convEntry); |
403 convEntry); |
405 NotifyL(clientConv, KConversationListEventDelete); |
404 NotifyL(clientConv, KConversationListEventDelete); |
406 CleanupStack::PopAndDestroy(clientConv); |
405 CleanupStack::PopAndDestroy(clientConv); |
407 } |
406 } |
408 |
407 |
|
408 // send all CV entry delete events, required in case CV is open |
|
409 // Notify client of conversation change |
|
410 TInt totalEntryCount = conversation->GetEntryCount(); |
|
411 for (TInt entryCounter = totalEntryCount - 1; entryCounter >= 0; |
|
412 entryCounter--) |
|
413 { |
|
414 CCsConversationEntry* entryInConversation = |
|
415 conversation->GetEntryL(entryCounter); |
|
416 CCsClientConversation * clientConv = |
|
417 CreateClientConvLC(conversation, entryInConversation); |
|
418 NotifyL(clientConv, KConversationEventDelete); |
|
419 CleanupStack::PopAndDestroy(clientConv); |
|
420 } |
|
421 |
409 iConversationList->Remove(aIndex); |
422 iConversationList->Remove(aIndex); |
410 entryList.ResetAndDestroy(); |
423 entryList.ResetAndDestroy(); |
411 |
424 |
412 delete conversation; |
425 delete conversation; |
413 } |
426 } |
435 |
448 |
436 // ---------------------------------------------------------------------------- |
449 // ---------------------------------------------------------------------------- |
437 // CCsConversationCache::MarkConversationAsDeleted |
450 // CCsConversationCache::MarkConversationAsDeleted |
438 // ---------------------------------------------------------------------------- |
451 // ---------------------------------------------------------------------------- |
439 void CCsConversationCache::MarkConversationAsDeleted(TInt aConversationId, |
452 void CCsConversationCache::MarkConversationAsDeleted(TInt aConversationId, |
440 TBool aDeleted) |
453 TBool aDeleted, TInt aCount) |
441 { |
454 { |
442 TInt conversationCount = iConversationList->Count(); |
455 TInt conversationCount = iConversationList->Count(); |
443 |
456 |
444 for (TInt loop = 0; loop < conversationCount; loop++) |
457 for (TInt loop = 0; loop < conversationCount; loop++) |
445 { |
458 { |
448 TInt id = conversation->GetConversationId(); |
461 TInt id = conversation->GetConversationId(); |
449 |
462 |
450 if (id == aConversationId) |
463 if (id == aConversationId) |
451 { |
464 { |
452 conversation->MarkDeleted(aDeleted); |
465 conversation->MarkDeleted(aDeleted); |
|
466 if( aCount ) |
|
467 { |
|
468 CCsClientConversation* clientConversation = |
|
469 CreateClientConvLC(conversation, |
|
470 conversation->GetLatestEntryL()); |
|
471 NotifyL(clientConversation, KConversationListEventPartialDelete); |
|
472 CleanupStack::PopAndDestroy();// clientConversation |
|
473 } |
453 break; |
474 break; |
454 } |
475 } |
455 } |
476 } |
456 } |
477 } |
457 |
478 |
511 |
532 |
512 for (int i = 0; i < totalPhoneNumber; i++) |
533 for (int i = 0; i < totalPhoneNumber; i++) |
513 { |
534 { |
514 QString phoneNumber = phoneNumberList.at(i); |
535 QString phoneNumber = phoneNumberList.at(i); |
515 HBufC* phoneNumber_s60 = |
536 HBufC* phoneNumber_s60 = |
516 S60QConversions::qStringToS60Desc(phoneNumber); |
537 XQConversions::qStringToS60Desc(phoneNumber); |
517 TInt cIndex = FindConversation(*phoneNumber_s60); |
538 TInt cIndex = FindConversation(*phoneNumber_s60); |
518 if (cIndex != KErrNotFound) |
539 if (cIndex != KErrNotFound) |
519 { |
540 { |
520 if (conversationIndex.Find(cIndex) == KErrNotFound) |
541 if (conversationIndex.Find(cIndex) == KErrNotFound) |
521 { |
542 { |
551 RArray<TInt> conversationIndex; |
572 RArray<TInt> conversationIndex; |
552 for (int i=0; i < countNumberList ; i++) |
573 for (int i=0; i < countNumberList ; i++) |
553 { |
574 { |
554 QString phoneNumber = phoneNumberList.at(i); |
575 QString phoneNumber = phoneNumberList.at(i); |
555 HBufC* phoneNumber_s60 = |
576 HBufC* phoneNumber_s60 = |
556 S60QConversions::qStringToS60Desc(phoneNumber); |
577 XQConversions::qStringToS60Desc(phoneNumber); |
557 |
578 |
558 TInt cIndex = FindConversation(*phoneNumber_s60); |
579 TInt cIndex = FindConversation(*phoneNumber_s60); |
559 if ( cIndex != KErrNotFound ) |
580 if ( cIndex != KErrNotFound ) |
560 { |
581 { |
561 conversationIndex.InsertInOrder(cIndex); |
582 conversationIndex.InsertInOrder(cIndex); |
638 } |
659 } |
639 return -1; |
660 return -1; |
640 } |
661 } |
641 |
662 |
642 // ---------------------------------------------------------------------------- |
663 // ---------------------------------------------------------------------------- |
|
664 // CCsConversationCache::GetConversationFromConversationId |
|
665 // ---------------------------------------------------------------------------- |
|
666 CCsClientConversation* CCsConversationCache::GetConversationFromConversationIdL(TInt aConversationId) |
|
667 { |
|
668 |
|
669 CCsClientConversation* clientConv = NULL; |
|
670 |
|
671 for ( TInt loop = 0; loop < iConversationList->Count(); ++loop ) |
|
672 { |
|
673 CCsConversation* conversation = |
|
674 static_cast<CCsConversation*>((*iConversationList)[loop]); |
|
675 |
|
676 if (aConversationId == conversation->GetConversationId()) |
|
677 { |
|
678 clientConv = CreateClientConvLC(conversation, conversation->GetLatestEntryL()); |
|
679 CleanupStack::Pop(); |
|
680 break; |
|
681 } |
|
682 } |
|
683 return clientConv; |
|
684 } |
|
685 |
|
686 // ---------------------------------------------------------------------------- |
643 // CCsConversationCache::GetConversationFromMessageIdL |
687 // CCsConversationCache::GetConversationFromMessageIdL |
644 // --------------------------------------------------------------------------- |
688 // --------------------------------------------------------------------------- |
645 CCsClientConversation* CCsConversationCache::GetConversationFromMessageIdL(TInt aMessageId) |
689 CCsClientConversation* CCsConversationCache::GetConversationFromMessageIdL(TInt aMessageId) |
646 { |
690 { |
647 TInt conversationCount = iConversationList->Count(); |
691 TInt conversationCount = iConversationList->Count(); |