|
1 /* |
|
2 * Copyright (c) 2004-2005 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: Interface for handling one message |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef MCAMESSAGE_H |
|
20 #define MCAMESSAGE_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <badesca.h> |
|
24 |
|
25 // FORWARD CLASS DECLERATIONS |
|
26 class MCAMessageContainerInfo; |
|
27 class MCALoggerMessage; |
|
28 class MCAContentProcessor; |
|
29 class MCAContentProcessObserver; |
|
30 |
|
31 // MDesCArray must not be fwd declared, or compiling test code will break |
|
32 // since it's a MACRO. hence the include to badesca.h |
|
33 |
|
34 // CLASS DECLARATION |
|
35 |
|
36 /** |
|
37 * Interface for handling one message |
|
38 * |
|
39 * @lib CAEngine.dll |
|
40 * @since 3.0 |
|
41 */ |
|
42 class MCAMessage |
|
43 { |
|
44 public: // Definitions |
|
45 |
|
46 /** |
|
47 * Different message types |
|
48 */ |
|
49 enum TMessageType |
|
50 { |
|
51 EMessagePTOP, |
|
52 EMessageWhisper, |
|
53 EMessageGroup, |
|
54 EMessageSystem, |
|
55 EMessageInvalid |
|
56 }; |
|
57 |
|
58 /** |
|
59 * System message enumerations. |
|
60 */ |
|
61 enum TSystemMessage |
|
62 { |
|
63 ESystemMessageNone, |
|
64 ESystemMessageWelcome, |
|
65 ESystemMessageNewUsers, |
|
66 ESystemMessageTopicChanged, |
|
67 ESystemMessagePrivatChanged, |
|
68 ESystemMessageLeftUsers, |
|
69 ESystemMessageDateChange |
|
70 }; |
|
71 |
|
72 /** |
|
73 * Direction of message. Coming or going or other. |
|
74 */ |
|
75 enum TMessagerType |
|
76 { |
|
77 EMessageSent, |
|
78 EMessageReceived, |
|
79 EMessageOther |
|
80 }; |
|
81 |
|
82 /** |
|
83 * Different message content types |
|
84 */ |
|
85 enum TContentType |
|
86 { |
|
87 EContentText, |
|
88 EContentPicture, |
|
89 EContentOther, |
|
90 EContentInvalid |
|
91 }; |
|
92 |
|
93 /** |
|
94 * Content processing states |
|
95 */ |
|
96 enum TContentProcessState |
|
97 { |
|
98 EContentNotProcessed = 0, |
|
99 EContentNotSupported, |
|
100 EContentNotSupportedDrm, |
|
101 EContentCorrupted, |
|
102 EBitmapDecoded, |
|
103 EBitmapScaled, |
|
104 EContentReady, |
|
105 EContentDecoded, |
|
106 EThumbnailReady |
|
107 }; |
|
108 |
|
109 public: // General information |
|
110 |
|
111 /** |
|
112 * Get timestamp when this message has been created. |
|
113 * For prioritization of message deletion and timestamping |
|
114 * chat messages |
|
115 */ |
|
116 virtual const TTime& TimeStamp() const = 0; |
|
117 |
|
118 /** |
|
119 * Message size in bytes. |
|
120 * @return Size of message in bytes. |
|
121 */ |
|
122 virtual TInt SizeInBytes() const = 0; |
|
123 |
|
124 public: // Type of message |
|
125 /** |
|
126 * Type of message |
|
127 * @return Type of message. EMessageGroup, EMessagePersonal, |
|
128 * EMessageSystem |
|
129 */ |
|
130 virtual TMessageType MessageType() const = 0; |
|
131 |
|
132 /** |
|
133 * Type of messager |
|
134 * @return Type of message. EMessageFrom, EMessageTo, EMessageOther |
|
135 */ |
|
136 virtual TMessagerType MessagerType() const = 0; |
|
137 |
|
138 /** |
|
139 * Type of content of message |
|
140 * @return Type of message. EMessageText, EMessagePicture |
|
141 */ |
|
142 virtual TContentType ContentType() const = 0; |
|
143 |
|
144 /** |
|
145 * Is message failed or not |
|
146 * @return ETrue if is, EFalse if not. |
|
147 */ |
|
148 virtual TBool FailedMessage() const = 0; |
|
149 |
|
150 /** |
|
151 * Returns the type of system message. |
|
152 * @return type of system message or |
|
153 * TSystemMessageNone if not system message |
|
154 */ |
|
155 virtual TSystemMessage SystemMessageType() = 0; |
|
156 |
|
157 public: // Identification of message |
|
158 /** |
|
159 * Operation code of message. One way to identify message. |
|
160 * @return Operation code of message. |
|
161 */ |
|
162 virtual TInt OperationCode() const = 0; |
|
163 |
|
164 /** |
|
165 * Set operation code of message. |
|
166 * @param aOpId, new operation code for message |
|
167 */ |
|
168 virtual void SetOperationCode( TInt aOpId ) = 0; |
|
169 |
|
170 /** |
|
171 * Part of container identifier which contains this message |
|
172 * @return Server address to identify container which contains |
|
173 * this message |
|
174 */ |
|
175 virtual const TDesC& ServerAddress() const = 0; |
|
176 |
|
177 /** |
|
178 * Part of container identifier which contains this message |
|
179 * @return User id to identify container which contains this message |
|
180 */ |
|
181 virtual const TDesC& UserId() const = 0; |
|
182 |
|
183 /** |
|
184 * Part of container identifier which contains this message |
|
185 * @return Identifier to identify container which contains this message |
|
186 */ |
|
187 virtual const TDesC& Target() const = 0; |
|
188 |
|
189 /** |
|
190 * Set containerinfo of message. Needed for identifying of message. |
|
191 * @param aInfo. ContainerInfo. |
|
192 */ |
|
193 virtual void SetContainerInfo( MCAMessageContainerInfo* aInfo ) = 0; |
|
194 |
|
195 public: // Content of message |
|
196 |
|
197 /** |
|
198 * Recipient of message. |
|
199 * @return Recipient of message. To whom the message is sent. |
|
200 */ |
|
201 virtual const TDesC& Recipient() const = 0; |
|
202 |
|
203 /** |
|
204 * Sender of message |
|
205 * @return Sender of message. To who has sent the message. |
|
206 */ |
|
207 virtual const TDesC& Sender() const = 0; |
|
208 |
|
209 /** |
|
210 * Recipients array. |
|
211 * @return Array of recipients |
|
212 */ |
|
213 virtual const MDesCArray* Recipients() const = 0; |
|
214 |
|
215 /** |
|
216 * Screennames array |
|
217 */ |
|
218 virtual const MDesCArray* ScreenNames() const = 0; |
|
219 |
|
220 /** |
|
221 * Textual content of message |
|
222 * @return Textual content. |
|
223 */ |
|
224 virtual const TDesC& Text() const = 0; |
|
225 |
|
226 /** |
|
227 * Mime type of content. |
|
228 * @return Mime type of content. |
|
229 */ |
|
230 virtual const TDesC8& MimeType() const = 0; |
|
231 |
|
232 /** |
|
233 * Content data in decriptor |
|
234 * @return Content data in descriptor |
|
235 */ |
|
236 virtual const TDesC8& ContentData() const = 0; |
|
237 |
|
238 /** |
|
239 * Set content data for message |
|
240 * @param aContent. Ownership is transferred. |
|
241 */ |
|
242 virtual void SetContentData( HBufC8* aContent ) = 0; |
|
243 |
|
244 /** |
|
245 * Current processing state. Might be different for different |
|
246 * content types |
|
247 * @return Processing state of message. |
|
248 */ |
|
249 virtual TContentProcessState ContentProcessState() const = 0; |
|
250 |
|
251 /** |
|
252 * Set current processing state. |
|
253 * @aNewState New processing state |
|
254 */ |
|
255 virtual void SetProcessState( TContentProcessState aNewState ) = 0; |
|
256 |
|
257 /** |
|
258 * Set the part of message to be forwarded, |
|
259 * used when forwarding a highlighted item from a message. |
|
260 * @param aFwdPart pointer to highlighted item descriptor, |
|
261 * use NULL to clear forward message part. |
|
262 */ |
|
263 virtual void SetForwardPartL( const HBufC* aFwdPart ) = 0; |
|
264 |
|
265 /** |
|
266 * Forwarded part of message. |
|
267 * @return forwarded part of message or NULL if not set |
|
268 */ |
|
269 virtual const HBufC* ForwardPart() const = 0; |
|
270 |
|
271 public: // Message owner managing. |
|
272 |
|
273 /** |
|
274 * Increase owner count. There can be multiply owners for one message. |
|
275 * This method is for increasing the count. Every owner class |
|
276 * must use also DecreaseOwnerCount. |
|
277 */ |
|
278 virtual void IncreaseOwnerCount() = 0; |
|
279 |
|
280 /** |
|
281 * Decrease owner count. There can be multiply owners for one message. |
|
282 * This method is for decreasing the count. Every owner class |
|
283 * must have called IncreaseOwnerCount before calling this method. |
|
284 * @return ETrue if owner can delete message. EFalse if not. |
|
285 */ |
|
286 virtual TBool DecreaseOwnerCount() = 0; |
|
287 |
|
288 public: // Log interface of message. |
|
289 |
|
290 /** |
|
291 * Interface for logger. |
|
292 * @return Interface for logger. |
|
293 */ |
|
294 virtual MCALoggerMessage& LoggerMessage() = 0; |
|
295 |
|
296 public: // Content processing. |
|
297 |
|
298 /** |
|
299 * Add content processor for message |
|
300 * @param aProcessor Processor for content. |
|
301 */ |
|
302 virtual TInt AddContentProcessor( |
|
303 MCAContentProcessor& aProcessor, |
|
304 MCAContentProcessObserver* aObserver ) = 0; |
|
305 |
|
306 /** |
|
307 * Handle processing completion. Called by content processor when |
|
308 * processing is ready. |
|
309 * @param aProcessor Processor which made processing. |
|
310 * @param aStatus, Status of processing. KErrNone -> OK. |
|
311 */ |
|
312 virtual void HandleProcessingComplete( MCAContentProcessor& aProcessor, |
|
313 TInt aStatus ) = 0; |
|
314 |
|
315 /** |
|
316 * Release temporary content data |
|
317 */ |
|
318 virtual void ReleaseTemporaryContentData() = 0; |
|
319 |
|
320 |
|
321 public: |
|
322 //The following API's are used, if message content is a image |
|
323 //This is part of new implementation required for wvuing |
|
324 //While merging with wvui20, please make sure you preserve |
|
325 //this change also. |
|
326 /** |
|
327 * API used to set the iSaved Flag to ETrue |
|
328 * if the image is saved by the user. |
|
329 * @param aSaved - ETrue if Image is Saved by the user |
|
330 * @return void |
|
331 */ |
|
332 virtual void SetImageAsSaved( const TBool aSaved ) = 0; |
|
333 |
|
334 /** |
|
335 * API used to check whether the image was |
|
336 * SAVED or not. |
|
337 * @return TBool - ETrue if the user has already saved the image |
|
338 * else EFalse |
|
339 */ |
|
340 virtual TBool IsImageSaved() = 0; |
|
341 |
|
342 public: // For deletion of message |
|
343 |
|
344 /** |
|
345 * Virtual destructor |
|
346 */ |
|
347 virtual ~MCAMessage() {} |
|
348 }; |
|
349 |
|
350 #endif // MCAMESSAGE_H |
|
351 |
|
352 // End of File |
|
353 |