messagingapp/msgui/conversationview/src/msgconversationview.cpp
changeset 43 35b64624a9e7
parent 34 84197e66a4bd
child 44 36f374c67aa8
equal deleted inserted replaced
34:84197e66a4bd 43:35b64624a9e7
    55 #include "unidatamodelloader.h"
    55 #include "unidatamodelloader.h"
    56 #include "unidatamodelplugininterface.h"
    56 #include "unidatamodelplugininterface.h"
    57 #include "ringbc.h"
    57 #include "ringbc.h"
    58 #include "mmsconformancecheck.h"
    58 #include "mmsconformancecheck.h"
    59 #include "msgsettingsview.h"
    59 #include "msgsettingsview.h"
       
    60 #include "msgaudiofetcherview.h"
    60 
    61 
    61 //Item specific menu.
    62 //Item specific menu.
    62 
    63 
    63 #define LOC_COMMON_OPEN hbTrId("txt_common_menu_open")
    64 #define LOC_COMMON_OPEN hbTrId("txt_common_menu_open")
    64 #define LOC_COMMON_DELETE hbTrId("txt_common_menu_delete")
    65 #define LOC_COMMON_DELETE hbTrId("txt_common_menu_delete")
    69 #define LOC_BUTTON_DELETE hbTrId("txt_common_button_delete")
    70 #define LOC_BUTTON_DELETE hbTrId("txt_common_button_delete")
    70 #define LOC_BUTTON_CANCEL hbTrId("txt_common_button_cancel")
    71 #define LOC_BUTTON_CANCEL hbTrId("txt_common_button_cancel")
    71 #define LOC_BUTTON_OK hbTrId("txt_common_button_ok")
    72 #define LOC_BUTTON_OK hbTrId("txt_common_button_ok")
    72 
    73 
    73 #define LOC_DELETE_MESSAGE hbTrId("txt_messaging_dialog_delete_message")
    74 #define LOC_DELETE_MESSAGE hbTrId("txt_messaging_dialog_delete_message")
       
    75 #define LOC_SAVE_TO_CONTACTS hbTrId("txt_messaging_menu_save_to_contacts")
    74 
    76 
    75 //main menu
    77 //main menu
    76 #define LOC_ATTACH          hbTrId("txt_messaging_opt_attach")
    78 #define LOC_ATTACH          hbTrId("txt_messaging_opt_attach")
    77 #define LOC_PHOTO           hbTrId("txt_messaging_opt_attach_sub_photo")
    79 #define LOC_PHOTO           hbTrId("txt_messaging_opt_attach_sub_photo")
    78 #define LOC_SOUND           hbTrId("txt_messaging_opt_attach_sub_sound")
    80 #define LOC_SOUND           hbTrId("txt_messaging_opt_attach_sub_sound")
   322         (messageSubType == ConvergedMessage::RingingTone) ||
   324         (messageSubType == ConvergedMessage::RingingTone) ||
   323         (messageType == ConvergedMessage::MmsNotification))
   325         (messageType == ConvergedMessage::MmsNotification))
   324         {
   326         {
   325         return;
   327         return;
   326         }
   328         }
   327     
   329     if ((messageSubType == ConvergedMessage::VCard) &&
       
   330         (direction == ConvergedMessage::Incoming))
       
   331         {
       
   332         HbAction *contextItem = contextMenu->addAction(LOC_SAVE_TO_CONTACTS);
       
   333         connect(contextItem, SIGNAL(triggered()),this, SLOT(openItem()));
       
   334         return;
       
   335         }
   328     if( (sendingState == ConvergedMessage::SentState ) ||
   336     if( (sendingState == ConvergedMessage::SentState ) ||
   329         (sendingState == ConvergedMessage::Resend ) ||
   337         (sendingState == ConvergedMessage::Resend ) ||
   330         (sendingState == ConvergedMessage::Failed ) ||
   338         (sendingState == ConvergedMessage::Failed ) ||
   331         (direction == ConvergedMessage::Incoming))
   339         (direction == ConvergedMessage::Incoming))
   332     {
   340     {
   544 //---------------------------------------------------------------
   552 //---------------------------------------------------------------
   545 void MsgConversationView::fetchImages()
   553 void MsgConversationView::fetchImages()
   546 {
   554 {
   547     QString service("photos");
   555     QString service("photos");
   548     QString interface("com.nokia.symbian.IImageFetch");
   556     QString interface("com.nokia.symbian.IImageFetch");
   549     QString operation("fetch(void)");
   557     QString operation("fetch()");
   550     XQAiwRequest* request = NULL;
   558     XQAiwRequest* request = NULL;
   551     XQApplicationManager appManager;
   559     XQApplicationManager appManager;
   552     request = appManager.create(service,interface, operation, true); // embedded
   560     request = appManager.create(service,interface, operation, true); // embedded
   553     request->setSynchronous(true); // synchronous
   561     request->setSynchronous(true); // synchronous
   554     if(!request)
   562     if(!request)
   574 // MsgConversationView::fetchAudio
   582 // MsgConversationView::fetchAudio
   575 // @see header file
   583 // @see header file
   576 //---------------------------------------------------------------
   584 //---------------------------------------------------------------
   577 void MsgConversationView::fetchAudio()
   585 void MsgConversationView::fetchAudio()
   578 {
   586 {
   579     QString service("musicplayer");
   587     // Launch Audio fetcher view
   580     QString interface("com.nokia.symbian.IMusicFetch");
   588     QVariantList params;
   581     QString operation("fetch()");
   589     params << MsgBaseView::AUDIOFETCHER; // target view
   582     XQAiwRequest* request = NULL;
   590     params << MsgBaseView::CV; // source view
   583     XQApplicationManager appManager;
   591     emit switchView(params);
   584     request = appManager.create(service, interface, operation, true); //embedded
       
   585     request->setSynchronous(true); // synchronous
       
   586     if(!request)
       
   587     {
       
   588         QDEBUG_WRITE("AIW-ERROR: NULL request");
       
   589         return;
       
   590     }
       
   591 
       
   592     connect(request, SIGNAL(requestOk(const QVariant&)),
       
   593         this, SLOT(audiosFetched(const QVariant&)));
       
   594     connect(request, SIGNAL(requestError(int,const QString&)),
       
   595         this, SLOT(serviceRequestError(int,const QString&)));
       
   596 
       
   597     // Make the request
       
   598     if (!request->send())
       
   599     {
       
   600         QDEBUG_WRITE_FORMAT("AIW-ERROR: Request Send failed  ",request->lastError());
       
   601     }
       
   602     delete request;
       
   603 }
   592 }
   604 
   593 
   605 //---------------------------------------------------------------
   594 //---------------------------------------------------------------
   606 // MsgConversationView::contactsFetched
   595 // MsgConversationView::contactsFetched
   607 // @see header file
   596 // @see header file
   632         if ( fileList.size()>0 )
   621         if ( fileList.size()>0 )
   633         {
   622         {
   634             QString filepath(QDir::toNativeSeparators(fileList.at(0)));
   623             QString filepath(QDir::toNativeSeparators(fileList.at(0)));
   635             QVariantList params;
   624             QVariantList params;
   636             params << MsgBaseView::ADD_PHOTO;
   625             params << MsgBaseView::ADD_PHOTO;
   637             params << filepath;
       
   638             launchUniEditor(params);
       
   639         }
       
   640     }
       
   641 }
       
   642 
       
   643 //---------------------------------------------------------------
       
   644 // MsgConversationView::audiosFetched()
       
   645 // @see header file
       
   646 //---------------------------------------------------------------
       
   647 void MsgConversationView::audiosFetched(const QVariant& result )
       
   648 {
       
   649     if(result.canConvert<QStringList>())
       
   650     {
       
   651         QStringList fileList = result.value<QStringList>();
       
   652         if ( fileList.size()>0 && !fileList.at(0).isEmpty())
       
   653         {
       
   654             QString filepath(QDir::toNativeSeparators(fileList.at(0)));
       
   655             QVariantList params;
       
   656             params << MsgBaseView::ADD_AUDIO;
       
   657             params << filepath;
   626             params << filepath;
   658             launchUniEditor(params);
   627             launchUniEditor(params);
   659         }
   628         }
   660     }
   629     }
   661 }
   630 }
   769 
   738 
   770 //---------------------------------------------------------------
   739 //---------------------------------------------------------------
   771 // MsgConversationView::saveContentToDrafts()
   740 // MsgConversationView::saveContentToDrafts()
   772 // @See header
   741 // @See header
   773 //---------------------------------------------------------------
   742 //---------------------------------------------------------------
   774 bool MsgConversationView::saveContentToDrafts()
   743 int MsgConversationView::saveContentToDrafts()
   775 {
   744 {
   776     int msgId = INVALID_MSGID;
   745     int msgId = INVALID_MSGID;
   777     if(!mEditorWidget->content().isEmpty())
   746     if(!mEditorWidget->content().isEmpty())
   778     {
   747     {
   779         activateInputBlocker();
   748         activateInputBlocker();
   792                      
   761                      
   793             mEditorWidget->clear();
   762             mEditorWidget->clear();
   794         }
   763         }
   795         deactivateInputBlocker();
   764         deactivateInputBlocker();
   796     }
   765     }
   797     return ((msgId > INVALID_MSGID)? true : false);
   766     return msgId;
   798 }
   767 }
   799 
   768 
   800 //---------------------------------------------------------------
   769 //---------------------------------------------------------------
   801 //MsgConversationView::populateForSending()
   770 //MsgConversationView::populateForSending()
   802 //@see header
   771 //@see header