Search box now directly filters entries, no need for another drop down

TextBoxWithButton now scales button with text size and text can now be properly aligned
Corrected some French translations
This commit is contained in:
BONNEVILLE Geoffroy
2017-12-04 18:07:03 +01:00
parent 7aa342cf9c
commit 898a9a0935
8 changed files with 72 additions and 17 deletions

View File

@@ -8,6 +8,7 @@
xmlns:interactivity="using:Microsoft.Xaml.Interactivity" xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
xmlns:core="using:Microsoft.Xaml.Interactions.Core" xmlns:core="using:Microsoft.Xaml.Interactions.Core"
xmlns:actions="using:ModernKeePass.Actions" xmlns:actions="using:ModernKeePass.Actions"
xmlns:controls="using:ModernKeePass.Controls"
x:Name="PageRoot" x:Name="PageRoot"
x:Class="ModernKeePass.Pages.GroupDetailPage" x:Class="ModernKeePass.Pages.GroupDetailPage"
mc:Ignorable="d" > mc:Ignorable="d" >
@@ -91,7 +92,7 @@
Source="{Binding Groups}" /> Source="{Binding Groups}" />
<CollectionViewSource <CollectionViewSource
x:Name="EntriesViewSource" x:Name="EntriesViewSource"
Source="{Binding Entries}" /> Source="{Binding EntriesFiltered}" />
<CollectionViewSource <CollectionViewSource
x:Name="EntriesZoomedOutViewSource" x:Name="EntriesZoomedOutViewSource"
Source="{Binding EntriesZoomedOut}" IsSourceGrouped="True"/> Source="{Binding EntriesZoomedOut}" IsSourceGrouped="True"/>
@@ -325,7 +326,7 @@
</TextBox> </TextBox>
<TextBlock FontSize="12" Text="{Binding Path}" /> <TextBlock FontSize="12" Text="{Binding Path}" />
</StackPanel> </StackPanel>
<SearchBox Grid.Column="2" x:Uid="GroupSearch" Width="350" Background="{ThemeResource TextBoxDisabledBackgroundThemeBrush}" BorderThickness="0" FontSize="18" SuggestionsRequested="SearchBox_OnSuggestionsRequested" SearchHistoryEnabled="False" ResultSuggestionChosen="SearchBox_OnResultSuggestionChosen" /> <controls:TextBoxWithButton Grid.Column="2" x:Uid="GroupSearch" ButtonSymbol="&#xE11A;" Text="{Binding Filter, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="18" VerticalContentAlignment="Center" Style="{StaticResource TextBoxWithButtonStyle}" />
</Grid> </Grid>
<VisualStateManager.VisualStateGroups> <VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="DragDropGroup"> <VisualStateGroup x:Name="DragDropGroup">

View File

@@ -1,4 +1,5 @@
using System; using System;
using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using Windows.ApplicationModel.DataTransfer; using Windows.ApplicationModel.DataTransfer;
using Windows.Storage.Streams; using Windows.Storage.Streams;
@@ -170,5 +171,11 @@ namespace ModernKeePass.Pages
e.Cancel = !Model.IsEditMode; e.Cancel = !Model.IsEditMode;
e.Data.RequestedOperation = DataPackageOperation.Move; e.Data.RequestedOperation = DataPackageOperation.Move;
} }
private void TextBox_OnTextChanged(object sender, TextChangedEventArgs e)
{
//throw new NotImplementedException();
Model.Entries = new ObservableCollection<EntryVm>(Model.Entries.Where(entry => entry.Name.Contains((sender as TextBox).Text)));
}
} }
} }

View File

@@ -49,7 +49,7 @@
Style="{StaticResource NoBorderButtonStyle}"> Style="{StaticResource NoBorderButtonStyle}">
<SymbolIcon Symbol="Back" /> <SymbolIcon Symbol="Back" />
</Button> </Button>
<TextBlock x:Name="TitleTextBox" Text="Settings" Grid.Column="1" FontSize="24" HorizontalAlignment="Center" VerticalAlignment="Center" /> <TextBlock x:Name="TitleTextBox" x:Uid="SettingsTitle" Grid.Column="1" FontSize="24" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Grid> </Grid>
<controls:ListViewWithDisable <controls:ListViewWithDisable
Grid.Column="0" Grid.Column="0"

