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

View File

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

View File

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

View File

@ -34,6 +34,7 @@ QtObject {
signal askDisableLocalCache() signal askDisableLocalCache()
signal askEnableLocalCache(var path) signal askEnableLocalCache(var path)
signal askResetBridge() signal askResetBridge()
signal askChangeAllMailVisibility(var isVisibleNow)
signal askDeleteAccount(var user) signal askDeleteAccount(var user)
enum Group { enum Group {
@ -72,6 +73,7 @@ QtObject {
root.disableLocalCache, root.disableLocalCache,
root.enableLocalCache, root.enableLocalCache,
root.resetBridge, root.resetBridge,
root.changeAllMailVisibility,
root.deleteAccount, root.deleteAccount,
root.noKeychain, root.noKeychain,
root.rebuildKeychain, 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 { property Notification deleteAccount: Notification {
title: qsTr("Remove this account?") title: qsTr("Remove this account?")
brief: title brief: title

View File

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