mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 23:50:18 -04:00
Toast notifications and undo mechanism now works! (for group and entries)
This commit is contained in:
@@ -6,6 +6,7 @@ using ModernKeePassLib;
|
||||
using ModernKeePassLib.Cryptography.PasswordGenerator;
|
||||
using ModernKeePassLib.Security;
|
||||
using System;
|
||||
using Windows.UI.Xaml;
|
||||
|
||||
namespace ModernKeePass.ViewModels
|
||||
{
|
||||
@@ -112,10 +113,6 @@ namespace ModernKeePass.ViewModels
|
||||
ParentGroup = parent;
|
||||
}
|
||||
|
||||
public void RemoveEntry()
|
||||
{
|
||||
ParentGroup.RemoveEntry(this);
|
||||
}
|
||||
|
||||
public void GeneratePassword()
|
||||
{
|
||||
@@ -154,10 +151,22 @@ namespace ModernKeePass.ViewModels
|
||||
{
|
||||
Entry?.Strings.Set(key, new ProtectedString(true, newValue));
|
||||
}
|
||||
|
||||
|
||||
public void MarkForDelete()
|
||||
{
|
||||
var app = (App)Application.Current;
|
||||
app.PendingDeleteEntities.Add(Id, this);
|
||||
ParentGroup.Entries.Remove(this);
|
||||
}
|
||||
public void CommitDelete()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
Entry.ParentGroup.Entries.Remove(Entry);
|
||||
}
|
||||
|
||||
public void UndoDelete()
|
||||
{
|
||||
ParentGroup.Entries.Add(this);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -97,23 +97,11 @@ namespace ModernKeePass.ViewModels
|
||||
Entries.Add(newEntry);
|
||||
return newEntry;
|
||||
}
|
||||
|
||||
public void RemoveGroup()
|
||||
{
|
||||
_pwGroup.ParentGroup.Groups.Remove(_pwGroup);
|
||||
ParentGroup.Groups.Remove(this);
|
||||
}
|
||||
|
||||
public void RemoveEntry(EntryVm entry)
|
||||
{
|
||||
_pwGroup.Entries.Remove(entry.Entry);
|
||||
Entries.Remove(entry);
|
||||
}
|
||||
|
||||
public void MarkForDelete()
|
||||
{
|
||||
var app = (App)Application.Current;
|
||||
app.PendingDeleteQueue.Enqueue(this);
|
||||
app.PendingDeleteEntities.Add(Id, this);
|
||||
ParentGroup.Groups.Remove(this);
|
||||
}
|
||||
|
||||
@@ -121,5 +109,9 @@ namespace ModernKeePass.ViewModels
|
||||
{
|
||||
_pwGroup.ParentGroup.Groups.Remove(_pwGroup);
|
||||
}
|
||||
public void UndoDelete()
|
||||
{
|
||||
ParentGroup.Groups.Add(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user