From 92741260221813d593590e5849727eb25cd7948d Mon Sep 17 00:00:00 2001 From: InspectorIT Date: Sun, 1 Mar 2026 15:06:07 +0300 Subject: [PATCH 1/9] add the hasUnsavedChanges flag and implemented it --- .../ViewModels/UnlockedRepositoryViewModel.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/KeyKeeper/ViewModels/UnlockedRepositoryViewModel.cs b/src/KeyKeeper/ViewModels/UnlockedRepositoryViewModel.cs index fe37cd5..c6551db 100644 --- a/src/KeyKeeper/ViewModels/UnlockedRepositoryViewModel.cs +++ b/src/KeyKeeper/ViewModels/UnlockedRepositoryViewModel.cs @@ -8,6 +8,7 @@ namespace KeyKeeper.ViewModels; public class UnlockedRepositoryViewModel : ViewModelBase { private IPassStore passStore; + private bool hasUnsavedChanges; public IEnumerable Passwords { @@ -19,6 +20,16 @@ public class UnlockedRepositoryViewModel : ViewModelBase } } + public bool HasUnsavedChanges + { + get => hasUnsavedChanges; + private set + { + hasUnsavedChanges = value; + OnPropertyChanged(nameof(HasUnsavedChanges)); + } + } + public UnlockedRepositoryViewModel(IPassStore store) { passStore = store; From eafa9fd558caaee46189533fab033e1cc433d1f5 Mon Sep 17 00:00:00 2001 From: InspectorIT Date: Sun, 1 Mar 2026 15:32:44 +0300 Subject: [PATCH 2/9] add the hasUnsavedChanges flag to the methods --- src/KeyKeeper/ViewModels/UnlockedRepositoryViewModel.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/KeyKeeper/ViewModels/UnlockedRepositoryViewModel.cs b/src/KeyKeeper/ViewModels/UnlockedRepositoryViewModel.cs index c6551db..7458814 100644 --- a/src/KeyKeeper/ViewModels/UnlockedRepositoryViewModel.cs +++ b/src/KeyKeeper/ViewModels/UnlockedRepositoryViewModel.cs @@ -33,6 +33,7 @@ public class UnlockedRepositoryViewModel : ViewModelBase public UnlockedRepositoryViewModel(IPassStore store) { passStore = store; + HasUnsavedChanges = false; } public void AddEntry(PassStoreEntry entry) @@ -40,6 +41,7 @@ public class UnlockedRepositoryViewModel : ViewModelBase if (entry is PassStoreEntryPassword) { (passStore.GetRootDirectory() as PassStoreEntryGroup)!.ChildEntries.Add(entry); + HasUnsavedChanges = true; OnPropertyChanged(nameof(Passwords)); } } @@ -47,11 +49,13 @@ public class UnlockedRepositoryViewModel : ViewModelBase public void DeleteEntry(Guid id) { (passStore.GetRootDirectory() as PassStoreEntryGroup)!.DeleteEntry(id); + HasUnsavedChanges = true; OnPropertyChanged(nameof(Passwords)); } public void Save() { passStore.Save(); + HasUnsavedChanges = false; } } \ No newline at end of file From 21a8688ad6a3c582b1241f79d0266029307558b8 Mon Sep 17 00:00:00 2001 From: InspectorIT Date: Sun, 1 Mar 2026 15:38:24 +0300 Subject: [PATCH 3/9] create CloseConfirmationDialog.axaml file --- src/KeyKeeper/Views/CloseConfirmationDialog.axaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/KeyKeeper/Views/CloseConfirmationDialog.axaml diff --git a/src/KeyKeeper/Views/CloseConfirmationDialog.axaml b/src/KeyKeeper/Views/CloseConfirmationDialog.axaml new file mode 100644 index 0000000..45dbbbc --- /dev/null +++ b/src/KeyKeeper/Views/CloseConfirmationDialog.axaml @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KeyKeeper.Views +{ + class CloseConfirmationDialog + { + } +} From 13139ed297122eca4104c63c2a212ede8486978a Mon Sep 17 00:00:00 2001 From: InspectorIT Date: Sun, 1 Mar 2026 15:40:30 +0300 Subject: [PATCH 4/9] create CloseConfirmationDialog.axaml.cs file --- src/KeyKeeper/Views/CloseConfirmationDialog.axaml.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/KeyKeeper/Views/CloseConfirmationDialog.axaml.cs diff --git a/src/KeyKeeper/Views/CloseConfirmationDialog.axaml.cs b/src/KeyKeeper/Views/CloseConfirmationDialog.axaml.cs new file mode 100644 index 0000000..85be7e9 --- /dev/null +++ b/src/KeyKeeper/Views/CloseConfirmationDialog.axaml.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KeyKeeper.Views +{ + internal class CloseConfirmationDialog + { + } +} From 63194d37d6e571232450999015c7a68a9f3ead31 Mon Sep 17 00:00:00 2001 From: InspectorIT Date: Sun, 1 Mar 2026 23:50:18 +0300 Subject: [PATCH 5/9] add CloseConfirmationDialog --- .../Views/CloseConfirmationDialog.axaml | 38 ++++++++---- .../Views/CloseConfirmationDialog.axaml.cs | 58 ++++++++++++++++--- 2 files changed, 76 insertions(+), 20 deletions(-) diff --git a/src/KeyKeeper/Views/CloseConfirmationDialog.axaml b/src/KeyKeeper/Views/CloseConfirmationDialog.axaml index 45dbbbc..2514c0a 100644 --- a/src/KeyKeeper/Views/CloseConfirmationDialog.axaml +++ b/src/KeyKeeper/Views/CloseConfirmationDialog.axaml @@ -1,12 +1,28 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; + + + -namespace KeyKeeper.Views -{ - class CloseConfirmationDialog - { - } -} + +