src/hbplugins/devicedialogs/deviceprogressdialogplugin/hbdeviceprogressdialogwidget.cpp
changeset 34 ed14f46c0e55
parent 2 06ff229162e9
--- a/src/hbplugins/devicedialogs/deviceprogressdialogplugin/hbdeviceprogressdialogwidget.cpp	Mon Oct 04 17:49:30 2010 +0300
+++ b/src/hbplugins/devicedialogs/deviceprogressdialogplugin/hbdeviceprogressdialogwidget.cpp	Mon Oct 18 18:23:13 2010 +0300
@@ -40,7 +40,7 @@
     TRACE_ENTRY
     mLastError = NoError;
     mProgressDialogType = progressDialogType;
-    mShowEventReceived = false;
+    mCloseEventReceived = false;
     mAction = 0;
     resetProperties();
     constructDialog(parameters);
@@ -52,6 +52,7 @@
         }
     }
     setBackgroundFaded(true);
+    setDismissOnAction(false);
     TRACE_EXIT
 }
 
@@ -92,11 +93,6 @@
     TRACE_ENTRY
     Q_UNUSED(byClient);
     cancel();
-    // 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();
-    }
     TRACE_EXIT
 }
 
@@ -208,7 +204,7 @@
 {
     TRACE_ENTRY
     QAction *act = action(Cancel);
-	QString actionData;
+    QString actionData;
     if (act) {
         actionData.append(actionTextTag);
         actionData.append(act->text());
@@ -277,18 +273,36 @@
     mAnimationDefinition = animationDefinition;
 }
 
+void HbDeviceProgressDialogWidget::setShowLevel(int level)
+{
+    // Level can only be set on construction
+    Q_UNUSED(level)
+}
+
+int HbDeviceProgressDialogWidget::showLevel() const
+{
+    return 0;
+}
+
 // Widget is about to hide. Closing effect has ended.
 void HbDeviceProgressDialogWidget::hideEvent(QHideEvent *event)
 {
     HbProgressDialog::hideEvent(event);
-    emit deviceDialogClosed();
+    if (mCloseEventReceived) {
+        emit deviceDialogClosed();
+    }
 }
 
-// Widget is about to show
-void HbDeviceProgressDialogWidget::showEvent(QShowEvent *event)
+// Widget is about to close, close() has been called
+void HbDeviceProgressDialogWidget::closeEvent(QCloseEvent * event)
 {
-    HbProgressDialog::showEvent(event);
-    mShowEventReceived = true;
+    HbProgressDialog::closeEvent(event);
+    mCloseEventReceived = true;
+    // If widget is visible, close is signalled from hide event. If not,
+    // hide event does not come and close is signalled from here.
+    if (!isVisible()) {
+        emit deviceDialogClosed();
+    }
 }
 
 // Primary action triggered
@@ -298,5 +312,6 @@
     QVariantMap data;
     data.insert("act", "c");
     emit deviceDialogData(data);
+    close();
     TRACE_EXIT
 }