mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-10 04:36:43 +00:00
GODT-1741: GUI and CLI settings to change visibility of All Mail folder.
This commit is contained in:
@ -137,6 +137,23 @@ func New( //nolint:funlen
|
||||
})
|
||||
fe.AddCmd(dohCmd)
|
||||
|
||||
// All mail visibility commands.
|
||||
allMailCmd := &ishell.Cmd{
|
||||
Name: "all-mail-visibility",
|
||||
Help: "choose not to list the All Mail folder in your local client",
|
||||
}
|
||||
allMailCmd.AddCmd(&ishell.Cmd{
|
||||
Name: "disable",
|
||||
Help: "All Mail folder will not be listed in your local client",
|
||||
Func: fe.disableAllMail,
|
||||
})
|
||||
allMailCmd.AddCmd(&ishell.Cmd{
|
||||
Name: "enable",
|
||||
Help: "All Mail folder will be listed in your local client",
|
||||
Func: fe.enableAllMail,
|
||||
})
|
||||
fe.AddCmd(allMailCmd)
|
||||
|
||||
// Cache-On-Disk commands.
|
||||
codCmd := &ishell.Cmd{
|
||||
Name: "local-cache",
|
||||
|
||||
@ -152,6 +152,32 @@ func (f *frontendCLI) disallowProxy(c *ishell.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
func (f *frontendCLI) disableAllMail(c *ishell.Context) {
|
||||
if !f.bridge.IsAllMailVisible() {
|
||||
f.Println("All Mail folder is not listed in your local client.")
|
||||
return
|
||||
}
|
||||
|
||||
f.Println("All Mail folder is listed in your client right now.")
|
||||
|
||||
if f.yesNoQuestion("Do you want to hide All Mail folder") {
|
||||
f.bridge.SetIsAllMailVisible(false)
|
||||
}
|
||||
}
|
||||
|
||||
func (f *frontendCLI) enableAllMail(c *ishell.Context) {
|
||||
if f.bridge.IsAllMailVisible() {
|
||||
f.Println("All Mail folder is listed in your local client.")
|
||||
return
|
||||
}
|
||||
|
||||
f.Println("All Mail folder is not listed in your client right now.")
|
||||
|
||||
if f.yesNoQuestion("Do you want to show All Mail folder") {
|
||||
f.bridge.SetIsAllMailVisible(true)
|
||||
}
|
||||
}
|
||||
|
||||
func (f *frontendCLI) enableCacheOnDisk(c *ishell.Context) {
|
||||
if f.settings.GetBool(settings.CacheEnabledKey) {
|
||||
f.Println("The local cache is already enabled.")
|
||||
|
||||
@ -672,6 +672,10 @@ Window {
|
||||
Label {colorScheme: root.colorScheme; text: "DoH:"}
|
||||
Toggle {colorScheme: root.colorScheme; checked: root.isDoHEnabled; onClicked: root.isDoHEnabled = !root.isDoHEnabled}
|
||||
}
|
||||
RowLayout {
|
||||
Label {colorScheme: root.colorScheme; text: "All Mail disabled:"}
|
||||
Toggle {colorScheme: root.colorScheme; checked: root.isAllMailDisabled; onClicked: root.isAllMailDisabled = !root.isAllMailDisabled}
|
||||
}
|
||||
RowLayout {
|
||||
Label {colorScheme: root.colorScheme; text: "Ports:"}
|
||||
TextField {
|
||||
@ -811,6 +815,13 @@ Window {
|
||||
root.isDoHEnabled = makeItActive
|
||||
}
|
||||
|
||||
property bool isAllMailDisabled : false
|
||||
function changeIsAllMailDisabled(isDisabled){
|
||||
console.debug("-> All Mail Disabled", isDisabled, root.isAllMailDisabled)
|
||||
root.isAllMailDisabled = isDisabled
|
||||
}
|
||||
|
||||
|
||||
property bool useSSLforSMTP: false
|
||||
function toggleUseSSLforSMTP(makeItActive){
|
||||
console.debug("-> SMTP SSL", makeItActive, root.useSSLforSMTP)
|
||||
|
||||
@ -156,6 +156,19 @@ SettingsView {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
SettingsItem {
|
||||
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.")
|
||||
type: SettingsItem.Toggle
|
||||
checked: root.backend.isAllMailDisabled
|
||||
onClicked: root.backend.changeIsAllMailDisabled(!allMail.checked )
|
||||
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
SettingsItem {
|
||||
id: ports
|
||||
visible: root._isAdvancedShown
|
||||
|
||||
@ -155,6 +155,9 @@ type QMLBackend struct {
|
||||
_ func() `signal:apiCertIssue`
|
||||
|
||||
_ func(userID string) `signal:userChanged`
|
||||
|
||||
_ bool `property:"isAllMailDisabled"`
|
||||
_ func(isDisabled bool) `slot:"changeIsAllMailDisabled"`
|
||||
}
|
||||
|
||||
func (q *QMLBackend) setup(f *FrontendQt) {
|
||||
@ -304,4 +307,11 @@ func (q *QMLBackend) setup(f *FrontendQt) {
|
||||
f.changeKeychain(k)
|
||||
}()
|
||||
})
|
||||
|
||||
q.SetIsAllMailDisabled(!f.bridge.IsAllMailVisible())
|
||||
q.ConnectChangeIsAllMailDisabled(func(isDisabled bool) {
|
||||
f.bridge.SetIsAllMailVisible(!isDisabled)
|
||||
f.qml.SetIsAllMailDisabled(isDisabled)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
@ -92,6 +92,8 @@ type Bridger interface {
|
||||
DisableAutostart() error
|
||||
GetLastVersion() string
|
||||
IsFirstStart() bool
|
||||
IsAllMailVisible() bool
|
||||
SetIsAllMailVisible(bool)
|
||||
}
|
||||
|
||||
type bridgeWrap struct {
|
||||
|
||||
Reference in New Issue
Block a user