src/hbplugins/devicedialogs/devicenotificationdialogplugin/hbdevicenotificationdialogwidget.cpp
changeset 34 ed14f46c0e55
parent 0 16d8024aca5e
equal deleted inserted replaced
31:7516d6d86cf5 34:ed14f46c0e55
    41 HbDeviceNotificationDialogWidget::HbDeviceNotificationDialogWidget(const QVariantMap &parameters)
    41 HbDeviceNotificationDialogWidget::HbDeviceNotificationDialogWidget(const QVariantMap &parameters)
    42 : HbNotificationDialog()
    42 : HbNotificationDialog()
    43 {
    43 {
    44     TRACE_ENTRY
    44     TRACE_ENTRY
    45     mLastError = NoError;
    45     mLastError = NoError;
    46     mShowEventReceived = false;
    46     mCloseEventReceived = false;
    47     resetProperties();
    47     resetProperties();
    48     constructDialog(parameters);
    48     constructDialog(parameters);
    49 
    49 
    50 #ifdef HB_EFFECTS
    50 #ifdef HB_EFFECTS
    51     HbEffectInternal::add(this, "devicenotificationdialog_appear", "appear");
    51     HbEffectInternal::add(this, "devicenotificationdialog_appear", "appear");
    88 void HbDeviceNotificationDialogWidget::closeDeviceDialog(bool byClient)
    88 void HbDeviceNotificationDialogWidget::closeDeviceDialog(bool byClient)
    89 {
    89 {
    90     TRACE_ENTRY
    90     TRACE_ENTRY
    91     Q_UNUSED(byClient);
    91     Q_UNUSED(byClient);
    92     close();
    92     close();
    93     // If show event has been received, close is signalled from hide event. If not,
       
    94     // hide event does not come and close is signalled from here.
       
    95     if (!mShowEventReceived) {
       
    96         emit deviceDialogClosed();
       
    97     }
       
    98     TRACE_EXIT
    93     TRACE_EXIT
    99 }
    94 }
   100 
    95 
   101 // Return display widget
    96 // Return display widget
   102 HbDialog *HbDeviceNotificationDialogWidget::deviceDialogWidget() const
    97 HbDialog *HbDeviceNotificationDialogWidget::deviceDialogWidget() const
   182     HbIcon hbicon(iconName);
   177     HbIcon hbicon(iconName);
   183     setIcon(hbicon);
   178     setIcon(hbicon);
   184     TRACE_EXIT
   179     TRACE_EXIT
   185 }
   180 }
   186 
   181 
       
   182 void HbDeviceNotificationDialogWidget::setShowLevel(int level)
       
   183 {
       
   184     // Show level can only be set on construction
       
   185     Q_UNUSED(level)
       
   186 }
       
   187 
       
   188 int HbDeviceNotificationDialogWidget::showLevel() const
       
   189 {
       
   190     return 0;
       
   191 }
       
   192 
   187 // Widget is about to hide. Closing effect has ended.
   193 // Widget is about to hide. Closing effect has ended.
   188 void HbDeviceNotificationDialogWidget::hideEvent(QHideEvent *event)
   194 void HbDeviceNotificationDialogWidget::hideEvent(QHideEvent *event)
   189 {
   195 {
   190     HbNotificationDialog::hideEvent(event);
   196     HbNotificationDialog::hideEvent(event);
   191     emit deviceDialogClosed();
   197     if (mCloseEventReceived) {
   192 }
   198         emit deviceDialogClosed();
   193 
   199     }
   194 // Widget is about to show
   200 }
   195 void HbDeviceNotificationDialogWidget::showEvent(QShowEvent *event)
   201 
   196 {
   202 // Widget is about to close, close() has been called
   197     HbNotificationDialog::showEvent(event);
   203 void HbDeviceNotificationDialogWidget::closeEvent(QCloseEvent *event)
   198     mShowEventReceived = true;
   204 {
       
   205     HbNotificationDialog::closeEvent(event);
       
   206     mCloseEventReceived = true;
       
   207     // If widget is visible, close is signalled from hide event. If not,
       
   208     // hide event does not come and close is signalled from here.
       
   209     if (!isVisible()) {
       
   210         emit deviceDialogClosed();
       
   211     }
   199 }
   212 }
   200 
   213 
   201 QString HbDeviceNotificationDialogWidget::animationDefinition() const
   214 QString HbDeviceNotificationDialogWidget::animationDefinition() const
   202 {
   215 {
   203     TRACE_ENTRY
   216     TRACE_ENTRY