Corrected RecycleBin group bug

Database Settings page now has radio button for recycle bin
This commit is contained in:
BONNEVILLE Geoffroy
2018-03-12 10:21:36 +01:00
parent e7d731bb04
commit 700f76679a
5 changed files with 21 additions and 19 deletions

View File

@@ -315,6 +315,12 @@
<data name="SettingsDatabaseRecycleBin.OnContent" xml:space="preserve"> <data name="SettingsDatabaseRecycleBin.OnContent" xml:space="preserve">
<value>Enabled</value> <value>Enabled</value>
</data> </data>
<data name="SettingsDatabaseRecycleBinCreate.Content" xml:space="preserve">
<value>Create a new group</value>
</data>
<data name="SettingsDatabaseRecycleBinExisting.Content" xml:space="preserve">
<value>Use an existing group</value>
</data>
<data name="SettingsNewDatabaseDesc.Text" xml:space="preserve"> <data name="SettingsNewDatabaseDesc.Text" xml:space="preserve">
<value>Here, you can change some default options when creating a database.</value> <value>Here, you can change some default options when creating a database.</value>
</data> </data>

View File

@@ -315,6 +315,12 @@
<data name="SettingsDatabaseRecycleBin.OnContent" xml:space="preserve"> <data name="SettingsDatabaseRecycleBin.OnContent" xml:space="preserve">
<value>Activé</value> <value>Activé</value>
</data> </data>
<data name="SettingsDatabaseRecycleBinCreate.Content" xml:space="preserve">
<value>Créer un nouveau groupe</value>
</data>
<data name="SettingsDatabaseRecycleBinExisting.Content" xml:space="preserve">
<value>Utiliser un groupe existant</value>
</data>
<data name="SettingsNewDatabaseDesc.Text" xml:space="preserve"> <data name="SettingsNewDatabaseDesc.Text" xml:space="preserve">
<value>Ici, vous pouvez changer certains options lors de la création d'une nouvelle base de données</value> <value>Ici, vous pouvez changer certains options lors de la création d'une nouvelle base de données</value>
</data> </data>

View File

@@ -63,7 +63,6 @@ namespace ModernKeePass.ViewModels
{ {
get get
{ {
//if (_pwGroup == null) return Symbol.Add;
var result = PwIconToSegoeMapping.GetSymbolFromIcon(_pwGroup.IconId); var result = PwIconToSegoeMapping.GetSymbolFromIcon(_pwGroup.IconId);
return result == Symbol.More ? Symbol.Folder : result; return result == Symbol.More ? Symbol.Folder : result;
} }

View File

@@ -94,7 +94,6 @@ namespace ModernKeePass.ViewModels
{ {
_database = database; _database = database;
Groups = _database?.RootGroup.Groups; Groups = _database?.RootGroup.Groups;
Groups?.Insert(0, new GroupVm());
} }
} }
} }

View File

@@ -5,35 +5,27 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:viewModels="using:ModernKeePass.ViewModels" xmlns:viewModels="using:ModernKeePass.ViewModels"
xmlns:templateSelectors="using:ModernKeePass.TemplateSelectors" xmlns:converters="using:ModernKeePass.Converters"
mc:Ignorable="d"> mc:Ignorable="d">
<Page.Resources> <Page.Resources>
<CollectionViewSource x:Name="RecycleBinGroups" Source="{Binding Groups}" /> <CollectionViewSource x:Name="RecycleBinGroups" Source="{Binding Groups}" />
<CollectionViewSource x:Name="Ciphers" Source="{Binding Ciphers}" /> <CollectionViewSource x:Name="Ciphers" Source="{Binding Ciphers}" />
<CollectionViewSource x:Name="Compressions" Source="{Binding Compressions}" /> <CollectionViewSource x:Name="Compressions" Source="{Binding Compressions}" />
<CollectionViewSource x:Name="KeyDerivations" Source="{Binding KeyDerivations}" /> <CollectionViewSource x:Name="KeyDerivations" Source="{Binding KeyDerivations}" />
<converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
<converters:NullToBooleanConverter x:Key="NullToBooleanConverter"/>
</Page.Resources> </Page.Resources>
<Page.DataContext> <Page.DataContext>
<viewModels:SettingsDatabaseVm /> <viewModels:SettingsDatabaseVm />
</Page.DataContext> </Page.DataContext>
<StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> <StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<ToggleSwitch x:Uid="SettingsDatabaseRecycleBin" IsOn="{Binding HasRecycleBin, Mode=TwoWay}" /> <ToggleSwitch x:Uid="SettingsDatabaseRecycleBin" IsOn="{Binding HasRecycleBin, Mode=TwoWay}" />
<ComboBox ItemsSource="{Binding Source={StaticResource RecycleBinGroups}}" SelectedItem="{Binding SelectedItem, Mode=TwoWay}" IsEnabled="{Binding HasRecycleBin}"> <StackPanel Visibility="{Binding HasRecycleBin, Converter={StaticResource BooleanToVisibilityConverter}}">
<ComboBox.Resources> <RadioButton x:Uid="SettingsDatabaseRecycleBinCreate" GroupName="Recycle" IsChecked="True" />
<DataTemplate x:Name="GroupFirstItem"> <RadioButton x:Name="RadioButton" x:Uid="SettingsDatabaseRecycleBinExisting" GroupName="Recycle" IsChecked="{Binding SelectedItem, Converter={StaticResource NullToBooleanConverter}}" />
<TextBlock x:Uid="GroupNewItemTextBox" /> <ComboBox ItemsSource="{Binding Source={StaticResource RecycleBinGroups}}" SelectedItem="{Binding SelectedItem, Mode=TwoWay}" IsEnabled="{Binding IsChecked, ElementName=RadioButton}" />
</DataTemplate> </StackPanel>
<DataTemplate x:Name="GroupOtherItem">
<TextBlock Text="{Binding}" />
</DataTemplate>
</ComboBox.Resources>
<ComboBox.ItemTemplateSelector>
<templateSelectors:FirstItemDataTemplateSelector
FirstItem="{StaticResource GroupFirstItem}"
OtherItem="{StaticResource GroupOtherItem}" />
</ComboBox.ItemTemplateSelector>
</ComboBox>
<TextBlock x:Uid="SettingsDatabaseEncryption" Style="{StaticResource TextBlockSettingsHeaderStyle}" Margin="5,20,0,10" /> <TextBlock x:Uid="SettingsDatabaseEncryption" Style="{StaticResource TextBlockSettingsHeaderStyle}" Margin="5,20,0,10" />
<ComboBox ItemsSource="{Binding Source={StaticResource Ciphers}}" SelectedIndex="{Binding CipherIndex, Mode=TwoWay}" /> <ComboBox ItemsSource="{Binding Source={StaticResource Ciphers}}" SelectedIndex="{Binding CipherIndex, Mode=TwoWay}" />
<TextBlock x:Uid="SettingsDatabaseCompression" Style="{StaticResource TextBlockSettingsHeaderStyle}" Margin="5,20,0,10" /> <TextBlock x:Uid="SettingsDatabaseCompression" Style="{StaticResource TextBlockSettingsHeaderStyle}" Margin="5,20,0,10" />