Skip to content

Commit

Permalink
Fix issue #24
Browse files Browse the repository at this point in the history
  • Loading branch information
lcmaqueda committed Nov 18, 2016
1 parent 5cb665e commit 68d4837
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
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

0 comments on commit 68d4837

Please sign in to comment.