Make group navigation controller-driven
This commit is contained in:
+2
-18
@@ -6,7 +6,6 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"git.julianfamily.org/keepassgo/appstate"
|
||||
"git.julianfamily.org/keepassgo/clipboard"
|
||||
"git.julianfamily.org/keepassgo/passwords"
|
||||
"git.julianfamily.org/keepassgo/vault"
|
||||
@@ -25,7 +24,7 @@ func (u *ui) loadSelectedEntryIntoEditor() {
|
||||
u.entryURL.SetText("")
|
||||
u.entryNotes.SetText("")
|
||||
u.entryTags.SetText("")
|
||||
u.entryPath.SetText(strings.Join(u.currentPath, " / "))
|
||||
u.entryPath.SetText(strings.Join(u.state.CurrentPath, " / "))
|
||||
u.entryFields.SetText("")
|
||||
u.attachmentName.SetText("")
|
||||
u.attachmentPath.SetText("")
|
||||
@@ -161,24 +160,9 @@ func (u *ui) renameGroupAction() error {
|
||||
}
|
||||
|
||||
func (u *ui) deleteCurrentGroupAction() error {
|
||||
session, ok := u.state.Session.(appstate.MutableSession)
|
||||
if !ok {
|
||||
return fmt.Errorf("session is not mutable")
|
||||
}
|
||||
|
||||
model, err := session.Current()
|
||||
if err != nil {
|
||||
if err := u.state.DeleteCurrentGroup(); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := model.DeleteGroup(u.currentPath); err != nil {
|
||||
return err
|
||||
}
|
||||
session.Replace(model)
|
||||
if len(u.currentPath) > 0 {
|
||||
u.currentPath = append([]string(nil), u.currentPath[:len(u.currentPath)-1]...)
|
||||
u.state.CurrentPath = append([]string(nil), u.currentPath...)
|
||||
}
|
||||
u.state.Dirty = true
|
||||
u.filter()
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user