messagingapp/msgnotifications/msgnotificationdialogplugin/src/msgnotificationdialogwidget.cpp
--- a/messagingapp/msgnotifications/msgnotificationdialogplugin/src/msgnotificationdialogwidget.cpp Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgnotifications/msgnotificationdialogplugin/src/msgnotificationdialogwidget.cpp Mon Oct 04 00:13:15 2010 +0300
@@ -38,6 +38,8 @@
static const char NEW_MSG_ICON[] = "qtg_large_new_message";
+bool serviceTaskLaunched = false;
+
// ----------------------------------------------------------------------------
// ServiceRequestSenderTask::ServiceRequestSenderTask
// @see msgnotificationdialogwidget.h
@@ -71,12 +73,33 @@
{
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(mConvId);
request->setArguments(args);
+ request->setSynchronous(true);
request->send();
delete request;
}
+void ServiceRequestSenderTask::onRequestCompleted(const QVariant& value)
+ {
+ Q_UNUSED(value);
+ serviceTaskLaunched = false;
+ emit serviceRequestCompleted();
+ }
+
+void ServiceRequestSenderTask::onRequestError(int errorCode, const QString& errorMessage)
+ {
+ Q_UNUSED(errorCode);
+ Q_UNUSED(errorMessage);
+ serviceTaskLaunched = false;
+ emit serviceRequestCompleted();
+ }
// ----------------------------------------------------------------------------
// MsgNotificationDialogWidget::MsgNotificationDialogWidget
@@ -170,12 +193,16 @@
// Close device dialog
Q_UNUSED(byClient);
close();
- // If show event has been received, close is signalled from hide event. If not,
- // hide event does not come and close is signalled from here.
- if (!mShowEventReceived) {
- emit deviceDialogClosed();
- }
-
+
+ if (serviceTaskLaunched == false)
+ {
+ // If show event has been received, close is signalled from hide event. If not,
+ // hide event does not come and close is signalled from here.
+ if (!mShowEventReceived)
+ {
+ emit deviceDialogClosed();
+ }
+ }
}
// ----------------------------------------------------------------------------
@@ -196,7 +223,10 @@
void MsgNotificationDialogWidget::hideEvent(QHideEvent *event)
{
HbNotificationDialog::hideEvent(event);
- emit deviceDialogClosed();
+ if (serviceTaskLaunched == false)
+ {
+ emit deviceDialogClosed();
+ }
}
// ----------------------------------------------------------------------------
@@ -214,10 +244,15 @@
// @see msgnotificationdialogwidget.h
// ----------------------------------------------------------------------------
void MsgNotificationDialogWidget::widgetActivated()
-{
-QThreadPool::globalInstance()->start(
- new ServiceRequestSenderTask(mConversationId));
- enableTouchActivation(false);
+{
+ ServiceRequestSenderTask* task =
+ new ServiceRequestSenderTask(mConversationId);
+ connect(task,SIGNAL(serviceRequestCompleted()),
+ this,SIGNAL(deviceDialogClosed()));
+ serviceTaskLaunched = true;
+ QThreadPool::globalInstance()->start(task);
+ enableTouchActivation(false);
+
}
// ----------------------------------------------------------------------------