|
1 /* |
|
2 * Copyright (c) 2009 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:uni editor view class. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef MSG_UNIFIED_EDITOR_VIEW_H |
|
19 #define MSG_UNIFIED_EDITOR_VIEW_H |
|
20 |
|
21 #ifdef UNIFIEDEDITOR_DLL |
|
22 #define UNIFIEDEDITOR_EXPORT Q_DECL_EXPORT |
|
23 #else |
|
24 #define UNIFIEDEDITOR_EXPORT Q_DECL_IMPORT |
|
25 #endif |
|
26 |
|
27 #include "msgbaseview.h" |
|
28 #include "convergedmessage.h" |
|
29 #include "convergedmessageid.h" |
|
30 |
|
31 class HbWidget; |
|
32 class HbAction; |
|
33 class HbGroupBox; |
|
34 class QGraphicsLinearLayout; |
|
35 class MsgUnifiedEditorSubject; |
|
36 class MsgUnifiedEditorAddress; |
|
37 class MsgUnifiedEditorBody; |
|
38 class MsgUnifiedEditorMonitor; |
|
39 class MsgAttachmentContainer; |
|
40 class UniEditorPluginLoader; |
|
41 class HbListWidgetItem; |
|
42 class HbAbstractVkbHost; |
|
43 class MsgUnifiedEditorBaseWidget; |
|
44 class HbListWidget; |
|
45 |
|
46 class UNIFIEDEDITOR_EXPORT MsgUnifiedEditorView : public MsgBaseView |
|
47 { |
|
48 Q_OBJECT |
|
49 |
|
50 public: |
|
51 |
|
52 /** |
|
53 * Constructor |
|
54 */ |
|
55 MsgUnifiedEditorView(QGraphicsItem *parent = 0); |
|
56 |
|
57 /** |
|
58 * Destructor |
|
59 */ |
|
60 ~MsgUnifiedEditorView(); |
|
61 |
|
62 /** |
|
63 * Populate editor with passed information |
|
64 * @param editorData data for editor's usage |
|
65 */ |
|
66 void populateContent(const QVariantList& editorData); |
|
67 |
|
68 /** |
|
69 * Opens the drafts message into editor |
|
70 * @param editorData data for editor's usage |
|
71 */ |
|
72 void openDraftsMessage(const QVariantList& editorData); |
|
73 |
|
74 |
|
75 /** |
|
76 * Saves the content inside editor to save |
|
77 */ |
|
78 int saveContentToDrafts(); |
|
79 |
|
80 protected: |
|
81 /** |
|
82 * reimplemented from base class to provide proper geometry for scrolling. |
|
83 */ |
|
84 void resizeEvent( QGraphicsSceneResizeEvent * event ); |
|
85 |
|
86 private: |
|
87 |
|
88 /** |
|
89 * helper method to add menu. |
|
90 */ |
|
91 void addMenu(); |
|
92 |
|
93 /** |
|
94 * helper method to add tool bar. |
|
95 */ |
|
96 void addToolBar(); |
|
97 |
|
98 /** |
|
99 * Packs the content inside editor into converged message |
|
100 * @param [OUT]msg, converged message to hold editor data |
|
101 * @param isSave, flag to indicate that msg needs to be packed |
|
102 * for saving to draft or not |
|
103 */ |
|
104 void packMessage(ConvergedMessage &msg, bool isSave=false); |
|
105 |
|
106 /** |
|
107 * Populate editor with prepopulated msg content |
|
108 * @param messageDetails message details |
|
109 * @param draftMessage boolean for specifying draft message |
|
110 */ |
|
111 void populateContentIntoEditor( |
|
112 const ConvergedMessage& messageDetails, bool draftMessage = false); |
|
113 |
|
114 /** |
|
115 * Populate the editor with the message's content |
|
116 * for various cases like forward, reply, replyAll |
|
117 * @param messageId, unique id of message in store |
|
118 * @param messageType, sms or mms |
|
119 * @param editorOperation, forward or reply or replyAll etc |
|
120 */ |
|
121 void fetchMessageFromStore(ConvergedMessageId& messageId, |
|
122 ConvergedMessage::MessageType messageType, |
|
123 int editorOperation); |
|
124 |
|
125 /** |
|
126 * Create VCards for all the contacts available in the list |
|
127 * @param value list of fetched contacts |
|
128 * @param [OUT]filelist list of newly added vcard files |
|
129 * @return errId KErrNone if no error |
|
130 */ |
|
131 int createVCards(const QVariant& value, QStringList& filelist); |
|
132 |
|
133 /** |
|
134 * Resolve name conflict when adding attachments to editor |
|
135 * @param suggestedName suggested file name to use |
|
136 * @return fully qualified path of the file in unieditor's temp folder |
|
137 */ |
|
138 QString generateFileName(QString& suggestedName); |
|
139 |
|
140 /** |
|
141 * Fetch images |
|
142 */ |
|
143 void fetchImages(); |
|
144 |
|
145 /** |
|
146 * Fetch contacts |
|
147 */ |
|
148 void fetchContacts(); |
|
149 |
|
150 /** |
|
151 * Fetch audio |
|
152 */ |
|
153 void fetchAudio(); |
|
154 |
|
155 /** |
|
156 * To hide/show chrome. |
|
157 */ |
|
158 void hideChrome(bool hide); |
|
159 |
|
160 /** |
|
161 * To initialize view. |
|
162 */ |
|
163 void initView(); |
|
164 |
|
165 /** |
|
166 * Creates temp folder for editor. |
|
167 */ |
|
168 bool createTempFolder(); |
|
169 |
|
170 /** |
|
171 * Removes editors temp folder. |
|
172 */ |
|
173 void removeTempFolder(); |
|
174 |
|
175 /** |
|
176 * Attachment options in TBE |
|
177 * Row number of the TBE actions |
|
178 */ |
|
179 enum TBE_AttachOption |
|
180 { |
|
181 TBE_PHOTO = 0x00, TBE_SOUND = 0x01, TBE_VCARD = 0x02 |
|
182 }; |
|
183 |
|
184 /** |
|
185 * Enable/Disable attachment options for slide-conformance |
|
186 * @param opt, row number of action in TBE |
|
187 * @param isEnabled, true/false |
|
188 */ |
|
189 void setAttachOptionEnabled(MsgUnifiedEditorView::TBE_AttachOption opt, |
|
190 bool enable); |
|
191 |
|
192 /** |
|
193 * Addresses are all ok. Now parse not allowed chars away |
|
194 * before giving it to MTM |
|
195 * @param addresses, list of ConvergedMessageAddress |
|
196 */ |
|
197 void formatAddresses(ConvergedMessageAddressList& addresses); |
|
198 |
|
199 private slots: |
|
200 |
|
201 /** |
|
202 * slot to add subject field. |
|
203 */ |
|
204 void addSubject(); |
|
205 |
|
206 /** |
|
207 * slot to add Cc,Bcc field. |
|
208 */ |
|
209 void addCcBcc(); |
|
210 |
|
211 /** |
|
212 * slot to handle Cc, Bcc group-box's toggle action |
|
213 */ |
|
214 void updateOtherRecipientCount(bool state); |
|
215 |
|
216 /** |
|
217 * slot to change priority. |
|
218 */ |
|
219 void changePriority(); |
|
220 |
|
221 /** |
|
222 * slot to current delete message. |
|
223 */ |
|
224 void deleteMessage(); |
|
225 |
|
226 /** |
|
227 * slot to images fetched. |
|
228 */ |
|
229 void imagesFetched(const QVariant& result ); |
|
230 |
|
231 /** |
|
232 * slot to receive fetched contacts |
|
233 */ |
|
234 void contactsFetched(const QVariant& value); |
|
235 |
|
236 /** |
|
237 * slot to send message. |
|
238 */ |
|
239 void send(); |
|
240 |
|
241 /** |
|
242 * slot to tell view to remove the attachment's container |
|
243 */ |
|
244 void removeAttachmentContainer(); |
|
245 |
|
246 /** |
|
247 * add attachments to the editor |
|
248 * @param files list of file paths |
|
249 */ |
|
250 void addAttachments(QStringList files); |
|
251 |
|
252 /** |
|
253 * add an attachment to the editor |
|
254 * @return addition operation status |
|
255 */ |
|
256 int addAttachment(const QString& filepath); |
|
257 |
|
258 /** |
|
259 * called when extention item is clicked. |
|
260 */ |
|
261 void handleViewExtnActivated(HbListWidgetItem* item); |
|
262 |
|
263 /** |
|
264 * Signal emitted when an error is generated. |
|
265 * @param errorCode Error code. |
|
266 * @param errorMessage Error description. |
|
267 */ |
|
268 void serviceRequestError(int errorCode, const QString& errorMessage); |
|
269 |
|
270 /** |
|
271 * Activate Input Blocker |
|
272 */ |
|
273 void activateInputBlocker(); |
|
274 |
|
275 /** |
|
276 * Deactivate Input Blocker |
|
277 */ |
|
278 void deactivateInputBlocker(); |
|
279 |
|
280 /** |
|
281 * Resizes the view when VKB is opened. |
|
282 * This slot is triggered when vkb is opened. |
|
283 */ |
|
284 void vkbOpened(); |
|
285 |
|
286 /** |
|
287 * Resizes the view when VKB is closed. |
|
288 * This slot is triggered when VKB focus is lost. |
|
289 */ |
|
290 void vkbClosed(); |
|
291 |
|
292 /** |
|
293 * Slot to do delayed construction. |
|
294 */ |
|
295 void doDelayedConstruction(); |
|
296 |
|
297 /** |
|
298 * Sets focus to item. |
|
299 */ |
|
300 void setFocus(MsgUnifiedEditorBaseWidget* item); |
|
301 |
|
302 /** |
|
303 * Listens to contentChanged signal of various fields. |
|
304 */ |
|
305 void onContentChanged(); |
|
306 |
|
307 /** |
|
308 * This slot is called when delete message dialog is launched. |
|
309 * @param action selected action (yes or no). |
|
310 */ |
|
311 void onDialogDeleteMsg(HbAction* action); |
|
312 |
|
313 /** |
|
314 * This slot is called when define sms settings dialog is launched. |
|
315 * @param action selected action (yes or no). |
|
316 */ |
|
317 void onDialogSmsSettings(HbAction* action); |
|
318 |
|
319 /** |
|
320 * This slot is called when define mms settings dialog is launched. |
|
321 * @param action selected action (yes or no). |
|
322 */ |
|
323 void onDialogMmsSettings(HbAction* action); |
|
324 |
|
325 /** |
|
326 * Enable/Disable send tool button. |
|
327 * @param true/false to enable/disable. |
|
328 */ |
|
329 void enableSendButton(bool enable); |
|
330 |
|
331 /** |
|
332 * This slot is triggered when vkb is about to be opened. |
|
333 */ |
|
334 void vkbAboutToOpen(); |
|
335 |
|
336 /** |
|
337 * This slot is triggered when vkb is about to be closed. |
|
338 */ |
|
339 void vkbAboutToClose(); |
|
340 |
|
341 private: |
|
342 HbAction* mSubjectAction; |
|
343 HbAction* mCcBccAction; |
|
344 HbAction* mSendAction; |
|
345 QGraphicsLinearLayout* mMainLayout; |
|
346 MsgUnifiedEditorSubject* mSubjectField; |
|
347 MsgUnifiedEditorAddress* mToField; |
|
348 MsgUnifiedEditorAddress* mCcField; |
|
349 MsgUnifiedEditorAddress* mBccField; |
|
350 MsgUnifiedEditorBody* mBody; |
|
351 |
|
352 HbWidget* mContentWidget; |
|
353 |
|
354 MsgUnifiedEditorMonitor* mMsgMonitor; |
|
355 MsgAttachmentContainer* mAttachmentContainer; |
|
356 UniEditorPluginLoader* mPluginLoader; |
|
357 ConvergedMessageId mOpenedMessageId; |
|
358 ConvergedMessage::MessageType mmOpenedMessageType; |
|
359 bool mCanSaveToDrafts; |
|
360 HbAction *mAttachAction; |
|
361 |
|
362 /** |
|
363 * TBE's content widget |
|
364 */ |
|
365 HbListWidget* mTBExtnContentWidget; |
|
366 |
|
367 /** |
|
368 * Instance of VKB host |
|
369 */ |
|
370 HbAbstractVkbHost* mVkbHost; |
|
371 |
|
372 friend class MsgUnifiedEditorMonitor; |
|
373 }; |
|
374 |
|
375 #endif //MSG_UNIFIED_EDITOR_VIEW_H |