Index: sources/gui/qml/PowerItem.qml =================================================================== diff -u -rc66898d4ac69b72f1b9cc59e3039e7d9a1e59154 -raa2a5931f6ba6087d1f0afb300da9494ed4951c5 --- sources/gui/qml/PowerItem.qml (.../PowerItem.qml) (revision c66898d4ac69b72f1b9cc59e3039e7d9a1e59154) +++ sources/gui/qml/PowerItem.qml (.../PowerItem.qml) (revision aa2a5931f6ba6087d1f0afb300da9494ed4951c5) @@ -35,39 +35,30 @@ property bool isOpen: false - AutoHideInfo { id: _autoHideInfo } ConfirmDialog { id: _powerOffDialog idText : vConfirm.id titleText : vConfirm.title messageText : vConfirm.message confirmText : vConfirm.confirm cancelText : vConfirm.cancel - confirmVisible : ! vConfirm.isReject +// confirmVisible : ! vConfirm.isReject notificationText: vConfirm.adjustment_ReasonText - autoClose : vConfirm.isPowerOff || vConfirm.isReject + autoClose : false onVisibleChanged: { _root.isOpen = visible if (visible) _alarmItem.alarmHide() else _alarmItem.alarmMaximize() } + onAccepted: { - if ( vConfirm.isPowerOff ) { + if ( ! vConfirm.isReject ) { vConfirm.doConfirm( true ) } - else { - if ( ! vConfirm.isReject ) vConfirm.doConfirm( true ) - } } - onRejected: { - if ( vConfirm.isPowerOff ) { - vConfirm.doConfirm( false ) - } - else { - if ( ! vConfirm.isReject ) vConfirm.doConfirm( false ) - } - } + + onRejected: if ( ! vConfirm.isReject ) vConfirm.doConfirm( false ) } function open() { @@ -86,56 +77,31 @@ function cancel() { _root.isOpen = false _powerOffDialog.close() - if ( vConfirm.needConfirm ) vConfirm.doConfirm( false ) + vConfirm.doConfirm( false ) } - function reject() { // the power off is the only confirm has separate reject dialog, because the button is not only on UI and is HW as well. - _autoHideInfo.showDialog( - qsTr("Cannot shutdown during 'Treatment'"), // '%1').arg() + Connections { target: vConfirm + function onIsRejectTriggered ( vValue ) { + if ( vValue && ! _powerOffDialog.visible ) { + _autoHideInfo.showDialog( + vConfirm.adjustment_ReasonText, 2000 // notifies user and hides the dialog ) - } - - // ---- Connections - Connections { target: _GuiView - function onDidActionReceive( vAction, vData ) { - switch(vAction) { - case GuiActions.ID_ShuttingDown: - _autoHideInfo.showDialog ( - qsTr("System is shutting down"), - 5000 // if any error happens and shutdown is not successful then after 5 seconds dialog hides. - ) - break; } } - } - Connections { target: vConfirm - function onIsRejectChanged ( vValue ) { - _powerOffDialog.footerUpdate() - } + function onVisibleTriggered ( vValue ) { + if ( vConfirm.isReject ) return - function onVisibleChanged ( vValue ) { - if ( vValue ) open () - else close () + if ( vValue ) open () + else close () } - function onPoweroffTriggered ( vValue ) { - switch ( vValue ) { - case GuiActions.Command : open (); break; - case GuiActions.Timeout : close (); break; - case GuiActions.Rejected: reject(); break; - } + function onPowerOffTriggered ( vValue ) { + _autoHideInfo.showDialog ( + qsTr("System is shutting down"), + 5000 // if any error happens and shutdown is not successful then after 5 seconds dialog hides. + ) } - function onAdjustmentTriggered ( vValue ) { - // DEBUG: - // console.debug('\n' + - // 'id : ' + vConfirm.id + '\n' + - // 'command : ' + vConfirm.command + '\n' + - // 'title : ' + vConfirm.title + '\n' + - // 'message : ' + vConfirm.message + '\n' + - // 'adjustment_ReasonText : ' + vConfirm.adjustment_ReasonText - // ) - } } }