status-desktop/ui/app/AppLayouts/Profile/controls/NotificationSelect.qml
Sale Djenic 03d7632f32 fix(@desktop/notifications): revamp notifications settings & behaviour
- signal for adding notification to the Activity Center introduced
and emitted, but that part is not handled within this commit since
there are some details needed to be discussed in the PR#5334
- signal for displaying ephemeral app notification is introduced
and emitted, but that part is not handled within this commit since
we don't have yet ephemeral notificaiton in place.

Fixes #4902
2022-05-13 14:58:39 -04:00

72 lines
2.0 KiB
QML

import QtQuick 2.13
import QtQuick.Controls 2.13
import StatusQ.Controls 0.1
import StatusQ.Popups 0.1
import utils 1.0
Item {
id: root
signal sendAlertsClicked()
signal deliverQuietlyClicked()
signal turnOffClicked()
property string selected: Constants.settingsSection.notifications.sendAlertsValue
implicitWidth: button.width
implicitHeight: button.height
QtObject {
id: d
readonly property string sendAlertsText: qsTr("Send Alerts")
readonly property string deliverQuietlyText: qsTr("Deliver Quietly")
readonly property string turnOffText: qsTr("Turn Off")
}
StatusButton {
id: button
text: root.selected === Constants.settingsSection.notifications.turnOffValue? d.turnOffText :
root.selected === Constants.settingsSection.notifications.deliverQuietlyValue? d.deliverQuietlyText :
d.sendAlertsText
icon.name: "chevron-down"
onClicked: {
if (selectMenu.opened) {
selectMenu.close()
} else {
selectMenu.popup(button.x, button.y + button.height + 8)
}
}
}
StatusPopupMenu {
id: selectMenu
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
width: parent.width
clip: true
StatusMenuItem {
text: d.sendAlertsText
onTriggered: {
root.sendAlertsClicked()
}
}
StatusMenuItem {
text: d.deliverQuietlyText
onTriggered: {
root.deliverQuietlyClicked()
}
}
StatusMenuItem {
text: d.turnOffText
onTriggered: {
root.turnOffClicked()
}
}
}
}