Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue #24 #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions assets/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,12 @@ ApplicationWindow {
anchors.left: parent.left
anchors.leftMargin: 25
anchors.verticalCenter: parent.verticalCenter
Image{
id: metadataToggle
width: 48; height: 48
fillMode: Image.PreserveAspectFit
source: ui.showMetadata ? "eye_open.svg": "eye_closed.svg"

}
Image{
id: metadataToggle
width: 48; height: 48
fillMode: Image.PreserveAspectFit
source: ui.showMetadata ? "eye_open.svg": "eye_closed.svg"
}
}
Image {
id: logo
Expand Down
27 changes: 14 additions & 13 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func (ui *UI) ClearClipboard() {

// CopyToClipboard copies the selected password to the system clipboard
func (p *Passwords) CopyToClipboard(selected int) {
if selected >= len(p.hits) {
if selected < 0 || selected >= len(p.hits) {
ui.setStatus("No password selected")
return
}
Expand Down Expand Up @@ -143,11 +143,12 @@ func (p *Passwords) Update(status string) {
p.hits = p.store.Query(ui.query)
p.Len = len(p.hits)

var pw Password
ui.Password.Info = "No info available"
ui.Password.Name = ""
ui.Password.Metadata = ""

ui.Password.Info = "Test"
if p.Selected < p.Len {
pw = (p.hits)[p.Selected]
if 0 <= p.Selected && p.Selected < p.Len {
pw := (p.hits)[p.Selected]
ki := pw.KeyInfo()
if ki.Algorithm != "" {
ui.Password.Info = fmt.Sprintf("Encrypted with %d bit %s key %s",
Expand All @@ -158,18 +159,18 @@ func (p *Passwords) Update(status string) {
ui.Password.Cached = false
}
ui.Password.Name = pw.Name
if ui.ShowMetadata {
ui.Password.Metadata = pw.Metadata()
} else {
ui.Password.Metadata = "Press enter to decrypt"
ui.Password.Metadata = pw.Raw()
}
}

if ui.ShowMetadata {
ui.Password.Metadata = pw.Metadata()
} else {
ui.Password.Metadata = "Press enter to decrypt"
ui.Password.Metadata = pw.Raw()
}
qml.Changed(p, &p.Len)
qml.Changed(&ui, &ui.Password)
qml.Changed(&ui, &ui.Password.Metadata)
qml.Changed(&ui, &ui.Password.Info)
qml.Changed(&ui, &ui.Password.Name)
qml.Changed(&ui, &ui.Password.Metadata)
ui.setStatus(status)
}

Expand Down