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; if (password.Length == 0) return;
EditedEntry = new PassStoreEntryPassword( EditedEntry = new PassStoreEntryPassword(
new Guid(), Guid.NewGuid(),
DateTime.UtcNow, DateTime.UtcNow,
DateTime.UtcNow, DateTime.UtcNow,
Guid.Empty, Guid.Empty,

View File

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

View File

@@ -2,6 +2,7 @@ using System;
using System.Threading.Tasks; using System.Threading.Tasks;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Interactivity; using Avalonia.Interactivity;
using KeyKeeper.PasswordStore;
using KeyKeeper.ViewModels; using KeyKeeper.ViewModels;
namespace KeyKeeper.Views; namespace KeyKeeper.Views;
@@ -42,4 +43,13 @@ public partial class RepositoryWindow: Window
pageVm.Save(); 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);
}
}
} }