implement password copy to clipboard

This commit is contained in:
2025-12-05 20:45:43 +03:00
parent 46727c8cb1
commit 9431cc0abf
3 changed files with 23 additions and 7 deletions

View File

@@ -30,7 +30,7 @@ public partial class EntryEditWindow: Window
if (password.Length == 0) return;
EditedEntry = new PassStoreEntryPassword(
new Guid(),
Guid.NewGuid(),
DateTime.UtcNow,
DateTime.UtcNow,
Guid.Empty,

View File

@@ -1,6 +1,7 @@
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="using:KeyKeeper.ViewModels"
xmlns:i="using:Avalonia.Interactivity"
x:Class="KeyKeeper.Views.RepositoryWindow"
Title="KeyKeeper - Password store"
CanResize="False"
@@ -69,12 +70,17 @@
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Width="100" Margin="10" HorizontalAlignment="Center">
<Svg Path="/Assets/logo_en.svg" Width="48" Height="48"/>
<TextBlock Text="{Binding Name}"
HorizontalAlignment="Center"
Foreground="Black" />
</StackPanel>
<Border Background="Transparent" DoubleTapped="Entry_DoubleTapped">
<StackPanel Width="100"
Margin="10"
HorizontalAlignment="Center">
<Svg Path="/Assets/logo_en.svg" Width="48" Height="48"
/>
<TextBlock Text="{Binding Name}"
HorizontalAlignment="Center"
Foreground="Black" />
</StackPanel>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>

View File

@@ -2,6 +2,7 @@ using System;
using System.Threading.Tasks;
using Avalonia.Controls;
using Avalonia.Interactivity;
using KeyKeeper.PasswordStore;
using KeyKeeper.ViewModels;
namespace KeyKeeper.Views;
@@ -42,4 +43,13 @@ public partial class RepositoryWindow: Window
pageVm.Save();
}
}
private void Entry_DoubleTapped(object sender, RoutedEventArgs args)
{
if (args.Source is Border b)
{
if (b.DataContext is PassStoreEntryPassword pwd)
Clipboard!.SetTextAsync(pwd.Password.Value);
}
}
}