--- a/messagingapp/msgnotifications/msgnotificationdialogplugin/inc/msgnotificationdialogwidget.h Fri Sep 17 20:01:45 2010 +0530
+++ b/messagingapp/msgnotifications/msgnotificationdialogplugin/inc/msgnotificationdialogwidget.h Fri Sep 17 20:16:33 2010 +0530
@@ -20,7 +20,7 @@
#include <QObject>
#include <QVariantMap>
-#include <QThread>
+#include <QRunnable>
#include <hbdevicedialoginterface.h>
#include <hbdevicedialog.h>
#include <hbnotificationdialog.h>
@@ -29,7 +29,7 @@
/**
* Class for sending service request
*/
-class ServiceRequestSenderTask :public QThread
+class ServiceRequestSenderTask :public QObject,public QRunnable
{
Q_OBJECT
@@ -37,7 +37,7 @@
/**
* Constructor
*/
- ServiceRequestSenderTask(qint64 conversationId,QObject* parent=0);
+ ServiceRequestSenderTask(qint64 conversationId);
/**
* Destructor
--- a/messagingapp/msgnotifications/msgnotificationdialogplugin/src/msgnotificationdialogwidget.cpp Fri Sep 17 20:01:45 2010 +0530
+++ b/messagingapp/msgnotifications/msgnotificationdialogplugin/src/msgnotificationdialogwidget.cpp Fri Sep 17 20:16:33 2010 +0530
@@ -14,6 +14,8 @@
* Description: Widget class for Notificaiton Dialog Plugin
*
*/
+#include <QThreadPool>
+#include <QRunnable>
#include "debugtraces.h"
#include <ccsdefs.h>
@@ -42,9 +44,7 @@
// ServiceRequestSenderTask::ServiceRequestSenderTask
// @see msgnotificationdialogwidget.h
// ----------------------------------------------------------------------------
-ServiceRequestSenderTask::ServiceRequestSenderTask(qint64 conversationId,
- QObject* parent):
-QThread(parent),
+ServiceRequestSenderTask::ServiceRequestSenderTask(qint64 conversationId):
mConvId(conversationId)
{
}
@@ -81,10 +81,9 @@
args << QVariant(mConvId);
request->setArguments(args);
+ request->setSynchronous(true);
request->send();
delete request;
-
- exec();
}
void ServiceRequestSenderTask::onRequestCompleted(const QVariant& value)
@@ -92,8 +91,6 @@
Q_UNUSED(value);
serviceTaskLaunched = false;
emit serviceRequestCompleted();
-
- quit();
}
void ServiceRequestSenderTask::onRequestError(int errorCode, const QString& errorMessage)
@@ -102,8 +99,6 @@
Q_UNUSED(errorMessage);
serviceTaskLaunched = false;
emit serviceRequestCompleted();
-
- quit();
}
// ----------------------------------------------------------------------------
@@ -251,11 +246,11 @@
void MsgNotificationDialogWidget::widgetActivated()
{
ServiceRequestSenderTask* task =
- new ServiceRequestSenderTask(mConversationId,this);
+ new ServiceRequestSenderTask(mConversationId);
connect(task,SIGNAL(serviceRequestCompleted()),
this,SIGNAL(deviceDialogClosed()));
serviceTaskLaunched = true;
- task->start();
+ QThreadPool::globalInstance()->start(task);
enableTouchActivation(false);
}