|
1 /* |
|
2 * Copyright (c) 2008 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CONVERSATIONS_ENGINE_PRIVATE_H |
|
20 #define CONVERSATIONS_ENGINE_PRIVATE_H |
|
21 |
|
22 // SYSTEM INCLUDES |
|
23 #include <ccsrequesthandler.h> |
|
24 #include <mcsresultsobserver.h> |
|
25 #include <msvstd.h> |
|
26 // USER INCLUDES |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class CCsClientConversation; |
|
30 class ConversationsSummaryModel; |
|
31 class ConversationsModel; |
|
32 class ConversationMsgStoreHandler; |
|
33 class ConversationsChangeHandler; |
|
34 class ConversationsListChangeHandler; |
|
35 |
|
36 /** |
|
37 * This Class reads the initial conversation list and conversations. |
|
38 * |
|
39 * @code |
|
40 * |
|
41 * @endcode |
|
42 * @since S60 v10.1 |
|
43 */ |
|
44 class ConversationsEnginePrivate :public CBase, public MCsResultsObserver |
|
45 { |
|
46 |
|
47 public: |
|
48 |
|
49 /** |
|
50 * Default constructor. |
|
51 */ |
|
52 explicit ConversationsEnginePrivate( |
|
53 ConversationMsgStoreHandler* conversationMsgStoreHandler, |
|
54 ConversationsSummaryModel* conversationsSummaryModel, |
|
55 ConversationsModel* conversationsModel |
|
56 ); |
|
57 |
|
58 /** |
|
59 * Destructor. |
|
60 */ |
|
61 virtual ~ConversationsEnginePrivate(); |
|
62 |
|
63 /** |
|
64 * Adds ConversationListChange Observer |
|
65 */ |
|
66 void registerForConversationListUpdatesL(); |
|
67 |
|
68 /** |
|
69 * getConversationsL |
|
70 * Initiates a call to conversation server to get all the |
|
71 * conversations for a conversation entry. |
|
72 * |
|
73 * @param aConversationId |
|
74 */ |
|
75 void getConversationsL( TInt aConversationId); |
|
76 |
|
77 /** |
|
78 * Delete all conversations. |
|
79 * @param conversationId, conversationId |
|
80 */ |
|
81 void deleteConversationL(TInt aConversationId); |
|
82 |
|
83 /** |
|
84 * Delete all messages. |
|
85 * @param msgIdList, message list. |
|
86 */ |
|
87 void deleteMessages(RArray<TInt>& aIdArray); |
|
88 |
|
89 /** |
|
90 * Delete all draft messages. |
|
91 */ |
|
92 void deleteAllDraftMessagesL(); |
|
93 |
|
94 /** |
|
95 * Marks the unread conversations as read |
|
96 * @param conversationId, conversationId |
|
97 */ |
|
98 void markConversationReadL(TInt aConversationId); |
|
99 |
|
100 /** |
|
101 * Mark messages as read. |
|
102 * @param msgIdList, message list. |
|
103 */ |
|
104 void markMessagesReadL(RArray<TInt>& aIdArray); |
|
105 |
|
106 /** |
|
107 * Get current conversation id. |
|
108 */ |
|
109 TInt getConversationCurrentId(); |
|
110 |
|
111 /** |
|
112 * Clear all conversations |
|
113 */ |
|
114 void clearConversationsL(); |
|
115 |
|
116 /** |
|
117 * Adds ConversationChange Observer |
|
118 */ |
|
119 void registerForConversationUpdatesL(); |
|
120 |
|
121 /** |
|
122 * Remove the CV notifs temporary for some time |
|
123 * does not destroy the model as such |
|
124 */ |
|
125 void deRegisterCVUpdatesTemporary(); |
|
126 |
|
127 /** |
|
128 * Register again after temporary de-register |
|
129 * just need to set the new conversation id |
|
130 */ |
|
131 void registerAgainForConversationUpdatesL(int newConversationId); |
|
132 |
|
133 /** |
|
134 * Fetch ConversationId from contactId |
|
135 * @param contactId , contactId |
|
136 * @return conversationId |
|
137 */ |
|
138 TInt getConversationIdFromContactIdL(TInt contactId); |
|
139 |
|
140 /** |
|
141 * Fetch ConversationId from contact address |
|
142 * @param contactAddress , contact Address |
|
143 * @return conversationId |
|
144 */ |
|
145 TInt getConversationIdFromAddressL(TDesC& contactAddress); |
|
146 |
|
147 /** |
|
148 * Get the latest conversation from the conversation cache by Id |
|
149 * @param aConversationId for conversation is required |
|
150 */ |
|
151 CCsClientConversation* getConversationFromConversationIdL(TInt aConversationId); |
|
152 |
|
153 /** |
|
154 * Starts fetching rest of the conversations |
|
155 */ |
|
156 void fetchMoreConversations(); |
|
157 |
|
158 /** |
|
159 * Starts fetching remaing conversations |
|
160 * @param aCount - count of conversation entries |
|
161 */ |
|
162 void fetchRemainingConversations(TInt& aCount); |
|
163 |
|
164 |
|
165 /** |
|
166 * Resend a failed message |
|
167 * @param messageId TMsvId The msv id of the entry to resend |
|
168 * @return bool true if success |
|
169 */ |
|
170 bool resendMessage(TMsvId messageId); |
|
171 |
|
172 /** |
|
173 * Download a specified message |
|
174 * @param aId TMsvId of the message |
|
175 * @return KErrNone if Download request is successful, |
|
176 * KErrNotFound if settings are not available, |
|
177 * KErrGeneral for other cases |
|
178 */ |
|
179 TInt downloadMessage(TMsvId messageId); |
|
180 |
|
181 /** |
|
182 * Query if the download operation be performed for |
|
183 * a message notification entry |
|
184 * @param aId, message notification id |
|
185 * @return true if download operation is possible |
|
186 */ |
|
187 bool downloadOperationSupported(TMsvId messageId); |
|
188 |
|
189 public: // From MCsResultsObserver |
|
190 |
|
191 /** |
|
192 * ConversationList |
|
193 * This is for handling GetEntryList results asynchronusly |
|
194 * from the server. |
|
195 * |
|
196 * @param aClientConversationList List of client conversations |
|
197 * returned by server. |
|
198 */ |
|
199 void ConversationList( |
|
200 RPointerArray<CCsClientConversation>& aClientConversationList); |
|
201 /** |
|
202 * Conversations |
|
203 * This is for handling GetConversation results asynchronusly |
|
204 * from the server. |
|
205 * |
|
206 * @param aConversationEntryList List of conversation entries |
|
207 * returned by server. |
|
208 */ |
|
209 |
|
210 void Conversations( |
|
211 RPointerArray<CCsConversationEntry>& aConversationEntryList, |
|
212 TInt& totalCount); |
|
213 |
|
214 private: |
|
215 |
|
216 /** |
|
217 * Initializes the ConversationReader class. |
|
218 */ |
|
219 void initL(); |
|
220 |
|
221 |
|
222 private: // data |
|
223 |
|
224 /** |
|
225 * mServer |
|
226 * Ptr to conversation server. |
|
227 */ |
|
228 CCSRequestHandler* mServer; |
|
229 |
|
230 /** |
|
231 * mClientConv |
|
232 * Current Client Conversation selected. |
|
233 * Own. |
|
234 */ |
|
235 CCsClientConversation* mClientConv; |
|
236 |
|
237 /** |
|
238 * MsgStore Handler |
|
239 * Not Owned |
|
240 */ |
|
241 ConversationMsgStoreHandler* mConversationMsgStoreHandler; |
|
242 |
|
243 /** |
|
244 * Conversations Summary Model |
|
245 * Not Owned |
|
246 */ |
|
247 ConversationsSummaryModel *mConversationsSummaryModel; |
|
248 |
|
249 /** |
|
250 * Conversations Model |
|
251 * Not Owned |
|
252 */ |
|
253 ConversationsModel *mConversationsModel; |
|
254 |
|
255 /** |
|
256 * Conversations Change Handler |
|
257 * Owned |
|
258 */ |
|
259 ConversationsChangeHandler *mConvChangeHandler; |
|
260 |
|
261 /** |
|
262 * Conversations List Change Handler |
|
263 * Owned |
|
264 */ |
|
265 ConversationsListChangeHandler *mConvListChangeHandler; |
|
266 |
|
267 }; |
|
268 |
|
269 #endif // CONVERSATIONS_ENGINE_PRIVATE_H |
|
270 |
|
271 //EOF |
|
272 |