aboutsummaryrefslogtreecommitdiff
path: root/widgets
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-05-22 11:13:55 -0400
committerDrew DeVault <sir@cmpwn.com>2019-05-22 11:13:55 -0400
commit58bc15b4727c034f9ce656f7774d68ec2e7a3f55 (patch)
tree617bf444d73635bb75848cf4638c2a8ab46c8666 /widgets
parent937b33c8505bc5414903bf6361cc15ea85f7f548 (diff)
Implement opening tutorial after account wizard
Diffstat (limited to 'widgets')
-rw-r--r--widgets/account-wizard.go22
1 files changed, 21 insertions, 1 deletions
diff --git a/widgets/account-wizard.go b/widgets/account-wizard.go
index 7ed9a62..aa68ed7 100644
--- a/widgets/account-wizard.go
+++ b/widgets/account-wizard.go
@@ -5,6 +5,7 @@ import (
"fmt"
"net/url"
"os"
+ "os/exec"
"path"
"strings"
"time"
@@ -451,6 +452,7 @@ func (wizard *AccountWizard) finish(tutorial bool) {
sec, _ = file.NewSection(wizard.accountName.String())
sec.NewKey("source", wizard.imapUrl.String())
sec.NewKey("outgoing", wizard.smtpUrl.String())
+ sec.NewKey("default", "INBOX")
if wizard.smtpMode == SMTP_STARTTLS {
sec.NewKey("smtp-starttls", "yes")
}
@@ -472,6 +474,7 @@ func (wizard *AccountWizard) finish(tutorial bool) {
account := config.AccountConfig{
Name: sec.Name(),
+ Default: "INBOX",
From: sec.Key("from").String(),
Source: sec.Key("source").String(),
Outgoing: sec.Key("outgoing").String(),
@@ -492,7 +495,24 @@ func (wizard *AccountWizard) finish(tutorial bool) {
wizard.aerc.NewTab(view, account.Name)
if tutorial {
- // TODO: Open tutorial
+ name := "aerc-tutorial"
+ if _, err := os.Stat("./aerc-tutorial.7"); !os.IsNotExist(err) {
+ // For development
+ name = "./aerc-tutorial.7"
+ }
+ term, err := NewTerminal(exec.Command("man", name))
+ if err != nil {
+ wizard.errorFor(nil, err)
+ return
+ }
+ wizard.aerc.NewTab(term, "Tutorial")
+ term.OnClose = func(err error) {
+ wizard.aerc.RemoveTab(term)
+ if err != nil {
+ wizard.aerc.PushStatus(" "+err.Error(), 10*time.Second).
+ Color(tcell.ColorDefault, tcell.ColorRed)
+ }
+ }
}
wizard.aerc.RemoveTab(wizard)