mirror of
https://github.com/KeyKeeperApp/KeyKeeper.git
synced 2026-05-03 05:16:29 +03:00
merge branch 'feature/ui-polish' into feature/totp
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
<Window xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="KeyKeeper.Views.CreateVaultFileWindow"
|
||||
x:Class="KeyKeeper.Views.CreateVaultDialog"
|
||||
Title="Create New Vault"
|
||||
Background="#fff"
|
||||
Focusable="True"
|
||||
Icon="/Assets/icon.ico"
|
||||
Width="600" Height="450"
|
||||
WindowStartupLocation="CenterOwner"
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Platform.Storage;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace KeyKeeper.Views
|
||||
{
|
||||
public partial class CreateVaultFileWindow : Window
|
||||
public partial class CreateVaultDialog : Window
|
||||
{
|
||||
public string FilePath { get; private set; } = string.Empty;
|
||||
public string Password { get; private set; } = string.Empty;
|
||||
public bool Success { get; private set; }
|
||||
|
||||
public CreateVaultFileWindow()
|
||||
public CreateVaultDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
#if DEBUG
|
||||
@@ -22,6 +21,8 @@ namespace KeyKeeper.Views
|
||||
FilePathTextBox.TextChanged += OnTextChanged;
|
||||
PasswordBox.TextChanged += OnPasswordTextChanged;
|
||||
ConfirmPasswordBox.TextChanged += OnPasswordTextChanged;
|
||||
|
||||
KeyDown += CreateVaultDialog_KeyDown;
|
||||
}
|
||||
|
||||
private async void OnTextChanged(object? sender, TextChangedEventArgs e)
|
||||
@@ -60,6 +61,18 @@ namespace KeyKeeper.Views
|
||||
CreateButton.IsEnabled = pathValid && passwordsEntered;
|
||||
}
|
||||
|
||||
private void CreateVaultDialog_KeyDown(object? sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Escape)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
else if (e.Key == Key.Enter && CreateButton.IsEnabled)
|
||||
{
|
||||
Submit();
|
||||
}
|
||||
}
|
||||
|
||||
private async void BrowseButton_Click(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
var file = await StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
|
||||
@@ -83,6 +96,11 @@ namespace KeyKeeper.Views
|
||||
}
|
||||
|
||||
private void CreateButton_Click(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
Submit();
|
||||
}
|
||||
|
||||
private void Submit()
|
||||
{
|
||||
string path = FilePathTextBox.Text ?? "";
|
||||
if (string.IsNullOrWhiteSpace(path))
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
x:Class="KeyKeeper.Views.EntryEditWindow"
|
||||
Title="Add Entry"
|
||||
CanResize="False"
|
||||
Width="540"
|
||||
Height="300"
|
||||
Width="400"
|
||||
Height="250"
|
||||
Background="White">
|
||||
|
||||
<Grid RowDefinitions="Auto,Auto,Auto,Auto,Auto" ColumnDefinitions="*,*" Margin="5">
|
||||
<Grid RowDefinitions="Auto,Auto,Auto,Auto,*" ColumnDefinitions="1*,3*" Margin="5">
|
||||
<TextBlock Text="Add New Password Entry" FontSize="20" HorizontalAlignment="Center"
|
||||
Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2"/>
|
||||
Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,0,20"/>
|
||||
|
||||
<TextBlock Text="Entry name:" HorizontalAlignment="Right"
|
||||
Grid.Row="1" Grid.Column="0" Margin="5" />
|
||||
@@ -23,11 +23,11 @@
|
||||
<TextBlock Text="Password:" HorizontalAlignment="Right"
|
||||
Grid.Row="3" Grid.Column="0" Margin="5" />
|
||||
|
||||
<!-- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -->
|
||||
<!-- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -->
|
||||
<Grid Grid.Row="3" Grid.Column="1" Margin="5" RowDefinitions="Auto,Auto">
|
||||
<TextBox Name="PasswordEdit" Grid.Row="0" PasswordChar="*" />
|
||||
|
||||
<!-- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -->
|
||||
<!-- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -->
|
||||
<Border Name="PasswordStrengthIndicator" Grid.Row="1"
|
||||
Height="4" CornerRadius="2" Margin="0,3,0,0"
|
||||
Background="#ddd">
|
||||
@@ -38,8 +38,8 @@
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
<Button Content="Add!" HorizontalAlignment="Center"
|
||||
Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2"
|
||||
<Button Content="Done" HorizontalAlignment="Center" Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2"
|
||||
VerticalAlignment="Bottom"
|
||||
Background="#aaa" Click="AddButton_Click" />
|
||||
</Grid>
|
||||
|
||||
@@ -50,12 +50,5 @@
|
||||
<Style Selector="TextBox">
|
||||
<Setter Property="Foreground" Value="Black" />
|
||||
</Style>
|
||||
<Style Selector="Button /template/ ContentPresenter">
|
||||
<Setter Property="Foreground" Value="Black" />
|
||||
</Style>
|
||||
<Style Selector="Button:pointerover /template/ ContentPresenter">
|
||||
<Setter Property="Foreground" Value="Black" />
|
||||
<Setter Property="Background" Value="#ccc" />
|
||||
</Style>
|
||||
</Window.Styles>
|
||||
</Window>
|
||||
@@ -56,7 +56,7 @@
|
||||
<Grid Grid.Column="1" VerticalAlignment="Center">
|
||||
<Grid RowDefinitions="Auto,Auto">
|
||||
|
||||
<TextBlock Text="Recent Database"
|
||||
<TextBlock Text="Recently opened"
|
||||
FontSize="38"
|
||||
Foreground="#2328C4"
|
||||
FontWeight="SemiBold"
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace KeyKeeper.Views
|
||||
|
||||
private async void CreateNewVault_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var createVaultDialog = new CreateVaultFileWindow();
|
||||
var createVaultDialog = new CreateVaultDialog();
|
||||
await createVaultDialog.ShowDialog(this);
|
||||
|
||||
if (createVaultDialog.Success &&
|
||||
|
||||
@@ -16,33 +16,34 @@
|
||||
<DataTemplate DataType="{x:Type vm:UnlockedRepositoryViewModel}">
|
||||
<Grid>
|
||||
<!-- Синий левый край -->
|
||||
<Border Width="200"
|
||||
Background="#2328C4"
|
||||
<Border Width="224"
|
||||
Background="#2A2ABB"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Stretch"/>
|
||||
VerticalAlignment="Stretch">
|
||||
|
||||
<StackPanel Margin="20" HorizontalAlignment="Left">
|
||||
<!-- Надпись KeyKeeper -->
|
||||
<TextBlock Text="KeyKeeper"
|
||||
FontSize="32"
|
||||
FontWeight="Bold"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0,0,0,20"/>
|
||||
|
||||
<Svg Path="/Assets/logo_en.svg"
|
||||
Stretch="Uniform" />
|
||||
|
||||
<!-- Таймер блокировки под надписью KeyKeeper -->
|
||||
<Border Background="#CC000000"
|
||||
CornerRadius="6"
|
||||
Padding="8,4"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0,0,0,12"
|
||||
Margin="0,12,0,12"
|
||||
IsVisible="{Binding $parent[Window].DataContext.LockTimerDisplay,
|
||||
Converter={x:Static StringConverters.IsNotNullOrEmpty}}">
|
||||
|
||||
<StackPanel Orientation="Horizontal" Spacing="6" VerticalAlignment="Center">
|
||||
|
||||
<!-- Иконка замка (Material Design lock outline) -->
|
||||
<Path Fill="White"
|
||||
VerticalAlignment="Center"
|
||||
Width="13" Height="13"
|
||||
Stretch="Uniform"
|
||||
Data="M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z"/>
|
||||
|
||||
<TextBlock Text="{Binding $parent[Window].DataContext.LockTimerDisplay}"
|
||||
Foreground="White"
|
||||
FontSize="13"
|
||||
@@ -91,26 +92,31 @@
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0,20,0,0"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- ListBox с паролями -->
|
||||
<ListBox x:Name="PasswordsListBox"
|
||||
Width="580"
|
||||
Margin="210 10 10 10"
|
||||
Margin="234 10 10 10"
|
||||
ItemsSource="{Binding Passwords}"
|
||||
Background="Transparent"
|
||||
SelectionMode="Single">
|
||||
SelectionMode="Single"
|
||||
KeyDown="PasswordsListBox_KeyDown">
|
||||
|
||||
<ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel Orientation="Horizontal" />
|
||||
<WrapPanel Orientation="Horizontal"/>
|
||||
</ItemsPanelTemplate>
|
||||
</ListBox.ItemsPanel>
|
||||
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border Background="Transparent" DoubleTapped="Entry_DoubleTapped">
|
||||
<Border Background="Transparent"
|
||||
DoubleTapped="Entry_DoubleTapped">
|
||||
|
||||
<StackPanel Width="100"
|
||||
Margin="10"
|
||||
HorizontalAlignment="Center">
|
||||
|
||||
<Svg Path="{Binding IconPath}" Width="48" Height="48"/>
|
||||
<TextBlock Text="{Binding Name}"
|
||||
HorizontalAlignment="Center"
|
||||
@@ -123,7 +129,6 @@
|
||||
<ContextMenu>
|
||||
<MenuItem Name="entryCtxMenuCopyUsername" Header="Copy username" Click="EntryContextMenuItem_Click"/>
|
||||
<MenuItem Name="entryCtxMenuCopyPassword" Header="Copy password" Click="EntryContextMenuItem_Click"/>
|
||||
<!-- Новый пункт меню "Edit" -->
|
||||
<MenuItem Name="entryCtxMenuEdit" Header="Edit" Click="EntryContextMenuItem_Click"/>
|
||||
<MenuItem Name="entryCtxMenuDelete" Header="Delete" Click="EntryContextMenuItem_Click"/>
|
||||
</ContextMenu>
|
||||
@@ -146,6 +151,7 @@
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Spacing="10">
|
||||
|
||||
<TextBlock Text="Enter credentials to unlock"
|
||||
Foreground="#2328C4"
|
||||
FontSize="32" />
|
||||
@@ -153,7 +159,13 @@
|
||||
<TextBox x:Name="UnlockPasswordEdit"
|
||||
Text="{Binding UnlockPassword, Mode=TwoWay}"
|
||||
PasswordChar="*"
|
||||
Width="450" />
|
||||
Width="450"
|
||||
Loaded="UnlockPasswordEdit_Loaded">
|
||||
|
||||
<TextBox.KeyBindings>
|
||||
<KeyBinding Gesture="Return" Command="{Binding TryUnlock}"/>
|
||||
</TextBox.KeyBindings>
|
||||
</TextBox>
|
||||
|
||||
<Button x:Name="UnlockButton"
|
||||
Command="{Binding TryUnlock}"
|
||||
|
||||
@@ -39,6 +39,11 @@ public partial class RepositoryWindow : Window
|
||||
vm.ResetLockTimer();
|
||||
}
|
||||
|
||||
private void UnlockPasswordEdit_Loaded(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
(sender as TextBox)?.Focus();
|
||||
}
|
||||
|
||||
private async void RepositoryWindow_Closing(object? sender, WindowClosingEventArgs e)
|
||||
{
|
||||
if (allowClose || closeConfirmationShown)
|
||||
@@ -150,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