PWD-3: add context menu to delete passwords (#6)

This commit is contained in:
Markus Thielker 2025-01-24 17:46:17 +01:00 committed by GitHub
commit 593f4fbd93
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -62,6 +62,16 @@ struct ListView: View {
.background(selectedItem == password.id ? .blue : .clear)
.foregroundColor(selectedItem == password.id ? .white : (colorScheme == .dark ? .white : .black))
.cornerRadius(8)
.contextMenu {
Button {
selectedItem = nil
viewModel.deletePassword(password)
viewModel.passwords = viewModel.getAllPasswords()
} label: {
Label("Delete", systemImage: "trash")
}
.keyboardShortcut(.delete)
}
}
if isUpdateTextVisible {