aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2023-08-18 19:45:28 +0200
committerRobin Jarry <robin@jarry.cc>2023-08-26 21:41:05 +0200
commit3e77fcb8fa9e4a06e9a84b9b16a0bbb9c6019083 (patch)
treee64d91d9fd76a3c4dac5e6fc354904695455400a
parent41dd51f7b30f328db5eb3f206b00ab9feebc2034 (diff)
downloadaerc-3e77fcb8fa9e4a06e9a84b9b16a0bbb9c6019083.tar.gz
wizard: allow setting special copy-to folder
Instead of a boolean, allow specifying the exact folder where to copy sent messages. Depending on the IMAP provider, the folders may be different. Instead of putting a default value which may not be correct, leave it empty. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Tristan Partin <tristan@partin.io> Tested-by: Tim Culverhouse <tim@timculverhouse.com>
-rw-r--r--widgets/account-wizard.go23
1 files changed, 7 insertions, 16 deletions
diff --git a/widgets/account-wizard.go b/widgets/account-wizard.go
index 6e54fe48..7f400a1e 100644
--- a/widgets/account-wizard.go
+++ b/widgets/account-wizard.go
@@ -65,7 +65,7 @@ type AccountWizard struct {
smtpMode int
smtpStr *ui.Text
smtpUrl url.URL
- copySent bool
+ copyTo *ui.TextInput
outgoing []ui.Interactive
// CONFIGURE_COMPLETE
complete []ui.Interactive
@@ -97,7 +97,6 @@ func NewAccountWizard(aerc *Aerc) *AccountWizard {
accountName: ui.NewTextInput("", config.Ui).Prompt("> "),
aerc: aerc,
temporary: false,
- copySent: true,
email: ui.NewTextInput("", config.Ui).Prompt("> "),
fullName: ui.NewTextInput("", config.Ui).Prompt("> "),
imapPassword: ui.NewTextInput("", config.Ui).Prompt("] ").Password(true),
@@ -108,6 +107,7 @@ func NewAccountWizard(aerc *Aerc) *AccountWizard {
smtpServer: ui.NewTextInput("", config.Ui).Prompt("> "),
smtpStr: ui.NewText("Connection URL: smtps://", config.Ui.GetStyle(config.STYLE_DEFAULT)),
smtpUsername: ui.NewTextInput("", config.Ui).Prompt("> "),
+ copyTo: ui.NewTextInput("", config.Ui).Prompt("> "),
}
// Autofill some stuff for the user
@@ -383,22 +383,13 @@ func NewAccountWizard(aerc *Aerc) *AccountWizard {
outgoing.AddChild(wizard.smtpStr).At(13, 0)
outgoing.AddChild(ui.NewFill(' ', tcell.StyleDefault)).At(14, 0)
outgoing.AddChild(
- ui.NewText("Copy sent messages to 'Sent' folder?",
+ ui.NewText("Copy sent messages to folder (leave empty to disable)",
config.Ui.GetStyle(config.STYLE_HEADER))).At(15, 0)
- copySent := NewSelector([]string{"Yes", "No"}, 0, config.Ui).
- Chooser(true).OnChoose(func(option string) {
- switch option {
- case "Yes":
- wizard.copySent = true
- case "No":
- wizard.copySent = false
- }
- })
- outgoing.AddChild(copySent).At(16, 0)
+ outgoing.AddChild(wizard.copyTo).At(16, 0)
outgoing.AddChild(selector).At(17, 0)
wizard.outgoing = []ui.Interactive{
wizard.smtpUsername, wizard.smtpPassword, wizard.smtpServer,
- smtpMode, copySent, selector,
+ smtpMode, wizard.copyTo, selector,
}
complete := ui.NewGrid().Rows([]ui.GridSpec{
@@ -511,8 +502,8 @@ func (wizard *AccountWizard) finish(tutorial bool) {
sec.NewKey("default", "INBOX") //nolint:errcheck // can't fail. option shadowing is not enabled and the key is not empty
sec.NewKey("from", fmt.Sprintf("%s <%s>", //nolint:errcheck // can't fail. option shadowing is not enabled and the key is not empty
wizard.fullName.String(), wizard.email.String()))
- if wizard.copySent {
- sec.NewKey("copy-to", "Sent") //nolint:errcheck // can't fail. option shadowing is not enabled and the key is not empty
+ if wizard.copyTo.String() != "" {
+ _, _ = sec.NewKey("copy-to", wizard.copyTo.String())
}
if !wizard.temporary {