Index: sources/gui/qml/PowerItem.qml =================================================================== diff -u -r5ed84841f5852381b2e36328c0aeca7bc97b9c03 -re255d4633b338f4f46c3a2fad5a62f982ebfcd18 --- sources/gui/qml/PowerItem.qml (.../PowerItem.qml) (revision 5ed84841f5852381b2e36328c0aeca7bc97b9c03) +++ sources/gui/qml/PowerItem.qml (.../PowerItem.qml) (revision e255d4633b338f4f46c3a2fad5a62f982ebfcd18) @@ -35,17 +35,16 @@ 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.isReject + autoClose : false onVisibleChanged: { _root.isOpen = visible @@ -78,56 +77,33 @@ 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() - if ( vValue ) _root.reject() + } } - function onVisibleChanged ( vValue ) { - if ( vValue ) open () - else close () + function onVisibleTriggered ( vValue ) { + print(vValue) + print("vConfirm.isReject " + vConfirm.isReject) + if ( vConfirm.isReject ) return + + if ( vValue ) open () + else close () } - function onPowerOffTriggered ( vValue ) { + 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. - ) + 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 - // ) - } } }