View File

@@ -318,6 +318,9 @@
<data name="SettingsSecurityUpdateButton.ButtonLabel" xml:space="preserve"> <data name="SettingsSecurityUpdateButton.ButtonLabel" xml:space="preserve">
<value>Update master key</value> <value>Update master key</value>
</data> </data>
<data name="SettingsTitle.Text" xml:space="preserve">
<value>Settings</value>
</data>
<data name="SettingsWelcomeDesc.Text" xml:space="preserve"> <data name="SettingsWelcomeDesc.Text" xml:space="preserve">
<value>Here, you may change the application or the database settings.</value> <value>Here, you may change the application or the database settings.</value>
</data> </data>

View File

@@ -227,6 +227,6 @@
<value>Nouveau</value> <value>Nouveau</value>
</data> </data>
<data name="SettingsMenuItemSecurity" xml:space="preserve"> <data name="SettingsMenuItemSecurity" xml:space="preserve">
<value>Securité</value> <value>Sécurité</value>
</data> </data>
</root> </root>

View File

@@ -318,6 +318,9 @@
<data name="SettingsSecurityUpdateButton.ButtonLabel" xml:space="preserve"> <data name="SettingsSecurityUpdateButton.ButtonLabel" xml:space="preserve">
<value>Mettre à jour la clé maître</value> <value>Mettre à jour la clé maître</value>
</data> </data>
<data name="SettingsTitle.Text" xml:space="preserve">
<value>Paramètres</value>
</data>
<data name="SettingsWelcomeDesc.Text" xml:space="preserve"> <data name="SettingsWelcomeDesc.Text" xml:space="preserve">
<value>Ici, vous pouvez changer les options de l'application ou de la base de données.</value> <value>Ici, vous pouvez changer les options de l'application ou de la base de données.</value>
</data> </data>

View File

@@ -83,14 +83,15 @@
Background="{ThemeResource TextBoxButtonBackgroundThemeBrush}" Background="{ThemeResource TextBoxButtonBackgroundThemeBrush}"
Margin="{TemplateBinding BorderThickness}"> Margin="{TemplateBinding BorderThickness}">
<TextBlock x:Name="GlyphElement" <TextBlock x:Name="GlyphElement"
Foreground="{ThemeResource TextBoxButtonForegroundThemeBrush}" Foreground="{ThemeResource TextBoxButtonForegroundThemeBrush}"
Padding="4,0,4,0" Padding="4,0,4,0"
VerticalAlignment="Center" VerticalAlignment="Center"
HorizontalAlignment="Center" HorizontalAlignment="Center"
FontStyle="Normal" FontStyle="Normal"
Text="{TemplateBinding Content}" Text="{TemplateBinding Content}"
FontFamily="{ThemeResource SymbolThemeFontFamily}" FontSize="{TemplateBinding FontSize}"
AutomationProperties.AccessibilityView="Raw"/> FontFamily="{ThemeResource SymbolThemeFontFamily}"
AutomationProperties.AccessibilityView="Raw"/>
</Border> </Border>
</Grid> </Grid>
</ControlTemplate> </ControlTemplate>
@@ -142,9 +143,28 @@
Storyboard.TargetProperty="Opacity" Storyboard.TargetProperty="Opacity"
Duration="0" Duration="0"
To="{ThemeResource TextControlPointerOverBorderThemeOpacity}" /> To="{ThemeResource TextControlPointerOverBorderThemeOpacity}" />
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ActionButton"
Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Focused">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ActionButton"
Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard> </Storyboard>
</VisualState> </VisualState>
<VisualState x:Name="Focused" />
</VisualStateGroup> </VisualStateGroup>
<VisualStateGroup x:Name="ButtonStates"> <VisualStateGroup x:Name="ButtonStates">
<VisualState x:Name="ButtonVisible"> <VisualState x:Name="ButtonVisible">
@@ -199,6 +219,7 @@
IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}" IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}"
IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}" IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}"
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}" IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Margin="{TemplateBinding BorderThickness}" Margin="{TemplateBinding BorderThickness}"
Padding="{TemplateBinding Padding}" Padding="{TemplateBinding Padding}"
IsTabStop="False" IsTabStop="False"
@@ -209,6 +230,7 @@
Foreground="{ThemeResource TextBoxPlaceholderTextThemeBrush}" Foreground="{ThemeResource TextBoxPlaceholderTextThemeBrush}"
Margin="{TemplateBinding BorderThickness}" Margin="{TemplateBinding BorderThickness}"
Padding="{TemplateBinding Padding}" Padding="{TemplateBinding Padding}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
IsTabStop="False" IsTabStop="False"
Grid.ColumnSpan="2" Grid.ColumnSpan="2"
Content="{TemplateBinding PlaceholderText}" Content="{TemplateBinding PlaceholderText}"

