mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 23:50:18 -04:00
WIP Entry expiration dates
This commit is contained in:
@@ -66,7 +66,7 @@ namespace ModernKeePass.Common
|
|||||||
*/
|
*/
|
||||||
var notificationXml = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastText02);
|
var notificationXml = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastText02);
|
||||||
var toastElements = notificationXml.GetElementsByTagName("text");
|
var toastElements = notificationXml.GetElementsByTagName("text");
|
||||||
toastElements[0].AppendChild(notificationXml.CreateTextNode($"{entityType} deleted"));
|
toastElements[0].AppendChild(notificationXml.CreateTextNode($"{entityType} {entity.Name} deleted"));
|
||||||
toastElements[1].AppendChild(notificationXml.CreateTextNode("Click me to undo"));
|
toastElements[1].AppendChild(notificationXml.CreateTextNode("Click me to undo"));
|
||||||
var toastNode = notificationXml.SelectSingleNode("/toast");
|
var toastNode = notificationXml.SelectSingleNode("/toast");
|
||||||
((XmlElement)toastNode)?.SetAttribute("launch", new QueryString
|
((XmlElement)toastNode)?.SetAttribute("launch", new QueryString
|
||||||
|
@@ -36,26 +36,18 @@
|
|||||||
<VisualState x:Name="Normal" />
|
<VisualState x:Name="Normal" />
|
||||||
<VisualState x:Name="PointerOver">
|
<VisualState x:Name="PointerOver">
|
||||||
<Storyboard>
|
<Storyboard>
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundElement"
|
|
||||||
Storyboard.TargetProperty="Background">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextBoxButtonPointerOverBackgroundThemeBrush}" />
|
|
||||||
</ObjectAnimationUsingKeyFrames>
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement"
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement"
|
||||||
Storyboard.TargetProperty="BorderBrush">
|
Storyboard.TargetProperty="BorderBrush">
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextBoxButtonPointerOverBorderThemeBrush}" />
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextBoxButtonPointerOverBorderThemeBrush}" />
|
||||||
</ObjectAnimationUsingKeyFrames>
|
</ObjectAnimationUsingKeyFrames>
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="GlyphElement"
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="GlyphElement"
|
||||||
Storyboard.TargetProperty="Foreground">
|
Storyboard.TargetProperty="Foreground">
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextBoxButtonPointerOverForegroundThemeBrush}" />
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextBoxButtonPointerOverBackgroundThemeBrush}" />
|
||||||
</ObjectAnimationUsingKeyFrames>
|
</ObjectAnimationUsingKeyFrames>
|
||||||
</Storyboard>
|
</Storyboard>
|
||||||
</VisualState>
|
</VisualState>
|
||||||
<VisualState x:Name="Pressed">
|
<VisualState x:Name="Pressed">
|
||||||
<Storyboard>
|
<Storyboard>
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundElement"
|
|
||||||
Storyboard.TargetProperty="Background">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextBoxButtonPressedBackgroundThemeBrush}" />
|
|
||||||
</ObjectAnimationUsingKeyFrames>
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement"
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement"
|
||||||
Storyboard.TargetProperty="BorderBrush">
|
Storyboard.TargetProperty="BorderBrush">
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextBoxButtonPressedBorderThemeBrush}" />
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextBoxButtonPressedBorderThemeBrush}" />
|
||||||
|
@@ -0,0 +1,32 @@
|
|||||||
|
using System;
|
||||||
|
using Windows.UI;
|
||||||
|
using Windows.UI.Xaml.Data;
|
||||||
|
using Windows.UI.Xaml.Media;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Converters
|
||||||
|
{
|
||||||
|
public class DoubleToForegroungBrushComplexityConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, string language)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var currentValue = (double) value;
|
||||||
|
var maxValue = double.Parse(parameter as string);
|
||||||
|
var green = System.Convert.ToByte(currentValue / maxValue * byte.MaxValue);
|
||||||
|
var red = (byte) (byte.MaxValue - green);
|
||||||
|
return new SolidColorBrush(Color.FromArgb(255, red, green, 0));
|
||||||
|
}
|
||||||
|
catch (OverflowException)
|
||||||
|
{
|
||||||
|
return new SolidColorBrush(Color.FromArgb(255, 0, byte.MaxValue, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -126,6 +126,7 @@
|
|||||||
<Compile Include="Controls\TextBoxWithButton.cs" />
|
<Compile Include="Controls\TextBoxWithButton.cs" />
|
||||||
<Compile Include="Converters\BooleanToVisibilityConverter.cs" />
|
<Compile Include="Converters\BooleanToVisibilityConverter.cs" />
|
||||||
<Compile Include="Converters\ColorToBrushConverter.cs" />
|
<Compile Include="Converters\ColorToBrushConverter.cs" />
|
||||||
|
<Compile Include="Converters\DoubleToForegroungBrushComplexityConverter.cs" />
|
||||||
<Compile Include="Converters\InverseBooleanToVisibilityConverter.cs" />
|
<Compile Include="Converters\InverseBooleanToVisibilityConverter.cs" />
|
||||||
<Compile Include="Converters\PluralizationConverter.cs" />
|
<Compile Include="Converters\PluralizationConverter.cs" />
|
||||||
<Compile Include="Converters\ProgressBarLegalValuesConverter.cs" />
|
<Compile Include="Converters\ProgressBarLegalValuesConverter.cs" />
|
||||||
|
@@ -41,10 +41,6 @@
|
|||||||
<VisualState x:Name="Normal" />
|
<VisualState x:Name="Normal" />
|
||||||
<VisualState x:Name="PointerOver">
|
<VisualState x:Name="PointerOver">
|
||||||
<Storyboard>
|
<Storyboard>
|
||||||
<!--<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundElement"
|
|
||||||
Storyboard.TargetProperty="Background">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextBoxButtonPointerOverBackgroundThemeBrush}" />
|
|
||||||
</ObjectAnimationUsingKeyFrames>-->
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement"
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement"
|
||||||
Storyboard.TargetProperty="BorderBrush">
|
Storyboard.TargetProperty="BorderBrush">
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextBoxButtonPointerOverBorderThemeBrush}" />
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextBoxButtonPointerOverBorderThemeBrush}" />
|
||||||
@@ -57,10 +53,6 @@
|
|||||||
</VisualState>
|
</VisualState>
|
||||||
<VisualState x:Name="Pressed">
|
<VisualState x:Name="Pressed">
|
||||||
<Storyboard>
|
<Storyboard>
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundElement"
|
|
||||||
Storyboard.TargetProperty="Background">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextBoxButtonPressedBackgroundThemeBrush}" />
|
|
||||||
</ObjectAnimationUsingKeyFrames>
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement"
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement"
|
||||||
Storyboard.TargetProperty="BorderBrush">
|
Storyboard.TargetProperty="BorderBrush">
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextBoxButtonPressedBorderThemeBrush}" />
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextBoxButtonPressedBorderThemeBrush}" />
|
||||||
@@ -343,8 +335,6 @@
|
|||||||
<CheckBox IsChecked="{Binding SpacePatternSelected, Mode=TwoWay}">Space ( )</CheckBox>
|
<CheckBox IsChecked="{Binding SpacePatternSelected, Mode=TwoWay}">Space ( )</CheckBox>
|
||||||
<CheckBox IsChecked="{Binding SpecialPatternSelected, Mode=TwoWay}">Special (!, $, %, ...)</CheckBox>
|
<CheckBox IsChecked="{Binding SpecialPatternSelected, Mode=TwoWay}">Special (!, $, %, ...)</CheckBox>
|
||||||
<CheckBox IsChecked="{Binding BracketsPatternSelected, Mode=TwoWay}">Brackets ([], {}, (), ...)</CheckBox>
|
<CheckBox IsChecked="{Binding BracketsPatternSelected, Mode=TwoWay}">Brackets ([], {}, (), ...)</CheckBox>
|
||||||
<TextBlock>Additional characters:</TextBlock>
|
|
||||||
<TextBox Text="{Binding CustomChars}" />
|
|
||||||
<Button Click="PasswordGenerationButton_Click">Generate</Button>
|
<Button Click="PasswordGenerationButton_Click">Generate</Button>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Flyout>
|
</Flyout>
|
||||||
@@ -377,6 +367,9 @@
|
|||||||
<Style TargetType="TextBlock">
|
<Style TargetType="TextBlock">
|
||||||
<Setter Property="Margin" Value="0,20,0,0"/>
|
<Setter Property="Margin" Value="0,20,0,0"/>
|
||||||
</Style>
|
</Style>
|
||||||
|
<Style TargetType="CheckBox">
|
||||||
|
<Setter Property="Margin" Value="0,20,0,0"/>
|
||||||
|
</Style>
|
||||||
</StackPanel.Resources>
|
</StackPanel.Resources>
|
||||||
<TextBlock TextWrapping="Wrap" Text="User name or login" FontSize="18"/>
|
<TextBlock TextWrapping="Wrap" Text="User name or login" FontSize="18"/>
|
||||||
<TextBox HorizontalAlignment="Left" TextWrapping="Wrap" Text="{Binding UserName, Mode=TwoWay}" Width="350" Height="32" />
|
<TextBox HorizontalAlignment="Left" TextWrapping="Wrap" Text="{Binding UserName, Mode=TwoWay}" Width="350" Height="32" />
|
||||||
@@ -388,6 +381,11 @@
|
|||||||
<local:TextBoxWithButton x:Name="UrlTextBox" HorizontalAlignment="Left" Text="{Binding Url, Mode=TwoWay}" Height="32" Width="350" MaxLength="256" Style="{StaticResource TextBoxWithButtonStyle}" GotoClick="UrlButton_Click" />
|
<local:TextBoxWithButton x:Name="UrlTextBox" HorizontalAlignment="Left" Text="{Binding Url, Mode=TwoWay}" Height="32" Width="350" MaxLength="256" Style="{StaticResource TextBoxWithButtonStyle}" GotoClick="UrlButton_Click" />
|
||||||
<TextBlock TextWrapping="Wrap" Text="Notes" FontSize="18"/>
|
<TextBlock TextWrapping="Wrap" Text="Notes" FontSize="18"/>
|
||||||
<TextBox HorizontalAlignment="Left" TextWrapping="Wrap" Text="{Binding Notes, Mode=TwoWay}" Width="350" Height="200" AcceptsReturn="True" IsSpellCheckEnabled="True" />
|
<TextBox HorizontalAlignment="Left" TextWrapping="Wrap" Text="{Binding Notes, Mode=TwoWay}" Width="350" Height="200" AcceptsReturn="True" IsSpellCheckEnabled="True" />
|
||||||
|
<CheckBox FontSize="18" IsChecked="{Binding HasExpirationDate, Mode=TwoWay}">Expiration date</CheckBox>
|
||||||
|
<StackPanel Orientation="Horizontal" IsHitTestVisible="{Binding HasExpirationDate}">
|
||||||
|
<DatePicker Margin="0,0,20,0" ></DatePicker>
|
||||||
|
<TimePicker ></TimePicker>
|
||||||
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<!-- Bouton Précédent et titre de la page -->
|
<!-- Bouton Précédent et titre de la page -->
|
||||||
|
@@ -11,6 +11,7 @@
|
|||||||
<Page.Resources>
|
<Page.Resources>
|
||||||
<converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
|
<converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
|
||||||
<converters:ProgressBarLegalValuesConverter x:Key="ProgressBarLegalValuesConverter"/>
|
<converters:ProgressBarLegalValuesConverter x:Key="ProgressBarLegalValuesConverter"/>
|
||||||
|
<converters:DoubleToForegroungBrushComplexityConverter x:Key="DoubleToForegroungBrushComplexityConverter"/>
|
||||||
</Page.Resources>
|
</Page.Resources>
|
||||||
<Page.DataContext>
|
<Page.DataContext>
|
||||||
<viewModels:NewVm />
|
<viewModels:NewVm />
|
||||||
@@ -25,14 +26,7 @@
|
|||||||
<TextBlock Margin="25,10,0,10" Text="{Binding Name}" />
|
<TextBlock Margin="25,10,0,10" Text="{Binding Name}" />
|
||||||
<local:OpenDatabaseUserControl Password="{Binding Password, Mode=TwoWay}" CreateNew="True" ValidationChecked="PasswordUserControl_PasswordChecked" />
|
<local:OpenDatabaseUserControl Password="{Binding Password, Mode=TwoWay}" CreateNew="True" ValidationChecked="PasswordUserControl_PasswordChecked" />
|
||||||
<TextBlock Margin="25,0,0,10">Password complexity</TextBlock>
|
<TextBlock Margin="25,0,0,10">Password complexity</TextBlock>
|
||||||
<ProgressBar Margin="25,0,0,10" Value="{Binding PasswordComplexityIndicator, ConverterParameter=0\,128, Converter={StaticResource ProgressBarLegalValuesConverter}, Mode=OneWay}" Maximum="128" Width="300" HorizontalAlignment="Left" >
|
<ProgressBar Margin="25,0,0,10" Value="{Binding PasswordComplexityIndicator, ConverterParameter=0\,128, Converter={StaticResource ProgressBarLegalValuesConverter}}" Maximum="128" Width="300" HorizontalAlignment="Left" Foreground="{Binding PasswordComplexityIndicator, ConverterParameter=128, Converter={StaticResource DoubleToForegroungBrushComplexityConverter}}" />
|
||||||
<ProgressBar.Background>
|
|
||||||
<LinearGradientBrush EndPoint="1,1" StartPoint="0,0">
|
|
||||||
<GradientStop Color="#FFFD0000"/>
|
|
||||||
<GradientStop Color="#FF2EFF00" Offset="1"/>
|
|
||||||
</LinearGradientBrush>
|
|
||||||
</ProgressBar.Background>
|
|
||||||
</ProgressBar>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
@@ -19,6 +19,7 @@ namespace ModernKeePass.ViewModels
|
|||||||
public System.Drawing.Color? ForegroundColor => Entry?.ForegroundColor;
|
public System.Drawing.Color? ForegroundColor => Entry?.ForegroundColor;
|
||||||
public bool IsRevealPasswordEnabled => !string.IsNullOrEmpty(Password);
|
public bool IsRevealPasswordEnabled => !string.IsNullOrEmpty(Password);
|
||||||
|
|
||||||
|
|
||||||
public double PasswordLength { get; set; } = 25;
|
public double PasswordLength { get; set; } = 25;
|
||||||
public bool UpperCasePatternSelected { get; set; } = true;
|
public bool UpperCasePatternSelected { get; set; } = true;
|
||||||
public bool LowerCasePatternSelected { get; set; } = true;
|
public bool LowerCasePatternSelected { get; set; } = true;
|
||||||
@@ -72,11 +73,23 @@ namespace ModernKeePass.ViewModels
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (Entry == null) return Symbol.Add;
|
if (Entry == null) return Symbol.Add;
|
||||||
|
//if ()
|
||||||
var result = PwIconToSegoeMapping.GetSymbolFromIcon(Entry.IconId);
|
var result = PwIconToSegoeMapping.GetSymbolFromIcon(Entry.IconId);
|
||||||
return result == Symbol.More ? Symbol.Permissions : result;
|
return result == Symbol.More ? Symbol.Permissions : result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DateTimeOffset ExpiryDate
|
||||||
|
{
|
||||||
|
get { return new DateTimeOffset(Entry.ExpiryTime.Date); }
|
||||||
|
set { Entry.ExpiryTime = value.DateTime; }
|
||||||
|
}
|
||||||
|
public TimeSpan ExpiryTime
|
||||||
|
{
|
||||||
|
get { return Entry.ExpiryTime.TimeOfDay; }
|
||||||
|
set { Entry.ExpiryTime = Entry.ExpiryTime.Date.Add(value); }
|
||||||
|
}
|
||||||
|
|
||||||
public bool IsEditMode
|
public bool IsEditMode
|
||||||
{
|
{
|
||||||
get { return _isEditMode; }
|
get { return _isEditMode; }
|
||||||
@@ -96,11 +109,21 @@ namespace ModernKeePass.ViewModels
|
|||||||
NotifyPropertyChanged("IsRevealPassword");
|
NotifyPropertyChanged("IsRevealPassword");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public bool HasExpirationDate
|
||||||
|
{
|
||||||
|
get { return Entry.Expires; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
Entry.Expires = value;
|
||||||
|
NotifyPropertyChanged("HasExpirationDate");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public event PropertyChangedEventHandler PropertyChanged;
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
|
||||||
private bool _isEditMode;
|
private bool _isEditMode;
|
||||||
private bool _isRevealPassword;
|
private bool _isRevealPassword;
|
||||||
|
|
||||||
private void NotifyPropertyChanged(string propertyName)
|
private void NotifyPropertyChanged(string propertyName)
|
||||||
{
|
{
|
||||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
|
@@ -6,6 +6,7 @@ namespace ModernKeePass.ViewModels
|
|||||||
{
|
{
|
||||||
private string _password = string.Empty;
|
private string _password = string.Empty;
|
||||||
|
|
||||||
|
public double PasswordComplexityIndicator => QualityEstimation.EstimatePasswordBits(Password.ToCharArray());
|
||||||
public string Password
|
public string Password
|
||||||
{
|
{
|
||||||
get { return _password; }
|
get { return _password; }
|
||||||
@@ -16,6 +17,5 @@ namespace ModernKeePass.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public double PasswordComplexityIndicator => QualityEstimation.EstimatePasswordBits(Password.ToCharArray());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user