messagingapp/msgnotifications/msgnotifier/src/msgnotifier.cpp
changeset 73 ecf6a73a9186
parent 56 f42d9a78f435
--- a/messagingapp/msgnotifications/msgnotifier/src/msgnotifier.cpp	Fri Sep 17 20:16:33 2010 +0530
+++ b/messagingapp/msgnotifications/msgnotifier/src/msgnotifier.cpp	Tue Oct 05 13:58:47 2010 +0530
@@ -20,6 +20,9 @@
 #include <hbdevicedialog.h>
 #include <hbindicator.h>
 #include <qfileinfo.h>
+#include <xqservicerequest.h>
+#include <xqaiwrequest.h>
+#include <xqappmgr.h>
 
 //USER INCLUDES
 #include "msgnotifier.h"
@@ -52,7 +55,7 @@
 // @see MsgNotifier.h
 // ----------------------------------------------------------------------------
 MsgNotifier::MsgNotifier(QObject* parent) :
-    QObject(parent)
+    QObject(parent),mDeviceDialog(NULL)
 {
     QDEBUG_WRITE("MsgNotifier::MsgNotifier : Enter")
 
@@ -75,6 +78,7 @@
     delete d_ptr;
     delete mSimHandler;
 	delete mErrorWatcher;
+	delete mDeviceDialog;
 
     QDEBUG_WRITE("MsgNotifier::~MsgNotifier : Enter")
 }
@@ -138,9 +142,15 @@
     notificationData[QString(KMessageSubjectKey)] = description;
     notificationData[QString(KContactAddressKey)] = data.mContactNum;
 
-    // call device dialog to show notification
-    HbDeviceDialog deviceDialog ;
-    deviceDialog.show(NotificationPluginId,notificationData);
+    if(mDeviceDialog == NULL)
+        {
+        // call device dialog to show notification
+        mDeviceDialog = new HbDeviceDialog;
+        connect(mDeviceDialog,SIGNAL(dataReceived(QVariantMap)),
+                this,SLOT(handleDataReceived(QVariantMap)));        
+        }
+    
+    mDeviceDialog->show(NotificationPluginId,notificationData);    
     
     QDEBUG_WRITE("MsgNotifier::displayNewMessageNotification : Exit")
     }
@@ -206,4 +216,36 @@
     QDEBUG_WRITE("MsgNotifier::updateOutboxIndications  Exit")
 }
 
+// ----------------------------------------------------------------------------
+// MsgNotifier::handleDataReceived
+// @see MsgNotifier.h
+// ----------------------------------------------------------------------------
+void MsgNotifier::handleDataReceived(QVariantMap data)
+    {
+    qint64 conversationId = data.value(KConversationIdKey).toLongLong(); 
+
+    QList<QVariant> args;
+    QString serviceName("com.nokia.services.hbserviceprovider");
+    QString operation("open(qint64)");
+    XQAiwRequest* request;
+    XQApplicationManager appManager;
+    request = appManager.create(serviceName, "conversationview", 
+            operation, false); // not embedded
+    if ( request == NULL )
+        {
+        return;       
+        }
+    connect(request,SIGNAL(requestOk(const QVariant&)),
+            this,SLOT(onRequestCompleted(const QVariant&)));
+
+    connect(request,SIGNAL(requestError(int, const QString&)),
+            this,SLOT(onRequestError(int, const QString&)));
+
+    args << QVariant(conversationId);
+    request->setArguments(args);
+    request->setSynchronous(false);
+    request->send();
+    delete request;    
+    }
+
 //EOF