View File

@@ -9,7 +9,6 @@ using Windows.UI.Xaml.Controls;
using ModernKeePass.Common; using ModernKeePass.Common;
using ModernKeePass.Interfaces; using ModernKeePass.Interfaces;
using ModernKeePass.Mappings; using ModernKeePass.Mappings;
using ModernKeePass.Services;
using ModernKeePassLib; using ModernKeePassLib;
namespace ModernKeePass.ViewModels namespace ModernKeePass.ViewModels
@@ -18,7 +17,13 @@ namespace ModernKeePass.ViewModels
{ {
public GroupVm ParentGroup { get; private set; } public GroupVm ParentGroup { get; private set; }
public GroupVm PreviousGroup { get; private set; } public GroupVm PreviousGroup { get; private set; }
public ObservableCollection<EntryVm> Entries { get; set; } = new ObservableCollection<EntryVm>();
public ObservableCollection<EntryVm> Entries
{
get { return _entries; }
set { SetProperty(ref _entries, value); }
}
public ObservableCollection<GroupVm> Groups { get; set; } = new ObservableCollection<GroupVm>(); public ObservableCollection<GroupVm> Groups { get; set; } = new ObservableCollection<GroupVm>();
public int EntryCount => Entries.Count; public int EntryCount => Entries.Count;
@@ -73,6 +78,19 @@ namespace ModernKeePass.ViewModels
set { SetProperty(ref _isEditMode, value); } set { SetProperty(ref _isEditMode, value); }
} }
public string Filter
{
get { return _filter; }
set
{
SetProperty(ref _filter, value);
OnPropertyChanged("EntriesFiltered");
}
}
public ObservableCollection<EntryVm> EntriesFiltered =>
new ObservableCollection<EntryVm>(Entries.Where(e => e.Name.IndexOf(Filter, StringComparison.OrdinalIgnoreCase) >= 0));
public string Path public string Path
{ {
get get
@@ -88,6 +106,8 @@ namespace ModernKeePass.ViewModels
private readonly IDatabase _database; private readonly IDatabase _database;
private bool _isEditMode; private bool _isEditMode;
private PwEntry _reorderedEntry; private PwEntry _reorderedEntry;
private ObservableCollection<EntryVm> _entries = new ObservableCollection<EntryVm>();
private string _filter = string.Empty;
public GroupVm() {} public GroupVm() {}
@@ -188,7 +208,6 @@ namespace ModernKeePass.ViewModels
{ {
_pwGroup.Entries.Sort(comparer); _pwGroup.Entries.Sort(comparer);
Entries = new ObservableCollection<EntryVm>(Entries.OrderBy(e => e.Name)); Entries = new ObservableCollection<EntryVm>(Entries.OrderBy(e => e.Name));
OnPropertyChanged("Entries");
} }
catch (Exception e) catch (Exception e)
{ {