GODT-1794: Add confirmation dialog and change wording

This commit is contained in:
Jakub
2022-08-26 15:01:18 +02:00
parent 76469969f3
commit a93ed35eee
5 changed files with 63 additions and 15 deletions

View File

@ -674,7 +674,7 @@ Window {
}
RowLayout {
Label {colorScheme: root.colorScheme; text: "All Mail disabled:"}
Toggle {colorScheme: root.colorScheme; checked: root.isAllMailDisabled; onClicked: root.isAllMailDisabled = !root.isAllMailDisabled}
Toggle {colorScheme: root.colorScheme; checked: root.isAllMailVisible; onClicked: root.isAllMailVisible = !root.isAllMailVisible}
}
RowLayout {
Label {colorScheme: root.colorScheme; text: "Ports:"}
@ -815,10 +815,10 @@ Window {
root.isDoHEnabled = makeItActive
}
property bool isAllMailDisabled : false
function changeIsAllMailDisabled(isDisabled){
console.debug("-> All Mail Disabled", isDisabled, root.isAllMailDisabled)
root.isAllMailDisabled = isDisabled
property bool isAllMailVisible : true
function changeIsAllMailVisible(isVisible){
console.debug("-> All Mail Visible", isVisible, root.isAllMailVisible)
root.isAllMailVisible = isVisible
}

View File

@ -160,11 +160,11 @@ SettingsView {
id: allMail
visible: root._isAdvancedShown
colorScheme: root.colorScheme
text: qsTr("Disable All Mail")
description: qsTr("Choose not to list the All Mail folder in your local client.")
text: qsTr("Show All Mail")
description: qsTr("Choose to list the All Mail folder in your local client.")
type: SettingsItem.Toggle
checked: root.backend.isAllMailDisabled
onClicked: root.backend.changeIsAllMailDisabled(!allMail.checked )
checked: root.backend.isAllMailVisible
onClicked: root.notifications.askChangeAllMailVisibility(root.backend.isAllMailVisible)
Layout.fillWidth: true
}

View File

@ -110,6 +110,11 @@ Item {
notification: root.notifications.resetBridge
}
NotificationDialog {
colorScheme: root.colorScheme
notification: root.notifications.changeAllMailVisibility
}
NotificationDialog {
colorScheme: root.colorScheme
notification: root.notifications.deleteAccount

View File

@ -34,6 +34,7 @@ QtObject {
signal askDisableLocalCache()
signal askEnableLocalCache(var path)
signal askResetBridge()
signal askChangeAllMailVisibility(var isVisibleNow)
signal askDeleteAccount(var user)
enum Group {
@ -72,6 +73,7 @@ QtObject {
root.disableLocalCache,
root.enableLocalCache,
root.resetBridge,
root.changeAllMailVisibility,
root.deleteAccount,
root.noKeychain,
root.rebuildKeychain,
@ -840,6 +842,47 @@ QtObject {
]
}
property Notification changeAllMailVisibility: Notification {
title: root.changeAllMailVisibility.isVisibleNow ?
qsTr("Hide All Mail folder?") :
qsTr("Show All Mail folder?")
brief: title
icon: "./icons/ic-info-circle-filled.svg"
description: qsTr("Switching between showing and hiding the All Mail folder will require you to restart your client.")
type: Notification.NotificationType.Info
group: Notifications.Group.Configuration | Notifications.Group.Dialogs
property var isVisibleNow
Connections {
target: root
onAskChangeAllMailVisibility: {
root.changeAllMailVisibility.isVisibleNow = isVisibleNow
root.changeAllMailVisibility.active = true
}
}
action: [
Action {
id: allMail_change
text: root.changeAllMailVisibility.isVisibleNow ?
qsTr("Hide All Mail folder") :
qsTr("Show All Mail folder")
onTriggered: {
root.backend.changeIsAllMailVisible(!root.changeAllMailVisibility.isVisibleNow)
root.changeAllMailVisibility.active = false
}
},
Action {
id: allMail_cancel
text: qsTr("Cancel")
onTriggered: {
root.changeAllMailVisibility.active = false
}
}
]
}
property Notification deleteAccount: Notification {
title: qsTr("Remove this account?")
brief: title

View File

@ -156,8 +156,8 @@ type QMLBackend struct {
_ func(userID string) `signal:userChanged`
_ bool `property:"isAllMailDisabled"`
_ func(isDisabled bool) `slot:"changeIsAllMailDisabled"`
_ bool `property:"isAllMailVisible"`
_ func(isDisabled bool) `slot:"changeIsAllMailVisible"`
}
func (q *QMLBackend) setup(f *FrontendQt) {
@ -308,10 +308,10 @@ func (q *QMLBackend) setup(f *FrontendQt) {
}()
})
q.SetIsAllMailDisabled(!f.bridge.IsAllMailVisible())
q.ConnectChangeIsAllMailDisabled(func(isDisabled bool) {
f.bridge.SetIsAllMailVisible(!isDisabled)
f.qml.SetIsAllMailDisabled(isDisabled)
q.SetIsAllMailVisible(f.bridge.IsAllMailVisible())
q.ConnectChangeIsAllMailVisible(func(isVisible bool) {
f.bridge.SetIsAllMailVisible(isVisible)
f.qml.SetIsAllMailVisible(isVisible)
})
}