Index: sources/gui/qml/PowerItem.qml =================================================================== diff -u -r27cc308ff5113a9386899d3c8f8b29962a8498e1 -r13e65c3d271d503c2e2e2f1f20736652c470f8cc --- sources/gui/qml/PowerItem.qml (.../PowerItem.qml) (revision 27cc308ff5113a9386899d3c8f8b29962a8498e1) +++ sources/gui/qml/PowerItem.qml (.../PowerItem.qml) (revision 13e65c3d271d503c2e2e2f1f20736652c470f8cc) @@ -20,8 +20,10 @@ // C++ imports import Gui.View 0.1 import Gui.Actions 0.1 -import VPowerOff 0.1 +// Confirm +import VConfirm 0.1 + // Qml imports import "qrc:/globals" import "qrc:/components" @@ -34,24 +36,18 @@ Item { id: _root anchors.fill: parent - VPowerOff { id: vPowerOff } - + VConfirm { id: vConfirm } AutoHideInfo { id: _autoHideInfo } - Connections { target: _GuiView - onDidActionReceive: { - 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; - } - } - } - PowerOff { id: _powerOffDialog + visible : vConfirm.visible + titleText : vConfirm.title + messageText : vConfirm.message + confirmText : vConfirm.confirm + confirmVisible : ! vConfirm.isReject + cancelText : vConfirm.cancel + notificationText: vConfirm.adjustment_ReasonText + onVisibleChanged: { if (visible) _alarmItem.alarmHide() else _alarmItem.alarmMaximize() @@ -64,27 +60,63 @@ } } - Connections { target: vPowerOff - onPoweroffTriggered: { - switch (vpoweroff) { - case GuiActions.Command: - _powerOffDialog.open() - _alarmItem.alarmHide() - break; + function open() { + _powerOffDialog.open() + _alarmItem.alarmMinimize() + } - case GuiActions.Timeout: - _powerOffDialog.close() - _alarmItem.alarmMaximize() - break; + function close() { + _powerOffDialog.close() + _alarmItem.alarmMaximize() + } - case GuiActions.Rejected: - _autoHideInfo.showDialog( - qsTr("Cannot shutdown during 'Treatment'"), // '%1').arg() - 2000 // notifies user and hides the dialog + 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() + 2000 // notifies user and hides the dialog + ) + } + + // ---- Connections + Connections { target: _GuiView + onDidActionReceive: { + 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 + onIsRejectChanged: { + _powerOffDialog.footerUpdate() + } + + onVisibleChanged: { + if ( vvisible ) open () + else close () + } + + onPoweroffTriggered: { + switch (vpoweroff) { + case GuiActions.Command : open (); break; + case GuiActions.Timeout : close (); break; + case GuiActions.Rejected: reject(); break; + } + } + onAdjustmentTriggered: { + // 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 + // ) + } + } }