add proper handling of default entry icon

This commit is contained in:
2026-02-20 21:36:35 +03:00
parent f59f4411ce
commit 8ed8a0cb15
5 changed files with 47 additions and 3 deletions

View File

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 26.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg
version="1.1"
id="Слой_1"
x="0px"
y="0px"
viewBox="0 0 48 48"
xml:space="preserve"
width="48"
height="48"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"><defs
id="defs1" />
<style
type="text/css"
id="style1">
.st0{fill:#00A4FF;}
</style>
<g
id="g1"
transform="matrix(0.16385143,0,0,0.16385143,-2.9171382,7.2325096)">
<path
class="st0"
d="M 286.94,89.23 H 180.3 C 173.13,56.78 144.32,32.44 109.95,32.44 70.2,32.44 37.87,64.99 37.87,105 c 0,40.01 32.34,72.56 72.08,72.56 34.37,0 63.17,-24.34 70.35,-56.79 h 39.35 v 33.81 c 0,3.49 2.83,6.32 6.32,6.32 h 45.01 c 3.49,0 6.32,-2.83 6.32,-6.32 v -33.81 h 9.63 c 3.97,0 7.2,-3.2 7.2,-7.16 V 96.39 c 0,-3.95 -3.22,-7.16 -7.19,-7.16 z m -176.99,54.26 c -20.19,0 -36.61,-17.27 -36.61,-38.49 0,-21.23 16.42,-38.49 36.61,-38.49 20.19,0 36.61,17.27 36.61,38.49 0,21.23 -16.42,38.49 -36.61,38.49 z"
id="path1" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1,9 @@
using System;
namespace KeyKeeper.PasswordStore;
public static class EntryIconType
{
public static readonly Guid KEY = Guid.Parse("65ab3d55-1652-4f66-aac9-c3617f14e308");
public static readonly Guid DEFAULT = KEY;
}

View File

@@ -1,6 +1,5 @@
using System;
using System.IO;
using KeyKeeper.PasswordStore.Crypto;
using static KeyKeeper.PasswordStore.FileFormatConstants;
namespace KeyKeeper.PasswordStore;
@@ -13,6 +12,13 @@ public abstract class PassStoreEntry
public Guid IconType { get; set; }
public string Name { get; set; }
public PassStoreEntryType Type { get; set; }
public string IconPath
{
get
{
return $"avares://KeyKeeper/Assets/builtin-entry-icon-{IconType}.svg";
}
}
public void WriteToStream(Stream str)
{

View File

@@ -33,7 +33,7 @@ public partial class EntryEditWindow: Window
Guid.NewGuid(),
DateTime.UtcNow,
DateTime.UtcNow,
Guid.Empty,
EntryIconType.DEFAULT,
name,
new LoginField()
{

View File

@@ -74,7 +74,7 @@
<StackPanel Width="100"
Margin="10"
HorizontalAlignment="Center">
<Svg Path="/Assets/logo_en.svg" Width="48" Height="48"
<Svg Path="{Binding IconPath}" Width="48" Height="48"
/>
<TextBlock Text="{Binding Name}"
HorizontalAlignment="Center"