|
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: Wrapper classes which encapsulates Message store functions |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CONVERSATION_MSG_STORE_HANDLER_H |
|
19 #define CONVERSATION_MSG_STORE_HANDLER_H |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include <msvapi.h> |
|
23 #include <ccsdefs.h> |
|
24 #include <QString> |
|
25 |
|
26 // FORWARD DECLARATIONS |
|
27 class CMsvSession; |
|
28 class MMsvSessionObserver; |
|
29 class DraftsModel; |
|
30 class CClientMtmRegistry; |
|
31 class CMmsClientMtm; |
|
32 class CMmsNotificationClientMtm; |
|
33 |
|
34 |
|
35 class ConversationMsgStoreHandler: public MMsvSessionObserver |
|
36 { |
|
37 public: |
|
38 |
|
39 /* |
|
40 * Draft processing states |
|
41 */ |
|
42 enum TDraftHandlerState |
|
43 { |
|
44 EReadDrafts, |
|
45 EProcessDrafts, |
|
46 EComplete |
|
47 }; |
|
48 |
|
49 /** |
|
50 * Default constructor. |
|
51 */ |
|
52 explicit ConversationMsgStoreHandler(); |
|
53 |
|
54 /** |
|
55 * Destructor |
|
56 */ |
|
57 virtual ~ConversationMsgStoreHandler(); |
|
58 |
|
59 private: |
|
60 |
|
61 /** |
|
62 * Initializes the ConversationMsgStoreHandler class. |
|
63 */ |
|
64 void InitL(); |
|
65 |
|
66 public: |
|
67 /** |
|
68 * From MMsvSessionObserver. HandleSessionEventL. |
|
69 */ |
|
70 void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, |
|
71 TAny* aArg3); |
|
72 public: |
|
73 /** |
|
74 * Get MMS notification status. |
|
75 * @param aMsvId MMS notification status. |
|
76 */ |
|
77 TCsMmsNotificationMsgState MmsNotificationStatus( TInt aMsvId ); |
|
78 |
|
79 /** |
|
80 * Mark specified messages as unread. |
|
81 * @param aIdArray Array of message ids. |
|
82 */ |
|
83 void MarkMessagesReadL(RArray<TInt>& aIdArray); |
|
84 |
|
85 /** |
|
86 * Delete specified messages from message store |
|
87 * @param aIdArray Array of message ids. |
|
88 */ |
|
89 void DeleteMessages(RArray<TInt>& aIdArray); |
|
90 |
|
91 /** |
|
92 * Delete all draft messages. |
|
93 */ |
|
94 void DeleteAllDraftMessagesL(); |
|
95 |
|
96 /** |
|
97 * Resend a specified message that has failed. |
|
98 * @param aId TMsvId of the failed message |
|
99 * @return bool true if succeeded |
|
100 */ |
|
101 bool ResendMessageL(TMsvId aId); |
|
102 |
|
103 /** |
|
104 * Returns the msv session object |
|
105 * @return CMsvSession object |
|
106 */ |
|
107 CMsvSession& GetMsvSession(); |
|
108 |
|
109 /** |
|
110 * Start fetching all draft messages |
|
111 */ |
|
112 void FetchDraftMessages(DraftsModel* draftsModel); |
|
113 |
|
114 /** |
|
115 * Mark message as read and get the message type. |
|
116 * @param messageId message Id |
|
117 * @param msgType message type is written to this. |
|
118 * @param msgType message sub type is written to this. |
|
119 */ |
|
120 void markAsReadAndGetType(int msgId, |
|
121 int& msgType, |
|
122 int& msgSubType); |
|
123 |
|
124 /** |
|
125 * Extract the message type. |
|
126 * @param entry message entry. |
|
127 * @param msgType message type is written to this. |
|
128 * @param msgType message sub type is written to this. |
|
129 */ |
|
130 void extractMsgType(const TMsvEntry& entry, |
|
131 int& msgType, |
|
132 int& msgSubType); |
|
133 /** |
|
134 * Query if the download operation be performed for |
|
135 * a message notification entry |
|
136 * @param aId, message notification id |
|
137 * @return true if download operation is possible |
|
138 */ |
|
139 bool DownloadOperationSupported(const TMsvId& aId); |
|
140 |
|
141 |
|
142 /** |
|
143 * Sets content to messageId |
|
144 * @param messageId, Message Id content |
|
145 */ |
|
146 void setNotificationMessageIdL(int messageId); |
|
147 |
|
148 /** |
|
149 * Seeker method for getting mms notification estimated msg size |
|
150 * @return Formatted string of msg size |
|
151 */ |
|
152 QString NotificationMsgSizeL(); |
|
153 |
|
154 /** |
|
155 * Seeker method for getting mms notification class type |
|
156 * @return Notification Class type string |
|
157 */ |
|
158 QString NotificationClass(); |
|
159 |
|
160 /** |
|
161 * Seeker method for message status and error string |
|
162 * mms notification's download state |
|
163 * @param [OUT] status, msg status |
|
164 * @param [OUT] statusStr, localized string of msg status |
|
165 */ |
|
166 void NotificationStatus(int& status, |
|
167 QString& statusStr); |
|
168 |
|
169 /** |
|
170 * Seeker method getting expiry info of a notification msg |
|
171 * @param [OUT] expiryTime, notification's expiry time |
|
172 * @param [OUT] expiryTimeQString, formatted string of |
|
173 * notification's expiry time |
|
174 */ |
|
175 void NotificationExpiryDate( |
|
176 TTime& expiryTime, |
|
177 QString& expiryTimeStr); |
|
178 |
|
179 /** |
|
180 * Download a specified message |
|
181 * @param aId TMsvId of the message |
|
182 * @return KErrNone if Download request is successful, |
|
183 * KErrNotFound if settings are not available, |
|
184 * KErrGeneral for other cases |
|
185 */ |
|
186 TInt DownloadMessageL(TMsvId aId); |
|
187 |
|
188 private: |
|
189 |
|
190 /** |
|
191 * verifys the current operation status |
|
192 *@param aEntry, TMsvEntry |
|
193 */ |
|
194 TBool OperationFinished( const TMsvEntry& aEntry ) const; |
|
195 |
|
196 /** |
|
197 * verifys the current operation status |
|
198 * @param aEntry, TMsvEntry |
|
199 */ |
|
200 TBool OperationOngoing( const TMsvEntry& aEntry ) const; |
|
201 |
|
202 /** |
|
203 * CIdle callback |
|
204 */ |
|
205 static TInt ProcessDraftMessages(TAny* arg); |
|
206 |
|
207 /** |
|
208 * State handler to read all draft messages |
|
209 */ |
|
210 TInt ProcessDraftMessagesL(); |
|
211 |
|
212 /** |
|
213 * Cleanup |
|
214 */ |
|
215 void CleanupL(); |
|
216 |
|
217 /** |
|
218 * Checks if the MTM type supported |
|
219 */ |
|
220 TBool IsMtmSupported(long uid); |
|
221 |
|
222 private: |
|
223 /** |
|
224 * Msv Session |
|
225 * Own. |
|
226 */ |
|
227 CMsvSession* iMsvSession; |
|
228 |
|
229 /** |
|
230 * Draft entry |
|
231 * Own |
|
232 */ |
|
233 CMsvEntry* iDraftEntry; |
|
234 |
|
235 /** |
|
236 * Active object |
|
237 */ |
|
238 CIdle* iIdle; |
|
239 |
|
240 /** |
|
241 * Messages under root entry |
|
242 * Own |
|
243 */ |
|
244 CMsvEntrySelection* iDraftMessages; |
|
245 |
|
246 /** |
|
247 * Drafts model |
|
248 * Not Own |
|
249 */ |
|
250 DraftsModel *mDraftsModel; |
|
251 |
|
252 /** |
|
253 * Mesage count |
|
254 */ |
|
255 TInt iDraftMessageCount; |
|
256 |
|
257 /** |
|
258 * State |
|
259 */ |
|
260 TDraftHandlerState iState; |
|
261 /** |
|
262 * Own. Mtm Registry |
|
263 */ |
|
264 CClientMtmRegistry* iMtmReg; |
|
265 |
|
266 /** |
|
267 * MMS client mtm |
|
268 */ |
|
269 CMmsClientMtm* iMmsClient; |
|
270 |
|
271 /** |
|
272 * Notification client mtm |
|
273 */ |
|
274 CMmsNotificationClientMtm* iNotificationClient; |
|
275 |
|
276 TBool iOfflineSupported; |
|
277 }; |
|
278 |
|
279 #endif // CONVERSATION_MSG_STORE_HANDLER_H |
|
280 |
|
281 // EOF |