messagingapp/msgui/conversationview/src/msgconversationview.cpp
changeset 27 e4592d119491
parent 25 84d9eb65b26f
child 47 5b14749788d7
equal deleted inserted replaced
25:84d9eb65b26f 27:e4592d119491
    21 #include <HbMenu>
    21 #include <HbMenu>
    22 #include <HbAction>
    22 #include <HbAction>
    23 #include <HbListView>
    23 #include <HbListView>
    24 #include <HbMessageBox>
    24 #include <HbMessageBox>
    25 #include <HbNotificationDialog>
    25 #include <HbNotificationDialog>
       
    26 #include <HbFrameBackground>
    26 #include <XQServiceRequest.h>
    27 #include <XQServiceRequest.h>
    27 #include <HbStaticVkbHost>
    28 #include <HbStaticVkbHost>
       
    29 #include <HbStyleLoader>
    28 #include <xqaiwrequest.h>
    30 #include <xqaiwrequest.h>
    29 #include <xqappmgr.h>
    31 #include <xqappmgr.h>
    30 
    32 
    31 #include <QDir>
    33 #include <QDir>
    32 #include <QDateTime>
    34 #include <QDateTime>
    50 #include "debugtraces.h"
    52 #include "debugtraces.h"
    51 #include "unidatamodelloader.h"
    53 #include "unidatamodelloader.h"
    52 #include "unidatamodelplugininterface.h"
    54 #include "unidatamodelplugininterface.h"
    53 #include "ringbc.h"
    55 #include "ringbc.h"
    54 #include "mmsconformancecheck.h"
    56 #include "mmsconformancecheck.h"
       
    57 #include "msgsettingsview.h"
    55 
    58 
    56 //Item specific menu.
    59 //Item specific menu.
    57 
    60 
    58 #define LOC_COMMON_OPEN hbTrId("txt_common_menu_open")
    61 #define LOC_COMMON_OPEN hbTrId("txt_common_menu_open")
    59 #define LOC_COMMON_DELETE hbTrId("txt_common_menu_delete")
    62 #define LOC_COMMON_DELETE hbTrId("txt_common_menu_delete")
    60 #define LOC_COMMON_FORWARD hbTrId("txt_common_menu_forward")
    63 #define LOC_COMMON_FORWARD hbTrId("txt_common_menu_forward")
    61 #define LOC_COMMON_DOWNLOAD hbTrId("txt_messaging_menu_download")
    64 #define LOC_COMMON_DOWNLOAD hbTrId("txt_messaging_menu_download")
    62 #define LOC_COMMON_SEND  hbTrId("txt_common_menu_send") 
    65 #define LOC_COMMON_SEND  hbTrId("txt_common_menu_send") 
    63 
    66 #define LOC_COMMON_SAVE  hbTrId("txt_common_menu_save")
    64 #define LOC_BUTTON_DELETE hbTrId("txt_common_button_delete")
    67 #define LOC_BUTTON_DELETE hbTrId("txt_common_button_delete")
    65 #define LOC_BUTTON_CANCEL hbTrId("txt_common_button_cancel")
    68 #define LOC_BUTTON_CANCEL hbTrId("txt_common_button_cancel")
    66 #define LOC_BUTTON_OK hbTrId("txt_common_button_ok")
    69 #define LOC_BUTTON_OK hbTrId("txt_common_button_ok")
    67 
    70 
    68 #define LOC_DELETE_MESSAGE hbTrId("txt_messaging_dialog_delete_message")
    71 #define LOC_DELETE_MESSAGE hbTrId("txt_messaging_dialog_delete_message")
    75 #define LOC_ADD_RECIPIENTS  hbTrId("txt_messaging_opt_add_recipients")
    78 #define LOC_ADD_RECIPIENTS  hbTrId("txt_messaging_opt_add_recipients")
    76 #define LOC_ADD_SUBJECT     hbTrId("txt_messaging_opt_add_subject")
    79 #define LOC_ADD_SUBJECT     hbTrId("txt_messaging_opt_add_subject")
    77 
    80 
    78 #define LOC_MSG_SEND_FAILED hbTrId("txt_messaging_dpopinfo_sending_failed")
    81 #define LOC_MSG_SEND_FAILED hbTrId("txt_messaging_dpopinfo_sending_failed")
    79 
    82 
    80 
    83 #define LOC_DIALOG_SMS_SETTINGS_INCOMPLETE hbTrId("txt_messaging_dialog_sms_settings_incomplete")
    81 const QString PLUGINPATH("conversationviewplugin.dll");
    84 #define LOC_DIALOG_SAVE_RINGTONE hbTrId("txt_conversations_dialog_save_ringing_tone")
       
    85 
       
    86 
    82 
    87 
    83 const int INVALID_MSGID = -1;
    88 const int INVALID_MSGID = -1;
    84 const int INVALID_CONVID = -1;
    89 const int INVALID_CONVID = -1;
    85 const int CONTACT_INSERTION_MODE = 1;
    90 const int CONTACT_INSERTION_MODE = 1;
    86 const int VCARD_INSERTION_MODE = 0;
    91 const int VCARD_INSERTION_MODE = 0;
   122 //---------------------------------------------------------------
   127 //---------------------------------------------------------------
   123 void MsgConversationView::setupView()
   128 void MsgConversationView::setupView()
   124 {
   129 {
   125     // Create HbListView and set properties
   130     // Create HbListView and set properties
   126     mConversationList = new HbListView();
   131     mConversationList = new HbListView();
   127     style()->registerPlugin(PLUGINPATH);
   132     if (!HbStyleLoader::registerFilePath(":/layouts")) {
       
   133         QDEBUG_WRITE("ERROR: ConversationView -> HbStyleLoader::registerFilePath");
       
   134     }
   128     mConversationList->setLayoutName("custom");
   135     mConversationList->setLayoutName("custom");
   129     mConversationList->setItemRecycling(true);
   136     mConversationList->setItemRecycling(true);
   130     MsgConversationViewItem *item = new MsgConversationViewItem(this);
   137     MsgConversationViewItem *item = new MsgConversationViewItem(this);
       
   138     HbFrameBackground defaultBackground;
       
   139     defaultBackground.setFrameGraphicsName(QString(""));
       
   140     item->setDefaultFrame(defaultBackground);
   131     mConversationList->setItemPrototype(item);
   141     mConversationList->setItemPrototype(item);
   132     mConversationList->setSelectionMode(HbListView::NoSelection);
   142     mConversationList->setSelectionMode(HbListView::NoSelection);
   133     mConversationList->setClampingStyle(HbScrollArea::BounceBackClamping);
   143     mConversationList->setClampingStyle(HbScrollArea::BounceBackClamping);
   134     mConversationList->setScrollingStyle(HbScrollArea::PanOrFlick);
   144     mConversationList->setScrollingStyle(HbScrollArea::PanOrFlick);
   135 
   145 
   204             mEditorWidget->hide();
   214             mEditorWidget->hide();
   205             mEditorWidget->setParent(this);
   215             mEditorWidget->setParent(this);
   206         }
   216         }
   207         else {
   217         else {
   208             mMainLayout->addItem(mEditorWidget);
   218             mMainLayout->addItem(mEditorWidget);
   209             mEditorWidget->setEncodingSettings();
   219             TRAP_IGNORE(mEditorWidget->setEncodingSettingsL());
   210             mEditorWidget->show();
   220             mEditorWidget->show();
   211         }
   221         }
   212         mContactCardWidget->updateContents();
   222         mContactCardWidget->updateContents();
   213     }
   223     }
   214 }
   224 }
   240     if (this->isVisible())
   250     if (this->isVisible())
   241     {
   251     {
   242         //If message is in Sending state or is Scheduled to be sent later,
   252         //If message is in Sending state or is Scheduled to be sent later,
   243         //do not allow any operations on the message
   253         //do not allow any operations on the message
   244         int sendingState = item->modelIndex().data(SendingState).toInt();
   254         int sendingState = item->modelIndex().data(SendingState).toInt();
       
   255         if(sendingState == ConvergedMessage::Scheduled ||
       
   256                    sendingState == ConvergedMessage::Sending ||
       
   257                    sendingState == ConvergedMessage::Waiting)
       
   258            {
       
   259                return;
       
   260            }
   245         // Create new menu
   261         // Create new menu
   246         HbMenu* contextMenu = new HbMenu();
   262         HbMenu* contextMenu = new HbMenu();
       
   263         contextMenu->setAttribute(Qt::WA_DeleteOnClose);
       
   264         contextMenu->setPreferredPos(point);
   247         setContextMenu(item, contextMenu, sendingState);
   265         setContextMenu(item, contextMenu, sendingState);
   248         
   266         contextMenu->show();
   249         //Before showing menu reset the flag
       
   250         mItemLongPressed = false;
       
   251         contextMenu->exec(point);
       
   252         // Cleanup
       
   253         delete contextMenu;
       
   254 
   267 
   255     }
   268     }
   256     else
   269     else
   257     {
   270     {
   258         // For cases where the long tap check failed
   271         // For cases where the long tap check failed
   269 {
   282 {
   270     addOpenItemToContextMenu(item , contextMenu,sendingState);
   283     addOpenItemToContextMenu(item , contextMenu,sendingState);
   271     addResendItemToContextMenu(item, contextMenu, sendingState);
   284     addResendItemToContextMenu(item, contextMenu, sendingState);
   272     addForwardItemToContextMenu(item, contextMenu, sendingState);
   285     addForwardItemToContextMenu(item, contextMenu, sendingState);
   273     addDownloadItemToContextMenu(item, contextMenu);
   286     addDownloadItemToContextMenu(item, contextMenu);
   274     addDeleteItemToContextMenu(item, contextMenu, sendingState);  
   287     addDeleteItemToContextMenu(item, contextMenu, sendingState);
       
   288     addSaveItemToContextMenu(item , contextMenu,sendingState);
       
   289 }
       
   290 
       
   291 
       
   292 //---------------------------------------------------------------
       
   293 // MsgEditorPrivate::addSaveItemToContextMenu
       
   294 // @see header
       
   295 //---------------------------------------------------------------
       
   296 void MsgConversationView::addSaveItemToContextMenu(MsgConversationViewItem* item,
       
   297     HbMenu* contextMenu, int sendingState)
       
   298 {
       
   299     int messageSubType = item->modelIndex().data(MessageSubType).toInt();
       
   300     int direction =  item->modelIndex().data(Direction).toInt();
       
   301     if ((messageSubType == ConvergedMessage::RingingTone) && 
       
   302         (direction == ConvergedMessage::Incoming)) {
       
   303         HbAction *contextItem = contextMenu->addAction(LOC_COMMON_SAVE);
       
   304         connect(contextItem, SIGNAL(triggered()), this, SLOT(saveRingingTone()));
       
   305     }
   275 }
   306 }
   276 
   307 
   277 //---------------------------------------------------------------
   308 //---------------------------------------------------------------
   278 // MsgEditorPrivate::addOpenItemToContextMenu
   309 // MsgEditorPrivate::addOpenItemToContextMenu
   279 // @see header
   310 // @see header
   429         }
   460         }
   430     }
   461     }
   431     deactivateInputBlocker();
   462     deactivateInputBlocker();
   432     if( sendResult == KErrNotFound)
   463     if( sendResult == KErrNotFound)
   433     {
   464     {
   434     bool result = HbMessageBox::question("SMS Settings not defined\nDefine now ?",
   465     HbMessageBox::question(LOC_DIALOG_SMS_SETTINGS_INCOMPLETE, this, SLOT(onDialogSettingsLaunch(HbAction*)), LOC_BUTTON_OK, LOC_BUTTON_CANCEL);
   435             LOC_BUTTON_OK,
       
   436             LOC_BUTTON_CANCEL);
       
   437         if (result)
       
   438         {
       
   439             //switch to settings view
       
   440             QVariantList param;
       
   441             param << MsgBaseView::MSGSETTINGS;
       
   442             param << MsgBaseView::CV;
       
   443             emit switchView(param);
       
   444         }
       
   445     }
   466     }
   446 }
   467 }
   447 
   468 
   448 //---------------------------------------------------------------
   469 //---------------------------------------------------------------
   449 // MsgConversationView::contactsFetchedForVCards
   470 // MsgConversationView::contactsFetchedForVCards
   517 {
   538 {
   518     QString interface("Image");
   539     QString interface("Image");
   519     QString operation("fetch(QVariantMap,QVariant)");
   540     QString operation("fetch(QVariantMap,QVariant)");
   520     XQAiwRequest* request = NULL;
   541     XQAiwRequest* request = NULL;
   521     XQApplicationManager appManager;
   542     XQApplicationManager appManager;
   522     request = appManager.create(interface, operation, true);//embedded
   543     request = appManager.create(interface, operation, true); // embedded
       
   544     request->setSynchronous(true); // synchronous
   523     if(!request)
   545     if(!request)
   524     {
   546     {
   525         QDEBUG_WRITE("AIW-ERROR: NULL request");
   547         QDEBUG_WRITE("AIW-ERROR: NULL request");
   526         return;
   548         return;
   527     }
   549     }
   528 
   550 
   529     connect(request, SIGNAL(requestOk(const QVariant&)),
   551     connect(request, SIGNAL(requestOk(const QVariant&)),
   530         this, SLOT(imagesFetched(const QVariant&)));
   552         this, SLOT(imagesFetched(const QVariant&)));
   531     connect(request, SIGNAL(requestError(int,const QString&)),
   553     connect(request, SIGNAL(requestError(int,const QString&)),
   532         this, SLOT(serviceRequestError(int,const QString&)));
   554         this, SLOT(serviceRequestError(int,const QString&)));
   533    
   555 
       
   556     // Set arguments for request
       
   557     QList<QVariant> args;
       
   558     args << QVariantMap();
       
   559     args << QVariant();
       
   560     request->setArguments(args);
   534     // Make the request
   561     // Make the request
   535     if (!request->send())
   562     if (!request->send())
   536     {
   563     {
   537         QDEBUG_WRITE_FORMAT("AIW-ERROR: Request Send failed:" , request->lastError());
   564         QDEBUG_WRITE_FORMAT("AIW-ERROR: Request Send failed:" , request->lastError());
   538     }  
   565     }  
   543 // MsgConversationView::fetchAudio
   570 // MsgConversationView::fetchAudio
   544 // @see header file
   571 // @see header file
   545 //---------------------------------------------------------------
   572 //---------------------------------------------------------------
   546 void MsgConversationView::fetchAudio()
   573 void MsgConversationView::fetchAudio()
   547 {
   574 {
   548     QString service("Music Fetcher");
   575     QString service("musicplayer");
   549     QString interface("com.nokia.services.media.Music");
   576     QString interface("com.nokia.symbian.IMusicFetch");
   550     QString operation("fetch(QString)");
   577     QString operation("fetch()");
   551     XQAiwRequest* request = NULL;
   578     XQAiwRequest* request = NULL;
   552     XQApplicationManager appManager;
   579     XQApplicationManager appManager;
   553     request = appManager.create(service, interface, operation, true); //embedded
   580     request = appManager.create(service, interface, operation, true); //embedded
       
   581     request->setSynchronous(true); // synchronous
   554     if(!request)
   582     if(!request)
   555     {
   583     {
   556         QDEBUG_WRITE("AIW-ERROR: NULL request");
   584         QDEBUG_WRITE("AIW-ERROR: NULL request");
   557         return;
   585         return;
   558     }
   586     }
   574 // MsgConversationView::contactsFetched
   602 // MsgConversationView::contactsFetched
   575 // @see header file
   603 // @see header file
   576 //---------------------------------------------------------------
   604 //---------------------------------------------------------------
   577 void MsgConversationView::contactsFetched(const QVariant& value)
   605 void MsgConversationView::contactsFetched(const QVariant& value)
   578 {
   606 {
   579     CntServicesContactList contactList;
   607     CntServicesContactList contactList = 
   580     contactList = qVariantValue<CntServicesContactList>(value);
   608             qVariantValue<CntServicesContactList>(value);
   581     ConvergedMessageAddressList addresses;
       
   582 	int count = contactList.count();
   609 	int count = contactList.count();
   583 	if(count > 0)
   610 	if(count > 0)
   584       {
   611     {
   585 	  ConvergedMessageAddress* address = new ConvergedMessageAddress;
   612         QVariantList params;
   586       address->setAlias(mContactCardWidget->address().at(0)->alias());
   613         params << MsgBaseView::ADD_RECIPIENTS;
   587       address->setAddress(mContactCardWidget->address().at(0)->address());
   614         params << value;
   588       addresses.append(address);
   615         launchUniEditor(params);
   589     	for(int i = 0; i < contactList.count(); i++ )
   616     }
   590 	    {
       
   591 	    ConvergedMessageAddress* address = new ConvergedMessageAddress;
       
   592 	    address->setAlias(contactList[i].mDisplayName);
       
   593 	    address->setAddress(contactList[i].mPhoneNumber);
       
   594 	    addresses.append(address);
       
   595 	    }
       
   596 
       
   597       ConvergedMessage message;
       
   598       message.setBodyText(mEditorWidget->content());
       
   599       message.addToRecipients(addresses);//takes the ownership of list elements
       
   600       QByteArray dataArray;
       
   601       QDataStream messageStream
       
   602       (&dataArray, QIODevice::WriteOnly | QIODevice::Append);
       
   603       message.serialize(messageStream);
       
   604       QVariantList params;
       
   605       params << MsgBaseView::UNIEDITOR; // target view
       
   606       params << MsgBaseView::CV; // source view
       
   607       params << dataArray;
       
   608       clearEditors();
       
   609       emit switchView(params);
       
   610      }    
       
   611 }
   617 }
   612 
   618 
   613 //---------------------------------------------------------------
   619 //---------------------------------------------------------------
   614 // MsgConversationView::imagesFetched()
   620 // MsgConversationView::imagesFetched()
   615 // @see header file
   621 // @see header file
   729 // MsgConversationView::deleteItem()
   735 // MsgConversationView::deleteItem()
   730 // Deletes the message
   736 // Deletes the message
   731 //---------------------------------------------------------------
   737 //---------------------------------------------------------------
   732 void MsgConversationView::deleteItem()
   738 void MsgConversationView::deleteItem()
   733     {
   739     {
   734     QModelIndex index = mConversationList->currentIndex();
   740     HbMessageBox::question(LOC_DELETE_MESSAGE,this,SLOT(onDialogdeleteMsg(HbAction*)),
   735     int count = mMessageModel->rowCount();
       
   736     //delete message
       
   737     qint32 messageId = index.data(ConvergedMsgId).toLongLong();    
       
   738 
       
   739     bool result = HbMessageBox::question(LOC_DELETE_MESSAGE,
       
   740                              LOC_BUTTON_DELETE,
   741                              LOC_BUTTON_DELETE,
   741                              LOC_BUTTON_CANCEL);
   742                              LOC_BUTTON_CANCEL);
   742     if(result)
       
   743         {        
       
   744         if (messageId)
       
   745             {
       
   746             QList<int> msgIdList;
       
   747             msgIdList.append(messageId);          
       
   748             ConversationsEngine::instance()->deleteMessages(msgIdList);
       
   749             //switch view               
       
   750             if (count == 1)
       
   751                 {
       
   752                 QVariantList param;
       
   753                 param << MsgBaseView::CLV; // target view
       
   754                 param << MsgBaseView::CV; // source view
       
   755                 emit switchView(param);
       
   756                 }  
       
   757             }             
       
   758         }
       
   759 }
   743 }
   760 
   744 
   761 //---------------------------------------------------------------
   745 //---------------------------------------------------------------
   762 // MsgConversationView::openItem()
   746 // MsgConversationView::openItem()
   763 // Opens the message
   747 // Opens the message
   883         {
   867         {
   884         return;
   868         return;
   885         }
   869         }
   886 
   870 
   887     if(mItemLongPressed)
   871     if(mItemLongPressed)
       
   872         {
       
   873         //reset the flag
       
   874         mItemLongPressed = false;
   888         return;
   875         return;
       
   876         }
   889     
   877     
   890     int messageType = index.data(MessageType).toInt();
   878     int messageType = index.data(MessageType).toInt();
   891     int messageSubType = index.data(MessageSubType).toInt();
   879     int messageSubType = index.data(MessageSubType).toInt();
   892     
   880     
   893     if (ConvergedMessage::BioMsg == messageType) {
   881     if (ConvergedMessage::BioMsg == messageType) {
   894         if (ConvergedMessage::RingingTone == messageSubType) {
   882         if (ConvergedMessage::RingingTone == messageSubType) {
   895             if (RingBc::askSaveQuery()) {
   883             HbMessageBox::question(LOC_DIALOG_SAVE_RINGTONE, this,
   896                 saveRingingTone();
   884                     SLOT(onDialogSaveTone(HbAction*)), LOC_COMMON_SAVE, LOC_BUTTON_CANCEL);
       
   885             return;
       
   886         }
       
   887         else if(ConvergedMessage::Provisioning == messageSubType)
       
   888             {
       
   889             int messageId = index.data(ConvergedMsgId).toInt();
       
   890             handleProvisoningMsg(messageId);
       
   891             QList<int> msgIdList;
       
   892             if(index.data(UnReadStatus).toInt())
       
   893                 {
       
   894                 msgIdList.clear();
       
   895                 msgIdList << messageId;
       
   896                 ConversationsEngine::instance()->markMessagesRead(msgIdList);
       
   897                 }
       
   898             return;
   897             }
   899             }
   898             return;
       
   899         }
       
   900         // Unsupported messages
   900         // Unsupported messages
   901         else if (ConvergedMessage::VCard == messageSubType
   901         else if (ConvergedMessage::VCard == messageSubType
   902             || ConvergedMessage::VCal == messageSubType
   902             || ConvergedMessage::VCal == messageSubType) {
   903             || ConvergedMessage::Provisioning == messageSubType) {
       
   904             return;
   903             return;
   905         }
   904         }
   906     }
   905     }
   907     else if (ConvergedMessage::BT == messageType) {
   906     else if (ConvergedMessage::BT == messageType) {
   908         launchBtDisplayService(index);
   907         launchBtDisplayService(index);
   921            return;
   920            return;
   922         }
   921         }
   923         else
   922         else
   924         {
   923         {
   925             //TODO: use logical str name
   924             //TODO: use logical str name
   926             if(HbMessageBox::question("Download Message?",
   925             HbMessageBox::question("Download Message?",this,SLOT(onDialogDownLoadMsg(HbAction*)),
   927                 LOC_COMMON_DOWNLOAD,
   926                 LOC_COMMON_DOWNLOAD,
   928                 LOC_BUTTON_CANCEL))
   927                 LOC_BUTTON_CANCEL);
   929             {
       
   930                 downloadMessage();
       
   931             }
       
   932             return;
   928             return;
   933         }
   929         }
   934     }
   930     }
   935 
   931 
   936     ConvergedMessage message;
   932     ConvergedMessage message;
  1048     QVariant data2;
  1044     QVariant data2;
  1049     if( editorOperation != MsgBaseView::FORWARD_MSG )
  1045     if( editorOperation != MsgBaseView::FORWARD_MSG )
  1050     {
  1046     {
  1051         message.setBodyText(mEditorWidget->content());
  1047         message.setBodyText(mEditorWidget->content());
  1052 
  1048 
       
  1049         // add address from contact-card to to-field
  1053         ConvergedMessageAddress address;
  1050         ConvergedMessageAddress address;
  1054         address.setAlias(mContactCardWidget->address().at(0)->alias());
  1051         address.setAlias(mContactCardWidget->address().at(0)->alias());
  1055         address.setAddress(mContactCardWidget->address().at(0)->address());
  1052         address.setAddress(mContactCardWidget->address().at(0)->address());
  1056         message.addToRecipient(address);
  1053         message.addToRecipient(address);
  1057 
  1054 
  1075         {
  1072         {
  1076             // filepath is not sent in cases like VCards & recipients
  1073             // filepath is not sent in cases like VCards & recipients
  1077             // instead, we will get a list of contacts. Pass it as it is.
  1074             // instead, we will get a list of contacts. Pass it as it is.
  1078             data2 = data.at(1);
  1075             data2 = data.at(1);
  1079         }
  1076         }
       
  1077         else if(editorOperation == MsgBaseView::ADD_RECIPIENTS)
       
  1078         {
       
  1079             ConvergedMessageAddressList addresses;
       
  1080             CntServicesContactList contactList = 
       
  1081                     qVariantValue<CntServicesContactList>(data.at(1));
       
  1082             // now add fetched contacts from contact selection dialog
       
  1083             for(int i = 0; i < contactList.count(); i++ )
       
  1084             {
       
  1085                 ConvergedMessageAddress* address = new ConvergedMessageAddress;
       
  1086                 address->setAlias(contactList[i].mDisplayName);
       
  1087                 address->setAddress(contactList[i].mPhoneNumber);
       
  1088                 addresses.append(address);
       
  1089             }
       
  1090             message.addToRecipients(addresses);
       
  1091         }
  1080     }
  1092     }
  1081     else
  1093     else
  1082     {
  1094     {
  1083         qint32 msgId = (qint32)data.at(1).toInt();
  1095         qint32 msgId = (qint32)data.at(1).toInt();
  1084         int msgType = data.at(2).toInt();
  1096         int msgType = data.at(2).toInt();
  1221     
  1233     
  1222     emit hideChrome(false);
  1234     emit hideChrome(false);
  1223     
  1235     
  1224     this->setMaximumHeight(-1);
  1236     this->setMaximumHeight(-1);
  1225     connect(mVkbHost,SIGNAL(keypadOpened()),this,SLOT(vkbOpened()));
  1237     connect(mVkbHost,SIGNAL(keypadOpened()),this,SLOT(vkbOpened()));
       
  1238     
       
  1239     scrollToBottom();
  1226 }
  1240 }
  1227 
  1241 
  1228 //---------------------------------------------------------------
  1242 //---------------------------------------------------------------
  1229 // MsgConversationView::serviceRequestError
  1243 // MsgConversationView::serviceRequestError
  1230 // @see header file
  1244 // @see header file
  1252     {    
  1266     {    
  1253         this->ungrabKeyboard();
  1267         this->ungrabKeyboard();
  1254         this->ungrabMouse();
  1268         this->ungrabMouse();
  1255     }
  1269     }
  1256 
  1270 
       
  1271 //---------------------------------------------------------------
       
  1272 // MsgConversationView::handleProvisoningMsg
       
  1273 // @see header file
       
  1274 //--------------------------------------------------------------
       
  1275 void MsgConversationView::handleProvisoningMsg(int msgId)
       
  1276 	{
       
  1277 		QString messageId;
       
  1278     messageId.setNum(msgId);
       
  1279 
       
  1280     XQApplicationManager* aiwMgr = new XQApplicationManager();
       
  1281 
       
  1282     XQAiwRequest* request = aiwMgr->create("com.nokia.services.MDM", 
       
  1283             "Provisioning",
       
  1284             "ProcessMessage(QString)", true); // embedded
       
  1285 
       
  1286     if (request) {
       
  1287     QList<QVariant> args;
       
  1288     args << QVariant(messageId);
       
  1289     request->setArguments(args);
       
  1290 
       
  1291     // Send the request
       
  1292     bool res = request->send();
       
  1293 
       
  1294     // Cleanup
       
  1295     delete request;
       
  1296     }
       
  1297 
       
  1298     delete aiwMgr;
       
  1299 	}
       
  1300 
       
  1301 //---------------------------------------------------------------
       
  1302 // MsgConversationView::onDialogSettingsLaunch
       
  1303 // @see header file
       
  1304 //--------------------------------------------------------------
       
  1305 void MsgConversationView::onDialogSettingsLaunch(HbAction* action)
       
  1306 {
       
  1307     HbMessageBox *dlg = qobject_cast<HbMessageBox*> (sender());
       
  1308     if (action == dlg->actions().at(0)) {
       
  1309         //switch to settings view
       
  1310          QVariantList param;
       
  1311          param << MsgBaseView::MSGSETTINGS;
       
  1312          param << MsgBaseView::CV;
       
  1313          param << MsgSettingsView::SMSView;
       
  1314          emit switchView(param);
       
  1315     }
       
  1316 
       
  1317 }
       
  1318 
       
  1319 //---------------------------------------------------------------
       
  1320 // MsgConversationView::onDialogdeleteMsg
       
  1321 // @see header file
       
  1322 //--------------------------------------------------------------
       
  1323 void MsgConversationView::onDialogdeleteMsg(HbAction* action)
       
  1324 {
       
  1325     HbMessageBox *dlg = qobject_cast<HbMessageBox*> (sender());
       
  1326     if (action == dlg->actions().at(0)) {
       
  1327         QModelIndex index = mConversationList->currentIndex();
       
  1328         if (index.isValid()) {
       
  1329             int count = mMessageModel->rowCount();
       
  1330             //delete message
       
  1331             qint32 messageId = index.data(ConvergedMsgId).toLongLong();
       
  1332             if (messageId) {
       
  1333                 QList<int> msgIdList;
       
  1334                 msgIdList.append(messageId);
       
  1335                 ConversationsEngine::instance()->deleteMessages(msgIdList);
       
  1336                 //switch view               
       
  1337                 if (count == 1) {
       
  1338                     QVariantList param;
       
  1339                     param << MsgBaseView::CLV; // target view
       
  1340                     param << MsgBaseView::CV; // source view
       
  1341                     emit switchView(param);
       
  1342                 }
       
  1343             }
       
  1344         }
       
  1345 
       
  1346     }
       
  1347 
       
  1348 }
       
  1349 
       
  1350 //---------------------------------------------------------------
       
  1351 // MsgConversationView::onDialogDownLoadMsg
       
  1352 // @see header file
       
  1353 //--------------------------------------------------------------
       
  1354 void MsgConversationView::onDialogDownLoadMsg(HbAction* action)
       
  1355 {
       
  1356     HbMessageBox *dlg = qobject_cast<HbMessageBox*> (sender());
       
  1357     if (action == dlg->actions().at(0)) {
       
  1358         downloadMessage();
       
  1359     }
       
  1360 }
       
  1361 
       
  1362 //---------------------------------------------------------------
       
  1363 // MsgConversationView::onDialogSaveTone
       
  1364 // @see header file
       
  1365 //--------------------------------------------------------------
       
  1366 void MsgConversationView::onDialogSaveTone(HbAction* action)
       
  1367     {
       
  1368     HbMessageBox *dlg = qobject_cast<HbMessageBox*> (sender());
       
  1369     if (action == dlg->actions().at(0)) {
       
  1370         saveRingingTone();
       
  1371     }
       
  1372 }
  1257 
  1373 
  1258 // EOF
  1374 // EOF