From 6ecabed7307fb73fe53ba74045ccbecacb791c87 Mon Sep 17 00:00:00 2001 From: Slavasil Date: Sun, 3 May 2026 20:07:21 +0300 Subject: [PATCH] add "Add Group" button --- src/KeyKeeper/PasswordStore/EntryIconType.cs | 2 +- .../ViewModels/EntryEditViewModel.cs | 3 +- .../ViewModels/UnlockedRepositoryViewModel.cs | 9 +++ src/KeyKeeper/Views/CreateGroupDialog.axaml | 60 +++++++++++++++ .../Views/CreateGroupDialog.axaml.cs | 74 +++++++++++++++++++ src/KeyKeeper/Views/RepositoryWindow.axaml | 8 ++ src/KeyKeeper/Views/RepositoryWindow.axaml.cs | 28 +++++++ 7 files changed, 181 insertions(+), 3 deletions(-) create mode 100644 src/KeyKeeper/Views/CreateGroupDialog.axaml create mode 100644 src/KeyKeeper/Views/CreateGroupDialog.axaml.cs diff --git a/src/KeyKeeper/PasswordStore/EntryIconType.cs b/src/KeyKeeper/PasswordStore/EntryIconType.cs index 0a1c7de..956f1c7 100644 --- a/src/KeyKeeper/PasswordStore/EntryIconType.cs +++ b/src/KeyKeeper/PasswordStore/EntryIconType.cs @@ -2,7 +2,7 @@ using System; namespace KeyKeeper.PasswordStore; -public static class EntryIconType +public static class BuiltinEntryIconType { public static readonly Guid KEY = Guid.Parse("65ab3d55-1652-4f66-aac9-c3617f14e308"); public static readonly Guid DEFAULT = KEY; diff --git a/src/KeyKeeper/ViewModels/EntryEditViewModel.cs b/src/KeyKeeper/ViewModels/EntryEditViewModel.cs index a0a105a..55e8264 100644 --- a/src/KeyKeeper/ViewModels/EntryEditViewModel.cs +++ b/src/KeyKeeper/ViewModels/EntryEditViewModel.cs @@ -323,7 +323,6 @@ public class EntryEditViewModel : ViewModelBase } catch (Exception) { - // Validation should have caught this, but handle gracefully totp = null; } } @@ -332,7 +331,7 @@ public class EntryEditViewModel : ViewModelBase id, created, DateTime.UtcNow, - EntryIconType.DEFAULT, + BuiltinEntryIconType.DEFAULT, EntryName.Trim(), new LoginField() { Type = LOGIN_FIELD_USERNAME_ID, Value = Username.Trim() }, new LoginField() { Type = LOGIN_FIELD_PASSWORD_ID, Value = Password }, diff --git a/src/KeyKeeper/ViewModels/UnlockedRepositoryViewModel.cs b/src/KeyKeeper/ViewModels/UnlockedRepositoryViewModel.cs index 7dd5e11..ec7e418 100644 --- a/src/KeyKeeper/ViewModels/UnlockedRepositoryViewModel.cs +++ b/src/KeyKeeper/ViewModels/UnlockedRepositoryViewModel.cs @@ -95,6 +95,15 @@ public class UnlockedRepositoryViewModel : ViewModelBase } } + public void AddGroup(PassStoreEntryGroup group) + { + if (rootDirectory == null) + return; + rootDirectory.AddEntry(group); + HasUnsavedChanges = true; + OnPropertyChanged(nameof(PasswordGroups)); + } + public void DeleteEntry(Guid id) { currentDirectory.DeleteEntry(id); diff --git a/src/KeyKeeper/Views/CreateGroupDialog.axaml b/src/KeyKeeper/Views/CreateGroupDialog.axaml new file mode 100644 index 0000000..988eaf7 --- /dev/null +++ b/src/KeyKeeper/Views/CreateGroupDialog.axaml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +