mirror of
https://github.com/KeyKeeperApp/KeyKeeper.git
synced 2026-04-28 19:06:37 +03:00
add context menu for password store entries
This commit is contained in:
@@ -82,6 +82,13 @@
|
|||||||
Foreground="#666"
|
Foreground="#666"
|
||||||
HorizontalAlignment="Center" />
|
HorizontalAlignment="Center" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
<Border.ContextMenu>
|
||||||
|
<ContextMenu>
|
||||||
|
<MenuItem Name="entryCtxMenuCopyUsername" Header="Copy username" Click="EntryContextMenuItem_Click"/>
|
||||||
|
<MenuItem Name="entryCtxMenuCopyPassword" Header="Copy password" Click="EntryContextMenuItem_Click"/>
|
||||||
|
<MenuItem Name="entryCtxMenuDelete" Header="Delete" Click="EntryContextMenuItem_Click"/>
|
||||||
|
</ContextMenu>
|
||||||
|
</Border.ContextMenu>
|
||||||
</Border>
|
</Border>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ListBox.ItemTemplate>
|
</ListBox.ItemTemplate>
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
@@ -54,4 +53,25 @@ public partial class RepositoryWindow: Window
|
|||||||
Clipboard!.SetTextAsync(pwd.Password.Value);
|
Clipboard!.SetTextAsync(pwd.Password.Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void EntryContextMenuItem_Click(object sender, RoutedEventArgs args) {
|
||||||
|
if (args.Source is StyledElement s)
|
||||||
|
{
|
||||||
|
if (s.DataContext is PassStoreEntryPassword pwd)
|
||||||
|
{
|
||||||
|
if (s.Name == "entryCtxMenuCopyUsername")
|
||||||
|
{
|
||||||
|
Clipboard!.SetTextAsync(pwd.Username.Value);
|
||||||
|
}
|
||||||
|
else if (s.Name == "entryCtxMenuCopyPassword")
|
||||||
|
{
|
||||||
|
Clipboard!.SetTextAsync(pwd.Password.Value);
|
||||||
|
}
|
||||||
|
else if (s.Name == "entryCtxMenuDelete")
|
||||||
|
{
|
||||||
|
Console.WriteLine("DELETE");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user