mirror of
https://github.com/KeyKeeperApp/KeyKeeper.git
synced 2026-05-19 23:06:33 +03:00
fix copying linked passwords
This commit is contained in:
@@ -206,10 +206,9 @@ public partial class RepositoryWindow : Window
|
|||||||
|
|
||||||
private void Entry_DoubleTapped(object sender, TappedEventArgs args)
|
private void Entry_DoubleTapped(object sender, TappedEventArgs args)
|
||||||
{
|
{
|
||||||
if (args.Source is StyledElement s && s.DataContext is PassStoreEntryPassword pwd)
|
if (args.Source is StyledElement s && s.DataContext is PassStoreEntry ent)
|
||||||
{
|
{
|
||||||
Clipboard!.SetTextAsync(pwd.Password.Value);
|
CopyPassword(ent);
|
||||||
this.FindControlRecursive<ToastNotificationHost>("NotificationHost")?.Show("Password copied to clipboard");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -217,13 +216,23 @@ public partial class RepositoryWindow : Window
|
|||||||
{
|
{
|
||||||
if (args.Key == Key.C && args.KeyModifiers == KeyModifiers.Control)
|
if (args.Key == Key.C && args.KeyModifiers == KeyModifiers.Control)
|
||||||
{
|
{
|
||||||
if (sender is ListBox list && list.SelectedItem is PassStoreEntryPassword pwd)
|
if (sender is ListBox list && list.SelectedItem is PassStoreEntry ent)
|
||||||
{
|
{
|
||||||
|
CopyPassword(ent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CopyPassword(PassStoreEntry ent)
|
||||||
|
{
|
||||||
|
PassStoreEntryPassword? pwd = null;
|
||||||
|
if (ent is PassStoreEntryPassword p) pwd = p;
|
||||||
|
else if (ent is PassStoreEntryLink lnk && lnk.LinkTarget is PassStoreEntryPassword p1) pwd = p1;
|
||||||
|
if (pwd == null) return;
|
||||||
|
|
||||||
Clipboard!.SetTextAsync(pwd.Password.Value);
|
Clipboard!.SetTextAsync(pwd.Password.Value);
|
||||||
this.FindControlRecursive<ToastNotificationHost>("NotificationHost")?.Show("Password copied to clipboard");
|
this.FindControlRecursive<ToastNotificationHost>("NotificationHost")?.Show("Password copied to clipboard");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void EntryContextMenu_Opening(object? sender, RoutedEventArgs args)
|
private void EntryContextMenu_Opening(object? sender, RoutedEventArgs args)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user