Skip to content

Commit

Permalink
allow entry description to change
Browse files Browse the repository at this point in the history
  • Loading branch information
tomcz committed Jul 5, 2024
1 parent 85decb8 commit e2f6239
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/main/java/com/tomczarniecki/jpasskeep/MainListModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,23 @@ public Entry getEntry(int index) {
}

public void setEntry(Entry entry) {
entries.put(entry.getKey(), entry);
if (entries.containsKey(entry.getKey())) {
entries.put(entry.getKey(), entry);
} else {
ImportState state = stateForEntry(entry);
if (state.equals(ImportState.New)) {
entries.put(entry.getKey(), entry);
} else if (state.equals(ImportState.Changed)) {
for (Entry current : entries.values()) {
if (current.getDescription().equals(entry.getDescription())) {
current.setCategory(entry.getCategory());
current.setUsername(entry.getUsername());
current.setPassword(entry.getPassword());
current.setNotes(entry.getNotes());
}
}
}
}
filter();
}

Expand Down

0 comments on commit e2f6239

Please sign in to comment.