mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 23:50:18 -04:00
Recycle bin is now created when deleting first element instead of selecting new group in Settings
This commit is contained in:

committed by
BONNEVILLE Geoffroy

parent
7e642e3b73
commit
82ef424365
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using Windows.Storage;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using ModernKeePass.ViewModels;
|
||||
using ModernKeePassLib;
|
||||
using ModernKeePassLib.Interfaces;
|
||||
@@ -129,5 +130,12 @@ namespace ModernKeePass.Common
|
||||
{
|
||||
_pwDatabase.DeletedObjects.Add(new PwDeletedObject(id, DateTime.UtcNow));
|
||||
}
|
||||
|
||||
public void CreateRecycleBin()
|
||||
{
|
||||
RecycleBin = RootGroup.AddNewGroup("Recycle bin");
|
||||
RecycleBin.IsSelected = true;
|
||||
RecycleBin.IconSymbol = Symbol.Delete;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -27,7 +27,7 @@
|
||||
</TransitionCollection>
|
||||
</Grid.ChildrenTransitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="40"/>
|
||||
<RowDefinition Height="50"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
@@ -43,7 +43,7 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button x:Name="BackButton"
|
||||
Command="{Binding NavigationHelper.GoBackCommand, ElementName=PageRoot}"
|
||||
Height="40"
|
||||
Height="50"
|
||||
AutomationProperties.Name="Back"
|
||||
AutomationProperties.AutomationId="BackButton"
|
||||
AutomationProperties.ItemType="Navigation Button"
|
||||
|
@@ -14,7 +14,6 @@
|
||||
<viewModels:SettingsDatabaseVm />
|
||||
</Page.DataContext>
|
||||
|
||||
|
||||
<StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
<ToggleSwitch Header="Recycle bin" OffContent="Disabled" OnContent="Enabled" IsOn="{Binding HasRecycleBin, Mode=TwoWay}" />
|
||||
<ComboBox ItemsSource="{Binding Source={StaticResource RecycleBinGroups}}" SelectedItem="{Binding SelectedItem, Mode=TwoWay}" IsEnabled="{Binding HasRecycleBin}" />
|
||||
|
@@ -196,6 +196,8 @@ namespace ModernKeePass.ViewModels
|
||||
|
||||
public void MarkForDelete()
|
||||
{
|
||||
if (_app.Database.RecycleBinEnabled && _app.Database.RecycleBin?.IdUuid == null)
|
||||
_app.Database.CreateRecycleBin();
|
||||
Move(_app.Database.RecycleBinEnabled && !ParentGroup.IsSelected ? _app.Database.RecycleBin : null);
|
||||
}
|
||||
|
||||
|
@@ -32,16 +32,16 @@ namespace ModernKeePass.ViewModels
|
||||
/// </summary>
|
||||
public bool IsSelected
|
||||
{
|
||||
get { return _app.Database.RecycleBinEnabled && _app.Database.RecycleBin.Id == Id; }
|
||||
get { return _app.Database.RecycleBinEnabled && _app.Database.RecycleBin?.Id == Id; }
|
||||
set
|
||||
{
|
||||
if (value && _pwGroup != null) _app.Database.RecycleBin = this;
|
||||
else if (value && _pwGroup == null)
|
||||
/*else if (value && _pwGroup == null)
|
||||
{
|
||||
var recycleBin = _app.Database.RootGroup.AddNewGroup("Recycle bin");
|
||||
recycleBin.IsSelected = true;
|
||||
recycleBin.IconSymbol = Symbol.Delete;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,6 +133,8 @@ namespace ModernKeePass.ViewModels
|
||||
|
||||
public void MarkForDelete()
|
||||
{
|
||||
if (_app.Database.RecycleBinEnabled && _app.Database.RecycleBin?.IdUuid == null)
|
||||
_app.Database.CreateRecycleBin();
|
||||
Move(_app.Database.RecycleBinEnabled && !IsSelected ? _app.Database.RecycleBin : null);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user