src/hbplugins/devicedialogs/deviceprogressdialogplugin/hbdeviceprogressdialogwidget.cpp
changeset 34 ed14f46c0e55
parent 2 06ff229162e9
equal deleted inserted replaced
31:7516d6d86cf5 34:ed14f46c0e55
    38     const QVariantMap &parameters) : HbProgressDialog(progressDialogType)
    38     const QVariantMap &parameters) : HbProgressDialog(progressDialogType)
    39 {
    39 {
    40     TRACE_ENTRY
    40     TRACE_ENTRY
    41     mLastError = NoError;
    41     mLastError = NoError;
    42     mProgressDialogType = progressDialogType;
    42     mProgressDialogType = progressDialogType;
    43     mShowEventReceived = false;
    43     mCloseEventReceived = false;
    44     mAction = 0;
    44     mAction = 0;
    45     resetProperties();
    45     resetProperties();
    46     constructDialog(parameters);
    46     constructDialog(parameters);
    47     if (!mAction) {
    47     if (!mAction) {
    48         // If HbProgressDialog default button is used, connect into its triggered signal.
    48         // If HbProgressDialog default button is used, connect into its triggered signal.
    50         if (act) {
    50         if (act) {
    51             connect(act, SIGNAL(triggered()), SLOT(cancelTriggered()));
    51             connect(act, SIGNAL(triggered()), SLOT(cancelTriggered()));
    52         }
    52         }
    53     }
    53     }
    54     setBackgroundFaded(true);
    54     setBackgroundFaded(true);
       
    55     setDismissOnAction(false);
    55     TRACE_EXIT
    56     TRACE_EXIT
    56 }
    57 }
    57 
    58 
    58 // Destructor
    59 // Destructor
    59 HbDeviceProgressDialogWidget::~HbDeviceProgressDialogWidget()
    60 HbDeviceProgressDialogWidget::~HbDeviceProgressDialogWidget()
    90 void HbDeviceProgressDialogWidget::closeDeviceDialog(bool byClient)
    91 void HbDeviceProgressDialogWidget::closeDeviceDialog(bool byClient)
    91 {
    92 {
    92     TRACE_ENTRY
    93     TRACE_ENTRY
    93     Q_UNUSED(byClient);
    94     Q_UNUSED(byClient);
    94     cancel();
    95     cancel();
    95     // If show event has been received, close is signalled from hide event. If not,
       
    96     // hide event does not come and close is signalled from here.
       
    97     if (!mShowEventReceived) {
       
    98         emit deviceDialogClosed();
       
    99     }
       
   100     TRACE_EXIT
    96     TRACE_EXIT
   101 }
    97 }
   102 
    98 
   103 // Return display widget
    99 // Return display widget
   104 HbDialog *HbDeviceProgressDialogWidget::deviceDialogWidget() const
   100 HbDialog *HbDeviceProgressDialogWidget::deviceDialogWidget() const
   206 
   202 
   207 QString HbDeviceProgressDialogWidget::cancelAction() const
   203 QString HbDeviceProgressDialogWidget::cancelAction() const
   208 {
   204 {
   209     TRACE_ENTRY
   205     TRACE_ENTRY
   210     QAction *act = action(Cancel);
   206     QAction *act = action(Cancel);
   211 	QString actionData;
   207     QString actionData;
   212     if (act) {
   208     if (act) {
   213         actionData.append(actionTextTag);
   209         actionData.append(actionTextTag);
   214         actionData.append(act->text());
   210         actionData.append(act->text());
   215     }
   211     }
   216     TRACE_EXIT
   212     TRACE_EXIT
   275     HbIconAnimationManager *manager = HbIconAnimationManager::global();
   271     HbIconAnimationManager *manager = HbIconAnimationManager::global();
   276     manager->addDefinitionFile(animationDefinition);
   272     manager->addDefinitionFile(animationDefinition);
   277     mAnimationDefinition = animationDefinition;
   273     mAnimationDefinition = animationDefinition;
   278 }
   274 }
   279 
   275 
       
   276 void HbDeviceProgressDialogWidget::setShowLevel(int level)
       
   277 {
       
   278     // Level can only be set on construction
       
   279     Q_UNUSED(level)
       
   280 }
       
   281 
       
   282 int HbDeviceProgressDialogWidget::showLevel() const
       
   283 {
       
   284     return 0;
       
   285 }
       
   286 
   280 // Widget is about to hide. Closing effect has ended.
   287 // Widget is about to hide. Closing effect has ended.
   281 void HbDeviceProgressDialogWidget::hideEvent(QHideEvent *event)
   288 void HbDeviceProgressDialogWidget::hideEvent(QHideEvent *event)
   282 {
   289 {
   283     HbProgressDialog::hideEvent(event);
   290     HbProgressDialog::hideEvent(event);
   284     emit deviceDialogClosed();
   291     if (mCloseEventReceived) {
   285 }
   292         emit deviceDialogClosed();
   286 
   293     }
   287 // Widget is about to show
   294 }
   288 void HbDeviceProgressDialogWidget::showEvent(QShowEvent *event)
   295 
   289 {
   296 // Widget is about to close, close() has been called
   290     HbProgressDialog::showEvent(event);
   297 void HbDeviceProgressDialogWidget::closeEvent(QCloseEvent * event)
   291     mShowEventReceived = true;
   298 {
       
   299     HbProgressDialog::closeEvent(event);
       
   300     mCloseEventReceived = true;
       
   301     // If widget is visible, close is signalled from hide event. If not,
       
   302     // hide event does not come and close is signalled from here.
       
   303     if (!isVisible()) {
       
   304         emit deviceDialogClosed();
       
   305     }
   292 }
   306 }
   293 
   307 
   294 // Primary action triggered
   308 // Primary action triggered
   295 void HbDeviceProgressDialogWidget::cancelTriggered()
   309 void HbDeviceProgressDialogWidget::cancelTriggered()
   296 {
   310 {
   297     TRACE_ENTRY
   311     TRACE_ENTRY
   298     QVariantMap data;
   312     QVariantMap data;
   299     data.insert("act", "c");
   313     data.insert("act", "c");
   300     emit deviceDialogData(data);
   314     emit deviceDialogData(data);
   301     TRACE_EXIT
   315     close();
   302 }
   316     TRACE_EXIT
       
   317 }