diff --git a/ModernKeePass.Application/Application.csproj b/ModernKeePass.Application/Application.csproj
index 5343467..9df5904 100644
--- a/ModernKeePass.Application/Application.csproj
+++ b/ModernKeePass.Application/Application.csproj
@@ -106,6 +106,7 @@
+
diff --git a/ModernKeePass.Application/Common/Interfaces/IDatabaseProxy.cs b/ModernKeePass.Application/Common/Interfaces/IDatabaseProxy.cs
index b3fd6e0..1e1494d 100644
--- a/ModernKeePass.Application/Common/Interfaces/IDatabaseProxy.cs
+++ b/ModernKeePass.Application/Common/Interfaces/IDatabaseProxy.cs
@@ -22,6 +22,7 @@ namespace ModernKeePass.Application.Common.Interfaces
string FileAccessToken { get; set; }
int Size { get; set; }
bool IsDirty { get; set; }
+ int MaxHistoryCount { get; set; }
Task Open(byte[] file, Credentials credentials);
Task ReOpen(byte[] file);
diff --git a/ModernKeePass.Application/Database/Models/DatabaseVm.cs b/ModernKeePass.Application/Database/Models/DatabaseVm.cs
index 4f21cfd..831b621 100644
--- a/ModernKeePass.Application/Database/Models/DatabaseVm.cs
+++ b/ModernKeePass.Application/Database/Models/DatabaseVm.cs
@@ -12,5 +12,6 @@
public string KeyDerivationId { get; set; }
public int Size { get; internal set; }
public bool IsDirty { get; internal set; }
+ public int MaxHistoryCount { get; set; }
}
}
\ No newline at end of file
diff --git a/ModernKeePass.Application/Database/Queries/GetDatabase/GetDatabaseQuery.cs b/ModernKeePass.Application/Database/Queries/GetDatabase/GetDatabaseQuery.cs
index 35659f7..93ebe5b 100644
--- a/ModernKeePass.Application/Database/Queries/GetDatabase/GetDatabaseQuery.cs
+++ b/ModernKeePass.Application/Database/Queries/GetDatabase/GetDatabaseQuery.cs
@@ -33,6 +33,7 @@ namespace ModernKeePass.Application.Database.Queries.GetDatabase
database.KeyDerivationId = _databaseProxy.KeyDerivationId;
database.Size = _databaseProxy.Size;
database.IsDirty = _databaseProxy.IsDirty;
+ database.MaxHistoryCount = _databaseProxy.MaxHistoryCount;
}
return database;
}
diff --git a/ModernKeePass.Application/Parameters/Commands/SetMaxHistoryCount/SetHistoryCountCommand.cs b/ModernKeePass.Application/Parameters/Commands/SetMaxHistoryCount/SetHistoryCountCommand.cs
new file mode 100644
index 0000000..2cbaa70
--- /dev/null
+++ b/ModernKeePass.Application/Parameters/Commands/SetMaxHistoryCount/SetHistoryCountCommand.cs
@@ -0,0 +1,27 @@
+using MediatR;
+using ModernKeePass.Application.Common.Interfaces;
+using ModernKeePass.Domain.Exceptions;
+
+namespace ModernKeePass.Application.Parameters.Commands.SetMaxHistoryCount
+{
+ public class SetMaxHistoryCountCommand : IRequest
+ {
+ public int MaxHistoryCount { get; set; }
+
+ public class SetMaxHistoryCountCommandHandler : IRequestHandler
+ {
+ private readonly IDatabaseProxy _database;
+
+ public SetMaxHistoryCountCommandHandler(IDatabaseProxy database)
+ {
+ _database = database;
+ }
+
+ public void Handle(SetMaxHistoryCountCommand message)
+ {
+ if (_database.IsOpen) _database.MaxHistoryCount = message.MaxHistoryCount;
+ else throw new DatabaseClosedException();
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/ModernKeePass.Infrastructure/KeePass/KeePassDatabaseClient.cs b/ModernKeePass.Infrastructure/KeePass/KeePassDatabaseClient.cs
index 8398d70..5e269b8 100644
--- a/ModernKeePass.Infrastructure/KeePass/KeePassDatabaseClient.cs
+++ b/ModernKeePass.Infrastructure/KeePass/KeePassDatabaseClient.cs
@@ -40,6 +40,12 @@ namespace ModernKeePass.Infrastructure.KeePass
public int Size { get; set; }
public bool IsDirty { get; set; }
+ public int MaxHistoryCount
+ {
+ get { return _pwDatabase.HistoryMaxItems; }
+ set { _pwDatabase.HistoryMaxItems = value; }
+ }
+
// Settings
public bool IsRecycleBinEnabled
{
diff --git a/ModernKeePass/App.xaml.cs b/ModernKeePass/App.xaml.cs
index 0f1a105..28e3468 100644
--- a/ModernKeePass/App.xaml.cs
+++ b/ModernKeePass/App.xaml.cs
@@ -166,14 +166,6 @@ namespace ModernKeePass
#if DEBUG
_notification.Show("App resumed", "Nothing to do, no previous database opened");
#endif
- }
- catch (Exception ex)
- {
- _hockey.TrackException(ex);
- _hockey.Flush();
- }
- finally
- {
_navigation.NavigateTo(Constants.Navigation.MainPage);
}
}
diff --git a/ModernKeePass/appMetadata/en-us/baselisting/releaseNotes.txt b/ModernKeePass/appMetadata/en-us/baselisting/releaseNotes.txt
index 0171f7a..e8aaf35 100644
--- a/ModernKeePass/appMetadata/en-us/baselisting/releaseNotes.txt
+++ b/ModernKeePass/appMetadata/en-us/baselisting/releaseNotes.txt
@@ -1,5 +1,7 @@
Support for additional fields
Support for attachments
+Add an expiration timer for clipboard data
Ability to manually reorder groups
+Ability to set max history count
Design changes
Update to KeePassLib version 2.45
\ No newline at end of file
diff --git a/ModernKeePass/appMetadata/fr-fr/baselisting/releaseNotes.txt b/ModernKeePass/appMetadata/fr-fr/baselisting/releaseNotes.txt
index 3123833..313b341 100644
--- a/ModernKeePass/appMetadata/fr-fr/baselisting/releaseNotes.txt
+++ b/ModernKeePass/appMetadata/fr-fr/baselisting/releaseNotes.txt
@@ -1,5 +1,7 @@
Ajout des champs additionnels
Ajout des pièces-jointes
+Ajout d'une expiration du presse papier
Possibilite de reorganiser les groupes manuellement
+Possibilite de parametrer le nombre max d'historique
Quelques changements de design
Mise a jour de la KeePassLib version 2.45
\ No newline at end of file
diff --git a/WinAppCommon/Actions/ClipboardAction.cs b/WinAppCommon/Actions/ClipboardAction.cs
index 5b9dab4..65a6ad6 100644
--- a/WinAppCommon/Actions/ClipboardAction.cs
+++ b/WinAppCommon/Actions/ClipboardAction.cs
@@ -1,11 +1,17 @@
-using Windows.ApplicationModel.DataTransfer;
+using System;
+using Windows.ApplicationModel.DataTransfer;
using Windows.UI.Xaml;
+using Microsoft.Extensions.DependencyInjection;
using Microsoft.Xaml.Interactivity;
+using ModernKeePass.Application.Common.Interfaces;
+using ModernKeePass.Common;
namespace ModernKeePass.Actions
{
public class ClipboardAction : DependencyObject, IAction
{
+ private DispatcherTimer _dispatcher;
+
public string Text
{
get { return (string)GetValue(TextProperty); }
@@ -18,10 +24,24 @@ namespace ModernKeePass.Actions
public object Execute(object sender, object parameter)
{
if (string.IsNullOrEmpty(Text)) return null;
+
+ var settings = App.Services.GetRequiredService();
+
+ _dispatcher = new DispatcherTimer {Interval = TimeSpan.FromSeconds(settings.GetSetting(Constants.Settings.ClipboardTimeout, 10))};
+ _dispatcher.Tick += Dispatcher_Tick;
+
var dataPackage = new DataPackage { RequestedOperation = DataPackageOperation.Copy };
dataPackage.SetText(Text);
Clipboard.SetContent(dataPackage);
+ _dispatcher.Start();
+
return null;
}
+
+ private void Dispatcher_Tick(object sender, object e)
+ {
+ Clipboard.SetContent(null);
+ _dispatcher.Stop();
+ }
}
}
diff --git a/WinAppCommon/Common/Constants.cs b/WinAppCommon/Common/Constants.cs
index 87bc674..b22cd7b 100644
--- a/WinAppCommon/Common/Constants.cs
+++ b/WinAppCommon/Common/Constants.cs
@@ -19,6 +19,8 @@
public static string SaveSuspend => nameof(SaveSuspend);
public static string Sample => nameof(Sample);
public static string DefaultFileFormat => nameof(DefaultFileFormat);
+ public static string ClipboardTimeout => nameof(ClipboardTimeout);
+ public static string HistoryMaxCount => nameof(HistoryMaxCount);
}
}
}
\ No newline at end of file