mirror of
https://github.com/KeyKeeperApp/KeyKeeper.git
synced 2026-04-17 18:16:28 +03:00
make Ctrl+C on an entry copy its password
This commit is contained in:
@@ -100,7 +100,8 @@
|
||||
Margin="286 10 10 10"
|
||||
ItemsSource="{Binding Passwords}"
|
||||
Background="Transparent"
|
||||
SelectionMode="Single">
|
||||
SelectionMode="Single"
|
||||
KeyDown="PasswordsListBox_KeyDown">
|
||||
|
||||
<ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
@@ -110,7 +111,8 @@
|
||||
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border Background="Transparent" DoubleTapped="Entry_DoubleTapped">
|
||||
<Border Background="Transparent"
|
||||
DoubleTapped="Entry_DoubleTapped">
|
||||
|
||||
<StackPanel Width="100"
|
||||
Margin="10"
|
||||
|
||||
@@ -155,6 +155,18 @@ public partial class RepositoryWindow : Window
|
||||
}
|
||||
}
|
||||
|
||||
private void PasswordsListBox_KeyDown(object sender, KeyEventArgs args)
|
||||
{
|
||||
if (args.Key == Key.C && args.KeyModifiers == KeyModifiers.Control)
|
||||
{
|
||||
if (sender is ListBox list && list.SelectedItem is PassStoreEntryPassword pwd)
|
||||
{
|
||||
Clipboard!.SetTextAsync(pwd.Password.Value);
|
||||
this.FindControlRecursive<ToastNotificationHost>("NotificationHost")?.Show("Password copied to clipboard");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async void EntryContextMenuItem_Click(object sender, RoutedEventArgs args)
|
||||
{
|
||||
if (args.Source is StyledElement s && s.DataContext is PassStoreEntryPassword pwd)
|
||||
|
||||
Reference in New Issue
Block a user