Refine entry detail and edit panels

This commit is contained in:
Joe Julian
2026-04-01 17:15:08 -07:00
parent 6293eca072
commit 315988134b
4 changed files with 566 additions and 266 deletions
+28
View File
@@ -41,6 +41,7 @@ func (u *ui) attachmentInput() (string, []byte, error) {
func (u *ui) loadSelectedEntryIntoEditor() {
u.resetPasswordPeek()
u.clearGeneratedPasswordDraft()
u.selectedHistoryIndex = -1
u.historyIndex.SetText("")
@@ -175,6 +176,7 @@ func (u *ui) saveEntryAction() error {
return err
}
u.editingEntry = false
u.clearGeneratedPasswordDraft()
u.filter()
return nil
}
@@ -229,6 +231,7 @@ func (u *ui) saveTemplateAction() error {
return err
}
u.editingEntry = false
u.clearGeneratedPasswordDraft()
u.filter()
return nil
}
@@ -408,6 +411,7 @@ func (u *ui) generatePasswordAction() error {
return err
}
u.entryPassword.SetText(password)
u.generatedPasswordDraft = true
return nil
}
@@ -489,3 +493,27 @@ func marshalFields(fields map[string]string) string {
}
return strings.Join(lines, "\n")
}
func (u *ui) clearGeneratedPasswordDraft() {
u.generatedPasswordDraft = false
}
func (u *ui) attachmentActionSummary() string {
items := u.selectedAttachmentItems()
if len(items) == 0 {
return "No attachments yet. Add one below to store a file with this entry."
}
name := strings.TrimSpace(u.attachmentName.Text())
if name == "" {
return "Select an attachment above, then replace it, export it, or remove it below."
}
for _, item := range items {
if item.Name == name {
return fmt.Sprintf("Selected attachment %q. Replace it, export it, or remove it below.", name)
}
}
return fmt.Sprintf("Attachment %q is not on this entry yet. Add it as new, or select an existing attachment above.", name)
}