37 |
37 |
38 // ---------------------------------------------------------------------------- |
38 // ---------------------------------------------------------------------------- |
39 // Constructor |
39 // Constructor |
40 // ---------------------------------------------------------------------------- |
40 // ---------------------------------------------------------------------------- |
41 CCsConversationDeleteHandler::CCsConversationDeleteHandler(): |
41 CCsConversationDeleteHandler::CCsConversationDeleteHandler(): |
42 CActive(CActive::EPriorityLow) |
42 CActive(CActive::EPriorityLow), |
|
43 iState(EIdle), |
|
44 iConversationEntryList(NULL) |
43 { |
45 { |
44 CActiveScheduler::Add( this ); |
46 CActiveScheduler::Add( this ); |
45 } |
47 } |
46 |
48 |
47 // ---------------------------------------------------------------------------- |
49 // ---------------------------------------------------------------------------- |
48 // Constructor |
50 // Constructor |
49 // ---------------------------------------------------------------------------- |
51 // ---------------------------------------------------------------------------- |
50 void CCsConversationDeleteHandler::ConstructL(CCsConversationCache* aCache) |
52 void CCsConversationDeleteHandler::ConstructL(CCsConversationCache* aCache) |
51 { |
53 { |
52 iCache = aCache; |
54 iCache = aCache; |
53 iState = EIdle; |
|
54 |
|
55 iConversationEntryList = new (ELeave)RPointerArray<CCsConversationEntry> (); |
|
56 iSession = CMsvSession::OpenSyncL(*this); |
55 iSession = CMsvSession::OpenSyncL(*this); |
57 } |
56 } |
58 |
57 |
59 // ---------------------------------------------------------------------------- |
58 // ---------------------------------------------------------------------------- |
60 // Destructor |
59 // Destructor |
61 // ---------------------------------------------------------------------------- |
60 // ---------------------------------------------------------------------------- |
62 CCsConversationDeleteHandler::~CCsConversationDeleteHandler() |
61 CCsConversationDeleteHandler::~CCsConversationDeleteHandler() |
63 { |
62 { |
|
63 // Make sure Aync request cancel. |
|
64 Cancel(); |
|
65 |
|
66 if(iSession) |
|
67 { |
|
68 delete iSession; |
|
69 iSession = NULL; |
|
70 } |
|
71 |
64 if (iConversationEntryList) |
72 if (iConversationEntryList) |
65 { |
73 { |
66 iConversationEntryList->ResetAndDestroy(); |
74 iConversationEntryList->ResetAndDestroy(); |
67 iConversationEntryList->Close(); |
75 iConversationEntryList->Close(); |
68 delete iConversationEntryList; |
76 delete iConversationEntryList; |
69 iConversationEntryList = NULL; |
77 iConversationEntryList = NULL; |
70 } |
78 } |
71 |
79 } |
72 if (iSession) |
|
73 { |
|
74 delete iSession; |
|
75 iSession = NULL; |
|
76 } |
|
77 } |
|
78 |
80 |
79 // ---------------------------------------------------------------------------- |
81 // ---------------------------------------------------------------------------- |
80 // Delete set of messages |
82 // Delete set of messages |
81 // ---------------------------------------------------------------------------- |
83 // ---------------------------------------------------------------------------- |
82 void CCsConversationDeleteHandler::DeleteL(TInt aConversationId) |
84 void CCsConversationDeleteHandler::DeleteL(TInt aConversationId) |
94 |
96 |
95 // Temp client conversation object |
97 // Temp client conversation object |
96 CCsClientConversation* clientConversation = CCsClientConversation::NewL(); |
98 CCsClientConversation* clientConversation = CCsClientConversation::NewL(); |
97 clientConversation->SetConversationEntryId(iConversationId); |
99 clientConversation->SetConversationEntryId(iConversationId); |
98 CleanupStack::PushL(clientConversation); |
100 CleanupStack::PushL(clientConversation); |
99 |
101 |
|
102 // Create entry list |
|
103 iConversationEntryList = new (ELeave)RPointerArray<CCsConversationEntry> (); |
|
104 |
100 // Get conversationlist for given client conversation |
105 // Get conversationlist for given client conversation |
101 iCache->GetConversationsL (clientConversation, iConversationEntryList); |
106 iCache->GetConversationsL (clientConversation, iConversationEntryList); |
102 iCache->MarkConversationAsDeleted(iConversationId, ETrue); |
107 iCache->MarkConversationAsDeleted(iConversationId, ETrue); |
103 |
108 |
104 iDeletedCount = 0; |
109 iDeletedCount = 0; |
|
110 iSendStateMsgs = 0; |
105 |
111 |
106 // Cleanup |
112 // Cleanup |
107 CleanupStack::PopAndDestroy(clientConversation); |
113 CleanupStack::PopAndDestroy(clientConversation); |
108 |
114 |
109 iState = EDeleteStart; |
115 iState = EDeleteStart; |