|
1 /* |
|
2 * Copyright (c) 2006 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: UI utils for message handling |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CCAUIMESSAGEUTILS_H |
|
21 #define CCAUIMESSAGEUTILS_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <MMGFetchVerifier.h> |
|
26 #include <apgcli.h> // RApaLsSession |
|
27 #include <aknserverapp.h> // MAknServerAppExitObserver |
|
28 #include <NewFileService.hrh> // TNewServiceFileType |
|
29 |
|
30 |
|
31 // FORWARD DECLARATIONS |
|
32 class MCAConversationMessage; |
|
33 class CDocumentHandler; |
|
34 class CImageDecoder; |
|
35 class MCAConversationPC; |
|
36 class MCABlockChecker; |
|
37 class MCAGroupPC; |
|
38 |
|
39 |
|
40 // CLASS DECLARATION |
|
41 |
|
42 /** |
|
43 * UI utils for message handling |
|
44 * |
|
45 * @lib chat.exe |
|
46 * @since Series 60 3.2 |
|
47 */ |
|
48 class CCAUiMessageUtils : public CActive, |
|
49 public MMGFetchVerifier, |
|
50 public MAknServerAppExitObserver |
|
51 { |
|
52 public: // Constructors and destructor |
|
53 |
|
54 /** |
|
55 * Two-phased constructor. |
|
56 */ |
|
57 static CCAUiMessageUtils* NewLC( MCABlockChecker* aBlockChecker = NULL ); |
|
58 |
|
59 /** |
|
60 * Destructor. |
|
61 */ |
|
62 virtual ~CCAUiMessageUtils(); |
|
63 |
|
64 public: // New functions |
|
65 |
|
66 /** |
|
67 * Send new file |
|
68 */ |
|
69 void SendNewFileL( TNewServiceFileType aFileType, |
|
70 MCAConversationPC& aMessageRWInterfacePC, |
|
71 const TDesC& aSender = KNullDesC, |
|
72 const MDesCArray* aScreenNames = NULL, |
|
73 TBool aIsWhisperAllowed = ETrue ); |
|
74 |
|
75 /** |
|
76 * Send image |
|
77 */ |
|
78 void SendImageL( |
|
79 MCAConversationPC& aMessageRWInterfacePC, |
|
80 const TDesC& aSender = KNullDesC, |
|
81 const MDesCArray* aScreenNames = NULL, |
|
82 TBool aIsWhisperAllowed = ETrue ); |
|
83 |
|
84 /** |
|
85 * Send files |
|
86 */ |
|
87 void SendFileL( const MDesCArray& aFileNames, |
|
88 MCAConversationPC& aMessageRWInterfacePC, |
|
89 const TDesC& aSender = KNullDesC, |
|
90 const MDesCArray* aScreenNames = NULL ); |
|
91 |
|
92 /** |
|
93 * Send new file |
|
94 */ |
|
95 void SendNewFileL( TNewServiceFileType aFileType, |
|
96 MCAGroupPC& aMessageRWInterfacePC, |
|
97 const TDesC& aSender = KNullDesC, |
|
98 const MDesCArray* aScreenNames = NULL, |
|
99 TBool aIsWhisperAllowed = ETrue ); |
|
100 |
|
101 /** |
|
102 * Send image |
|
103 */ |
|
104 void SendImageL( |
|
105 MCAGroupPC& aMessageRWInterfacePC, |
|
106 const TDesC& aSender = KNullDesC, |
|
107 const MDesCArray* aScreenNames = NULL, |
|
108 TBool aIsWhisperAllowed = ETrue ); |
|
109 |
|
110 /** |
|
111 * Send files |
|
112 */ |
|
113 void SendFileL( const MDesCArray& aFileNames, |
|
114 MCAGroupPC& aMessageRWInterfacePC, |
|
115 const TDesC& aSender = KNullDesC, |
|
116 const MDesCArray* aScreenNames = NULL ); |
|
117 |
|
118 |
|
119 /** |
|
120 * Open object |
|
121 * @param aMessage Reference message with Image content |
|
122 */ |
|
123 void OpenObjectL( MCAConversationMessage& aMsg ); |
|
124 |
|
125 /** |
|
126 * Save object |
|
127 * @param aMessage Reference message with Image content |
|
128 * @return KErrNone if success. KUserCancel if the user |
|
129 * cancelled the operation. |
|
130 */ |
|
131 TInt SaveObjectL( MCAConversationMessage& aMsg ); |
|
132 |
|
133 /** |
|
134 * Forwards a content message to recipient(s) |
|
135 * @param aMessage Reference message from which the content is |
|
136 * taken and forwarded |
|
137 * @param aRecipient Recipient for the forwarded message |
|
138 * @param aScreenNames Names of the recipients (if whispering is |
|
139 * allowed) |
|
140 * @param aMsgCreator Message creator |
|
141 * @param aWriteInterface Interface to which the forwarded message is |
|
142 * to be written. |
|
143 * @param aIsWhisperingAllowed ETrue if whispering is allowed. |
|
144 * @param aSender Sender of the message |
|
145 * @return ETrue if message was handled, EFalse otherwise. |
|
146 */ |
|
147 TBool ForwardContentMessageL( |
|
148 const MCAConversationMessage& aMessage, |
|
149 const TDesC& aRecipient, |
|
150 const MDesCArray* aScreenNames, |
|
151 MCAConversationPC& aMessageRWInterfacePC, |
|
152 TBool aIsWhisperingAllowed, |
|
153 const TDesC& aSender = KNullDesC ); |
|
154 /** |
|
155 * Forwards a content message to recipient(s) |
|
156 * @param aMessage Reference message from which the content is |
|
157 * taken and forwarded |
|
158 * @param aRecipient Recipient for the forwarded message |
|
159 * @param aScreenNames Names of the recipients (if whispering is |
|
160 * allowed) |
|
161 * @param aMsgCreator Message creator |
|
162 * @param aWriteInterface Interface to which the forwarded message is |
|
163 * to be written. |
|
164 * @param aIsWhisperingAllowed ETrue if whispering is allowed. |
|
165 * @param aSender Sender of the message |
|
166 * @return ETrue if message was handled, EFalse otherwise. |
|
167 */ |
|
168 TBool ForwardContentMessageL( |
|
169 const MCAConversationMessage& aMessage, |
|
170 const TDesC& aRecipient, |
|
171 const MDesCArray* aScreenNames, |
|
172 MCAGroupPC& aMessageRWInterfacePC, |
|
173 TBool aIsWhisperingAllowed, |
|
174 const TDesC& aSender = KNullDesC ); |
|
175 |
|
176 protected: // Functions from base classes |
|
177 |
|
178 /** |
|
179 * @see MAknServerAppExitObserver |
|
180 * @since 3.2 |
|
181 */ |
|
182 void HandleServerAppExit( TInt aReason ); |
|
183 |
|
184 /** |
|
185 * @see MMGFetcVerifier |
|
186 */ |
|
187 TBool VerifySelectionL( const MDesCArray* aSelectedFiles ); |
|
188 |
|
189 protected: // From CActive |
|
190 |
|
191 /** |
|
192 * @see CActive |
|
193 */ |
|
194 void RunL(); |
|
195 |
|
196 /** |
|
197 * @see CActive |
|
198 */ |
|
199 void DoCancel(); |
|
200 |
|
201 /** |
|
202 * @see CActive. |
|
203 */ |
|
204 TInt RunError( TInt aError ); |
|
205 |
|
206 private: |
|
207 |
|
208 /** |
|
209 * C++ default constructor. |
|
210 */ |
|
211 CCAUiMessageUtils( MCABlockChecker* aBlockChecker ); |
|
212 |
|
213 /** |
|
214 * By default Symbian 2nd phase constructor is private. |
|
215 */ |
|
216 void ConstructL(); |
|
217 |
|
218 /** |
|
219 * Select recipients as image or file recipients. |
|
220 * @param aScreenNames The screen names within the group |
|
221 * @return ETrue if accepted, EFalse if cancelled |
|
222 * @since 3.2 |
|
223 */ |
|
224 TBool SelectRecipientsL( const MDesCArray* aScreenNames, |
|
225 TBool aIsWhisperAllowed = ETrue ); |
|
226 |
|
227 |
|
228 |
|
229 /** |
|
230 * Does the actual file sending. The recipients, |
|
231 * if any, should already be in the iSelectedNames. |
|
232 * @see SendFileL |
|
233 * @since 3.2 |
|
234 */ |
|
235 void DoSendFileL( |
|
236 const MDesCArray& aFileNames, |
|
237 MCAConversationPC& aMsgRWInterface, |
|
238 const TDesC& aSender = KNullDesC ); |
|
239 /** |
|
240 * Does the actual file sending. The recipients, |
|
241 * if any, should already be in the iSelectedNames. |
|
242 * @see SendFileL |
|
243 * @since 3.2 |
|
244 */ |
|
245 void DoSendFileL( |
|
246 const MDesCArray& aFileNames, |
|
247 MCAGroupPC& aMsgRWInterface, |
|
248 const TDesC& aSender = KNullDesC ); |
|
249 |
|
250 /** |
|
251 * Retrieves the optimal decode size (as small as possible) |
|
252 * for validating the image |
|
253 */ |
|
254 TSize DecodeSize( const TSize& aSize ); |
|
255 |
|
256 /** |
|
257 * set Navigation Pane to be dimmed. |
|
258 */ |
|
259 void SetNavigationPaneDimmed( TBool aDimmed ); |
|
260 |
|
261 /** |
|
262 * check image file type before it will be sent. |
|
263 */ |
|
264 TBool CheckFileL( const MDesCArray& aFileNames, TDataType& aDataType, TPtrC8& aMimeType, TBool& aSendOption ); |
|
265 |
|
266 private: // Data |
|
267 |
|
268 // Exit reason for server apps |
|
269 TInt iServerAppExitReason; |
|
270 |
|
271 // Activescheduler wait |
|
272 CActiveSchedulerWait iWait; |
|
273 |
|
274 // apa session |
|
275 RApaLsSession iApaSession; |
|
276 |
|
277 // owns, document handler |
|
278 CDocumentHandler* iDocHandler; |
|
279 |
|
280 // owns, selected screen names |
|
281 CDesCArray* iSelectedNames; |
|
282 |
|
283 // owns |
|
284 CImageDecoder* iDecoder; |
|
285 |
|
286 // Not owned - used to check if current recipient is blocked. |
|
287 MCABlockChecker* iBlockChecker; |
|
288 |
|
289 // the flat to indicate that VerifySelectionL() should be run or not. |
|
290 TBool iBeginVerifySelection; |
|
291 |
|
292 }; |
|
293 |
|
294 #endif // CCAUIMESSAGEUTILS_H |
|
295 |
|
296 // End of File |