Index: denali.qrc =================================================================== diff -u -rc1ceb8df87b195e8a1b9dc09e0bbab9c6655c308 -r364cf0959b78d4e86c7220fb878c5246c9d7d6bd --- denali.qrc (.../denali.qrc) (revision c1ceb8df87b195e8a1b9dc09e0bbab9c6655c308) +++ denali.qrc (.../denali.qrc) (revision 364cf0959b78d4e86c7220fb878c5246c9d7d6bd) @@ -27,7 +27,7 @@ sources/gui/qml/pages/settings/SettingsDecommission.qml - sources/gui/qml/dialogs/PowerOff.qml + sources/gui/qml/dialogs/ConfirmDialog.qml sources/gui/qml/dialogs/AutoHideInfo.qml sources/gui/qml/dialogs/NotificationDialog.qml sources/gui/qml/dialogs/AlarmListDialog.qml Index: sources/gui/qml/AlarmItem.qml =================================================================== diff -u -r689177edf29dee6f10bebfed42f6bbadeb7ce8a8 -r364cf0959b78d4e86c7220fb878c5246c9d7d6bd --- sources/gui/qml/AlarmItem.qml (.../AlarmItem.qml) (revision 689177edf29dee6f10bebfed42f6bbadeb7ce8a8) +++ sources/gui/qml/AlarmItem.qml (.../AlarmItem.qml) (revision 364cf0959b78d4e86c7220fb878c5246c9d7d6bd) @@ -72,6 +72,9 @@ // Look at the PowerItem as an example. if ( ! vAlarmStatus.hasAlarm ) return + // close the user confrimation dialog if the alarm dialog is going to be dispalyed + _confirmDialog.close() + if ( _root._DEBUG_DISABLE_MAXIMIZE_ ) { alarmMinimize() } else { Index: sources/gui/qml/PowerItem.qml =================================================================== diff -u -raf8d98b36b427e2b5f4d6659fcf3b58ee79eab6a -r364cf0959b78d4e86c7220fb878c5246c9d7d6bd --- sources/gui/qml/PowerItem.qml (.../PowerItem.qml) (revision af8d98b36b427e2b5f4d6659fcf3b58ee79eab6a) +++ sources/gui/qml/PowerItem.qml (.../PowerItem.qml) (revision 364cf0959b78d4e86c7220fb878c5246c9d7d6bd) @@ -37,7 +37,7 @@ AutoHideInfo { id: _autoHideInfo } - PowerOff { id: _powerOffDialog + ConfirmDialog { id: _powerOffDialog idText : vConfirm.id titleText : vConfirm.title messageText : vConfirm.message @@ -73,6 +73,7 @@ function open() { _root.isOpen = true _powerOffDialog.open() + _confirmDialog.close() // close the user confrimation dialog if the power off is requested _alarmItem.alarmMinimize() } Index: sources/gui/qml/dialogs/ConfirmDialog.qml =================================================================== diff -u --- sources/gui/qml/dialogs/ConfirmDialog.qml (revision 0) +++ sources/gui/qml/dialogs/ConfirmDialog.qml (revision 364cf0959b78d4e86c7220fb878c5246c9d7d6bd) @@ -0,0 +1,90 @@ +/*! + * + * Copyright (c) 2019-2023 Diality Inc. - All Rights Reserved. + * \copyright + * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN + * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. + * + * \file PowerOff.qml + * \author (last) Behrouz NematiPour + * \date (last) 06-Oct-2022 + * \author (original) Behrouz NematiPour + * \date (original) 18-Oct-2019 + * + */ + +// Qt +import QtQuick 2.12 + +// Project +// Qml imports +import "qrc:/globals" +import "qrc:/components" + +/*! + * \brief Contains the PowerOff Dialog Implementation + */ +ModalDialog { id : _root + contentItem.objectName : "PowerOffDialog" //SquishQt testability + property string idText : "" + property alias titleText : _titleText.text + property alias messageText : _messageText.text + property alias confirmText : _confirmTouch.textString + property alias confirmVisible : _confirmTouch.visible + property alias cancelText : _cancelTouch.textString + property alias cancelVisible : _cancelTouch.visible + property bool autoClose : true + + function footerUpdate() { + _footer.update() + } + + TitleText { id: _titleText + width : _root.width + height : Variables.mainMenuHeight + anchors.top : parent.top + anchors.topMargin : Variables.minVGap2 // Since it doesnt have border, it looks too close to top border. + clip : true + } + + TitleText { id: _messageText + anchors.centerIn : parent + width : parent.width + height : Variables.mainMenuHeight * 4 // title + reason + 2*Gap + clip : true + text : qsTr("Are you sure?") + } + + Footer { id: _footer + childrenWidth: 350 + children: [ + TouchRect { id : _cancelTouch + textString : qsTr("CANCEL") + onPressed : { + rejected() + if ( autoClose ) close() + } + }, + TouchRect { id : _confirmTouch + textString : qsTr("CONFIRM") + onPressed : { + accepted() + if ( autoClose ) close() + } + } + ] + } + + Text { id: _idText + text : qsTr("ID") + ":" + _root.idText + visible : _root.idText + anchors { + left : parent.left + bottom : parent.bottom + leftMargin : 5 + bottomMargin: 5 + } + color : notification.visible ? Colors.backgroundDialog : Colors.textMain + font.pixelSize : Fonts.fontPixelDialogText + } +} Fisheye: Tag 364cf0959b78d4e86c7220fb878c5246c9d7d6bd refers to a dead (removed) revision in file `sources/gui/qml/dialogs/PowerOff.qml'. Fisheye: No comparison available. Pass `N' to diff? Index: sources/gui/qml/main.qml =================================================================== diff -u -rb9d5efd980be633f5d0bd92cc76295f3a0669db4 -r364cf0959b78d4e86c7220fb878c5246c9d7d6bd --- sources/gui/qml/main.qml (.../main.qml) (revision b9d5efd980be633f5d0bd92cc76295f3a0669db4) +++ sources/gui/qml/main.qml (.../main.qml) (revision 364cf0959b78d4e86c7220fb878c5246c9d7d6bd) @@ -406,13 +406,9 @@ // keyboard should always be before AlarmItem to not to covet it. KeyboardItem { id: _keyboard } - // AlarmItem should always be at the end so nothing covers it - AlarmItem { id: _alarmItem ; z: 997 } - - // PowerOff screen should still be avilable. Even if the Alarm happens the Power option should be available. - PowerItem { id: _powerItem ; z: 998 } - - // this dialog as an exception can cover the Alarm for debugging and testing. + AlarmItem { id: _alarmItem ; z: 996 } + PowerItem { id: _powerItem ; z: 997 } + ConfirmDialog { id: _confirmDialog ; z: 998 } DiagnosticsDialog { id: _diagnosticsDialog; z: 999 } // Note: NotificationBar has to be anchored to the main menu and if it is moved into the AlarmItem Index: sources/gui/qml/pages/settings/SettingsDecommission.qml =================================================================== diff -u -r80b5e8f1ebb90c03c37d90d90cd2da3bd95d6803 -r364cf0959b78d4e86c7220fb878c5246c9d7d6bd --- sources/gui/qml/pages/settings/SettingsDecommission.qml (.../SettingsDecommission.qml) (revision 80b5e8f1ebb90c03c37d90d90cd2da3bd95d6803) +++ sources/gui/qml/pages/settings/SettingsDecommission.qml (.../SettingsDecommission.qml) (revision 364cf0959b78d4e86c7220fb878c5246c9d7d6bd) @@ -25,16 +25,25 @@ * \brief SettingsDecommission is the screen * which asks for confirmation of performing a factory reset and doing it if confirmed */ -UserConfirmation{ id: _root +UserConfirmation { id : _root message : vDevice.decommissionEnabled ? qsTr("Do you want to perform the %1?").arg(title.toLowerCase()) : qsTr("Please wait ...") itemIndex : SettingsStack.Decommission notificationText : vDevice.status confirmVisible : true confirmEnabled : vDevice.decommissionEnabled - onConfirmClicked : vDevice.decommission = "" // Need to set to something (ie: emtpy string) to trigger CPP code backVisible : true backEnabled : vDevice.decommissionEnabled + + onConfirmClicked : { + _confirmDialog.titleText = _root.title + _confirmDialog.open() + } + Connections { target: _confirmDialog + function onAccepted() { + vDevice.decommission = "" // Need to set to something (ie: emtpy string) to trigger CPP code + } + } } Index: sources/gui/qml/pages/settings/SettingsFactoryReset.qml =================================================================== diff -u -r80b5e8f1ebb90c03c37d90d90cd2da3bd95d6803 -r364cf0959b78d4e86c7220fb878c5246c9d7d6bd --- sources/gui/qml/pages/settings/SettingsFactoryReset.qml (.../SettingsFactoryReset.qml) (revision 80b5e8f1ebb90c03c37d90d90cd2da3bd95d6803) +++ sources/gui/qml/pages/settings/SettingsFactoryReset.qml (.../SettingsFactoryReset.qml) (revision 364cf0959b78d4e86c7220fb878c5246c9d7d6bd) @@ -25,16 +25,25 @@ * \brief SettingsFactoryReset is the screen * which asks for confirmation of performing a factory reset and doing it if confirmed */ -UserConfirmation{ id: _root +UserConfirmation { id : _root message : vDevice.factoryResetEnabled ? qsTr("Do you want to perform the %1?").arg(title.toLowerCase()) : qsTr("Please wait ...") itemIndex : SettingsStack.FactoryReset notificationText : vDevice.status confirmVisible : true confirmEnabled : vDevice.factoryResetEnabled - onConfirmClicked : vDevice.factoryReset = "" // Need to set to something (ie: emtpy string) to trigger CPP code backVisible : true backEnabled : vDevice.factoryResetEnabled + + onConfirmClicked : { + _confirmDialog.titleText = _root.title + _confirmDialog.open() + } + Connections { target: _confirmDialog + function onAccepted() { + vDevice.factoryReset = "" // Need to set to something (ie: emtpy string) to trigger CPP code + } + } }