14 * Description: |
14 * Description: |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 // SYSTEM INCLUDES |
18 // SYSTEM INCLUDES |
19 #include <HbWidget> |
19 #include <e32base.h> |
20 #include <HbMenu> |
20 #include <HbMenu> |
21 #include <HbAction> |
21 #include <HbAction> |
22 #include <HbToolBar> |
22 #include <HbToolBar> |
23 #include <QGraphicsLinearLayout> |
23 #include <QGraphicsLinearLayout> |
24 #include <HbGroupBox> |
24 #include <HbGroupBox> |
25 #include <HbScrollArea> |
25 #include <HbScrollArea> |
26 #include <QDateTime> |
26 #include <QDateTime> |
27 #include <QDir> |
27 #include <QDir> |
|
28 #include <QBuffer> |
|
29 #include <QFile> |
|
30 #include <QFileInfo> |
|
31 #include <xqconversions.h> |
|
32 #include <HbToolBarExtension> |
|
33 #include <HbListWidget> |
|
34 #include <HbFrameBackground> |
|
35 #include <HbListViewItem> |
|
36 #include <HbListWidgetItem> |
|
37 #include <HbNotificationDialog> |
|
38 #include <HbMessageBox> |
|
39 #include <xqaiwrequest.h> |
|
40 #include <xqappmgr.h> |
|
41 |
|
42 // QT Mobility for fetching business card |
|
43 #include <qversitwriter.h> |
|
44 #include <qversitdocument.h> |
|
45 #include <qcontact.h> |
|
46 #include <qcontactmanager.h> |
|
47 #include <qversitcontactexporter.h> |
|
48 #include <cntservicescontact.h> |
28 |
49 |
29 // USER INCLUDES |
50 // USER INCLUDES |
30 #include "debugtraces.h" |
51 #include "debugtraces.h" |
31 #include "msgunieditorview.h" |
52 #include "msgunieditorview.h" |
32 #include "msgunieditoraddress.h" |
53 #include "msgunieditoraddress.h" |
33 #include "msgunieditorsubject.h" |
54 #include "msgunieditorsubject.h" |
34 #include "msgunieditorbody.h" |
55 #include "msgunieditorbody.h" |
35 #include "msgtypenotifier.h" |
|
36 #include "msgmonitor.h" |
56 #include "msgmonitor.h" |
37 #include "msgattachmentcontainer.h" |
57 #include "msgattachmentcontainer.h" |
38 #include "msguiutilsmanager.h" |
58 #include "msgsendutil.h" |
39 #include "convergedmessageaddress.h" |
59 #include "convergedmessageaddress.h" |
40 #include "matchphnumberutil.h" |
|
41 #include "unieditorgenutils.h" |
60 #include "unieditorgenutils.h" |
42 #include "unieditorpluginloader.h" |
61 #include "unieditorpluginloader.h" |
43 #include "unieditorplugininterface.h" |
62 #include "unieditorplugininterface.h" |
44 |
63 |
45 // Constants |
64 // Constants |
46 const QString SEND_ICON(":/qtg_mono_send.svg"); |
65 const QString SEND_ICON("qtg_mono_send"); |
47 const QString ATTACH_ICON(":/qtg_mono_attach.svg"); |
66 const QString ATTACH_ICON("qtg_mono_attach"); |
|
67 // temporary folder for unieditor |
|
68 const QString UNIFIED_EDITOR_TEMP_FOLDER("unifiededitor"); |
48 |
69 |
49 const int INVALID_MSGID = -1; |
70 const int INVALID_MSGID = -1; |
|
71 // vcard file extn. |
|
72 const QString FILE_EXTN(".vcf"); |
|
73 // Max vcards inside a msg. Using a very large number. |
|
74 // TODO: how we can avoid this? |
|
75 const int MAX_VCARDS(1000); |
50 |
76 |
51 // LOCALIZED CONSTANTS |
77 // LOCALIZED CONSTANTS |
52 #define LOC_TO hbTrId("txt_messaging_formlabel_to") |
78 //To,Cc.Bcc |
|
79 #define LOC_TO hbTrId("txt_messaging_formlabel_to") |
|
80 #define LOC_CC hbTrId("txt_messaging_formlabel_cc") |
|
81 #define LOC_BCC hbTrId("txt_messaging_formlabel_bcc") |
|
82 |
|
83 //attach options |
|
84 #define LOC_PHOTO hbTrId("txt_messaging_button_photo") |
|
85 #define LOC_SOUND hbTrId("txt_messaging_button_sound") |
|
86 #define LOC_BUSINESS_CARD hbTrId("txt_messaging_button_business_card") |
|
87 |
|
88 //options menu. |
|
89 #define LOC_ADD_SUBJECT hbTrId("txt_messaging_opt_add_subject") |
|
90 #define LOC_ADD_CC_BCC hbTrId("txt_messaging_opt_add_cc_bcc") |
|
91 #define LOC_PRIORITY hbTrId("txt_messaging_setlabel_priority") |
|
92 #define LOC_SENDING_OPTIONS hbTrId("txt_messaging_opt_sending_options") |
|
93 #define LOC_DELETE_MESSAGE hbTrId("txt_messaging_opt_delete_message") |
|
94 |
|
95 //priority sub menu |
53 #define LOC_HIGH hbTrId("txt_messaging_setlabel_priority_val_high") |
96 #define LOC_HIGH hbTrId("txt_messaging_setlabel_priority_val_high") |
54 #define LOC_NORMAL hbTrId("txt_messaging_setlabel_priority_val_normal") |
97 #define LOC_NORMAL hbTrId("txt_messaging_setlabel_priority_val_normal") |
55 #define LOC_LOW hbTrId("txt_messaging_setlabel_priority_val_low") |
98 #define LOC_LOW hbTrId("txt_messaging_setlabel_priority_val_low") |
56 #define LOC_SENDING_OPTIONS hbTrId("txt_messaging_opt_sending_options") |
99 |
57 |
100 //group box |
58 #define LOC_DELETE_MESSAGE hbTrId("txt_messaging_opt_delete_message") |
101 #define LOC_OTHER_RECIPIENTS(n) hbTrId("txt_messaging_group_title_ln_other_recipients",n) |
59 #define LOC_CC hbTrId("txt_messaging_formlabel_cc") |
102 |
60 #define LOC_BCC hbTrId("txt_messaging_formlabel_bcc") |
103 //saved to draft note |
61 #define LOC_OTHER_RECIPIENTS hbTrId("txt_messaging_group_title_ln_other_recipients") |
104 #define LOC_SAVED_TO_DRAFTS hbTrId("txt_messaging_dpopinfo_saved_to_drafts") |
62 |
105 |
63 #define LOC_PHOTO hbTrId("txt_messaging_button_photo") |
106 //delete confermation |
64 #define LOC_VIDEO hbTrId("txt_messaging_button_video") |
107 #define LOC_NOTE_DELETE_MESSAGE hbTrId("txt_messaging_dialog_delete_message") |
65 #define LOC_SOUND hbTrId("txt_messaging_button_sound") |
108 #define LOC_BUTTON_DELETE hbTrId("txt_common_button_delete") |
66 #define LOC_MORE hbTrId("txt_messaging_button_more") |
109 #define LOC_BUTTON_CANCEL hbTrId("txt_common_button_cancel") |
|
110 #define LOC_DIALOG_OK hbTrId("txt_common_button_ok") |
|
111 |
|
112 //extension list item frame. |
|
113 const QString POPUP_LIST_FRAME("qtg_fr_popup_list_normal"); |
|
114 |
|
115 // LOCAL FUNCTIONS |
|
116 QString editorTempPath(); |
67 |
117 |
68 //--------------------------------------------------------------- |
118 //--------------------------------------------------------------- |
69 // MsgUnifiedEditorView::MsgUnifiedEditorView |
119 // MsgUnifiedEditorView::MsgUnifiedEditorView |
70 // @see header file |
120 // @see header file |
71 //--------------------------------------------------------------- |
121 //--------------------------------------------------------------- |
72 MsgUnifiedEditorView::MsgUnifiedEditorView( QGraphicsItem *parent ) : |
122 MsgUnifiedEditorView::MsgUnifiedEditorView( QGraphicsItem *parent ) : |
73 MsgBaseView(parent), |
123 MsgBaseView(parent), |
74 mSubjectAction(0), |
124 mSubjectAction(0), |
75 mCcBccAction(0), |
125 mCcBccAction(0), |
76 mMainLayout(0), |
126 mMainLayout(0), |
77 mSubjectField(0), |
127 mSubjectField(0), |
78 mToField(0), |
128 mToField(0), |
79 mCcField(0), |
129 mCcField(0), |
80 mBccField(0), |
130 mBccField(0), |
81 mBody(0), |
131 mBody(0), |
82 mPrioritySubMenu(0), |
132 mContentWidget(0), |
83 mContentWidget(0), |
133 mMsgMonitor(0), |
84 mNotifier(0), |
134 mAttachmentContainer(0), |
85 mMsgMonitor(0), |
135 mPluginLoader(0), |
86 mUtilsManager(0), |
136 mCanSaveToDrafts(true) |
87 mAttachmentContainer(0), |
137 { |
88 mPluginLoader(0) |
|
89 { |
|
90 addMenu(); |
138 addMenu(); |
91 addToolBar(); |
139 addToolBar(); |
92 |
140 |
93 HbScrollArea* scrollArea = new HbScrollArea(this); |
141 HbScrollArea* scrollArea = new HbScrollArea(this); |
94 this->setWidget(scrollArea); |
142 this->setWidget(scrollArea); |
95 |
143 |
96 mContentWidget = new HbWidget(this); |
144 mContentWidget = new HbWidget(this); |
97 scrollArea->setContentWidget(mContentWidget); |
145 scrollArea->setContentWidget(mContentWidget); |
98 |
146 |
99 mPluginPath = pluginPath(); |
147 mPluginPath = pluginPath(); |
100 |
148 |
101 mMainLayout = new QGraphicsLinearLayout(Qt::Vertical, mContentWidget); |
149 mMainLayout = new QGraphicsLinearLayout(Qt::Vertical, mContentWidget); |
102 mMainLayout->setContentsMargins(0,0,0,0); |
150 qreal vTopSpacing = 0.0; |
103 |
|
104 //Adding suitable spacing between the Custom Widgets |
|
105 qreal vItemSpacing = 0.0; |
151 qreal vItemSpacing = 0.0; |
|
152 style()->parameter("hb-param-margin-gene-top",vTopSpacing); |
106 style()->parameter("hb-param-margin-gene-middle-vertical",vItemSpacing); |
153 style()->parameter("hb-param-margin-gene-middle-vertical",vItemSpacing); |
|
154 |
|
155 mMainLayout->setContentsMargins(0,vTopSpacing,0,0); |
107 mMainLayout->setSpacing(vItemSpacing); |
156 mMainLayout->setSpacing(vItemSpacing); |
108 |
157 |
109 // notifier for recording msg type transitions between sms & mms |
158 mMsgMonitor = new MsgMonitor(this); |
110 mNotifier = new MsgTypeNotifier(this); |
|
111 mMsgMonitor = new MsgMonitor(this); |
|
112 mUtilsManager = new MsgUiUtilsManager(this); |
|
113 |
159 |
114 mToField = new MsgUnifiedEditorAddress( LOC_TO, mPluginPath, mContentWidget ); |
160 mToField = new MsgUnifiedEditorAddress( LOC_TO, mPluginPath, mContentWidget ); |
115 mBody = new MsgUnifiedEditorBody(mPluginPath, mContentWidget); |
161 mBody = new MsgUnifiedEditorBody(mPluginPath, mContentWidget); |
116 |
162 |
117 mMainLayout->addItem(mToField); |
163 mMainLayout->addItem(mToField); |
118 mMainLayout->addItem(mBody); |
164 mMainLayout->addItem(mBody); |
119 |
165 |
120 //Set the invalid msg id |
166 //Set the invalid msg id |
121 mOpenedMessageId.setId(-1); |
167 mOpenedMessageId.setId(-1); |
122 |
168 |
|
169 // create editor's temp folder |
|
170 QDir tempDir = QDir(QString()); |
|
171 QString tempPath(editorTempPath()); |
|
172 if(tempDir.mkpath(tempPath)) |
|
173 { |
|
174 tempDir.cd(tempPath); |
|
175 // remove stale folder content when freshly launched |
|
176 QStringList contentList(tempDir.entryList()); |
|
177 int contentCount = contentList.count(); |
|
178 for(int i=0; i<contentCount; i++) |
|
179 { |
|
180 tempDir.remove(contentList.at(i)); |
|
181 } |
|
182 } |
|
183 |
123 connect(mToField, SIGNAL(sendMessage()), this, SLOT(send())); |
184 connect(mToField, SIGNAL(sendMessage()), this, SLOT(send())); |
124 connect(mBody, SIGNAL(sendMessage()), this, SLOT(send())); |
185 connect(mBody, SIGNAL(sendMessage()), this, SLOT(send())); |
125 connect(mBody, SIGNAL(mmContentAdded(bool)), |
186 connect(mBody, SIGNAL(contentChanged()), |
126 mNotifier, SLOT(onMMContentAdded(bool))); |
187 mMsgMonitor, SLOT(checkMsgTypeChange())); |
127 connect(mBody, SIGNAL(sizeChanged(int)), |
188 } |
128 mMsgMonitor, SLOT(onSizeChanged(int))); |
|
129 connect(mUtilsManager, SIGNAL(imagesFetched(const QVariant&)), |
|
130 this, SLOT(imagesFetched(const QVariant&))); |
|
131 connect(mUtilsManager, SIGNAL(audiosFetched(const QVariant&)), |
|
132 this, SLOT(audiosFetched(const QVariant&))); |
|
133 } |
|
134 |
189 |
135 //--------------------------------------------------------------- |
190 //--------------------------------------------------------------- |
136 // MsgUnifiedEditorView::~MsgUnifiedEditorView |
191 // MsgUnifiedEditorView::~MsgUnifiedEditorView |
137 // @see header file |
192 // @see header file |
138 //--------------------------------------------------------------- |
193 //--------------------------------------------------------------- |
139 MsgUnifiedEditorView::~MsgUnifiedEditorView() |
194 MsgUnifiedEditorView::~MsgUnifiedEditorView() |
140 { |
195 { |
|
196 // clean editor's temporary contents before exiting |
|
197 QDir tempDir = QDir(QString()); |
|
198 QString tempPath(editorTempPath()); |
|
199 tempDir.cd(tempPath); |
|
200 QStringList contentList(tempDir.entryList()); |
|
201 int contentCount = contentList.count(); |
|
202 for(int i=0; i<contentCount; i++) |
|
203 { |
|
204 tempDir.remove(contentList.at(i)); |
|
205 } |
|
206 tempDir.cdUp(); |
|
207 tempDir.rmdir(UNIFIED_EDITOR_TEMP_FOLDER); |
141 } |
208 } |
142 |
209 |
143 void MsgUnifiedEditorView::addMenu() |
210 void MsgUnifiedEditorView::addMenu() |
144 { |
211 { |
145 //Create Menu Options |
212 //Create Menu Options |
146 HbMenu* mainMenu = new HbMenu(); |
213 HbMenu* mainMenu = new HbMenu(); |
147 |
214 |
148 //TODO:These 2 should be submenu option to Add |
215 //TODO:These 2 should be submenu option to Add |
149 mSubjectAction = mainMenu->addAction(tr("Add Subject")); |
216 mSubjectAction = mainMenu->addAction(LOC_ADD_SUBJECT); |
150 mCcBccAction = mainMenu->addAction(tr("Add Cc/Bcc")); |
217 mCcBccAction = mainMenu->addAction(LOC_ADD_CC_BCC); |
151 |
218 |
152 mPrioritySubMenu = mainMenu->addMenu(tr("Add Priority")); |
219 HbMenu* prioritySubMenu = mainMenu->addMenu(LOC_PRIORITY); |
153 |
220 |
154 HbAction* highPriorityAction = mPrioritySubMenu->addAction(LOC_HIGH); |
221 HbAction* highPriorityAction = prioritySubMenu->addAction(LOC_HIGH); |
155 highPriorityAction->setData(ConvergedMessage::High); |
222 highPriorityAction->setData(ConvergedMessage::High); |
156 |
223 |
157 HbAction* normalPriorityAction = mPrioritySubMenu->addAction(LOC_NORMAL); |
224 HbAction* normalPriorityAction = prioritySubMenu->addAction(LOC_NORMAL); |
158 normalPriorityAction->setData(ConvergedMessage::Normal); |
225 normalPriorityAction->setData(ConvergedMessage::Normal); |
159 |
226 |
160 HbAction* lowPriorityAction = mPrioritySubMenu->addAction(LOC_LOW); |
227 HbAction* lowPriorityAction = prioritySubMenu->addAction(LOC_LOW); |
161 lowPriorityAction->setData(ConvergedMessage::Low); |
228 lowPriorityAction->setData(ConvergedMessage::Low); |
162 |
229 |
163 HbAction* sendOptionsAction = mainMenu->addAction(LOC_SENDING_OPTIONS); |
230 HbAction* sendOptionsAction = mainMenu->addAction(LOC_SENDING_OPTIONS); |
164 HbAction* deleteMsgAction = mainMenu->addAction(LOC_DELETE_MESSAGE); |
231 HbAction* deleteMsgAction = mainMenu->addAction(LOC_DELETE_MESSAGE); |
165 HbAction* helpAction = mainMenu->addAction(tr("Help")); |
|
166 |
232 |
167 connect(mSubjectAction,SIGNAL(triggered()),this, SLOT(addSubject())); |
233 connect(mSubjectAction,SIGNAL(triggered()),this, SLOT(addSubject())); |
168 connect(mCcBccAction,SIGNAL(triggered()),this, SLOT(addCcBcc())); |
234 connect(mCcBccAction,SIGNAL(triggered()),this, SLOT(addCcBcc())); |
169 connect(highPriorityAction, SIGNAL(triggered()), this, SLOT(changePriority())); |
235 connect(highPriorityAction, SIGNAL(triggered()), this, SLOT(changePriority())); |
170 connect(normalPriorityAction, SIGNAL(triggered()), this, SLOT(changePriority())); |
236 connect(normalPriorityAction, SIGNAL(triggered()), this, SLOT(changePriority())); |
171 connect(lowPriorityAction, SIGNAL(triggered()), this, SLOT(changePriority())); |
237 connect(lowPriorityAction, SIGNAL(triggered()), this, SLOT(changePriority())); |
172 connect(sendOptionsAction,SIGNAL(triggered()),this, SLOT(sendingOptions())); |
238 connect(sendOptionsAction,SIGNAL(triggered()),this, SLOT(sendingOptions())); |
173 connect(deleteMsgAction,SIGNAL(triggered()),this, SLOT(deleteMessage())); |
239 connect(deleteMsgAction,SIGNAL(triggered()),this, SLOT(deleteMessage())); |
174 connect(helpAction,SIGNAL(triggered()),this, SLOT(launchHelp())); |
|
175 |
240 |
176 setMenu(mainMenu); |
241 setMenu(mainMenu); |
177 } |
242 } |
178 |
243 |
179 void MsgUnifiedEditorView::openDraftsMessage(ConvergedMessageId& messageId, |
244 void MsgUnifiedEditorView::openDraftsMessage(const QVariantList& editorData) |
180 ConvergedMessage::MessageType messageType ) |
245 { |
181 { |
246 // unpack editor's data |
|
247 // first arg is convergedmessage |
|
248 QByteArray dataArray = editorData.at(0).toByteArray(); |
|
249 ConvergedMessage* messageDetails = new ConvergedMessage; |
|
250 QDataStream stream(&dataArray, QIODevice::ReadOnly); |
|
251 messageDetails->deserialize(stream); |
|
252 ConvergedMessage::MessageType messageType = messageDetails->messageType(); |
|
253 ConvergedMessageId messageId = *(messageDetails->id()); |
|
254 delete messageDetails; |
|
255 |
182 if(!mPluginLoader) |
256 if(!mPluginLoader) |
183 { |
257 { |
184 mPluginLoader = new UniEditorPluginLoader(this); |
258 mPluginLoader = new UniEditorPluginLoader(this); |
185 mPluginLoader->loadPlugins(); |
259 } |
186 } |
260 |
187 |
|
188 UniEditorPluginInterface* pluginInterface = |
261 UniEditorPluginInterface* pluginInterface = |
189 mPluginLoader->getUniEditorPlugin(messageType); |
262 mPluginLoader->getUniEditorPlugin(messageType); |
190 |
263 |
191 mOpenedMessageId.setId(messageId.getId()); |
264 mOpenedMessageId.setId(messageId.getId()); |
192 mmOpenedMessageType = messageType; |
265 mmOpenedMessageType = messageType; |
193 |
266 |
194 //Fetch the converged message from the msgId |
267 //Fetch the converged message from the msgId |
195 ConvergedMessage* msg; |
268 ConvergedMessage* msg; |
196 msg = pluginInterface->convertFrom(messageId.getId()); |
269 msg = pluginInterface->convertFrom(messageId.getId()); |
197 |
270 |
198 if( msg != NULL ) |
271 if( msg != NULL ) |
199 { |
272 { |
200 //Populate the content inside editor |
273 //Populate the content inside editor |
201 populateDraftsContent(*msg); |
274 populateContentIntoEditor(*msg); |
202 delete msg; |
275 delete msg; |
203 } |
276 } |
204 } |
277 } |
205 |
278 |
206 void MsgUnifiedEditorView::populateContent(const ConvergedMessage& messageDetails, int editorFields) |
279 void MsgUnifiedEditorView::forwardMessage(ConvergedMessageId& messageId, |
207 { |
280 ConvergedMessage::MessageType messageType ) |
208 mToField->setAddresses(messageDetails.toAddressList()); |
281 { |
209 QString bodyTxt = messageDetails.bodyText(); |
282 if(!mPluginLoader) |
210 mBody->setText(bodyTxt); |
283 { |
211 |
284 mPluginLoader = new UniEditorPluginLoader(this); |
212 int attachmentCount = messageDetails.attachments().count(); |
285 |
213 if(attachmentCount == 1) |
286 } |
214 { |
287 UniEditorPluginInterface* pluginInterface = NULL; |
215 int imageSize=0; |
288 if( messageType == ConvergedMessage::Mms ) |
216 QString mimeType; |
289 { |
217 TMsgMediaType mediaType = EMsgMediaUnknown; |
290 pluginInterface = |
218 QString filePath = messageDetails.attachments().at(0)->filePath(); |
291 mPluginLoader->getUniEditorPlugin(ConvergedMessage::Mms); |
219 UniEditorGenUtils* genUtils = new UniEditorGenUtils; |
292 } |
220 TRAP_IGNORE(genUtils->getFileInfoL(filePath,imageSize, |
293 else // For sms,vcard,vcal cases |
|
294 { |
|
295 pluginInterface = |
|
296 mPluginLoader->getUniEditorPlugin(ConvergedMessage::Sms); |
|
297 } |
|
298 |
|
299 //Fetch the converged message from the msgId |
|
300 ConvergedMessage* msg; |
|
301 msg = pluginInterface->convertFrom(messageId.getId(), |
|
302 UniEditorPluginInterface::Forward); |
|
303 |
|
304 if( msg != NULL ) |
|
305 { |
|
306 //Populate the content inside editor |
|
307 populateContentIntoEditor(*msg); |
|
308 delete msg; |
|
309 } |
|
310 } |
|
311 |
|
312 void MsgUnifiedEditorView::populateContent(const QVariantList& editorData) |
|
313 { |
|
314 // unpack editor's data |
|
315 // first arg is convergedmessage |
|
316 QByteArray dataArray = editorData.at(0).toByteArray(); |
|
317 ConvergedMessage* messageDetails = new ConvergedMessage; |
|
318 QDataStream stream(&dataArray, QIODevice::ReadOnly); |
|
319 messageDetails->deserialize(stream); |
|
320 |
|
321 // get next arg i.e. editor operation command |
|
322 int editorOp = 0; |
|
323 if(editorData.length() > 1) |
|
324 { |
|
325 editorOp = editorData.at(1).toInt(); |
|
326 } |
|
327 |
|
328 // population logic based on editor Operation command |
|
329 switch(editorOp) |
|
330 { |
|
331 case MsgBaseView::ADD_RECIPIENTS: |
|
332 { |
|
333 addCcBcc(); |
|
334 } |
|
335 break; |
|
336 case MsgBaseView::ADD_SUBJECT: |
|
337 { |
|
338 addSubject(); |
|
339 } |
|
340 break; |
|
341 case MsgBaseView::ADD_VCARD: |
|
342 { |
|
343 contactsFetched(editorData.at(2)); |
|
344 } |
|
345 break; |
|
346 case MsgBaseView::FORWARD_MSG: |
|
347 { |
|
348 forwardMessage(*messageDetails->id(), messageDetails->messageType()); |
|
349 } |
|
350 break; |
|
351 default: |
|
352 break; |
|
353 } |
|
354 |
|
355 // additional common operations for non-forwarded messages |
|
356 if(editorOp != MsgBaseView::FORWARD_MSG) |
|
357 { |
|
358 mToField->setAddresses(messageDetails->toAddressList()); |
|
359 QString bodyTxt = messageDetails->bodyText(); |
|
360 mBody->setText(bodyTxt); |
|
361 |
|
362 int attachmentCount = messageDetails->attachments().count(); |
|
363 QStringList pendingAttList; |
|
364 for(int i=0; i<attachmentCount; i++) |
|
365 { |
|
366 int imageSize=0; |
|
367 QString mimeType; |
|
368 TMsgMediaType mediaType = EMsgMediaUnknown; |
|
369 QString filePath = messageDetails->attachments().at(i)->filePath(); |
|
370 UniEditorGenUtils* genUtils = new UniEditorGenUtils; |
|
371 TRAP_IGNORE(genUtils->getFileInfoL(filePath,imageSize, |
221 mimeType,mediaType)); |
372 mimeType,mediaType)); |
222 delete genUtils; |
373 delete genUtils; |
223 switch(mediaType) |
374 switch(mediaType) |
224 { |
|
225 case EMsgMediaImage: |
|
226 { |
375 { |
227 mBody->setImage(filePath); |
376 case EMsgMediaImage: |
|
377 { |
|
378 mBody->setImage(filePath); |
|
379 addSubject(); |
|
380 } |
|
381 break; |
|
382 case EMsgMediaVideo: |
|
383 { |
|
384 mBody->setVideo(filePath); |
|
385 addSubject(); |
|
386 } |
|
387 break; |
|
388 case EMsgMediaAudio: |
|
389 { |
|
390 mBody->setAudio(filePath); |
|
391 addSubject(); |
|
392 } |
|
393 break; |
|
394 default: |
|
395 { |
|
396 pendingAttList << filePath; |
|
397 } |
228 break; |
398 break; |
229 } |
399 } |
230 case EMsgMediaVideo: |
400 } |
231 { |
401 // add pending attachments in bulk |
232 mBody->setVideo(filePath); |
402 addAttachments(pendingAttList); |
233 break; |
403 } |
234 } |
404 delete messageDetails; |
235 case EMsgMediaAudio: |
405 } |
236 { |
406 |
237 mBody->setAudio(filePath); |
407 void MsgUnifiedEditorView::populateContentIntoEditor( |
238 break; |
|
239 } |
|
240 case EMsgMediaUnknown: |
|
241 case EMsgMediaText: |
|
242 default: |
|
243 { |
|
244 addAttachment(filePath); |
|
245 break; |
|
246 } |
|
247 } |
|
248 |
|
249 addSubject(); |
|
250 } |
|
251 else if(attachmentCount > 1) |
|
252 { |
|
253 for(int i=0; i<attachmentCount; i++) |
|
254 { |
|
255 QString filePath = messageDetails.attachments().at(i)->filePath(); |
|
256 //TODO: put size checks and show size exceeded msg when appropriate |
|
257 addAttachment(filePath); |
|
258 } |
|
259 |
|
260 addSubject(); |
|
261 } |
|
262 |
|
263 if(editorFields & MsgBaseView::ADD_RECIPIENTS) |
|
264 { |
|
265 addCcBcc(); |
|
266 } |
|
267 else if(editorFields & MsgBaseView::ADD_SUBJECT) |
|
268 { |
|
269 addSubject(); |
|
270 } |
|
271 } |
|
272 |
|
273 void MsgUnifiedEditorView::populateDraftsContent( |
|
274 const ConvergedMessage& messageDetails) |
408 const ConvergedMessage& messageDetails) |
275 { |
409 { |
276 // skip first-time MMS type switch note for draft |
410 // skip first-time MMS type switch note for draft |
277 mNotifier->setSkipNote(); |
411 mMsgMonitor->setSkipNote(true); |
278 mToField->setAddresses(messageDetails.toAddressList()); |
412 mToField->setAddresses(messageDetails.toAddressList()); |
279 if(messageDetails.ccAddressList().count() > 0 ) |
413 if(messageDetails.ccAddressList().count() > 0 ) |
280 { |
414 { |
281 if(!mCcField) |
415 if(!mCcField) |
282 { |
416 { |
283 addCcBcc(); |
417 addCcBcc(); |
284 } |
418 } |
285 mCcField->setAddresses(messageDetails.ccAddressList()); |
419 mCcField->setAddresses(messageDetails.ccAddressList()); |
286 } |
420 } |
287 if(messageDetails.bccAddressList().count() > 0 ) |
421 if(messageDetails.bccAddressList().count() > 0 ) |
288 { |
422 { |
289 if(!mBccField) |
423 if(!mBccField) |
290 { |
424 { |
291 addCcBcc(); |
425 addCcBcc(); |
292 } |
426 } |
293 mBccField->setAddresses(messageDetails.bccAddressList()); |
427 mBccField->setAddresses(messageDetails.bccAddressList()); |
294 } |
428 } |
295 if(messageDetails.subject().size() > 0) |
429 if(messageDetails.subject().size() > 0) |
296 { |
430 { |
297 if(!mSubjectField) |
431 if(!mSubjectField) |
298 { |
432 { |
299 addSubject(); |
433 addSubject(); |
300 } |
434 } |
301 mSubjectField->setText(messageDetails.subject()); |
435 mSubjectField->setText(messageDetails.subject()); |
302 } |
436 } |
303 |
437 |
304 if(messageDetails.priority()==ConvergedMessage::High || |
438 if(messageDetails.priority()==ConvergedMessage::High || |
305 messageDetails.priority() == ConvergedMessage::Low) |
439 messageDetails.priority() == ConvergedMessage::Low) |
306 { |
440 { |
307 if(!mSubjectField) |
441 if(!mSubjectField) |
308 { |
442 { |
309 addSubject(); |
443 addSubject(); |
310 } |
444 } |
311 mSubjectField->setPriority(messageDetails.priority()); |
445 mSubjectField->setPriority(messageDetails.priority()); |
312 } |
446 } |
313 |
447 |
314 QString bodyTxt = messageDetails.bodyText(); |
448 QString bodyTxt = messageDetails.bodyText(); |
315 mBody->setText(bodyTxt); |
449 mBody->setText(bodyTxt); |
316 |
450 |
317 ConvergedMessageAttachmentList attachmentList = |
451 ConvergedMessageAttachmentList attachmentList = |
318 messageDetails.attachments(); |
452 messageDetails.attachments(); |
319 int attachmentCount = attachmentList.count(); |
453 int attachmentCount = attachmentList.count(); |
320 |
454 |
321 UniEditorGenUtils* genUtils = new UniEditorGenUtils; |
455 UniEditorGenUtils* genUtils = new UniEditorGenUtils; |
322 |
456 |
|
457 QStringList pendingAttList; |
323 for( int i=0; i < attachmentCount; i++ ) |
458 for( int i=0; i < attachmentCount; i++ ) |
324 { |
459 { |
325 QString filePath = messageDetails.attachments().at(i)->filePath(); |
460 QString filePath = messageDetails.attachments().at(i)->filePath(); |
326 |
461 |
327 if(attachmentList.at(i)->attachmentType() == |
462 if(attachmentList.at(i)->attachmentType() == |
328 ConvergedMessageAttachment::EInline) |
463 ConvergedMessageAttachment::EInline) |
329 { |
464 { |
330 int imageSize=0; |
465 int imageSize=0; |
331 QString mimeType; |
466 QString mimeType; |
332 TMsgMediaType mediaType = EMsgMediaUnknown; |
467 TMsgMediaType mediaType = EMsgMediaUnknown; |
333 TRAP_IGNORE(genUtils->getFileInfoL(filePath,imageSize, |
468 TRAP_IGNORE(genUtils->getFileInfoL(filePath,imageSize, |
334 mimeType,mediaType)); |
469 mimeType,mediaType)); |
335 |
470 |
336 switch(mediaType) |
471 switch(mediaType) |
337 { |
472 { |
338 case EMsgMediaImage: |
473 case EMsgMediaImage: |
339 { |
474 { |
340 mBody->setImage(filePath); |
475 mBody->setImage(filePath); |
|
476 addSubject(); |
341 break; |
477 break; |
342 } |
478 } |
343 case EMsgMediaVideo: |
479 case EMsgMediaVideo: |
344 { |
480 { |
345 mBody->setVideo(filePath); |
481 mBody->setVideo(filePath); |
|
482 addSubject(); |
346 break; |
483 break; |
347 } |
484 } |
348 case EMsgMediaAudio: |
485 case EMsgMediaAudio: |
349 { |
486 { |
350 mBody->setAudio(filePath); |
487 mBody->setAudio(filePath); |
|
488 addSubject(); |
351 break; |
489 break; |
352 } |
490 } |
353 case EMsgMediaUnknown: |
|
354 case EMsgMediaText: |
|
355 default: |
491 default: |
356 { |
492 { |
357 addAttachment(filePath); |
493 pendingAttList << filePath; |
358 break; |
494 break; |
359 } |
495 } |
360 } |
496 } |
361 } |
497 } |
362 else |
498 else |
363 { |
499 { |
364 addAttachment(filePath); |
500 pendingAttList << filePath; |
365 } |
501 } |
366 } |
502 } |
|
503 // add pending attachments to editor |
|
504 addAttachments(pendingAttList); |
|
505 |
367 delete genUtils; |
506 delete genUtils; |
|
507 // ensure that any msg-type change after this are shown |
|
508 mMsgMonitor->setSkipNote(false); |
368 } |
509 } |
369 |
510 |
370 void MsgUnifiedEditorView::addToolBar() |
511 void MsgUnifiedEditorView::addToolBar() |
371 { |
512 { |
372 //Create Tool Bar |
513 //Create Tool Bar |
373 HbToolBar *toolBar = new HbToolBar(); |
514 HbToolBar *toolBar = new HbToolBar(); |
374 toolBar->setOrientation(Qt::Horizontal); |
515 toolBar->setOrientation(Qt::Horizontal); |
|
516 |
|
517 //tool bar extension for attach action. |
|
518 HbToolBarExtension* attachExtension = new HbToolBarExtension(); |
|
519 HbAction *attachAction = toolBar->addExtension(attachExtension); |
|
520 attachAction->setIcon(HbIcon(ATTACH_ICON)); |
|
521 |
|
522 HbListWidget* extnList = new HbListWidget(); |
|
523 extnList->addItem(LOC_PHOTO); |
|
524 extnList->addItem(LOC_SOUND); |
|
525 extnList->addItem(LOC_BUSINESS_CARD); |
|
526 |
|
527 HbListViewItem *prototype = extnList->listItemPrototype(); |
|
528 HbFrameBackground frame(POPUP_LIST_FRAME, HbFrameDrawer::NinePieces); |
|
529 prototype->setDefaultFrame(frame); |
|
530 |
|
531 connect(extnList, SIGNAL(activated(HbListWidgetItem*)), this, |
|
532 SLOT(handleViewExtnActivated(HbListWidgetItem*))); |
|
533 connect(extnList, SIGNAL(activated(HbListWidgetItem*)), attachExtension, SLOT(close())); |
|
534 |
|
535 attachExtension->setContentWidget(extnList); |
375 |
536 |
376 //Add Action to the toolbar and show toolbar |
537 //Add Action to the toolbar and show toolbar |
377 HbAction* attachToolButton = toolBar->addAction(HbIcon(ATTACH_ICON), QString()); |
538 toolBar->addAction(HbIcon(SEND_ICON),QString(),this,SLOT(send())); |
378 HbAction* sendToolButton = toolBar->addAction(HbIcon(SEND_ICON), QString()); |
539 |
379 |
|
380 connect(attachToolButton, SIGNAL(triggered()), this, SLOT(showAttachmentPopup())); |
|
381 connect(sendToolButton, SIGNAL(triggered()), this, SLOT(send())); |
|
382 |
540 |
383 setToolBar(toolBar); |
541 setToolBar(toolBar); |
384 } |
542 } |
385 |
543 |
386 void MsgUnifiedEditorView::addSubject() |
544 void MsgUnifiedEditorView::addSubject() |
919 #endif |
1110 #endif |
920 |
1111 |
921 mContentWidget->resize(this->rect().width(),this->rect().height()+1); |
1112 mContentWidget->resize(this->rect().width(),this->rect().height()+1); |
922 } |
1113 } |
923 |
1114 |
|
1115 //--------------------------------------------------------------- |
|
1116 // editorTempPath |
|
1117 // @return fullPath of unified editor's temporary dir |
|
1118 //--------------------------------------------------------------- |
|
1119 QString editorTempPath() |
|
1120 { |
|
1121 QDir tempDir = QDir(QString()); |
|
1122 QString tempPath(QDir::toNativeSeparators(tempDir.tempPath())); |
|
1123 tempPath.append(QDir::separator()); |
|
1124 tempPath.append(UNIFIED_EDITOR_TEMP_FOLDER); |
|
1125 tempPath.append(QDir::separator()); |
|
1126 return tempPath; |
|
1127 } |
|
1128 |
|
1129 //--------------------------------------------------------------- |
|
1130 // MsgUnifiedEditorView::createVCards |
|
1131 // @see header file |
|
1132 //--------------------------------------------------------------- |
|
1133 int MsgUnifiedEditorView::createVCards( |
|
1134 const QVariant& value, QStringList& filelist) |
|
1135 { |
|
1136 // make sure that temp-folder is created for storing vcards |
|
1137 QDir tempDir = QDir(QString()); |
|
1138 if(!tempDir.mkpath(editorTempPath())) |
|
1139 { |
|
1140 return KErrGeneral; |
|
1141 } |
|
1142 tempDir.cd(editorTempPath()); |
|
1143 |
|
1144 |
|
1145 // extract contact-list |
|
1146 QContactManager* contactManager = new QContactManager("symbian"); |
|
1147 CntServicesContactList cntServicesContacts = qVariantValue<CntServicesContactList>(value); |
|
1148 int cntCount = cntServicesContacts.count(); |
|
1149 QList<QtMobility::QContact> contactList; |
|
1150 for(int i = 0; i < cntCount; i++ ) |
|
1151 { |
|
1152 contactList << contactManager->contact( cntServicesContacts.at(i).mContactId ); |
|
1153 } |
|
1154 delete contactManager; |
|
1155 |
|
1156 // get list of all versit-documents |
|
1157 QVersitDocument::VersitType versitType(QVersitDocument::VCard21Type); |
|
1158 QVersitContactExporter* exporter = new QVersitContactExporter(); |
|
1159 |
|
1160 bool ret_val = exporter->exportContacts(contactList, versitType); |
|
1161 QList<QtMobility::QVersitDocument> documentList = exporter->documents(); |
|
1162 |
|
1163 delete exporter; |
|
1164 |
|
1165 // loop though and create a vcard for each contact |
|
1166 QVersitWriter* writer = new QVersitWriter(); |
|
1167 for(int i = 0; i < cntCount; i++ ) |
|
1168 { |
|
1169 // buffer to hold vcard data fetched from contacts |
|
1170 QBuffer contactsbuf; |
|
1171 contactsbuf.open(QBuffer::ReadWrite); |
|
1172 writer->setDevice( &contactsbuf ); |
|
1173 |
|
1174 //write document data to buffer |
|
1175 QList<QtMobility::QVersitDocument> currDoc; |
|
1176 currDoc << documentList.at(i); |
|
1177 writer->startWriting(currDoc); |
|
1178 if(writer->waitForFinished()) |
|
1179 { |
|
1180 // generate file name |
|
1181 QString displayLabel = contactList.at(i).displayLabel(); |
|
1182 QString filepath = generateFileName(displayLabel); |
|
1183 QFile file(filepath); |
|
1184 if(file.open(QIODevice::WriteOnly)) |
|
1185 { |
|
1186 // trap ignore so that, incase of multiselection, other vcards are still created |
|
1187 QByteArray bufArr; |
|
1188 TRAP_IGNORE( |
|
1189 CBufBase* contactbufbase = CBufFlat::NewL(contactsbuf.size()); |
|
1190 CleanupStack::PushL(contactbufbase); |
|
1191 contactbufbase->InsertL( contactbufbase->Size(), |
|
1192 *XQConversions::qStringToS60Desc8( contactsbuf.data() ) ); |
|
1193 TPtr8 ptrbuf(contactbufbase->Ptr(0)); |
|
1194 bufArr = XQConversions::s60Desc8ToQByteArray(ptrbuf); |
|
1195 CleanupStack::PopAndDestroy(contactbufbase); |
|
1196 ); |
|
1197 file.write(bufArr); |
|
1198 file.close(); |
|
1199 filelist << filepath; |
|
1200 } |
|
1201 } |
|
1202 } |
|
1203 |
|
1204 // cleanup & return |
|
1205 delete writer; |
|
1206 return KErrNone; |
|
1207 } |
|
1208 |
|
1209 |
|
1210 //--------------------------------------------------------------- |
|
1211 // MsgUnifiedEditorView::generateFileName |
|
1212 // @param suggestedName suggested name of the file |
|
1213 // @return fullPath of the generated filename |
|
1214 // @algo For multiselected 'Unnamed' contacts, the filename should |
|
1215 // be synthesized as unnamed.vcf, unnamed1.vcf, unnamed2.vcf etc. |
|
1216 //--------------------------------------------------------------- |
|
1217 QString MsgUnifiedEditorView::generateFileName(QString& suggestedName) |
|
1218 { |
|
1219 QDir editorTempDir = QDir(QString()); |
|
1220 editorTempDir.cd(editorTempPath()); |
|
1221 |
|
1222 for(int i=0; i<MAX_VCARDS; i++) |
|
1223 { |
|
1224 QString searchFileName = suggestedName; |
|
1225 if(i>0) |
|
1226 { |
|
1227 searchFileName.append(QString::number(i)); |
|
1228 } |
|
1229 searchFileName.append(FILE_EXTN); |
|
1230 |
|
1231 // check if filename is already used by an attachment in container |
|
1232 bool alreadyExists = false; |
|
1233 if(mAttachmentContainer) |
|
1234 { |
|
1235 MsgUnifiedEditorAttachmentList attList = |
|
1236 mAttachmentContainer->attachmentList(); |
|
1237 int attCount = attList.count(); |
|
1238 for(int j=0; j<attCount; j++) |
|
1239 { |
|
1240 QFileInfo fileinfo(attList.at(j)->path()); |
|
1241 if(searchFileName == fileinfo.fileName()) |
|
1242 { |
|
1243 alreadyExists = true; |
|
1244 break; |
|
1245 } |
|
1246 } |
|
1247 } |
|
1248 |
|
1249 if(!alreadyExists) |
|
1250 { |
|
1251 if(i>0) |
|
1252 { |
|
1253 suggestedName.append(QString::number(i)); |
|
1254 } |
|
1255 break; |
|
1256 } |
|
1257 } |
|
1258 QString filepath(editorTempPath()); |
|
1259 filepath.append(suggestedName); |
|
1260 filepath.append(FILE_EXTN); |
|
1261 return filepath; |
|
1262 } |
|
1263 |
|
1264 void MsgUnifiedEditorView::handleViewExtnActivated(HbListWidgetItem* item) |
|
1265 { |
|
1266 QString itemText = item->text(); |
|
1267 |
|
1268 if(itemText == LOC_PHOTO) |
|
1269 { |
|
1270 //launch photo picker. |
|
1271 fetchImages(); |
|
1272 } |
|
1273 else if(itemText == LOC_SOUND) |
|
1274 { |
|
1275 //launch audio picker |
|
1276 fetchAudio(); |
|
1277 } |
|
1278 else if(itemText == LOC_BUSINESS_CARD) |
|
1279 { |
|
1280 //launch contact card picker. |
|
1281 fetchContacts(); |
|
1282 } |
|
1283 |
|
1284 } |
|
1285 |
|
1286 //--------------------------------------------------------------- |
|
1287 // MsgUnifiedEditorView::fetchContacts |
|
1288 // @see header file |
|
1289 //--------------------------------------------------------------- |
|
1290 void MsgUnifiedEditorView::fetchContacts() |
|
1291 { |
|
1292 QList<QVariant> args; |
|
1293 QString serviceName("com.nokia.services.phonebookservices"); |
|
1294 QString operation("fetch(QString,QString,QString)"); |
|
1295 XQAiwRequest* request; |
|
1296 XQApplicationManager appManager; |
|
1297 request = appManager.create(serviceName, "Fetch", operation, true); //embedded |
|
1298 if ( request == NULL ) |
|
1299 { |
|
1300 QCRITICAL_WRITE("AIW-ERROR: NULL request"); |
|
1301 return; |
|
1302 } |
|
1303 |
|
1304 // Result handlers |
|
1305 connect (request, SIGNAL(requestOk(const QVariant&)), |
|
1306 this, SLOT(contactsFetched(const QVariant&))); |
|
1307 connect (request, SIGNAL(requestError(int,const QString&)), |
|
1308 this, SLOT(serviceRequestError(int,const QString&))); |
|
1309 |
|
1310 args << QString(tr("Phonebook")); |
|
1311 args << KCntActionAll; |
|
1312 args << KCntFilterDisplayAll; |
|
1313 |
|
1314 request->setArguments(args); |
|
1315 if(!request->send()) |
|
1316 { |
|
1317 QDEBUG_WRITE_FORMAT("AIW-ERROR: Request Send failed:",request->lastError()); |
|
1318 } |
|
1319 delete request; |
|
1320 } |
|
1321 |
|
1322 //--------------------------------------------------------------- |
|
1323 // MsgUnifiedEditorView::fetchImages |
|
1324 // @see header file |
|
1325 //--------------------------------------------------------------- |
|
1326 void MsgUnifiedEditorView::fetchImages() |
|
1327 { |
|
1328 QString interface("Image"); |
|
1329 QString operation("fetch(QVariantMap,QVariant)"); |
|
1330 XQAiwRequest* request = NULL; |
|
1331 XQApplicationManager appManager; |
|
1332 request = appManager.create(interface, operation, true);//embedded |
|
1333 if(!request) |
|
1334 { |
|
1335 QCRITICAL_WRITE("AIW-ERROR: NULL request"); |
|
1336 return; |
|
1337 } |
|
1338 |
|
1339 connect(request, SIGNAL(requestOk(const QVariant&)), |
|
1340 this, SLOT(imagesFetched(const QVariant&))); |
|
1341 connect(request, SIGNAL(requestError(int,const QString&)), |
|
1342 this, SLOT(serviceRequestError(int,const QString&))); |
|
1343 |
|
1344 // Make the request |
|
1345 if (!request->send()) |
|
1346 { |
|
1347 QDEBUG_WRITE_FORMAT("AIW-ERROR: Request Send failed:" , request->lastError()); |
|
1348 } |
|
1349 delete request; |
|
1350 } |
|
1351 |
|
1352 //--------------------------------------------------------------- |
|
1353 // MsgUnifiedEditorView::fetchAudio |
|
1354 // @see header file |
|
1355 //--------------------------------------------------------------- |
|
1356 void MsgUnifiedEditorView::fetchAudio() |
|
1357 { |
|
1358 QString service("Music Fetcher"); |
|
1359 QString interface("com.nokia.services.media.Music"); |
|
1360 QString operation("fetch(QString)"); |
|
1361 XQAiwRequest* request = NULL; |
|
1362 XQApplicationManager appManager; |
|
1363 request = appManager.create(service, interface, operation, true); //embedded |
|
1364 if(!request) |
|
1365 { |
|
1366 QCRITICAL_WRITE("AIW-ERROR: NULL request"); |
|
1367 return; |
|
1368 } |
|
1369 |
|
1370 connect(request, SIGNAL(requestOk(const QVariant&)), |
|
1371 this, SLOT(audiosFetched(const QVariant&))); |
|
1372 connect(request, SIGNAL(requestError(int,const QString&)), |
|
1373 this, SLOT(serviceRequestError(int,const QString&))); |
|
1374 |
|
1375 // Make the request |
|
1376 if (!request->send()) |
|
1377 { |
|
1378 QDEBUG_WRITE_FORMAT("AIW-ERROR: Request Send failed :",request->lastError()); |
|
1379 } |
|
1380 delete request; |
|
1381 } |
|
1382 |
|
1383 //--------------------------------------------------------------- |
|
1384 // MsgUnifiedEditorView::contactsFetched |
|
1385 // @see header file |
|
1386 //--------------------------------------------------------------- |
|
1387 void MsgUnifiedEditorView::contactsFetched(const QVariant& value) |
|
1388 { |
|
1389 // create a vcard for each contact fetched and add as attachment |
|
1390 QStringList attachmentList; |
|
1391 if(createVCards(value, attachmentList) == KErrNone) |
|
1392 { |
|
1393 addAttachments(attachmentList); |
|
1394 } |
|
1395 } |
|
1396 |
|
1397 //--------------------------------------------------------------- |
|
1398 // MsgUnifiedEditorView::imagesFetched |
|
1399 // @see header file |
|
1400 //--------------------------------------------------------------- |
|
1401 void MsgUnifiedEditorView::imagesFetched(const QVariant& result ) |
|
1402 { |
|
1403 if(result.canConvert<QStringList>()) |
|
1404 { |
|
1405 QStringList fileList = result.value<QStringList>(); |
|
1406 if ( fileList.size()>0 ) |
|
1407 { |
|
1408 QString filepath(QDir::toNativeSeparators(fileList.at(0))); |
|
1409 mBody->setImage(filepath); |
|
1410 addSubject(); |
|
1411 } |
|
1412 } |
|
1413 } |
|
1414 |
|
1415 //--------------------------------------------------------------- |
|
1416 // MsgUnifiedEditorView::audiosFetched |
|
1417 // @see header file |
|
1418 //--------------------------------------------------------------- |
|
1419 void MsgUnifiedEditorView::audiosFetched(const QVariant& result ) |
|
1420 { |
|
1421 if(result.canConvert<QStringList>()) |
|
1422 { |
|
1423 QStringList fileList = result.value<QStringList>(); |
|
1424 if ( fileList.size()>0 && !fileList.at(0).isEmpty()) |
|
1425 { |
|
1426 QString filepath(QDir::toNativeSeparators(fileList.at(0))); |
|
1427 QDEBUG_WRITE_FORMAT("Received audio file path = ", fileList.at(0)); |
|
1428 mBody->setAudio(filepath); |
|
1429 addSubject(); |
|
1430 } |
|
1431 } |
|
1432 } |
|
1433 |
|
1434 //--------------------------------------------------------------- |
|
1435 // MsgUnifiedEditorView::serviceRequestError |
|
1436 // @see header file |
|
1437 //--------------------------------------------------------------- |
|
1438 void MsgUnifiedEditorView::serviceRequestError(int errorCode, const QString& errorMessage) |
|
1439 { |
|
1440 QDEBUG_WRITE_FORMAT(errorMessage,errorCode); |
|
1441 } |
|
1442 |
|
1443 //--------------------------------------------------------------- |
|
1444 // MsgUnifiedEditorView::activateInputBlocker |
|
1445 // @see header file |
|
1446 //-------------------------------------------------------------- |
|
1447 void MsgUnifiedEditorView::activateInputBlocker() |
|
1448 { |
|
1449 this->grabMouse(); |
|
1450 this->grabKeyboard(); |
|
1451 } |
|
1452 |
|
1453 //--------------------------------------------------------------- |
|
1454 // MsgUnifiedEditorView::deactivateInputBlocker |
|
1455 // @see header file |
|
1456 //-------------------------------------------------------------- |
|
1457 void MsgUnifiedEditorView::deactivateInputBlocker() |
|
1458 { |
|
1459 this->ungrabKeyboard(); |
|
1460 this->ungrabMouse(); |
|
1461 } |
|
1462 |
924 //EOF |
1463 //EOF |