messagingapp/msgnotifications/msgnotifier/src/msgnotifier.cpp
changeset 73 ecf6a73a9186
parent 56 f42d9a78f435
equal deleted inserted replaced
68:e8a69c93c830 73:ecf6a73a9186
    18 
    18 
    19 // SYSTEM INCLUDES
    19 // SYSTEM INCLUDES
    20 #include <hbdevicedialog.h>
    20 #include <hbdevicedialog.h>
    21 #include <hbindicator.h>
    21 #include <hbindicator.h>
    22 #include <qfileinfo.h>
    22 #include <qfileinfo.h>
       
    23 #include <xqservicerequest.h>
       
    24 #include <xqaiwrequest.h>
       
    25 #include <xqappmgr.h>
    23 
    26 
    24 //USER INCLUDES
    27 //USER INCLUDES
    25 #include "msgnotifier.h"
    28 #include "msgnotifier.h"
    26 #include "msgnotifier_p.h"
    29 #include "msgnotifier_p.h"
    27 #include "msgsimnumberdetector.h"
    30 #include "msgsimnumberdetector.h"
    50 // ----------------------------------------------------------------------------
    53 // ----------------------------------------------------------------------------
    51 // MsgNotifier::MsgNotifier
    54 // MsgNotifier::MsgNotifier
    52 // @see MsgNotifier.h
    55 // @see MsgNotifier.h
    53 // ----------------------------------------------------------------------------
    56 // ----------------------------------------------------------------------------
    54 MsgNotifier::MsgNotifier(QObject* parent) :
    57 MsgNotifier::MsgNotifier(QObject* parent) :
    55     QObject(parent)
    58     QObject(parent),mDeviceDialog(NULL)
    56 {
    59 {
    57     QDEBUG_WRITE("MsgNotifier::MsgNotifier : Enter")
    60     QDEBUG_WRITE("MsgNotifier::MsgNotifier : Enter")
    58 
    61 
    59     d_ptr = q_check_ptr(new MsgNotifierPrivate(this));
    62     d_ptr = q_check_ptr(new MsgNotifierPrivate(this));
    60 
    63 
    73     QDEBUG_WRITE("MsgNotifier::~MsgNotifier : Enter")
    76     QDEBUG_WRITE("MsgNotifier::~MsgNotifier : Enter")
    74 
    77 
    75     delete d_ptr;
    78     delete d_ptr;
    76     delete mSimHandler;
    79     delete mSimHandler;
    77 	delete mErrorWatcher;
    80 	delete mErrorWatcher;
       
    81 	delete mDeviceDialog;
    78 
    82 
    79     QDEBUG_WRITE("MsgNotifier::~MsgNotifier : Enter")
    83     QDEBUG_WRITE("MsgNotifier::~MsgNotifier : Enter")
    80 }
    84 }
    81 
    85 
    82 // ----------------------------------------------------------------------------
    86 // ----------------------------------------------------------------------------
   136     notificationData[QString(KMessageTypeKey)] = data.mMsgType;
   140     notificationData[QString(KMessageTypeKey)] = data.mMsgType;
   137     notificationData[QString(KMessageBodyKey)] = description;
   141     notificationData[QString(KMessageBodyKey)] = description;
   138     notificationData[QString(KMessageSubjectKey)] = description;
   142     notificationData[QString(KMessageSubjectKey)] = description;
   139     notificationData[QString(KContactAddressKey)] = data.mContactNum;
   143     notificationData[QString(KContactAddressKey)] = data.mContactNum;
   140 
   144 
   141     // call device dialog to show notification
   145     if(mDeviceDialog == NULL)
   142     HbDeviceDialog deviceDialog ;
   146         {
   143     deviceDialog.show(NotificationPluginId,notificationData);
   147         // call device dialog to show notification
       
   148         mDeviceDialog = new HbDeviceDialog;
       
   149         connect(mDeviceDialog,SIGNAL(dataReceived(QVariantMap)),
       
   150                 this,SLOT(handleDataReceived(QVariantMap)));        
       
   151         }
       
   152     
       
   153     mDeviceDialog->show(NotificationPluginId,notificationData);    
   144     
   154     
   145     QDEBUG_WRITE("MsgNotifier::displayNewMessageNotification : Exit")
   155     QDEBUG_WRITE("MsgNotifier::displayNewMessageNotification : Exit")
   146     }
   156     }
   147 
   157 
   148     
   158     
   204     }
   214     }
   205 
   215 
   206     QDEBUG_WRITE("MsgNotifier::updateOutboxIndications  Exit")
   216     QDEBUG_WRITE("MsgNotifier::updateOutboxIndications  Exit")
   207 }
   217 }
   208 
   218 
       
   219 // ----------------------------------------------------------------------------
       
   220 // MsgNotifier::handleDataReceived
       
   221 // @see MsgNotifier.h
       
   222 // ----------------------------------------------------------------------------
       
   223 void MsgNotifier::handleDataReceived(QVariantMap data)
       
   224     {
       
   225     qint64 conversationId = data.value(KConversationIdKey).toLongLong(); 
       
   226 
       
   227     QList<QVariant> args;
       
   228     QString serviceName("com.nokia.services.hbserviceprovider");
       
   229     QString operation("open(qint64)");
       
   230     XQAiwRequest* request;
       
   231     XQApplicationManager appManager;
       
   232     request = appManager.create(serviceName, "conversationview", 
       
   233             operation, false); // not embedded
       
   234     if ( request == NULL )
       
   235         {
       
   236         return;       
       
   237         }
       
   238     connect(request,SIGNAL(requestOk(const QVariant&)),
       
   239             this,SLOT(onRequestCompleted(const QVariant&)));
       
   240 
       
   241     connect(request,SIGNAL(requestError(int, const QString&)),
       
   242             this,SLOT(onRequestError(int, const QString&)));
       
   243 
       
   244     args << QVariant(conversationId);
       
   245     request->setArguments(args);
       
   246     request->setSynchronous(false);
       
   247     request->send();
       
   248     delete request;    
       
   249     }
       
   250 
   209 //EOF
   251 //EOF