messagingapp/msgui/unifiedviewer/src/unifiedviewer.cpp
changeset 62 fdbe8253b596
parent 56 f42d9a78f435
child 63 eceabb8c7a12
equal deleted inserted replaced
59:fcb676ca077d 62:fdbe8253b596
    25 #include <hbnotificationdialog.h>
    25 #include <hbnotificationdialog.h>
    26 #include <HbStyleLoader>
    26 #include <HbStyleLoader>
    27 #include <centralrepository.h>
    27 #include <centralrepository.h>
    28 #include <MmsEngineDomainCRKeys.h>
    28 #include <MmsEngineDomainCRKeys.h>
    29 #include <ccsdefs.h>
    29 #include <ccsdefs.h>
       
    30 #include <xqappmgr.h>
       
    31 #include <xqaiwrequest.h>
    30 
    32 
    31 // USER INCLUDES
    33 // USER INCLUDES
    32 #include "uniscrollarea.h"
    34 #include "uniscrollarea.h"
    33 #include "unicontentswidget.h"
    35 #include "unicontentswidget.h"
    34 #include "univiewerfeeder.h"
    36 #include "univiewerfeeder.h"
    62 // UnifiedViewer::UnifiedViewer
    64 // UnifiedViewer::UnifiedViewer
    63 // constructor
    65 // constructor
    64 //----------------------------------------------------------------------------
    66 //----------------------------------------------------------------------------
    65 UnifiedViewer::UnifiedViewer(const qint32 messageId,
    67 UnifiedViewer::UnifiedViewer(const qint32 messageId,
    66                              QGraphicsItem *parent) :
    68                              QGraphicsItem *parent) :
    67     MsgBaseView(parent)
    69     MsgBaseView(parent), mConversationID(-1)
    68 {
    70 {
    69     QDEBUG_WRITE("UnifiedViewer contruction start");
    71     QDEBUG_WRITE("UnifiedViewer contruction start");
    70 
    72 
    71     if (!HbStyleLoader::registerFilePath(":/layouts"))
    73     if (!HbStyleLoader::registerFilePath(":/layouts"))
    72     {
    74     {
   158 
   160 
   159 //---------------------------------------------------------------
   161 //---------------------------------------------------------------
   160 // UnifiedViewer::populateContent
   162 // UnifiedViewer::populateContent
   161 // @see header file
   163 // @see header file
   162 //---------------------------------------------------------------
   164 //---------------------------------------------------------------
   163 void UnifiedViewer::populateContent(const qint32 messageId, bool update, int msgCount)
   165 void UnifiedViewer::populateContent(const qint32 messageId, bool update, int msgCount, qint64 conversationId)
   164 {
   166 {
   165     QDEBUG_WRITE("UnifiedViewer populateContent Start");
   167     QDEBUG_WRITE("UnifiedViewer populateContent Start");
   166 
   168 
   167     mMsgCount = msgCount;
   169     mMsgCount = msgCount;
   168     mMessageId = messageId;
   170     mMessageId = messageId;
       
   171     mConversationID = conversationId;
   169 
   172 
   170     QDEBUG_WRITE("UnifiedViewer feeder->updateContent START");
   173     QDEBUG_WRITE("UnifiedViewer feeder->updateContent START");
   171 
   174 
   172     if (update)
   175     if (update)
   173     {
   176     {
   193 
   196 
   194     //Creation of toolbar now depends on content
   197     //Creation of toolbar now depends on content
   195     createToolBar();
   198     createToolBar();
   196 
   199 
   197     QDEBUG_WRITE("UnifiedViewer populateContent END");
   200     QDEBUG_WRITE("UnifiedViewer populateContent END");
       
   201 }
       
   202 
       
   203 //---------------------------------------------------------------
       
   204 // UnifiedViewer::handleKeyEvent
       
   205 // @see header file
       
   206 //---------------------------------------------------------------
       
   207 bool UnifiedViewer::handleKeyEvent(int key)
       
   208 {
       
   209     bool eventHandled = false;
       
   210     if (Qt::Key_Yes == key) {
       
   211         bool incoming = mViewFeeder->isIncoming();
       
   212         QString number;
       
   213         if (incoming) {
       
   214             QString alias;
       
   215             mViewFeeder->fromAddressAndAlias(number, alias);
       
   216         }
       
   217         else if (!incoming && 1 == mViewFeeder->recipientCount()) {
       
   218             ConvergedMessageAddressList addrList;
       
   219             if ((addrList = mViewFeeder->toAddressList()).count()) {
       
   220                 number = addrList[0]->address();
       
   221             }
       
   222             else if((addrList = mViewFeeder->ccAddressList()).count()) {
       
   223                 number = addrList[0]->address();
       
   224             }
       
   225             else if ((addrList = mViewFeeder->bccAddressList()).count()) {
       
   226                 number = addrList[0]->address();
       
   227             }
       
   228         }
       
   229 
       
   230         // Call
       
   231         if (!number.isEmpty()) {
       
   232             eventHandled = true;
       
   233             call(number);
       
   234         }
       
   235     }
       
   236     return eventHandled;
   198 }
   237 }
   199 
   238 
   200 //---------------------------------------------------------------
   239 //---------------------------------------------------------------
   201 // UnifiedViewer::handleFwdAction
   240 // UnifiedViewer::handleFwdAction
   202 // @see header file
   241 // @see header file
   296 
   335 
   297         QVariantList param;
   336         QVariantList param;
   298         if (mMsgCount > 1) {
   337         if (mMsgCount > 1) {
   299             param << MsgBaseView::CV;
   338             param << MsgBaseView::CV;
   300             param << MsgBaseView::UNIVIEWER;
   339             param << MsgBaseView::UNIVIEWER;
       
   340             param << mConversationID;
   301         }
   341         }
   302         else {
   342         else {
   303             param << MsgBaseView::CLV;
   343             param << MsgBaseView::CLV;
   304             param << MsgBaseView::UNIVIEWER;
   344             param << MsgBaseView::UNIVIEWER;
   305         }
   345         }
   340 
   380 
   341     params << dataArray;
   381     params << dataArray;
   342     params << operation;
   382     params << operation;
   343 
   383 
   344     emit switchView(params);
   384     emit switchView(params);
       
   385 }
       
   386 
       
   387 //---------------------------------------------------------------
       
   388 // UnifiedViewer::call
       
   389 // @see header file
       
   390 //---------------------------------------------------------------
       
   391 void UnifiedViewer::call(const QString &number)
       
   392 {
       
   393     QString service("phoneui");
       
   394     QString interface("com.nokia.symbian.ICallDial");
       
   395     QString operation("dial(QString)");
       
   396 
       
   397     XQApplicationManager appManager;
       
   398     QScopedPointer<XQAiwRequest> request(appManager.create(service, interface, operation, false));
       
   399     if (request) {
       
   400         QList<QVariant> args;
       
   401         args << number;
       
   402         request->setArguments(args);
       
   403         request->send();
       
   404     }
   345 }
   405 }
   346 
   406 
   347 //---------------------------------------------------------------
   407 //---------------------------------------------------------------
   348 // UnifiedViewer::isForwardOk
   408 // UnifiedViewer::isForwardOk
   349 // @see header file
   409 // @see header file