29 #include <hbmessagebox.h> |
29 #include <hbmessagebox.h> |
30 #include <hbframebackground.h> |
30 #include <hbframebackground.h> |
31 #include <QSortFilterProxyModel> |
31 #include <QSortFilterProxyModel> |
32 #include <QGraphicsLinearLayout> |
32 #include <QGraphicsLinearLayout> |
33 #include <hblistviewitem.h> |
33 #include <hblistviewitem.h> |
34 #include <HbStyleLoader> |
34 #include <hbstyleloader.h> |
35 #include <HbMainWindow> |
35 #include <hbmainwindow.h> |
36 #include <xqaiwrequest.h> |
36 #include <xqaiwrequest.h> |
|
37 #include <xqaiwdecl.h> |
37 #include <xqappmgr.h> |
38 #include <xqappmgr.h> |
38 #include <qtcontacts.h> |
39 #include <qtcontacts.h> |
39 |
40 |
40 // USER INCLUDES |
41 // USER INCLUDES |
41 #include "msgconversationviewinterface.h" |
42 #include "msgconversationviewinterface.h" |
48 QTM_USE_NAMESPACE |
49 QTM_USE_NAMESPACE |
49 |
50 |
50 //Icons |
51 //Icons |
51 const QString POPUP_LIST_FRAME("qtg_fr_popup_list_normal"); |
52 const QString POPUP_LIST_FRAME("qtg_fr_popup_list_normal"); |
52 const QString NEW_MESSAGE_ICON("qtg_mono_create_message"); |
53 const QString NEW_MESSAGE_ICON("qtg_mono_create_message"); |
53 const QString SORT_ICON("qtg_mono_sort"); |
54 const QString SORT_ICON("qtg_mono_show_view"); |
54 |
55 |
55 //Localized constants |
56 //Localized constants |
56 |
57 |
57 #define LOC_DIALOG_DELETE_CONVERSATION hbTrId("txt_messaging_dialog_delete_conversation") |
58 #define LOC_DIALOG_DELETE_CONVERSATION hbTrId("txt_messaging_dialog_delete_conversation") |
58 #define LOC_DIALOG_UNABLE_TO_DELETE_CONVERSATION hbTrId("txt_messaging_dialog_unable_to_delete_conversation") |
59 #define LOC_DIALOG_UNABLE_TO_DELETE_CONVERSATION hbTrId("txt_messaging_dialog_unable_to_delete_conversation") |
59 |
60 |
60 //itemspecific menu |
61 //itemspecific menu |
61 #define LOC_OPEN hbTrId("txt_common_menu_open") |
62 #define LOC_OPEN hbTrId("txt_common_menu_open") |
62 #define LOC_SAVETO_CONTACTS hbTrId("txt_messaging_menu_save_to_contacts") |
|
63 #define LOC_DELETE_CONVERSATION hbTrId("txt_messaging_menu_delete_conversation") |
63 #define LOC_DELETE_CONVERSATION hbTrId("txt_messaging_menu_delete_conversation") |
64 #define LOC_OPEN_CONTACT_INFO hbTrId("txt_messaging_menu_contact_info") |
64 #define LOC_OPEN_CONTACT_INFO hbTrId("txt_messaging_menu_contact_info") |
65 |
65 |
66 //main menu |
66 //main menu |
67 #define LOC_SETTINGS hbTrId("txt_messaging_opt_settings") |
67 #define LOC_SETTINGS hbTrId("txt_messaging_opt_settings") |
127 //open menu option |
127 //open menu option |
128 contextMenu->addAction(LOC_OPEN,this,SLOT(openConversation())); |
128 contextMenu->addAction(LOC_OPEN,this,SLOT(openConversation())); |
129 |
129 |
130 //save to contacts for unresolved. |
130 //save to contacts for unresolved. |
131 int msgType = viewItem->modelIndex().data(MessageType).toInt(); |
131 int msgType = viewItem->modelIndex().data(MessageType).toInt(); |
132 if(msgType == ConvergedMessage::Sms || |
132 if (msgType == ConvergedMessage::Sms || |
133 msgType == ConvergedMessage::Mms || |
133 msgType == ConvergedMessage::Mms || |
134 msgType == ConvergedMessage::BioMsg) |
134 msgType == ConvergedMessage::BioMsg) |
135 { |
135 { |
136 qint64 contactId = mMsgList->currentIndex().data(ContactId).toLongLong(); |
136 contextMenu->addAction(LOC_OPEN_CONTACT_INFO, this, SLOT(contactInfo())); |
137 if(contactId < 0) |
137 } |
138 { |
|
139 contextMenu->addAction(LOC_SAVETO_CONTACTS,this,SLOT(saveToContacts())); |
|
140 } |
|
141 else |
|
142 { |
|
143 contextMenu->addAction(LOC_OPEN_CONTACT_INFO,this,SLOT(contactInfo())); |
|
144 } |
|
145 } |
|
146 |
138 |
147 //delete conversation |
139 //delete conversation |
148 contextMenu->addAction(LOC_DELETE_CONVERSATION,this,SLOT(deleteItem())); |
140 contextMenu->addAction(LOC_DELETE_CONVERSATION,this,SLOT(deleteItem())); |
149 |
141 |
150 contextMenu->setPreferredPos(point); |
142 contextMenu->setPreferredPos(point); |
363 |
355 |
364 disconnect(this->mainWindow(),SIGNAL(viewReady()),this,SLOT(doDelayedConstruction())); |
356 disconnect(this->mainWindow(),SIGNAL(viewReady()),this,SLOT(doDelayedConstruction())); |
365 } |
357 } |
366 |
358 |
367 //--------------------------------------------------------------- |
359 //--------------------------------------------------------------- |
368 // MsgListView::saveToContacts |
360 // MsgListView::contactInfo |
369 // @see header |
361 // @see header |
370 //--------------------------------------------------------------- |
362 //--------------------------------------------------------------- |
371 void MsgListView::saveToContacts() |
363 void MsgListView::contactInfo() |
372 { |
364 { |
373 //save to contacts with phone number field prefilled. |
365 QList<QVariant> args; |
374 QList<QVariant> args; |
366 XQAiwRequest* request = NULL; |
375 |
|
376 QString data = mMsgList->currentIndex().data(DisplayName).toString(); |
|
377 |
|
378 QString type = QContactPhoneNumber::DefinitionName; |
|
379 |
|
380 args << type; |
|
381 args << data; |
|
382 |
|
383 //service stuff. |
|
384 QString service("phonebookservices"); |
|
385 QString interface("com.nokia.symbian.IContactsEdit"); |
|
386 QString operation("editCreateNew(QString,QString)"); |
|
387 |
|
388 XQAiwRequest* request; |
|
389 XQApplicationManager appManager; |
367 XQApplicationManager appManager; |
390 request = appManager.create(service, interface, operation, true); // embedded |
368 |
391 if ( request == NULL ) |
369 int contactId = mMsgList->currentIndex().data(ContactId).toInt(); |
392 { |
370 |
393 return; |
371 if (contactId < 0) { |
394 } |
372 // open temp contact card |
|
373 request = appManager.create(XQI_CONTACTS_VIEW, |
|
374 XQOP_CONTACTS_VIEW_TEMP_CONTACT_CARD_WITH_DETAIL, true); // Embedded |
|
375 args << QContactPhoneNumber::DefinitionName; // Type |
|
376 args << mMsgList->currentIndex().data(DisplayName).toString(); // Actual data |
|
377 } |
|
378 else { |
|
379 // open existing contact card |
|
380 request = appManager.create(XQI_CONTACTS_VIEW, XQOP_CONTACTS_VIEW_CONTACT_CARD, true); // Embedded |
|
381 args << contactId; |
|
382 } |
|
383 |
|
384 if (request == NULL) { |
|
385 return; |
|
386 } |
395 |
387 |
396 request->setArguments(args); |
388 request->setArguments(args); |
397 request->send(); |
389 request->send(); |
398 |
390 |
399 delete request; |
391 delete request; |
400 } |
392 } |
401 |
|
402 //--------------------------------------------------------------- |
|
403 // MsgListView::contactInfo |
|
404 // @see header |
|
405 //--------------------------------------------------------------- |
|
406 void MsgListView::contactInfo() |
|
407 { |
|
408 //open contact info. |
|
409 QList<QVariant> args; |
|
410 |
|
411 int contactId = mMsgList->currentIndex().data(ContactId).toInt(); |
|
412 |
|
413 args << contactId; |
|
414 |
|
415 //service stuff. |
|
416 QString service("phonebookservices"); |
|
417 QString interface("com.nokia.symbian.IContactsView"); |
|
418 QString operation("openContactCard(int)"); |
|
419 |
|
420 XQAiwRequest* request; |
|
421 XQApplicationManager appManager; |
|
422 request = appManager.create(service, interface, operation, true); // embedded |
|
423 if ( request == NULL ) |
|
424 { |
|
425 return; |
|
426 } |
|
427 |
|
428 request->setArguments(args); |
|
429 request->send(); |
|
430 |
|
431 delete request; |
|
432 } |
|
433 |
393 |
434 //--------------------------------------------------------------- |
394 //--------------------------------------------------------------- |
435 // MsgListView::onDialogDeleteMsg |
395 // MsgListView::onDialogDeleteMsg |
436 // @see header |
396 // @see header |
437 //--------------------------------------------------------------- |
397 //--------------------------------------------------------------- |