messagingapp/msgui/conversationview/src/msgconversationview.cpp
changeset 62 fdbe8253b596
parent 56 f42d9a78f435
child 67 fc91263aee62
equal deleted inserted replaced
59:fcb676ca077d 62:fdbe8253b596
    23 #include <HbAction>
    23 #include <HbAction>
    24 #include <HbListView>
    24 #include <HbListView>
    25 #include <HbMessageBox>
    25 #include <HbMessageBox>
    26 #include <HbNotificationDialog>
    26 #include <HbNotificationDialog>
    27 #include <HbFrameBackground>
    27 #include <HbFrameBackground>
    28 #include <xqservicerequest.h>
       
    29 #include <HbStaticVkbHost>
    28 #include <HbStaticVkbHost>
    30 #include <HbStyleLoader>
    29 #include <HbStyleLoader>
    31 #include <xqaiwrequest.h>
    30 #include <xqaiwrequest.h>
    32 #include <xqappmgr.h>
    31 #include <xqappmgr.h>
    33 #include <HbMainWindow>
    32 #include <HbMainWindow>
   534     HbAction* action = qobject_cast<HbAction*>(sender());
   533     HbAction* action = qobject_cast<HbAction*>(sender());
   535 
   534 
   536     if(!action)
   535     if(!action)
   537         return;
   536         return;
   538 
   537 
   539     QList<QVariant> args;
   538     QString service("phonebookservices");
   540     QString serviceName("com.nokia.services.phonebookservices");
   539     QString interface("com.nokia.symbian.IContactsFetch");
   541     QString operation("fetch(QString,QString,QString)");
   540     QString operation("multiFetch(QString,QString)");
   542     XQAiwRequest* request;
   541     XQAiwRequest* request;
   543     XQApplicationManager appManager;
   542     XQApplicationManager appManager;
   544     request = appManager.create(serviceName, "Fetch", operation, true); //embedded
   543     request = appManager.create(service, interface, operation, true); //embedded
   545     if ( request == NULL )
   544     if ( request == NULL )
   546     {
   545     {
   547         return;       
   546         return;       
   548     }
   547     }
   549 
   548 
   560             this, SLOT(contactsFetched(const QVariant&)));
   559             this, SLOT(contactsFetched(const QVariant&)));
   561     }
   560     }
   562     connect (request, SIGNAL(requestError(int,const QString&)), 
   561     connect (request, SIGNAL(requestError(int,const QString&)), 
   563         this, SLOT(serviceRequestError(int,const QString&)));
   562         this, SLOT(serviceRequestError(int,const QString&)));
   564 
   563 
       
   564     QList<QVariant> args;
   565     args << QString(tr("Phonebook")); 
   565     args << QString(tr("Phonebook")); 
   566     args << KCntActionAll;
   566     args << KCntActionAll;
   567     args << KCntFilterDisplayAll;
   567     args << KCntFilterDisplayAll;
   568 
   568 
   569     request->setArguments(args);
   569     request->setArguments(args);
   580     QString interface("com.nokia.symbian.IImageFetch");
   580     QString interface("com.nokia.symbian.IImageFetch");
   581     QString operation("fetch()");
   581     QString operation("fetch()");
   582     XQAiwRequest* request = NULL;
   582     XQAiwRequest* request = NULL;
   583     XQApplicationManager appManager;
   583     XQApplicationManager appManager;
   584     request = appManager.create(service,interface, operation, true); // embedded
   584     request = appManager.create(service,interface, operation, true); // embedded
   585     request->setSynchronous(true); // synchronous
   585 
   586     if(!request)
   586     if(!request)
   587     {
   587     {
   588         QDEBUG_WRITE("AIW-ERROR: NULL request");
   588         QDEBUG_WRITE("AIW-ERROR: NULL request");
   589         return;
   589         return;
   590     }
   590     }
   591 
   591 
       
   592     request->setSynchronous(true); // synchronous
       
   593     
   592     connect(request, SIGNAL(requestOk(const QVariant&)),
   594     connect(request, SIGNAL(requestOk(const QVariant&)),
   593         this, SLOT(imagesFetched(const QVariant&)));
   595         this, SLOT(imagesFetched(const QVariant&)));
   594     connect(request, SIGNAL(requestError(int,const QString&)),
   596     connect(request, SIGNAL(requestError(int,const QString&)),
   595         this, SLOT(serviceRequestError(int,const QString&)));
   597         this, SLOT(serviceRequestError(int,const QString&)));
   596 
   598 
   980     int sendingState = index.data(SendingState).toInt();
   982     int sendingState = index.data(SendingState).toInt();
   981     
   983     
   982     // For suspended message both short tap and long tap needs to show the same
   984     // For suspended message both short tap and long tap needs to show the same
   983     // context menu.....
   985     // context menu.....
   984     if(direction == ConvergedMessage::Outgoing 
   986     if(direction == ConvergedMessage::Outgoing 
   985         	&&sendingState == ConvergedMessage::Suspended )
   987         	&& ((sendingState == ConvergedMessage::Suspended) || (sendingState == ConvergedMessage::Failed)))
   986     {
   988     {
   987         handleShortTap();
   989         handleShortTap();
   988         return;
   990         return;
   989     }
   991     }
   990     
   992     
  1109     params << dataArray;
  1111     params << dataArray;
  1110     params << editorOperation;
  1112     params << editorOperation;
  1111     if(!data2.isNull())
  1113     if(!data2.isNull())
  1112         params << data2;
  1114         params << data2;
  1113 
  1115 
  1114     clearEditors();
       
  1115     emit switchView(params);
  1116     emit switchView(params);
  1116 }
  1117 }
  1117 
  1118 
  1118 //---------------------------------------------------------------
  1119 //---------------------------------------------------------------
  1119 // MsgConversationView::populateConversationsView
  1120 // MsgConversationView::populateConversationsView
  1492     delete pluginLoader;    
  1493     delete pluginLoader;    
  1493 
  1494 
  1494     return shared;
  1495     return shared;
  1495 }
  1496 }
  1496 
  1497 
       
  1498 //---------------------------------------------------------------
       
  1499 // MsgConversationView::onAudioSelected
       
  1500 // @see header file
       
  1501 //---------------------------------------------------------------
  1497 void MsgConversationView::onAudioSelected(QString& filePath)
  1502 void MsgConversationView::onAudioSelected(QString& filePath)
  1498 {
  1503 {
  1499     QVariantList params;
  1504     QVariantList params;
  1500     QByteArray dataArray;
  1505     QByteArray dataArray;
  1501     QDataStream messageStream
  1506     QDataStream messageStream
  1522     params << dataArray;
  1527     params << dataArray;
  1523     params << MsgBaseView::ADD_AUDIO;
  1528     params << MsgBaseView::ADD_AUDIO;
  1524     emit switchView(params);
  1529     emit switchView(params);
  1525 }
  1530 }
  1526 
  1531 
       
  1532 //---------------------------------------------------------------
       
  1533 // MsgConversationView::handleKeyEvent
       
  1534 // @see header file
       
  1535 //---------------------------------------------------------------
       
  1536 bool MsgConversationView::handleKeyEvent(int key)
       
  1537 {
       
  1538     bool eventHandled = false;
       
  1539     if (Qt::Key_Yes == key) {
       
  1540         //getting address of last sent/received msg.
       
  1541         const int rowCount = mMessageModel->rowCount();
       
  1542         QModelIndex index = mMessageModel->index(rowCount - 1, 0);
       
  1543         QString address = index.data(ConversationAddress).toString();
       
  1544 
       
  1545         if (!address.isEmpty()) {
       
  1546             call(address);
       
  1547             eventHandled = true;
       
  1548         }
       
  1549     }
       
  1550     return eventHandled;
       
  1551 }
       
  1552 
       
  1553 //---------------------------------------------------------------
       
  1554 // MsgConversationView::call
       
  1555 // @see header
       
  1556 //---------------------------------------------------------------
       
  1557 void MsgConversationView::call(const QString& address)
       
  1558 {
       
  1559     QString service("phoneui");
       
  1560     QString interface("com.nokia.symbian.ICallDial");
       
  1561     QString operation("dial(QString)");
       
  1562 
       
  1563     XQApplicationManager appManager;
       
  1564     QScopedPointer<XQAiwRequest> request(appManager.create(service, interface, operation, false));
       
  1565     if (request) {
       
  1566         QList<QVariant> args;
       
  1567         args << address;
       
  1568         request->setArguments(args);
       
  1569         request->send();
       
  1570     }
       
  1571 }
       
  1572 
  1527 // EOF
  1573 // EOF