From dfdaa0ce26e1e29967a01e1900aba5b112fc087e Mon Sep 17 00:00:00 2001
From: Kevin Puetz <puetzk@puetzk.org>
Date: Wed, 4 Jan 2023 20:58:44 -0600
Subject: [PATCH] keepass: 2.49 -> 2.52

https://keepass.info/news/n220909_2.52.html
---
 pkgs/applications/misc/keepass/default.nix    |  4 ++--
 .../applications/misc/keepass/fix-paths.patch | 22 +++++++++----------
 .../misc/keepass/keepass-plugins.patch        | 20 ++++++++---------
 3 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/pkgs/applications/misc/keepass/default.nix b/pkgs/applications/misc/keepass/default.nix
index f9c78dfc6fbf..e062c35e80a6 100644
--- a/pkgs/applications/misc/keepass/default.nix
+++ b/pkgs/applications/misc/keepass/default.nix
@@ -4,11 +4,11 @@ let
   inherit (builtins) add length readFile replaceStrings unsafeDiscardStringContext toString map;
 in buildDotnetPackage rec {
   pname = "keepass";
-  version = "2.49";
+  version = "2.52";
 
   src = fetchurl {
     url = "mirror://sourceforge/keepass/KeePass-${version}-Source.zip";
-    sha256 = "sha256-1hg4bRuQSG+UzEQGeQcSURTmTxt5ITGQqfg0IS7RWt0=";
+    sha256 = "sha256-6dGCfysen26VGHIHETuNGkqHbPyeWRIEopqJa6AMzXA=";
   };
 
   sourceRoot = ".";
diff --git a/pkgs/applications/misc/keepass/fix-paths.patch b/pkgs/applications/misc/keepass/fix-paths.patch
index 5ff36a21c002..5d367b0a8266 100644
--- a/pkgs/applications/misc/keepass/fix-paths.patch
+++ b/pkgs/applications/misc/keepass/fix-paths.patch
@@ -43,15 +43,15 @@ diff --git a/KeePass/Util/AppLocator.cs b/KeePass/Util/AppLocator.cs
 index af02803..8a32c9d 100644
 --- a/KeePass/Util/AppLocator.cs
 +++ b/KeePass/Util/AppLocator.cs
-@@ -429,7 +429,7 @@ namespace KeePass.Util
+@@ -468,7 +468,7 @@ namespace KeePass.Util
  			if(NativeLib.GetPlatformID() == PlatformID.MacOSX)
- 				strArgPrefix = string.Empty; // FR 3535696
+ 				strOpt = string.Empty; // FR 3535696
  
--			string str = NativeLib.RunConsoleApp("whereis", strArgPrefix + strApp);
-+			string str = NativeLib.RunConsoleApp("@whereis@", strArgPrefix + strApp);
- 			if(str == null) return null;
+-			string str = NativeLib.RunConsoleApp("whereis", strOpt + strApp);
++			string str = NativeLib.RunConsoleApp("@whereis@", strOpt + strApp);
+ 			if(string.IsNullOrEmpty(str)) return null;
  
- 			str = str.Trim();
+ 			int iSep = str.IndexOf(':');
 diff --git a/KeePass/Util/ClipboardUtil.Unix.cs b/KeePass/Util/ClipboardUtil.Unix.cs
 index ab49ee2..7f6c50f 100644
 --- a/KeePass/Util/ClipboardUtil.Unix.cs
@@ -108,14 +108,14 @@ diff --git a/KeePassLib/Native/NativeLib.cs b/KeePassLib/Native/NativeLib.cs
 index 2d227a3..243f4ee 100644
 --- a/KeePassLib/Native/NativeLib.cs
 +++ b/KeePassLib/Native/NativeLib.cs
-@@ -145,7 +145,7 @@ namespace KeePassLib.Native
- 			// Mono returns PlatformID.Unix on Mac OS X, workaround this
- 			if(m_platID.Value == PlatformID.Unix)
+@@ -143,7 +143,7 @@ namespace KeePassLib.Native
+ 			// Mono returns PlatformID.Unix on MacOS, workaround this
+ 			if(g_platID.Value == PlatformID.Unix)
  			{
 -				if((RunConsoleApp("uname", null) ?? string.Empty).Trim().Equals(
 +				if((RunConsoleApp("@uname@", null) ?? string.Empty).Trim().Equals(
  					"Darwin", StrUtil.CaseIgnoreCmp))
- 					m_platID = PlatformID.MacOSX;
+ 					g_platID = PlatformID.MacOSX;
  			}
 diff --git a/KeePassLib/Utility/MonoWorkarounds.cs b/KeePassLib/Utility/MonoWorkarounds.cs
 index e20bb3a..4fd875b 100644
@@ -130,7 +130,7 @@ index e20bb3a..4fd875b 100644
  
  		private static Dictionary<uint, bool> g_dForceReq = new Dictionary<uint, bool>();
  		private static Thread g_thFixClip = null;
-@@ -335,7 +335,7 @@ namespace KeePassLib.Utility
+@@ -356,7 +356,7 @@ namespace KeePassLib.Utility
  				// }
  				// else { Debug.Assert(false); }
  
diff --git a/pkgs/applications/misc/keepass/keepass-plugins.patch b/pkgs/applications/misc/keepass/keepass-plugins.patch
index 891be1ffa314..978387eb9919 100644
--- a/pkgs/applications/misc/keepass/keepass-plugins.patch
+++ b/pkgs/applications/misc/keepass/keepass-plugins.patch
@@ -9,17 +9,17 @@ Subject: [PATCH] loadplugin
 
 diff --git a/KeePass/Forms/MainForm.cs b/KeePass/Forms/MainForm.cs
 index 347eaf5..b92e1e2 100644
---- a/KeePass/Forms/MainForm.cs
-+++ b/KeePass/Forms/MainForm.cs
-@@ -440,7 +440,$OUTPUT_LC$ @@ namespace KeePass.Forms
- 				ToolStripItemCollection tsicT = m_ctxTray.Items;
- 				ToolStripItem tsiPrevT = m_ctxTrayOptions;
- 
--				m_pluginManager.LoadAllPlugins();
+--- a/KeePass/Forms/MainForm_Functions.cs
++++ b/KeePass/Forms/MainForm_Functions.cs
+@@ -312,7 +312,$OUTPUT_LC$ @@ namespace KeePass.Forms
+ 				ToolStripItemCollection tsicT = m_ctxTray.Items;
+ 				ToolStripItem tsiPrevT = m_ctxTrayOptions;
+ 
+-				m_pluginManager.LoadAllPlugins();
 $DO_LOADS$+
- 
- 				m_pluginManager.AddMenuItems(PluginMenuType.Main, tsicM, tsiPrevM);
- 				m_pluginManager.AddMenuItems(PluginMenuType.Group, tsicGM, tsiPrevGM);
+ 
+ 				m_pluginManager.AddMenuItems(PluginMenuType.Main, tsicM, tsiPrevM);
+ 				m_pluginManager.AddMenuItems(PluginMenuType.Group, tsicGM, tsiPrevGM);
 -- 
 2.25.4