mirror of
https://github.com/KeyKeeperApp/KeyKeeper.git
synced 2026-05-09 09:56:32 +03:00
modified entries now retain their position
This commit is contained in:
@@ -7,4 +7,5 @@ public interface IPassStoreDirectory : IEnumerable<PassStoreEntry>
|
||||
{
|
||||
bool DeleteEntry(Guid id);
|
||||
void AddEntry(PassStoreEntry entry);
|
||||
void UpdateEntry(Guid id, PassStoreEntry entry);
|
||||
}
|
||||
|
||||
@@ -85,6 +85,21 @@ public class PassStoreEntryGroup : PassStoreEntry, IPassStoreDirectory
|
||||
return false;
|
||||
}
|
||||
|
||||
public void UpdateEntry(Guid id, PassStoreEntry entry)
|
||||
{
|
||||
entry.Parent = this;
|
||||
if (ChildEntries == null)
|
||||
return;
|
||||
for (int i = 0; i < ChildEntries.Count; i++)
|
||||
{
|
||||
if (ChildEntries[i].Id == id)
|
||||
{
|
||||
ChildEntries[i] = entry;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator<PassStoreEntry> IEnumerable<PassStoreEntry>.GetEnumerator()
|
||||
{
|
||||
return ChildEntries.GetEnumerator();
|
||||
|
||||
@@ -77,8 +77,7 @@ public class UnlockedRepositoryViewModel : ViewModelBase
|
||||
|
||||
public void UpdateEntry(PassStoreEntryPassword updatedEntry)
|
||||
{
|
||||
currentDirectory.DeleteEntry(updatedEntry.Id);
|
||||
currentDirectory.AddEntry(updatedEntry);
|
||||
currentDirectory.UpdateEntry(updatedEntry.Id, updatedEntry);
|
||||
HasUnsavedChanges = true;
|
||||
OnPropertyChanged(nameof(Passwords));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user