diff -Nru keepass2-2.35+dfsg/Build/PrepMonoDev.sh keepass2-2.36+dfsg/Build/PrepMonoDev.sh --- keepass2-2.35+dfsg/Build/PrepMonoDev.sh 2015-11-08 18:25:36.000000000 +0000 +++ keepass2-2.36+dfsg/Build/PrepMonoDev.sh 2017-03-13 11:44:16.000000000 +0000 @@ -1,15 +1,62 @@ -cp -f ../Ext/Icons_04_CB/Finals2/plockb.ico ../KeePass/KeePass.ico -cp -f ../Ext/Icons_04_CB/Finals2/plockb.ico ../KeePass/Resources/Images/KeePass.ico +#!/bin/sh -sed 's!true!false!g' ../KeePass/KeePass.csproj > ../KeePass/KeePass.csproj.new -sed 's! ToolsVersion="3.5"!!g' ../KeePass/KeePass.csproj.new > ../KeePass/KeePass.csproj.new2 -cat ../KeePass/KeePass.csproj.new2 | grep -v 'sgen\.exe' > ../KeePass/KeePass.csproj -rm -f ../KeePass/KeePass.csproj.new2 -rm -f ../KeePass/KeePass.csproj.new - -sed 's!true!false!g' ../KeePassLib/KeePassLib.csproj > ../KeePassLib/KeePassLib.csproj.new -sed 's! ToolsVersion="3.5"!!g' ../KeePassLib/KeePassLib.csproj.new > ../KeePassLib/KeePassLib.csproj -rm -f ../KeePassLib/KeePassLib.csproj.new +kpBuild="$(pwd)" +kpRoot="${kpBuild}/.." -# cat ../KeePass.sln | grep -v 'DC15F71A-2117-4DEF-8C10-AA355B5E5979' | uniq > ../KeePass.sln.new -# mv -f ../KeePass.sln.new ../KeePass.sln +# Mono's resource compiler/linker doesn't support ICO files +# containing high resolution images (in PNG format) +kpIco="${kpRoot}/Ext/Icons_15_VA/LowResIcons/KeePass_LR.ico" +kpIcoG="${kpRoot}/Ext/Icons_15_VA/LowResIcons/KeePass_LR_G.ico" +kpIcoR="${kpRoot}/Ext/Icons_15_VA/LowResIcons/KeePass_LR_R.ico" +kpIcoY="${kpRoot}/Ext/Icons_15_VA/LowResIcons/KeePass_LR_Y.ico" + +fnPrepSolution() +{ + cd "${kpRoot}" + local kpSln="KeePass.sln" + + # Update solution format to 11 (this targets Mono 4 rather than 3.5) + sed -i 's!Format Version 10\.00!Format Version 11\.00!g' "${kpSln}" +} + +fnPrepKeePass() +{ + cd "${kpRoot}/KeePass" + local kpCsProj="KeePass.csproj" + + sed -i 's! ToolsVersion="3\.5"!!g' "${kpCsProj}" + sed -i 's!true!false!g' "${kpCsProj}" + sed -i '/sgen\.exe/d' "${kpCsProj}" + + cp -f "${kpIco}" KeePass.ico + cp -f "${kpIco}" Resources/Icons/KeePass.ico + cp -f "${kpIcoG}" Resources/Icons/KeePass_G.ico + cp -f "${kpIcoR}" Resources/Icons/KeePass_R.ico + cp -f "${kpIcoY}" Resources/Icons/KeePass_Y.ico +} + +fnPrepKeePassLib() +{ + cd "${kpRoot}/KeePassLib" + local kpCsProj="KeePassLib.csproj" + + sed -i 's! ToolsVersion="3\.5"!!g' "${kpCsProj}" + sed -i 's!true!false!g' "${kpCsProj}" +} + +fnPrepTrlUtil() +{ + cd "${kpRoot}/Translation/TrlUtil" + local kpCsProj="TrlUtil.csproj" + + sed -i 's! ToolsVersion="3\.5"!!g' "${kpCsProj}" + + cp -f "${kpIco}" Resources/KeePass.ico +} + +fnPrepSolution +fnPrepKeePass +fnPrepKeePassLib +fnPrepTrlUtil + +cd "${kpBuild}" diff -Nru keepass2-2.35+dfsg/debian/changelog keepass2-2.36+dfsg/debian/changelog --- keepass2-2.35+dfsg/debian/changelog 2017-05-21 15:50:24.000000000 +0000 +++ keepass2-2.36+dfsg/debian/changelog 2017-06-26 15:07:54.000000000 +0000 @@ -1,8 +1,18 @@ -keepass2 (2.35+dfsg-2~ubuntu14.04~ppa1) trusty; urgency=medium +keepass2 (2.36+dfsg-1~ubuntu14.04~ppa1) trusty; urgency=medium * upload to ppa - -- Julian Taylor Sun, 21 May 2017 17:50:24 +0200 + -- Julian Taylor Mon, 26 Jun 2017 17:07:54 +0200 + +keepass2 (2.36+dfsg-1) unstable; urgency=medium + + * New upstream release + * Update rules for new icon path + * remove debian/patches/use-installed-ico-files.patch: + does not appear to be necessary with current mono anymore + * increase-tabheight.patch: workaround database tab crash (LP: #891029) + + -- Julian Taylor Sun, 18 Jun 2017 19:28:14 +0200 keepass2 (2.35+dfsg-2) unstable; urgency=medium diff -Nru keepass2-2.35+dfsg/debian/install keepass2-2.36+dfsg/debian/install --- keepass2-2.35+dfsg/debian/install 2017-05-21 15:50:24.000000000 +0000 +++ keepass2-2.36+dfsg/debian/install 2017-06-26 15:07:54.000000000 +0000 @@ -2,10 +2,6 @@ Ext/KeePass.config.xml usr/lib/keepass2 Ext/KeePass.exe.config usr/lib/keepass2 Ext/XSL usr/share/keepass2 -KeePass/Resources/Icons/LockOverlay.ico usr/share/keepass2 -KeePass/Resources/Icons/QuadLocked.ico usr/share/keepass2 -KeePass/Resources/Icons/QuadNormal.ico usr/share/keepass2 -KeePass/Resources/Images/KeePass.ico usr/share/keepass2 debian/keepass2.desktop usr/share/applications debian/keepass2.sh usr/bin debian/keepass2.xml usr/share/mime/packages diff -Nru keepass2-2.35+dfsg/debian/patches/disable-clipboard-workaround.patch keepass2-2.36+dfsg/debian/patches/disable-clipboard-workaround.patch --- keepass2-2.35+dfsg/debian/patches/disable-clipboard-workaround.patch 2017-05-21 15:50:24.000000000 +0000 +++ keepass2-2.36+dfsg/debian/patches/disable-clipboard-workaround.patch 2017-06-26 15:07:54.000000000 +0000 @@ -13,9 +13,9 @@ =================================================================== --- keepass2.orig/KeePassLib/Utility/MonoWorkarounds.cs +++ keepass2/KeePassLib/Utility/MonoWorkarounds.cs -@@ -169,7 +169,7 @@ namespace KeePassLib.Utility +@@ -174,7 +174,7 @@ namespace KeePassLib.Utility - // m_fOwnWindow = fOwnWindow; + // g_fOwnWindow = fOwnWindow; - if(IsRequired(1530)) + if(false && IsRequired(1530)) diff -Nru keepass2-2.35+dfsg/debian/patches/do-not-use-the-non-free-icons.patch keepass2-2.36+dfsg/debian/patches/do-not-use-the-non-free-icons.patch --- keepass2-2.35+dfsg/debian/patches/do-not-use-the-non-free-icons.patch 2017-05-21 15:50:24.000000000 +0000 +++ keepass2-2.36+dfsg/debian/patches/do-not-use-the-non-free-icons.patch 2017-06-26 15:07:54.000000000 +0000 @@ -4,14 +4,14 @@ Forwarded: not-needed --- - KeePass/Properties/Resources.resx | 80 +++++++++++++++++++-------------------- - 1 file changed, 40 insertions(+), 40 deletions(-) + KeePass/Properties/Resources.resx | 83 ++++++++++++++++++++------------------- + 1 file changed, 43 insertions(+), 40 deletions(-) Index: keepass2/KeePass/Properties/Resources.resx =================================================================== --- keepass2.orig/KeePass/Properties/Resources.resx +++ keepass2/KeePass/Properties/Resources.resx -@@ -404,40 +404,40 @@ +@@ -401,40 +404,40 @@ ..\Resources\Nuvola\B48x48_Run.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -63,7 +63,7 @@ ..\Resources\Nuvola_Derived\B16x16_File_SaveAll.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a -@@ -449,22 +449,22 @@ +@@ -446,22 +449,22 @@ ..\Resources\Nuvola_Derived\B16x16_File_Close.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -91,7 +91,7 @@ ..\Resources\Nuvola\B16x16_Make_KDevelop.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a -@@ -473,10 +473,10 @@ +@@ -470,10 +473,10 @@ ..\Resources\Nuvola\B48x48_Make_KDevelop.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -104,7 +104,7 @@ ..\Resources\Images\B16x16_FontBold.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a -@@ -503,13 +503,13 @@ +@@ -500,13 +503,13 @@ ..\Resources\Images\B16x16_Imp_KeePassX.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -121,7 +121,7 @@ ..\Resources\Nuvola\B48x48_View_Detailed.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a -@@ -524,13 +524,13 @@ +@@ -521,13 +524,13 @@ ..\Resources\Icons\LockOverlay.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -138,7 +138,7 @@ ..\Resources\Images\B16x16_MenuRadio.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a -@@ -539,13 +539,13 @@ +@@ -536,13 +539,13 @@ ..\Resources\Nuvola\B16x16_KaboodleLoop.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -155,7 +155,7 @@ ..\Resources\Nuvola_Derived\B16x16_EditCopyLink.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a -@@ -554,19 +554,19 @@ +@@ -551,19 +554,19 @@ ..\Resources\Nuvola_Derived\B16x16_Key_New.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -180,7 +180,7 @@ ..\Resources\Nuvola_Derived\B16x16_Folder_2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a -@@ -581,13 +581,13 @@ +@@ -578,13 +581,13 @@ ..\Resources\Data\MostPopularPasswords.txt.gz;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -197,7 +197,7 @@ ..\Resources\Images\B16x16_MenuCheck.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a -@@ -629,18 +629,18 @@ +@@ -626,19 +629,19 @@ ..\Resources\Nuvola_Derived\B16x16_Folder_New_Ex.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -219,6 +219,12 @@ - ..\Resources\Images\B16x16_Imp_Enpass.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\Nuvola\B16x16_KGPG_Import.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Icons\KeePass_G.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a +@@ -661,4 +664,4 @@ + + ..\Resources\Icons\KeePass.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + - \ No newline at end of file + diff -Nru keepass2-2.35+dfsg/debian/patches/dont-display-as-dev-version.patch keepass2-2.36+dfsg/debian/patches/dont-display-as-dev-version.patch --- keepass2-2.35+dfsg/debian/patches/dont-display-as-dev-version.patch 2017-05-21 15:50:24.000000000 +0000 +++ keepass2-2.36+dfsg/debian/patches/dont-display-as-dev-version.patch 2017-06-26 15:07:54.000000000 +0000 @@ -11,7 +11,7 @@ =================================================================== --- keepass2.orig/KeePass/Program.cs +++ keepass2/KeePass/Program.cs -@@ -779,7 +779,7 @@ namespace KeePass +@@ -776,7 +776,7 @@ namespace KeePass Assembly asm = Assembly.GetExecutingAssembly(); byte[] pk = asm.GetName().GetPublicKeyToken(); string strPk = MemUtil.ByteArrayToHexString(pk); diff -Nru keepass2-2.35+dfsg/debian/patches/fix-XSL-search-path.patch keepass2-2.36+dfsg/debian/patches/fix-XSL-search-path.patch --- keepass2-2.35+dfsg/debian/patches/fix-XSL-search-path.patch 2017-05-21 15:50:24.000000000 +0000 +++ keepass2-2.36+dfsg/debian/patches/fix-XSL-search-path.patch 2017-06-26 15:07:54.000000000 +0000 @@ -20,14 +20,14 @@ + public const string DebianDataDir = "/usr/share/keepass2/"; + - public const string XslFilesDir = "XSL"; - public const string XslFileHtmlFull = "KDBX_DetailsFull_HTML.xsl"; - public const string XslFileHtmlLight = "KDBX_DetailsLight_HTML.xsl"; + public static readonly Color ColorQualityLow = Color.FromArgb(255, 128, 0); + public static readonly Color ColorQualityHigh = Color.FromArgb(0, 255, 0); + Index: keepass2/KeePass/Forms/AboutForm.cs =================================================================== --- keepass2.orig/KeePass/Forms/AboutForm.cs +++ keepass2/KeePass/Forms/AboutForm.cs -@@ -97,8 +97,7 @@ namespace KeePass.Forms +@@ -98,8 +98,7 @@ namespace KeePass.Forms m_lvComponents.Items.Add(lvi); lvi = new ListViewItem(KPRes.XslStylesheetsKdbx); diff -Nru keepass2-2.35+dfsg/debian/patches/force_toolsversion_4 keepass2-2.36+dfsg/debian/patches/force_toolsversion_4 --- keepass2-2.35+dfsg/debian/patches/force_toolsversion_4 2017-05-21 15:50:24.000000000 +0000 +++ keepass2-2.36+dfsg/debian/patches/force_toolsversion_4 2017-06-26 15:07:54.000000000 +0000 @@ -30,7 +30,7 @@ Debug AnyCPU -@@ -1392,4 +1392,4 @@ +@@ -1407,4 +1407,4 @@ --> diff -Nru keepass2-2.35+dfsg/debian/patches/increase-tabheight.patch keepass2-2.36+dfsg/debian/patches/increase-tabheight.patch --- keepass2-2.35+dfsg/debian/patches/increase-tabheight.patch 1970-01-01 00:00:00.000000000 +0000 +++ keepass2-2.36+dfsg/debian/patches/increase-tabheight.patch 2017-06-26 15:07:54.000000000 +0000 @@ -0,0 +1,25 @@ +From: Julian Taylor +Date: Thu, 22 Jun 2017 07:35:29 +0200 +Subject: increase tabheight + +Increase tabheight further to workaround crash when changing database +tabs. +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1659159 +Bug: https://sourceforge.net/p/keepass/bugs/1634 +--- + KeePass/Forms/MainForm.cs | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Index: keepass2/KeePass/Forms/MainForm.cs +=================================================================== +--- keepass2.orig/KeePass/Forms/MainForm.cs ++++ keepass2/KeePass/Forms/MainForm.cs +@@ -125,7 +125,7 @@ namespace KeePass.Forms + + AssignMenuShortcuts(); + +- if(MonoWorkarounds.IsRequired(891029)) m_tabMain.Height += 5; ++ if(MonoWorkarounds.IsRequired(891029)) m_tabMain.Height += 10; + } + + private bool m_bFormLoadCalled = false; diff -Nru keepass2-2.35+dfsg/debian/patches/series keepass2-2.36+dfsg/debian/patches/series --- keepass2-2.35+dfsg/debian/patches/series 2017-05-21 15:50:24.000000000 +0000 +++ keepass2-2.36+dfsg/debian/patches/series 2017-06-26 15:07:54.000000000 +0000 @@ -1,5 +1,4 @@ use-the-mono-signing-key.patch -use-installed-ico-files.patch do-not-use-the-non-free-icons.patch skip-sgen-run-during-build.patch fix-XSL-search-path.patch @@ -9,3 +8,4 @@ x11-dllmap.patch dont-display-as-dev-version.patch disable-clipboard-workaround.patch +increase-tabheight.patch diff -Nru keepass2-2.35+dfsg/debian/patches/skip-sgen-run-during-build.patch keepass2-2.36+dfsg/debian/patches/skip-sgen-run-during-build.patch --- keepass2-2.35+dfsg/debian/patches/skip-sgen-run-during-build.patch 2017-05-21 15:50:24.000000000 +0000 +++ keepass2-2.36+dfsg/debian/patches/skip-sgen-run-during-build.patch 2017-06-26 15:07:54.000000000 +0000 @@ -11,7 +11,7 @@ =================================================================== --- keepass2.orig/KeePass/KeePass.csproj +++ keepass2/KeePass/KeePass.csproj -@@ -1392,7 +1392,4 @@ +@@ -1407,7 +1407,4 @@ --> diff -Nru keepass2-2.35+dfsg/debian/patches/use-installed-ico-files.patch keepass2-2.36+dfsg/debian/patches/use-installed-ico-files.patch --- keepass2-2.35+dfsg/debian/patches/use-installed-ico-files.patch 2017-05-21 15:50:24.000000000 +0000 +++ keepass2-2.36+dfsg/debian/patches/use-installed-ico-files.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,758 +0,0 @@ -From: Debian CLI Applications Team -Date: Sun, 10 Apr 2011 15:46:08 +0200 -Subject: use installed ico files - -use installed icons instead of pulling them from the ressource. -This avoids a UnknownImageFormat error probably caused by mono bug. - -Bugs-mono: https://bugzilla.novell.com/show_bug.cgi?id=599462 -Forwarded: not-needed ---- - KeePass/Forms/AboutForm.cs | 4 ++-- - KeePass/Forms/AutoTypeCtxForm.cs | 2 +- - KeePass/Forms/CharPickerForm.cs | 2 +- - KeePass/Forms/ColumnsForm.cs | 2 +- - KeePass/Forms/CsvImportForm.cs | 2 +- - KeePass/Forms/DataEditorForm.cs | 2 +- - KeePass/Forms/DataViewerForm.cs | 2 +- - KeePass/Forms/DatabaseOperationsForm.cs | 2 +- - KeePass/Forms/DatabaseSettingsForm.cs | 2 +- - KeePass/Forms/DuplicationForm.cs | 2 +- - KeePass/Forms/EcasActionForm.cs | 2 +- - KeePass/Forms/EcasConditionForm.cs | 2 +- - KeePass/Forms/EcasEventForm.cs | 2 +- - KeePass/Forms/EcasTriggerForm.cs | 2 +- - KeePass/Forms/EcasTriggersForm.cs | 2 +- - KeePass/Forms/EditAutoTypeItemForm.cs | 2 +- - KeePass/Forms/EditStringForm.cs | 2 +- - KeePass/Forms/EntropyForm.cs | 2 +- - KeePass/Forms/EntryListForm.cs | 2 +- - KeePass/Forms/EntryReportForm.cs | 2 +- - KeePass/Forms/ExchangeDataForm.cs | 2 +- - KeePass/Forms/FieldPickerForm.cs | 2 +- - KeePass/Forms/FieldRefForm.cs | 2 +- - KeePass/Forms/FileBrowserForm.cs | 2 +- - KeePass/Forms/GroupForm.cs | 2 +- - KeePass/Forms/HelpSourceForm.cs | 2 +- - KeePass/Forms/IOConnectionForm.cs | 2 +- - KeePass/Forms/IconPickerForm.cs | 2 +- - KeePass/Forms/ImportMethodForm.cs | 2 +- - KeePass/Forms/InternalBrowserForm.cs | 2 +- - KeePass/Forms/KeyCreationForm.cs | 2 +- - KeePass/Forms/KeyPromptForm.cs | 2 +- - KeePass/Forms/LanguageForm.cs | 2 +- - KeePass/Forms/MainForm.cs | 2 +- - KeePass/Forms/MainForm_Functions.cs | 16 ++++++++-------- - KeePass/Forms/OptionsForm.cs | 2 +- - KeePass/Forms/PluginsForm.cs | 2 +- - KeePass/Forms/PrintForm.cs | 2 +- - KeePass/Forms/ProxyForm.cs | 2 +- - KeePass/Forms/PwEntryForm.cs | 2 +- - KeePass/Forms/PwGeneratorForm.cs | 2 +- - KeePass/Forms/SearchForm.cs | 2 +- - KeePass/Forms/SingleLineEditForm.cs | 2 +- - KeePass/Forms/StatusLoggerForm.cs | 2 +- - KeePass/Forms/TanWizardForm.cs | 2 +- - KeePass/Forms/UpdateCheckForm.cs | 2 +- - KeePass/Forms/UrlOverrideForm.cs | 2 +- - KeePass/Forms/UrlOverridesForm.cs | 2 +- - KeePass/Forms/XmlReplaceForm.cs | 2 +- - 49 files changed, 57 insertions(+), 57 deletions(-) - -Index: keepass2/KeePass/Forms/AboutForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/AboutForm.cs -+++ keepass2/KeePass/Forms/AboutForm.cs -@@ -68,11 +68,11 @@ namespace KeePass.Forms - strDesc += ")"; - } - -- Icon icoNew = new Icon(Properties.Resources.KeePass, 48, 48); -+ Icon icoNew = new Icon(new Icon("/usr/share/keepass2/KeePass.ico"), 48, 48); - - BannerFactory.CreateBannerEx(this, m_bannerImage, icoNew.ToBitmap(), - strTitle, strDesc); -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - - m_lvComponents.Columns.Add(KPRes.Component, 100, HorizontalAlignment.Left); - m_lvComponents.Columns.Add(KPRes.Status + " / " + KPRes.Version, 100, -Index: keepass2/KeePass/Forms/AutoTypeCtxForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/AutoTypeCtxForm.cs -+++ keepass2/KeePass/Forms/AutoTypeCtxForm.cs -@@ -76,7 +76,7 @@ namespace KeePass.Forms - - m_lblText.Text = KPRes.AutoTypeEntrySelectionDescLong2; - this.Text = KPRes.AutoTypeEntrySelection; -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - - string strRect = Program.Config.UI.AutoTypeCtxRect; - if(strRect.Length > 0) UIUtil.SetWindowScreenRect(this, strRect); -Index: keepass2/KeePass/Forms/CharPickerForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/CharPickerForm.cs -+++ keepass2/KeePass/Forms/CharPickerForm.cs -@@ -135,7 +135,7 @@ namespace KeePass.Forms - - m_fontChars = FontUtil.CreateFont("Tahoma", 8.25f, FontStyle.Bold); - -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - this.Text = KPRes.PickCharacters + " - " + PwDefs.ShortProductName; - - m_secWord.Attach(m_tbSelected, OnSelectedTextChangedEx, true); -Index: keepass2/KeePass/Forms/ColumnsForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/ColumnsForm.cs -+++ keepass2/KeePass/Forms/ColumnsForm.cs -@@ -58,7 +58,7 @@ namespace KeePass.Forms - BannerFactory.CreateBannerEx(this, m_bannerImage, - Properties.Resources.B48x48_View_Detailed, - KPRes.ConfigureColumns, KPRes.ConfigureColumnsDesc); -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - this.Text = KPRes.ConfigureColumns; - - float fWidth = (float)(m_lvColumns.ClientRectangle.Width - -Index: keepass2/KeePass/Forms/CsvImportForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/CsvImportForm.cs -+++ keepass2/KeePass/Forms/CsvImportForm.cs -@@ -112,7 +112,7 @@ namespace KeePass.Forms - // Callable from KPScript without parent form - Debug.Assert(this.StartPosition == FormStartPosition.CenterScreen); - -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - this.Text = KPRes.GenericCsvImporter + " - " + PwDefs.ShortProductName; - - // FontUtil.AssignDefaultBold(m_grpSyntax); -Index: keepass2/KeePass/Forms/DataEditorForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/DataEditorForm.cs -+++ keepass2/KeePass/Forms/DataEditorForm.cs -@@ -95,7 +95,7 @@ namespace KeePass.Forms - - GlobalWindowManager.AddWindow(this); - -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - this.DoubleBuffered = true; - - string strRect = Program.Config.UI.DataEditorRect; -Index: keepass2/KeePass/Forms/DataViewerForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/DataViewerForm.cs -+++ keepass2/KeePass/Forms/DataViewerForm.cs -@@ -93,7 +93,7 @@ namespace KeePass.Forms - - GlobalWindowManager.AddWindow(this); - -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - - string strTitle = PwDefs.ShortProductName + " " + KPRes.DataViewer; - if(m_strDataDesc.Length > 0) -Index: keepass2/KeePass/Forms/DatabaseOperationsForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/DatabaseOperationsForm.cs -+++ keepass2/KeePass/Forms/DatabaseOperationsForm.cs -@@ -64,7 +64,7 @@ namespace KeePass.Forms - BannerFactory.CreateBannerEx(this, m_bannerImage, - Properties.Resources.B48x48_Package_Settings, KPRes.DatabaseMaintenance, - KPRes.DatabaseMaintenanceDesc); -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - this.Text = KPRes.DatabaseMaintenance; - - m_numHistoryDays.Value = m_pwDatabase.MaintenanceHistoryDays; -Index: keepass2/KeePass/Forms/DatabaseSettingsForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/DatabaseSettingsForm.cs -+++ keepass2/KeePass/Forms/DatabaseSettingsForm.cs -@@ -90,7 +90,7 @@ namespace KeePass.Forms - BannerFactory.CreateBannerEx(this, m_bannerImage, - Properties.Resources.B48x48_Ark, KPRes.DatabaseSettings, - KPRes.DatabaseSettingsDesc); -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - - FontUtil.AssignDefaultItalic(m_lblHeaderCpAlgo); - FontUtil.AssignDefaultItalic(m_lblHeaderCp); -Index: keepass2/KeePass/Forms/DuplicationForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/DuplicationForm.cs -+++ keepass2/KeePass/Forms/DuplicationForm.cs -@@ -100,7 +100,7 @@ namespace KeePass.Forms - { - GlobalWindowManager.AddWindow(this); - -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - - FontUtil.AssignDefaultBold(m_cbAppendCopy); - FontUtil.AssignDefaultBold(m_cbFieldRefs); -Index: keepass2/KeePass/Forms/EcasActionForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/EcasActionForm.cs -+++ keepass2/KeePass/Forms/EcasActionForm.cs -@@ -59,7 +59,7 @@ namespace KeePass.Forms - GlobalWindowManager.AddWindow(this); - - this.Text = KPRes.Action; -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - - m_lblParamHint.Text = KPRes.ParamDescHelp; - -Index: keepass2/KeePass/Forms/EcasConditionForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/EcasConditionForm.cs -+++ keepass2/KeePass/Forms/EcasConditionForm.cs -@@ -56,7 +56,7 @@ namespace KeePass.Forms - GlobalWindowManager.AddWindow(this); - - this.Text = KPRes.Condition; -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - - m_lblParamHint.Text = KPRes.ParamDescHelp; - -Index: keepass2/KeePass/Forms/EcasEventForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/EcasEventForm.cs -+++ keepass2/KeePass/Forms/EcasEventForm.cs -@@ -56,7 +56,7 @@ namespace KeePass.Forms - GlobalWindowManager.AddWindow(this); - - this.Text = KPRes.Event; -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - - m_lblParamHint.Text = KPRes.ParamDescHelp; - -Index: keepass2/KeePass/Forms/EcasTriggerForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/EcasTriggerForm.cs -+++ keepass2/KeePass/Forms/EcasTriggerForm.cs -@@ -67,7 +67,7 @@ namespace KeePass.Forms - BannerFactory.CreateBannerEx(this, m_bannerImage, - Properties.Resources.B48x48_Run, strTitle, strDesc); - this.Text = strTitle; -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - - m_lvEvents.SmallImageList = m_ilIcons; - m_lvConditions.SmallImageList = m_ilIcons; -Index: keepass2/KeePass/Forms/EcasTriggersForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/EcasTriggersForm.cs -+++ keepass2/KeePass/Forms/EcasTriggersForm.cs -@@ -82,7 +82,7 @@ namespace KeePass.Forms - Properties.Resources.B48x48_Make_KDevelop, KPRes.Triggers, - KPRes.TriggersDesc); - this.Text = KPRes.Triggers; -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - - int nWidth = (m_lvTriggers.ClientSize.Width - UIUtil.GetVScrollBarWidth() - 1); - m_lvTriggers.Columns.Add(KPRes.Triggers, nWidth); -Index: keepass2/KeePass/Forms/EditAutoTypeItemForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/EditAutoTypeItemForm.cs -+++ keepass2/KeePass/Forms/EditAutoTypeItemForm.cs -@@ -106,7 +106,7 @@ namespace KeePass.Forms - KPRes.ConfigureKeystrokeSeqDesc); - } - -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - - // FontUtil.AssignDefaultBold(m_lblTargetWindow); - // FontUtil.AssignDefaultBold(m_rbSeqDefault); -Index: keepass2/KeePass/Forms/EditStringForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/EditStringForm.cs -+++ keepass2/KeePass/Forms/EditStringForm.cs -@@ -97,7 +97,7 @@ namespace KeePass.Forms - - BannerFactory.CreateBannerEx(this, m_bannerImage, - Properties.Resources.B48x48_Font, strTitle, strDesc); -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - - UIUtil.EnableAutoCompletion(m_cmbStringName, true); - UIUtil.PrepareStandardMultilineControl(m_richStringValue, true, true); -Index: keepass2/KeePass/Forms/EntropyForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/EntropyForm.cs -+++ keepass2/KeePass/Forms/EntropyForm.cs -@@ -77,7 +77,7 @@ namespace KeePass.Forms - BannerFactory.CreateBannerEx(this, m_bannerImage, - Properties.Resources.B48x48_Binary, KPRes.EntropyTitle, - KPRes.EntropyDesc); -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - this.Text = KPRes.EntropyTitle; - - m_bmpRandom = CreateRandomBitmap(m_picRandom.ClientSize); -Index: keepass2/KeePass/Forms/EntryListForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/EntryListForm.cs -+++ keepass2/KeePass/Forms/EntryListForm.cs -@@ -87,7 +87,7 @@ namespace KeePass.Forms - m_imgIcon, m_strTitle, m_strDescShort); - m_lblText.Text = m_strDescLong; - this.Text = m_strTitle; -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - - if(m_ilIcons != null) m_lvEntries.SmallImageList = m_ilIcons; - else m_ilIcons = new ImageList(); -Index: keepass2/KeePass/Forms/EntryReportForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/EntryReportForm.cs -+++ keepass2/KeePass/Forms/EntryReportForm.cs -@@ -51,7 +51,7 @@ namespace KeePass.Forms - - private void OnFormLoad(object sender, EventArgs e) - { -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - - if(!string.IsNullOrEmpty(m_strTitle)) this.Text = m_strTitle; - else m_strTitle = PwDefs.ShortProductName; -Index: keepass2/KeePass/Forms/ExchangeDataForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/ExchangeDataForm.cs -+++ keepass2/KeePass/Forms/ExchangeDataForm.cs -@@ -100,7 +100,7 @@ namespace KeePass.Forms - Properties.Resources.B48x48_Folder_Download); - BannerFactory.CreateBannerEx(this, m_bannerImage, - bmpBanner, strWndTitle, strWndDesc); -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - - this.Text = strWndTitle; - -Index: keepass2/KeePass/Forms/FieldPickerForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/FieldPickerForm.cs -+++ keepass2/KeePass/Forms/FieldPickerForm.cs -@@ -93,7 +93,7 @@ namespace KeePass.Forms - if(strTitle.Length > 0) strTitleEx += " - "; - strTitleEx += PwDefs.ShortProductName; - -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - this.Text = strTitleEx; - - BannerFactory.CreateBannerEx(this, m_bannerImage, -Index: keepass2/KeePass/Forms/FieldRefForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/FieldRefForm.cs -+++ keepass2/KeePass/Forms/FieldRefForm.cs -@@ -71,7 +71,7 @@ namespace KeePass.Forms - - GlobalWindowManager.AddWindow(this); - -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - - UIUtil.SetExplorerTheme(m_lvEntries, true); - -Index: keepass2/KeePass/Forms/FileBrowserForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/FileBrowserForm.cs -+++ keepass2/KeePass/Forms/FileBrowserForm.cs -@@ -97,7 +97,7 @@ namespace KeePass.Forms - { - GlobalWindowManager.AddWindow(this); - -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - this.Text = m_strTitle; - - m_nIconDim = m_tvFolders.ItemHeight; -Index: keepass2/KeePass/Forms/GroupForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/GroupForm.cs -+++ keepass2/KeePass/Forms/GroupForm.cs -@@ -80,7 +80,7 @@ namespace KeePass.Forms - BannerFactory.CreateBannerEx(this, m_bannerImage, - Properties.Resources.B48x48_Folder_Txt, strTitle, - (m_bCreatingNew ? KPRes.AddGroupDesc : KPRes.EditGroupDesc)); -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - this.Text = strTitle; - - UIUtil.SetButtonImage(m_btnAutoTypeEdit, -Index: keepass2/KeePass/Forms/HelpSourceForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/HelpSourceForm.cs -+++ keepass2/KeePass/Forms/HelpSourceForm.cs -@@ -47,7 +47,7 @@ namespace KeePass.Forms - BannerFactory.CreateBannerEx(this, m_bannerImage, - Properties.Resources.B48x48_Folder_Download, KPRes.HelpSourceSelection, - KPRes.HelpSourceSelectionDesc); -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - this.Text = KPRes.HelpSourceSelection; - - FontUtil.AssignDefaultBold(m_radioLocal); -Index: keepass2/KeePass/Forms/IOConnectionForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/IOConnectionForm.cs -+++ keepass2/KeePass/Forms/IOConnectionForm.cs -@@ -85,7 +85,7 @@ namespace KeePass.Forms - - BannerFactory.CreateBannerEx(this, m_bannerImage, - KeePass.Properties.Resources.B48x48_WWW, strTitle, strDesc); -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - this.Text = strTitle; - - FontUtil.AssignDefaultBold(m_lblUrl); -Index: keepass2/KeePass/Forms/IconPickerForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/IconPickerForm.cs -+++ keepass2/KeePass/Forms/IconPickerForm.cs -@@ -80,7 +80,7 @@ namespace KeePass.Forms - - GlobalWindowManager.AddWindow(this); - -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - - FontUtil.AssignDefaultBold(m_radioStandard); - FontUtil.AssignDefaultBold(m_radioCustom); -Index: keepass2/KeePass/Forms/ImportMethodForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/ImportMethodForm.cs -+++ keepass2/KeePass/Forms/ImportMethodForm.cs -@@ -56,7 +56,7 @@ namespace KeePass.Forms - BannerFactory.CreateBannerEx(this, m_bannerImage, - Properties.Resources.B48x48_Folder_Download, KPRes.ImportBehavior, - KPRes.ImportBehaviorDesc); -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - - this.Text = KPRes.ImportBehavior; - -Index: keepass2/KeePass/Forms/InternalBrowserForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/InternalBrowserForm.cs -+++ keepass2/KeePass/Forms/InternalBrowserForm.cs -@@ -53,7 +53,7 @@ namespace KeePass.Forms - { - GlobalWindowManager.AddWindow(this); - -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - - if(m_strInitialUrl.Length > 0) - m_webBrowser.Navigate(m_strInitialUrl); -Index: keepass2/KeePass/Forms/KeyCreationForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/KeyCreationForm.cs -+++ keepass2/KeePass/Forms/KeyCreationForm.cs -@@ -82,7 +82,7 @@ namespace KeePass.Forms - BannerFactory.CreateBannerEx(this, m_bannerImage, - Properties.Resources.B48x48_KGPG_Sign, KPRes.CreateMasterKey, - m_ioInfo.GetDisplayName()); -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - this.Text = KPRes.CreateMasterKey; - - FontUtil.SetDefaultFont(m_cbPassword); -Index: keepass2/KeePass/Forms/KeyPromptForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/KeyPromptForm.cs -+++ keepass2/KeePass/Forms/KeyPromptForm.cs -@@ -121,7 +121,7 @@ namespace KeePass.Forms - string strBannerDesc = WinUtil.CompactPath(m_ioInfo.Path, 45); - BannerFactory.CreateBannerEx(this, m_bannerImage, - Properties.Resources.B48x48_KGPG_Key2, strBannerTitle, strBannerDesc); -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - - FontUtil.SetDefaultFont(m_cbPassword); - FontUtil.AssignDefaultBold(m_cbPassword); -Index: keepass2/KeePass/Forms/LanguageForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/LanguageForm.cs -+++ keepass2/KeePass/Forms/LanguageForm.cs -@@ -58,7 +58,7 @@ namespace KeePass.Forms - BannerFactory.CreateBannerEx(this, m_bannerImage, - Properties.Resources.B48x48_Keyboard_Layout, - KPRes.SelectLanguage, KPRes.SelectLanguageDesc); -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - this.Text = KPRes.SelectLanguage; - - List lImg = new List(); -Index: keepass2/KeePass/Forms/MainForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/MainForm.cs -+++ keepass2/KeePass/Forms/MainForm.cs -@@ -141,7 +141,7 @@ namespace KeePass.Forms - m_strNeverExpiresText = KPRes.NeverExpires; - - this.Text = PwDefs.ShortProductName; -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - m_imgFileSaveEnabled = Properties.Resources.B16x16_FileSave; - m_imgFileSaveDisabled = Properties.Resources.B16x16_FileSave_Disabled; - // m_imgFileSaveAllEnabled = Properties.Resources.B16x16_File_SaveAll; -Index: keepass2/KeePass/Forms/MainForm_Functions.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/MainForm_Functions.cs -+++ keepass2/KeePass/Forms/MainForm_Functions.cs -@@ -438,18 +438,18 @@ namespace KeePass.Forms - strNtfText = strNtfPre + strFileDesc; - - Icon icoDisposable, icoAssignable; -- CreateColorizedIcon(Properties.Resources.QuadLocked, qSmall, -+ CreateColorizedIcon(new Icon("/usr/share/keepass2/QuadLocked.ico"), qSmall, - ref m_kvpIcoTrayLocked, out icoAssignable, out icoDisposable); - m_ntfTray.Icon = icoAssignable; - if(icoDisposable != null) icoDisposable.Dispose(); - -- TaskbarList.SetOverlayIcon(this, Properties.Resources.LockOverlay, -+ TaskbarList.SetOverlayIcon(this, new Icon("/usr/share/keepass2/LockOverlay.ico"), - KPRes.Locked); - } - else if(s.DatabaseOpened == false) - { - Icon icoDisposable, icoAssignable; -- CreateColorizedIcon(Properties.Resources.QuadNormal, qSmall, -+ CreateColorizedIcon(new Icon("/usr/share/keepass2/QuadNormal.ico"), qSmall, - ref m_kvpIcoTrayNormal, out icoAssignable, out icoDisposable); - m_ntfTray.Icon = icoAssignable; - if(icoDisposable != null) icoDisposable.Dispose(); -@@ -472,7 +472,7 @@ namespace KeePass.Forms - m_docMgr.ActiveDatabase.IOConnectionInfo.Path, 63 - strNtfPre.Length); - - Icon icoDisposable, icoAssignable; -- CreateColorizedIcon(Properties.Resources.QuadNormal, qSmall, -+ CreateColorizedIcon(new Icon("/usr/share/keepass2/QuadNormal.ico"), qSmall, - ref m_kvpIcoTrayNormal, out icoAssignable, out icoDisposable); - m_ntfTray.Icon = icoAssignable; - if(icoDisposable != null) icoDisposable.Dispose(); -@@ -497,7 +497,7 @@ namespace KeePass.Forms - m_ntfTray.Text = StrUtil.CompactString3Dots(strNtfText, 63); - - Icon icoToDispose, icoToAssign; -- if(CreateColorizedIcon(Properties.Resources.KeePass, 0, -+ if(CreateColorizedIcon(new Icon("/usr/share/keepass2/KeePass.ico"), 0, - ref m_kvpIcoMain, out icoToAssign, out icoToDispose)) - this.Icon = icoToAssign; - if(icoToDispose != null) icoToDispose.Dispose(); -@@ -2771,12 +2771,12 @@ namespace KeePass.Forms - } - else if(m.Msg == DwmUtil.WM_DWMSENDICONICTHUMBNAIL) - { -- DwmUtil.SetIconicThumbnail(this, Properties.Resources.KeePass, ref m); -+ DwmUtil.SetIconicThumbnail(this, new Icon("/usr/share/keepass2/KeePass.ico"), ref m); - return; - } - else if(m.Msg == DwmUtil.WM_DWMSENDICONICLIVEPREVIEWBITMAP) - { -- DwmUtil.SetIconicPreview(this, Properties.Resources.KeePass, ref m); -+ DwmUtil.SetIconicPreview(this, new Icon("/usr/share/keepass2/KeePass.ico"), ref m); - return; - } - -@@ -3900,7 +3900,7 @@ namespace KeePass.Forms - // wasn't fully constructed at that time yet) - // if(IsFileLocked(null)) - // TaskbarList.SetOverlayIcon(this, -- // Properties.Resources.LockOverlay, KPRes.Locked); -+ // new Icon("/usr/share/keepass2/LockOverlay.ico"), KPRes.Locked); - } - - if(Program.Config.MainWindow.MinimizeToTray) MinimizeToTray(true); -Index: keepass2/KeePass/Forms/OptionsForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/OptionsForm.cs -+++ keepass2/KeePass/Forms/OptionsForm.cs -@@ -121,7 +121,7 @@ namespace KeePass.Forms - - GlobalWindowManager.AddWindow(this); - -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - - Debug.Assert(m_ilIcons != null); - if(m_ilIcons != null) -Index: keepass2/KeePass/Forms/PluginsForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/PluginsForm.cs -+++ keepass2/KeePass/Forms/PluginsForm.cs -@@ -64,7 +64,7 @@ namespace KeePass.Forms - BannerFactory.CreateBannerEx(this, m_bannerImage, - Properties.Resources.B48x48_BlockDevice, KPRes.Plugins, - KPRes.PluginsDesc); -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - - m_cbCacheDeleteOld.Checked = Program.Config.Application.Start.PluginCacheDeleteOld; - -Index: keepass2/KeePass/Forms/PrintForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/PrintForm.cs -+++ keepass2/KeePass/Forms/PrintForm.cs -@@ -100,7 +100,7 @@ namespace KeePass.Forms - - GlobalWindowManager.AddWindow(this); - -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - CreateDialogBanner(); - - List lTabImg = new List(); -Index: keepass2/KeePass/Forms/ProxyForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/ProxyForm.cs -+++ keepass2/KeePass/Forms/ProxyForm.cs -@@ -44,7 +44,7 @@ namespace KeePass.Forms - { - GlobalWindowManager.AddWindow(this); - -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - - ProxyServerType pst = Program.Config.Integration.ProxyType; - if(pst == ProxyServerType.None) m_rbNoProxy.Checked = true; -Index: keepass2/KeePass/Forms/PwEntryForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/PwEntryForm.cs -+++ keepass2/KeePass/Forms/PwEntryForm.cs -@@ -662,7 +662,7 @@ namespace KeePass.Forms - - BannerFactory.CreateBannerEx(this, m_bannerImage, - KeePass.Properties.Resources.B48x48_KGPG_Sign, strTitle, strDesc); -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - this.Text = strTitle; - - m_imgGenPw = UIUtil.CreateDropDownImage(Properties.Resources.B16x16_Key_New); -Index: keepass2/KeePass/Forms/PwGeneratorForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/PwGeneratorForm.cs -+++ keepass2/KeePass/Forms/PwGeneratorForm.cs -@@ -98,7 +98,7 @@ namespace KeePass.Forms - BannerFactory.CreateBannerEx(this, m_bannerImage, - Properties.Resources.B48x48_KGPG_Gen, KPRes.PasswordOptions, - KPRes.PasswordOptionsDesc); -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - - UIUtil.SetButtonImage(m_btnProfileAdd, - Properties.Resources.B16x16_FileSaveAs, false); -Index: keepass2/KeePass/Forms/SearchForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/SearchForm.cs -+++ keepass2/KeePass/Forms/SearchForm.cs -@@ -92,7 +92,7 @@ namespace KeePass.Forms - - BannerFactory.CreateBannerEx(this, m_bannerImage, - Properties.Resources.B48x48_XMag, strTitle, KPRes.SearchDesc); -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - - m_cbDerefData.Text = m_cbDerefData.Text + " (" + KPRes.Slow + ")"; - -Index: keepass2/KeePass/Forms/SingleLineEditForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/SingleLineEditForm.cs -+++ keepass2/KeePass/Forms/SingleLineEditForm.cs -@@ -73,7 +73,7 @@ namespace KeePass.Forms - - BannerFactory.CreateBannerEx(this, m_bannerImage, - m_imgIcon, m_strTitle, m_strDesc); -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - - this.Text = m_strTitle; - m_lblLongDesc.Text = m_strLongDesc; -Index: keepass2/KeePass/Forms/StatusLoggerForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/StatusLoggerForm.cs -+++ keepass2/KeePass/Forms/StatusLoggerForm.cs -@@ -127,7 +127,7 @@ namespace KeePass.Forms - { - GlobalWindowManager.AddWindow(this); - -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - this.Text = PwDefs.ShortProductName; - - m_pbProgress.Minimum = 0; -Index: keepass2/KeePass/Forms/TanWizardForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/TanWizardForm.cs -+++ keepass2/KeePass/Forms/TanWizardForm.cs -@@ -61,7 +61,7 @@ namespace KeePass.Forms - KeePass.Properties.Resources.B48x48_Wizard, KPRes.TanWizard, - KPRes.TanWizardDesc); - -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - this.Text = KPRes.TanWizard; - - if((m_pgStorage.Name != null) && (m_pgStorage.Name.Length > 0)) -Index: keepass2/KeePass/Forms/UpdateCheckForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/UpdateCheckForm.cs -+++ keepass2/KeePass/Forms/UpdateCheckForm.cs -@@ -64,7 +64,7 @@ namespace KeePass.Forms - BannerFactory.CreateBannerEx(this, m_bannerImage, - Properties.Resources.B48x48_WWW, KPRes.UpdateCheck, - KPRes.UpdateCheckResults); -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - this.Text = KPRes.UpdateCheck + " - " + PwDefs.ShortProductName; - - UIUtil.SetExplorerTheme(m_lvInfo, true); -Index: keepass2/KeePass/Forms/UrlOverrideForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/UrlOverrideForm.cs -+++ keepass2/KeePass/Forms/UrlOverrideForm.cs -@@ -51,7 +51,7 @@ namespace KeePass.Forms - - GlobalWindowManager.AddWindow(this); - -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - this.Text = KPRes.UrlOverride; - - m_tbScheme.Text = m_ovr.Scheme; -Index: keepass2/KeePass/Forms/UrlOverridesForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/UrlOverridesForm.cs -+++ keepass2/KeePass/Forms/UrlOverridesForm.cs -@@ -66,7 +66,7 @@ namespace KeePass.Forms - - GlobalWindowManager.AddWindow(this); - -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - this.Text = KPRes.UrlOverrides; - - UIUtil.SetExplorerTheme(m_lvOverrides, false); -Index: keepass2/KeePass/Forms/XmlReplaceForm.cs -=================================================================== ---- keepass2.orig/KeePass/Forms/XmlReplaceForm.cs -+++ keepass2/KeePass/Forms/XmlReplaceForm.cs -@@ -62,7 +62,7 @@ namespace KeePass.Forms - KeePass.Properties.Resources.B48x48_Binary, KPRes.XmlReplace, - KPRes.XmlReplaceDesc); - -- this.Icon = Properties.Resources.KeePass; -+ this.Icon = new Icon("/usr/share/keepass2/KeePass.ico"); - this.Text = KPRes.XmlReplace; - - Bitmap bmpBig = SystemIcons.Warning.ToBitmap(); diff -Nru keepass2-2.35+dfsg/debian/rules keepass2-2.36+dfsg/debian/rules --- keepass2-2.35+dfsg/debian/rules 2017-05-21 15:50:24.000000000 +0000 +++ keepass2-2.36+dfsg/debian/rules 2017-06-26 15:07:54.000000000 +0000 @@ -36,9 +36,11 @@ python -c 'import archmod.CHM; archmod.CHM.CHMDir("Docs").process_templates("Docs/Chm")' override_dh_install: - convert $(CURDIR)/KeePass/Resources/Images/KeePass.ico keepass2.png + convert $(CURDIR)/KeePass/Resources/Icons/KeePass.ico keepass2.png mkdir -p $(CURDIR)/debian/keepass2/usr/share/icons/hicolor/16x16/apps - mv keepass2-9.png $(CURDIR)/debian/keepass2/usr/share/icons/hicolor/16x16/apps/keepass2.png + mv keepass2-11.png $(CURDIR)/debian/keepass2/usr/share/icons/hicolor/16x16/apps/keepass2.png + mkdir -p $(CURDIR)/debian/keepass2/usr/share/icons/hicolor/24x24/apps + mv keepass2-9.png $(CURDIR)/debian/keepass2/usr/share/icons/hicolor/24x24/apps/keepass2.png mkdir -p $(CURDIR)/debian/keepass2/usr/share/icons/hicolor/32x32/apps mv keepass2-8.png $(CURDIR)/debian/keepass2/usr/share/icons/hicolor/32x32/apps/keepass2.png mkdir -p $(CURDIR)/debian/keepass2/usr/share/icons/hicolor/48x48/apps diff -Nru keepass2-2.35+dfsg/Docs/Chm/default.css keepass2-2.36+dfsg/Docs/Chm/default.css --- keepass2-2.35+dfsg/Docs/Chm/default.css 2017-01-09 10:10:12.000000000 +0000 +++ keepass2-2.36+dfsg/Docs/Chm/default.css 2017-06-09 08:39:18.000000000 +0000 @@ -13,7 +13,7 @@ body { background-color: #FFFFFF; - background-image: url(./images/back.gif); + background-image: url('./images/back.gif'); background-repeat: repeat; background-attachment: fixed; } @@ -122,7 +122,7 @@ div.menubox div.menutitle { background-color: #C5C5C5; - background: url(./images/grad_h_gw.gif) repeat-y; + background: url('./images/grad_h_gw.gif') repeat-y; display: block; font-weight: bold; font-size: 7.50pt; @@ -134,7 +134,7 @@ div.menubox div.menutitlewide { background-color: #C5C5C5; - background: url(./images/grad_h_gw_186.gif) repeat-y; + background: url('./images/grad_h_gw_186.gif') repeat-y; display: block; font-weight: bold; font-size: 7.50pt; @@ -194,7 +194,7 @@ table.tablebox tr th, table.tablebox75 tr th { background-color: #EEEEEE; - background: url(./images/grad_v_gw.gif) repeat-x top; + background: url('./images/grad_v_gw.gif') repeat-x top; font-weight: bold; border-bottom: 1px solid #AFB5CF; border-left: 0px none; @@ -326,7 +326,7 @@ font-size: 9.75pt; font-weight: bold; color: #000000; - background: url(./images/grad_v_dlb_tall_light.png) repeat-x top; + background: url('./images/grad_v_dlb_tall_light.png') repeat-x top; border: 1px solid #AFB5CF; color: #005101; min-height: 14.25pt; @@ -338,7 +338,7 @@ /* --------------------------------------------------------------------- */ td.helptopheader { - background-image: url(./help/images/b32x68_headerbg.png); + background-image: url('./help/images/b32x68_headerbg.png'); background-repeat: repeat-x; } diff -Nru keepass2-2.35+dfsg/Docs/Chm/help/base/autotype.html keepass2-2.36+dfsg/Docs/Chm/help/base/autotype.html --- keepass2-2.35+dfsg/Docs/Chm/help/base/autotype.html 2017-01-09 10:10:12.000000000 +0000 +++ keepass2-2.36+dfsg/Docs/Chm/help/base/autotype.html 2017-06-09 08:39:18.000000000 +0000 @@ -127,6 +127,13 @@ is running with administrative rights, KeePass must be running with administrative rights, too.

+

Remote Desktops and Virtual Machines:
+KeePass does not know the keyboard layout that has been selected in +a remote desktop or virtual machine window. +If you want to auto-type into such a window, you must ensure +that the local and the remote/virtual system are using the same +keyboard layout.

+
@@ -336,7 +343,7 @@ {CLEARFIELD}Clears the contents of the edit control that currently has the focus (only single-line edit controls). {VKEY X}Sends the -virtual key of value X. {APPACTIVATE WindowTitle}Activates the window "WindowTitle". diff -Nru keepass2-2.35+dfsg/Docs/Chm/help/base/credits.html keepass2-2.36+dfsg/Docs/Chm/help/base/credits.html --- keepass2-2.35+dfsg/Docs/Chm/help/base/credits.html 2017-01-09 10:10:12.000000000 +0000 +++ keepass2-2.36+dfsg/Docs/Chm/help/base/credits.html 2017-06-09 08:39:18.000000000 +0000 @@ -118,7 +118,8 @@ target="_blank">BCMenu). Davide Calabro -MFC class for buttons with icons ( +MFC class for buttons with icons (CButtonST). Zorglab, Chris Maunder, Alexander Bischofberger, James White, Descartes Systems Sciences Inc. @@ -134,7 +135,8 @@ target="_blank">CKCSideBannerWnd). Chris Maunder -MFC class for system tray icons ( +MFC class for system tray icons (CSystemTray). Hans Dietrich, Chris Maunder diff -Nru keepass2-2.35+dfsg/Docs/Chm/help/base/disclaimer.html keepass2-2.36+dfsg/Docs/Chm/help/base/disclaimer.html --- keepass2-2.35+dfsg/Docs/Chm/help/base/disclaimer.html 2017-01-09 10:10:12.000000000 +0000 +++ keepass2-2.36+dfsg/Docs/Chm/help/base/disclaimer.html 2017-06-09 08:39:18.000000000 +0000 @@ -102,7 +102,8 @@ in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by Google, click -here.

+ +here.

We use cookies to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use @@ -112,7 +113,7 @@

Details:

    -
  • Google: Google: How Google uses data when you use our partners' sites or apps.
  • Flattr: Flattr Privacy Policy.
  • @@ -224,7 +225,8 @@ können, die Sie interessieren. Falls Sie mehr über diese Methoden erfahren möchten oder wissen möchten, welche Möglichkeiten Sie haben, damit diese Informationen nicht von Google verwendet werden können, klicken Sie -hier.

    + +hier.

    Wir verwenden Cookies, um Inhalte und Anzeigen zu personalisieren, Funktionen für soziale Medien anbieten zu können und die Zugriffe @@ -237,7 +239,7 @@

    Details:

    @@ -428,11 +428,13 @@ -Only Rijndael (AES) is supported, but KeePass supports additional algorithms -through encryption plugins. You can find encryption plugins on the -plugins page.
    +AES (Rijndael) and ChaCha20 are supported. +There exist various +plugins +that provide support for additional encryption algorithms, +including but not limited to Twofish, Serpent and GOST.

    -If you'd like to implement an algorithm, have a look at the ArcFourCipher sample plugin. +If you'd like to implement an algorithm, have a look at the ArcFourCipher sample plugin.

    @@ -457,12 +459,13 @@ what to do (the workstation is locked already and no window can't be displayed), consequently KeePass must make an automatic decision. There are several possibilities:

    -
      -
    • Do not save the database and lock.
      +
        +
      • Do not save the database and lock.
        In this case, all unsaved data of the database would be lost. This not only applies to the data entered in the current dialog, but to all other entries that have been modified previously.
      • -
      • Save the database and lock.
        + +
      • Save the database and lock.
        In this case, possibly unwanted changes are saved. Often you open files, try something, having in mind that you can just close the file without saving the changes. KeePass has an option 'Automatically save database when KeePass closes or the workspace @@ -470,7 +473,8 @@ try to save the database and if successful: lock the workspace. But what to do with the unsaved changes in the sub-dialog? Should it be saved automatically, taking away the possibility of pressing the 'Cancel' button?
      • -
      • Save to a temporary location and lock.
        + +
      • Save to a temporary location and lock.
        While this sounds the best alternative at first glance, there are several problems with it, too. First of all, saving to a temporary location could fail (for example there could be too few disk space or some other program like virus scanner could have blocked it). @@ -497,7 +501,7 @@

        Security consequence: the database is left open when Windows locks. Normally, you are the only one who can log back in to Windows. When someone else logs in (like administrator), he can't use your programs anyway. By default, KeePass keeps -in-memory passwords encrypted, therefore it does not matter if Windows caches the process +in-memory passwords encrypted, therefore it does not matter if Windows dumps the process to disk at some time. So, your passwords are pretty safe anyway.

        Note. On Windows ≤ XP, the 'Terminal Services' @@ -530,20 +534,20 @@ diff -Nru keepass2-2.35+dfsg/Docs/Chm/help/base/keys.html keepass2-2.36+dfsg/Docs/Chm/help/base/keys.html --- keepass2-2.35+dfsg/Docs/Chm/help/base/keys.html 2017-01-09 10:10:12.000000000 +0000 +++ keepass2-2.36+dfsg/Docs/Chm/help/base/keys.html 2017-06-09 08:39:18.000000000 +0000 @@ -173,7 +173,7 @@ Recover Windows User Account Credentials (a short technical tutorial can be found in a Microsoft TechNet article: -How to recover a Vault corrupted by lost DPAPI keys).

        You can change the password of the Windows user account freely; @@ -191,7 +191,7 @@ from a domain controller, or a home user can use a previously created Password Reset Disk). Details can be found in the MSDN article -Windows Data Protection and in the support article How to troubleshoot the Data Protection API (DPAPI).
        @@ -223,17 +223,23 @@ -The contents of the MinimumLength node in -Security/MasterPassword can contain -the minimum master password length in characters. For example, by setting -the contents to 10, KeePass will only accept -master passwords that have at least 10 characters.
        -
        -The contents of the MinimumQuality node in -Security/MasterPassword can contain -the minimum estimated quality in bits that master passwords must have. For example, -by setting the contents to 32, only master passwords -with an estimated quality of at least 32 bits will be accepted.
        +The value of the +Security/MasterPassword/MinimumLength node specifies +the minimum master password length (in characters). For example, by setting +it to 10, KeePass will only accept +master passwords that consist of at least 10 characters.
        +
        +The value of the +Security/MasterPassword/MinimumQuality node specifies +the minimum estimated quality (in bits) that master passwords must have. +For example, by setting it to 80, only master passwords +with an estimated quality of at least 80 bits will be accepted.
        +
        +The Security/MasterKeyExpiryRec node can be set to an +XSD date. +If the master key has not been changed since the specified date, +KeePass recommends to change it.

        By specifying KeyCreationFlags and/or KeyPromptFlags (in the UI node), you can force states (enabled, disabled, diff -Nru keepass2-2.35+dfsg/Docs/Chm/help/base/placeholders.html keepass2-2.36+dfsg/Docs/Chm/help/base/placeholders.html --- keepass2-2.35+dfsg/Docs/Chm/help/base/placeholders.html 2017-01-09 10:10:12.000000000 +0000 +++ keepass2-2.36+dfsg/Docs/Chm/help/base/placeholders.html 2017-06-09 08:39:18.000000000 +0000 @@ -277,7 +277,12 @@

      • Upper or U:
        Upper-case.
      • Lower or L:
        -Lower-case.
      • +Lower-case.
        +Example. +Let the user name of an entry be 'Bob' and +the URL 'http://myprovider.net/?user={T-CONV:/{USERNAME}/L/}'. +When running the URL, KeePass opens +'http://myprovider.net/?user=bob'.
      • Base64:
        The Base64 encoding of the UTF-8 representation of the text.
      • Hex:
        @@ -286,12 +291,19 @@ The URI-escaped representation of the text.
      • Uri-Dec:
        The URI-unescaped representation of the text.
      • +
      • Raw:
        +Spr-compiles Text without encoding the result for the current context.
        +Example. +Let the user name of an entry be '+'. +The auto-type sequence '{USERNAME}a' results in the text +'+a', whereas the auto-type sequence +'{T-CONV:/{USERNAME}/Raw/}a' results in the text +'A' +(because this placeholder inserts '+' into the auto-type +sequence without encoding it, and +'+a' means to press Shift+A, +which results in the text 'A').
      -Usage example. -Let the user name field contain 'Bob' and -the URL field 'http://myprovider.net/?user={T-CONV:/{USERNAME}/L/}'. -When running the URL field, KeePass opens -'http://myprovider.net/?user=bob'.

      @@ -331,6 +343,8 @@ each of these placeholders is replaced by the specified part of the string that is being overridden. See below. +{CMD:/CommandLine/Options/} +Runs a command line. See below. @@ -416,7 +430,7 @@ KeePass shows the character picking dialog once and reuses the picked characters in all following placeholders with the same ID.

      -Usage examples:
      +Usage examples:

      {USERNAME}{TAB}{PICKCHARS:Password:C=5}{ENTER}
      First a dialog is shown in which the user can pick exactly 5 characters @@ -515,7 +529,7 @@ HmacOtp-Secret-Base64 (secret as Base64 string). The counter is stored in decimal form in the HmacOtp-Counter field.

      -Usage example. +Usage example. Create a new entry, set its password to the {HMACOTP} placeholder, switch to the 'Advanced' tab, add a string named HmacOtp-Secret with value 12345678901234567890, @@ -542,7 +556,7 @@ global URL override (defined in 'Tools' -> 'Options' -> tab 'Integration' -> button 'URL Overrides'), because there no entry context may be available.

      -Example. For the entry URL +Usage example. For the entry URL http://user:pw@keepass.info:80/path/example.php?q=e&s=t, the placeholders return the following values:

      @@ -573,5 +587,99 @@ {BASE} supports exactly the same parts as {URL}. +

      + + + +{CMD:/CommandLine/Options/} – Running a command line:
      +The {CMD:/CommandLine/Options/} placeholder +runs the specified command line.
      +
      +A command line consists of a path to an executable file or a document +and command line parameters. +If the path contains spaces, it must be enclosed in quotes (").
      +
      +The character after the first ':' specifies the separator +character. It can be chosen freely (except '{' and '}'), +but it must not occur in the command line or any of the options. +For example, {CMD:/Notepad.exe/W=0/} and +{CMD:!Notepad.exe!W=0!} are equivalent. +The separator character at the end (before the '}') is mandatory.
      +
      +An option is a key-value pair, separated by '='. +Multiple options must be separated using commas ','.
      +
      +Options: +
        +
      • M: +Specifies the method for running/opening the executable/document.
        +The default value is S. +
          +
        • S: +Use the system shell (via ShellExecute). +With this, executable files are executed and documents are opened +using their associated applications. +However, no standard input/output is supported.
        • +
        • C: +Run an executable file (EXE or COM, via CreateProcess); +documents are not supported. +Standard input/output is supported.
        • +
        +
      • + +
      • O: +Specifies what to do with the standard output of the executed application.
        +The default value is 1. +
          +
        • 0: +Ignore the standard output. The placeholder is replaced by an empty string.
        • +
        • 1: +Replace the placeholder by the standard output.
        • +
        +
      • + +
      • W: +Specifies whether to wait for the termination of the executed application.
        +The default value is 1. +
          +
        • 0: +Do not wait.
        • +
        • 1: +Wait.
        • +
        +
      • + +
      • WS: +Specifies the window style. Not all applications support this option.
        +The default value is N. +
          +
        • N: +Normal.
        • +
        • H: +Hidden.
        • +
        • Min: +Minimized.
        • +
        • Max: +Maximized.
        • +
        +
      • + +
      • V: +Specifies the verb (action to be performed), +e.g. 'Open' or 'Print'. +When using the verb 'RunAs', the application is executed with administrative +rights (this may require a confirmation via the UAC dialog).
      • +
      + +Usage examples: +
        +
      • {CMD:/Notepad.exe/W=0/}
        +Runs Notepad and continues immediately.
      • +
      • {CMD:/PowerShell.exe -Command "(Get-FileHash '%SYSTEMROOT%\Win.ini' +-Algorithm SHA256).Hash"/M=C,WS=H/}
        +The placeholder is replaced by the SHA-256 hash of Windows' Win.ini file.
      • +
      + + diff -Nru keepass2-2.35+dfsg/Docs/Chm/help/base/security.html keepass2-2.36+dfsg/Docs/Chm/help/base/security.html --- keepass2-2.35+dfsg/Docs/Chm/help/base/security.html 2017-01-09 10:10:12.000000000 +0000 +++ keepass2-2.36+dfsg/Docs/Chm/help/base/security.html 2017-06-09 08:39:18.000000000 +0000 @@ -265,8 +265,8 @@ This means that even if you would dump the KeePass process memory to disk, you could not find any sensitive data.

      - @@ -277,20 +277,20 @@

      Furthermore, KeePass erases all security-critical memory when it is not needed anymore, i.e. it overwrites these memory areas before releasing them.

      -

      KeePass uses the Windows DPAPI for in-memory encrypting sensitive data +

      KeePass uses the Windows DPAPI for encrypting sensitive data in memory (via CryptProtectMemory / ProtectedMemory). -With DPAPI, the key for in-memory encryption is stored in a +With DPAPI, the key for the memory encryption is stored in a secure, non-swappable memory area managed by Windows. DPAPI is available on Windows 2000 and higher. KeePass 2.x always uses DPAPI when it is available; in KeePass 1.x, this can be disabled (in the advanced options; by default -using DPAPI is enabled; if it is disabled, KeePass uses the ARC4 encryption +using DPAPI is enabled; if it is disabled, KeePass 1.x uses the ARC4 encryption algorithm with a random key; note that this is less secure than DPAPI, mainly not -because ARC4 cryptographically is not that strong, but because the key for in-memory -encryption is also stored in swappable process memory; +because ARC4 cryptographically is not that strong, but because the key for +the memory encryption is also stored in swappable process memory; similarly, KeePass 2.x falls back to encrypting the process memory using ChaCha20, if DPAPI is unavailable). On Unix-like systems, KeePass 2.x uses ChaCha20, because Mono does not provide diff -Nru keepass2-2.35+dfsg/Docs/Chm/help/v2/setup.html keepass2-2.36+dfsg/Docs/Chm/help/v2/setup.html --- keepass2-2.35+dfsg/Docs/Chm/help/v2/setup.html 2017-01-09 10:10:12.000000000 +0000 +++ keepass2-2.36+dfsg/Docs/Chm/help/v2/setup.html 2017-06-09 08:39:18.000000000 +0000 @@ -217,7 +217,12 @@

    • OpenSUSE Linux:
      Install the keepass package -(from the Mono community repository; link on the downloads page).
      +(from the OpenSUSE Mono repository; link on the downloads page).
      +
    • + +
    • Gentoo Linux:
      +Install the keepass package +(from the Gentoo Linux repository; link on the downloads page).

    • Arch Linux:
      @@ -271,8 +276,8 @@

      Clipboard:
      On some systems, Mono's clipboard routines don't work properly. -In this case, install the xsel package. If xsel -is installed, KeePass uses this utility for clipboard operations.

      +In this case, install the xsel and xdotool packages. +If these are installed, KeePass uses them for clipboard operations.

      Global Auto-Type:
      In order to use global auto-type, diff -Nru keepass2-2.35+dfsg/Docs/Chm/help/v2/xml_replace.html keepass2-2.36+dfsg/Docs/Chm/help/v2/xml_replace.html --- keepass2-2.35+dfsg/Docs/Chm/help/v2/xml_replace.html 2017-01-09 10:10:12.000000000 +0000 +++ keepass2-2.36+dfsg/Docs/Chm/help/v2/xml_replace.html 2017-06-09 08:39:18.000000000 +0000 @@ -94,16 +94,16 @@

      diff -Nru keepass2-2.35+dfsg/Docs/Chm/help/v2_dev/customize.html keepass2-2.36+dfsg/Docs/Chm/help/v2_dev/customize.html --- keepass2-2.35+dfsg/Docs/Chm/help/v2_dev/customize.html 2017-01-09 10:10:12.000000000 +0000 +++ keepass2-2.36+dfsg/Docs/Chm/help/v2_dev/customize.html 2017-06-09 08:39:18.000000000 +0000 @@ -129,7 +129,7 @@ Key  More Options -
        +
        • Configuration/Defaults/WinFavsBaseFolderName:
          For the 'Windows Favorites' export: name of the root folder; the default value is 'KeePass'.
        • @@ -148,6 +148,18 @@ Note that very small delays may result in target applications not being able to process the keypresses correctly. +
        • Configuration/Integration/AutoTypeAbortOnWindows:
          +This node may contain one or more Window nodes that +specify disallowed auto-type target windows (the value of each node must +be a target window filter). + +

          For example, the following configuration disallows auto-typing into +WordPad and LibreOffice Writer:

          +
          <AutoTypeAbortOnWindows>
          +    <Window>* - WordPad</Window>
          +    <Window>* - LibreOffice Writer</Window>
          +</AutoTypeAbortOnWindows>
        • +
        • Configuration/Security/MasterKeyTries:
          Specifies how often the master key dialog appears when entering incorrect master keys. The default value is 3.
        • diff -Nru keepass2-2.35+dfsg/Docs/Chm/help/v2_dev/plg_index.html keepass2-2.36+dfsg/Docs/Chm/help/v2_dev/plg_index.html --- keepass2-2.35+dfsg/Docs/Chm/help/v2_dev/plg_index.html 2017-01-09 10:10:12.000000000 +0000 +++ keepass2-2.36+dfsg/Docs/Chm/help/v2_dev/plg_index.html 2017-06-09 08:39:18.000000000 +0000 @@ -67,9 +67,9 @@
        • Latest KeePass source code package. You can get it from the KeePass website.
        • A C# 2.0 development IDE -(Microsoft +(Microsoft Visual Studio, -SharpDevelop +SharpDevelop or any other IDE).
        @@ -530,7 +530,7 @@

        In order to specify a quote character on the command line, it has to be encoded using three quotes (this is Windows standard, see -MSDN: SHELLEXECUTEINFO). So, the command line above will actually embed the post-build command cmd /c COPY "{PLGX_TEMP_DIR}MyFile.txt" diff -Nru keepass2-2.35+dfsg/Docs/History.txt keepass2-2.36+dfsg/Docs/History.txt --- keepass2-2.35+dfsg/Docs/History.txt 2017-01-08 16:35:52.000000000 +0000 +++ keepass2-2.36+dfsg/Docs/History.txt 2017-06-09 08:28:34.000000000 +0000 @@ -1,3 +1,69 @@ +2017-06-09: 2.36 +- Added commands 'Find Duplicate Passwords' and 'Find Similar + Passwords' (in 'Edit' -> 'Show Entries'), which show entries + that are using the same or similar passwords +- Added command 'Password Quality Report' (in 'Edit' -> 'Show + Entries'), which shows all entries and the estimated quality + of their passwords +- Added option 'String name' in the 'Edit' -> 'Find' dialog + (for searching entries that have a specific custom string + field) +- Added option for using a gray tray icon +- Added {CMD:/.../} placeholder, which runs a command line +- Added {T-CONV:/.../Raw/} placeholder, which inserts a text + without encoding it for the current context +- Added optional 'Last Password Modification Time (Based on + History)' entry list column +- The internal text editor now supports editing PS1 files +- The position and size of the internal data viewer is now + remembered and restored +- For various dialogs, the maximized state is now remembered + and restored +- Added configuration option for specifying an expiry date for + master keys +- Added configuration option for specifying disallowed + auto-type target windows +- Added workaround for Edge throwing away all keyboard input + for a short time after its activation +- Added workaround for Mono not properly rendering bold and + italic text in rich text boxes +- TrlUtil now performs a case-sensitive word validation + +- The password input controls in the IO connection dialog and + the proxy dialog now are secure edit controls +- The icon of the 'Save' command in the main menu is now grayed + out when there are no database changes (like the toolbar + button) +- Auto-Type: improved support for target applications that + redirect the focus immediately +- Auto-Type: improved compatibility with VMware vSphere client +- When an error occurs during auto-type, KeePass is now brought + to the foreground before showing an error message box +- Entries in groups where searching is disabled (e.g. the + recycle bin group) are now ignored by the commands that show + expired entries +- Improved scrolling when moving entries while grouping in the + entry list is on +- Improved support for right-to-left writing systems +- Improved application and system tray icon handling +- Updated low resolution ICO files (for Mono development) +- Moved single-click tray icon action option from the + 'Integration' tab to the 'Interface' tab of the options + dialog +- Synchronization file path comparisons are case-insensitive + now +- Improved workaround for Mono clipboard bug (improved + performance and window detection; the workaround is now + applied only if 'xsel' and 'xdotool' are installed) +- Enhanced PrepMonoDev.sh script +- KPScript: times in group and entry lists now contain a time + zone identifier (typically 'Z' for UTC) +- Various code optimizations +- Minor other improvements + +- The drop-down menu commands in the entry editing dialog for + setting the expiry date now work as expected + 2017-01-09: 2.35 - New KDBX 4 file format, which supports various new features (listed below; e.g. Argon2) Binary files /tmp/tmpusXDzT/4DEY4hShpt/keepass2-2.35+dfsg/Ext/Icons_15_VA/KeePass_Round/KeePass_Round_20.png and /tmp/tmpusXDzT/O4gh4lJ_eh/keepass2-2.36+dfsg/Ext/Icons_15_VA/KeePass_Round/KeePass_Round_20.png differ Binary files /tmp/tmpusXDzT/4DEY4hShpt/keepass2-2.35+dfsg/Ext/Icons_15_VA/KeePass_Round/KeePass_Round_24.png and /tmp/tmpusXDzT/O4gh4lJ_eh/keepass2-2.36+dfsg/Ext/Icons_15_VA/KeePass_Round/KeePass_Round_24.png differ Binary files /tmp/tmpusXDzT/4DEY4hShpt/keepass2-2.35+dfsg/Ext/Icons_15_VA/KeePass_Square_Blue/KeePass_Square_Blue_24.png and /tmp/tmpusXDzT/O4gh4lJ_eh/keepass2-2.36+dfsg/Ext/Icons_15_VA/KeePass_Square_Blue/KeePass_Square_Blue_24.png differ Binary files /tmp/tmpusXDzT/4DEY4hShpt/keepass2-2.35+dfsg/Ext/Icons_15_VA/KeePass_Square_Blue_Locked/KeePass_Square_Blue_Locked_24.png and /tmp/tmpusXDzT/O4gh4lJ_eh/keepass2-2.36+dfsg/Ext/Icons_15_VA/KeePass_Square_Blue_Locked/KeePass_Square_Blue_Locked_24.png differ Binary files /tmp/tmpusXDzT/4DEY4hShpt/keepass2-2.35+dfsg/Ext/Icons_15_VA/LowResIcons/KeePass_LR_G.ico and /tmp/tmpusXDzT/O4gh4lJ_eh/keepass2-2.36+dfsg/Ext/Icons_15_VA/LowResIcons/KeePass_LR_G.ico differ Binary files /tmp/tmpusXDzT/4DEY4hShpt/keepass2-2.35+dfsg/Ext/Icons_15_VA/LowResIcons/KeePass_LR.ico and /tmp/tmpusXDzT/O4gh4lJ_eh/keepass2-2.36+dfsg/Ext/Icons_15_VA/LowResIcons/KeePass_LR.ico differ Binary files /tmp/tmpusXDzT/4DEY4hShpt/keepass2-2.35+dfsg/Ext/Icons_15_VA/LowResIcons/KeePass_LR_R.ico and /tmp/tmpusXDzT/O4gh4lJ_eh/keepass2-2.36+dfsg/Ext/Icons_15_VA/LowResIcons/KeePass_LR_R.ico differ Binary files /tmp/tmpusXDzT/4DEY4hShpt/keepass2-2.35+dfsg/Ext/Icons_15_VA/LowResIcons/KeePass_LR_Y.ico and /tmp/tmpusXDzT/O4gh4lJ_eh/keepass2-2.36+dfsg/Ext/Icons_15_VA/LowResIcons/KeePass_LR_Y.ico differ diff -Nru keepass2-2.35+dfsg/Ext/KeePass.exe.config keepass2-2.36+dfsg/Ext/KeePass.exe.config --- keepass2-2.35+dfsg/Ext/KeePass.exe.config 2017-01-09 10:10:30.000000000 +0000 +++ keepass2-2.36+dfsg/Ext/KeePass.exe.config 2017-06-09 08:39:38.000000000 +0000 @@ -10,8 +10,8 @@ - + diff -Nru keepass2-2.35+dfsg/Ext/KeePass.iss keepass2-2.36+dfsg/Ext/KeePass.iss --- keepass2-2.35+dfsg/Ext/KeePass.iss 2017-01-09 10:11:02.000000000 +0000 +++ keepass2-2.36+dfsg/Ext/KeePass.iss 2017-06-09 08:40:08.000000000 +0000 @@ -8,11 +8,11 @@ #define MyAppNameEx "KeePass Password Safe 2" #define MyAppPublisher "Dominik Reichl" -#define KeeVersionStr "2.35" -#define KeeVersionStrWithMinor "2.35" -#define KeeVersionStrWithMinorPath "2.35" -#define KeeVersionWin "2.35.0.0" -#define KeeVersionWinShort "2.35" +#define KeeVersionStr "2.36" +#define KeeVersionStrWithMinor "2.36" +#define KeeVersionStrWithMinorPath "2.36" +#define KeeVersionWin "2.36.0.0" +#define KeeVersionWinShort "2.36" #define MyAppURL "http://keepass.info/" #define MyAppExeName "KeePass.exe" diff -Nru keepass2-2.35+dfsg/Ext/KeePassMsi/KeePassMsi.vdproj keepass2-2.36+dfsg/Ext/KeePassMsi/KeePassMsi.vdproj --- keepass2-2.35+dfsg/Ext/KeePassMsi/KeePassMsi.vdproj 2017-01-09 10:11:38.000000000 +0000 +++ keepass2-2.36+dfsg/Ext/KeePassMsi/KeePassMsi.vdproj 2017-06-09 08:40:44.000000000 +0000 @@ -296,7 +296,7 @@ { "AssemblyRegister" = "3:1" "AssemblyIsInGAC" = "11:FALSE" - "AssemblyAsmDisplayName" = "8:KeePass, Version=2.35.0.20042, Culture=neutral, PublicKeyToken=fed2ed7716aecf5c, processorArchitecture=MSIL" + "AssemblyAsmDisplayName" = "8:KeePass, Version=2.36.0.17315, Culture=neutral, PublicKeyToken=fed2ed7716aecf5c, processorArchitecture=MSIL" "ScatterAssemblies" { "_442863E39B69D2D0EE0DFF0823AF5611" @@ -387,7 +387,7 @@ { "AssemblyRegister" = "3:1" "AssemblyIsInGAC" = "11:FALSE" - "AssemblyAsmDisplayName" = "8:KeePass.XmlSerializers, Version=2.35.0.20042, Culture=neutral, PublicKeyToken=fed2ed7716aecf5c, processorArchitecture=MSIL" + "AssemblyAsmDisplayName" = "8:KeePass.XmlSerializers, Version=2.36.0.17315, Culture=neutral, PublicKeyToken=fed2ed7716aecf5c, processorArchitecture=MSIL" "ScatterAssemblies" { "_8C05ADB649434D7892E36709EBDED4CC" @@ -538,7 +538,7 @@ { "AssemblyRegister" = "3:1" "AssemblyIsInGAC" = "11:FALSE" - "AssemblyAsmDisplayName" = "8:KeePass, Version=2.35.0.20042, Culture=neutral, PublicKeyToken=fed2ed7716aecf5c, processorArchitecture=MSIL" + "AssemblyAsmDisplayName" = "8:KeePass, Version=2.36.0.17315, Culture=neutral, PublicKeyToken=fed2ed7716aecf5c, processorArchitecture=MSIL" "ScatterAssemblies" { "_C4F8814F844C43EE8C9F5B662182B11A" @@ -676,16 +676,16 @@ "Product" { "Name" = "8:Microsoft Visual Studio" - "ProductName" = "8:KeePass 2.35" - "ProductCode" = "8:{499FAE95-DECD-4168-8906-A6F502C3CE87}" - "PackageCode" = "8:{5F53E893-C1A7-433B-9E07-FF8CC01FE501}" + "ProductName" = "8:KeePass 2.36" + "ProductCode" = "8:{0CBD126E-4AA7-4F80-AB0C-7982A7C8AAE6}" + "PackageCode" = "8:{379F12CC-E057-4DCE-B530-518A81E62229}" "UpgradeCode" = "8:{F2F19898-4F86-4940-9BFA-426574CE03E1}" "AspNetVersion" = "8:4.0.30319.0" "RestartWWWService" = "11:FALSE" "RemovePreviousVersions" = "11:TRUE" "DetectNewerInstalledVersion" = "11:TRUE" "InstallAllUsers" = "11:TRUE" - "ProductVersion" = "8:2.35.0" + "ProductVersion" = "8:2.36.0" "Manufacturer" = "8:Dominik Reichl" "ARPHELPTELEPHONE" = "8:" "ARPHELPLINK" = "8:http://keepass.info/" diff -Nru keepass2-2.35+dfsg/KeePass/App/AppDefs.cs keepass2-2.36+dfsg/KeePass/App/AppDefs.cs --- keepass2-2.35+dfsg/KeePass/App/AppDefs.cs 2017-01-01 13:33:50.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/App/AppDefs.cs 2017-05-14 15:38:04.000000000 +0000 @@ -36,6 +36,9 @@ public static readonly Color ColorControlDisabled = SystemColors.Control; public static readonly Color ColorEditError = Color.FromArgb(255, 192, 192); + public static readonly Color ColorQualityLow = Color.FromArgb(255, 128, 0); + public static readonly Color ColorQualityHigh = Color.FromArgb(0, 255, 0); + public const string XslFilesDir = "XSL"; public const string XslFileHtmlFull = "KDBX_DetailsFull_HTML.xsl"; public const string XslFileHtmlLight = "KDBX_DetailsLight_HTML.xsl"; diff -Nru keepass2-2.35+dfsg/KeePass/App/AppIcons.cs keepass2-2.36+dfsg/KeePass/App/AppIcons.cs --- keepass2-2.35+dfsg/KeePass/App/AppIcons.cs 1970-01-01 00:00:00.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/App/AppIcons.cs 2017-05-28 09:47:54.000000000 +0000 @@ -0,0 +1,160 @@ +/* + KeePass Password Safe - The Open-Source Password Manager + Copyright (C) 2003-2017 Dominik Reichl + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Drawing; +using System.Globalization; +using System.Text; + +using KeePass.UI; + +namespace KeePass.App +{ + public enum AppIconType + { + None = 0, + Main, + QuadNormal, + QuadLocked + } + + public static class AppIcons + { + private static readonly Color[] g_vColors = new Color[] { + // Default should be first + Color.Blue, Color.Red, Color.Lime, Color.Yellow + + // Color.Green.G == 128, Color.Lime.G == 255 + }; + internal static Color[] Colors { get { return g_vColors; } } + + private static Dictionary g_dCache = new Dictionary(); + private static readonly object g_oCacheSync = new object(); + + public static Icon Default + { + get { return Get(AppIconType.Main, Size.Empty, g_vColors[0]); } + } + + public static Icon Get(AppIconType t, Size sz, Color clr) + { + int w = Math.Min(Math.Max(sz.Width, 0), 256); + int h = Math.Min(Math.Max(sz.Height, 0), 256); + if((w == 0) || (h == 0)) + { + Size szDef = UIUtil.GetIconSize(); + w = szDef.Width; + h = szDef.Height; + } + + Color c = RoundColor(clr); + + NumberFormatInfo nf = NumberFormatInfo.InvariantInfo; + string strID = ((long)t).ToString(nf) + ":" + w.ToString(nf) + ":" + + h.ToString(nf) + ":" + c.ToArgb().ToString(nf); + + Icon ico = null; + lock(g_oCacheSync) + { + if(g_dCache.TryGetValue(strID, out ico)) return ico; + } + + if(t == AppIconType.Main) + { + if(c == Color.Red) + ico = Properties.Resources.KeePass_R; + else if(c == Color.Lime) + ico = Properties.Resources.KeePass_G; + else if(c == Color.Yellow) + ico = Properties.Resources.KeePass_Y; + else + { + Debug.Assert(c == Color.Blue); + ico = Properties.Resources.KeePass; + } + } + else if(t == AppIconType.QuadNormal) + { + if(c == Color.Red) + ico = Properties.Resources.QuadNormal_R; + else if(c == Color.Lime) + ico = Properties.Resources.QuadNormal_G; + else if(c == Color.Yellow) + ico = Properties.Resources.QuadNormal_Y; + else + { + Debug.Assert(c == Color.Blue); + ico = Properties.Resources.QuadNormal; + } + } + else if(t == AppIconType.QuadLocked) + { + Debug.Assert(c == Color.Blue); + ico = Properties.Resources.QuadLocked; + } + else { Debug.Assert(false); } + + Icon icoSc = null; + if(ico != null) icoSc = new Icon(ico, w, h); // Preserves icon data + else { Debug.Assert(false); } + + lock(g_oCacheSync) { g_dCache[strID] = icoSc; } + return icoSc; + } + + private static int ColorDist(Color c1, Color c2) + { + int dR = (int)c1.R - (int)c2.R; + int dG = (int)c1.G - (int)c2.G; + int dB = (int)c1.B - (int)c2.B; + return ((dR * dR) + (dG * dG) + (dB * dB)); + } + + ///

        + /// Round to the nearest supported color. + /// + public static Color RoundColor(Color clr) + { + int c = clr.ToArgb(); // Color name is irrelevant + for(int i = 0; i < g_vColors.Length; ++i) + { + if(g_vColors[i].ToArgb() == c) return g_vColors[i]; // With name + } + + if((clr.R == clr.B) && (clr.G == clr.B)) + return g_vColors[0]; // Gray => default + + int iColor = 0; + int dMin = int.MaxValue; + for(int i = 0; i < g_vColors.Length; ++i) + { + int d = ColorDist(clr, g_vColors[i]); + if(d < dMin) + { + iColor = i; + dMin = d; + } + } + + return g_vColors[iColor]; + } + } +} diff -Nru keepass2-2.35+dfsg/KeePass/App/Configuration/AceIntegration.cs keepass2-2.36+dfsg/KeePass/App/Configuration/AceIntegration.cs --- keepass2-2.35+dfsg/KeePass/App/Configuration/AceIntegration.cs 2017-01-01 13:33:50.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/App/Configuration/AceIntegration.cs 2017-03-08 20:32:06.000000000 +0000 @@ -220,6 +220,18 @@ set { m_iInterKeyDelay = value; } } + private List m_lAbortWindows = new List(); + [XmlArrayItem("Window")] + public List AutoTypeAbortOnWindows + { + get { return m_lAbortWindows; } + set + { + if(value == null) throw new ArgumentNullException("value"); + m_lAbortWindows = value; + } + } + private ProxyServerType m_pstProxyType = ProxyServerType.System; public ProxyServerType ProxyType { diff -Nru keepass2-2.35+dfsg/KeePass/App/Configuration/AceMainWindow.cs keepass2-2.36+dfsg/KeePass/App/Configuration/AceMainWindow.cs --- keepass2-2.35+dfsg/KeePass/App/Configuration/AceMainWindow.cs 2017-01-01 16:33:54.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/App/Configuration/AceMainWindow.cs 2017-05-23 20:02:38.000000000 +0000 @@ -19,12 +19,12 @@ using System; using System.Collections.Generic; -using System.Text; +using System.ComponentModel; +using System.Diagnostics; using System.Drawing; +using System.Text; using System.Windows.Forms; using System.Xml.Serialization; -using System.ComponentModel; -using System.Diagnostics; using KeePass.Resources; using KeePass.UI; @@ -528,6 +528,7 @@ Size, HistoryCount, AttachmentCount, + LastPasswordModTime, Count // Virtual identifier representing the number of types } @@ -615,10 +616,11 @@ case AceColumnType.Tags: str = KPRes.Tags; break; case AceColumnType.ExpiryTimeDateOnly: str = KPRes.ExpiryTimeDateOnly; break; case AceColumnType.Size: str = KPRes.Size; break; - case AceColumnType.HistoryCount: str = KPRes.History + - " (" + KPRes.Count + ")"; break; - case AceColumnType.AttachmentCount: str = KPRes.Attachments + - " (" + KPRes.Count + ")"; break; + case AceColumnType.HistoryCount: + str = KPRes.History + " (" + KPRes.Count + ")"; break; + case AceColumnType.AttachmentCount: + str = KPRes.Attachments + " (" + KPRes.Count + ")"; break; + case AceColumnType.LastPasswordModTime: str = KPRes.LastModTimePwHist; break; default: Debug.Assert(false); break; }; @@ -633,9 +635,29 @@ public static bool IsTimeColumn(AceColumnType t) { - return ((t == AceColumnType.CreationTime) || (t == AceColumnType.LastAccessTime) || - (t == AceColumnType.LastModificationTime) || (t == AceColumnType.ExpiryTime) || - (t == AceColumnType.ExpiryTimeDateOnly)); + return ((t == AceColumnType.CreationTime) || + (t == AceColumnType.LastModificationTime) || + (t == AceColumnType.LastAccessTime) || + (t == AceColumnType.ExpiryTime) || + (t == AceColumnType.ExpiryTimeDateOnly) || + (t == AceColumnType.LastPasswordModTime)); + + /* bool bTime = false; + switch(t) + { + case AceColumnType.CreationTime: + case AceColumnType.LastModificationTime: + case AceColumnType.LastAccessTime: + case AceColumnType.ExpiryTime: + case AceColumnType.ExpiryTimeDateOnly: + case AceColumnType.LastPasswordModTime: + bTime = true; + break; + default: + break; + } + + return bTime; */ } public static HorizontalAlignment GetTextAlign(AceColumnType t) diff -Nru keepass2-2.35+dfsg/KeePass/App/Configuration/AceSecurity.cs keepass2-2.36+dfsg/KeePass/App/Configuration/AceSecurity.cs --- keepass2-2.35+dfsg/KeePass/App/Configuration/AceSecurity.cs 2017-01-01 13:33:50.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/App/Configuration/AceSecurity.cs 2017-02-06 18:44:30.000000000 +0000 @@ -79,6 +79,18 @@ set { m_bSecureDesktop = value; } } + private string m_strMasterKeyExpiryRec = string.Empty; + [DefaultValue("")] + public string MasterKeyExpiryRec + { + get { return m_strMasterKeyExpiryRec; } + set + { + if(value == null) throw new ArgumentNullException("value"); + m_strMasterKeyExpiryRec = value; + } + } + private bool m_bClipClearOnExit = true; [DefaultValue(true)] public bool ClipboardClearOnExit diff -Nru keepass2-2.35+dfsg/KeePass/App/Configuration/AceTrayIcon.cs keepass2-2.36+dfsg/KeePass/App/Configuration/AceTrayIcon.cs --- keepass2-2.35+dfsg/KeePass/App/Configuration/AceTrayIcon.cs 2017-01-01 13:33:50.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/App/Configuration/AceTrayIcon.cs 2017-05-20 15:30:44.000000000 +0000 @@ -38,6 +38,14 @@ set { m_bOnlyIfTrayed = value; } } + private bool m_bGrayIcon = false; + [DefaultValue(false)] + public bool GrayIcon + { + get { return m_bGrayIcon; } + set { m_bGrayIcon = value; } + } + private bool m_bSingleClickDefault = false; [DefaultValue(false)] public bool SingleClickDefault diff -Nru keepass2-2.35+dfsg/KeePass/App/Configuration/AceUI.cs keepass2-2.36+dfsg/KeePass/App/Configuration/AceUI.cs --- keepass2-2.35+dfsg/KeePass/App/Configuration/AceUI.cs 2017-01-01 13:33:50.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/App/Configuration/AceUI.cs 2017-06-05 17:45:42.000000000 +0000 @@ -207,6 +207,18 @@ set { m_bOptScreenReader = value; } } + private string m_strDataViewerRect = string.Empty; + [DefaultValue("")] + public string DataViewerRect + { + get { return m_strDataViewerRect; } + set + { + if(value == null) throw new ArgumentNullException("value"); + m_strDataViewerRect = value; + } + } + private string m_strDataEditorRect = string.Empty; [DefaultValue("")] public string DataEditorRect diff -Nru keepass2-2.35+dfsg/KeePass/DataExchange/ImportUtil.cs keepass2-2.36+dfsg/KeePass/DataExchange/ImportUtil.cs --- keepass2-2.35+dfsg/KeePass/DataExchange/ImportUtil.cs 2017-01-01 13:33:52.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/DataExchange/ImportUtil.cs 2017-03-09 17:19:28.000000000 +0000 @@ -229,7 +229,7 @@ // ")", LogStatusType.Info); string strSource = pwDatabase.IOConnectionInfo.Path; - if(ioc.Path != strSource) + if(!string.Equals(ioc.Path, strSource, StrUtil.CaseIgnoreCmp)) { bool bSaveAs = true; diff -Nru keepass2-2.35+dfsg/KeePass/Forms/AboutForm.cs keepass2-2.36+dfsg/KeePass/Forms/AboutForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/AboutForm.cs 2017-01-01 13:33:54.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/AboutForm.cs 2017-04-09 09:52:54.000000000 +0000 @@ -27,10 +27,10 @@ using System.Windows.Forms; using KeePass.App; -using KeePass.UI; +using KeePass.DataExchange; using KeePass.Resources; +using KeePass.UI; using KeePass.Util; -using KeePass.DataExchange; using KeePassLib; using KeePassLib.Utility; @@ -51,6 +51,7 @@ { GlobalWindowManager.AddWindow(this, this); + Debug.Assert(!m_lblCopyright.AutoSize); // For RTL support m_lblCopyright.Text = PwDefs.Copyright + "."; string strTitle = PwDefs.ProductName; @@ -68,11 +69,11 @@ strDesc += ")"; } - Icon icoNew = new Icon(Properties.Resources.KeePass, 48, 48); - - BannerFactory.CreateBannerEx(this, m_bannerImage, icoNew.ToBitmap(), + Icon icoSc = AppIcons.Get(AppIconType.Main, new Size( + DpiUtil.ScaleIntX(48), DpiUtil.ScaleIntY(48)), Color.Empty); + BannerFactory.CreateBannerEx(this, m_bannerImage, icoSc.ToBitmap(), strTitle, strDesc); - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; m_lvComponents.Columns.Add(KPRes.Component, 100, HorizontalAlignment.Left); m_lvComponents.Columns.Add(KPRes.Status + " / " + KPRes.Version, 100, diff -Nru keepass2-2.35+dfsg/KeePass/Forms/AutoTypeCtxForm.cs keepass2-2.36+dfsg/KeePass/Forms/AutoTypeCtxForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/AutoTypeCtxForm.cs 2017-01-01 13:33:54.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/AutoTypeCtxForm.cs 2017-06-06 11:50:12.000000000 +0000 @@ -20,10 +20,10 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Drawing; using System.Text; using System.Windows.Forms; -using System.Diagnostics; using KeePass.App; using KeePass.App.Configuration; @@ -74,13 +74,14 @@ GlobalWindowManager.AddWindow(this); + Debug.Assert(!m_lblText.AutoSize); // For RTL support m_lblText.Text = KPRes.AutoTypeEntrySelectionDescLong2; + this.Text = KPRes.AutoTypeEntrySelection; - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; - string strRect = Program.Config.UI.AutoTypeCtxRect; - if(strRect.Length > 0) UIUtil.SetWindowScreenRect(this, strRect); - m_strInitialFormRect = UIUtil.GetWindowScreenRect(this); + m_strInitialFormRect = UIUtil.SetWindowScreenRectEx(this, + Program.Config.UI.AutoTypeCtxRect); UIUtil.SetExplorerTheme(m_lvItems, true); @@ -125,7 +126,7 @@ Program.Config.UI.AutoTypeCtxColumnWidths = strColWidths; string strRect = UIUtil.GetWindowScreenRect(this); - if(strRect != m_strInitialFormRect) + if(strRect != m_strInitialFormRect) // Don't overwrite "" Program.Config.UI.AutoTypeCtxRect = strRect; DestroyToolsContextMenu(); @@ -279,7 +280,7 @@ private void OnBtnTools(object sender, EventArgs e) { RecreateToolsContextMenu(); - m_ctxTools.Show(m_btnTools, 0, m_btnTools.Height); + m_ctxTools.ShowEx(m_btnTools); } } } diff -Nru keepass2-2.35+dfsg/KeePass/Forms/CharPickerForm.cs keepass2-2.36+dfsg/KeePass/Forms/CharPickerForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/CharPickerForm.cs 2017-01-01 13:33:54.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/CharPickerForm.cs 2017-06-06 11:50:12.000000000 +0000 @@ -20,10 +20,10 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Drawing; using System.Text; using System.Windows.Forms; -using System.Diagnostics; using KeePass.App; using KeePass.App.Configuration; @@ -129,13 +129,12 @@ m_nFormHeight = this.Height; // Before restoring the position/size - string strRect = Program.Config.UI.CharPickerRect; - if(strRect.Length > 0) UIUtil.SetWindowScreenRect(this, strRect); - m_strInitialFormRect = UIUtil.GetWindowScreenRect(this); + m_strInitialFormRect = UIUtil.SetWindowScreenRectEx(this, + Program.Config.UI.CharPickerRect); m_fontChars = FontUtil.CreateFont("Tahoma", 8.25f, FontStyle.Bold); - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; this.Text = KPRes.PickCharacters + " - " + PwDefs.ShortProductName; m_secWord.Attach(m_tbSelected, OnSelectedTextChangedEx, true); @@ -186,7 +185,7 @@ private void CleanUpEx() { string strRect = UIUtil.GetWindowScreenRect(this); - if(strRect != m_strInitialFormRect) + if(strRect != m_strInitialFormRect) // Don't overwrite "" Program.Config.UI.CharPickerRect = strRect; m_secWord.Detach(); @@ -232,6 +231,8 @@ RemoveAllCharButtons(); + bool bRtl = (this.RightToLeft == RightToLeft.Yes); + string strWord = ((m_psWord != null) ? m_psWord.ReadString() : string.Empty); if(strWord.Length >= 1) { @@ -241,8 +242,10 @@ { int w = ((nPnlWidth * (i + 1)) / strWord.Length) - x; + int rx = (bRtl ? (nPnlWidth - x - w) : x); + Button btn = new Button(); - btn.Location = new Point(x, 0); + btn.Location = new Point(rx, 0); btn.Size = new Size(w, nPnlHeight / 2 - 1); btn.Font = m_fontChars; btn.Tag = strWord[i]; @@ -254,8 +257,8 @@ Label lbl = new Label(); lbl.Text = (i + 1).ToString(); lbl.TextAlign = ContentAlignment.MiddleCenter; - lbl.Location = new Point(x, nPnlHeight / 2); - lbl.Size = new Size(w + 1, nPnlHeight / 2 - 3); + lbl.Location = new Point(rx - 1, nPnlHeight / 2); + lbl.Size = new Size(w + 2, nPnlHeight / 2 - 3); m_lLabels.Add(lbl); m_pnlSelect.Controls.Add(lbl); diff -Nru keepass2-2.35+dfsg/KeePass/Forms/CharPickerForm.Designer.cs keepass2-2.36+dfsg/KeePass/Forms/CharPickerForm.Designer.cs --- keepass2-2.35+dfsg/KeePass/Forms/CharPickerForm.Designer.cs 2015-03-16 10:17:30.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/CharPickerForm.Designer.cs 2017-04-09 12:22:10.000000000 +0000 @@ -88,7 +88,7 @@ // m_lblChars // this.m_lblChars.AutoSize = true; - this.m_lblChars.Location = new System.Drawing.Point(12, 6); + this.m_lblChars.Location = new System.Drawing.Point(0, 6); this.m_lblChars.Name = "m_lblChars"; this.m_lblChars.Size = new System.Drawing.Size(56, 13); this.m_lblChars.TabIndex = 0; @@ -97,7 +97,7 @@ // m_lblIndex // this.m_lblIndex.AutoSize = true; - this.m_lblIndex.Location = new System.Drawing.Point(12, 30); + this.m_lblIndex.Location = new System.Drawing.Point(0, 30); this.m_lblIndex.Name = "m_lblIndex"; this.m_lblIndex.Size = new System.Drawing.Size(47, 13); this.m_lblIndex.TabIndex = 1; @@ -166,7 +166,7 @@ this.m_pnlTop.Dock = System.Windows.Forms.DockStyle.Top; this.m_pnlTop.Location = new System.Drawing.Point(0, 60); this.m_pnlTop.Name = "m_pnlTop"; - this.m_pnlTop.Padding = new System.Windows.Forms.Padding(0, 8, 12, 8); + this.m_pnlTop.Padding = new System.Windows.Forms.Padding(12, 8, 12, 8); this.m_pnlTop.Size = new System.Drawing.Size(628, 68); this.m_pnlTop.TabIndex = 3; // @@ -175,9 +175,9 @@ this.m_pnlTopLeft.Controls.Add(this.m_lblChars); this.m_pnlTopLeft.Controls.Add(this.m_lblIndex); this.m_pnlTopLeft.Dock = System.Windows.Forms.DockStyle.Left; - this.m_pnlTopLeft.Location = new System.Drawing.Point(0, 8); + this.m_pnlTopLeft.Location = new System.Drawing.Point(12, 8); this.m_pnlTopLeft.Name = "m_pnlTopLeft"; - this.m_pnlTopLeft.Size = new System.Drawing.Size(71, 52); + this.m_pnlTopLeft.Size = new System.Drawing.Size(59, 52); this.m_pnlTopLeft.TabIndex = 0; // // m_pnlLeft diff -Nru keepass2-2.35+dfsg/KeePass/Forms/ColumnsForm.cs keepass2-2.36+dfsg/KeePass/Forms/ColumnsForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/ColumnsForm.cs 2017-01-01 13:33:54.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/ColumnsForm.cs 2017-05-22 18:06:04.000000000 +0000 @@ -20,11 +20,11 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Drawing; using System.Text; -using System.Windows.Forms; using System.Threading; -using System.Diagnostics; +using System.Windows.Forms; using KeePass.App; using KeePass.App.Configuration; @@ -58,7 +58,7 @@ BannerFactory.CreateBannerEx(this, m_bannerImage, Properties.Resources.B48x48_View_Detailed, KPRes.ConfigureColumns, KPRes.ConfigureColumnsDesc); - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; this.Text = KPRes.ConfigureColumns; float fWidth = (float)(m_lvColumns.ClientRectangle.Width - @@ -224,6 +224,7 @@ AddStdAceColumn(l, AceColumnType.OverrideUrl); AddStdAceColumn(l, AceColumnType.Tags); AddStdAceColumn(l, AceColumnType.ExpiryTimeDateOnly); + AddStdAceColumn(l, AceColumnType.LastPasswordModTime); d.Clear(); // Add active plugin columns (including those of uninstalled plugins) diff -Nru keepass2-2.35+dfsg/KeePass/Forms/CsvImportForm.cs keepass2-2.36+dfsg/KeePass/Forms/CsvImportForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/CsvImportForm.cs 2017-01-01 13:33:54.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/CsvImportForm.cs 2017-04-09 12:33:56.000000000 +0000 @@ -20,11 +20,11 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Drawing; +using System.Globalization; using System.Text; using System.Windows.Forms; -using System.Globalization; -using System.Diagnostics; using KeePass.App; using KeePass.DataExchange; @@ -112,7 +112,7 @@ // Callable from KPScript without parent form Debug.Assert(this.StartPosition == FormStartPosition.CenterScreen); - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; this.Text = KPRes.GenericCsvImporter + " - " + PwDefs.ShortProductName; // FontUtil.AssignDefaultBold(m_grpSyntax); @@ -239,8 +239,8 @@ m_cmbFieldFormat.Items.Add(strPre); if(t == CsvFieldType.Group) - m_lblFieldFormat.Text = KPRes.Separator + ":"; - else m_lblFieldFormat.Text = KPRes.Format + ":"; + UIUtil.SetText(m_lblFieldFormat, KPRes.Separator + ":"); + else UIUtil.SetText(m_lblFieldFormat, KPRes.Format + ":"); } m_tLastCsvType = t; diff -Nru keepass2-2.35+dfsg/KeePass/Forms/DatabaseOperationsForm.cs keepass2-2.36+dfsg/KeePass/Forms/DatabaseOperationsForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/DatabaseOperationsForm.cs 2017-01-01 13:33:54.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/DatabaseOperationsForm.cs 2017-03-12 17:19:16.000000000 +0000 @@ -20,13 +20,14 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Drawing; using System.Text; using System.Windows.Forms; -using System.Diagnostics; -using KeePass.UI; +using KeePass.App; using KeePass.Resources; +using KeePass.UI; using KeePassLib; using KeePassLib.Collections; @@ -64,7 +65,7 @@ BannerFactory.CreateBannerEx(this, m_bannerImage, Properties.Resources.B48x48_Package_Settings, KPRes.DatabaseMaintenance, KPRes.DatabaseMaintenanceDesc); - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; this.Text = KPRes.DatabaseMaintenance; m_numHistoryDays.Value = m_pwDatabase.MaintenanceHistoryDays; diff -Nru keepass2-2.35+dfsg/KeePass/Forms/DatabaseSettingsForm.cs keepass2-2.36+dfsg/KeePass/Forms/DatabaseSettingsForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/DatabaseSettingsForm.cs 2017-01-07 18:24:54.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/DatabaseSettingsForm.cs 2017-04-10 09:28:18.000000000 +0000 @@ -28,13 +28,13 @@ using KeePass.App; using KeePass.App.Configuration; -using KeePass.UI; using KeePass.Resources; +using KeePass.UI; using KeePassLib; -using KeePassLib.Delegates; using KeePassLib.Cryptography.Cipher; using KeePassLib.Cryptography.KeyDerivation; +using KeePassLib.Delegates; using KeePassLib.Keys; using KeePassLib.Security; using KeePassLib.Utility; @@ -48,7 +48,7 @@ private Color m_clr = Color.Empty; - private ContextMenu m_ctxColor = null; + private CustomContextMenuEx m_ctxColor = null; private List m_vColorItems = new List(); private Image m_imgColor = null; @@ -90,7 +90,7 @@ BannerFactory.CreateBannerEx(this, m_bannerImage, Properties.Resources.B48x48_Ark, KPRes.DatabaseSettings, KPRes.DatabaseSettingsDesc); - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; FontUtil.AssignDefaultItalic(m_lblHeaderCpAlgo); FontUtil.AssignDefaultItalic(m_lblHeaderCp); @@ -114,8 +114,11 @@ m_clr = m_pwDatabase.Color; if(m_clr != Color.Empty) + { + m_clr = AppIcons.RoundColor(m_clr); UIUtil.OverwriteButtonImage(m_btnColor, ref m_imgColor, UIUtil.CreateColorBitmap24(m_btnColor, m_clr)); + } m_cbColor.Checked = (m_clr != Color.Empty); for(int inx = 0; inx < CipherPool.GlobalPool.EngineCount; ++inx) @@ -510,11 +513,12 @@ if(m_ctxColor == null) { - m_ctxColor = new ContextMenu(); + m_ctxColor = new CustomContextMenuEx(); int qSize = (int)((20.0f * m_btnColor.Height) / 23.0f + 0.01f); - const int nMaxColors = 64; + // const int nMaxColors = 64; + int nMaxColors = AppIcons.Colors.Length; int nBreakAt = (int)Math.Sqrt(0.1 + nMaxColors); // m_ctxColor.LayoutStyle = ToolStripLayoutStyle.Flow; @@ -532,8 +536,9 @@ for(int i = 0; i < nMaxColors; ++i) { - float fHue = ((float)i * 360.0f) / (float)nMaxColors; - Color clr = UIUtil.ColorFromHsv(fHue, 1.0f, 1.0f); + // float fHue = ((float)i * 360.0f) / (float)nMaxColors; + // Color clr = UIUtil.ColorFromHsv(fHue, 1.0f, 1.0f); + Color clr = AppIcons.Colors[i]; // Image img = UIUtil.CreateColorBitmap24(16, 16, clr); // ToolStripButton btn = new ToolStripButton(string.Empty, img); @@ -566,7 +571,7 @@ // m_ctxColor.Visible = true; // m_ctxColor.Show(); - m_ctxColor.Show(m_btnColor, new Point(0, m_btnColor.Height)); + m_ctxColor.ShowEx(m_btnColor); } private void OnColorCheckedChanged(object sender, EventArgs e) diff -Nru keepass2-2.35+dfsg/KeePass/Forms/DataEditorForm.cs keepass2-2.36+dfsg/KeePass/Forms/DataEditorForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/DataEditorForm.cs 2017-01-01 13:33:54.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/DataEditorForm.cs 2017-06-06 11:50:12.000000000 +0000 @@ -20,11 +20,11 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Drawing; using System.Drawing.Text; using System.Text; using System.Windows.Forms; -using System.Diagnostics; using KeePass.App; using KeePass.App.Configuration; @@ -95,12 +95,11 @@ GlobalWindowManager.AddWindow(this); - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; this.DoubleBuffered = true; - string strRect = Program.Config.UI.DataEditorRect; - if(strRect.Length > 0) UIUtil.SetWindowScreenRect(this, strRect); - m_strInitialFormRect = UIUtil.GetWindowScreenRect(this); + m_strInitialFormRect = UIUtil.SetWindowScreenRectEx(this, + Program.Config.UI.DataEditorRect); m_bdc = BinaryDataClassifier.Classify(m_strDataDesc, m_pbData); uint uStartOffset; @@ -299,7 +298,7 @@ Debug.Assert(m_uBlockEvents == 0); string strRect = UIUtil.GetWindowScreenRect(this); - if(strRect != m_strInitialFormRect) + if(strRect != m_strInitialFormRect) // Don't overwrite "" Program.Config.UI.DataEditorRect = strRect; m_ctxText.Detach(); diff -Nru keepass2-2.35+dfsg/KeePass/Forms/DataEditorForm.Designer.cs keepass2-2.36+dfsg/KeePass/Forms/DataEditorForm.Designer.cs --- keepass2-2.35+dfsg/KeePass/Forms/DataEditorForm.Designer.cs 2016-08-27 08:32:34.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/DataEditorForm.Designer.cs 2017-04-10 12:52:56.000000000 +0000 @@ -126,19 +126,19 @@ // m_menuViewFont // this.m_menuViewFont.Name = "m_menuViewFont"; - this.m_menuViewFont.Size = new System.Drawing.Size(152, 22); + this.m_menuViewFont.Size = new System.Drawing.Size(134, 22); this.m_menuViewFont.Text = "&Font..."; this.m_menuViewFont.Click += new System.EventHandler(this.OnViewFont); // // m_menuViewSep0 // this.m_menuViewSep0.Name = "m_menuViewSep0"; - this.m_menuViewSep0.Size = new System.Drawing.Size(149, 6); + this.m_menuViewSep0.Size = new System.Drawing.Size(131, 6); // // m_menuViewWordWrap // this.m_menuViewWordWrap.Name = "m_menuViewWordWrap"; - this.m_menuViewWordWrap.Size = new System.Drawing.Size(152, 22); + this.m_menuViewWordWrap.Size = new System.Drawing.Size(134, 22); this.m_menuViewWordWrap.Text = "Word &Wrap"; this.m_menuViewWordWrap.Click += new System.EventHandler(this.OnViewWordWrap); // @@ -212,6 +212,7 @@ this.m_tbEditUndo.Image = global::KeePass.Properties.Resources.B16x16_Undo; this.m_tbEditUndo.ImageTransparentColor = System.Drawing.Color.Magenta; this.m_tbEditUndo.Name = "m_tbEditUndo"; + this.m_tbEditUndo.RightToLeftAutoMirrorImage = true; this.m_tbEditUndo.Size = new System.Drawing.Size(23, 22); this.m_tbEditUndo.Click += new System.EventHandler(this.OnEditUndo); // @@ -221,6 +222,7 @@ this.m_tbEditRedo.Image = global::KeePass.Properties.Resources.B16x16_Redo; this.m_tbEditRedo.ImageTransparentColor = System.Drawing.Color.Magenta; this.m_tbEditRedo.Name = "m_tbEditRedo"; + this.m_tbEditRedo.RightToLeftAutoMirrorImage = true; this.m_tbEditRedo.Size = new System.Drawing.Size(23, 22); this.m_tbEditRedo.Click += new System.EventHandler(this.OnEditRedo); // diff -Nru keepass2-2.35+dfsg/KeePass/Forms/DataViewerForm.cs keepass2-2.36+dfsg/KeePass/Forms/DataViewerForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/DataViewerForm.cs 2017-01-01 13:33:54.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/DataViewerForm.cs 2017-06-06 11:50:12.000000000 +0000 @@ -20,14 +20,15 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Imaging; +using System.IO; using System.Text; using System.Windows.Forms; -using System.Diagnostics; -using System.IO; +using KeePass.App; using KeePass.Native; using KeePass.Resources; using KeePass.UI; @@ -56,6 +57,7 @@ private readonly string m_strDataExpand = "--- " + KPRes.More + " ---"; private bool m_bDataExpanded = false; + private string m_strInitialFormRect = string.Empty; private RichTextBoxContextMenu m_ctxText = new RichTextBoxContextMenu(); private Image m_img = null; @@ -93,14 +95,16 @@ GlobalWindowManager.AddWindow(this); - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; + this.DoubleBuffered = true; string strTitle = PwDefs.ShortProductName + " " + KPRes.DataViewer; if(m_strDataDesc.Length > 0) strTitle = m_strDataDesc + " - " + strTitle; this.Text = strTitle; - this.DoubleBuffered = true; + m_strInitialFormRect = UIUtil.SetWindowScreenRectEx(this, + Program.Config.UI.DataViewerRect); m_tssStatusMain.Text = KPRes.Ready; m_ctxText.Attach(m_rtbText, this); @@ -482,6 +486,10 @@ } } + string strRect = UIUtil.GetWindowScreenRect(this); + if(strRect != m_strInitialFormRect) // Don't overwrite "" + Program.Config.UI.DataViewerRect = strRect; + m_picBox.Image = null; if(m_img != null) { m_img.Dispose(); m_img = null; } if(m_imgResized != null) { m_imgResized.Dispose(); m_imgResized = null; } diff -Nru keepass2-2.35+dfsg/KeePass/Forms/DuplicationForm.cs keepass2-2.36+dfsg/KeePass/Forms/DuplicationForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/DuplicationForm.cs 2017-01-01 13:33:54.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/DuplicationForm.cs 2017-03-12 17:09:12.000000000 +0000 @@ -20,10 +20,10 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Drawing; using System.Text; using System.Windows.Forms; -using System.Diagnostics; using KeePass.App; using KeePass.Resources; @@ -100,7 +100,7 @@ { GlobalWindowManager.AddWindow(this); - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; FontUtil.AssignDefaultBold(m_cbAppendCopy); FontUtil.AssignDefaultBold(m_cbFieldRefs); diff -Nru keepass2-2.35+dfsg/KeePass/Forms/EcasActionForm.cs keepass2-2.36+dfsg/KeePass/Forms/EcasActionForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/EcasActionForm.cs 2017-01-01 13:33:54.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/EcasActionForm.cs 2017-04-09 09:46:52.000000000 +0000 @@ -20,15 +20,15 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Drawing; using System.Text; using System.Windows.Forms; -using System.Diagnostics; using KeePass.App; -using KeePass.UI; -using KeePass.Resources; using KeePass.Ecas; +using KeePass.Resources; +using KeePass.UI; using KeePassLib; using KeePassLib.Utility; @@ -59,8 +59,9 @@ GlobalWindowManager.AddWindow(this); this.Text = KPRes.Action; - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; + Debug.Assert(!m_lblParamHint.AutoSize); // For RTL support m_lblParamHint.Text = KPRes.ParamDescHelp; foreach(EcasActionProvider ap in Program.EcasPool.ActionProviders) diff -Nru keepass2-2.35+dfsg/KeePass/Forms/EcasConditionForm.cs keepass2-2.36+dfsg/KeePass/Forms/EcasConditionForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/EcasConditionForm.cs 2017-01-01 13:33:54.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/EcasConditionForm.cs 2017-04-09 09:46:28.000000000 +0000 @@ -20,15 +20,15 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Drawing; using System.Text; using System.Windows.Forms; -using System.Diagnostics; using KeePass.App; -using KeePass.UI; -using KeePass.Resources; using KeePass.Ecas; +using KeePass.Resources; +using KeePass.UI; namespace KeePass.Forms { @@ -56,8 +56,9 @@ GlobalWindowManager.AddWindow(this); this.Text = KPRes.Condition; - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; + Debug.Assert(!m_lblParamHint.AutoSize); // For RTL support m_lblParamHint.Text = KPRes.ParamDescHelp; foreach(EcasConditionProvider cp in Program.EcasPool.ConditionProviders) diff -Nru keepass2-2.35+dfsg/KeePass/Forms/EcasEventForm.cs keepass2-2.36+dfsg/KeePass/Forms/EcasEventForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/EcasEventForm.cs 2017-01-01 13:33:54.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/EcasEventForm.cs 2017-04-09 09:45:38.000000000 +0000 @@ -20,15 +20,15 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Drawing; using System.Text; using System.Windows.Forms; -using System.Diagnostics; using KeePass.App; -using KeePass.UI; -using KeePass.Resources; using KeePass.Ecas; +using KeePass.Resources; +using KeePass.UI; namespace KeePass.Forms { @@ -56,8 +56,9 @@ GlobalWindowManager.AddWindow(this); this.Text = KPRes.Event; - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; + Debug.Assert(!m_lblParamHint.AutoSize); // For RTL support m_lblParamHint.Text = KPRes.ParamDescHelp; foreach(EcasEventProvider ep in Program.EcasPool.EventProviders) diff -Nru keepass2-2.35+dfsg/KeePass/Forms/EcasTriggerForm.cs keepass2-2.36+dfsg/KeePass/Forms/EcasTriggerForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/EcasTriggerForm.cs 2017-01-01 13:33:54.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/EcasTriggerForm.cs 2017-03-12 17:06:08.000000000 +0000 @@ -20,15 +20,15 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Drawing; using System.Text; using System.Windows.Forms; -using System.Diagnostics; using KeePass.App; -using KeePass.UI; -using KeePass.Resources; using KeePass.Ecas; +using KeePass.Resources; +using KeePass.UI; using KeePassLib; using KeePassLib.Utility; @@ -67,7 +67,7 @@ BannerFactory.CreateBannerEx(this, m_bannerImage, Properties.Resources.B48x48_Run, strTitle, strDesc); this.Text = strTitle; - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; m_lvEvents.SmallImageList = m_ilIcons; m_lvConditions.SmallImageList = m_ilIcons; diff -Nru keepass2-2.35+dfsg/KeePass/Forms/EcasTriggersForm.cs keepass2-2.36+dfsg/KeePass/Forms/EcasTriggersForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/EcasTriggersForm.cs 2017-01-01 13:33:54.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/EcasTriggersForm.cs 2017-04-10 09:44:24.000000000 +0000 @@ -20,18 +20,18 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Drawing; +using System.IO; using System.Text; using System.Windows.Forms; -using System.Diagnostics; using System.Xml; using System.Xml.Serialization; -using System.IO; using KeePass.App; -using KeePass.UI; -using KeePass.Resources; using KeePass.Ecas; +using KeePass.Resources; +using KeePass.UI; using KeePass.Util; using KeePassLib; @@ -82,7 +82,7 @@ Properties.Resources.B48x48_Make_KDevelop, KPRes.Triggers, KPRes.TriggersDesc); this.Text = KPRes.Triggers; - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; int nWidth = (m_lvTriggers.ClientSize.Width - UIUtil.GetVScrollBarWidth() - 1); m_lvTriggers.Columns.Add(KPRes.Triggers, nWidth); @@ -190,7 +190,7 @@ private void OnBtnTools(object sender, EventArgs e) { - m_ctxTools.Show(m_btnTools, new Point(0, m_btnTools.Size.Height)); + m_ctxTools.ShowEx(m_btnTools); } private void OnCtxToolsHelp(object sender, EventArgs e) diff -Nru keepass2-2.35+dfsg/KeePass/Forms/EditAutoTypeItemForm.cs keepass2-2.36+dfsg/KeePass/Forms/EditAutoTypeItemForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/EditAutoTypeItemForm.cs 2017-01-01 13:33:54.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/EditAutoTypeItemForm.cs 2017-05-28 11:49:50.000000000 +0000 @@ -20,11 +20,11 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Drawing; using System.Text; -using System.Windows.Forms; using System.Threading; -using System.Diagnostics; +using System.Windows.Forms; using KeePass.App; using KeePass.Native; @@ -34,8 +34,8 @@ using KeePass.Util.Spr; using KeePassLib; -using KeePassLib.Security; using KeePassLib.Collections; +using KeePassLib.Security; using KeePassLib.Utility; using NativeLib = KeePassLib.Native.NativeLib; @@ -50,11 +50,13 @@ private string m_strDefaultSeq = string.Empty; private ProtectedStringDictionary m_vStringDict = null; - private object m_objDialogSync = new object(); + private readonly object m_objDialogSync = new object(); private bool m_bDialogClosed = false; + #if DEBUG private static Dictionary m_dWndTasks = new Dictionary(); + private static readonly object m_oWndTasksSync = new object(); #endif // private Color m_clrOriginalForeground = Color.Black; @@ -106,7 +108,7 @@ KPRes.ConfigureKeystrokeSeqDesc); } - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; // FontUtil.AssignDefaultBold(m_lblTargetWindow); // FontUtil.AssignDefaultBold(m_rbSeqDefault); @@ -163,11 +165,14 @@ "TAB", "ENTER", "UP", "DOWN", "LEFT", "RIGHT", "HOME", "END", "PGUP", "PGDN", "INSERT", "DELETE", "SPACE", VkcBreak, + "BACKSPACE", "BREAK", "CAPSLOCK", "ESC", "WIN", "LWIN", "RWIN", "APPS", "HELP", "NUMLOCK", "PRTSC", "SCROLLLOCK", VkcBreak, + "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", "F13", "F14", "F15", "F16", VkcBreak, + "ADD", "SUBTRACT", "MULTIPLY", "DIVIDE", "NUMPAD0", "NUMPAD1", "NUMPAD2", "NUMPAD3", "NUMPAD4", "NUMPAD5", "NUMPAD6", "NUMPAD7", "NUMPAD8", "NUMPAD9" @@ -182,14 +187,19 @@ // "BASE", "T-REPLACE-RX:/T/S/R/", "T-CONV:/T/C/", "C:Comment", VkcBreak, + "DELAY 1000", "DELAY=200", "VKEY 13", "VKEY-NX 13", "VKEY-EX 13", "PICKCHARS", "PICKCHARS:Password:C=3", "PICKFIELD", "NEWPASSWORD", "NEWPASSWORD:/Profile/", "HMACOTP", "CLEARFIELD", - "APPACTIVATE " + KPRes.Title, "BEEP 800 200", VkcBreak, + "APPACTIVATE " + KPRes.Title, "BEEP 800 200", + "CMD:/C/O/", VkcBreak, + "APPDIR", "DB_PATH", "DB_DIR", "DB_NAME", "DB_BASENAME", "DB_EXT", "ENV_DIRSEP", "ENV_PROGRAMFILES_X86", VkcBreak, + // "INTERNETEXPLORER", "FIREFOX", "OPERA", "GOOGLECHROME", // "SAFARI", VkcBreak, + "DT_SIMPLE", "DT_YEAR", "DT_MONTH", "DT_DAY", "DT_HOUR", "DT_MINUTE", "DT_SECOND", "DT_UTC_SIMPLE", "DT_UTC_YEAR", "DT_UTC_MONTH", "DT_UTC_DAY", "DT_UTC_HOUR", "DT_UTC_MINUTE", "DT_UTC_SECOND" @@ -306,7 +316,7 @@ m_ctxKeySeq.Detach(); #if DEBUG - lock(m_dWndTasks) { Debug.Assert(m_dWndTasks.Count == 0); } + lock(m_oWndTasksSync) { Debug.Assert(m_dWndTasks.Count == 0); } #endif } @@ -578,7 +588,7 @@ { #if DEBUG string strTaskID = Guid.NewGuid().ToString(); - lock(m_dWndTasks) { m_dWndTasks[strTaskID] = @"<<>>"; } + lock(m_oWndTasksSync) { m_dWndTasks[strTaskID] = @"<<>>"; } #endif try @@ -600,7 +610,7 @@ #if DEBUG Debug.Assert(strName.Length <= pLen.ToInt64()); - lock(m_dWndTasks) { m_dWndTasks[strTaskID] = strName; } + lock(m_oWndTasksSync) { m_dWndTasks[strTaskID] = strName; } #endif if((NativeMethods.GetWindowStyle(hWnd) & @@ -619,7 +629,7 @@ #if DEBUG finally { - lock(m_dWndTasks) { m_dWndTasks.Remove(strTaskID); } + lock(m_oWndTasksSync) { m_dWndTasks.Remove(strTaskID); } } #endif } diff -Nru keepass2-2.35+dfsg/KeePass/Forms/EditStringForm.cs keepass2-2.36+dfsg/KeePass/Forms/EditStringForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/EditStringForm.cs 2017-01-01 13:33:54.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/EditStringForm.cs 2017-04-09 09:44:26.000000000 +0000 @@ -20,15 +20,15 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Drawing; using System.Text; -using System.Windows.Forms; using System.Threading; -using System.Diagnostics; +using System.Windows.Forms; using KeePass.App; -using KeePass.UI; using KeePass.Resources; +using KeePass.UI; using KeePassLib; using KeePassLib.Collections; @@ -97,7 +97,7 @@ BannerFactory.CreateBannerEx(this, m_bannerImage, Properties.Resources.B48x48_Font, strTitle, strDesc); - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; UIUtil.EnableAutoCompletion(m_cmbStringName, true); UIUtil.PrepareStandardMultilineControl(m_richStringValue, true, true); @@ -122,6 +122,7 @@ bool b = ValidateStringName(m_cmbStringName.Text, out strResult, out bError); + Debug.Assert(!m_lblValidationInfo.AutoSize); // For RTL support m_lblValidationInfo.Text = strResult; if(bError) m_cmbStringName.BackColor = AppDefs.ColorEditError; else m_cmbStringName.ResetBackColor(); diff -Nru keepass2-2.35+dfsg/KeePass/Forms/EntropyForm.cs keepass2-2.36+dfsg/KeePass/Forms/EntropyForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/EntropyForm.cs 2017-01-01 13:33:54.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/EntropyForm.cs 2017-04-09 10:58:24.000000000 +0000 @@ -28,8 +28,9 @@ using System.Text; using System.Windows.Forms; -using KeePass.UI; +using KeePass.App; using KeePass.Resources; +using KeePass.UI; using KeePassLib.Cryptography; using KeePassLib.Cryptography.PasswordGenerator; @@ -77,7 +78,7 @@ BannerFactory.CreateBannerEx(this, m_bannerImage, Properties.Resources.B48x48_Binary, KPRes.EntropyTitle, KPRes.EntropyDesc); - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; this.Text = KPRes.EntropyTitle; m_bmpRandom = CreateRandomBitmap(m_picRandom.ClientSize); @@ -89,6 +90,7 @@ private void UpdateUIState() { int nBits = m_llPool.Count / 8; + Debug.Assert(!m_lblStatus.AutoSize); // For RTL support m_lblStatus.Text = nBits.ToString() + " " + KPRes.BitsStc; if(nBits > 256) { Debug.Assert(false); m_pbGenerated.Value = 100; } diff -Nru keepass2-2.35+dfsg/KeePass/Forms/EntryListForm.cs keepass2-2.36+dfsg/KeePass/Forms/EntryListForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/EntryListForm.cs 2017-01-01 13:33:54.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/EntryListForm.cs 1970-01-01 00:00:00.000000000 +0000 @@ -1,181 +0,0 @@ -/* - KeePass Password Safe - The Open-Source Password Manager - Copyright (C) 2003-2017 Dominik Reichl - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Text; -using System.Windows.Forms; -using System.Diagnostics; - -using KeePass.UI; -using KeePass.Resources; -using KeePass.Native; - -using KeePassLib; -using KeePassLib.Collections; -using KeePassLib.Utility; - -namespace KeePass.Forms -{ - public partial class EntryListForm : Form - { - private string m_strTitle = string.Empty; - private string m_strDescShort = string.Empty; - private string m_strDescLong = string.Empty; - private Image m_imgIcon = null; - private ImageList m_ilIcons = null; - private PwObjectList m_vEntries = null; - private PwEntry m_peSelected = null; - private bool m_bEnsureForeground = false; - - public PwEntry SelectedEntry - { - get { return m_peSelected; } - } - - public bool EnsureForeground - { - get { return m_bEnsureForeground; } - set { m_bEnsureForeground = value; } - } - - public void InitEx(string strTitle, string strDescShort, - string strDescLong, Image imgIcon, ImageList ilIcons, - PwObjectList vEntries) - { - m_strTitle = strTitle; - m_strDescShort = strDescShort; - m_strDescLong = strDescLong; - m_imgIcon = imgIcon; - m_ilIcons = UIUtil.CloneImageList(ilIcons, true); - m_vEntries = vEntries; - } - - public EntryListForm() - { - InitializeComponent(); - Program.Translation.ApplyTo(this); - } - - private void OnFormLoad(object sender, EventArgs e) - { - Debug.Assert(m_strTitle.Length > 0); - Debug.Assert(m_imgIcon != null); - Debug.Assert(m_ilIcons != null); - - GlobalWindowManager.AddWindow(this); - - BannerFactory.CreateBannerEx(this, m_bannerImage, - m_imgIcon, m_strTitle, m_strDescShort); - m_lblText.Text = m_strDescLong; - this.Text = m_strTitle; - this.Icon = Properties.Resources.KeePass; - - if(m_ilIcons != null) m_lvEntries.SmallImageList = m_ilIcons; - else m_ilIcons = new ImageList(); - - List> vColumns = - new List>(); - vColumns.Add(new KeyValuePair(PwDefs.TitleField, KPRes.Title)); - vColumns.Add(new KeyValuePair(PwDefs.UserNameField, KPRes.UserName)); - vColumns.Add(new KeyValuePair(PwDefs.UrlField, KPRes.Url)); - - UIUtil.CreateEntryList(m_lvEntries, m_vEntries, vColumns, m_ilIcons); - - ProcessResize(); - - if(m_bEnsureForeground) - { - this.BringToFront(); - this.Activate(); - } - - EnableControlsEx(); - } - - private void EnableControlsEx() - { - bool bCond = (m_lvEntries.SelectedIndices.Count > 0); - bool bCur = m_btnOK.Enabled; - if(bCond != bCur) m_btnOK.Enabled = bCond; - } - - private void ProcessResize() - { - UIUtil.ResizeColumns(m_lvEntries, true); - } - - private bool GetSelectedEntry(bool bSetDialogResult) - { - ListView.SelectedListViewItemCollection slvic = m_lvEntries.SelectedItems; - if(slvic.Count == 1) - { - m_peSelected = (slvic[0].Tag as PwEntry); - - if(bSetDialogResult) this.DialogResult = DialogResult.OK; - return true; - } - - return false; - } - - private void OnBtnOK(object sender, EventArgs e) - { - if(GetSelectedEntry(false) == false) - this.DialogResult = DialogResult.None; - } - - private void OnBtnCancel(object sender, EventArgs e) - { - } - - private void CleanUpEx() - { - if(m_ilIcons != null) - { - m_lvEntries.SmallImageList = null; // Detach event handlers - m_ilIcons.Dispose(); - m_ilIcons = null; - } - } - - private void OnEntriesItemActivate(object sender, EventArgs e) - { - if(GetSelectedEntry(true)) - m_lvEntries.Enabled = false; - } - - private void OnEntriesSelectedIndexChanged(object sender, EventArgs e) - { - EnableControlsEx(); - - // ListView.SelectedIndexCollection lvsic = m_lvEntries.SelectedIndices; - // if((lvsic != null) && (lvsic.Count == 1)) - // NativeMethods.EnsureVisible(m_lvEntries, lvsic[0], false); - } - - private void OnFormClosed(object sender, FormClosedEventArgs e) - { - CleanUpEx(); - GlobalWindowManager.RemoveWindow(this); - } - } -} diff -Nru keepass2-2.35+dfsg/KeePass/Forms/EntryListForm.Designer.cs keepass2-2.36+dfsg/KeePass/Forms/EntryListForm.Designer.cs --- keepass2-2.35+dfsg/KeePass/Forms/EntryListForm.Designer.cs 2015-03-16 10:34:46.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/EntryListForm.Designer.cs 1970-01-01 00:00:00.000000000 +0000 @@ -1,129 +0,0 @@ -namespace KeePass.Forms -{ - partial class EntryListForm - { - /// - /// Erforderliche Designervariable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Verwendete Ressourcen bereinigen. - /// - /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. - protected override void Dispose(bool disposing) - { - if(disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Vom Windows Form-Designer generierter Code - - /// - /// Erforderliche Methode für die Designerunterstützung. - /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. - /// - private void InitializeComponent() - { - this.m_btnCancel = new System.Windows.Forms.Button(); - this.m_lvEntries = new KeePass.UI.CustomListViewEx(); - this.m_bannerImage = new System.Windows.Forms.PictureBox(); - this.m_lblText = new System.Windows.Forms.Label(); - this.m_btnOK = new System.Windows.Forms.Button(); - ((System.ComponentModel.ISupportInitialize)(this.m_bannerImage)).BeginInit(); - this.SuspendLayout(); - // - // m_btnCancel - // - this.m_btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.m_btnCancel.Location = new System.Drawing.Point(416, 292); - this.m_btnCancel.Name = "m_btnCancel"; - this.m_btnCancel.Size = new System.Drawing.Size(75, 23); - this.m_btnCancel.TabIndex = 2; - this.m_btnCancel.Text = "Cancel"; - this.m_btnCancel.UseVisualStyleBackColor = true; - this.m_btnCancel.Click += new System.EventHandler(this.OnBtnCancel); - // - // m_lvEntries - // - this.m_lvEntries.FullRowSelect = true; - this.m_lvEntries.GridLines = true; - this.m_lvEntries.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; - this.m_lvEntries.HideSelection = false; - this.m_lvEntries.Location = new System.Drawing.Point(12, 104); - this.m_lvEntries.MultiSelect = false; - this.m_lvEntries.Name = "m_lvEntries"; - this.m_lvEntries.ShowItemToolTips = true; - this.m_lvEntries.Size = new System.Drawing.Size(479, 182); - this.m_lvEntries.TabIndex = 0; - this.m_lvEntries.UseCompatibleStateImageBehavior = false; - this.m_lvEntries.View = System.Windows.Forms.View.Details; - this.m_lvEntries.ItemActivate += new System.EventHandler(this.OnEntriesItemActivate); - this.m_lvEntries.SelectedIndexChanged += new System.EventHandler(this.OnEntriesSelectedIndexChanged); - // - // m_bannerImage - // - this.m_bannerImage.Dock = System.Windows.Forms.DockStyle.Top; - this.m_bannerImage.Location = new System.Drawing.Point(0, 0); - this.m_bannerImage.Name = "m_bannerImage"; - this.m_bannerImage.Size = new System.Drawing.Size(503, 60); - this.m_bannerImage.TabIndex = 3; - this.m_bannerImage.TabStop = false; - // - // m_lblText - // - this.m_lblText.Location = new System.Drawing.Point(9, 72); - this.m_lblText.Name = "m_lblText"; - this.m_lblText.Size = new System.Drawing.Size(482, 29); - this.m_lblText.TabIndex = 3; - this.m_lblText.Text = "<>"; - // - // m_btnOK - // - this.m_btnOK.DialogResult = System.Windows.Forms.DialogResult.OK; - this.m_btnOK.Location = new System.Drawing.Point(335, 292); - this.m_btnOK.Name = "m_btnOK"; - this.m_btnOK.Size = new System.Drawing.Size(75, 23); - this.m_btnOK.TabIndex = 1; - this.m_btnOK.Text = "OK"; - this.m_btnOK.UseVisualStyleBackColor = true; - this.m_btnOK.Click += new System.EventHandler(this.OnBtnOK); - // - // EntryListForm - // - this.AcceptButton = this.m_btnOK; - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this.m_btnCancel; - this.ClientSize = new System.Drawing.Size(503, 327); - this.Controls.Add(this.m_btnOK); - this.Controls.Add(this.m_lblText); - this.Controls.Add(this.m_bannerImage); - this.Controls.Add(this.m_lvEntries); - this.Controls.Add(this.m_btnCancel); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "EntryListForm"; - this.ShowInTaskbar = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "<>"; - this.Load += new System.EventHandler(this.OnFormLoad); - this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.OnFormClosed); - ((System.ComponentModel.ISupportInitialize)(this.m_bannerImage)).EndInit(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.Button m_btnCancel; - private KeePass.UI.CustomListViewEx m_lvEntries; - private System.Windows.Forms.PictureBox m_bannerImage; - private System.Windows.Forms.Label m_lblText; - private System.Windows.Forms.Button m_btnOK; - } -} \ No newline at end of file diff -Nru keepass2-2.35+dfsg/KeePass/Forms/EntryListForm.resx keepass2-2.36+dfsg/KeePass/Forms/EntryListForm.resx --- keepass2-2.35+dfsg/KeePass/Forms/EntryListForm.resx 2015-03-16 10:34:46.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/EntryListForm.resx 1970-01-01 00:00:00.000000000 +0000 @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff -Nru keepass2-2.35+dfsg/KeePass/Forms/EntryReportForm.cs keepass2-2.36+dfsg/KeePass/Forms/EntryReportForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/EntryReportForm.cs 2017-01-01 13:33:54.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/EntryReportForm.cs 2017-03-12 17:01:06.000000000 +0000 @@ -24,8 +24,9 @@ using System.Text; using System.Windows.Forms; -using KeePass.UI; +using KeePass.App; using KeePass.Resources; +using KeePass.UI; using KeePassLib; using KeePassLib.Delegates; @@ -51,7 +52,7 @@ private void OnFormLoad(object sender, EventArgs e) { - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; if(!string.IsNullOrEmpty(m_strTitle)) this.Text = m_strTitle; else m_strTitle = PwDefs.ShortProductName; diff -Nru keepass2-2.35+dfsg/KeePass/Forms/ExchangeDataForm.cs keepass2-2.36+dfsg/KeePass/Forms/ExchangeDataForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/ExchangeDataForm.cs 2017-01-01 13:33:54.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/ExchangeDataForm.cs 2017-04-08 17:13:54.000000000 +0000 @@ -20,11 +20,11 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Drawing; +using System.IO; using System.Text; using System.Windows.Forms; -using System.Diagnostics; -using System.IO; using KeePass.App; using KeePass.DataExchange; @@ -100,13 +100,13 @@ Properties.Resources.B48x48_Folder_Download); BannerFactory.CreateBannerEx(this, m_bannerImage, bmpBanner, strWndTitle, strWndDesc); - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; this.Text = strWndTitle; if(m_bExport) { - m_lblFile.Text = KPRes.ExportToPrompt; + UIUtil.SetText(m_lblFile, KPRes.ExportToPrompt); UIUtil.SetButtonImage(m_btnSelFile, Properties.Resources.B16x16_FileSaveAs, false); @@ -115,7 +115,7 @@ } else // Import mode { - m_lblFile.Text = KPRes.ImportFilesPrompt; + UIUtil.SetText(m_lblFile, KPRes.ImportFilesPrompt); UIUtil.SetButtonImage(m_btnSelFile, Properties.Resources.B16x16_Folder_Yellow_Open, false); } diff -Nru keepass2-2.35+dfsg/KeePass/Forms/FieldPickerForm.cs keepass2-2.36+dfsg/KeePass/Forms/FieldPickerForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/FieldPickerForm.cs 2017-01-01 13:33:54.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/FieldPickerForm.cs 2017-03-12 16:59:36.000000000 +0000 @@ -25,6 +25,7 @@ using System.Text; using System.Windows.Forms; +using KeePass.App; using KeePass.Native; using KeePass.Resources; using KeePass.UI; @@ -93,7 +94,7 @@ if(strTitle.Length > 0) strTitleEx += " - "; strTitleEx += PwDefs.ShortProductName; - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; this.Text = strTitleEx; BannerFactory.CreateBannerEx(this, m_bannerImage, diff -Nru keepass2-2.35+dfsg/KeePass/Forms/FieldRefForm.cs keepass2-2.36+dfsg/KeePass/Forms/FieldRefForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/FieldRefForm.cs 2017-01-01 13:33:56.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/FieldRefForm.cs 2017-03-12 16:59:08.000000000 +0000 @@ -20,10 +20,10 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Drawing; using System.Text; using System.Windows.Forms; -using System.Diagnostics; using KeePass.App; using KeePass.Resources; @@ -71,7 +71,7 @@ GlobalWindowManager.AddWindow(this); - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; UIUtil.SetExplorerTheme(m_lvEntries, true); diff -Nru keepass2-2.35+dfsg/KeePass/Forms/FileBrowserForm.cs keepass2-2.36+dfsg/KeePass/Forms/FileBrowserForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/FileBrowserForm.cs 2017-01-01 13:33:56.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/FileBrowserForm.cs 2017-04-09 09:41:06.000000000 +0000 @@ -20,14 +20,15 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Imaging; +using System.IO; using System.Text; using System.Windows.Forms; -using System.IO; -using System.Diagnostics; +using KeePass.App; using KeePass.Native; using KeePass.Resources; using KeePass.UI; @@ -97,7 +98,7 @@ { GlobalWindowManager.AddWindow(this); - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; this.Text = m_strTitle; m_nIconDim = m_tvFolders.ItemHeight; @@ -111,6 +112,7 @@ } m_btnOK.Text = (m_bSaveMode ? KPRes.SaveCmd : KPRes.OpenCmd); + Debug.Assert(!m_lblHint.AutoSize); // For RTL support m_lblHint.Text = m_strHint; if(UIUtil.ColorsEqual(m_lblHint.ForeColor, Color.Black)) diff -Nru keepass2-2.35+dfsg/KeePass/Forms/GroupForm.cs keepass2-2.36+dfsg/KeePass/Forms/GroupForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/GroupForm.cs 2017-01-01 13:33:56.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/GroupForm.cs 2017-03-12 16:57:46.000000000 +0000 @@ -20,14 +20,15 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Drawing; +using System.Globalization; using System.Text; using System.Windows.Forms; -using System.Diagnostics; -using System.Globalization; -using KeePass.UI; +using KeePass.App; using KeePass.Resources; +using KeePass.UI; using KeePassLib; using KeePassLib.Collections; @@ -80,7 +81,7 @@ BannerFactory.CreateBannerEx(this, m_bannerImage, Properties.Resources.B48x48_Folder_Txt, strTitle, (m_bCreatingNew ? KPRes.AddGroupDesc : KPRes.EditGroupDesc)); - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; this.Text = strTitle; UIUtil.SetButtonImage(m_btnAutoTypeEdit, diff -Nru keepass2-2.35+dfsg/KeePass/Forms/HelpSourceForm.cs keepass2-2.36+dfsg/KeePass/Forms/HelpSourceForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/HelpSourceForm.cs 2017-01-01 13:33:56.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/HelpSourceForm.cs 2017-04-09 09:39:30.000000000 +0000 @@ -20,13 +20,14 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Drawing; using System.Text; using System.Windows.Forms; using KeePass.App; -using KeePass.UI; using KeePass.Resources; +using KeePass.UI; namespace KeePass.Forms { @@ -47,13 +48,14 @@ BannerFactory.CreateBannerEx(this, m_bannerImage, Properties.Resources.B48x48_Folder_Download, KPRes.HelpSourceSelection, KPRes.HelpSourceSelectionDesc); - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; this.Text = KPRes.HelpSourceSelection; FontUtil.AssignDefaultBold(m_radioLocal); FontUtil.AssignDefaultBold(m_radioOnline); - if(AppHelp.LocalHelpAvailable == false) + Debug.Assert(!m_lblLocal.AutoSize); // For RTL support + if(!AppHelp.LocalHelpAvailable) { m_radioLocal.Enabled = false; m_lblLocal.Text = KPRes.HelpSourceNoLocalOption; diff -Nru keepass2-2.35+dfsg/KeePass/Forms/IconPickerForm.cs keepass2-2.36+dfsg/KeePass/Forms/IconPickerForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/IconPickerForm.cs 2017-01-01 13:33:56.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/IconPickerForm.cs 2017-03-12 16:56:32.000000000 +0000 @@ -20,12 +20,12 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Drawing; using System.Drawing.Imaging; +using System.IO; using System.Text; using System.Windows.Forms; -using System.Diagnostics; -using System.IO; using KeePass.App; using KeePass.Resources; @@ -80,7 +80,7 @@ GlobalWindowManager.AddWindow(this); - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; FontUtil.AssignDefaultBold(m_radioStandard); FontUtil.AssignDefaultBold(m_radioCustom); diff -Nru keepass2-2.35+dfsg/KeePass/Forms/ImportMethodForm.cs keepass2-2.36+dfsg/KeePass/Forms/ImportMethodForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/ImportMethodForm.cs 2017-01-01 13:33:56.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/ImportMethodForm.cs 2017-03-12 16:55:04.000000000 +0000 @@ -20,13 +20,14 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Drawing; using System.Text; using System.Windows.Forms; -using System.Diagnostics; -using KeePass.UI; +using KeePass.App; using KeePass.Resources; +using KeePass.UI; using KeePassLib; @@ -56,7 +57,7 @@ BannerFactory.CreateBannerEx(this, m_bannerImage, Properties.Resources.B48x48_Folder_Download, KPRes.ImportBehavior, KPRes.ImportBehaviorDesc); - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; this.Text = KPRes.ImportBehavior; diff -Nru keepass2-2.35+dfsg/KeePass/Forms/InternalBrowserForm.cs keepass2-2.36+dfsg/KeePass/Forms/InternalBrowserForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/InternalBrowserForm.cs 2017-01-01 13:33:56.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/InternalBrowserForm.cs 2017-04-10 13:10:36.000000000 +0000 @@ -20,11 +20,12 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Drawing; using System.Text; using System.Windows.Forms; -using System.Diagnostics; +using KeePass.App; using KeePass.UI; using KeePassLib; @@ -53,7 +54,7 @@ { GlobalWindowManager.AddWindow(this); - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; if(m_strInitialUrl.Length > 0) m_webBrowser.Navigate(m_strInitialUrl); diff -Nru keepass2-2.35+dfsg/KeePass/Forms/InternalBrowserForm.Designer.cs keepass2-2.36+dfsg/KeePass/Forms/InternalBrowserForm.Designer.cs --- keepass2-2.35+dfsg/KeePass/Forms/InternalBrowserForm.Designer.cs 2010-03-24 17:05:04.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/InternalBrowserForm.Designer.cs 2017-04-10 13:10:36.000000000 +0000 @@ -62,13 +62,13 @@ this.m_menuFile.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.m_menuFileExit}); this.m_menuFile.Name = "m_menuFile"; - this.m_menuFile.Size = new System.Drawing.Size(35, 20); + this.m_menuFile.Size = new System.Drawing.Size(37, 20); this.m_menuFile.Text = "&File"; // // m_menuFileExit // this.m_menuFileExit.Name = "m_menuFileExit"; - this.m_menuFileExit.Size = new System.Drawing.Size(91, 22); + this.m_menuFileExit.Size = new System.Drawing.Size(92, 22); this.m_menuFileExit.Text = "E&xit"; // // m_statusMain @@ -144,6 +144,7 @@ this.m_btnReload.ImageTransparentColor = System.Drawing.Color.Magenta; this.m_btnReload.Name = "m_btnReload"; this.m_btnReload.Overflow = System.Windows.Forms.ToolStripItemOverflow.Never; + this.m_btnReload.RightToLeftAutoMirrorImage = true; this.m_btnReload.Size = new System.Drawing.Size(23, 22); this.m_btnReload.Text = "&Reload"; this.m_btnReload.Click += new System.EventHandler(this.OnBtnReload); diff -Nru keepass2-2.35+dfsg/KeePass/Forms/IOConnectionForm.cs keepass2-2.36+dfsg/KeePass/Forms/IOConnectionForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/IOConnectionForm.cs 2017-01-01 13:33:56.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/IOConnectionForm.cs 2017-04-08 17:28:12.000000000 +0000 @@ -48,6 +48,7 @@ private bool m_bCanRememberCred = true; private bool m_bTestConnection = false; + private SecureEdit m_secPassword = new SecureEdit(); private List> m_lProps = new List>(); @@ -85,7 +86,7 @@ BannerFactory.CreateBannerEx(this, m_bannerImage, KeePass.Properties.Resources.B48x48_WWW, strTitle, strDesc); - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; this.Text = strTitle; FontUtil.AssignDefaultBold(m_lblUrl); @@ -93,9 +94,11 @@ FontUtil.AssignDefaultBold(m_lblPassword); FontUtil.AssignDefaultBold(m_lblRemember); + m_secPassword.Attach(m_tbPassword, null, true); + m_tbUrl.Text = (m_ioc.IsLocalFile() ? string.Empty : m_ioc.Path); m_tbUserName.Text = m_ioc.UserName; - m_tbPassword.Text = m_ioc.Password; + m_secPassword.SetPassword(StrUtil.Utf8.GetBytes(m_ioc.Password)); m_cmbCredSaveMode.Items.Add(KPRes.CredSaveNone); m_cmbCredSaveMode.Items.Add(KPRes.CredSaveUserOnly); @@ -134,7 +137,7 @@ m_ioc.Path = strUrl; m_ioc.UserName = m_tbUserName.Text; - m_ioc.Password = m_tbPassword.Text; + m_ioc.Password = StrUtil.Utf8.GetString(m_secPassword.ToUtf8()); if(m_cmbCredSaveMode.SelectedIndex == 1) m_ioc.CredSaveMode = IOCredSaveMode.UserNameOnly; @@ -262,6 +265,8 @@ private void OnFormClosed(object sender, FormClosedEventArgs e) { + m_secPassword.Detach(); + GlobalWindowManager.RemoveWindow(this); } @@ -316,6 +321,14 @@ int wCell = (wPanel - (3 * d)) / 2; int xText = d - 1; int xInput = d + wCell + d - 1; + int xGroup = xText; + + if(this.RightToLeft == RightToLeft.Yes) + { + int iTemp = xText; + xText = xInput; + xInput = iTemp; + } int y = 1; int iID = 0; @@ -333,7 +346,7 @@ lblGroup.AutoEllipsis = true; lblGroup.AutoSize = false; lblGroup.Dock = DockStyle.None; - lblGroup.Location = new Point(xText, y); + lblGroup.Location = new Point(xGroup, y); lblGroup.Size = new Size(wGroup, hLabel); lblGroup.Text = strGroup; lblGroup.TextAlign = ContentAlignment.MiddleLeft; diff -Nru keepass2-2.35+dfsg/KeePass/Forms/KeyCreationForm.cs keepass2-2.36+dfsg/KeePass/Forms/KeyCreationForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/KeyCreationForm.cs 2017-01-01 13:33:56.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/KeyCreationForm.cs 2017-04-09 09:36:08.000000000 +0000 @@ -20,13 +20,13 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Imaging; -using System.Text; using System.IO; +using System.Text; using System.Windows.Forms; -using System.Diagnostics; using KeePass.App; using KeePass.App.Configuration; @@ -82,7 +82,7 @@ BannerFactory.CreateBannerEx(this, m_bannerImage, Properties.Resources.B48x48_KGPG_Sign, KPRes.CreateMasterKey, m_ioInfo.GetDisplayName()); - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; this.Text = KPRes.CreateMasterKey; FontUtil.SetDefaultFont(m_cbPassword); @@ -102,6 +102,7 @@ m_ttRect.SetToolTip(m_btnOpenKeyFile, KPRes.KeyFileUseExisting); m_ttRect.SetToolTip(m_tbRepeatPassword, KPRes.PasswordRepeatHint); + Debug.Assert(!m_lblIntro.AutoSize); // For RTL support if(!m_bCreatingNew) m_lblIntro.Text = KPRes.ChangeMasterKeyIntroShort; diff -Nru keepass2-2.35+dfsg/KeePass/Forms/KeyPromptForm.cs keepass2-2.36+dfsg/KeePass/Forms/KeyPromptForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/KeyPromptForm.cs 2017-01-01 13:33:56.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/KeyPromptForm.cs 2017-03-12 16:51:54.000000000 +0000 @@ -20,12 +20,12 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Drawing; -using System.Text; using System.IO; -using System.Windows.Forms; -using System.Diagnostics; +using System.Text; using System.Threading; +using System.Windows.Forms; using KeePass.App; using KeePass.App.Configuration; @@ -37,8 +37,8 @@ using KeePassLib.Delegates; using KeePassLib.Keys; using KeePassLib.Native; -using KeePassLib.Utility; using KeePassLib.Serialization; +using KeePassLib.Utility; namespace KeePass.Forms { @@ -121,7 +121,7 @@ string strBannerDesc = WinUtil.CompactPath(m_ioInfo.Path, 45); BannerFactory.CreateBannerEx(this, m_bannerImage, Properties.Resources.B48x48_KGPG_Key2, strBannerTitle, strBannerDesc); - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; FontUtil.SetDefaultFont(m_cbPassword); FontUtil.AssignDefaultBold(m_cbPassword); diff -Nru keepass2-2.35+dfsg/KeePass/Forms/LanguageForm.cs keepass2-2.36+dfsg/KeePass/Forms/LanguageForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/LanguageForm.cs 2017-01-01 13:33:56.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/LanguageForm.cs 2017-03-12 16:51:04.000000000 +0000 @@ -20,16 +20,16 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Drawing; +using System.IO; using System.Text; using System.Windows.Forms; -using System.IO; -using System.Diagnostics; using KeePass.App; using KeePass.App.Configuration; -using KeePass.UI; using KeePass.Resources; +using KeePass.UI; using KeePass.Util; using KeePass.Util.XmlSerialization; @@ -58,7 +58,7 @@ BannerFactory.CreateBannerEx(this, m_bannerImage, Properties.Resources.B48x48_Keyboard_Layout, KPRes.SelectLanguage, KPRes.SelectLanguageDesc); - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; this.Text = KPRes.SelectLanguage; List lImg = new List(); diff -Nru keepass2-2.35+dfsg/KeePass/Forms/ListViewForm.cs keepass2-2.36+dfsg/KeePass/Forms/ListViewForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/ListViewForm.cs 1970-01-01 00:00:00.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/ListViewForm.cs 2017-05-21 17:14:04.000000000 +0000 @@ -0,0 +1,244 @@ +/* + KeePass Password Safe - The Open-Source Password Manager + Copyright (C) 2003-2017 Dominik Reichl + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Drawing; +using System.Text; +using System.Windows.Forms; + +using KeePass.App; +using KeePass.Native; +using KeePass.Resources; +using KeePass.UI; + +using KeePassLib; +using KeePassLib.Collections; +using KeePassLib.Utility; + +namespace KeePass.Forms +{ + /* public sealed class LvfCommand + { + private readonly string m_strText; + public string Text + { + get { return m_strText; } + } + + private readonly Action m_fAction; + public Action Action + { + get { return m_fAction; } + } + + public LvfCommand(string strText, Action fAction) + { + if(strText == null) throw new ArgumentNullException("strText"); + if(fAction == null) throw new ArgumentNullException("fAction"); + + m_strText = strText; + m_fAction = fAction; + } + } */ + + public partial class ListViewForm : Form + { + private string m_strTitle = string.Empty; + private string m_strSubTitle = string.Empty; + private string m_strInfo = string.Empty; + private Image m_imgIcon = null; + private List m_lData = new List(); + private ImageList m_ilIcons = null; + private Action m_fInit = null; + + private object m_resItem = null; + public object ResultItem + { + get { return m_resItem; } + } + + private object m_resGroup = null; + public object ResultGroup + { + get { return m_resGroup; } + } + + private bool m_bEnsureForeground = false; + public bool EnsureForeground + { + get { return m_bEnsureForeground; } + set { m_bEnsureForeground = value; } + } + + public void InitEx(string strTitle, string strSubTitle, + string strInfo, Image imgIcon, List lData, + ImageList ilIcons, Action fInit) + { + m_strTitle = (strTitle ?? string.Empty); + m_strSubTitle = (strSubTitle ?? string.Empty); + m_strInfo = (strInfo ?? string.Empty); + m_imgIcon = imgIcon; + if(lData != null) m_lData = lData; + + if(ilIcons != null) + m_ilIcons = UIUtil.CloneImageList(ilIcons, true); + + m_fInit = fInit; + } + + public ListViewForm() + { + InitializeComponent(); + Program.Translation.ApplyTo(this); + } + + private void OnFormLoad(object sender, EventArgs e) + { + GlobalWindowManager.AddWindow(this); + + this.Text = m_strTitle; + this.Icon = AppIcons.Default; + + BannerFactory.CreateBannerEx(this, m_bannerImage, + m_imgIcon, m_strTitle, m_strSubTitle); + + Debug.Assert(!m_lblInfo.AutoSize); // For RTL support + m_lblInfo.Text = m_strInfo; + if(m_strInfo.Length == 0) + { + int yLabel = m_lblInfo.Location.Y; + Point ptList = m_lvMain.Location; + Size szList = m_lvMain.Size; + + m_lblInfo.Visible = false; + m_lvMain.Location = new Point(ptList.X, yLabel); + m_lvMain.Size = new Size(szList.Width, szList.Height + + ptList.Y - yLabel); + } + + UIUtil.SetExplorerTheme(m_lvMain, true); + + if(m_ilIcons != null) m_lvMain.SmallImageList = m_ilIcons; + + if(m_fInit != null) + { + try { m_fInit(m_lvMain); } + catch(Exception) { Debug.Assert(false); } + } + + m_lvMain.BeginUpdate(); + + ListViewGroup lvgCur = null; + foreach(object o in m_lData) + { + if(o == null) { Debug.Assert(false); continue; } + + ListViewItem lvi = (o as ListViewItem); + if(lvi != null) + { + // Caller should not care about associations + Debug.Assert(lvi.ListView == null); + Debug.Assert(lvi.Group == null); + + m_lvMain.Items.Add(lvi); + if(lvgCur != null) lvgCur.Items.Add(lvi); + + Debug.Assert(lvi.ListView == m_lvMain); + Debug.Assert(lvi.Group == lvgCur); + continue; + } + + ListViewGroup lvg = (o as ListViewGroup); + if(lvg != null) + { + // Caller should not care about associations + Debug.Assert(lvg.ListView == null); + + m_lvMain.Groups.Add(lvg); + lvgCur = lvg; + + Debug.Assert(lvg.ListView == m_lvMain); + continue; + } + + Debug.Assert(false); // Unknown data type + } + + m_lvMain.EndUpdate(); + + if(m_bEnsureForeground) + { + this.BringToFront(); + this.Activate(); + } + } + + private void CleanUpEx() + { + if(m_ilIcons != null) + { + m_lvMain.SmallImageList = null; // Detach event handlers + m_ilIcons.Dispose(); + m_ilIcons = null; + } + } + + private void OnFormClosed(object sender, FormClosedEventArgs e) + { + CleanUpEx(); + GlobalWindowManager.RemoveWindow(this); + } + + private bool CreateResult() + { + ListView.SelectedListViewItemCollection lvic = m_lvMain.SelectedItems; + if(lvic.Count != 1) { Debug.Assert(false); return false; } + + ListViewItem lvi = lvic[0]; + if(lvi == null) { Debug.Assert(false); return false; } + + m_resItem = lvi.Tag; + m_resGroup = ((lvi.Group != null) ? lvi.Group.Tag : null); + return true; + } + + private void ProcessItemSelection() + { + if(this.DialogResult == DialogResult.OK) return; // Already closing + + if(CreateResult()) this.DialogResult = DialogResult.OK; + } + + private void OnListItemActivate(object sender, EventArgs e) + { + ProcessItemSelection(); + } + + // The item activation handler has a slight delay when clicking an + // item, thus as a performance optimization we additionally handle + // item clicks + private void OnListClick(object sender, EventArgs e) + { + ProcessItemSelection(); + } + } +} diff -Nru keepass2-2.35+dfsg/KeePass/Forms/ListViewForm.Designer.cs keepass2-2.36+dfsg/KeePass/Forms/ListViewForm.Designer.cs --- keepass2-2.35+dfsg/KeePass/Forms/ListViewForm.Designer.cs 1970-01-01 00:00:00.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/ListViewForm.Designer.cs 2017-05-21 14:38:06.000000000 +0000 @@ -0,0 +1,102 @@ +namespace KeePass.Forms +{ + partial class ListViewForm + { + /// + /// Erforderliche Designervariable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Verwendete Ressourcen bereinigen. + /// + /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. + protected override void Dispose(bool disposing) + { + if(disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Vom Windows Form-Designer generierter Code + + /// + /// Erforderliche Methode für die Designerunterstützung. + /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. + /// + private void InitializeComponent() + { + this.m_lvMain = new KeePass.UI.CustomListViewEx(); + this.m_bannerImage = new System.Windows.Forms.PictureBox(); + this.m_lblInfo = new System.Windows.Forms.Label(); + ((System.ComponentModel.ISupportInitialize)(this.m_bannerImage)).BeginInit(); + this.SuspendLayout(); + // + // m_lvMain + // + this.m_lvMain.Activation = System.Windows.Forms.ItemActivation.OneClick; + this.m_lvMain.FullRowSelect = true; + this.m_lvMain.GridLines = true; + this.m_lvMain.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + this.m_lvMain.HideSelection = false; + this.m_lvMain.HotTracking = true; + this.m_lvMain.HoverSelection = true; + this.m_lvMain.Location = new System.Drawing.Point(12, 104); + this.m_lvMain.MultiSelect = false; + this.m_lvMain.Name = "m_lvMain"; + this.m_lvMain.ShowItemToolTips = true; + this.m_lvMain.Size = new System.Drawing.Size(601, 418); + this.m_lvMain.TabIndex = 0; + this.m_lvMain.UseCompatibleStateImageBehavior = false; + this.m_lvMain.View = System.Windows.Forms.View.Details; + this.m_lvMain.ItemActivate += new System.EventHandler(this.OnListItemActivate); + this.m_lvMain.Click += new System.EventHandler(this.OnListClick); + // + // m_bannerImage + // + this.m_bannerImage.Dock = System.Windows.Forms.DockStyle.Top; + this.m_bannerImage.Location = new System.Drawing.Point(0, 0); + this.m_bannerImage.Name = "m_bannerImage"; + this.m_bannerImage.Size = new System.Drawing.Size(625, 60); + this.m_bannerImage.TabIndex = 3; + this.m_bannerImage.TabStop = false; + // + // m_lblInfo + // + this.m_lblInfo.Location = new System.Drawing.Point(9, 72); + this.m_lblInfo.Name = "m_lblInfo"; + this.m_lblInfo.Size = new System.Drawing.Size(604, 29); + this.m_lblInfo.TabIndex = 1; + this.m_lblInfo.Text = "<>"; + // + // ListViewForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(625, 534); + this.Controls.Add(this.m_lblInfo); + this.Controls.Add(this.m_bannerImage); + this.Controls.Add(this.m_lvMain); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "ListViewForm"; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "<>"; + this.Load += new System.EventHandler(this.OnFormLoad); + this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.OnFormClosed); + ((System.ComponentModel.ISupportInitialize)(this.m_bannerImage)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private KeePass.UI.CustomListViewEx m_lvMain; + private System.Windows.Forms.PictureBox m_bannerImage; + private System.Windows.Forms.Label m_lblInfo; + } +} \ No newline at end of file diff -Nru keepass2-2.35+dfsg/KeePass/Forms/ListViewForm.resx keepass2-2.36+dfsg/KeePass/Forms/ListViewForm.resx --- keepass2-2.35+dfsg/KeePass/Forms/ListViewForm.resx 1970-01-01 00:00:00.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/ListViewForm.resx 2017-05-21 14:38:06.000000000 +0000 @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff -Nru keepass2-2.35+dfsg/KeePass/Forms/MainForm.cs keepass2-2.36+dfsg/KeePass/Forms/MainForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/MainForm.cs 2017-01-01 19:11:58.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/MainForm.cs 2017-05-22 20:12:56.000000000 +0000 @@ -45,11 +45,11 @@ using KeePassLib.Collections; using KeePassLib.Cryptography.Cipher; using KeePassLib.Cryptography.PasswordGenerator; +using KeePassLib.Delegates; using KeePassLib.Interfaces; -using KeePassLib.Utility; using KeePassLib.Security; -using KeePassLib.Delegates; using KeePassLib.Serialization; +using KeePassLib.Utility; using NativeLib = KeePassLib.Native.NativeLib; @@ -141,7 +141,7 @@ m_strNeverExpiresText = KPRes.NeverExpires; this.Text = PwDefs.ShortProductName; - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; m_imgFileSaveEnabled = Properties.Resources.B16x16_FileSave; m_imgFileSaveDisabled = Properties.Resources.B16x16_FileSave_Disabled; // m_imgFileSaveAllEnabled = Properties.Resources.B16x16_File_SaveAll; @@ -477,7 +477,7 @@ Debug.Assert((m_toolMain.Height == 25) || DpiUtil.ScalingRequired); m_toolMain.LockHeight(true); - UpdateTrayIcon(); + UpdateTrayIcon(false); UpdateTagsMenu(m_dynShowEntriesByTagsEditMenu, false, false, TagsMenuMode.EnsurePopupOnly); UpdateTagsMenu(m_dynRemoveTag, false, false, TagsMenuMode.EnsurePopupOnly); @@ -1365,7 +1365,7 @@ } AppConfigSerializer.Save(Program.Config); - UpdateTrayIcon(); + UpdateTrayIcon(true); } UIUtil.DestroyForm(ofDlg); @@ -2817,5 +2817,28 @@ { ShowSelectedEntryParentGroup(); } + + private void OnEditFindDupPasswords(object sender, EventArgs e) + { + if(CreateAndShowEntryList(EntryUtil.FindDuplicatePasswords, + KPRes.SearchingOp + "...", Properties.Resources.B48x48_KGPG_Key2, + KPRes.DuplicatePasswords, KPRes.DuplicatePasswordsList, null, false) == 0) + MessageService.ShowInfo(KPRes.DuplicatePasswordsNone); + } + + private void OnEditFindSimPasswords(object sender, EventArgs e) + { + CreateAndShowEntryList(EntryUtil.FindSimilarPasswords, + KPRes.SearchingOp + "...", Properties.Resources.B48x48_KGPG_Key2, + KPRes.SimilarPasswords, KPRes.SimilarPasswordsList, + KPRes.SimilarPasswordsNoDup, true); + } + + private void OnEditPwQualityReport(object sender, EventArgs e) + { + CreateAndShowEntryList(EntryUtil.CreatePwQualityList, + KPRes.SearchingOp + "...", Properties.Resources.B48x48_KOrganizer, + KPRes.PasswordQuality, KPRes.PasswordQualityReport, null, true); + } } } diff -Nru keepass2-2.35+dfsg/KeePass/Forms/MainForm.Designer.cs keepass2-2.36+dfsg/KeePass/Forms/MainForm.Designer.cs --- keepass2-2.35+dfsg/KeePass/Forms/MainForm.Designer.cs 2016-11-24 18:16:54.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/MainForm.Designer.cs 2017-05-21 13:49:18.000000000 +0000 @@ -66,6 +66,7 @@ this.m_ctxEntrySaveAttachedFiles = new System.Windows.Forms.ToolStripMenuItem(); this.m_ctxEntrySep0 = new System.Windows.Forms.ToolStripSeparator(); this.m_ctxEntryPerformAutoType = new System.Windows.Forms.ToolStripMenuItem(); + this.m_ctxEntryAutoTypeAdv = new System.Windows.Forms.ToolStripMenuItem(); this.m_ctxEntrySep1 = new System.Windows.Forms.ToolStripSeparator(); this.m_ctxEntryAdd = new System.Windows.Forms.ToolStripMenuItem(); this.m_ctxEntryEdit = new System.Windows.Forms.ToolStripMenuItem(); @@ -138,6 +139,7 @@ this.m_menuEdit = new System.Windows.Forms.ToolStripMenuItem(); this.m_menuEditShowEntries = new System.Windows.Forms.ToolStripMenuItem(); this.m_menuEditShowAll = new System.Windows.Forms.ToolStripMenuItem(); + this.m_menuEditShowParentGroup = new System.Windows.Forms.ToolStripMenuItem(); this.m_menuEditShowSep0 = new System.Windows.Forms.ToolStripSeparator(); this.m_menuEditShowExp = new System.Windows.Forms.ToolStripMenuItem(); this.m_menuEditShowExp1 = new System.Windows.Forms.ToolStripMenuItem(); @@ -149,7 +151,8 @@ this.m_menuEditShowExp56 = new System.Windows.Forms.ToolStripMenuItem(); this.m_menuEditShowExpInF = new System.Windows.Forms.ToolStripMenuItem(); this.m_menuEditShowSep1 = new System.Windows.Forms.ToolStripSeparator(); - this.m_menuEditShowParentGroup = new System.Windows.Forms.ToolStripMenuItem(); + this.m_menuEditFindDupPasswords = new System.Windows.Forms.ToolStripMenuItem(); + this.m_menuEditPwQualityReport = new System.Windows.Forms.ToolStripMenuItem(); this.m_menuEditShowByTag = new System.Windows.Forms.ToolStripMenuItem(); this.m_menuEditSep0 = new System.Windows.Forms.ToolStripSeparator(); this.m_menuEditFind = new System.Windows.Forms.ToolStripMenuItem(); @@ -246,7 +249,7 @@ this.m_tvGroups = new KeePass.UI.CustomTreeViewEx(); this.m_lvEntries = new KeePass.UI.CustomListViewEx(); this.m_richEntryView = new KeePass.UI.CustomRichTextBoxEx(); - this.m_ctxEntryAutoTypeAdv = new System.Windows.Forms.ToolStripMenuItem(); + this.m_menuEditFindSimPasswords = new System.Windows.Forms.ToolStripMenuItem(); this.m_ctxGroupList.SuspendLayout(); this.m_ctxPwList.SuspendLayout(); this.m_menuMain.SuspendLayout(); @@ -286,7 +289,7 @@ this.m_ctxGroupAdd.Image = global::KeePass.Properties.Resources.B16x16_Folder_New_Ex; this.m_ctxGroupAdd.Name = "m_ctxGroupAdd"; this.m_ctxGroupAdd.Size = new System.Drawing.Size(177, 22); - this.m_ctxGroupAdd.Text = "Add &Group"; + this.m_ctxGroupAdd.Text = "Add &Group..."; this.m_ctxGroupAdd.Click += new System.EventHandler(this.OnGroupsAdd); // // m_ctxGroupSep0 @@ -299,7 +302,7 @@ this.m_ctxGroupEdit.Image = global::KeePass.Properties.Resources.B16x16_Folder_Txt; this.m_ctxGroupEdit.Name = "m_ctxGroupEdit"; this.m_ctxGroupEdit.Size = new System.Drawing.Size(177, 22); - this.m_ctxGroupEdit.Text = "Ed&it Group"; + this.m_ctxGroupEdit.Text = "Ed&it Group..."; this.m_ctxGroupEdit.Click += new System.EventHandler(this.OnGroupsEdit); // // m_ctxGroupDuplicate @@ -423,6 +426,7 @@ // this.m_ctxGroupSort.Image = global::KeePass.Properties.Resources.B16x16_KaboodleLoop; this.m_ctxGroupSort.Name = "m_ctxGroupSort"; + this.m_ctxGroupSort.RightToLeftAutoMirrorImage = true; this.m_ctxGroupSort.Size = new System.Drawing.Size(199, 22); this.m_ctxGroupSort.Text = "&Sort Direct Subgroups"; this.m_ctxGroupSort.Click += new System.EventHandler(this.OnGroupsSort); @@ -431,6 +435,7 @@ // this.m_ctxGroupSortRec.Image = global::KeePass.Properties.Resources.B16x16_KaboodleLoop; this.m_ctxGroupSortRec.Name = "m_ctxGroupSortRec"; + this.m_ctxGroupSortRec.RightToLeftAutoMirrorImage = true; this.m_ctxGroupSortRec.Size = new System.Drawing.Size(199, 22); this.m_ctxGroupSortRec.Text = "Sort &Recursively"; this.m_ctxGroupSortRec.Click += new System.EventHandler(this.OnGroupsSortRec); @@ -479,7 +484,7 @@ this.m_ctxEntryClipboard, this.m_ctxEntryRearrangePopup}); this.m_ctxPwList.Name = "m_ctxPwList"; - this.m_ctxPwList.Size = new System.Drawing.Size(209, 396); + this.m_ctxPwList.Size = new System.Drawing.Size(209, 374); this.m_ctxPwList.Opening += new System.ComponentModel.CancelEventHandler(this.OnCtxPwListOpening); // // m_ctxEntryCopyUserName @@ -573,6 +578,12 @@ this.m_ctxEntryPerformAutoType.Text = "Perform Auto-&Type"; this.m_ctxEntryPerformAutoType.Click += new System.EventHandler(this.OnEntryPerformAutoType); // + // m_ctxEntryAutoTypeAdv + // + this.m_ctxEntryAutoTypeAdv.Name = "m_ctxEntryAutoTypeAdv"; + this.m_ctxEntryAutoTypeAdv.Size = new System.Drawing.Size(208, 22); + this.m_ctxEntryAutoTypeAdv.Text = "Perform Auto-Type"; + // // m_ctxEntrySep1 // this.m_ctxEntrySep1.Name = "m_ctxEntrySep1"; @@ -1071,6 +1082,7 @@ // this.m_menuFileSyncFile.Image = global::KeePass.Properties.Resources.B16x16_Reload_Page; this.m_menuFileSyncFile.Name = "m_menuFileSyncFile"; + this.m_menuFileSyncFile.RightToLeftAutoMirrorImage = true; this.m_menuFileSyncFile.Size = new System.Drawing.Size(197, 22); this.m_menuFileSyncFile.Text = "Synchronize with &File..."; this.m_menuFileSyncFile.Click += new System.EventHandler(this.OnFileSynchronize); @@ -1079,6 +1091,7 @@ // this.m_menuFileSyncUrl.Image = global::KeePass.Properties.Resources.B16x16_Reload_Page; this.m_menuFileSyncUrl.Name = "m_menuFileSyncUrl"; + this.m_menuFileSyncUrl.RightToLeftAutoMirrorImage = true; this.m_menuFileSyncUrl.Size = new System.Drawing.Size(197, 22); this.m_menuFileSyncUrl.Text = "Synchronize with &URL..."; this.m_menuFileSyncUrl.Click += new System.EventHandler(this.OnFileSynchronizeUrl); @@ -1139,6 +1152,7 @@ // this.m_menuEditShowEntries.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.m_menuEditShowAll, + this.m_menuEditShowParentGroup, this.m_menuEditShowSep0, this.m_menuEditShowExp, this.m_menuEditShowExp1, @@ -1150,7 +1164,9 @@ this.m_menuEditShowExp56, this.m_menuEditShowExpInF, this.m_menuEditShowSep1, - this.m_menuEditShowParentGroup}); + this.m_menuEditFindDupPasswords, + this.m_menuEditFindSimPasswords, + this.m_menuEditPwQualityReport}); this.m_menuEditShowEntries.Name = "m_menuEditShowEntries"; this.m_menuEditShowEntries.Size = new System.Drawing.Size(179, 22); this.m_menuEditShowEntries.Text = "&Show Entries"; @@ -1159,20 +1175,28 @@ // this.m_menuEditShowAll.Image = global::KeePass.Properties.Resources.B16x16_KGPG_Key3; this.m_menuEditShowAll.Name = "m_menuEditShowAll"; - this.m_menuEditShowAll.Size = new System.Drawing.Size(192, 22); + this.m_menuEditShowAll.Size = new System.Drawing.Size(217, 22); this.m_menuEditShowAll.Text = "&All"; this.m_menuEditShowAll.Click += new System.EventHandler(this.OnEditShowAll); // + // m_menuEditShowParentGroup + // + this.m_menuEditShowParentGroup.Image = global::KeePass.Properties.Resources.B16x16_Folder_Blue_Open; + this.m_menuEditShowParentGroup.Name = "m_menuEditShowParentGroup"; + this.m_menuEditShowParentGroup.Size = new System.Drawing.Size(217, 22); + this.m_menuEditShowParentGroup.Text = "Selected Entry\'s Group"; + this.m_menuEditShowParentGroup.Click += new System.EventHandler(this.OnEditShowParentGroup); + // // m_menuEditShowSep0 // this.m_menuEditShowSep0.Name = "m_menuEditShowSep0"; - this.m_menuEditShowSep0.Size = new System.Drawing.Size(189, 6); + this.m_menuEditShowSep0.Size = new System.Drawing.Size(214, 6); // // m_menuEditShowExp // this.m_menuEditShowExp.Image = global::KeePass.Properties.Resources.B16x16_History_Clear; this.m_menuEditShowExp.Name = "m_menuEditShowExp"; - this.m_menuEditShowExp.Size = new System.Drawing.Size(192, 22); + this.m_menuEditShowExp.Size = new System.Drawing.Size(217, 22); this.m_menuEditShowExp.Text = "E&xpired"; this.m_menuEditShowExp.Click += new System.EventHandler(this.OnEditShowExp); // @@ -1180,7 +1204,7 @@ // this.m_menuEditShowExp1.Image = global::KeePass.Properties.Resources.B16x16_History_Clear; this.m_menuEditShowExp1.Name = "m_menuEditShowExp1"; - this.m_menuEditShowExp1.Size = new System.Drawing.Size(192, 22); + this.m_menuEditShowExp1.Size = new System.Drawing.Size(217, 22); this.m_menuEditShowExp1.Text = "Expiring in &1 Day"; this.m_menuEditShowExp1.Click += new System.EventHandler(this.OnEditShowExp1); // @@ -1188,7 +1212,7 @@ // this.m_menuEditShowExp2.Image = global::KeePass.Properties.Resources.B16x16_History_Clear; this.m_menuEditShowExp2.Name = "m_menuEditShowExp2"; - this.m_menuEditShowExp2.Size = new System.Drawing.Size(192, 22); + this.m_menuEditShowExp2.Size = new System.Drawing.Size(217, 22); this.m_menuEditShowExp2.Text = "Expiring in &2 Days"; this.m_menuEditShowExp2.Click += new System.EventHandler(this.OnEditShowExp2); // @@ -1196,7 +1220,7 @@ // this.m_menuEditShowExp3.Image = global::KeePass.Properties.Resources.B16x16_History_Clear; this.m_menuEditShowExp3.Name = "m_menuEditShowExp3"; - this.m_menuEditShowExp3.Size = new System.Drawing.Size(192, 22); + this.m_menuEditShowExp3.Size = new System.Drawing.Size(217, 22); this.m_menuEditShowExp3.Text = "Expiring in &3 Days"; this.m_menuEditShowExp3.Click += new System.EventHandler(this.OnEditShowExp3); // @@ -1204,7 +1228,7 @@ // this.m_menuEditShowExp7.Image = global::KeePass.Properties.Resources.B16x16_History_Clear; this.m_menuEditShowExp7.Name = "m_menuEditShowExp7"; - this.m_menuEditShowExp7.Size = new System.Drawing.Size(192, 22); + this.m_menuEditShowExp7.Size = new System.Drawing.Size(217, 22); this.m_menuEditShowExp7.Text = "Expiring in 1 &Week"; this.m_menuEditShowExp7.Click += new System.EventHandler(this.OnEditShowExp7); // @@ -1212,7 +1236,7 @@ // this.m_menuEditShowExp14.Image = global::KeePass.Properties.Resources.B16x16_History_Clear; this.m_menuEditShowExp14.Name = "m_menuEditShowExp14"; - this.m_menuEditShowExp14.Size = new System.Drawing.Size(192, 22); + this.m_menuEditShowExp14.Size = new System.Drawing.Size(217, 22); this.m_menuEditShowExp14.Text = "Expiring in 2 W&eeks"; this.m_menuEditShowExp14.Click += new System.EventHandler(this.OnEditShowExp14); // @@ -1220,7 +1244,7 @@ // this.m_menuEditShowExp28.Image = global::KeePass.Properties.Resources.B16x16_History_Clear; this.m_menuEditShowExp28.Name = "m_menuEditShowExp28"; - this.m_menuEditShowExp28.Size = new System.Drawing.Size(192, 22); + this.m_menuEditShowExp28.Size = new System.Drawing.Size(217, 22); this.m_menuEditShowExp28.Text = "Expiring in 4 Wee&ks"; this.m_menuEditShowExp28.Click += new System.EventHandler(this.OnEditShowExp28); // @@ -1228,7 +1252,7 @@ // this.m_menuEditShowExp56.Image = global::KeePass.Properties.Resources.B16x16_History_Clear; this.m_menuEditShowExp56.Name = "m_menuEditShowExp56"; - this.m_menuEditShowExp56.Size = new System.Drawing.Size(192, 22); + this.m_menuEditShowExp56.Size = new System.Drawing.Size(217, 22); this.m_menuEditShowExp56.Text = "Expiring in 8 Week&s"; this.m_menuEditShowExp56.Click += new System.EventHandler(this.OnEditShowExp56); // @@ -1236,22 +1260,30 @@ // this.m_menuEditShowExpInF.Image = global::KeePass.Properties.Resources.B16x16_History_Clear; this.m_menuEditShowExpInF.Name = "m_menuEditShowExpInF"; - this.m_menuEditShowExpInF.Size = new System.Drawing.Size(192, 22); + this.m_menuEditShowExpInF.Size = new System.Drawing.Size(217, 22); this.m_menuEditShowExpInF.Text = "Expiring in the &Future"; this.m_menuEditShowExpInF.Click += new System.EventHandler(this.OnEditShowExpInF); // // m_menuEditShowSep1 // this.m_menuEditShowSep1.Name = "m_menuEditShowSep1"; - this.m_menuEditShowSep1.Size = new System.Drawing.Size(189, 6); + this.m_menuEditShowSep1.Size = new System.Drawing.Size(214, 6); // - // m_menuEditShowParentGroup + // m_menuEditFindDupPasswords // - this.m_menuEditShowParentGroup.Image = global::KeePass.Properties.Resources.B16x16_Folder_Blue_Open; - this.m_menuEditShowParentGroup.Name = "m_menuEditShowParentGroup"; - this.m_menuEditShowParentGroup.Size = new System.Drawing.Size(192, 22); - this.m_menuEditShowParentGroup.Text = "Selected Entry\'s Group"; - this.m_menuEditShowParentGroup.Click += new System.EventHandler(this.OnEditShowParentGroup); + this.m_menuEditFindDupPasswords.Image = global::KeePass.Properties.Resources.B16x16_KGPG_Key2; + this.m_menuEditFindDupPasswords.Name = "m_menuEditFindDupPasswords"; + this.m_menuEditFindDupPasswords.Size = new System.Drawing.Size(217, 22); + this.m_menuEditFindDupPasswords.Text = "Find &Duplicate Passwords..."; + this.m_menuEditFindDupPasswords.Click += new System.EventHandler(this.OnEditFindDupPasswords); + // + // m_menuEditPwQualityReport + // + this.m_menuEditPwQualityReport.Image = global::KeePass.Properties.Resources.B16x16_KOrganizer; + this.m_menuEditPwQualityReport.Name = "m_menuEditPwQualityReport"; + this.m_menuEditPwQualityReport.Size = new System.Drawing.Size(217, 22); + this.m_menuEditPwQualityReport.Text = "Password &Quality Report..."; + this.m_menuEditPwQualityReport.Click += new System.EventHandler(this.OnEditPwQualityReport); // // m_menuEditShowByTag // @@ -1906,6 +1938,7 @@ // // m_statusClipboard // + this.m_statusClipboard.AutoSize = false; this.m_statusClipboard.Name = "m_statusClipboard"; this.m_statusClipboard.Size = new System.Drawing.Size(100, 16); this.m_statusClipboard.Style = System.Windows.Forms.ProgressBarStyle.Continuous; @@ -2098,11 +2131,13 @@ this.m_richEntryView.LinkClicked += new System.Windows.Forms.LinkClickedEventHandler(this.OnEntryViewLinkClicked); this.m_richEntryView.KeyUp += new System.Windows.Forms.KeyEventHandler(this.OnEntryViewKeyUp); // - // m_ctxEntryAutoTypeAdv + // m_menuEditFindSimPasswords // - this.m_ctxEntryAutoTypeAdv.Name = "m_ctxEntryAutoTypeAdv"; - this.m_ctxEntryAutoTypeAdv.Size = new System.Drawing.Size(208, 22); - this.m_ctxEntryAutoTypeAdv.Text = "Perform Auto-Type"; + this.m_menuEditFindSimPasswords.Image = global::KeePass.Properties.Resources.B16x16_KGPG_Key2; + this.m_menuEditFindSimPasswords.Name = "m_menuEditFindSimPasswords"; + this.m_menuEditFindSimPasswords.Size = new System.Drawing.Size(217, 22); + this.m_menuEditFindSimPasswords.Text = "F&ind Similar Passwords..."; + this.m_menuEditFindSimPasswords.Click += new System.EventHandler(this.OnEditFindSimPasswords); // // MainForm // @@ -2364,6 +2399,9 @@ private System.Windows.Forms.ToolStripMenuItem m_menuEditShowParentGroup; private System.Windows.Forms.ToolStripMenuItem m_ctxEntryShowParentGroup; private System.Windows.Forms.ToolStripMenuItem m_ctxEntryAutoTypeAdv; + private System.Windows.Forms.ToolStripMenuItem m_menuEditFindDupPasswords; + private System.Windows.Forms.ToolStripMenuItem m_menuEditPwQualityReport; + private System.Windows.Forms.ToolStripMenuItem m_menuEditFindSimPasswords; } } diff -Nru keepass2-2.35+dfsg/KeePass/Forms/MainForm_Functions.cs keepass2-2.36+dfsg/KeePass/Forms/MainForm_Functions.cs --- keepass2-2.35+dfsg/KeePass/Forms/MainForm_Functions.cs 2017-01-01 19:10:02.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/MainForm_Functions.cs 2017-06-06 14:22:46.000000000 +0000 @@ -18,16 +18,17 @@ */ using System; -using System.Text; -using System.Text.RegularExpressions; -using System.Drawing; using System.Collections; using System.Collections.Generic; -using System.Windows.Forms; +using System.Diagnostics; +using System.Drawing; using System.IO; +using System.Text; +using System.Text.RegularExpressions; using System.Threading; +using System.Windows.Forms; +using System.Xml; using System.Xml.Serialization; -using System.Diagnostics; using KeePass.App; using KeePass.App.Configuration; @@ -48,9 +49,9 @@ using KeePassLib.Delegates; using KeePassLib.Interfaces; using KeePassLib.Keys; -using KeePassLib.Utility; using KeePassLib.Security; using KeePassLib.Serialization; +using KeePassLib.Utility; namespace KeePass.Forms { @@ -119,12 +120,12 @@ private List m_lStdClientImages = null; private ImageList m_ilCurrentIcons = null; - private KeyValuePair m_kvpIcoMain = - new KeyValuePair(Color.Empty, null); - private KeyValuePair m_kvpIcoTrayNormal = - new KeyValuePair(Color.Empty, null); - private KeyValuePair m_kvpIcoTrayLocked = - new KeyValuePair(Color.Empty, null); + // private KeyValuePair m_kvpIcoMain = + // new KeyValuePair(Color.Empty, null); + // private KeyValuePair m_kvpIcoTrayNormal = + // new KeyValuePair(Color.Empty, null); + // private KeyValuePair m_kvpIcoTrayLocked = + // new KeyValuePair(Color.Empty, null); private List m_lTabImages = new List(); private ImageList m_ilTabImages = null; @@ -411,7 +412,7 @@ string strWindowText = PwDefs.ShortProductName; string strNtfText = PwDefs.ShortProductName; - int qSmall = UIUtil.GetSmallIconSize(32, 32).Width; + // int qSmall = UIUtil.GetSmallIconSize().Width; if(s.FileLocked) { @@ -437,22 +438,24 @@ else { Debug.Assert(false); } strNtfText = strNtfPre + strFileDesc; - Icon icoDisposable, icoAssignable; - CreateColorizedIcon(Properties.Resources.QuadLocked, qSmall, - ref m_kvpIcoTrayLocked, out icoAssignable, out icoDisposable); - m_ntfTray.Icon = icoAssignable; - if(icoDisposable != null) icoDisposable.Dispose(); + // Icon icoDisposable, icoAssignable; + // CreateColorizedIcon(Properties.Resources.QuadLocked, qSmall, + // ref m_kvpIcoTrayLocked, out icoAssignable, out icoDisposable); + // m_ntfTray.Icon = icoAssignable; + // if(icoDisposable != null) icoDisposable.Dispose(); + m_ntfTray.Icon = CreateColorizedIcon(AppIconType.QuadLocked, true); TaskbarList.SetOverlayIcon(this, Properties.Resources.LockOverlay, KPRes.Locked); } - else if(s.DatabaseOpened == false) + else if(!s.DatabaseOpened) { - Icon icoDisposable, icoAssignable; - CreateColorizedIcon(Properties.Resources.QuadNormal, qSmall, - ref m_kvpIcoTrayNormal, out icoAssignable, out icoDisposable); - m_ntfTray.Icon = icoAssignable; - if(icoDisposable != null) icoDisposable.Dispose(); + // Icon icoDisposable, icoAssignable; + // CreateColorizedIcon(Properties.Resources.QuadNormal, qSmall, + // ref m_kvpIcoTrayNormal, out icoAssignable, out icoDisposable); + // m_ntfTray.Icon = icoAssignable; + // if(icoDisposable != null) icoDisposable.Dispose(); + m_ntfTray.Icon = CreateColorizedIcon(AppIconType.QuadNormal, true); TaskbarList.SetOverlayIcon(this, null, string.Empty); } @@ -471,11 +474,12 @@ strNtfText = strNtfPre + WinUtil.CompactPath( m_docMgr.ActiveDatabase.IOConnectionInfo.Path, 63 - strNtfPre.Length); - Icon icoDisposable, icoAssignable; - CreateColorizedIcon(Properties.Resources.QuadNormal, qSmall, - ref m_kvpIcoTrayNormal, out icoAssignable, out icoDisposable); - m_ntfTray.Icon = icoAssignable; - if(icoDisposable != null) icoDisposable.Dispose(); + // Icon icoDisposable, icoAssignable; + // CreateColorizedIcon(Properties.Resources.QuadNormal, qSmall, + // ref m_kvpIcoTrayNormal, out icoAssignable, out icoDisposable); + // m_ntfTray.Icon = icoAssignable; + // if(icoDisposable != null) icoDisposable.Dispose(); + m_ntfTray.Icon = CreateColorizedIcon(AppIconType.QuadNormal, true); TaskbarList.SetOverlayIcon(this, null, string.Empty); } @@ -496,11 +500,12 @@ strNtfText = StrUtil.EncodeToolTipText(strNtfText); m_ntfTray.Text = StrUtil.CompactString3Dots(strNtfText, 63); - Icon icoToDispose, icoToAssign; - if(CreateColorizedIcon(Properties.Resources.KeePass, 0, - ref m_kvpIcoMain, out icoToAssign, out icoToDispose)) - this.Icon = icoToAssign; - if(icoToDispose != null) icoToDispose.Dispose(); + // Icon icoToDispose, icoToAssign; + // if(CreateColorizedIcon(Properties.Resources.KeePass, 0, + // ref m_kvpIcoMain, out icoToAssign, out icoToDispose)) + // this.Icon = icoToAssign; + // if(icoToDispose != null) icoToDispose.Dispose(); + this.Icon = CreateColorizedIcon(AppIconType.Main, false); // Main menu UIUtil.SetEnabledFast(s.DatabaseOpened, m_menuFileSaveAs, @@ -519,6 +524,8 @@ m_menuEditShowExp2, m_menuEditShowExp3, m_menuEditShowExp7, m_menuEditShowExp14, m_menuEditShowExp28, m_menuEditShowExp56, m_menuEditShowExpInF); + UIUtil.SetEnabledFast(s.DatabaseOpened, m_menuEditFindDupPasswords, + m_menuEditFindSimPasswords, m_menuEditPwQualityReport); UIUtil.SetEnabledFast((s.EntriesSelected == 1), m_menuEditShowParentGroup); UIUtil.SetEnabledFast(s.DatabaseOpened, m_menuToolsDbMaintenance, m_menuToolsDbDelDupEntries, m_menuToolsDbDelEmptyGroups, @@ -536,18 +543,22 @@ UIUtil.SetEnabledFast(s.DatabaseOpened, m_tbFind, m_tbViewsShowAll, m_tbViewsShowExpired, m_tbEntryViewsDropDown); + Image imgSave; + bool bEnableSave; if(Program.Config.MainWindow.DisableSaveIfNotModified) { - m_tbSaveDatabase.Image = m_imgFileSaveEnabled; - UIUtil.SetEnabledFast((s.DatabaseOpened && m_docMgr.ActiveDatabase.Modified), - m_menuFileSave, m_tbSaveDatabase); + imgSave = m_imgFileSaveEnabled; + bEnableSave = (s.DatabaseOpened && m_docMgr.ActiveDatabase.Modified); } else { - m_tbSaveDatabase.Image = (m_docMgr.ActiveDatabase.Modified ? + imgSave = (m_docMgr.ActiveDatabase.Modified ? m_imgFileSaveEnabled : m_imgFileSaveDisabled); - UIUtil.SetEnabledFast(s.DatabaseOpened, m_menuFileSave, m_tbSaveDatabase); + bEnableSave = s.DatabaseOpened; } + m_menuFileSave.Image = imgSave; + m_tbSaveDatabase.Image = imgSave; + UIUtil.SetEnabledFast(bEnableSave, m_menuFileSave, m_tbSaveDatabase); m_tbQuickFind.Enabled = s.DatabaseOpened; @@ -1741,6 +1752,10 @@ case AceColumnType.HistoryCount: EditSelectedEntry(true); break; + case AceColumnType.LastPasswordModTime: + bCnt = ClipboardUtil.CopyAndMinimize(TimeUtil.ToDisplayString( + EntryUtil.GetLastPasswordModTime(pe)), true, this, pe, null); + break; default: Debug.Assert(false); break; @@ -1938,6 +1953,7 @@ EntryHandler eh = delegate(PwEntry pe) { if(!pe.Expires) return true; + if(!pe.GetSearchingEnabled()) return true; if(PwDefs.IsTanEntry(pe)) return true; // Exclude TANs int iRelNow = pe.ExpiryTime.CompareTo(dtNow); @@ -1945,7 +1961,7 @@ if((bExpInP && (iRelNow <= 0)) || (bExpInD && (pe.ExpiryTime <= dtLimit) && (iRelNow > 0)) || (bExpInF && (iRelNow > 0))) - pg.AddEntry(pe, false); + pg.AddEntry(pe, false, false); return true; }; @@ -2217,9 +2233,30 @@ } UpdateColumnSortingIcons(); - if(((pwOpenedDb.MasterKeyChangeForce >= 0) && - ((DateTime.UtcNow - pwOpenedDb.MasterKeyChanged).Days >= - pwOpenedDb.MasterKeyChangeForce)) || pwOpenedDb.MasterKeyChangeForceOnce) + long lMkDays = (DateTime.UtcNow - pwOpenedDb.MasterKeyChanged).Days; + bool bMkChangeForce = ((pwOpenedDb.MasterKeyChangeForce >= 0) && + (lMkDays >= pwOpenedDb.MasterKeyChangeForce)); + bMkChangeForce |= pwOpenedDb.MasterKeyChangeForceOnce; + + bool bMkChangeRec = ((pwOpenedDb.MasterKeyChangeRec >= 0) && + (lMkDays >= pwOpenedDb.MasterKeyChangeRec)); + string strMkExpiry = Program.Config.Security.MasterKeyExpiryRec; + if(!string.IsNullOrEmpty(strMkExpiry)) + { + try + { + DateTime dtExpiry = XmlConvert.ToDateTime(strMkExpiry, + XmlDateTimeSerializationMode.Utc); + bMkChangeRec |= (pwOpenedDb.MasterKeyChanged < dtExpiry); + } + catch(Exception exDate) + { + MessageService.ShowWarning("Configuration/Security/MasterKeyExpiryRec:", + exDate.Message); + } + } + + if(bMkChangeForce) { // Updating the UI might trigger an auto-save pwOpenedDb.MasterKeyChangeForceOnce = false; @@ -2237,9 +2274,7 @@ if(!AppPolicy.Current.ChangeMasterKey) break; // Prevent endless loop } } - else if((pwOpenedDb.MasterKeyChangeRec >= 0) && - ((DateTime.UtcNow - pwOpenedDb.MasterKeyChanged).Days >= - pwOpenedDb.MasterKeyChangeRec)) + else if(bMkChangeRec) { if(MessageService.AskYesNo(pwOpenedDb.IOConnectionInfo.GetDisplayName() + MessageService.NewParagraph + KPRes.MasterKeyChangeRec + @@ -2531,11 +2566,14 @@ m_mruList.Clear(); } - /// - /// Function to update the tray icon based on the current window state. - /// + // For plugins public void UpdateTrayIcon() { + UpdateTrayIcon(true); + } + + private void UpdateTrayIcon(bool bRefreshIcon) + { if(m_ntfTray == null) { Debug.Assert(false); return; } // Required bool bWindowVisible = this.Visible; @@ -2545,6 +2583,8 @@ m_ntfTray.Visible = !bWindowVisible; else if(bWindowVisible && !bTrayVisible) m_ntfTray.Visible = true; + + if(bRefreshIcon) m_ntfTray.RefreshShellIcon(); } private void OnSessionLock(object sender, SessionLockEventArgs e) @@ -2637,7 +2677,9 @@ DateTime dtNow = DateTime.UtcNow; foreach(PwEntry peUpd in vEntries) peUpd.LocationChanged = dtNow; - m_lvEntries.BeginUpdate(); + // Blocking prevents correct scrolling when groups are enabled + // and the scroll position is near the end + // m_lvEntries.BeginUpdate(); bool bScrollOne = ((Math.Abs(iMove) == 1) && !UIUtil.GetGroupsEnabled(m_lvEntries)); @@ -2686,7 +2728,7 @@ UpdateEntryList(null, false); EnsureVisibleSelected(iMove > 0); // In all cases - m_lvEntries.EndUpdate(); + // m_lvEntries.EndUpdate(); UpdateUIState(true); } @@ -2771,12 +2813,12 @@ } else if(m.Msg == DwmUtil.WM_DWMSENDICONICTHUMBNAIL) { - DwmUtil.SetIconicThumbnail(this, Properties.Resources.KeePass, ref m); + DwmUtil.SetIconicThumbnail(this, AppIcons.Default, ref m); return; } else if(m.Msg == DwmUtil.WM_DWMSENDICONICLIVEPREVIEWBITMAP) { - DwmUtil.SetIconicPreview(this, Properties.Resources.KeePass, ref m); + DwmUtil.SetIconicPreview(this, AppIcons.Default, ref m); return; } @@ -3875,7 +3917,7 @@ ResetDefaultFocus(null); } - UpdateTrayIcon(); + UpdateTrayIcon(false); } private bool GetStartMinimized() @@ -4875,6 +4917,9 @@ uint uc = pe.Binaries.UCount; str = ((uc > 0) ? uc.ToString() : string.Empty); break; + case AceColumnType.LastPasswordModTime: + str = TimeUtil.ToDisplayString(EntryUtil.GetLastPasswordModTime(pe)); + break; default: Debug.Assert(false); str = string.Empty; break; } @@ -5197,7 +5242,7 @@ UpdateUI(false, null, true, null, false, null, true); } - private bool CreateColorizedIcon(Icon icoBase, int qSize, + /* private bool CreateColorizedIcon(Icon icoBase, int qSize, ref KeyValuePair kvpStore, out Icon icoAssignable, out Icon icoDisposable) { @@ -5227,6 +5272,18 @@ } return true; + } */ + + private Icon CreateColorizedIcon(AppIconType t, bool bSmall) + { + PwDatabase pd = m_docMgr.ActiveDatabase; + Color clr = Color.Empty; + if((pd == null) || !pd.IsOpen || pd.Color.IsEmpty || (pd.Color.A < 255)) { } + else clr = pd.Color; + + Size sz = (bSmall ? UIUtil.GetSmallIconSize() : UIUtil.GetIconSize()); + + return AppIcons.Get(t, sz, clr); } private void SetObjectsDeletedStatus(uint uDeleted, bool bDbMntnc) @@ -5555,5 +5612,62 @@ { m_clrAlternateItemBgColor = UIUtil.GetAlternateColorEx(m_lvEntries.BackColor); } + + private int CreateAndShowEntryList(EntryReportDelegate f, string strStatus, + Image imgIcon, string strTitle, string strSubTitle, string strNote, + bool bForceDialog) + { + if(f == null) { Debug.Assert(false); return -1; } + + PwDatabase pd = m_docMgr.ActiveDatabase; + if((pd == null) || !pd.IsOpen) { Debug.Assert(false); return -1; } + + Form fOptDialog; + IStatusLogger sl = StatusUtil.CreateStatusDialog(this, out fOptDialog, + null, (strStatus ?? "..."), true, false); + UIBlockInteraction(true); + + Action fInit = null; + List l = null; + + string strExcp = null; + try { l = f(pd, sl, out fInit); } + catch(Exception ex) { strExcp = ex.Message; } + + UIBlockInteraction(false); + sl.EndLogging(); + + if(!string.IsNullOrEmpty(strExcp)) + MessageService.ShowWarning(strExcp); + + if(l == null) return -1; + if((l.Count == 0) && !bForceDialog) return 0; + + ListViewForm dlg = new ListViewForm(); + dlg.InitEx(strTitle, strSubTitle, strNote, imgIcon, l, + m_ilCurrentIcons, fInit); + UIUtil.ShowDialogAndDestroy(dlg); + + PwGroup pg = (dlg.ResultGroup as PwGroup); + PwEntry pe = (dlg.ResultItem as PwEntry); + if((pg != null) || (pe != null)) + { + if(pg != null) + UpdateUI(false, null, false, null, true, pg, false, m_lvEntries); + else + UpdateUI(false, null, true, pe.ParentGroup, true, null, false, m_lvEntries); + + if(pe != null) + { + PwObjectList lSel = new PwObjectList(); + lSel.Add(pe); + + SelectEntries(lSel, true, true); + EnsureVisibleSelected(false); + } + } + + return l.Count; + } } } diff -Nru keepass2-2.35+dfsg/KeePass/Forms/OptionsForm.cs keepass2-2.36+dfsg/KeePass/Forms/OptionsForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/OptionsForm.cs 2017-01-07 10:27:46.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/OptionsForm.cs 2017-05-20 15:31:02.000000000 +0000 @@ -20,16 +20,16 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Drawing; using System.Text; using System.Windows.Forms; -using System.Diagnostics; using KeePass.App; using KeePass.App.Configuration; +using KeePass.Resources; using KeePass.UI; using KeePass.UI.ToolStripRendering; -using KeePass.Resources; using KeePass.Util; using KeePassLib; @@ -121,7 +121,7 @@ GlobalWindowManager.AddWindow(this); - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; Debug.Assert(m_ilIcons != null); if(m_ilIcons != null) @@ -392,8 +392,6 @@ m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "MinimizeToTray", lvg, KPRes.MinimizeToTray); - m_cdxGuiOptions.CreateItem(Program.Config.UI.TrayIcon, "ShowOnlyIfTrayed", - lvg, KPRes.ShowTrayOnlyIfTrayed); m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "DropToBackAfterClipboardCopy", lvg, KPRes.DropToBackOnCopy); m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "MinimizeAfterClipboardCopy", @@ -465,6 +463,15 @@ m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "FocusQuickFindOnUntray", lvg, KPRes.FocusQuickFindOnUntray); + lvg = new ListViewGroup(KPRes.TrayIcon); + m_lvGuiOptions.Groups.Add(lvg); + m_cdxGuiOptions.CreateItem(Program.Config.UI.TrayIcon, "ShowOnlyIfTrayed", + lvg, KPRes.ShowTrayOnlyIfTrayed); + m_cdxGuiOptions.CreateItem(Program.Config.UI.TrayIcon, "GrayIcon", + lvg, KPRes.TrayIconGray); + m_cdxGuiOptions.CreateItem(Program.Config.UI.TrayIcon, "SingleClickDefault", + lvg, KPRes.TrayIconSingleClick); + lvg = new ListViewGroup(KPRes.Dialogs); m_lvGuiOptions.Groups.Add(lvg); m_cdxGuiOptions.CreateItem(Program.Config.UI, "ShowRecycleConfirmDialog", @@ -531,9 +538,9 @@ m_cbAutoRun.Checked = ShellUtil.GetStartWithWindows(AppDefs.AutoRunName); - m_cbSingleClickTrayAction.Checked = Program.Config.UI.TrayIcon.SingleClickDefault; - if(AppConfigEx.IsOptionEnforced(Program.Config.UI.TrayIcon, "SingleClickDefault")) - m_cbSingleClickTrayAction.Enabled = false; + // m_cbSingleClickTrayAction.Checked = Program.Config.UI.TrayIcon.SingleClickDefault; + // if(AppConfigEx.IsOptionEnforced(Program.Config.UI.TrayIcon, "SingleClickDefault")) + // m_cbSingleClickTrayAction.Enabled = false; } private void LoadAdvancedOptions() @@ -726,7 +733,7 @@ ChangeHotKey(ref m_kPrevSWHKKey, m_hkShowWindow, AppDefs.GlobalHotKeyId.ShowWindow); - Program.Config.UI.TrayIcon.SingleClickDefault = m_cbSingleClickTrayAction.Checked; + // Program.Config.UI.TrayIcon.SingleClickDefault = m_cbSingleClickTrayAction.Checked; Program.Config.Integration.UrlSchemeOverrides = m_aceUrlSchemeOverrides; Program.Config.Integration.UrlOverride = m_strUrlOverrideAll; diff -Nru keepass2-2.35+dfsg/KeePass/Forms/OptionsForm.Designer.cs keepass2-2.36+dfsg/KeePass/Forms/OptionsForm.Designer.cs --- keepass2-2.35+dfsg/KeePass/Forms/OptionsForm.Designer.cs 2017-01-02 16:31:20.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/OptionsForm.Designer.cs 2017-05-20 15:17:30.000000000 +0000 @@ -62,7 +62,6 @@ this.m_cmbBannerStyle = new System.Windows.Forms.ComboBox(); this.m_tabIntegration = new System.Windows.Forms.TabPage(); this.m_btnSchemeOverrides = new System.Windows.Forms.Button(); - this.m_cbSingleClickTrayAction = new System.Windows.Forms.CheckBox(); this.m_cbAutoRun = new System.Windows.Forms.CheckBox(); this.m_grpFileExt = new System.Windows.Forms.GroupBox(); this.m_btnFileExtRemove = new System.Windows.Forms.Button(); @@ -463,7 +462,6 @@ // m_tabIntegration // this.m_tabIntegration.Controls.Add(this.m_btnSchemeOverrides); - this.m_tabIntegration.Controls.Add(this.m_cbSingleClickTrayAction); this.m_tabIntegration.Controls.Add(this.m_cbAutoRun); this.m_tabIntegration.Controls.Add(this.m_grpFileExt); this.m_tabIntegration.Controls.Add(this.m_grpHotKeys); @@ -479,21 +477,11 @@ this.m_btnSchemeOverrides.Location = new System.Drawing.Point(435, 280); this.m_btnSchemeOverrides.Name = "m_btnSchemeOverrides"; this.m_btnSchemeOverrides.Size = new System.Drawing.Size(112, 23); - this.m_btnSchemeOverrides.TabIndex = 4; + this.m_btnSchemeOverrides.TabIndex = 3; this.m_btnSchemeOverrides.Text = "&URL Overrides..."; this.m_btnSchemeOverrides.UseVisualStyleBackColor = true; this.m_btnSchemeOverrides.Click += new System.EventHandler(this.OnBtnUrlOverrides); // - // m_cbSingleClickTrayAction - // - this.m_cbSingleClickTrayAction.AutoSize = true; - this.m_cbSingleClickTrayAction.Location = new System.Drawing.Point(6, 218); - this.m_cbSingleClickTrayAction.Name = "m_cbSingleClickTrayAction"; - this.m_cbSingleClickTrayAction.Size = new System.Drawing.Size(314, 17); - this.m_cbSingleClickTrayAction.TabIndex = 3; - this.m_cbSingleClickTrayAction.Text = "Single click instead of double click for default tray icon action"; - this.m_cbSingleClickTrayAction.UseVisualStyleBackColor = true; - // // m_cbAutoRun // this.m_cbAutoRun.AutoSize = true; @@ -737,7 +725,6 @@ private System.Windows.Forms.Button m_btnFileExtCreate; private System.Windows.Forms.Label m_lblFileExtHint; private System.Windows.Forms.CheckBox m_cbAutoRun; - private System.Windows.Forms.CheckBox m_cbSingleClickTrayAction; private KeePass.UI.CustomListViewEx m_lvAdvanced; private KeePass.UI.CustomListViewEx m_lvSecurityOptions; private System.Windows.Forms.NumericUpDown m_numMruCount; diff -Nru keepass2-2.35+dfsg/KeePass/Forms/PluginsForm.cs keepass2-2.36+dfsg/KeePass/Forms/PluginsForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/PluginsForm.cs 2017-01-01 13:33:56.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/PluginsForm.cs 2017-04-09 09:31:44.000000000 +0000 @@ -20,11 +20,12 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Drawing; using System.Text; using System.Windows.Forms; -using System.Diagnostics; +using KeePass.App; using KeePass.Plugins; using KeePass.Resources; using KeePass.UI; @@ -64,7 +65,7 @@ BannerFactory.CreateBannerEx(this, m_bannerImage, Properties.Resources.B48x48_BlockDevice, KPRes.Plugins, KPRes.PluginsDesc); - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; m_cbCacheDeleteOld.Checked = Program.Config.Application.Start.PluginCacheDeleteOld; @@ -80,6 +81,7 @@ DpiUtil.ScaleIntY(16)); m_ilIcons.ColorDepth = ColorDepth.Depth32Bit; + Debug.Assert(!m_lblCacheSize.AutoSize); // For RTL support m_lblCacheSize.Text += " " + StrUtil.FormatDataSize( PlgxCache.GetUsedCacheSize()) + "."; @@ -142,6 +144,8 @@ private void UpdatePluginDescription() { + Debug.Assert(!m_lblSelectedPluginDesc.AutoSize); // For RTL support + ListView.SelectedListViewItemCollection lvsic = m_lvPlugins.SelectedItems; if(lvsic.Count == 0) { diff -Nru keepass2-2.35+dfsg/KeePass/Forms/PrintForm.cs keepass2-2.36+dfsg/KeePass/Forms/PrintForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/PrintForm.cs 2017-01-01 13:33:56.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/PrintForm.cs 2017-04-10 13:17:46.000000000 +0000 @@ -20,11 +20,11 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Drawing; using System.Globalization; using System.Text; using System.Windows.Forms; -using System.Diagnostics; using KeePass.App; using KeePass.App.Configuration; @@ -33,10 +33,10 @@ using KeePassLib; using KeePassLib.Collections; -using KeePassLib.Native; -using KeePassLib.Security; using KeePassLib.Delegates; +using KeePassLib.Native; using KeePassLib.Resources; +using KeePassLib.Security; using KeePassLib.Translation; using KeePassLib.Utility; @@ -100,7 +100,7 @@ GlobalWindowManager.AddWindow(this); - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; CreateDialogBanner(); List lTabImg = new List(); @@ -219,15 +219,19 @@ if(strSortFieldName != null) SortGroupEntriesRecursive(pgDataSource, strSortFieldName); + bool bRtl = (this.RightToLeft == RightToLeft.Yes); + StringBuilder sb = new StringBuilder(); sb.AppendLine(""); - sb.Append(""); + sb.Append(" lang=\"" + strLang + "\" xml:lang=\"" + strLang + "\""); + if(bRtl) sb.Append(" dir=\"rtl\""); + sb.AppendLine(">"); sb.AppendLine(""); sb.AppendLine(""); @@ -255,12 +259,14 @@ sb.AppendLine("\tcolor: #000000;"); sb.AppendLine("\tbackground-color: #D0D0D0;"); sb.AppendLine("\tpadding-left: 2pt;"); + sb.AppendLine("\tpadding-right: 2pt;"); // RTL support sb.AppendLine("}"); sb.AppendLine("h3 {"); sb.AppendLine("\tfont-size: 1.2em;"); sb.AppendLine("\tcolor: #000000;"); sb.AppendLine("\tbackground-color: #D0D0D0;"); sb.AppendLine("\tpadding-left: 2pt;"); + sb.AppendLine("\tpadding-right: 2pt;"); // RTL support sb.AppendLine("}"); sb.AppendLine("h4 { font-size: 1em; }"); sb.AppendLine("h5 { font-size: 0.89em; }"); @@ -272,13 +278,13 @@ sb.AppendLine("}"); sb.AppendLine("th {"); - sb.AppendLine("\ttext-align: left;"); + sb.AppendLine("\ttext-align: " + (bRtl ? "right;" : "left;")); sb.AppendLine("\tvertical-align: top;"); sb.AppendLine("\tfont-weight: bold;"); sb.AppendLine("}"); sb.AppendLine("td {"); - sb.AppendLine("\ttext-align: left;"); + sb.AppendLine("\ttext-align: " + (bRtl ? "right;" : "left;")); sb.AppendLine("\tvertical-align: top;"); sb.AppendLine("}"); diff -Nru keepass2-2.35+dfsg/KeePass/Forms/ProxyForm.cs keepass2-2.36+dfsg/KeePass/Forms/ProxyForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/ProxyForm.cs 2017-01-01 13:33:56.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/ProxyForm.cs 2017-03-12 16:41:04.000000000 +0000 @@ -24,16 +24,20 @@ using System.Text; using System.Windows.Forms; +using KeePass.App; using KeePass.App.Configuration; using KeePass.UI; using KeePassLib; using KeePassLib.Serialization; +using KeePassLib.Utility; namespace KeePass.Forms { public partial class ProxyForm : Form { + private SecureEdit m_secPassword = new SecureEdit(); + public ProxyForm() { InitializeComponent(); @@ -44,7 +48,9 @@ { GlobalWindowManager.AddWindow(this); - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; + + m_secPassword.Attach(m_tbPassword, null, true); ProxyServerType pst = Program.Config.Integration.ProxyType; if(pst == ProxyServerType.None) m_rbNoProxy.Checked = true; @@ -70,13 +76,15 @@ else m_rbAuthDefault.Checked = true; m_tbUser.Text = strUserName; - m_tbPassword.Text = strPassword; + m_secPassword.SetPassword(StrUtil.Utf8.GetBytes(strPassword)); EnableControlsEx(); } private void OnFormClosed(object sender, FormClosedEventArgs e) { + m_secPassword.Detach(); + GlobalWindowManager.RemoveWindow(this); } @@ -96,7 +104,7 @@ ace.ProxyPort = m_tbPort.Text; ace.ProxyAuthType = pat; ace.ProxyUserName = m_tbUser.Text; - ace.ProxyPassword = m_tbPassword.Text; + ace.ProxyPassword = StrUtil.Utf8.GetString(m_secPassword.ToUtf8()); Program.Config.Apply(AceApplyFlags.Proxy); } diff -Nru keepass2-2.35+dfsg/KeePass/Forms/PwEntryForm.cs keepass2-2.36+dfsg/KeePass/Forms/PwEntryForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/PwEntryForm.cs 2017-01-07 17:32:40.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/PwEntryForm.cs 2017-04-15 13:38:20.000000000 +0000 @@ -20,13 +20,13 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Drawing; -using System.Text; -using System.Windows.Forms; using System.Globalization; using System.IO; +using System.Text; using System.Threading; -using System.Diagnostics; +using System.Windows.Forms; using KeePass.App; using KeePass.App.Configuration; @@ -662,7 +662,7 @@ BannerFactory.CreateBannerEx(this, m_bannerImage, KeePass.Properties.Resources.B48x48_KGPG_Sign, strTitle, strDesc); - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; this.Text = strTitle; m_imgGenPw = UIUtil.CreateDropDownImage(Properties.Resources.B16x16_Key_New); @@ -1021,7 +1021,7 @@ private void OnBtnBinAdd(object sender, EventArgs e) { - m_ctxBinAttach.Show(m_btnBinAdd, new Point(0, m_btnBinAdd.Height)); + m_ctxBinAttach.ShowEx(m_btnBinAdd); } private void OnBtnBinDelete(object sender, EventArgs e) @@ -1227,15 +1227,20 @@ { if(m_pwEditMode == PwEditMode.ViewReadOnlyEntry) return; - DateTime dt = DateTime.UtcNow.Date; - dt = dt.AddYears(nYears); - dt = dt.AddMonths(nMonths); - dt = dt.AddDays(nDays); - - DateTime dtPrevTime = m_cgExpiry.Value; - dt = dt.AddHours(dtPrevTime.Hour); - dt = dt.AddMinutes(dtPrevTime.Minute); - dt = dt.AddSeconds(dtPrevTime.Second); + DateTime dt = DateTime.Now; // Not UTC + if((nYears != 0) || (nMonths != 0) || (nDays != 0)) + { + dt = dt.Date; // Remove time part + dt = dt.AddYears(nYears); + dt = dt.AddMonths(nMonths); + dt = dt.AddDays(nDays); + + DateTime dtPrev = TimeUtil.ToLocal(m_cgExpiry.Value, false); + dt = dt.AddHours(dtPrev.Hour); + dt = dt.AddMinutes(dtPrev.Minute); + dt = dt.AddSeconds(dtPrev.Second); + } + // else do not change the time part of dt m_cgExpiry.Checked = true; m_cgExpiry.Value = dt; @@ -1280,7 +1285,7 @@ private void OnBtnStandardExpiresClick(object sender, EventArgs e) { - m_ctxDefaultTimes.Show(m_btnStandardExpires, 0, m_btnStandardExpires.Height); + m_ctxDefaultTimes.ShowEx(m_btnStandardExpires); } private void OnCtxCopyFieldValue(object sender, EventArgs e) @@ -1436,7 +1441,7 @@ private void OnBtnStrMove(object sender, EventArgs e) { - m_ctxStrMoveToStandard.Show(m_btnStrMove, 0, m_btnStrMove.Height); + m_ctxStrMoveToStandard.ShowEx(m_btnStrMove); } private void OnNotesLinkClicked(object sender, LinkClickedEventArgs e) @@ -1551,7 +1556,7 @@ foreach(KeyValuePair kvp in l) DynAddProfile(kvp.Key, kvp.Value, lAvailKeys); - m_ctxPwGen.Show(m_btnGenPw, new Point(0, m_btnGenPw.Height)); + m_ctxPwGen.ShowEx(m_btnGenPw); } private void DynAddProfile(string strProfile, Image img, List lAvailKeys) @@ -1685,7 +1690,7 @@ private void OnBtnTools(object sender, EventArgs e) { - m_ctxTools.Show(m_btnTools, 0, m_btnTools.Height); + m_ctxTools.ShowEx(m_btnTools); } private void OnCtxToolsHelp(object sender, EventArgs e) diff -Nru keepass2-2.35+dfsg/KeePass/Forms/PwGeneratorForm.cs keepass2-2.36+dfsg/KeePass/Forms/PwGeneratorForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/PwGeneratorForm.cs 2017-01-01 13:33:56.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/PwGeneratorForm.cs 2017-04-08 17:36:52.000000000 +0000 @@ -20,14 +20,14 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Drawing; using System.Text; using System.Windows.Forms; -using System.Diagnostics; using KeePass.App; -using KeePass.UI; using KeePass.Resources; +using KeePass.UI; using KeePass.Util; using KeePassLib; @@ -98,7 +98,7 @@ BannerFactory.CreateBannerEx(this, m_bannerImage, Properties.Resources.B48x48_KGPG_Gen, KPRes.PasswordOptions, KPRes.PasswordOptionsDesc); - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; UIUtil.SetButtonImage(m_btnProfileAdd, Properties.Resources.B16x16_FileSaveAs, false); @@ -116,18 +116,25 @@ m_bBlockUIUpdate = true; - m_cbUpperCase.Text += @" (A, B, C, ...)"; - m_cbLowerCase.Text += @" (a, b, c, ...)"; - m_cbDigits.Text += @" (0, 1, 2, ...)"; - m_cbMinus.Text += @" (-)"; - m_cbUnderline.Text += @" (_)"; - m_cbSpace.Text += @" ( )"; - m_cbSpecial.Text += @" (!, $, %, &&, ...)"; - m_cbBrackets.Text += @" ([, ], {, }, (, ), <, >)"; - m_cbNoRepeat.Text += @" *"; - m_cbExcludeLookAlike.Text += @" (l|1I, O0) *"; - m_lblExcludeChars.Text += @" *"; - m_lblSecRedInfo.Text = @"* " + m_lblSecRedInfo.Text; + using(RtlAwareResizeScope r = new RtlAwareResizeScope( + m_cbUpperCase, m_cbLowerCase, m_cbDigits, m_cbMinus, + m_cbUnderline, m_cbSpace, m_cbSpecial, m_cbBrackets, + m_cbNoRepeat, m_cbExcludeLookAlike, m_lblExcludeChars, + m_lblSecRedInfo)) + { + m_cbUpperCase.Text += @" (A, B, C, ...)"; + m_cbLowerCase.Text += @" (a, b, c, ...)"; + m_cbDigits.Text += @" (0, 1, 2, ...)"; + m_cbMinus.Text += @" (-)"; + m_cbUnderline.Text += @" (_)"; + m_cbSpace.Text += @" ( )"; + m_cbSpecial.Text += @" (!, $, %, &&, ...)"; + m_cbBrackets.Text += @" ([, ], {, }, (, ), <, >)"; + m_cbNoRepeat.Text += @" *"; + m_cbExcludeLookAlike.Text += @" (l|1I, O0) *"; + m_lblExcludeChars.Text += @" *"; + m_lblSecRedInfo.Text = @"* " + m_lblSecRedInfo.Text; + } m_cmbCustomAlgo.Items.Add(NoCustomAlgo); foreach(CustomPwGenerator pwg in Program.PwGeneratorPool) diff -Nru keepass2-2.35+dfsg/KeePass/Forms/SearchForm.cs keepass2-2.36+dfsg/KeePass/Forms/SearchForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/SearchForm.cs 2017-01-01 13:33:56.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/SearchForm.cs 2017-04-13 17:35:40.000000000 +0000 @@ -20,12 +20,13 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Drawing; using System.Text; using System.Text.RegularExpressions; using System.Windows.Forms; -using System.Diagnostics; +using KeePass.App; using KeePass.UI; using KeePass.Util; using KeePass.Util.Spr; @@ -92,9 +93,9 @@ BannerFactory.CreateBannerEx(this, m_bannerImage, Properties.Resources.B48x48_XMag, strTitle, KPRes.SearchDesc); - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; - m_cbDerefData.Text = m_cbDerefData.Text + " (" + KPRes.Slow + ")"; + UIUtil.SetText(m_cbDerefData, m_cbDerefData.Text + " (" + KPRes.Slow + ")"); SearchParameters sp = Program.Config.Defaults.SearchParameters; m_cbTitle.Checked = sp.SearchInTitles; @@ -103,9 +104,10 @@ m_cbPassword.Checked = sp.SearchInPasswords; m_cbNotes.Checked = sp.SearchInNotes; m_cbOtherFields.Checked = sp.SearchInOther; + m_cbStringName.Checked = sp.SearchInStringNames; + m_cbTags.Checked = sp.SearchInTags; m_cbUuid.Checked = sp.SearchInUuids; m_cbGroupName.Checked = sp.SearchInGroupNames; - m_cbTags.Checked = sp.SearchInTags; StringComparison sc = sp.ComparisonMode; m_cbCaseSensitive.Checked = ((sc != StringComparison.CurrentCultureIgnoreCase) && @@ -198,9 +200,10 @@ sp.SearchInUrls = m_cbURL.Checked; sp.SearchInNotes = m_cbNotes.Checked; sp.SearchInOther = m_cbOtherFields.Checked; + sp.SearchInStringNames = m_cbStringName.Checked; + sp.SearchInTags = m_cbTags.Checked; sp.SearchInUuids = m_cbUuid.Checked; sp.SearchInGroupNames = m_cbGroupName.Checked; - sp.SearchInTags = m_cbTags.Checked; sp.ComparisonMode = (m_cbCaseSensitive.Checked ? StringComparison.InvariantCulture : diff -Nru keepass2-2.35+dfsg/KeePass/Forms/SearchForm.Designer.cs keepass2-2.36+dfsg/KeePass/Forms/SearchForm.Designer.cs --- keepass2-2.35+dfsg/KeePass/Forms/SearchForm.Designer.cs 2016-12-22 12:59:14.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/SearchForm.Designer.cs 2017-04-13 17:34:24.000000000 +0000 @@ -34,6 +34,7 @@ this.m_tbSearch = new System.Windows.Forms.TextBox(); this.m_lblSearchFor = new System.Windows.Forms.Label(); this.m_grpSearchIn = new System.Windows.Forms.GroupBox(); + this.m_cbStringName = new System.Windows.Forms.CheckBox(); this.m_cbTags = new System.Windows.Forms.CheckBox(); this.m_cbGroupName = new System.Windows.Forms.CheckBox(); this.m_cbUuid = new System.Windows.Forms.CheckBox(); @@ -66,7 +67,7 @@ // m_btnOK // this.m_btnOK.DialogResult = System.Windows.Forms.DialogResult.OK; - this.m_btnOK.Location = new System.Drawing.Point(183, 346); + this.m_btnOK.Location = new System.Drawing.Point(183, 368); this.m_btnOK.Name = "m_btnOK"; this.m_btnOK.Size = new System.Drawing.Size(75, 23); this.m_btnOK.TabIndex = 6; @@ -77,7 +78,7 @@ // m_btnCancel // this.m_btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.m_btnCancel.Location = new System.Drawing.Point(264, 346); + this.m_btnCancel.Location = new System.Drawing.Point(264, 368); this.m_btnCancel.Name = "m_btnCancel"; this.m_btnCancel.Size = new System.Drawing.Size(75, 23); this.m_btnCancel.TabIndex = 7; @@ -103,6 +104,7 @@ // // m_grpSearchIn // + this.m_grpSearchIn.Controls.Add(this.m_cbStringName); this.m_grpSearchIn.Controls.Add(this.m_cbTags); this.m_grpSearchIn.Controls.Add(this.m_cbGroupName); this.m_grpSearchIn.Controls.Add(this.m_cbUuid); @@ -114,11 +116,21 @@ this.m_grpSearchIn.Controls.Add(this.m_cbTitle); this.m_grpSearchIn.Location = new System.Drawing.Point(12, 150); this.m_grpSearchIn.Name = "m_grpSearchIn"; - this.m_grpSearchIn.Size = new System.Drawing.Size(327, 89); + this.m_grpSearchIn.Size = new System.Drawing.Size(327, 112); this.m_grpSearchIn.TabIndex = 4; this.m_grpSearchIn.TabStop = false; this.m_grpSearchIn.Text = "Search in"; // + // m_cbStringName + // + this.m_cbStringName.AutoSize = true; + this.m_cbStringName.Location = new System.Drawing.Point(9, 65); + this.m_cbStringName.Name = "m_cbStringName"; + this.m_cbStringName.Size = new System.Drawing.Size(82, 17); + this.m_cbStringName.TabIndex = 6; + this.m_cbStringName.Text = "String na&me"; + this.m_cbStringName.UseVisualStyleBackColor = true; + // // m_cbTags // this.m_cbTags.AutoSize = true; @@ -132,20 +144,20 @@ // m_cbGroupName // this.m_cbGroupName.AutoSize = true; - this.m_cbGroupName.Location = new System.Drawing.Point(217, 65); + this.m_cbGroupName.Location = new System.Drawing.Point(9, 88); this.m_cbGroupName.Name = "m_cbGroupName"; this.m_cbGroupName.Size = new System.Drawing.Size(84, 17); - this.m_cbGroupName.TabIndex = 8; + this.m_cbGroupName.TabIndex = 9; this.m_cbGroupName.Text = "&Group name"; this.m_cbGroupName.UseVisualStyleBackColor = true; // // m_cbUuid // this.m_cbUuid.AutoSize = true; - this.m_cbUuid.Location = new System.Drawing.Point(9, 65); + this.m_cbUuid.Location = new System.Drawing.Point(217, 65); this.m_cbUuid.Name = "m_cbUuid"; this.m_cbUuid.Size = new System.Drawing.Size(53, 17); - this.m_cbUuid.TabIndex = 6; + this.m_cbUuid.TabIndex = 8; this.m_cbUuid.Text = "UU&ID"; this.m_cbUuid.UseVisualStyleBackColor = true; // @@ -214,9 +226,9 @@ this.m_grpOptions.Controls.Add(this.m_cbDerefData); this.m_grpOptions.Controls.Add(this.m_cbExcludeExpired); this.m_grpOptions.Controls.Add(this.m_cbCaseSensitive); - this.m_grpOptions.Location = new System.Drawing.Point(12, 244); + this.m_grpOptions.Location = new System.Drawing.Point(12, 268); this.m_grpOptions.Name = "m_grpOptions"; - this.m_grpOptions.Size = new System.Drawing.Size(327, 92); + this.m_grpOptions.Size = new System.Drawing.Size(327, 89); this.m_grpOptions.TabIndex = 5; this.m_grpOptions.TabStop = false; this.m_grpOptions.Text = "Options"; @@ -277,7 +289,7 @@ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.m_btnCancel; - this.ClientSize = new System.Drawing.Size(351, 381); + this.ClientSize = new System.Drawing.Size(351, 403); this.Controls.Add(this.m_lblHints); this.Controls.Add(this.m_cbRegEx); this.Controls.Add(this.m_grpOptions); @@ -329,5 +341,6 @@ private System.Windows.Forms.CheckBox m_cbTags; private System.Windows.Forms.CheckBox m_cbDerefData; private System.Windows.Forms.Label m_lblHints; + private System.Windows.Forms.CheckBox m_cbStringName; } } \ No newline at end of file diff -Nru keepass2-2.35+dfsg/KeePass/Forms/SingleLineEditForm.cs keepass2-2.36+dfsg/KeePass/Forms/SingleLineEditForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/SingleLineEditForm.cs 2017-01-01 13:33:56.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/SingleLineEditForm.cs 2017-04-09 09:24:56.000000000 +0000 @@ -20,10 +20,12 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Drawing; using System.Text; using System.Windows.Forms; +using KeePass.App; using KeePass.UI; namespace KeePass.Forms @@ -73,9 +75,11 @@ BannerFactory.CreateBannerEx(this, m_bannerImage, m_imgIcon, m_strTitle, m_strDesc); - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; this.Text = m_strTitle; + + Debug.Assert(!m_lblLongDesc.AutoSize); // For RTL support m_lblLongDesc.Text = m_strLongDesc; Control cFocus = null; diff -Nru keepass2-2.35+dfsg/KeePass/Forms/StatusLoggerForm.cs keepass2-2.36+dfsg/KeePass/Forms/StatusLoggerForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/StatusLoggerForm.cs 2017-01-01 13:33:56.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/StatusLoggerForm.cs 2017-03-12 16:37:22.000000000 +0000 @@ -20,11 +20,12 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Drawing; using System.Text; using System.Windows.Forms; -using System.Diagnostics; +using KeePass.App; using KeePass.Resources; using KeePass.UI; @@ -127,7 +128,7 @@ { GlobalWindowManager.AddWindow(this); - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; this.Text = PwDefs.ShortProductName; m_pbProgress.Minimum = 0; diff -Nru keepass2-2.35+dfsg/KeePass/Forms/StatusProgressForm.cs keepass2-2.36+dfsg/KeePass/Forms/StatusProgressForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/StatusProgressForm.cs 2017-01-01 13:33:56.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/StatusProgressForm.cs 2017-04-09 09:20:24.000000000 +0000 @@ -20,11 +20,12 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Drawing; using System.Text; using System.Windows.Forms; -using System.Diagnostics; +using KeePass.App; using KeePass.UI; using KeePass.Util; @@ -94,6 +95,8 @@ GlobalWindowManager.AddWindow(this); + this.Icon = AppIcons.Default; + m_pbTotal.Minimum = 0; m_pbTotal.Maximum = 100; m_pbTotal.Value = 0; @@ -132,6 +135,7 @@ Debug.Assert(!m_lblTotal.InvokeRequired); Debug.Assert(!m_pbTotal.InvokeRequired); + Debug.Assert(!m_lblTotal.AutoSize); // For RTL support if(strText != null) m_lblTotal.Text = strText; if((nPercent >= 0) && (nPercent <= 100)) diff -Nru keepass2-2.35+dfsg/KeePass/Forms/StatusProgressForm.Designer.cs keepass2-2.36+dfsg/KeePass/Forms/StatusProgressForm.Designer.cs --- keepass2-2.35+dfsg/KeePass/Forms/StatusProgressForm.Designer.cs 2015-03-16 10:48:36.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/StatusProgressForm.Designer.cs 2017-03-12 17:47:08.000000000 +0000 @@ -73,7 +73,6 @@ this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "StatusProgressForm"; - this.ShowIcon = false; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "<>"; diff -Nru keepass2-2.35+dfsg/KeePass/Forms/TanWizardForm.cs keepass2-2.36+dfsg/KeePass/Forms/TanWizardForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/TanWizardForm.cs 2017-01-01 13:33:56.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/TanWizardForm.cs 2017-04-08 18:09:20.000000000 +0000 @@ -20,11 +20,12 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Drawing; using System.Text; using System.Windows.Forms; -using System.Diagnostics; +using KeePass.App; using KeePass.UI; using KeePass.Resources; @@ -61,10 +62,11 @@ KeePass.Properties.Resources.B48x48_Wizard, KPRes.TanWizard, KPRes.TanWizardDesc); - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; this.Text = KPRes.TanWizard; - if((m_pgStorage.Name != null) && (m_pgStorage.Name.Length > 0)) + Debug.Assert(!m_lblToGroup.AutoSize); // For RTL support + if(!string.IsNullOrEmpty(m_pgStorage.Name)) m_lblToGroup.Text += ": " + m_pgStorage.Name + "."; else m_lblToGroup.Text += "."; diff -Nru keepass2-2.35+dfsg/KeePass/Forms/TextEncodingForm.cs keepass2-2.36+dfsg/KeePass/Forms/TextEncodingForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/TextEncodingForm.cs 2017-01-01 13:33:56.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/TextEncodingForm.cs 2017-04-09 10:56:34.000000000 +0000 @@ -20,14 +20,15 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Drawing; using System.Text; using System.Windows.Forms; -using System.Diagnostics; +using KeePass.App; +using KeePass.Resources; using KeePass.UI; using KeePass.Util; -using KeePass.Resources; using KeePassLib.Utility; @@ -68,7 +69,10 @@ GlobalWindowManager.AddWindow(this); m_bInitializing = true; + this.Icon = AppIcons.Default; + FontUtil.AssignDefaultBold(m_lblContext); + Debug.Assert(!m_lblContext.AutoSize); // For RTL support m_lblContext.Text = m_strContext; m_cmbEnc.Items.Add(KPRes.BinaryNoConv); diff -Nru keepass2-2.35+dfsg/KeePass/Forms/UpdateCheckForm.cs keepass2-2.36+dfsg/KeePass/Forms/UpdateCheckForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/UpdateCheckForm.cs 2017-01-01 13:33:56.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/UpdateCheckForm.cs 2017-03-12 16:36:00.000000000 +0000 @@ -20,11 +20,12 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Drawing; using System.Text; using System.Windows.Forms; -using System.Diagnostics; +using KeePass.App; using KeePass.Native; using KeePass.Resources; using KeePass.UI; @@ -64,7 +65,7 @@ BannerFactory.CreateBannerEx(this, m_bannerImage, Properties.Resources.B48x48_WWW, KPRes.UpdateCheck, KPRes.UpdateCheckResults); - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; this.Text = KPRes.UpdateCheck + " - " + PwDefs.ShortProductName; UIUtil.SetExplorerTheme(m_lvInfo, true); diff -Nru keepass2-2.35+dfsg/KeePass/Forms/UrlOverrideForm.cs keepass2-2.36+dfsg/KeePass/Forms/UrlOverrideForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/UrlOverrideForm.cs 2017-01-01 13:33:56.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/UrlOverrideForm.cs 2017-03-12 16:33:44.000000000 +0000 @@ -24,6 +24,7 @@ using System.Text; using System.Windows.Forms; +using KeePass.App; using KeePass.App.Configuration; using KeePass.Resources; using KeePass.UI; @@ -51,7 +52,7 @@ GlobalWindowManager.AddWindow(this); - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; this.Text = KPRes.UrlOverride; m_tbScheme.Text = m_ovr.Scheme; diff -Nru keepass2-2.35+dfsg/KeePass/Forms/UrlOverridesForm.cs keepass2-2.36+dfsg/KeePass/Forms/UrlOverridesForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/UrlOverridesForm.cs 2017-01-01 13:33:56.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/UrlOverridesForm.cs 2017-03-12 16:33:44.000000000 +0000 @@ -20,11 +20,12 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Drawing; using System.Text; using System.Windows.Forms; -using System.Diagnostics; +using KeePass.App; using KeePass.App.Configuration; using KeePass.Resources; using KeePass.UI; @@ -66,7 +67,7 @@ GlobalWindowManager.AddWindow(this); - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; this.Text = KPRes.UrlOverrides; UIUtil.SetExplorerTheme(m_lvOverrides, false); diff -Nru keepass2-2.35+dfsg/KeePass/Forms/WebDocForm.cs keepass2-2.36+dfsg/KeePass/Forms/WebDocForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/WebDocForm.cs 1970-01-01 00:00:00.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/WebDocForm.cs 2017-05-08 16:39:14.000000000 +0000 @@ -0,0 +1,95 @@ +/* + KeePass Password Safe - The Open-Source Password Manager + Copyright (C) 2003-2017 Dominik Reichl + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Drawing; +using System.Text; +using System.Windows.Forms; + +using KeePass.App; +using KeePass.Resources; +using KeePass.UI; + +using KeePassLib; + +namespace KeePass.Forms +{ + public partial class WebDocForm : Form + { + private string m_strTitle = PwDefs.ShortProductName; + private string m_strDocHtml = null; + + private uint m_uBlockEvents = 1; // For initial navigation + + private string m_strResultUri = null; + public string ResultUri + { + get { return m_strResultUri; } + } + + public WebDocForm() + { + InitializeComponent(); + Program.Translation.ApplyTo(this); + } + + public void InitEx(string strTitle, string strDocHtml) + { + if(!string.IsNullOrEmpty(strTitle)) m_strTitle = strTitle; + + m_strDocHtml = strDocHtml; + } + + private void OnFormLoad(object sender, EventArgs e) + { + GlobalWindowManager.AddWindow(this); + + this.Icon = AppIcons.Default; + this.Text = m_strTitle; + + UIUtil.SetWebBrowserDocument(m_wbMain, m_strDocHtml); + + m_uBlockEvents = 0; + } + + private void OnFormClosed(object sender, FormClosedEventArgs e) + { + GlobalWindowManager.RemoveWindow(this); + } + + private void OnWebNavigating(object sender, WebBrowserNavigatingEventArgs e) + { + if(e == null) { Debug.Assert(false); return; } + if(m_uBlockEvents != 0) return; + + e.Cancel = true; + + Uri uri = e.Url; + if(uri != null) + { + m_strResultUri = uri.ToString(); + this.DialogResult = DialogResult.OK; + } + else { Debug.Assert(false); } + } + } +} diff -Nru keepass2-2.35+dfsg/KeePass/Forms/WebDocForm.Designer.cs keepass2-2.36+dfsg/KeePass/Forms/WebDocForm.Designer.cs --- keepass2-2.35+dfsg/KeePass/Forms/WebDocForm.Designer.cs 1970-01-01 00:00:00.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/WebDocForm.Designer.cs 2017-05-08 14:34:28.000000000 +0000 @@ -0,0 +1,69 @@ +namespace KeePass.Forms +{ + partial class WebDocForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if(disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.m_wbMain = new System.Windows.Forms.WebBrowser(); + this.SuspendLayout(); + // + // m_wbMain + // + this.m_wbMain.AllowWebBrowserDrop = false; + this.m_wbMain.Dock = System.Windows.Forms.DockStyle.Fill; + this.m_wbMain.IsWebBrowserContextMenuEnabled = false; + this.m_wbMain.Location = new System.Drawing.Point(0, 0); + this.m_wbMain.MinimumSize = new System.Drawing.Size(20, 20); + this.m_wbMain.Name = "m_wbMain"; + this.m_wbMain.ScriptErrorsSuppressed = true; + this.m_wbMain.Size = new System.Drawing.Size(541, 445); + this.m_wbMain.TabIndex = 0; + this.m_wbMain.WebBrowserShortcutsEnabled = false; + this.m_wbMain.Navigating += new System.Windows.Forms.WebBrowserNavigatingEventHandler(this.OnWebNavigating); + // + // WebDocForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(541, 445); + this.Controls.Add(this.m_wbMain); + this.MinimizeBox = false; + this.Name = "WebDocForm"; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "<>"; + this.Load += new System.EventHandler(this.OnFormLoad); + this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.OnFormClosed); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.WebBrowser m_wbMain; + } +} \ No newline at end of file diff -Nru keepass2-2.35+dfsg/KeePass/Forms/WebDocForm.resx keepass2-2.36+dfsg/KeePass/Forms/WebDocForm.resx --- keepass2-2.35+dfsg/KeePass/Forms/WebDocForm.resx 1970-01-01 00:00:00.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/WebDocForm.resx 2017-05-08 14:34:26.000000000 +0000 @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff -Nru keepass2-2.35+dfsg/KeePass/Forms/XmlReplaceForm.cs keepass2-2.36+dfsg/KeePass/Forms/XmlReplaceForm.cs --- keepass2-2.35+dfsg/KeePass/Forms/XmlReplaceForm.cs 2017-01-01 13:33:56.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Forms/XmlReplaceForm.cs 2017-03-12 16:33:44.000000000 +0000 @@ -20,10 +20,10 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Drawing; using System.Text; using System.Windows.Forms; -using System.Diagnostics; using KeePass.App; using KeePass.Resources; @@ -62,7 +62,7 @@ KeePass.Properties.Resources.B48x48_Binary, KPRes.XmlReplace, KPRes.XmlReplaceDesc); - this.Icon = Properties.Resources.KeePass; + this.Icon = AppIcons.Default; this.Text = KPRes.XmlReplace; Bitmap bmpBig = SystemIcons.Warning.ToBitmap(); diff -Nru keepass2-2.35+dfsg/KeePass/KeePass.csproj keepass2-2.36+dfsg/KeePass/KeePass.csproj --- keepass2-2.35+dfsg/KeePass/KeePass.csproj 2017-01-09 10:13:44.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/KeePass.csproj 2017-06-09 08:42:54.000000000 +0000 @@ -352,6 +352,7 @@ + @@ -550,11 +551,11 @@ EntropyForm.cs - + Form - - EntryListForm.cs + + ListViewForm.cs Form @@ -742,6 +743,12 @@ UrlOverridesForm.cs + + Form + + + WebDocForm.cs + Form @@ -769,6 +776,9 @@ + + Component + Component @@ -814,6 +824,7 @@ + Component @@ -922,9 +933,9 @@ Designer EntropyForm.cs - + Designer - EntryListForm.cs + ListViewForm.cs EntryReportForm.cs @@ -1036,6 +1047,9 @@ UrlOverridesForm.cs + + WebDocForm.cs + XmlReplaceForm.cs @@ -1111,6 +1125,7 @@ + @@ -1240,6 +1255,13 @@ + + + + + + + @@ -1249,8 +1271,6 @@ - - @@ -1291,9 +1311,6 @@ - - - @@ -1358,7 +1375,6 @@ - @@ -1372,7 +1388,6 @@ - Binary files /tmp/tmpusXDzT/4DEY4hShpt/keepass2-2.35+dfsg/KeePass/KeePass.ico and /tmp/tmpusXDzT/O4gh4lJ_eh/keepass2-2.36+dfsg/KeePass/KeePass.ico differ diff -Nru keepass2-2.35+dfsg/KeePass/Native/NativeMethods.New.cs keepass2-2.36+dfsg/KeePass/Native/NativeMethods.New.cs --- keepass2-2.35+dfsg/KeePass/Native/NativeMethods.New.cs 2017-01-01 13:33:56.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Native/NativeMethods.New.cs 2017-05-05 13:40:52.000000000 +0000 @@ -133,6 +133,8 @@ { if(!IsWindowEx(hWnd)) return false; + IntPtr hWndInit = GetForegroundWindowHandle(); + if(!SetForegroundWindowEx(hWnd)) { Debug.Assert(false); @@ -145,6 +147,13 @@ IntPtr h = GetForegroundWindowHandle(); if(h == hWnd) return true; + // Some applications (like Microsoft Edge) have multiple + // windows and automatically redirect the focus to other + // windows, thus also break when a different window gets + // focused (except when h is zero, which can occur while + // the focus transfer occurs) + if((h != IntPtr.Zero) && (h != hWndInit)) return true; + Application.DoEvents(); } diff -Nru keepass2-2.35+dfsg/KeePass/Native/NativeProgressDialog.cs keepass2-2.36+dfsg/KeePass/Native/NativeProgressDialog.cs --- keepass2-2.35+dfsg/KeePass/Native/NativeProgressDialog.cs 2017-01-01 13:33:56.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Native/NativeProgressDialog.cs 2017-06-03 15:03:10.000000000 +0000 @@ -73,7 +73,8 @@ ~NativeProgressDialog() { - EndLogging(); + try { EndLogging(); } + catch(Exception) { Debug.Assert(false); } } public void StartLogging(string strOperation, bool bWriteOperationToLog) diff -Nru keepass2-2.35+dfsg/KeePass/Program.cs keepass2-2.36+dfsg/KeePass/Program.cs --- keepass2-2.35+dfsg/KeePass/Program.cs 2017-01-01 13:33:56.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Program.cs 2017-06-04 12:17:52.000000000 +0000 @@ -534,10 +534,7 @@ { m_bDesignMode = false; // Again, for the ones not calling Main - int nRandomSeed = (int)DateTime.UtcNow.Ticks; - // Prevent overflow (see Random class constructor) - if(nRandomSeed == int.MinValue) nRandomSeed = 17; - m_rndGlobal = new Random(nRandomSeed); + m_rndGlobal = CryptoRandom.NewWeakRandom(); InitEnvSecurity(); MonoWorkarounds.Initialize(); diff -Nru keepass2-2.35+dfsg/KeePass/Properties/AssemblyInfo.cs keepass2-2.36+dfsg/KeePass/Properties/AssemblyInfo.cs --- keepass2-2.35+dfsg/KeePass/Properties/AssemblyInfo.cs 2017-01-09 10:06:44.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Properties/AssemblyInfo.cs 2017-06-09 08:35:50.000000000 +0000 @@ -38,5 +38,5 @@ [assembly: Guid("02020c52-c0da-47c0-9f3f-a6fe76cee400")] // Assembly version information -[assembly: AssemblyVersion("2.35.0.*")] -[assembly: AssemblyFileVersion("2.35.0.0")] +[assembly: AssemblyVersion("2.36.0.*")] +[assembly: AssemblyFileVersion("2.36.0.0")] diff -Nru keepass2-2.35+dfsg/KeePass/Properties/Resources.Designer.cs keepass2-2.36+dfsg/KeePass/Properties/Resources.Designer.cs --- keepass2-2.35+dfsg/KeePass/Properties/Resources.Designer.cs 2016-12-16 22:02:08.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Properties/Resources.Designer.cs 2017-03-13 10:59:08.000000000 +0000 @@ -1257,6 +1257,27 @@ } } + internal static System.Drawing.Icon KeePass_G { + get { + object obj = ResourceManager.GetObject("KeePass_G", resourceCulture); + return ((System.Drawing.Icon)(obj)); + } + } + + internal static System.Drawing.Icon KeePass_R { + get { + object obj = ResourceManager.GetObject("KeePass_R", resourceCulture); + return ((System.Drawing.Icon)(obj)); + } + } + + internal static System.Drawing.Icon KeePass_Y { + get { + object obj = ResourceManager.GetObject("KeePass_Y", resourceCulture); + return ((System.Drawing.Icon)(obj)); + } + } + internal static System.Drawing.Icon LockOverlay { get { object obj = ResourceManager.GetObject("LockOverlay", resourceCulture); @@ -1284,5 +1305,26 @@ return ((System.Drawing.Icon)(obj)); } } + + internal static System.Drawing.Icon QuadNormal_G { + get { + object obj = ResourceManager.GetObject("QuadNormal_G", resourceCulture); + return ((System.Drawing.Icon)(obj)); + } + } + + internal static System.Drawing.Icon QuadNormal_R { + get { + object obj = ResourceManager.GetObject("QuadNormal_R", resourceCulture); + return ((System.Drawing.Icon)(obj)); + } + } + + internal static System.Drawing.Icon QuadNormal_Y { + get { + object obj = ResourceManager.GetObject("QuadNormal_Y", resourceCulture); + return ((System.Drawing.Icon)(obj)); + } + } } } diff -Nru keepass2-2.35+dfsg/KeePass/Properties/Resources.resx keepass2-2.36+dfsg/KeePass/Properties/Resources.resx --- keepass2-2.35+dfsg/KeePass/Properties/Resources.resx 2016-12-16 22:02:08.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Properties/Resources.resx 2017-03-13 10:59:08.000000000 +0000 @@ -307,9 +307,6 @@ ..\Resources\Images\B16x16_KeePass.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\Images\KeePass.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\Nuvola_Derived\B16x16_FileSave_Disabled.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -643,4 +640,25 @@ ..\Resources\Images\B16x16_Imp_Enpass.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Icons\KeePass_G.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Icons\KeePass_R.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Icons\KeePass_Y.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Icons\QuadNormal_G.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Icons\QuadNormal_R.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Icons\QuadNormal_Y.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Icons\KeePass.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file Binary files /tmp/tmpusXDzT/4DEY4hShpt/keepass2-2.35+dfsg/KeePass/Resources/Icons/KeePass_G.ico and /tmp/tmpusXDzT/O4gh4lJ_eh/keepass2-2.36+dfsg/KeePass/Resources/Icons/KeePass_G.ico differ Binary files /tmp/tmpusXDzT/4DEY4hShpt/keepass2-2.35+dfsg/KeePass/Resources/Icons/KeePass.ico and /tmp/tmpusXDzT/O4gh4lJ_eh/keepass2-2.36+dfsg/KeePass/Resources/Icons/KeePass.ico differ Binary files /tmp/tmpusXDzT/4DEY4hShpt/keepass2-2.35+dfsg/KeePass/Resources/Icons/KeePass_R.ico and /tmp/tmpusXDzT/O4gh4lJ_eh/keepass2-2.36+dfsg/KeePass/Resources/Icons/KeePass_R.ico differ Binary files /tmp/tmpusXDzT/4DEY4hShpt/keepass2-2.35+dfsg/KeePass/Resources/Icons/KeePass_Y.ico and /tmp/tmpusXDzT/O4gh4lJ_eh/keepass2-2.36+dfsg/KeePass/Resources/Icons/KeePass_Y.ico differ Binary files /tmp/tmpusXDzT/4DEY4hShpt/keepass2-2.35+dfsg/KeePass/Resources/Icons/QuadLocked.ico and /tmp/tmpusXDzT/O4gh4lJ_eh/keepass2-2.36+dfsg/KeePass/Resources/Icons/QuadLocked.ico differ Binary files /tmp/tmpusXDzT/4DEY4hShpt/keepass2-2.35+dfsg/KeePass/Resources/Icons/QuadNormal_G.ico and /tmp/tmpusXDzT/O4gh4lJ_eh/keepass2-2.36+dfsg/KeePass/Resources/Icons/QuadNormal_G.ico differ Binary files /tmp/tmpusXDzT/4DEY4hShpt/keepass2-2.35+dfsg/KeePass/Resources/Icons/QuadNormal.ico and /tmp/tmpusXDzT/O4gh4lJ_eh/keepass2-2.36+dfsg/KeePass/Resources/Icons/QuadNormal.ico differ Binary files /tmp/tmpusXDzT/4DEY4hShpt/keepass2-2.35+dfsg/KeePass/Resources/Icons/QuadNormal_R.ico and /tmp/tmpusXDzT/O4gh4lJ_eh/keepass2-2.36+dfsg/KeePass/Resources/Icons/QuadNormal_R.ico differ Binary files /tmp/tmpusXDzT/4DEY4hShpt/keepass2-2.35+dfsg/KeePass/Resources/Icons/QuadNormal_Y.ico and /tmp/tmpusXDzT/O4gh4lJ_eh/keepass2-2.36+dfsg/KeePass/Resources/Icons/QuadNormal_Y.ico differ Binary files /tmp/tmpusXDzT/4DEY4hShpt/keepass2-2.35+dfsg/KeePass/Resources/Images/KeePass.ico and /tmp/tmpusXDzT/O4gh4lJ_eh/keepass2-2.36+dfsg/KeePass/Resources/Images/KeePass.ico differ diff -Nru keepass2-2.35+dfsg/KeePass/Resources/KPRes.Generated.cs keepass2-2.36+dfsg/KeePass/Resources/KPRes.Generated.cs --- keepass2-2.35+dfsg/KeePass/Resources/KPRes.Generated.cs 2016-12-18 18:52:00.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Resources/KPRes.Generated.cs 2017-05-23 20:12:58.000000000 +0000 @@ -79,6 +79,7 @@ m_strAutoShowExpiredEntries = TryGetEx(dictNew, "AutoShowExpiredEntries", m_strAutoShowExpiredEntries); m_strAutoShowSoonToExpireEntries = TryGetEx(dictNew, "AutoShowSoonToExpireEntries", m_strAutoShowSoonToExpireEntries); m_strAutoType = TryGetEx(dictNew, "AutoType", m_strAutoType); + m_strAutoTypeAbortedOnWindow = TryGetEx(dictNew, "AutoTypeAbortedOnWindow", m_strAutoTypeAbortedOnWindow); m_strAutoTypeAlwaysShowSelDialog = TryGetEx(dictNew, "AutoTypeAlwaysShowSelDialog", m_strAutoTypeAlwaysShowSelDialog); m_strAutoTypeCancelOnTitleChange = TryGetEx(dictNew, "AutoTypeCancelOnTitleChange", m_strAutoTypeCancelOnTitleChange); m_strAutoTypeCancelOnWindowChange = TryGetEx(dictNew, "AutoTypeCancelOnWindowChange", m_strAutoTypeCancelOnWindowChange); @@ -224,6 +225,10 @@ m_strDocumentationHint = TryGetEx(dictNew, "DocumentationHint", m_strDocumentationHint); m_strDragDrop = TryGetEx(dictNew, "DragDrop", m_strDragDrop); m_strDropToBackOnCopy = TryGetEx(dictNew, "DropToBackOnCopy", m_strDropToBackOnCopy); + m_strDuplicatePasswords = TryGetEx(dictNew, "DuplicatePasswords", m_strDuplicatePasswords); + m_strDuplicatePasswordsGroup = TryGetEx(dictNew, "DuplicatePasswordsGroup", m_strDuplicatePasswordsGroup); + m_strDuplicatePasswordsList = TryGetEx(dictNew, "DuplicatePasswordsList", m_strDuplicatePasswordsList); + m_strDuplicatePasswordsNone = TryGetEx(dictNew, "DuplicatePasswordsNone", m_strDuplicatePasswordsNone); m_strDuplicateStringFieldName = TryGetEx(dictNew, "DuplicateStringFieldName", m_strDuplicateStringFieldName); m_strEditCmd = TryGetEx(dictNew, "EditCmd", m_strEditCmd); m_strEditEntry = TryGetEx(dictNew, "EditEntry", m_strEditEntry); @@ -430,6 +435,7 @@ m_strLanguageSelected = TryGetEx(dictNew, "LanguageSelected", m_strLanguageSelected); m_strLastAccessTime = TryGetEx(dictNew, "LastAccessTime", m_strLastAccessTime); m_strLastModificationTime = TryGetEx(dictNew, "LastModificationTime", m_strLastModificationTime); + m_strLastModTimePwHist = TryGetEx(dictNew, "LastModTimePwHist", m_strLastModTimePwHist); m_strLimitSingleInstance = TryGetEx(dictNew, "LimitSingleInstance", m_strLimitSingleInstance); m_strLocked = TryGetEx(dictNew, "Locked", m_strLocked); m_strLockMenuLock = TryGetEx(dictNew, "LockMenuLock", m_strLockMenuLock); @@ -526,6 +532,8 @@ m_strPasswordOptions = TryGetEx(dictNew, "PasswordOptions", m_strPasswordOptions); m_strPasswordOptionsDesc = TryGetEx(dictNew, "PasswordOptionsDesc", m_strPasswordOptionsDesc); m_strPasswordPrompt = TryGetEx(dictNew, "PasswordPrompt", m_strPasswordPrompt); + m_strPasswordQuality = TryGetEx(dictNew, "PasswordQuality", m_strPasswordQuality); + m_strPasswordQualityReport = TryGetEx(dictNew, "PasswordQualityReport", m_strPasswordQualityReport); m_strPasswordRepeatFailed = TryGetEx(dictNew, "PasswordRepeatFailed", m_strPasswordRepeatFailed); m_strPasswordRepeatHint = TryGetEx(dictNew, "PasswordRepeatHint", m_strPasswordRepeatHint); m_strPaste = TryGetEx(dictNew, "Paste", m_strPaste); @@ -572,6 +580,7 @@ m_strPrintDesc = TryGetEx(dictNew, "PrintDesc", m_strPrintDesc); m_strPrivate = TryGetEx(dictNew, "Private", m_strPrivate); m_strProfessional = TryGetEx(dictNew, "Professional", m_strProfessional); + m_strQuality = TryGetEx(dictNew, "Quality", m_strQuality); m_strQuickSearchExclExpired = TryGetEx(dictNew, "QuickSearchExclExpired", m_strQuickSearchExclExpired); m_strQuickSearchInPwFields = TryGetEx(dictNew, "QuickSearchInPwFields", m_strQuickSearchInPwFields); m_strQuickSearchDerefData = TryGetEx(dictNew, "QuickSearchDerefData", m_strQuickSearchDerefData); @@ -655,6 +664,10 @@ m_strShowIn = TryGetEx(dictNew, "ShowIn", m_strShowIn); m_strShowMessageBox = TryGetEx(dictNew, "ShowMessageBox", m_strShowMessageBox); m_strShowTrayOnlyIfTrayed = TryGetEx(dictNew, "ShowTrayOnlyIfTrayed", m_strShowTrayOnlyIfTrayed); + m_strSimilarPasswords = TryGetEx(dictNew, "SimilarPasswords", m_strSimilarPasswords); + m_strSimilarPasswordsGroup = TryGetEx(dictNew, "SimilarPasswordsGroup", m_strSimilarPasswordsGroup); + m_strSimilarPasswordsList = TryGetEx(dictNew, "SimilarPasswordsList", m_strSimilarPasswordsList); + m_strSimilarPasswordsNoDup = TryGetEx(dictNew, "SimilarPasswordsNoDup", m_strSimilarPasswordsNoDup); m_strSize = TryGetEx(dictNew, "Size", m_strSize); m_strSlow = TryGetEx(dictNew, "Slow", m_strSlow); m_strSoonToExpireEntries = TryGetEx(dictNew, "SoonToExpireEntries", m_strSoonToExpireEntries); @@ -700,6 +713,9 @@ m_strToolBarSaveAll = TryGetEx(dictNew, "ToolBarSaveAll", m_strToolBarSaveAll); m_strTooManyFilesError = TryGetEx(dictNew, "TooManyFilesError", m_strTooManyFilesError); m_strTransformTime = TryGetEx(dictNew, "TransformTime", m_strTransformTime); + m_strTrayIcon = TryGetEx(dictNew, "TrayIcon", m_strTrayIcon); + m_strTrayIconGray = TryGetEx(dictNew, "TrayIconGray", m_strTrayIconGray); + m_strTrayIconSingleClick = TryGetEx(dictNew, "TrayIconSingleClick", m_strTrayIconSingleClick); m_strTrigger = TryGetEx(dictNew, "Trigger", m_strTrigger); m_strTriggerActionTypeUnknown = TryGetEx(dictNew, "TriggerActionTypeUnknown", m_strTriggerActionTypeUnknown); m_strTriggerAdd = TryGetEx(dictNew, "TriggerAdd", m_strTriggerAdd); @@ -835,6 +851,7 @@ "AutoShowExpiredEntries", "AutoShowSoonToExpireEntries", "AutoType", + "AutoTypeAbortedOnWindow", "AutoTypeAlwaysShowSelDialog", "AutoTypeCancelOnTitleChange", "AutoTypeCancelOnWindowChange", @@ -980,6 +997,10 @@ "DocumentationHint", "DragDrop", "DropToBackOnCopy", + "DuplicatePasswords", + "DuplicatePasswordsGroup", + "DuplicatePasswordsList", + "DuplicatePasswordsNone", "DuplicateStringFieldName", "EditCmd", "EditEntry", @@ -1186,6 +1207,7 @@ "LanguageSelected", "LastAccessTime", "LastModificationTime", + "LastModTimePwHist", "LimitSingleInstance", "Locked", "LockMenuLock", @@ -1282,6 +1304,8 @@ "PasswordOptions", "PasswordOptionsDesc", "PasswordPrompt", + "PasswordQuality", + "PasswordQualityReport", "PasswordRepeatFailed", "PasswordRepeatHint", "Paste", @@ -1328,6 +1352,7 @@ "PrintDesc", "Private", "Professional", + "Quality", "QuickSearchExclExpired", "QuickSearchInPwFields", "QuickSearchDerefData", @@ -1411,6 +1436,10 @@ "ShowIn", "ShowMessageBox", "ShowTrayOnlyIfTrayed", + "SimilarPasswords", + "SimilarPasswordsGroup", + "SimilarPasswordsList", + "SimilarPasswordsNoDup", "Size", "Slow", "SoonToExpireEntries", @@ -1456,6 +1485,9 @@ "ToolBarSaveAll", "TooManyFilesError", "TransformTime", + "TrayIcon", + "TrayIconGray", + "TrayIconSingleClick", "Trigger", "TriggerActionTypeUnknown", "TriggerAdd", @@ -2125,6 +2157,17 @@ get { return m_strAutoType; } } + private static string m_strAutoTypeAbortedOnWindow = + @"Auto-Type has been aborted, because the target window is disallowed by the application policy (defined by your administrator)."; + /// + /// Look up a localized string similar to + /// 'Auto-Type has been aborted, because the target window is disallowed by the application policy (defined by your administrator).'. + /// + public static string AutoTypeAbortedOnWindow + { + get { return m_strAutoTypeAbortedOnWindow; } + } + private static string m_strAutoTypeAlwaysShowSelDialog = @"Always show global auto-type entry selection dialog"; /// @@ -2247,10 +2290,10 @@ } private static string m_strAutoTypeObfuscationHint = - @"Auto-type obfuscation may not work with all windows."; + @"Auto-Type obfuscation may not work with all windows."; /// /// Look up a localized string similar to - /// 'Auto-type obfuscation may not work with all windows.'. + /// 'Auto-Type obfuscation may not work with all windows.'. /// public static string AutoTypeObfuscationHint { @@ -3720,6 +3763,50 @@ get { return m_strDropToBackOnCopy; } } + private static string m_strDuplicatePasswords = + @"Duplicate Passwords"; + /// + /// Look up a localized string similar to + /// 'Duplicate Passwords'. + /// + public static string DuplicatePasswords + { + get { return m_strDuplicatePasswords; } + } + + private static string m_strDuplicatePasswordsGroup = + @"Entries using the same password:"; + /// + /// Look up a localized string similar to + /// 'Entries using the same password:'. + /// + public static string DuplicatePasswordsGroup + { + get { return m_strDuplicatePasswordsGroup; } + } + + private static string m_strDuplicatePasswordsList = + @"List of entries that are using the same passwords."; + /// + /// Look up a localized string similar to + /// 'List of entries that are using the same passwords.'. + /// + public static string DuplicatePasswordsList + { + get { return m_strDuplicatePasswordsList; } + } + + private static string m_strDuplicatePasswordsNone = + @"No duplicate passwords have been found."; + /// + /// Look up a localized string similar to + /// 'No duplicate passwords have been found.'. + /// + public static string DuplicatePasswordsNone + { + get { return m_strDuplicatePasswordsNone; } + } + private static string m_strDuplicateStringFieldName = @"The string field name you specified already exists. String field names must be unique for each entry."; /// @@ -5986,6 +6073,17 @@ get { return m_strLastModificationTime; } } + private static string m_strLastModTimePwHist = + @"Last Password Modification Time (Based on History)"; + /// + /// Look up a localized string similar to + /// 'Last Password Modification Time (Based on History)'. + /// + public static string LastModTimePwHist + { + get { return m_strLastModTimePwHist; } + } + private static string m_strLimitSingleInstance = @"Limit to single instance"; /// @@ -7042,6 +7140,28 @@ get { return m_strPasswordPrompt; } } + private static string m_strPasswordQuality = + @"Password Quality"; + /// + /// Look up a localized string similar to + /// 'Password Quality'. + /// + public static string PasswordQuality + { + get { return m_strPasswordQuality; } + } + + private static string m_strPasswordQualityReport = + @"Estimated quality of the entry passwords."; + /// + /// Look up a localized string similar to + /// 'Estimated quality of the entry passwords.'. + /// + public static string PasswordQualityReport + { + get { return m_strPasswordQualityReport; } + } + private static string m_strPasswordRepeatFailed = @"Password and repeated password aren't identical!"; /// @@ -7548,6 +7668,17 @@ get { return m_strProfessional; } } + private static string m_strQuality = + @"Quality"; + /// + /// Look up a localized string similar to + /// 'Quality'. + /// + public static string Quality + { + get { return m_strQuality; } + } + private static string m_strQuickSearchExclExpired = @"Exclude expired entries in quick searches"; /// @@ -8461,6 +8592,50 @@ get { return m_strShowTrayOnlyIfTrayed; } } + private static string m_strSimilarPasswords = + @"Similar Passwords"; + /// + /// Look up a localized string similar to + /// 'Similar Passwords'. + /// + public static string SimilarPasswords + { + get { return m_strSimilarPasswords; } + } + + private static string m_strSimilarPasswordsGroup = + @"Entries using similar passwords (similarity: {PARAM}):"; + /// + /// Look up a localized string similar to + /// 'Entries using similar passwords (similarity: {PARAM}):'. + /// + public static string SimilarPasswordsGroup + { + get { return m_strSimilarPasswordsGroup; } + } + + private static string m_strSimilarPasswordsList = + @"List of entries that are using similar passwords."; + /// + /// Look up a localized string similar to + /// 'List of entries that are using similar passwords.'. + /// + public static string SimilarPasswordsList + { + get { return m_strSimilarPasswordsList; } + } + + private static string m_strSimilarPasswordsNoDup = + @"The list shows entries that are using similar, but not identical passwords. For finding entries that are using the same passwords, use the 'Find Duplicate Passwords' command (in the main menu)."; + /// + /// Look up a localized string similar to + /// 'The list shows entries that are using similar, but not identical passwords. For finding entries that are using the same passwords, use the 'Find Duplicate Passwords' command (in the main menu).'. + /// + public static string SimilarPasswordsNoDup + { + get { return m_strSimilarPasswordsNoDup; } + } + private static string m_strSize = @"Size"; /// @@ -8956,6 +9131,39 @@ get { return m_strTransformTime; } } + private static string m_strTrayIcon = + @"Tray Icon"; + /// + /// Look up a localized string similar to + /// 'Tray Icon'. + /// + public static string TrayIcon + { + get { return m_strTrayIcon; } + } + + private static string m_strTrayIconGray = + @"Use gray tray icon"; + /// + /// Look up a localized string similar to + /// 'Use gray tray icon'. + /// + public static string TrayIconGray + { + get { return m_strTrayIconGray; } + } + + private static string m_strTrayIconSingleClick = + @"Single click instead of double click for default tray icon action"; + /// + /// Look up a localized string similar to + /// 'Single click instead of double click for default tray icon action'. + /// + public static string TrayIconSingleClick + { + get { return m_strTrayIconSingleClick; } + } + private static string m_strTrigger = @"Trigger"; /// diff -Nru keepass2-2.35+dfsg/KeePass/UI/AsyncPwListUpdate.cs keepass2-2.36+dfsg/KeePass/UI/AsyncPwListUpdate.cs --- keepass2-2.35+dfsg/KeePass/UI/AsyncPwListUpdate.cs 2017-01-01 13:33:58.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/UI/AsyncPwListUpdate.cs 2017-05-28 09:56:38.000000000 +0000 @@ -64,14 +64,14 @@ { private readonly ListView m_lv; - private object m_objListEditSync = new object(); + private readonly object m_objListEditSync = new object(); public object ListEditSyncObject { get { return m_objListEditSync; } } private Dictionary m_dValidIDs = new Dictionary(); - private object m_objValidIDsSync = new object(); + private readonly object m_objValidIDsSync = new object(); private sealed class LviUpdInfo { diff -Nru keepass2-2.35+dfsg/KeePass/UI/BannerFactory.cs keepass2-2.36+dfsg/KeePass/UI/BannerFactory.cs --- keepass2-2.35+dfsg/KeePass/UI/BannerFactory.cs 2017-01-01 13:33:58.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/UI/BannerFactory.cs 2017-04-10 13:59:22.000000000 +0000 @@ -19,11 +19,11 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Drawing; -using System.Drawing.Imaging; using System.Drawing.Drawing2D; +using System.Drawing.Imaging; using System.Windows.Forms; -using System.Diagnostics; using KeePass.App; using KeePass.Util; @@ -129,15 +129,6 @@ { img = new Bitmap(nWidth, nHeight, PixelFormat.Format24bppRgb); Graphics g = Graphics.FromImage(img); - int xIcon = DpiScaleInt(10, nHeight); - - bool bRtl = Program.Translation.Properties.RightToLeft; - Matrix mxTrfOrg = g.Transform; - if(bRtl) - { - g.TranslateTransform(nWidth, 0.0f); - g.ScaleTransform(-1.0f, 1.0f); - } Color clrStart = Color.White; Color clrEnd = Color.LightBlue; @@ -208,6 +199,15 @@ } } + bool bRtl = Program.Translation.Properties.RightToLeft; + // Matrix mxTrfOrg = g.Transform; + // if(bRtl) + // { + // g.TranslateTransform(nWidth, 0.0f); + // g.ScaleTransform(-1.0f, 1.0f); + // } + + int xIcon = DpiScaleInt(10, nHeight); int wIconScaled = StdIconDim; int hIconScaled = StdIconDim; if(imgIcon != null) @@ -217,11 +217,12 @@ (float)StdIconDim, nHeight)); hIconScaled = DpiScaleInt(StdIconDim, nHeight); - int yIcon = (nHeight - hIconScaled) / 2; + int xIconR = (bRtl ? (nWidth - xIcon - wIconScaled) : xIcon); + int yIconR = (nHeight - hIconScaled) / 2; if(hIconScaled == imgIcon.Height) - g.DrawImageUnscaled(imgIcon, xIcon, yIcon); + g.DrawImageUnscaled(imgIcon, xIconR, yIconR); else - g.DrawImage(imgIcon, xIcon, yIcon, wIconScaled, hIconScaled); + g.DrawImage(imgIcon, xIconR, yIconR, wIconScaled, hIconScaled); ColorMatrix cm = new ColorMatrix(); cm.Matrix33 = 0.1f; @@ -229,7 +230,8 @@ ia.SetColorMatrix(cm); int w = wIconScaled * 3, h = hIconScaled * 3; - int x = nWidth - w - xIcon, y = (nHeight - h) / 2; + int x = (bRtl ? xIcon : (nWidth - w - xIcon)); + int y = (nHeight - h) / 2; Rectangle rectDest = new Rectangle(x, y, w, h); g.DrawImage(imgIcon, rectDest, 0, 0, imgIcon.Width, imgIcon.Height, GraphicsUnit.Pixel, ia); @@ -275,7 +277,7 @@ } } - if(bRtl) g.Transform = mxTrfOrg; + // if(bRtl) g.Transform = mxTrfOrg; // Brush brush; Color clrText; @@ -301,10 +303,10 @@ float fFontSize = DpiScaleFloat((12.0f * 96.0f) / g.DpiY, nHeight); Font font = FontUtil.CreateFont(FontFamily.GenericSansSerif, fFontSize, FontStyle.Bold); - int txs = (!bRtl ? tx : (nWidth - tx)); + int txT = (!bRtl ? tx : (nWidth - tx)); // - TextRenderer.MeasureText(g, strTitle, font).Width)); // g.DrawString(strTitle, font, brush, fx, fy); - BannerFactory.DrawText(g, strTitle, txs, ty, font, clrText, bRtl); + BannerFactory.DrawText(g, strTitle, txT, ty, font, clrText, bRtl); font.Dispose(); tx += xIcon; // fx @@ -313,10 +315,10 @@ float fFontSizeSm = DpiScaleFloat((9.0f * 96.0f) / g.DpiY, nHeight); Font fontSmall = FontUtil.CreateFont(FontFamily.GenericSansSerif, fFontSizeSm, FontStyle.Regular); - int txl = (!bRtl ? tx : (nWidth - tx)); + int txL = (!bRtl ? tx : (nWidth - tx)); // - TextRenderer.MeasureText(g, strLine, fontSmall).Width)); // g.DrawString(strLine, fontSmall, brush, fx, fy); - BannerFactory.DrawText(g, strLine, txl, ty, fontSmall, clrText, bRtl); + BannerFactory.DrawText(g, strLine, txL, ty, fontSmall, clrText, bRtl); fontSmall.Dispose(); g.Dispose(); diff -Nru keepass2-2.35+dfsg/KeePass/UI/CustomContextMenuEx.cs keepass2-2.36+dfsg/KeePass/UI/CustomContextMenuEx.cs --- keepass2-2.35+dfsg/KeePass/UI/CustomContextMenuEx.cs 1970-01-01 00:00:00.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/UI/CustomContextMenuEx.cs 2017-04-10 09:28:18.000000000 +0000 @@ -0,0 +1,46 @@ +/* + KeePass Password Safe - The Open-Source Password Manager + Copyright (C) 2003-2017 Dominik Reichl + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Drawing; +using System.Text; +using System.Windows.Forms; + +namespace KeePass.UI +{ + public sealed class CustomContextMenuEx : ContextMenu + { + public CustomContextMenuEx() : base() { } + + public void ShowEx(Control cParent) + { + if(cParent == null) { Debug.Assert(false); return; } + + if(cParent.RightToLeft == RightToLeft.Yes) + { + this.RightToLeft = RightToLeft.Yes; + Show(cParent, new Point(cParent.Width, cParent.Height), + LeftRightAlignment.Left); + } + else Show(cParent, new Point(0, cParent.Height)); + } + } +} diff -Nru keepass2-2.35+dfsg/KeePass/UI/CustomContextMenuStripEx.cs keepass2-2.36+dfsg/KeePass/UI/CustomContextMenuStripEx.cs --- keepass2-2.35+dfsg/KeePass/UI/CustomContextMenuStripEx.cs 2017-01-01 13:33:58.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/UI/CustomContextMenuStripEx.cs 2017-04-10 09:22:36.000000000 +0000 @@ -19,10 +19,11 @@ using System; using System.Collections.Generic; -using System.Text; using System.ComponentModel; -using System.Windows.Forms; using System.Diagnostics; +using System.Drawing; +using System.Text; +using System.Windows.Forms; namespace KeePass.UI { @@ -40,6 +41,22 @@ UIUtil.Configure(this); } + public void ShowEx(Control cParent) + { + if(cParent == null) Show(Cursor.Position); + else + { + int dx = 0; + if(cParent.RightToLeft == RightToLeft.Yes) + { + this.RightToLeft = RightToLeft.Yes; + dx = cParent.Width; + } + + Show(cParent, dx, cParent.Height); + } + } + // protected override void OnItemClicked(ToolStripItemClickedEventArgs e) // { // if(UIUtil.HasClickedSeparator(e)) return; // Ignore the click diff -Nru keepass2-2.35+dfsg/KeePass/UI/CustomMenuStripEx.cs keepass2-2.36+dfsg/KeePass/UI/CustomMenuStripEx.cs --- keepass2-2.35+dfsg/KeePass/UI/CustomMenuStripEx.cs 2017-01-01 13:33:58.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/UI/CustomMenuStripEx.cs 2017-03-15 15:16:30.000000000 +0000 @@ -52,5 +52,12 @@ // if(UIUtil.HasClickedSeparator(e)) return; // Ignore the click // base.OnItemClicked(e); // } + + // protected override void OnMouseUp(MouseEventArgs mea) + // { + // ToolStripSeparator s = (GetItemAt(mea.X, mea.Y) as ToolStripSeparator); + // if(s != null) return; + // base.OnMouseUp(mea); + // } } } diff -Nru keepass2-2.35+dfsg/KeePass/UI/DynamicMenu.cs keepass2-2.36+dfsg/KeePass/UI/DynamicMenu.cs --- keepass2-2.35+dfsg/KeePass/UI/DynamicMenu.cs 2017-01-01 13:33:58.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/UI/DynamicMenu.cs 2017-06-03 14:44:24.000000000 +0000 @@ -77,7 +77,8 @@ ~DynamicMenu() { - Clear(); + try { Clear(); } // Throws under Mono + catch(Exception) { Debug.Assert(false); } } public void Clear() diff -Nru keepass2-2.35+dfsg/KeePass/UI/EnableThemingInScope.cs keepass2-2.36+dfsg/KeePass/UI/EnableThemingInScope.cs --- keepass2-2.35+dfsg/KeePass/UI/EnableThemingInScope.cs 2017-01-01 13:33:58.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/UI/EnableThemingInScope.cs 2017-05-28 09:55:10.000000000 +0000 @@ -37,7 +37,7 @@ { private UIntPtr? m_nuCookie = null; - private static object m_oSync = new object(); + private static readonly object m_oSync = new object(); private static IntPtr? m_nhCtx = null; public EnableThemingInScope(bool bEnable) diff -Nru keepass2-2.35+dfsg/KeePass/UI/FontUtil.cs keepass2-2.36+dfsg/KeePass/UI/FontUtil.cs --- keepass2-2.35+dfsg/KeePass/UI/FontUtil.cs 2017-01-01 13:33:58.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/UI/FontUtil.cs 2017-04-08 17:16:54.000000000 +0000 @@ -58,6 +58,21 @@ return new Font(fBase, fBase.Style); // Clone } + private static void Assign(Control c, Font f) + { + if(c == null) { Debug.Assert(false); return; } + if(f == null) { Debug.Assert(false); return; } + + try + { + using(RtlAwareResizeScope r = new RtlAwareResizeScope(c)) + { + c.Font = f; + } + } + catch(Exception) { Debug.Assert(false); } + } + private static Font m_fontDefault = null; /// /// Get the default UI font. This might be null! @@ -69,22 +84,21 @@ public static void SetDefaultFont(Control c) { - if(c == null) throw new ArgumentNullException("c"); + if(c == null) { Debug.Assert(false); return; } + // Allow specifying the default font once only if(m_fontDefault == null) m_fontDefault = c.Font; } public static void AssignDefault(Control c) { - if(c == null) throw new ArgumentNullException("c"); - - if(m_fontDefault != null) c.Font = m_fontDefault; + Assign(c, m_fontDefault); } private static Font m_fontBold = null; public static void AssignDefaultBold(Control c) { - if(c == null) throw new ArgumentNullException("c"); + if(c == null) { Debug.Assert(false); return; } if(m_fontBold == null) { @@ -92,13 +106,13 @@ catch(Exception) { Debug.Assert(false); m_fontBold = c.Font; } } - if(m_fontBold != null) c.Font = m_fontBold; + Assign(c, m_fontBold); } private static Font m_fontItalic = null; public static void AssignDefaultItalic(Control c) { - if(c == null) throw new ArgumentNullException("c"); + if(c == null) { Debug.Assert(false); return; } if(m_fontItalic == null) { @@ -106,7 +120,7 @@ catch(Exception) { Debug.Assert(false); m_fontItalic = c.Font; } } - if(m_fontItalic != null) c.Font = m_fontItalic; + Assign(c, m_fontItalic); } private static Font m_fontMono = null; @@ -120,7 +134,7 @@ public static void AssignDefaultMono(Control c, bool bIsPasswordBox) { - if(c == null) throw new ArgumentNullException("c"); + if(c == null) { Debug.Assert(false); return; } if(m_fontMono == null) { @@ -135,8 +149,8 @@ } if(bIsPasswordBox && Program.Config.UI.PasswordFont.OverrideUIDefault) - c.Font = Program.Config.UI.PasswordFont.ToFont(); - else if(m_fontMono != null) c.Font = m_fontMono; + Assign(c, Program.Config.UI.PasswordFont.ToFont()); + else Assign(c, m_fontMono); } /* private const string FontPartsSeparator = @"/:/"; diff -Nru keepass2-2.35+dfsg/KeePass/UI/GlobalWindowManager.cs keepass2-2.36+dfsg/KeePass/UI/GlobalWindowManager.cs --- keepass2-2.35+dfsg/KeePass/UI/GlobalWindowManager.cs 2017-01-01 13:33:58.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/UI/GlobalWindowManager.cs 2017-05-28 09:53:46.000000000 +0000 @@ -59,7 +59,7 @@ new List>(); private static List g_vDialogs = new List(); - private static object g_oSyncRoot = new object(); + private static readonly object g_oSyncRoot = new object(); public static uint WindowCount { diff -Nru keepass2-2.35+dfsg/KeePass/UI/NotifyIconEx.cs keepass2-2.36+dfsg/KeePass/UI/NotifyIconEx.cs --- keepass2-2.35+dfsg/KeePass/UI/NotifyIconEx.cs 2017-01-01 13:33:58.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/UI/NotifyIconEx.cs 2017-05-20 17:37:12.000000000 +0000 @@ -25,6 +25,8 @@ using System.Text; using System.Windows.Forms; +using KeePass; + using KeePassLib; using KeePassLib.Native; using KeePassLib.Utility; @@ -80,32 +82,10 @@ get { return m_ico; } set { - try - { - m_ico = value; - if(m_ntf == null) return; + if(value == m_ico) return; // Avoid small icon recreation - Icon icoToDispose = m_icoShell; - try - { - if(m_ico != null) - { - Size sz = SystemInformation.SmallIconSize; - m_icoShell = new Icon(m_ico, sz); - - m_ntf.Icon = m_icoShell; - } - else m_ntf.Icon = null; - } - catch(Exception) - { - Debug.Assert(false); - m_ntf.Icon = m_ico; - } - - if(icoToDispose != null) icoToDispose.Dispose(); - } - catch(Exception) { Debug.Assert(false); } + m_ico = value; + RefreshShellIcon(); } } @@ -156,5 +136,47 @@ } catch(Exception) { Debug.Assert(false); } } + + internal void RefreshShellIcon() + { + if(m_ntf == null) return; + + try + { + Icon icoToDispose = m_icoShell; + try + { + if(m_ico != null) + { + Size sz = UIUtil.GetSmallIconSize(); + + if(Program.Config.UI.TrayIcon.GrayIcon) + { + using(Bitmap bmpOrg = UIUtil.IconToBitmap(m_ico, + sz.Width, sz.Height)) + { + using(Bitmap bmpGray = UIUtil.CreateGrayImage( + bmpOrg)) + { + m_icoShell = UIUtil.BitmapToIcon(bmpGray); + } + } + } + else m_icoShell = new Icon(m_ico, sz); + + m_ntf.Icon = m_icoShell; + } + else m_ntf.Icon = null; + } + catch(Exception) + { + Debug.Assert(false); + m_ntf.Icon = m_ico; + } + + if(icoToDispose != null) icoToDispose.Dispose(); + } + catch(Exception) { Debug.Assert(false); } + } } } diff -Nru keepass2-2.35+dfsg/KeePass/UI/OnDemandStatusDialog.cs keepass2-2.36+dfsg/KeePass/UI/OnDemandStatusDialog.cs --- keepass2-2.35+dfsg/KeePass/UI/OnDemandStatusDialog.cs 2017-01-01 13:33:58.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/UI/OnDemandStatusDialog.cs 2017-05-28 09:52:56.000000000 +0000 @@ -37,7 +37,7 @@ private Thread m_th = null; private StatusProgressForm m_dlgModal = null; - private object m_objSync = new object(); + private readonly object m_objSync = new object(); private const uint InitialProgress = 0; private const string InitialStatus = null; diff -Nru keepass2-2.35+dfsg/KeePass/UI/OpenWithMenu.cs keepass2-2.36+dfsg/KeePass/UI/OpenWithMenu.cs --- keepass2-2.35+dfsg/KeePass/UI/OpenWithMenu.cs 2017-01-01 13:33:58.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/UI/OpenWithMenu.cs 2017-06-03 14:44:46.000000000 +0000 @@ -107,7 +107,8 @@ ~OpenWithMenu() { - Destroy(); + try { Destroy(); } + catch(Exception) { Debug.Assert(false); } } public void Destroy() diff -Nru keepass2-2.35+dfsg/KeePass/UI/PwInputControlGroup.cs keepass2-2.36+dfsg/KeePass/UI/PwInputControlGroup.cs --- keepass2-2.35+dfsg/KeePass/UI/PwInputControlGroup.cs 2017-01-01 13:33:58.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/UI/PwInputControlGroup.cs 2017-05-28 09:52:04.000000000 +0000 @@ -410,12 +410,13 @@ } private List m_lUqiTasks = new List(); + private readonly object m_oUqiTasksSync = new object(); private void UpdateQualityInfo(string str) { if(str == null) { Debug.Assert(false); return; } int nTasks; - lock(m_lUqiTasks) + lock(m_oUqiTasksSync) { if(m_lUqiTasks.Contains(str)) return; @@ -452,7 +453,7 @@ byte[] pbUtf8 = StrUtil.Utf8.GetBytes(str); // str = StrUtil.Utf8.GetString(pbUtf8); - // lock(m_lUqiTasks) { m_lUqiTasks.Add(str); } + // lock(m_oUqiTasksSync) { m_lUqiTasks.Add(str); } uint uBits = QualityEstimation.EstimatePasswordBits(pbUtf8); @@ -472,7 +473,7 @@ catch(Exception) { Debug.Assert(false); } finally { - lock(m_lUqiTasks) { m_lUqiTasks.Remove(str); } + lock(m_oUqiTasksSync) { m_lUqiTasks.Remove(str); } } } @@ -505,7 +506,7 @@ string strInfo = strLength + " " + KPRes.CharsAbbr; if(Program.Config.UI.OptimizeForScreenReader) strInfo = strBits + ", " + strInfo; - m_lblQualityInfo.Text = strInfo; + UIUtil.SetText(m_lblQualityInfo, strInfo); if(m_ttHint != null) m_ttHint.SetToolTip(m_lblQualityInfo, KPRes.PasswordLength + ": " + strLength + " " + KPRes.CharsStc); diff -Nru keepass2-2.35+dfsg/KeePass/UI/QualityProgressBar.cs keepass2-2.36+dfsg/KeePass/UI/QualityProgressBar.cs --- keepass2-2.35+dfsg/KeePass/UI/QualityProgressBar.cs 2017-01-01 13:33:58.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/UI/QualityProgressBar.cs 2017-05-13 17:53:44.000000000 +0000 @@ -19,14 +19,15 @@ using System; using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Drawing; +using System.Drawing.Drawing2D; using System.Text; using System.Windows.Forms; using System.Windows.Forms.VisualStyles; -using System.Drawing; -using System.Drawing.Drawing2D; -using System.ComponentModel; -using System.Diagnostics; +using KeePass.App; using KeePass.Util; using KeePassLib.Native; @@ -133,8 +134,8 @@ int nDrawWidth = (int)((float)rectDraw.Width * (float)nNormPos / (float)nNormMax); - Color clrStart = Color.FromArgb(255, 128, 0); - Color clrEnd = Color.FromArgb(0, 255, 0); + Color clrStart = AppDefs.ColorQualityLow; + Color clrEnd = AppDefs.ColorQualityHigh; if(!this.Enabled) { clrStart = UIUtil.ColorToGrayscale(SystemColors.ControlDark); diff -Nru keepass2-2.35+dfsg/KeePass/UI/RichTextBoxContextMenu.cs keepass2-2.36+dfsg/KeePass/UI/RichTextBoxContextMenu.cs --- keepass2-2.35+dfsg/KeePass/UI/RichTextBoxContextMenu.cs 2017-01-01 13:33:58.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/UI/RichTextBoxContextMenu.cs 2017-06-03 15:00:58.000000000 +0000 @@ -31,7 +31,7 @@ { private RichTextBox m_rtb = null; private Form m_form = null; - private ContextMenuStrip m_ctx = null; + private CustomContextMenuStripEx m_ctx = null; private ToolStripItem[] m_vMenuItems = new ToolStripItem[(int)RtbCtxCommands.Count]; private string m_strCurLink = string.Empty; @@ -55,7 +55,8 @@ ~RichTextBoxContextMenu() { - Detach(); + try { Detach(); } + catch(Exception) { Debug.Assert(false); } } [Obsolete] @@ -96,13 +97,15 @@ } } - private ContextMenuStrip CreateContextMenu() + private CustomContextMenuStripEx CreateContextMenu() { CustomContextMenuStripEx ctx = new CustomContextMenuStripEx(); int iPos = -1; - m_vMenuItems[++iPos] = ctx.Items.Add(KPRes.Undo, + ToolStripItem tsiUndo = ctx.Items.Add(KPRes.Undo, Properties.Resources.B16x16_Undo, this.OnUndoCommand); + tsiUndo.RightToLeftAutoMirrorImage = true; + m_vMenuItems[++iPos] = tsiUndo; ctx.Items.Add(new ToolStripSeparator()); m_vMenuItems[++iPos] = ctx.Items.Add(KPRes.Cut, @@ -115,8 +118,10 @@ Properties.Resources.B16x16_EditDelete, this.OnDeleteCommand); ctx.Items.Add(new ToolStripSeparator()); - m_vMenuItems[++iPos] = ctx.Items.Add(KPRes.CopyLink, + ToolStripItem tsiLink = ctx.Items.Add(KPRes.CopyLink, Properties.Resources.B16x16_EditCopyLink, this.OnCopyLinkCommand); + tsiLink.RightToLeftAutoMirrorImage = true; + m_vMenuItems[++iPos] = tsiLink; m_vMenuItems[++iPos] = ctx.Items.Add(KPRes.CopyAll, Properties.Resources.B16x16_EditShred, this.OnCopyAllCommand); m_vMenuItems[++iPos] = ctx.Items.Add(KPRes.SelectAll, diff -Nru keepass2-2.35+dfsg/KeePass/UI/RichTextBuilder.cs keepass2-2.36+dfsg/KeePass/UI/RichTextBuilder.cs --- keepass2-2.35+dfsg/KeePass/UI/RichTextBuilder.cs 2017-01-01 13:33:58.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/UI/RichTextBuilder.cs 2017-06-04 09:28:54.000000000 +0000 @@ -19,10 +19,10 @@ using System; using System.Collections.Generic; -using System.Text; -using System.Windows.Forms; using System.Diagnostics; using System.Drawing; +using System.Text; +using System.Windows.Forms; using KeePassLib.Utility; @@ -53,16 +53,32 @@ internal static string GenerateRandomIdCode() { - StringBuilder sb = new StringBuilder(14); + StringBuilder sb = new StringBuilder(15); // 1 + 12 + 2 + Random r = Program.GlobalRandom; + + // On Hebrew systems, IDs starting with digits break + // the RTF generation; for safety, we do not use + // digits at all + sb.Append((char)('A' + r.Next(26))); for(int i = 0; i < 12; ++i) { - int n = Program.GlobalRandom.Next(62); + int n = r.Next(52); // 62 if(n < 26) sb.Append((char)('A' + n)); - else if(n < 52) sb.Append((char)('a' + (n - 26))); - else sb.Append((char)('0' + (n - 52))); + // else if(n < 52) + else sb.Append((char)('a' + (n - 26))); + // else sb.Append((char)('0' + (n - 52))); } + return sb.ToString(); } + +#if DEBUG + // For debugger display + public override string ToString() + { + return (this.IdCode + " => " + (this.RtfCode ?? string.Empty)); + } +#endif } private Font m_fDefault = null; @@ -81,11 +97,21 @@ { if(m_vTags != null) return; + // When running under Mono, replace bold and italic text + // by underlined text, which is rendered correctly (in + // contrast to bold and italic text) + string strOvrS = null, strOvrE = null; + if(MonoWorkarounds.IsRequired(1632)) + { + strOvrS = "\\ul "; + strOvrE = "\\ul0 "; + } + List l = new List(); - l.Add(new RtfbTag(null, "\\b ", true, FontStyle.Bold)); - l.Add(new RtfbTag(null, "\\b0 ", false, FontStyle.Bold)); - l.Add(new RtfbTag(null, "\\i ", true, FontStyle.Italic)); - l.Add(new RtfbTag(null, "\\i0 ", false, FontStyle.Italic)); + l.Add(new RtfbTag(null, (strOvrS ?? "\\b "), true, FontStyle.Bold)); + l.Add(new RtfbTag(null, (strOvrE ?? "\\b0 "), false, FontStyle.Bold)); + l.Add(new RtfbTag(null, (strOvrS ?? "\\i "), true, FontStyle.Italic)); + l.Add(new RtfbTag(null, (strOvrE ?? "\\i0 "), false, FontStyle.Italic)); l.Add(new RtfbTag(null, "\\ul ", true, FontStyle.Underline)); l.Add(new RtfbTag(null, "\\ul0 ", false, FontStyle.Underline)); l.Add(new RtfbTag(null, "\\strike ", true, FontStyle.Strikeout)); @@ -158,15 +184,25 @@ m_sb.AppendLine(); } - private static RichTextBox CreateOpRtb() + private static RichTextBox CreateOpRtb(RichTextBox rtbUI) { RichTextBox rtbOp = new RichTextBox(); - rtbOp.Visible = false; // Ensure invisibility + rtbOp.Visible = false; rtbOp.DetectUrls = false; rtbOp.HideSelection = true; rtbOp.Multiline = true; rtbOp.WordWrap = false; + // rtbOp.BorderStyle = rtbUI.BorderStyle; + // rtbOp.ScrollBars = rtbUI.ScrollBars; + rtbOp.Size = rtbUI.Size; + + if(rtbUI.RightToLeft == RightToLeft.Yes) + { + rtbOp.RightToLeft = RightToLeft.Yes; + // rtbOp.SelectionAlignment = HorizontalAlignment.Right; + } + return rtbOp; } @@ -174,7 +210,7 @@ { if(rtb == null) throw new ArgumentNullException("rtb"); - RichTextBox rtbOp = CreateOpRtb(); + RichTextBox rtbOp = CreateOpRtb(rtb); string strText = m_sb.ToString(); Dictionary dEnc = new Dictionary(); @@ -204,7 +240,7 @@ if(m_fDefault != null) { - rtbOp.Select(0, rtbOp.TextLength); + rtbOp.SelectAll(); rtbOp.SelectionFont = m_fDefault; } diff -Nru keepass2-2.35+dfsg/KeePass/UI/RtlAwareResizeScope.cs keepass2-2.36+dfsg/KeePass/UI/RtlAwareResizeScope.cs --- keepass2-2.35+dfsg/KeePass/UI/RtlAwareResizeScope.cs 1970-01-01 00:00:00.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/UI/RtlAwareResizeScope.cs 2017-04-08 18:13:42.000000000 +0000 @@ -0,0 +1,96 @@ +/* + KeePass Password Safe - The Open-Source Password Manager + Copyright (C) 2003-2017 Dominik Reichl + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Drawing; +using System.Text; +using System.Windows.Forms; + +using KeePassLib.Translation; + +namespace KeePass.UI +{ + public sealed class RtlAwareResizeScope : IDisposable + { + private List m_lControls = new List(); + private List m_lOrgX = new List(); + private List m_lOrgW = new List(); + + public RtlAwareResizeScope(params Control[] v) + { + if(v != null) + { + foreach(Control c in v) + { + if(c == null) { Debug.Assert(false); continue; } + + try + { + if((c.RightToLeft == RightToLeft.Yes) && + KPTranslation.IsRtlMoveChildsRequired(c.Parent)) + { + int x = c.Location.X; + int w = c.Width; + + m_lControls.Add(c); + m_lOrgX.Add(x); + m_lOrgW.Add(w); + } + } + catch(Exception) { Debug.Assert(false); } + } + } + else { Debug.Assert(false); } + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool bDisposing) + { + if(!bDisposing) { Debug.Assert(false); return; } + + for(int i = 0; i < m_lControls.Count; ++i) + { + try + { + Control c = m_lControls[i]; + int xOrg = m_lOrgX[i]; + int wOrg = m_lOrgW[i]; + Point ptNew = c.Location; + int wNew = c.Width; + + Debug.Assert(c.RightToLeft == RightToLeft.Yes); + if((wNew != wOrg) && (ptNew.X == xOrg)) + c.Location = new Point(xOrg + wOrg - wNew, ptNew.Y); + } + catch(Exception) { Debug.Assert(false); } + } + + m_lControls.Clear(); + m_lOrgX.Clear(); + m_lOrgW.Clear(); + } + } +} diff -Nru keepass2-2.35+dfsg/KeePass/UI/SecureEdit.cs keepass2-2.36+dfsg/KeePass/UI/SecureEdit.cs --- keepass2-2.35+dfsg/KeePass/UI/SecureEdit.cs 2017-01-01 13:33:58.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/UI/SecureEdit.cs 2017-06-03 15:00:14.000000000 +0000 @@ -18,12 +18,12 @@ */ using System; -using System.Windows.Forms; -using System.Security; using System.Diagnostics; -using System.Text; using System.Runtime.InteropServices; +using System.Security; +using System.Text; using System.Threading; +using System.Windows.Forms; using KeePassLib.Security; using KeePassLib.Utility; @@ -88,7 +88,8 @@ ~SecureEdit() { - Detach(); + try { Detach(); } + catch(Exception) { Debug.Assert(false); } } /// diff -Nru keepass2-2.35+dfsg/KeePass/UI/ShowWarningsLogger.cs keepass2-2.36+dfsg/KeePass/UI/ShowWarningsLogger.cs --- keepass2-2.35+dfsg/KeePass/UI/ShowWarningsLogger.cs 2017-01-01 13:33:58.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/UI/ShowWarningsLogger.cs 2017-06-03 14:58:54.000000000 +0000 @@ -62,7 +62,9 @@ ~ShowWarningsLogger() { Debug.Assert(m_bEndedLogging); - if(!m_bEndedLogging) EndLogging(); + + try { if(!m_bEndedLogging) EndLogging(); } + catch(Exception) { Debug.Assert(false); } } public void StartLogging(string strOperation, bool bWriteOperationToLog) diff -Nru keepass2-2.35+dfsg/KeePass/UI/SplitButtonEx.cs keepass2-2.36+dfsg/KeePass/UI/SplitButtonEx.cs --- keepass2-2.35+dfsg/KeePass/UI/SplitButtonEx.cs 2017-01-01 13:33:58.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/UI/SplitButtonEx.cs 2017-04-10 09:44:24.000000000 +0000 @@ -33,16 +33,18 @@ public sealed class SplitButtonEx : Button { private const int BS_SPLITBUTTON = 0x0000000C; + // private const int BS_LEFTTEXT = 0x00000020; + // private const int BS_RIGHT = 0x00000200; private const uint BCN_FIRST = unchecked((uint)(-1250)); private const uint BCN_DROPDOWN = (BCN_FIRST + 0x0002); private readonly bool m_bSupported; - private ContextMenuStrip m_ctx = null; + private CustomContextMenuStripEx m_ctx = null; [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public ContextMenuStrip SplitDropDownMenu + public CustomContextMenuStripEx SplitDropDownMenu { get { return m_ctx; } set { m_ctx = value; } @@ -56,7 +58,14 @@ { CreateParams cp = base.CreateParams; - if(m_bSupported) cp.Style |= BS_SPLITBUTTON; + if(m_bSupported) + { + int fAdd = BS_SPLITBUTTON; + // if(this.RightToLeft == RightToLeft.Yes) + // fAdd |= (BS_LEFTTEXT | BS_RIGHT); + + cp.Style |= fAdd; + } return cp; } @@ -85,7 +94,7 @@ { if(m_ctx != null) { - m_ctx.Show(this, new Point(0, this.Height)); + m_ctx.ShowEx(this); return; // We handled it } else { Debug.Assert(false); } diff -Nru keepass2-2.35+dfsg/KeePass/UI/StatusBarLogger.cs keepass2-2.36+dfsg/KeePass/UI/StatusBarLogger.cs --- keepass2-2.35+dfsg/KeePass/UI/StatusBarLogger.cs 2017-01-01 13:33:58.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/UI/StatusBarLogger.cs 2017-06-03 14:57:48.000000000 +0000 @@ -19,9 +19,9 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Text; using System.Windows.Forms; -using System.Diagnostics; using KeePassLib.Interfaces; @@ -38,7 +38,9 @@ ~StatusBarLogger() { Debug.Assert(m_bEndedLogging); - if(!m_bEndedLogging) EndLogging(); + + try { if(!m_bEndedLogging) EndLogging(); } + catch(Exception) { Debug.Assert(false); } } public void SetControls(ToolStripStatusLabel sbText, ToolStripProgressBar pbProgress) diff -Nru keepass2-2.35+dfsg/KeePass/UI/UIUtil.cs keepass2-2.36+dfsg/KeePass/UI/UIUtil.cs --- keepass2-2.35+dfsg/KeePass/UI/UIUtil.cs 2017-01-07 17:47:06.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/UI/UIUtil.cs 2017-06-06 12:10:04.000000000 +0000 @@ -73,6 +73,9 @@ public static class UIUtil { + private const int FwsNormal = 0; + private const int FwsMaximized = 2; // Compatible with FormWindowState + private static bool m_bVistaStyleLists = false; public static bool VistaStyleListsSupported { @@ -1228,6 +1231,9 @@ if(ts == null) { Debug.Assert(false); return; } if(Program.DesignMode) return; + // if(Program.Translation.Properties.RightToLeft) + // ts.RightToLeft = RightToLeft.Yes; + DpiUtil.Configure(ts); } @@ -1590,8 +1596,9 @@ public static bool ColorsEqual(Color c1, Color c2) { - return ((c1.R == c2.R) && (c1.G == c2.G) && (c1.B == c2.B) && - (c1.A == c2.A)); + // return ((c1.R == c2.R) && (c1.G == c2.G) && (c1.B == c2.B) && + // (c1.A == c2.A)); + return (c1.ToArgb() == c2.ToArgb()); } public static Color GetAlternateColor(Color clrBase) @@ -2154,61 +2161,76 @@ { if(f == null) { Debug.Assert(false); return string.Empty; } - StringBuilder sb = new StringBuilder(); + List l = new List(); + + Point pt = f.Location; + l.Add(pt.X); + l.Add(pt.Y); - Point ptLocation = f.Location; - sb.Append(ptLocation.X); - sb.Append(", "); - sb.Append(ptLocation.Y); - - if((f.FormBorderStyle == FormBorderStyle.Sizable) || - (f.FormBorderStyle == FormBorderStyle.SizableToolWindow)) - { - Size szSize = f.Size; - sb.Append(", "); - sb.Append(szSize.Width); - sb.Append(", "); - sb.Append(szSize.Height); + FormBorderStyle s = f.FormBorderStyle; + if((s == FormBorderStyle.Sizable) || (s == FormBorderStyle.SizableToolWindow)) + { + Size sz = f.Size; + l.Add(sz.Width); + l.Add(sz.Height); + + if(f.WindowState == FormWindowState.Maximized) l.Add(FwsMaximized); } - return sb.ToString(); + return StrUtil.SerializeIntArray(l.ToArray()); } - public static void SetWindowScreenRect(Form f, string strScreenRect) + public static void SetWindowScreenRect(Form f, string strRect) { - if((f == null) || (strScreenRect == null)) { Debug.Assert(false); return; } - - string[] v = strScreenRect.Split(new char[] { ',', ' ' }, - StringSplitOptions.RemoveEmptyEntries); + if((f == null) || (strRect == null)) { Debug.Assert(false); return; } - if(v.Length == 4) + try { - int x, y, w, h; - if(int.TryParse(v[0], out x) && int.TryParse(v[1], out y) && - int.TryParse(v[2], out w) && int.TryParse(v[3], out h)) + // Backward compatibility (", " as separator) + Debug.Assert(StrUtil.SerializeIntArray(new int[] { + 12, 34, 56 }) == "12 34 56"); // Should not use ',' + string str = strRect.Replace(",", string.Empty); + if(str.Length == 0) return; // No assert + + int[] v = StrUtil.DeserializeIntArray(str); + if((v == null) || (v.Length < 2)) { Debug.Assert(false); return; } + + FormBorderStyle s = f.FormBorderStyle; + bool bSizable = ((s == FormBorderStyle.Sizable) || + (s == FormBorderStyle.SizableToolWindow)); + + int ws = ((v.Length <= 4) ? FwsNormal : v[4]); + if(ws == FwsMaximized) { - Rectangle rect = new Rectangle(x, y, w, h); - if(UIUtil.IsScreenAreaVisible(rect)) - { - f.Location = new Point(x, y); - f.Size = new Size(w, h); - } + if(bSizable && f.MaximizeBox) + f.WindowState = FormWindowState.Maximized; + else { Debug.Assert(false); } + + return; // Ignore the saved size; restore to default } - else { Debug.Assert(false); } - } - else if(v.Length == 2) - { - int x, y; - if(int.TryParse(v[0], out x) && int.TryParse(v[1], out y)) + else if(ws != FwsNormal) { Debug.Assert(false); return; } + + bool bSize = ((v.Length >= 4) && (v[2] > 0) && (v[3] > 0) && bSizable); + + Rectangle rect = new Rectangle(); + rect.X = v[0]; + rect.Y = v[1]; + if(bSize) rect.Size = new Size(v[2], v[3]); + else rect.Size = f.Size; + + if(UIUtil.IsScreenAreaVisible(rect)) { - Size sz = f.Size; - Rectangle rect = new Rectangle(x, y, sz.Width, sz.Height); - if(UIUtil.IsScreenAreaVisible(rect)) - f.Location = new Point(x, y); + f.Location = rect.Location; + if(bSize) f.Size = rect.Size; } - else { Debug.Assert(false); } } - else { Debug.Assert(false); } + catch(Exception) { Debug.Assert(false); } + } + + public static string SetWindowScreenRectEx(Form f, string strRect) + { + SetWindowScreenRect(f, strRect); + return GetWindowScreenRect(f); } public static string GetColumnWidths(ListView lv) @@ -2240,16 +2262,22 @@ if(btn == null) { Debug.Assert(false); return null; } if(img == null) { Debug.Assert(false); return null; } - if(b16To15 && (btn.Height == 23) && (img.Height == 16)) - { - Image imgSc = GfxUtil.ScaleImage(img, img.Width, 15, + Image imgNew = img; + if(b16To15 && (btn.Height == 23) && (imgNew.Height == 16)) + imgNew = GfxUtil.ScaleImage(imgNew, imgNew.Width, 15, ScaleTransformFlags.UIIcon); - btn.Image = imgSc; - return imgSc; - } - btn.Image = img; - return img; + // if(btn.RightToLeft == RightToLeft.Yes) + // { + // // Dispose scaled image only + // Image imgToDispose = ((imgNew != img) ? imgNew : null); + // imgNew = (Image)imgNew.Clone(); + // imgNew.RotateFlip(RotateFlipType.RotateNoneFlipX); + // if(imgToDispose != null) imgToDispose.Dispose(); + // } + + btn.Image = imgNew; + return imgNew; } public static void OverwriteButtonImage(Button btn, ref Image imgCur, @@ -2476,15 +2504,67 @@ return Color.Transparent; } - public static Icon CreateColorizedIcon(Icon icoBase, Color clr, int qSize) + public static Bitmap IconToBitmap(Icon ico, int w, int h) + { + if(ico == null) { Debug.Assert(false); return null; } + + if(w < 0) w = ico.Width; + if(h < 0) h = ico.Height; + + Bitmap bmp = new Bitmap(w, h, PixelFormat.Format32bppArgb); + using(Icon icoBest = new Icon(ico, w, h)) + { + using(Graphics g = Graphics.FromImage(bmp)) + { + g.Clear(Color.Transparent); + + g.InterpolationMode = InterpolationMode.HighQualityBicubic; + g.SmoothingMode = SmoothingMode.HighQuality; + + g.DrawIcon(icoBest, new Rectangle(0, 0, w, h)); + } + } + + return bmp; + } + + public static Icon BitmapToIcon(Bitmap bmp) + { + if(bmp == null) { Debug.Assert(false); return null; } + + Icon ico = null; + IntPtr hIcon = IntPtr.Zero; + try + { + hIcon = bmp.GetHicon(); + using(Icon icoNoOwn = Icon.FromHandle(hIcon)) + { + ico = (Icon)icoNoOwn.Clone(); + } + } + catch(Exception) { Debug.Assert(false); } + finally + { + if(hIcon != IntPtr.Zero) + { + try { NativeMethods.DestroyIcon(hIcon); } + catch(Exception) { Debug.Assert(NativeLib.IsUnix()); } + } + } + + return ico; + } + + /* public static Icon CreateColorizedIcon(Icon icoBase, Color clr, int qSize) { if(icoBase == null) { Debug.Assert(false); return null; } if(qSize <= 0) qSize = 48; // Large shell icon size + Bitmap bmp = null; try { - Bitmap bmp = new Bitmap(qSize, qSize, PixelFormat.Format32bppArgb); + bmp = new Bitmap(qSize, qSize, PixelFormat.Format32bppArgb); using(Graphics g = Graphics.FromImage(bmp)) { g.Clear(Color.Transparent); @@ -2565,24 +2645,19 @@ Marshal.Copy(pbArgb, 0, bd.Scan0, nBytes); bmp.UnlockBits(bd); - IntPtr hIcon = bmp.GetHicon(); - Icon icoBmp = Icon.FromHandle(hIcon); - - Icon icoResult = (Icon)icoBmp.Clone(); - - try { NativeMethods.DestroyIcon(hIcon); } - catch(Exception) { Debug.Assert(NativeLib.IsUnix()); } - bmp.Dispose(); - - return icoResult; + return BitmapToIcon(bmp); } catch(Exception) { Debug.Assert(false); } + finally { if(bmp != null) bmp.Dispose(); } return (Icon)icoBase.Clone(); - } + } */ - public static Bitmap InvertImage(Image img) + private static Bitmap CloneWithColorMatrix(Image img, ColorMatrix cm) { + if(img == null) { Debug.Assert(false); return null; } + if(cm == null) { Debug.Assert(false); return null; } + try { int w = img.Width, h = img.Height; @@ -2595,14 +2670,6 @@ g.InterpolationMode = InterpolationMode.NearestNeighbor; g.SmoothingMode = SmoothingMode.None; - ColorMatrix cm = new ColorMatrix(new float[][] { - new float[] { -1, 0, 0, 0, 0 }, - new float[] { 0, -1, 0, 0, 0 }, - new float[] { 0, 0, -1, 0, 0 }, - new float[] { 0, 0, 0, 1, 0 }, - new float[] { 1, 1, 1, 0, 1 } - }); - ImageAttributes a = new ImageAttributes(); a.SetColorMatrix(cm); @@ -2617,6 +2684,32 @@ return null; } + public static Bitmap InvertImage(Image img) + { + ColorMatrix cm = new ColorMatrix(new float[][] { + new float[] { -1, 0, 0, 0, 0 }, + new float[] { 0, -1, 0, 0, 0 }, + new float[] { 0, 0, -1, 0, 0 }, + new float[] { 0, 0, 0, 1, 0 }, + new float[] { 1, 1, 1, 0, 1 } + }); + + return CloneWithColorMatrix(img, cm); + } + + public static Bitmap CreateGrayImage(Image img) + { + ColorMatrix cm = new ColorMatrix(new float[][] { + new float[] { 0.30f, 0.30f, 0.30f, 0, 0 }, + new float[] { 0.59f, 0.59f, 0.59f, 0, 0 }, + new float[] { 0.11f, 0.11f, 0.11f, 0, 0 }, + new float[] { 0, 0, 0, 1, 0 }, + new float[] { 0, 0, 0, 0, 1 } + }); + + return CloneWithColorMatrix(img, cm); + } + public static Image CreateTabColorImage(Color clr, TabControl cTab) { if(cTab == null) { Debug.Assert(false); return null; } @@ -2847,6 +2940,7 @@ if((dx < ((hArrow * 2) + 2)) || (dy < (hArrow + 2))) return new Bitmap(imgBase); + bool bRtl = Program.Translation.Properties.RightToLeft; bool bStdClr = !UIUtil.IsDarkTheme; Bitmap bmp = new Bitmap(dx, dy, PixelFormat.Format32bppArgb); @@ -2874,6 +2968,12 @@ g.SmoothingMode = SmoothingMode.None; + if(bRtl) + { + g.ScaleTransform(-1, 1); + g.TranslateTransform(-dx + 1, 0); + } + Pen penDark = (bStdClr ? Pens.Black : Pens.White); for(int i = 1; i < hArrow; ++i) g.DrawLine(penDark, dx - hArrow - i, dy - 1 - i, @@ -2893,7 +2993,8 @@ // bmp.SetPixel(dx - 3, dy - 1, Color.Black); // // bmp.SetPixel(dx - 4, dy - 1, Color.Black); - bmp.SetPixel(dx - hArrow, dy - 1, (bStdClr ? Color.Black : Color.White)); + bmp.SetPixel((bRtl ? (hArrow - 1) : (dx - hArrow)), dy - 1, + (bStdClr ? Color.Black : Color.White)); return bmp; } @@ -3032,14 +3133,38 @@ return false; } - internal static Size GetSmallIconSize(int wDefault, int hDefault) + public static Size GetIconSize() { +#if DEBUG + if(!NativeLib.IsUnix()) + { + Debug.Assert(SystemInformation.IconSize.Width == DpiUtil.ScaleIntX(32)); + Debug.Assert(SystemInformation.IconSize.Height == DpiUtil.ScaleIntY(32)); + } +#endif + + try { return SystemInformation.IconSize; } + catch(Exception) { Debug.Assert(NativeLib.IsUnix()); } + + return new Size(DpiUtil.ScaleIntX(32), DpiUtil.ScaleIntY(32)); + } + + public static Size GetSmallIconSize() + { +#if DEBUG + if(!NativeLib.IsUnix()) + { + Debug.Assert(SystemInformation.SmallIconSize.Width == DpiUtil.ScaleIntX(16)); + Debug.Assert(SystemInformation.SmallIconSize.Height == DpiUtil.ScaleIntY(16)); + } +#endif + // Throws under Mono 4.2.1 on Mac OS X; // https://sourceforge.net/p/keepass/discussion/329221/thread/7c096cfc/ try { return SystemInformation.SmallIconSize; } catch(Exception) { Debug.Assert(NativeLib.IsUnix()); } - return new Size(wDefault, hDefault); + return new Size(DpiUtil.ScaleIntX(16), DpiUtil.ScaleIntY(16)); } /* internal static bool HasClickedSeparator(ToolStripItemClickedEventArgs e) @@ -3172,5 +3297,35 @@ StrDictListUpdate(lv, sd); } + + public static void SetText(Control c, string strText) + { + if(c == null) { Debug.Assert(false); return; } + if(strText == null) { Debug.Assert(false); strText = string.Empty; } + + using(RtlAwareResizeScope r = new RtlAwareResizeScope(c)) + { + c.Text = strText; + } + } + + internal static int GetEntryIconIndex(PwDatabase pd, PwEntry pe, + DateTime dtNow) + { + if(pe == null) { Debug.Assert(false); return (int)PwIcon.Key; } + + if(pe.Expires && (pe.ExpiryTime <= dtNow)) + return (int)PwIcon.Expired; + + if(pe.CustomIconUuid == PwUuid.Zero) + return (int)pe.IconId; + + int i = -1; + if(pd != null) i = pd.GetCustomIconIndex(pe.CustomIconUuid); + else { Debug.Assert(false); } + if(i >= 0) return ((int)PwIcon.Count + i); + Debug.Assert(false); + return (int)pe.IconId; + } } } diff -Nru keepass2-2.35+dfsg/KeePass/Util/AutoType.cs keepass2-2.36+dfsg/KeePass/Util/AutoType.cs --- keepass2-2.35+dfsg/KeePass/Util/AutoType.cs 2017-01-01 13:34:00.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Util/AutoType.cs 2017-05-06 17:45:10.000000000 +0000 @@ -19,12 +19,13 @@ using System; using System.Collections.Generic; +using System.Diagnostics; +using System.Media; +using System.Security; using System.Text; using System.Text.RegularExpressions; -using System.Windows.Forms; using System.Threading; -using System.Media; -using System.Diagnostics; +using System.Windows.Forms; using KeePass.App; using KeePass.Forms; @@ -106,7 +107,7 @@ catch(Exception) { Debug.Assert(false); } } - private static bool MatchWindows(string strFilter, string strWindow) + internal static bool MatchWindows(string strFilter, string strWindow) { Debug.Assert(strFilter != null); if(strFilter == null) return false; Debug.Assert(strWindow != null); if(strWindow == null) return false; @@ -190,11 +191,26 @@ if(args.Sequence.Length > 0) { + string strError = null; try { SendInputEx.SendKeysWait(args.Sequence, args.SendObfuscated); } - catch(Exception excpAT) + catch(SecurityException exSec) { strError = exSec.Message; } + catch(Exception ex) { - MessageService.ShowWarning(args.Sequence + - MessageService.NewParagraph + excpAT.Message); + strError = args.Sequence + MessageService.NewParagraph + + ex.Message; + } + + if(!string.IsNullOrEmpty(strError)) + { + try + { + MainForm mfP = Program.MainForm; + if(mfP != null) + mfP.EnsureVisibleForegroundWindow(false, false); + } + catch(Exception) { Debug.Assert(false); } + + MessageService.ShowWarning(strError); } } @@ -499,10 +515,24 @@ try { NativeMethods.EnsureForegroundWindow(hWnd); } catch(Exception) { Debug.Assert(false); } - // Allow target window to handle its activation; + int nActDelayMS = TargetActivationDelay; + string strWindowT = strWindow.Trim(); + // https://sourceforge.net/p/keepass/discussion/329220/thread/3681f343/ + // This apparently is only required here (after showing the + // auto-type entry selection dialog), not when using the + // context menu command in the main window + if(strWindowT.EndsWith("Microsoft Edge", StrUtil.CaseIgnoreCmp)) + { + // 700 skips the first 1-2 characters, + // 750 sometimes skips the first character + nActDelayMS = 1000; + } + + // Allow target window to handle its activation + // (required by some applications, e.g. Edge) Application.DoEvents(); - Thread.Sleep(TargetActivationDelay); + Thread.Sleep(nActDelayMS); Application.DoEvents(); AutoType.PerformInternal(ctx, strWindow); diff -Nru keepass2-2.35+dfsg/KeePass/Util/BinaryDataClassifier.cs keepass2-2.36+dfsg/KeePass/Util/BinaryDataClassifier.cs --- keepass2-2.35+dfsg/KeePass/Util/BinaryDataClassifier.cs 2017-01-01 13:34:00.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Util/BinaryDataClassifier.cs 2017-03-22 13:58:38.000000000 +0000 @@ -42,7 +42,8 @@ public static class BinaryDataClassifier { private static readonly string[] m_vTextExtensions = new string[] { - "txt", "csv", "c", "cpp", "h", "hpp", "css", "js", "bat" + "txt", "csv", "c", "cpp", "h", "hpp", "css", "js", "bat", + "ps1" }; private static readonly string[] m_vRichTextExtensions = new string[] { diff -Nru keepass2-2.35+dfsg/KeePass/Util/EntryMenu.cs keepass2-2.36+dfsg/KeePass/Util/EntryMenu.cs --- keepass2-2.35+dfsg/KeePass/Util/EntryMenu.cs 2017-01-01 13:34:00.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Util/EntryMenu.cs 2017-04-10 09:54:16.000000000 +0000 @@ -33,7 +33,7 @@ { public static class EntryMenu { - private static ContextMenuStrip m_ctx = null; + private static CustomContextMenuStripEx m_ctx = null; public static void Show() { @@ -58,7 +58,7 @@ } } - private static ContextMenuStrip Construct() + private static CustomContextMenuStripEx Construct() { CustomContextMenuStripEx ctx = new CustomContextMenuStripEx(); diff -Nru keepass2-2.35+dfsg/KeePass/Util/EntryUtil.cs keepass2-2.36+dfsg/KeePass/Util/EntryUtil.cs --- keepass2-2.35+dfsg/KeePass/Util/EntryUtil.cs 2017-01-01 13:34:00.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Util/EntryUtil.cs 2017-06-03 17:53:10.000000000 +0000 @@ -19,13 +19,15 @@ using System; using System.Collections.Generic; -using System.Text; -using System.Windows.Forms; using System.Diagnostics; +using System.Drawing; using System.IO; using System.IO.Compression; using System.Security.Cryptography; +using System.Text; +using System.Windows.Forms; +using KeePass.App; using KeePass.Forms; using KeePass.Resources; using KeePass.UI; @@ -36,12 +38,16 @@ using KeePassLib.Cryptography; using KeePassLib.Cryptography.PasswordGenerator; using KeePassLib.Delegates; +using KeePassLib.Interfaces; using KeePassLib.Security; -using KeePassLib.Utility; using KeePassLib.Serialization; +using KeePassLib.Utility; namespace KeePass.Util { + internal delegate List EntryReportDelegate(PwDatabase pd, + IStatusLogger sl, out Action fInit); + /// /// This class contains various static functions for entry operations. /// @@ -571,5 +577,439 @@ return strSummary; } + + private static int CompareLastMod(PwEntry x, PwEntry y) + { + if(x == null) { Debug.Assert(false); return ((y == null) ? 0 : -1); } + if(y == null) { Debug.Assert(false); return 1; } + + return x.LastModificationTime.CompareTo(y.LastModificationTime); + } + + public static DateTime GetLastPasswordModTime(PwEntry pe) + { + if(pe == null) { Debug.Assert(false); return TimeUtil.ToUtc(DateTime.Today, false); } + + List l = new List(pe.History); + l.Sort(EntryUtil.CompareLastMod); + + DateTime dt = pe.LastModificationTime; + byte[] pbC = pe.Strings.GetSafe(PwDefs.PasswordField).ReadUtf8(); + + for(int i = l.Count - 1; i >= 0; --i) + { + PwEntry peH = l[i]; + + byte[] pbH = peH.Strings.GetSafe(PwDefs.PasswordField).ReadUtf8(); + bool bSame = MemUtil.ArraysEqual(pbH, pbC); + MemUtil.ZeroByteArray(pbH); + + if(!bSame) break; + dt = peH.LastModificationTime; + } + + MemUtil.ZeroByteArray(pbC); + return dt; + } + + private static int CompareListSizeDesc(List x, List y) + { + if(x == null) { Debug.Assert(false); return ((y == null) ? 0 : -1); } + if(y == null) { Debug.Assert(false); return 1; } + + return y.Count.CompareTo(x.Count); // Descending + } + + internal static List FindDuplicatePasswords(PwDatabase pd, + IStatusLogger sl, out Action fInit) + { + fInit = delegate(ListView lv) + { + int w = lv.ClientSize.Width - UIUtil.GetVScrollBarWidth(); + int wf = w / 4; + int di = Math.Min(UIUtil.GetSmallIconSize().Width, wf); + + lv.Columns.Add(KPRes.Title, wf + di); + lv.Columns.Add(KPRes.UserName, wf); + lv.Columns.Add(KPRes.Password, wf); + lv.Columns.Add(KPRes.Group, wf - di); + + UIUtil.SetDisplayIndices(lv, new int[] { 1, 2, 3, 0 }); + }; + + List> lDups = FindDuplicatePasswordsEx(pd, sl); + if(lDups == null) return null; + + List lResults = new List(); + DateTime dtNow = DateTime.UtcNow; + + foreach(List l in lDups) + { + PwGroup pg = new PwGroup(true, true); + pg.IsVirtual = true; + + ListViewGroup lvg = new ListViewGroup(KPRes.DuplicatePasswordsGroup); + lvg.Tag = pg; + lResults.Add(lvg); + + foreach(PwEntry pe in l) + { + pg.AddEntry(pe, false, false); + + string strGroup = string.Empty; + if(pe.ParentGroup != null) + strGroup = pe.ParentGroup.GetFullPath(" - ", false); + + ListViewItem lvi = new ListViewItem(pe.Strings.ReadSafe( + PwDefs.TitleField)); + lvi.SubItems.Add(pe.Strings.ReadSafe(PwDefs.UserNameField)); + lvi.SubItems.Add(pe.Strings.ReadSafe(PwDefs.PasswordField)); + lvi.SubItems.Add(strGroup); + + lvi.ImageIndex = UIUtil.GetEntryIconIndex(pd, pe, dtNow); + lvi.Tag = pe; + lResults.Add(lvi); + } + } + + return lResults; + } + + private static List> FindDuplicatePasswordsEx(PwDatabase pd, + IStatusLogger sl) + { + if((pd == null) || !pd.IsOpen) { Debug.Assert(false); return null; } + PwGroup pg = pd.RootGroup; + if(pg == null) { Debug.Assert(false); return null; } + + uint uEntries = pg.GetEntriesCount(true); + uint uEntriesDone = 0; + Dictionary> d = + new Dictionary>(); + + EntryHandler eh = delegate(PwEntry pe) + { + if((sl != null) && (uEntries != 0)) + { + uint u = (uEntriesDone * 100) / uEntries; + if(!sl.SetProgress(u)) return false; + + ++uEntriesDone; + } + + if(!pe.GetSearchingEnabled()) return true; + + SprContext ctx = new SprContext(pe, pd, SprCompileFlags.NonActive); + string str = SprEngine.Compile(pe.Strings.ReadSafe( + PwDefs.PasswordField), ctx); + if(str.Length != 0) + { + List l; + if(d.TryGetValue(str, out l)) l.Add(pe); + else + { + l = new List(); + l.Add(pe); + d[str] = l; + } + } + + return true; + }; + + if(!pg.TraverseTree(TraversalMethod.PreOrder, null, eh)) + return null; + + List> lRes = new List>(); + foreach(List l in d.Values) + { + if(l.Count <= 1) continue; + lRes.Add(l); + } + lRes.Sort(EntryUtil.CompareListSizeDesc); + + return lRes; + } + + private sealed class EuSimilarPasswords + { + public readonly PwEntry EntryA; + public readonly PwEntry EntryB; + public readonly float Similarity; + + public EuSimilarPasswords(PwEntry peA, PwEntry peB, float fSimilarity) + { + if(peA == null) throw new ArgumentNullException("peA"); + if(peB == null) throw new ArgumentNullException("peB"); + + this.EntryA = peA; + this.EntryB = peB; + this.Similarity = fSimilarity; + } + } + + internal static List FindSimilarPasswords(PwDatabase pd, + IStatusLogger sl, out Action fInit) + { + fInit = delegate(ListView lv) + { + int w = lv.ClientSize.Width - UIUtil.GetVScrollBarWidth(); + int wf = w / 4; + int di = Math.Min(UIUtil.GetSmallIconSize().Width, wf); + + lv.Columns.Add(KPRes.Title, wf + di); + lv.Columns.Add(KPRes.UserName, wf); + lv.Columns.Add(KPRes.Password, wf); + lv.Columns.Add(KPRes.Group, wf - di); + + UIUtil.SetDisplayIndices(lv, new int[] { 1, 2, 3, 0 }); + }; + + List l = FindSimilarPasswordsEx(pd, sl); + if(l == null) return null; + + List lResults = new List(); + DateTime dtNow = DateTime.UtcNow; + + foreach(EuSimilarPasswords sp in l) + { + PwGroup pg = new PwGroup(true, true); + pg.IsVirtual = true; + + float fSim = sp.Similarity * 100.0f; + string strLvg = KPRes.SimilarPasswordsGroup.Replace( + @"{PARAM}", fSim.ToString("F02") + @"%"); + ListViewGroup lvg = new ListViewGroup(strLvg); + lvg.Tag = pg; + lResults.Add(lvg); + + for(int i = 0; i < 2; ++i) + { + PwEntry pe = ((i == 0) ? sp.EntryA : sp.EntryB); + pg.AddEntry(pe, false, false); + + string strGroup = string.Empty; + if(pe.ParentGroup != null) + strGroup = pe.ParentGroup.GetFullPath(" - ", false); + + ListViewItem lvi = new ListViewItem(pe.Strings.ReadSafe( + PwDefs.TitleField)); + lvi.SubItems.Add(pe.Strings.ReadSafe(PwDefs.UserNameField)); + lvi.SubItems.Add(pe.Strings.ReadSafe(PwDefs.PasswordField)); + lvi.SubItems.Add(strGroup); + + lvi.ImageIndex = UIUtil.GetEntryIconIndex(pd, pe, dtNow); + lvi.Tag = pe; + lResults.Add(lvi); + } + } + + return lResults; + } + + private static List FindSimilarPasswordsEx( + PwDatabase pd, IStatusLogger sl) + { + if((pd == null) || !pd.IsOpen) { Debug.Assert(false); return null; } + PwGroup pg = pd.RootGroup; + if(pg == null) { Debug.Assert(false); return null; } + + const uint uPrePct = 33; + const long cPostPct = 67; + + uint uEntries = pg.GetEntriesCount(true); + uint uEntriesDone = 0; + List lEntries = new List(); + List lPasswords = new List(); + + EntryHandler eh = delegate(PwEntry pe) + { + if((sl != null) && (uEntries != 0)) + { + uint u = (uEntriesDone * uPrePct) / uEntries; + if(!sl.SetProgress(u)) return false; + + ++uEntriesDone; + } + + if(!pe.GetSearchingEnabled()) return true; + + SprContext ctx = new SprContext(pe, pd, SprCompileFlags.NonActive); + string str = SprEngine.Compile(pe.Strings.ReadSafe( + PwDefs.PasswordField), ctx); + if(str.Length != 0) + { + lEntries.Add(pe); + lPasswords.Add(str); + } + + return true; + }; + + if(!pg.TraverseTree(TraversalMethod.PreOrder, null, eh)) + return null; + + Debug.Assert(TextSimilarity.LevenshteinDistance("Columns", "Comments") == 4); + Debug.Assert(TextSimilarity.LevenshteinDistance("File/URL", "Field Value") == 8); + + long cTotal = ((long)lEntries.Count * (long)(lEntries.Count - 1)) / 2L; + long cDone = 0; + + List l = new List(); + for(int i = 0; i < (lEntries.Count - 1); ++i) + { + string strA = lPasswords[i]; + Debug.Assert(strA.Length != 0); // See above + + for(int j = i + 1; j < lEntries.Count; ++j) + { + string strB = lPasswords[j]; + + if(strA != strB) + l.Add(new EuSimilarPasswords(lEntries[i], lEntries[j], 1.0f - + ((float)TextSimilarity.LevenshteinDistance(strA, strB) / + (float)Math.Max(strA.Length, strB.Length)))); + + if(sl != null) + { + ++cDone; + + uint u = uPrePct + (uint)((cDone * cPostPct) / cTotal); + if(!sl.SetProgress(u)) return null; + } + } + } + Debug.Assert((cDone == cTotal) || (sl == null)); + + Comparison fCmp = delegate(EuSimilarPasswords x, + EuSimilarPasswords y) + { + return y.Similarity.CompareTo(x.Similarity); // Descending + }; + l.Sort(fCmp); + + int ciMax = Math.Max(lEntries.Count / 2, 20); + if(l.Count > ciMax) l.RemoveRange(ciMax, l.Count - ciMax); + + return l; + } + + internal static List CreatePwQualityList(PwDatabase pd, + IStatusLogger sl, out Action fInit) + { + fInit = delegate(ListView lv) + { + int w = lv.ClientSize.Width - UIUtil.GetVScrollBarWidth(); + int wf = (int)(((long)w * 5L) / 23L); + int wq = w - (wf * 4); + int di = Math.Min(UIUtil.GetSmallIconSize().Width, wf); + + lv.Columns.Add(KPRes.Title, wf + di); + lv.Columns.Add(KPRes.UserName, wf); + lv.Columns.Add(KPRes.Password, wf); + lv.Columns.Add(KPRes.Group, wf - di); + lv.Columns.Add(KPRes.Quality, wq, HorizontalAlignment.Right); + + UIUtil.SetDisplayIndices(lv, new int[] { 1, 2, 3, 0, 4 }); + }; + + List> l = CreatePwQualityListEx(pd, sl); + if(l == null) return null; + + List lResults = new List(); + DateTime dtNow = DateTime.UtcNow; + + Color clrL = UIUtil.ColorTowards(AppDefs.ColorQualityLow, + AppDefs.ColorControlNormal, 0.5); + Color clrH = UIUtil.ColorTowards(AppDefs.ColorQualityHigh, + AppDefs.ColorControlNormal, 0.5); + int rL = clrL.R, gL = clrL.G, bL = clrL.B; + float rSp = (int)clrH.R - rL; + float gSp = (int)clrH.G - gL; + float bSp = (int)clrH.B - bL; + + foreach(KeyValuePair kvp in l) + { + PwEntry pe = kvp.Key; + + string strGroup = string.Empty; + if(pe.ParentGroup != null) + strGroup = pe.ParentGroup.GetFullPath(" - ", false); + + ListViewItem lvi = new ListViewItem(pe.Strings.ReadSafe( + PwDefs.TitleField)); + lvi.UseItemStyleForSubItems = false; + + lvi.SubItems.Add(pe.Strings.ReadSafe(PwDefs.UserNameField)); + lvi.SubItems.Add(pe.Strings.ReadSafe(PwDefs.PasswordField)); + lvi.SubItems.Add(strGroup); + + ulong q = (kvp.Value >> 32); + ListViewItem.ListViewSubItem lvsi = lvi.SubItems.Add( + q.ToString() + " " + KPRes.BitsStc); + + try + { + float fQ = (float)Math.Min(q, 128UL) / 128.0f; + lvsi.BackColor = Color.FromArgb(rL + (int)(fQ * rSp), + gL + (int)(fQ * gSp), bL + (int)(fQ * bSp)); + } + catch(Exception) { Debug.Assert(false); } + + lvi.ImageIndex = UIUtil.GetEntryIconIndex(pd, pe, dtNow); + lvi.Tag = pe; + lResults.Add(lvi); + } + + return lResults; + } + + private static List> CreatePwQualityListEx( + PwDatabase pd, IStatusLogger sl) + { + if((pd == null) || !pd.IsOpen) { Debug.Assert(false); return null; } + PwGroup pg = pd.RootGroup; + if(pg == null) { Debug.Assert(false); return null; } + + uint uEntries = pg.GetEntriesCount(true); + uint uEntriesDone = 0; + List> l = new List>(); + + EntryHandler eh = delegate(PwEntry pe) + { + if((sl != null) && (uEntries != 0)) + { + uint u = (uEntriesDone * 100) / uEntries; + if(!sl.SetProgress(u)) return false; + } + ++uEntriesDone; // Also used for sorting, see below + + if(!pe.GetSearchingEnabled()) return true; + + SprContext ctx = new SprContext(pe, pd, SprCompileFlags.NonActive); + string str = SprEngine.Compile(pe.Strings.ReadSafe( + PwDefs.PasswordField), ctx); + if(str.Length != 0) + { + uint q = QualityEstimation.EstimatePasswordBits(str.ToCharArray()); + l.Add(new KeyValuePair(pe, + ((ulong)q << 32) | (ulong)uEntriesDone)); + } + + return true; + }; + + if(!pg.TraverseTree(TraversalMethod.PreOrder, null, eh)) + return null; + + Comparison> fCompare = delegate( + KeyValuePair x, KeyValuePair y) + { + return x.Value.CompareTo(y.Value); + }; + l.Sort(fCompare); + + return l; + } } } diff -Nru keepass2-2.35+dfsg/KeePass/Util/SendInputEx.cs keepass2-2.36+dfsg/KeePass/Util/SendInputEx.cs --- keepass2-2.35+dfsg/KeePass/Util/SendInputEx.cs 2017-01-01 13:34:00.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Util/SendInputEx.cs 2017-03-11 10:40:18.000000000 +0000 @@ -19,11 +19,11 @@ using System; using System.Collections.Generic; +using System.Diagnostics; +using System.Media; using System.Text; -using System.Windows.Forms; using System.Threading; -using System.Media; -using System.Diagnostics; +using System.Windows.Forms; using KeePass.Native; using KeePass.Resources; diff -Nru keepass2-2.35+dfsg/KeePass/Util/SendInputExt/SiEngineStd.cs keepass2-2.36+dfsg/KeePass/Util/SendInputExt/SiEngineStd.cs --- keepass2-2.35+dfsg/KeePass/Util/SendInputExt/SiEngineStd.cs 2017-01-01 13:34:00.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Util/SendInputExt/SiEngineStd.cs 2017-03-11 10:47:36.000000000 +0000 @@ -19,12 +19,16 @@ using System; using System.Collections.Generic; +using System.Diagnostics; +using System.Security; using System.Text; using System.Threading; using System.Windows.Forms; -using System.Diagnostics; using KeePass.Native; +using KeePass.Resources; + +using KeePassLib.Utility; namespace KeePass.Util.SendInputExt { @@ -131,32 +135,57 @@ { if(this.Cancelled) return false; - bool bChkWnd = Program.Config.Integration.AutoTypeCancelOnWindowChange; - bool bChkTitle = Program.Config.Integration.AutoTypeCancelOnTitleChange; - if(!bChkWnd && !bChkTitle) return true; + List lAbortWindows = Program.Config.Integration.AutoTypeAbortOnWindows; - bool bValid = true; - try - { - IntPtr h; - string strTitle; - NativeMethods.GetForegroundWindowInfo(out h, out strTitle, false); + bool bChkWndCh = Program.Config.Integration.AutoTypeCancelOnWindowChange; + bool bChkTitleCh = Program.Config.Integration.AutoTypeCancelOnTitleChange; + bool bChkTitleFx = (lAbortWindows.Count != 0); - if(bChkWnd && (h != this.TargetHWnd)) + if(bChkWndCh || bChkTitleCh || bChkTitleFx) + { + IntPtr h = IntPtr.Zero; + string strTitle = null; + bool bHasInfo = true; + try { - this.Cancelled = true; - bValid = false; + NativeMethods.GetForegroundWindowInfo(out h, out strTitle, false); } + catch(Exception) { Debug.Assert(false); bHasInfo = false; } + if(strTitle == null) strTitle = string.Empty; - if(bChkTitle && ((strTitle ?? string.Empty) != this.TargetWindowTitle)) + if(bHasInfo) { - this.Cancelled = true; - bValid = false; + if(bChkWndCh && (h != this.TargetHWnd)) + { + this.Cancelled = true; + return false; + } + + if(bChkTitleCh && (strTitle != this.TargetWindowTitle)) + { + this.Cancelled = true; + return false; + } + + if(bChkTitleFx) + { + foreach(string strWnd in lAbortWindows) + { + if(string.IsNullOrEmpty(strWnd)) continue; + + if(AutoType.MatchWindows(strWnd, strTitle)) + { + this.Cancelled = true; + throw new SecurityException(KPRes.AutoTypeAbortedOnWindow + + MessageService.NewParagraph + KPRes.TargetWindow + + @": '" + strTitle + @"'."); + } + } + } } } - catch(Exception) { Debug.Assert(false); } - return bValid; + return true; } } } diff -Nru keepass2-2.35+dfsg/KeePass/Util/SendInputExt/SiEngineWin.cs keepass2-2.36+dfsg/KeePass/Util/SendInputExt/SiEngineWin.cs --- keepass2-2.35+dfsg/KeePass/Util/SendInputExt/SiEngineWin.cs 2017-01-01 13:34:00.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Util/SendInputExt/SiEngineWin.cs 2017-03-24 16:11:54.000000000 +0000 @@ -237,7 +237,8 @@ string[] vEnfKey = new string[] { "MSTSC", // Remote Desktop Connection client - "VirtualBox" // VirtualBox does not support VK_PACKET + "VirtualBox", // VirtualBox does not support VK_PACKET + "VpxClient" // VMware vSphere client }; foreach(string strEnfKey in vEnfKey) { diff -Nru keepass2-2.35+dfsg/KeePass/Util/SendInputExt/SiObf.cs keepass2-2.36+dfsg/KeePass/Util/SendInputExt/SiObf.cs --- keepass2-2.35+dfsg/KeePass/Util/SendInputExt/SiObf.cs 2017-01-01 13:34:00.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Util/SendInputExt/SiObf.cs 2017-01-21 20:33:24.000000000 +0000 @@ -165,7 +165,7 @@ nSeed = nSeed * 13 + l[iOffset + i].Char; } - // Prevent overflow (see Random class constructor) + // Prevent overflow (see .NET 2.0 Random class constructor) if(nSeed == int.MinValue) nSeed = 13; return nSeed; } diff -Nru keepass2-2.35+dfsg/KeePass/Util/Spr/SprContext.cs keepass2-2.36+dfsg/KeePass/Util/Spr/SprContext.cs --- keepass2-2.35+dfsg/KeePass/Util/Spr/SprContext.cs 2017-01-01 13:34:00.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Util/Spr/SprContext.cs 2017-02-25 17:14:46.000000000 +0000 @@ -25,8 +25,6 @@ using KeePassLib; using KeePassLib.Interfaces; -using SprRefsCache = System.Collections.Generic.Dictionary; - namespace KeePass.Util.Spr { [Flags] @@ -50,15 +48,16 @@ Comments = 0x2000, TextTransforms = 0x10000, Env = 0x20000, // {BASE}, ... + Run = 0x40000, // Running other (console) applications ExtActive = 0x4000, // Active transformations provided by plugins ExtNonActive = 0x8000, // Non-active transformations provided by plugins - // Next free: 0x40000 - All = 0x3FFFF, + // Next free: 0x80000 + All = 0x7FFFF, // Internal: - UIInteractive = SprCompileFlags.PickChars, + UIInteractive = (SprCompileFlags.PickChars | SprCompileFlags.Run), StateChanging = (SprCompileFlags.NewPassword | SprCompileFlags.HmacOtp), Active = (SprCompileFlags.UIInteractive | SprCompileFlags.StateChanging | @@ -134,13 +133,13 @@ set { m_flags = value; } } - private SprRefsCache m_refsCache = new SprRefsCache(); + private SprRefCache m_refCache = new SprRefCache(); /// /// Used internally by SprEngine; don't modify it. /// - internal SprRefsCache RefsCache + internal SprRefCache RefCache { - get { return m_refsCache; } + get { return m_refCache; } } // private bool m_bNoUrlSchemeOnce = false; @@ -194,7 +193,7 @@ Debug.Assert(object.ReferenceEquals(m_pe, ctx.m_pe)); Debug.Assert(object.ReferenceEquals(m_pd, ctx.m_pd)); - Debug.Assert(object.ReferenceEquals(m_refsCache, ctx.m_refsCache)); + Debug.Assert(object.ReferenceEquals(m_refCache, ctx.m_refCache)); return ctx; } } diff -Nru keepass2-2.35+dfsg/KeePass/Util/Spr/SprEngine.cs keepass2-2.36+dfsg/KeePass/Util/Spr/SprEngine.cs --- keepass2-2.35+dfsg/KeePass/Util/Spr/SprEngine.cs 2017-01-01 13:34:00.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Util/Spr/SprEngine.cs 2017-02-25 17:23:50.000000000 +0000 @@ -94,7 +94,7 @@ SprEngine.InitializeStatic(); if(ctx == null) ctx = new SprContext(); - ctx.RefsCache.Clear(); + ctx.RefCache.Clear(); string str = SprEngine.CompileInternal(strText, ctx, 0); @@ -131,9 +131,14 @@ if((ctx.Flags & SprCompileFlags.Comments) != SprCompileFlags.None) str = RemoveComments(str); + // The following realizes {T-CONV:/Text/Raw/}, which should be + // one of the first transformations (except comments) if((ctx.Flags & SprCompileFlags.TextTransforms) != SprCompileFlags.None) str = PerformTextTransforms(str, ctx, uRecursionLevel); + if((ctx.Flags & SprCompileFlags.Run) != SprCompileFlags.None) + str = RunCommands(str, ctx, uRecursionLevel); + if((ctx.Flags & SprCompileFlags.AppPaths) != SprCompileFlags.None) str = AppLocator.FillPlaceholders(str, ctx); @@ -536,7 +541,7 @@ int nOffset = 0; for(int iLoop = 0; iLoop < 20; ++iLoop) { - str = SprEngine.FillRefsUsingCache(str, ctx); + str = ctx.RefCache.Fill(str, ctx); int nStart = str.IndexOf(StrRefStart, nOffset, SprEngine.ScMethod); if(nStart < 0) break; @@ -576,8 +581,8 @@ strInnerContent = SprEngine.TransformContent(strInnerContent, ctx); // str = str.Substring(0, nStart) + strInnerContent + str.Substring(nEnd + 1); - SprEngine.AddRefToCache(strFullRef, strInnerContent, ctx); - str = SprEngine.FillRefsUsingCache(str, ctx); + ctx.RefCache.Add(strFullRef, strInnerContent, ctx); + str = ctx.RefCache.Fill(str, ctx); } else { nOffset = nStart + 1; continue; } } @@ -625,31 +630,6 @@ return ((lFound.UCount > 0) ? lFound.GetAt(0) : null); } - private static string FillRefsUsingCache(string strText, SprContext ctx) - { - string str = strText; - - foreach(KeyValuePair kvp in ctx.RefsCache) - { - // str = str.Replace(kvp.Key, kvp.Value); - str = StrUtil.ReplaceCaseInsensitive(str, kvp.Key, kvp.Value); - } - - return str; - } - - private static void AddRefToCache(string strRef, string strValue, - SprContext ctx) - { - if(strRef == null) { Debug.Assert(false); return; } - if(strValue == null) { Debug.Assert(false); return; } - if(ctx == null) { Debug.Assert(false); return; } - - // Only add if not exists, do not overwrite - if(!ctx.RefsCache.ContainsKey(strRef)) - ctx.RefsCache.Add(strRef, strValue); - } - // internal static bool MightChange(string strText) // { // if(string.IsNullOrEmpty(strText)) return false; @@ -759,20 +739,7 @@ int iStart; List lParams; - while(ParseAndRemovePlhWithParams(ref str, ctx, uRecursionLevel, - @"{T-REPLACE-RX:", out iStart, out lParams, true)) - { - if(lParams.Count < 2) continue; - if(lParams.Count == 2) lParams.Add(string.Empty); - - try - { - string strNew = Regex.Replace(lParams[0], lParams[1], lParams[2]); - strNew = TransformContent(strNew, ctx); - str = str.Insert(iStart, strNew); - } - catch(Exception) { } - } + // {T-CONV:/Text/Raw/} should be the first transformation while(ParseAndRemovePlhWithParams(ref str, ctx, uRecursionLevel, @"{T-CONV:", out iStart, out lParams, true)) @@ -802,13 +769,31 @@ strNew = Uri.EscapeDataString(strNew); else if(strCmd == "uri-dec") strNew = Uri.UnescapeDataString(strNew); + // "raw": no modification + + if(strCmd != "raw") + strNew = TransformContent(strNew, ctx); - strNew = TransformContent(strNew, ctx); str = str.Insert(iStart, strNew); } catch(Exception) { Debug.Assert(false); } } + while(ParseAndRemovePlhWithParams(ref str, ctx, uRecursionLevel, + @"{T-REPLACE-RX:", out iStart, out lParams, true)) + { + if(lParams.Count < 2) continue; + if(lParams.Count == 2) lParams.Add(string.Empty); + + try + { + string strNew = Regex.Replace(lParams[0], lParams[1], lParams[2]); + strNew = TransformContent(strNew, ctx); + str = str.Insert(iStart, strNew); + } + catch(Exception) { } + } + return str; } @@ -835,5 +820,123 @@ return str; } + + private static string RunCommands(string strText, SprContext ctx, + uint uRecursionLevel) + { + string str = strText; + int iStart; + List lParams; + + while(ParseAndRemovePlhWithParams(ref str, ctx, uRecursionLevel, + @"{CMD:", out iStart, out lParams, true)) + { + if(lParams.Count == 0) continue; + string strCmd = lParams[0]; + if(string.IsNullOrEmpty(strCmd)) continue; + + try + { + const StringComparison sc = StrUtil.CaseIgnoreCmp; + + string strOpt = ((lParams.Count >= 2) ? lParams[1] : + string.Empty); + Dictionary d = SplitParams(strOpt); + + ProcessStartInfo psi = new ProcessStartInfo(); + + string strApp, strArgs; + StrUtil.SplitCommandLine(strCmd, out strApp, out strArgs); + if(string.IsNullOrEmpty(strApp)) continue; + psi.FileName = strApp; + if(!string.IsNullOrEmpty(strArgs)) + psi.Arguments = strArgs; + + string strMethod = GetParam(d, "m", "s"); + bool bShellExec = !strMethod.Equals("c", sc); + psi.UseShellExecute = bShellExec; + + string strO = GetParam(d, "o", (bShellExec ? "0" : "1")); + bool bStdOut = strO.Equals("1", sc); + if(bStdOut) psi.RedirectStandardOutput = true; + + string strWS = GetParam(d, "ws", "n"); + if(strWS.Equals("h", sc)) + { + psi.CreateNoWindow = true; + psi.WindowStyle = ProcessWindowStyle.Hidden; + } + else if(strWS.Equals("min", sc)) + psi.WindowStyle = ProcessWindowStyle.Minimized; + else if(strWS.Equals("max", sc)) + psi.WindowStyle = ProcessWindowStyle.Maximized; + else { Debug.Assert(psi.WindowStyle == ProcessWindowStyle.Normal); } + + string strVerb = GetParam(d, "v", null); + if(!string.IsNullOrEmpty(strVerb)) + psi.Verb = strVerb; + + bool bWait = GetParam(d, "w", "1").Equals("1", sc); + + Process p = Process.Start(psi); + if(p == null) { Debug.Assert(false); continue; } + + if(bStdOut) + { + string strOut = p.StandardOutput.ReadToEnd(); + strOut = TransformContent(strOut, ctx); + str = str.Insert(iStart, strOut); + } + + if(bWait) p.WaitForExit(); + } + catch(Exception ex) + { + string strMsg = strCmd + MessageService.NewParagraph + ex.Message; + MessageService.ShowWarning(strMsg); + } + } + + return str; + } + + private static Dictionary SplitParams(string str) + { + Dictionary d = new Dictionary(); + if(string.IsNullOrEmpty(str)) return d; + + char[] vSplitPrm = new char[] { ',' }; + char[] vSplitKvp = new char[] { '=' }; + + string[] v = str.Split(vSplitPrm); + foreach(string strOption in v) + { + if(string.IsNullOrEmpty(strOption)) continue; + + string[] vKvp = strOption.Split(vSplitKvp); + if(vKvp.Length != 2) continue; + + string strKey = (vKvp[0] ?? string.Empty).Trim().ToLower(); + string strValue = (vKvp[1] ?? string.Empty).Trim(); + + d[strKey] = strValue; + } + + return d; + } + + private static string GetParam(Dictionary d, + string strName, string strDefaultValue) + { + if(d == null) { Debug.Assert(false); return strDefaultValue; } + if(strName == null) { Debug.Assert(false); return strDefaultValue; } + + Debug.Assert(strName == strName.ToLower()); + + string strValue; + if(d.TryGetValue(strName, out strValue)) return strValue; + + return strDefaultValue; + } } } diff -Nru keepass2-2.35+dfsg/KeePass/Util/Spr/SprEngine.PickChars.cs keepass2-2.36+dfsg/KeePass/Util/Spr/SprEngine.PickChars.cs --- keepass2-2.35+dfsg/KeePass/Util/Spr/SprEngine.PickChars.cs 2017-01-01 13:34:00.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Util/Spr/SprEngine.PickChars.cs 2017-01-22 19:44:20.000000000 +0000 @@ -141,20 +141,9 @@ string strOptions = string.Empty; if(vParams.Length >= 2) strOptions = (vParams[1] ?? string.Empty); - Dictionary dOptions = new Dictionary(); - string[] vOptions = strOptions.Split(new char[] { ',' }, - StringSplitOptions.RemoveEmptyEntries); - foreach(string strOption in vOptions) - { - string[] vKvp = strOption.Split(new char[] { '=' }, - StringSplitOptions.None); - if(vKvp.Length != 2) continue; - - dOptions[vKvp[0].Trim().ToLower()] = vKvp[1].Trim(); - } + Dictionary dOptions = SplitParams(strOptions); - string strID = string.Empty; - if(dOptions.ContainsKey("id")) strID = dOptions["id"].ToLower(); + string strID = GetParam(dOptions, "id", string.Empty).ToLower(); uint uCharCount = 0; if(dOptions.ContainsKey("c")) @@ -182,11 +171,9 @@ if(dOptions.ContainsKey("conv-offset")) int.TryParse(dOptions["conv-offset"], out iOffset); - string strConvFmt = string.Empty; - if(dOptions.ContainsKey("conv-fmt")) - strConvFmt = dOptions["conv-fmt"]; + string strConvFmt = GetParam(dOptions, "conv-fmt", string.Empty); - string strConv = dOptions["conv"]; + string strConv = dOptions["conv"]; // Exists, see above if(strConv.Equals("d", StrUtil.CaseIgnoreCmp)) { strRep = ConvertToDownArrows(strRep, iOffset, strConvFmt); diff -Nru keepass2-2.35+dfsg/KeePass/Util/Spr/SprRefCache.cs keepass2-2.36+dfsg/KeePass/Util/Spr/SprRefCache.cs --- keepass2-2.35+dfsg/KeePass/Util/Spr/SprRefCache.cs 1970-01-01 00:00:00.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Util/Spr/SprRefCache.cs 2017-02-25 17:51:24.000000000 +0000 @@ -0,0 +1,123 @@ +/* + KeePass Password Safe - The Open-Source Password Manager + Copyright (C) 2003-2017 Dominik Reichl + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Text; + +using KeePassLib.Utility; + +namespace KeePass.Util.Spr +{ + internal sealed class SprRefCache + { + private sealed class SprRefCacheItem + { + public readonly string Ref; + public readonly string Value; + public readonly uint Context; + + public SprRefCacheItem(string strRef, string strValue, uint uContext) + { + this.Ref = strRef; + this.Value = strValue; + this.Context = uContext; + } + } + + private List m_l = new List(); + + public SprRefCache() + { + } + + /// + /// Hash all settings of that may + /// affect the encoded value of a field reference. + /// + private static uint HashContext(SprContext ctx) + { + if(ctx == null) { Debug.Assert(false); return 0; } + + uint u = 0; + + if(ctx.ForcePlainTextPasswords) u |= 1; + if(ctx.EncodeQuotesForCommandLine) u |= 2; + if(ctx.EncodeAsAutoTypeSequence) u |= 4; + + return u; + } + + public void Clear() + { + m_l.Clear(); + } + + private string Get(string strRef, uint uCtx) + { + if(strRef == null) { Debug.Assert(false); return null; } + + foreach(SprRefCacheItem ci in m_l) + { + if(ci.Context != uCtx) continue; + + if(string.Equals(strRef, ci.Ref, StrUtil.CaseIgnoreCmp)) + return ci.Value; + } + + return null; + } + + public bool Add(string strRef, string strValue, SprContext ctx) + { + if(strRef == null) throw new ArgumentNullException("strRef"); + if(strValue == null) throw new ArgumentNullException("strValue"); + + uint uCtx = HashContext(ctx); + + if(Get(strRef, uCtx) != null) + { + Debug.Assert(false); + return false; // Exists already, do not overwrite + } + + m_l.Add(new SprRefCacheItem(strRef, strValue, uCtx)); + return true; + } + + public string Fill(string strText, SprContext ctx) + { + if(strText == null) { Debug.Assert(false); return string.Empty; } + + string str = strText; + uint uCtx = HashContext(ctx); + + foreach(SprRefCacheItem ci in m_l) + { + if(ci.Context != uCtx) continue; + + // str = str.Replace(ci.Ref, ci.Value); + str = StrUtil.ReplaceCaseInsensitive(str, ci.Ref, ci.Value); + } + + return str; + } + } +} diff -Nru keepass2-2.35+dfsg/KeePass/Util/Spr/SprSyntax.cs keepass2-2.36+dfsg/KeePass/Util/Spr/SprSyntax.cs --- keepass2-2.35+dfsg/KeePass/Util/Spr/SprSyntax.cs 2017-01-01 13:34:00.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Util/Spr/SprSyntax.cs 2017-02-24 16:41:12.000000000 +0000 @@ -34,7 +34,8 @@ public static class SprSyntax { private static readonly string[] m_vDynSepPlh = new string[] { - @"{NEWPASSWORD:", @"{T-REPLACE-RX:", @"{T-CONV:" + @"{NEWPASSWORD:", @"{T-REPLACE-RX:", @"{T-CONV:", + @"{CMD:" }; private static readonly SprStyle SprStyleOK = new SprStyle( diff -Nru keepass2-2.35+dfsg/KeePass/Util/TempFilesPool.cs keepass2-2.36+dfsg/KeePass/Util/TempFilesPool.cs --- keepass2-2.35+dfsg/KeePass/Util/TempFilesPool.cs 2017-01-01 13:34:02.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Util/TempFilesPool.cs 2017-05-28 09:50:48.000000000 +0000 @@ -48,6 +48,7 @@ new List>(); private Dictionary m_dContentLoc = new Dictionary(); + private readonly object m_oContentLocSync = new object(); private long m_nThreads = 0; @@ -159,7 +160,7 @@ { if(string.IsNullOrEmpty(strFilePattern)) { Debug.Assert(false); return; } - lock(m_dContentLoc) + lock(m_oContentLocSync) { if(m_dContentLoc.ContainsKey(strFilePattern) && !bRecursive) return; // Do not overwrite recursive with non-recursive @@ -210,7 +211,7 @@ private void ClearContentAsync() { - lock(m_dContentLoc) + lock(m_oContentLocSync) { if(m_dContentLoc.Count == 0) return; } @@ -240,7 +241,7 @@ string strTempPath = UrlUtil.GetTempPath(); Dictionary dToDo; - lock(m_dContentLoc) + lock(m_oContentLocSync) { dToDo = new Dictionary(m_dContentLoc); m_dContentLoc.Clear(); @@ -258,7 +259,7 @@ if(!bSuccess) { - lock(m_dContentLoc) + lock(m_oContentLocSync) { m_dContentLoc[kvp.Key] = kvp.Value; // Try again next time } diff -Nru keepass2-2.35+dfsg/KeePass/Util/TextSimilarity.cs keepass2-2.36+dfsg/KeePass/Util/TextSimilarity.cs --- keepass2-2.35+dfsg/KeePass/Util/TextSimilarity.cs 2017-01-01 13:34:02.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Util/TextSimilarity.cs 2017-06-04 12:17:52.000000000 +0000 @@ -17,48 +17,74 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -/* using System; using System.Collections.Generic; -using System.Text; using System.Diagnostics; +using System.Text; namespace KeePass.Util { public static class TextSimilarity { - public static int LevenshteinDistance(char[] s, char[] t) + public static int LevenshteinDistance(string s, string t) { - Debug.Assert(s != null); - if(s == null) throw new ArgumentNullException("s"); - Debug.Assert(t != null); - if(t == null) throw new ArgumentNullException("t"); + if(s == null) { Debug.Assert(false); throw new ArgumentNullException("s"); } + if(t == null) { Debug.Assert(false); throw new ArgumentNullException("t"); } - int n = s.Length, m = t.Length; - if(n <= 0) return m; + int m = s.Length, n = t.Length; if(m <= 0) return n; + if(n <= 0) return m; - int[,] d = new int[n + 1, m + 1]; + int[,] d = new int[m + 1, n + 1]; - for(int k = 0; k <= n; ++k) d[k, 0] = k; - for(int l = 0; l <= m; ++l) d[0, l] = l; + for(int k = 0; k <= m; ++k) d[k, 0] = k; + for(int l = 1; l <= n; ++l) d[0, l] = l; - for(int i = 1; i <= n; ++i) + for(int i = 1; i <= m; ++i) { char s_i = s[i - 1]; - for(int j = 1; j <= m; ++j) + for(int j = 1; j <= n; ++j) { - int nCost = ((s_i == t[j - 1]) ? 0 : 1); + int dSubst = ((s_i == t[j - 1]) ? 0 : 1); // Insertion, deletion and substitution - d[i, j] = Math.Min(d[i - 1, j] + 1, Math.Min( - d[i, j - 1] + 1, d[i - 1, j - 1] + nCost)); + d[i, j] = Math.Min(d[i, j - 1] + 1, Math.Min( + d[i - 1, j] + 1, d[i - 1, j - 1] + dSubst)); } } - return d[n, m]; + return d[m, n]; } + + /* internal static void Test() + { + string[] v = new string[] { + "Y00000000Y", "Y00001111Y", "Y11110000Y", "Y11111111Y", + "YZZZZZZZAY", "YZZZZZZZBY" + }; + int n = v.Length; + + float[,] mx = new float[n, n]; + for(int i = 0; i < n; ++i) + { + for(int j = i; j < n; ++j) + { + float f = (float)LevenshteinDistance(v[i], v[j]) / + (float)Math.Max(v[i].Length, v[j].Length); + float p = (1.0f - f) * 100.0f; + mx[i, j] = p; + mx[j, i] = p; + } + } + + float[] s = new float[n]; + for(int i = 0; i < n; ++i) + { + for(int j = 0; j < n; ++j) + s[i] += mx[i, j]; + s[i] /= n; + } + } */ } } -*/ diff -Nru keepass2-2.35+dfsg/KeePass/Util/UpdateCheckEx.cs keepass2-2.36+dfsg/KeePass/Util/UpdateCheckEx.cs --- keepass2-2.35+dfsg/KeePass/Util/UpdateCheckEx.cs 2017-01-01 13:34:02.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Util/UpdateCheckEx.cs 2017-05-28 09:28:50.000000000 +0000 @@ -238,7 +238,7 @@ private sealed class UpdateDownloadInfo { public readonly string Url; // Never null - public object SyncObj = new object(); + public readonly object SyncObj = new object(); public bool Ready = false; public List ComponentInfo = null; diff -Nru keepass2-2.35+dfsg/KeePass/Util/XmlSerialization/XmlSerializerEx.Gen.cs keepass2-2.36+dfsg/KeePass/Util/XmlSerialization/XmlSerializerEx.Gen.cs --- keepass2-2.35+dfsg/KeePass/Util/XmlSerialization/XmlSerializerEx.Gen.cs 2017-01-08 16:38:32.000000000 +0000 +++ keepass2-2.36+dfsg/KeePass/Util/XmlSerialization/XmlSerializerEx.Gen.cs 2017-06-08 09:44:50.000000000 +0000 @@ -493,6 +493,9 @@ case "OptimizeForScreenReader": o.OptimizeForScreenReader = ReadBoolean(xr); break; + case "DataViewerRect": + o.DataViewerRect = ReadString(xr); + break; case "DataEditorRect": o.DataEditorRect = ReadString(xr); break; @@ -576,6 +579,9 @@ case "MasterKeyOnSecureDesktop": o.MasterKeyOnSecureDesktop = ReadBoolean(xr); break; + case "MasterKeyExpiryRec": + o.MasterKeyExpiryRec = ReadString(xr); + break; case "ClipboardClearOnExit": o.ClipboardClearOnExit = ReadBoolean(xr); break; @@ -839,6 +845,9 @@ case "AutoTypeInterKeyDelay": o.AutoTypeInterKeyDelay = ReadInt32(xr); break; + case "AutoTypeAbortOnWindows": + o.AutoTypeAbortOnWindows = ReadListOfString(xr); + break; case "ProxyType": o.ProxyType = ReadProxyServerType(xr); break; @@ -1533,6 +1542,9 @@ case "ShowOnlyIfTrayed": o.ShowOnlyIfTrayed = ReadBoolean(xr); break; + case "GrayIcon": + o.GrayIcon = ReadBoolean(xr); + break; case "SingleClickDefault": o.SingleClickDefault = ReadBoolean(xr); break; @@ -1996,15 +2008,18 @@ case "SearchInOther": o.SearchInOther = ReadBoolean(xr); break; + case "SearchInStringNames": + o.SearchInStringNames = ReadBoolean(xr); + break; + case "SearchInTags": + o.SearchInTags = ReadBoolean(xr); + break; case "SearchInUuids": o.SearchInUuids = ReadBoolean(xr); break; case "SearchInGroupNames": o.SearchInGroupNames = ReadBoolean(xr); break; - case "SearchInTags": - o.SearchInTags = ReadBoolean(xr); - break; case "ComparisonMode": o.ComparisonMode = ReadStringComparison(xr); break; @@ -2096,6 +2111,33 @@ return o; } + private static System.Collections.Generic.List ReadListOfString(XmlReader xr) + { + System.Collections.Generic.List o = new System.Collections.Generic.List(); + + if(SkipEmptyElement(xr)) return o; + + Debug.Assert(xr.NodeType == XmlNodeType.Element); + xr.ReadStartElement(); + xr.MoveToContent(); + + while(true) + { + XmlNodeType nt = xr.NodeType; + if((nt == XmlNodeType.EndElement) || (nt == XmlNodeType.None)) break; + if(nt != XmlNodeType.Element) { Debug.Assert(false); continue; } + + System.String oElem = ReadString(xr); + o.Add(oElem); + + xr.MoveToContent(); + } + + Debug.Assert(xr.NodeType == XmlNodeType.EndElement); + xr.ReadEndElement(); + return o; + } + private static Dictionary m_dictProxyServerType = null; private static KeePassLib.ProxyServerType ReadProxyServerType(XmlReader xr) { @@ -2780,6 +2822,7 @@ m_dictAceColumnType["Size"] = KeePass.App.Configuration.AceColumnType.Size; m_dictAceColumnType["HistoryCount"] = KeePass.App.Configuration.AceColumnType.HistoryCount; m_dictAceColumnType["AttachmentCount"] = KeePass.App.Configuration.AceColumnType.AttachmentCount; + m_dictAceColumnType["LastPasswordModTime"] = KeePass.App.Configuration.AceColumnType.LastPasswordModTime; m_dictAceColumnType["Count"] = KeePass.App.Configuration.AceColumnType.Count; } @@ -3110,33 +3153,6 @@ xr.MoveToContent(); } - - Debug.Assert(xr.NodeType == XmlNodeType.EndElement); - xr.ReadEndElement(); - return o; - } - - private static System.Collections.Generic.List ReadListOfString(XmlReader xr) - { - System.Collections.Generic.List o = new System.Collections.Generic.List(); - - if(SkipEmptyElement(xr)) return o; - - Debug.Assert(xr.NodeType == XmlNodeType.Element); - xr.ReadStartElement(); - xr.MoveToContent(); - - while(true) - { - XmlNodeType nt = xr.NodeType; - if((nt == XmlNodeType.EndElement) || (nt == XmlNodeType.None)) break; - if(nt != XmlNodeType.Element) { Debug.Assert(false); continue; } - - System.String oElem = ReadString(xr); - o.Add(oElem); - - xr.MoveToContent(); - } Debug.Assert(xr.NodeType == XmlNodeType.EndElement); xr.ReadEndElement(); diff -Nru keepass2-2.35+dfsg/KeePassLib/Cryptography/Cipher/CtrBlockCipher.cs keepass2-2.36+dfsg/KeePassLib/Cryptography/Cipher/CtrBlockCipher.cs --- keepass2-2.35+dfsg/KeePassLib/Cryptography/Cipher/CtrBlockCipher.cs 2017-01-01 13:33:46.000000000 +0000 +++ keepass2-2.36+dfsg/KeePassLib/Cryptography/Cipher/CtrBlockCipher.cs 2017-03-03 16:59:24.000000000 +0000 @@ -28,6 +28,8 @@ { public abstract class CtrBlockCipher : IDisposable { + private bool m_bDisposed = false; + private byte[] m_pBlock; private int m_iBlockPos; @@ -57,6 +59,8 @@ { MemUtil.ZeroByteArray(m_pBlock); m_iBlockPos = m_pBlock.Length; + + m_bDisposed = true; } } @@ -69,6 +73,7 @@ public void Encrypt(byte[] m, int iOffset, int cb) { + if(m_bDisposed) throw new ObjectDisposedException(null); if(m == null) throw new ArgumentNullException("m"); if(iOffset < 0) throw new ArgumentOutOfRangeException("iOffset"); if(cb < 0) throw new ArgumentOutOfRangeException("cb"); diff -Nru keepass2-2.35+dfsg/KeePassLib/Cryptography/CryptoRandom.cs keepass2-2.36+dfsg/KeePassLib/Cryptography/CryptoRandom.cs --- keepass2-2.35+dfsg/KeePassLib/Cryptography/CryptoRandom.cs 2017-01-01 13:33:46.000000000 +0000 +++ keepass2-2.36+dfsg/KeePassLib/Cryptography/CryptoRandom.cs 2017-05-28 11:46:26.000000000 +0000 @@ -47,8 +47,8 @@ private RNGCryptoServiceProvider m_rng = new RNGCryptoServiceProvider(); private ulong m_uGeneratedBytesCount = 0; - private static object g_oSyncRoot = new object(); - private object m_oSyncRoot = new object(); + private static readonly object g_oSyncRoot = new object(); + private readonly object m_oSyncRoot = new object(); private static CryptoRandom g_pInstance = null; public static CryptoRandom Instance @@ -364,5 +364,26 @@ Debug.Assert(iPos == pbRes.Length); return pbRes; } + + private static int g_iWeakSeed = 0; + public static Random NewWeakRandom() + { + long s64 = DateTime.UtcNow.ToBinary(); + int s32 = (int)((s64 >> 32) ^ s64); + + lock(g_oSyncRoot) + { + unchecked + { + g_iWeakSeed += 0x78A8C4B7; // Prime number + s32 ^= g_iWeakSeed; + } + } + + // Prevent overflow in the Random constructor of .NET 2.0 + if(s32 == int.MinValue) s32 = int.MaxValue; + + return new Random(s32); + } } } diff -Nru keepass2-2.35+dfsg/KeePassLib/Cryptography/CryptoRandomStream.cs keepass2-2.36+dfsg/KeePassLib/Cryptography/CryptoRandomStream.cs --- keepass2-2.35+dfsg/KeePassLib/Cryptography/CryptoRandomStream.cs 2017-01-01 13:33:46.000000000 +0000 +++ keepass2-2.36+dfsg/KeePassLib/Cryptography/CryptoRandomStream.cs 2017-03-03 16:45:52.000000000 +0000 @@ -67,6 +67,7 @@ public sealed class CryptoRandomStream : IDisposable { private readonly CrsAlgorithm m_crsAlgorithm; + private bool m_bDisposed = false; private byte[] m_pbState = null; private byte m_i = 0; @@ -170,6 +171,8 @@ m_j = 0; } else { Debug.Assert(false); } + + m_bDisposed = true; } } @@ -180,8 +183,9 @@ /// Returns random bytes. public byte[] GetRandomBytes(uint uRequestedCount) { - if(uRequestedCount == 0) return MemUtil.EmptyByteArray; + if(m_bDisposed) throw new ObjectDisposedException(null); + if(uRequestedCount == 0) return MemUtil.EmptyByteArray; if(uRequestedCount > (uint)int.MaxValue) throw new ArgumentOutOfRangeException("uRequestedCount"); int cb = (int)uRequestedCount; diff -Nru keepass2-2.35+dfsg/KeePassLib/Cryptography/QualityEstimation.cs keepass2-2.36+dfsg/KeePassLib/Cryptography/QualityEstimation.cs --- keepass2-2.35+dfsg/KeePassLib/Cryptography/QualityEstimation.cs 2017-01-01 13:33:48.000000000 +0000 +++ keepass2-2.36+dfsg/KeePassLib/Cryptography/QualityEstimation.cs 2017-05-28 09:58:06.000000000 +0000 @@ -281,7 +281,7 @@ } } - private static object m_objSyncInit = new object(); + private static readonly object m_objSyncInit = new object(); private static List m_lCharTypes = null; private static void EnsureInitialized() diff -Nru keepass2-2.35+dfsg/KeePassLib/Cryptography/SelfTest.cs keepass2-2.36+dfsg/KeePassLib/Cryptography/SelfTest.cs --- keepass2-2.35+dfsg/KeePassLib/Cryptography/SelfTest.cs 2017-01-01 13:33:48.000000000 +0000 +++ keepass2-2.36+dfsg/KeePassLib/Cryptography/SelfTest.cs 2017-01-21 20:21:42.000000000 +0000 @@ -58,21 +58,24 @@ /// public static void Perform() { + Random r = CryptoRandom.NewWeakRandom(); + TestFipsComplianceProblems(); // Must be the first test TestRijndael(); - TestSalsa20(); - TestChaCha20(); - TestBlake2b(); + TestSalsa20(r); + TestChaCha20(r); + TestBlake2b(r); TestArgon2(); TestHmac(); - TestNativeKeyTransform(); + TestKeyTransform(r); + TestNativeKeyTransform(r); TestHmacOtp(); - TestProtectedObjects(); - TestMemUtil(); + TestProtectedObjects(r); + TestMemUtil(r); TestStrUtil(); TestUrlUtil(); @@ -146,7 +149,7 @@ throw new SecurityException("AES"); } - private static void TestSalsa20() + private static void TestSalsa20(Random r) { #if DEBUG // Test values from official set 6, vector 3 @@ -179,7 +182,6 @@ 0x28, 0xF5, 0x67, 0x91, 0xD5, 0xB7, 0xCE, 0x23 }; - Random r = new Random(); int nPos = Salsa20ToPos(c, r, pb.Length, 65536); Array.Clear(pb, 0, pb.Length); c.Encrypt(pb, 0, pb.Length); @@ -223,7 +225,7 @@ } #endif - private static void TestChaCha20() + private static void TestChaCha20(Random r) { // ====================================================== // Test vector from RFC 7539, section 2.3.2 @@ -328,7 +330,6 @@ "98CED759C3FF9B6477338F3DA4F9CD8514EA9982CCAFB341B2384DD902F3D1AB" + "7AC61DD29C6F21BA5B862F3730E37CFDC4FD806C22F221"); - Random r = new Random(); using(MemoryStream msEnc = new MemoryStream()) { using(ChaCha20Stream c = new ChaCha20Stream(msEnc, true, pbKey, pbIV)) @@ -418,7 +419,7 @@ #endif } - private static void TestBlake2b() + private static void TestBlake2b(Random r) { #if DEBUG Blake2b h = new Blake2b(); @@ -479,7 +480,6 @@ 0x3F, 0x08, 0x8A, 0x93, 0xF8, 0x75, 0x91, 0xB0 }; - Random r = new Random(); int p = 0; while(p < pbData.Length) { @@ -701,12 +701,45 @@ } #endif - private static void TestNativeKeyTransform() + private static void TestKeyTransform(Random r) + { +#if DEBUG + // Up to KeePass 2.34, the OtpKeyProv plugin used the public + // CompositeKey.TransformKeyManaged method (and a finalizing + // SHA-256 computation), which became an internal method of + // the AesKdf class in KeePass 2.35, thus OtpKeyProv now + // uses the AesKdf class; here we ensure that the results + // are the same + + byte[] pbKey = new byte[32]; + r.NextBytes(pbKey); + byte[] pbSeed = new byte[32]; + r.NextBytes(pbSeed); + ulong uRounds = (ulong)r.Next(1, 0x7FFF); + + byte[] pbMan = new byte[pbKey.Length]; + Array.Copy(pbKey, pbMan, pbKey.Length); + if(!AesKdf.TransformKeyManaged(pbMan, pbSeed, uRounds)) + throw new SecurityException("AES-KDF-1"); + pbMan = CryptoUtil.HashSha256(pbMan); + + AesKdf kdf = new AesKdf(); + KdfParameters p = kdf.GetDefaultParameters(); + p.SetUInt64(AesKdf.ParamRounds, uRounds); + p.SetByteArray(AesKdf.ParamSeed, pbSeed); + byte[] pbKdf = kdf.Transform(pbKey, p); + + if(!MemUtil.ArraysEqual(pbMan, pbKdf)) + throw new SecurityException("AES-KDF-2"); +#endif + } + + private static void TestNativeKeyTransform(Random r) { #if DEBUG byte[] pbOrgKey = CryptoRandom.Instance.GetRandomBytes(32); byte[] pbSeed = CryptoRandom.Instance.GetRandomBytes(32); - ulong uRounds = (ulong)((new Random()).Next(1, 0x3FFF)); + ulong uRounds = (ulong)r.Next(1, 0x3FFF); byte[] pbManaged = new byte[32]; Array.Copy(pbOrgKey, pbManaged, 32); @@ -723,10 +756,9 @@ #endif } - private static void TestMemUtil() + private static void TestMemUtil(Random r) { #if DEBUG - Random r = new Random(); byte[] pb = CryptoRandom.Instance.GetRandomBytes((uint)r.Next( 0, 0x2FFFF)); @@ -813,7 +845,7 @@ #endif } - private static void TestProtectedObjects() + private static void TestProtectedObjects(Random r) { #if DEBUG Encoding enc = StrUtil.Utf8; @@ -868,7 +900,6 @@ if(!ps.IsProtected) throw new SecurityException("ProtectedString-9"); if(!ps2.IsProtected) throw new SecurityException("ProtectedString-10"); - Random r = new Random(); string str = string.Empty; ps = new ProtectedString(); for(int i = 0; i < 100; ++i) diff -Nru keepass2-2.35+dfsg/KeePassLib/Properties/AssemblyInfo.cs keepass2-2.36+dfsg/KeePassLib/Properties/AssemblyInfo.cs --- keepass2-2.35+dfsg/KeePassLib/Properties/AssemblyInfo.cs 2017-01-09 10:06:46.000000000 +0000 +++ keepass2-2.36+dfsg/KeePassLib/Properties/AssemblyInfo.cs 2017-06-09 08:35:52.000000000 +0000 @@ -38,5 +38,5 @@ [assembly: Guid("395f6eec-a1e0-4438-aa82-b75099348134")] // Assembly version information -[assembly: AssemblyVersion("2.35.0.*")] -[assembly: AssemblyFileVersion("2.35.0.0")] +[assembly: AssemblyVersion("2.36.0.*")] +[assembly: AssemblyFileVersion("2.36.0.0")] diff -Nru keepass2-2.35+dfsg/KeePassLib/PwDefs.cs keepass2-2.36+dfsg/KeePassLib/PwDefs.cs --- keepass2-2.35+dfsg/KeePassLib/PwDefs.cs 2017-01-09 10:06:42.000000000 +0000 +++ keepass2-2.36+dfsg/KeePassLib/PwDefs.cs 2017-06-09 08:35:48.000000000 +0000 @@ -55,18 +55,18 @@ /// e.g. 2.19 = 0x02130000. /// It is highly recommended to use FileVersion64 instead. /// - public const uint Version32 = 0x02230000; + public const uint Version32 = 0x02240000; /// /// Version, encoded as 64-bit unsigned integer /// (component-wise, 16 bits per component). /// - public const ulong FileVersion64 = 0x0002002300000000UL; + public const ulong FileVersion64 = 0x0002002400000000UL; /// /// Version, encoded as string. /// - public const string VersionString = "2.35"; + public const string VersionString = "2.36"; public const string Copyright = @"Copyright © 2003-2017 Dominik Reichl"; @@ -296,6 +296,22 @@ set { m_bSearchInOther = value; } } + private bool m_bSearchInStringNames = false; + [DefaultValue(false)] + public bool SearchInStringNames + { + get { return m_bSearchInStringNames; } + set { m_bSearchInStringNames = value; } + } + + private bool m_bSearchInTags = true; + [DefaultValue(true)] + public bool SearchInTags + { + get { return m_bSearchInTags; } + set { m_bSearchInTags = value; } + } + private bool m_bSearchInUuids = false; [DefaultValue(false)] public bool SearchInUuids @@ -312,14 +328,6 @@ set { m_bSearchInGroupNames = value; } } - private bool m_bSearchInTags = true; - [DefaultValue(true)] - public bool SearchInTags - { - get { return m_bSearchInTags; } - set { m_bSearchInTags = value; } - } - #if KeePassUAP private StringComparison m_scType = StringComparison.OrdinalIgnoreCase; #else @@ -381,20 +389,21 @@ { SearchParameters sp = new SearchParameters(); - // sp.m_strText = string.Empty; - // sp.m_bRegex = false; + Debug.Assert(sp.m_strText.Length == 0); + Debug.Assert(!sp.m_bRegex); sp.m_bSearchInTitles = false; sp.m_bSearchInUserNames = false; - // sp.m_bSearchInPasswords = false; + Debug.Assert(!sp.m_bSearchInPasswords); sp.m_bSearchInUrls = false; sp.m_bSearchInNotes = false; sp.m_bSearchInOther = false; - // sp.m_bSearchInUuids = false; - // sp.SearchInGroupNames = false; + Debug.Assert(!sp.m_bSearchInStringNames); sp.m_bSearchInTags = false; - // sp.m_scType = StringComparison.InvariantCultureIgnoreCase; - // sp.m_bExcludeExpired = false; - // m_bRespectEntrySearchingDisabled = true; + Debug.Assert(!sp.m_bSearchInUuids); + Debug.Assert(!sp.m_bSearchInGroupNames); + // Debug.Assert(sp.m_scType == StringComparison.InvariantCultureIgnoreCase); + Debug.Assert(!sp.m_bExcludeExpired); + Debug.Assert(sp.m_bRespectEntrySearchingDisabled); return sp; } diff -Nru keepass2-2.35+dfsg/KeePassLib/PwGroup.cs keepass2-2.36+dfsg/KeePassLib/PwGroup.cs --- keepass2-2.35+dfsg/KeePassLib/PwGroup.cs 2017-01-01 13:33:48.000000000 +0000 +++ keepass2-2.36+dfsg/KeePassLib/PwGroup.cs 2017-05-08 18:16:58.000000000 +0000 @@ -675,7 +675,8 @@ if(!groupHandler(pg)) return false; } - pg.PreOrderTraverseTree(groupHandler, entryHandler); + if(!pg.PreOrderTraverseTree(groupHandler, entryHandler)) + return false; } return true; @@ -878,9 +879,10 @@ bool bUrl = sp.SearchInUrls; bool bNotes = sp.SearchInNotes; bool bOther = sp.SearchInOther; + bool bStringName = sp.SearchInStringNames; + bool bTags = sp.SearchInTags; bool bUuids = sp.SearchInUuids; bool bGroupName = sp.SearchInGroupNames; - bool bTags = sp.SearchInTags; // bool bExcludeExpired = sp.ExcludeExpired; // bool bRespectEntrySearchingDisabled = sp.RespectEntrySearchingDisabled; @@ -958,12 +960,15 @@ if(lResults.UCount != uInitialResults) break; } - if(bUuids && (lResults.UCount == uInitialResults)) - SearchEvalAdd(sp, pe.Uuid.ToHexString(), rx, pe, lResults); + if(bStringName) + { + foreach(KeyValuePair kvp in pe.Strings) + { + if(lResults.UCount != uInitialResults) break; - if(bGroupName && (lResults.UCount == uInitialResults) && - (pe.ParentGroup != null)) - SearchEvalAdd(sp, pe.ParentGroup.Name, rx, pe, lResults); + SearchEvalAdd(sp, kvp.Key, rx, pe, lResults); + } + } if(bTags) { @@ -974,6 +979,13 @@ SearchEvalAdd(sp, strTag, rx, pe, lResults); } } + + if(bUuids && (lResults.UCount == uInitialResults)) + SearchEvalAdd(sp, pe.Uuid.ToHexString(), rx, pe, lResults); + + if(bGroupName && (lResults.UCount == uInitialResults) && + (pe.ParentGroup != null)) + SearchEvalAdd(sp, pe.ParentGroup.Name, rx, pe, lResults); } } diff -Nru keepass2-2.35+dfsg/KeePassLib/Security/ProtectedBinary.cs keepass2-2.36+dfsg/KeePassLib/Security/ProtectedBinary.cs --- keepass2-2.35+dfsg/KeePassLib/Security/ProtectedBinary.cs 2017-01-01 13:33:48.000000000 +0000 +++ keepass2-2.36+dfsg/KeePassLib/Security/ProtectedBinary.cs 2017-05-28 09:57:34.000000000 +0000 @@ -139,7 +139,7 @@ private PbMemProt m_mp = PbMemProt.None; // Actual protection - private object m_objSync = new object(); + private readonly object m_objSync = new object(); private static byte[] g_pbKey32 = null; diff -Nru keepass2-2.35+dfsg/KeePassLib/Translation/KPTranslation.cs keepass2-2.36+dfsg/KeePassLib/Translation/KPTranslation.cs --- keepass2-2.35+dfsg/KeePassLib/Translation/KPTranslation.cs 2017-01-01 13:33:50.000000000 +0000 +++ keepass2-2.36+dfsg/KeePassLib/Translation/KPTranslation.cs 2017-04-10 14:11:20.000000000 +0000 @@ -224,31 +224,76 @@ ((TrackBar)c).RightToLeftLayout = true; else if(c is TreeView) ((TreeView)c).RightToLeftLayout = true; - else if(c is ToolStrip) - RtlApplyToToolStripItems(((ToolStrip)c).Items); + // else if(c is ToolStrip) + // RtlApplyToToolStripItems(((ToolStrip)c).Items); + /* else if(c is Button) // Also see Label + { + Button btn = (c as Button); + Image img = btn.Image; + if(img != null) + { + Image imgNew = (Image)img.Clone(); + imgNew.RotateFlip(RotateFlipType.RotateNoneFlipX); + btn.Image = imgNew; + } + } + else if(c is Label) // Also see Button + { + Label lbl = (c as Label); + Image img = lbl.Image; + if(img != null) + { + Image imgNew = (Image)img.Clone(); + imgNew.RotateFlip(RotateFlipType.RotateNoneFlipX); + lbl.Image = imgNew; + } + } */ - if((c is GroupBox) || (c is Panel)) RtlMoveChildControls(c); + if(IsRtlMoveChildsRequired(c)) RtlMoveChildControls(c); } } + internal static bool IsRtlMoveChildsRequired(Control c) + { + if(c == null) { Debug.Assert(false); return false; } + + return ((c is GroupBox) || (c is Panel)); + } + private static void RtlMoveChildControls(Control cParent) { int nParentWidth = cParent.Size.Width; foreach(Control c in cParent.Controls) { - Point ptCur = c.Location; - c.Location = new Point(nParentWidth - c.Size.Width - ptCur.X, ptCur.Y); + DockStyle ds = c.Dock; + if(ds == DockStyle.Left) + c.Dock = DockStyle.Right; + else if(ds == DockStyle.Right) + c.Dock = DockStyle.Left; + else + { + Point ptCur = c.Location; + c.Location = new Point(nParentWidth - c.Size.Width - ptCur.X, ptCur.Y); + } } } + /* private static readonly string[] g_vRtlMirrorItemNames = new string[] { }; private static void RtlApplyToToolStripItems(ToolStripItemCollection tsic) { foreach(ToolStripItem tsi in tsic) { - tsi.RightToLeftAutoMirrorImage = true; + if(tsi == null) { Debug.Assert(false); continue; } + + if(Array.IndexOf(g_vRtlMirrorItemNames, tsi.Name) >= 0) + tsi.RightToLeftAutoMirrorImage = true; + + ToolStripDropDownItem tsdd = (tsi as ToolStripDropDownItem); + if(tsdd != null) + RtlApplyToToolStripItems(tsdd.DropDownItems); } - } + } */ public void ApplyTo(string strTableName, ToolStripItemCollection tsic) { diff -Nru keepass2-2.35+dfsg/KeePassLib/Utility/MonoWorkarounds.cs keepass2-2.36+dfsg/KeePassLib/Utility/MonoWorkarounds.cs --- keepass2-2.35+dfsg/KeePassLib/Utility/MonoWorkarounds.cs 2017-01-01 13:33:50.000000000 +0000 +++ keepass2-2.36+dfsg/KeePassLib/Utility/MonoWorkarounds.cs 2017-06-04 09:20:08.000000000 +0000 @@ -37,15 +37,17 @@ { public static class MonoWorkarounds { - private static Dictionary m_dForceReq = new Dictionary(); - private static Thread m_thFixClip = null; - // private static Predicate m_fOwnWindow = null; + private const string AppXDoTool = "xdotool"; - private static bool? m_bReq = null; + private static Dictionary g_dForceReq = new Dictionary(); + private static Thread g_thFixClip = null; + // private static Predicate g_fOwnWindow = null; + + private static bool? g_bReq = null; public static bool IsRequired() { - if(!m_bReq.HasValue) m_bReq = NativeLib.IsUnix(); - return m_bReq.Value; + if(!g_bReq.HasValue) g_bReq = NativeLib.IsUnix(); + return g_bReq.Value; } // 1219: @@ -84,6 +86,9 @@ // Finalizer of NotifyIcon throws on Mac OS X. // See also 1354. // https://sourceforge.net/p/keepass/bugs/1574/ + // 1632: + // RichTextBox rendering bug for bold/italic text. + // https://sourceforge.net/p/keepass/bugs/1632/ // 2139: // Shortcut keys are ignored. // https://sourceforge.net/p/keepass/feature-requests/2139/ @@ -136,7 +141,7 @@ if(!MonoWorkarounds.IsRequired()) return false; bool bForce; - if(m_dForceReq.TryGetValue(uBugID, out bForce)) return bForce; + if(g_dForceReq.TryGetValue(uBugID, out bForce)) return bForce; ulong v = NativeLib.MonoVersion; if(v != 0) @@ -159,7 +164,7 @@ uint uID; if(StrUtil.TryParseUInt(strID.Trim(), out uID)) - m_dForceReq[uID] = bEnabled; + g_dForceReq[uID] = bEnabled; } } @@ -167,15 +172,15 @@ { Terminate(); - // m_fOwnWindow = fOwnWindow; + // g_fOwnWindow = fOwnWindow; if(IsRequired(1530)) { try { ThreadStart ts = new ThreadStart(MonoWorkarounds.FixClipThread); - m_thFixClip = new Thread(ts); - m_thFixClip.Start(); + g_thFixClip = new Thread(ts); + g_thFixClip.Start(); } catch(Exception) { Debug.Assert(false); } } @@ -183,12 +188,12 @@ internal static void Terminate() { - if(m_thFixClip != null) + if(g_thFixClip != null) { - try { m_thFixClip.Abort(); } + try { g_thFixClip.Abort(); } catch(Exception) { Debug.Assert(false); } - m_thFixClip = null; + g_thFixClip = null; } } @@ -198,25 +203,43 @@ { #if !KeePassUAP const string strXSel = "xsel"; + const string strXSelR = "--output --clipboard"; + const string strXSelW = "--input --clipboard --nodetach"; const AppRunFlags rfW = AppRunFlags.WaitForExit; + const int msDelay = 250; + + // XSel is required + string strTest = NativeLib.RunConsoleApp(strXSel, strXSelR); + if(strTest == null) return; // XSel not installed + + // Without XDoTool, the workaround would be applied to + // all applications, which may corrupt the clipboard + // when it doesn't contain simple text only; + // https://sourceforge.net/p/keepass/bugs/1603/#a113 + strTest = (NativeLib.RunConsoleApp(AppXDoTool, + "help") ?? string.Empty).Trim(); + if(strTest.Length == 0) return; + + Thread.Sleep(msDelay); string strLast = null; while(true) { - string str = NativeLib.RunConsoleApp(strXSel, - "--output --clipboard"); - if(str == null) return; // 'xsel' not installed - - if(str != strLast) + string str = NativeLib.RunConsoleApp(strXSel, strXSelR); + if(str == null) { Debug.Assert(false); } + else if(str != strLast) { if(NeedClipboardWorkaround()) - NativeLib.RunConsoleApp(strXSel, - "--input --clipboard", str, rfW); + { + // Use --nodetach to prevent clipboard corruption; + // https://sourceforge.net/p/keepass/bugs/1603/ + NativeLib.RunConsoleApp(strXSel, strXSelW, str, rfW); + } strLast = str; } - Thread.Sleep(250); + Thread.Sleep(msDelay); } #endif } @@ -226,18 +249,17 @@ catch(Exception) { Debug.Assert(false); } } catch(Exception) { Debug.Assert(false); } - finally { m_thFixClip = null; } + finally { g_thFixClip = null; } } +#if !KeePassUAP private static bool NeedClipboardWorkaround() { - const bool bDef = true; - try { - string strHandle = (NativeLib.RunConsoleApp("xdotool", + string strHandle = (NativeLib.RunConsoleApp(AppXDoTool, "getactivewindow") ?? string.Empty).Trim(); - if(strHandle.Length == 0) return bDef; + if(strHandle.Length == 0) { Debug.Assert(false); return false; } // IntPtr h = new IntPtr(long.Parse(strHandle)); long.Parse(strHandle); // Validate @@ -245,7 +267,7 @@ // Detection of own windows based on Form.Handle // comparisons doesn't work reliably (Mono's handles // are usually off by 1) - // Predicate fOwnWindow = m_fOwnWindow; + // Predicate fOwnWindow = g_fOwnWindow; // if(fOwnWindow != null) // { // if(fOwnWindow(h)) return true; @@ -257,20 +279,15 @@ if(strWmClass.IndexOf("\"" + PwDefs.ResClass + "\"", StrUtil.CaseIgnoreCmp) >= 0) return true; - - // Workaround for Remmina if(strWmClass.IndexOf("\"Remmina\"", StrUtil.CaseIgnoreCmp) >= 0) return true; - - return false; } catch(ThreadAbortException) { throw; } catch(Exception) { Debug.Assert(false); } - return bDef; + return false; } -#if !KeePassUAP public static void ApplyTo(Form f) { if(!MonoWorkarounds.IsRequired()) return; diff -Nru keepass2-2.35+dfsg/ShInstUtil/ShInstUtil.rc keepass2-2.36+dfsg/ShInstUtil/ShInstUtil.rc --- keepass2-2.35+dfsg/ShInstUtil/ShInstUtil.rc 2017-01-09 10:09:00.000000000 +0000 +++ keepass2-2.36+dfsg/ShInstUtil/ShInstUtil.rc 2017-06-09 08:38:06.000000000 +0000 @@ -65,8 +65,8 @@ // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,35,0,0 - PRODUCTVERSION 2,35,0,0 + FILEVERSION 2,36,0,0 + PRODUCTVERSION 2,36,0,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -83,12 +83,12 @@ BEGIN VALUE "CompanyName", "Dominik Reichl" VALUE "FileDescription", "ShInstUtil - KeePass Helper Utility" - VALUE "FileVersion", "2.35.0.0" + VALUE "FileVersion", "2.36.0.0" VALUE "InternalName", "ShInstUtil" VALUE "LegalCopyright", "Copyright (c) 2007-2017 Dominik Reichl" VALUE "OriginalFilename", "ShInstUtil.exe" VALUE "ProductName", "ShInstUtil - KeePass Helper Utility" - VALUE "ProductVersion", "2.35.0.0" + VALUE "ProductVersion", "2.36.0.0" END END BLOCK "VarFileInfo" diff -Nru keepass2-2.35+dfsg/Translation/DefaultText.xml keepass2-2.36+dfsg/Translation/DefaultText.xml --- keepass2-2.35+dfsg/Translation/DefaultText.xml 2016-12-18 18:51:46.000000000 +0000 +++ keepass2-2.36+dfsg/Translation/DefaultText.xml 2017-05-23 20:12:50.000000000 +0000 @@ -160,6 +160,9 @@ Auto-Type + + Auto-Type has been aborted, because the target window is disallowed by the application policy (defined by your administrator). + Always show global auto-type entry selection dialog @@ -194,7 +197,7 @@ An entry matches if its URL is contained in the target window title - Auto-type obfuscation may not work with all windows. + Auto-Type obfuscation may not work with all windows. Prepend special initialization sequence for Internet Explorer windows @@ -595,6 +598,18 @@ Drop to background after copying data to the clipboard + + Duplicate Passwords + + + Entries using the same password: + + + List of entries that are using the same passwords. + + + No duplicate passwords have been found. + The string field name you specified already exists. String field names must be unique for each entry. @@ -1213,6 +1228,9 @@ Last Modification Time + + Last Password Modification Time (Based on History) + Limit to single instance @@ -1501,6 +1519,12 @@ Enter the password: + + Password Quality + + + Estimated quality of the entry passwords. + Password and repeated password aren't identical! @@ -1639,6 +1663,9 @@ Professional + + Quality + Exclude expired entries in quick searches @@ -1888,6 +1915,18 @@ Show tray icon only if main window has been sent to tray + + Similar Passwords + + + Entries using similar passwords (similarity: {PARAM}): + + + List of entries that are using similar passwords. + + + The list shows entries that are using similar, but not identical passwords. For finding entries that are using the same passwords, use the 'Find Duplicate Passwords' command (in the main menu). + Size @@ -2023,6 +2062,15 @@ The key transformation took {PARAM} seconds. + + Tray Icon + + + Use gray tray icon + + + Single click instead of double click for default tray icon action + Trigger diff -Nru keepass2-2.35+dfsg/Translation/TrlUtil/FormTrlMgr.cs keepass2-2.36+dfsg/Translation/TrlUtil/FormTrlMgr.cs --- keepass2-2.35+dfsg/Translation/TrlUtil/FormTrlMgr.cs 2017-01-01 13:34:02.000000000 +0000 +++ keepass2-2.36+dfsg/Translation/TrlUtil/FormTrlMgr.cs 2017-05-17 13:42:54.000000000 +0000 @@ -61,7 +61,6 @@ AddForm(l, new EditAutoTypeItemForm()); AddForm(l, new EditStringForm()); AddForm(l, new EntropyForm()); - AddForm(l, new EntryListForm()); AddForm(l, new EntryReportForm()); AddForm(l, new ExchangeDataForm()); AddForm(l, new FieldPickerForm()); @@ -76,6 +75,7 @@ AddForm(l, new KeyCreationForm()); AddForm(l, new KeyPromptForm()); AddForm(l, new LanguageForm()); + AddForm(l, new ListViewForm()); AddForm(l, new KeePass.Forms.MainForm()); AddForm(l, new OptionsForm()); AddForm(l, new PluginsForm()); @@ -92,6 +92,7 @@ AddForm(l, new UpdateCheckForm()); AddForm(l, new UrlOverrideForm()); AddForm(l, new UrlOverridesForm()); + AddForm(l, new WebDocForm()); AddForm(l, new XmlReplaceForm()); return l; diff -Nru keepass2-2.35+dfsg/Translation/TrlUtil/MainForm.cs keepass2-2.36+dfsg/Translation/TrlUtil/MainForm.cs --- keepass2-2.35+dfsg/Translation/TrlUtil/MainForm.cs 2017-01-03 10:19:16.000000000 +0000 +++ keepass2-2.36+dfsg/Translation/TrlUtil/MainForm.cs 2017-05-25 18:04:06.000000000 +0000 @@ -20,11 +20,11 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Drawing; +using System.Reflection; using System.Text; using System.Windows.Forms; -using System.Diagnostics; -using System.Reflection; using KeePass.App; using KeePass.Resources; @@ -576,7 +576,7 @@ if(!string.IsNullOrEmpty(m_trl.UnusedText)) ShowValidationWarning(@"It is recommended to clear the 'Unused Text' tab."); - try { Validate3Dots(); } + try { ValidateTranslation(); } catch(Exception) { Debug.Assert(false); } try @@ -602,9 +602,11 @@ str, TrlUtilName, MessageBoxButtons.OK, MessageBoxIcon.Warning); } - private void Validate3Dots() + private void ValidateTranslation() { - if(m_trl.Properties.RightToLeft) return; // Check doesn't support RTL + string[] vCaseSensWords = new string[] { PwDefs.ShortProductName }; + + bool bRtl = m_trl.Properties.RightToLeft; foreach(KPStringTable kpst in m_trl.StringTables) { @@ -614,10 +616,27 @@ string strTrl = kpi.Value; if(string.IsNullOrEmpty(strEn) || string.IsNullOrEmpty(strTrl)) continue; + // Check case-sensitive words + foreach(string strWord in vCaseSensWords) + { + bool bWordEn = (strEn.IndexOf(strWord) >= 0); + if(!bWordEn) + { + Debug.Assert(strEn.IndexOf(strWord, StrUtil.CaseIgnoreCmp) < 0); + } + if(bWordEn && (strTrl.IndexOf(strWord) < 0) && + (strTrl.IndexOf(strWord, StrUtil.CaseIgnoreCmp) >= 0)) + ShowValidationWarning("The English string" + + MessageService.NewParagraph + strEn + MessageService.NewParagraph + + @"contains the case-sensitive word '" + strWord + + @"', but the translated string does not:" + + MessageService.NewParagraph + strTrl); + } + + // Check 3 dots bool bEllEn = (strEn.EndsWith("...") || strEn.EndsWith(@"…")); bool bEllTrl = (strTrl.EndsWith("...") || strTrl.EndsWith(@"…")); - - if(bEllEn && !bEllTrl) + if(bEllEn && !bEllTrl && !bRtl) // Check doesn't support RTL ShowValidationWarning("The English string" + MessageService.NewParagraph + strEn + MessageService.NewParagraph + "ends with 3 dots, but the translated string does not:" + diff -Nru keepass2-2.35+dfsg/Translation/TrlUtil/PreviewForm.cs keepass2-2.36+dfsg/Translation/TrlUtil/PreviewForm.cs --- keepass2-2.35+dfsg/Translation/TrlUtil/PreviewForm.cs 2017-01-01 13:34:02.000000000 +0000 +++ keepass2-2.36+dfsg/Translation/TrlUtil/PreviewForm.cs 2017-04-09 08:46:58.000000000 +0000 @@ -19,19 +19,21 @@ using System; using System.Collections.Generic; -using System.Text; -using System.Windows.Forms; -using System.Drawing; using System.Diagnostics; +using System.Drawing; using System.Reflection; +using System.Text; +using System.Windows.Forms; using KeePass.UI; +using KeePassLib.Cryptography; + namespace TrlUtil { public sealed class PreviewForm : Form { - private static Random m_rand = new Random(); + private static Random m_rand = CryptoRandom.NewWeakRandom(); public PreviewForm() { @@ -84,7 +86,7 @@ else if(t == typeof(Label)) { cCopy = new Label(); - (cCopy as Label).AutoSize = (c as Label).AutoSize; + // (cCopy as Label).AutoSize = (c as Label).AutoSize; } else if(t == typeof(CheckBox)) cCopy = new CheckBox(); else if(t == typeof(RadioButton)) cCopy = new RadioButton(); @@ -129,15 +131,21 @@ cCopy.BackColor = clr; cCopy.Text = c.Text; - Type tCopy = cCopy.GetType(); - PropertyInfo piAutoSizeSrc = t.GetProperty("AutoSize", typeof(bool)); - PropertyInfo piAutoSizeDst = tCopy.GetProperty("AutoSize", typeof(bool)); - if((piAutoSizeSrc != null) && (piAutoSizeDst != null)) - { - MethodInfo miSrc = piAutoSizeSrc.GetGetMethod(); - MethodInfo miDst = piAutoSizeDst.GetSetMethod(); - miDst.Invoke(cCopy, new object[] { miSrc.Invoke(c, null) }); - } + // Type tCopy = cCopy.GetType(); + // PropertyInfo piAutoSizeSrc = t.GetProperty("AutoSize", typeof(bool)); + // PropertyInfo piAutoSizeDst = tCopy.GetProperty("AutoSize", typeof(bool)); + // if((piAutoSizeSrc != null) && (piAutoSizeDst != null)) + // { + // MethodInfo miSrc = piAutoSizeSrc.GetGetMethod(); + // MethodInfo miDst = piAutoSizeDst.GetSetMethod(); + // miDst.Invoke(cCopy, new object[] { miSrc.Invoke(c, null) }); + // } + cCopy.AutoSize = c.AutoSize; + + cCopy.Location = c.Location; + cCopy.Size = c.Size; + // Debug.Assert(cCopy.ClientSize == c.ClientSize); + if(c.Dock != DockStyle.None) cCopy.Dock = c.Dock; try { @@ -146,13 +154,6 @@ if(bCopyChilds) CopyChildControls(cCopy, c); } catch(Exception) { Debug.Assert(false); } - - cCopy.Left = c.Left; - cCopy.Top = c.Top; - cCopy.Width = c.Width; - cCopy.Height = c.Height; - cCopy.ClientSize = c.ClientSize; - if(c.Dock != DockStyle.None) cCopy.Dock = c.Dock; } } } diff -Nru keepass2-2.35+dfsg/Translation/TrlUtil/Properties/AssemblyInfo.cs keepass2-2.36+dfsg/Translation/TrlUtil/Properties/AssemblyInfo.cs --- keepass2-2.35+dfsg/Translation/TrlUtil/Properties/AssemblyInfo.cs 2017-01-09 10:06:48.000000000 +0000 +++ keepass2-2.36+dfsg/Translation/TrlUtil/Properties/AssemblyInfo.cs 2017-06-09 08:35:54.000000000 +0000 @@ -38,5 +38,5 @@ [assembly: Guid("39aa6f93-a1c9-497f-bad2-cc42a61d5710")] // Assembly version information -[assembly: AssemblyVersion("2.35.0.*")] -[assembly: AssemblyFileVersion("2.35.0.0")] +[assembly: AssemblyVersion("2.36.0.*")] +[assembly: AssemblyFileVersion("2.36.0.0")] Binary files /tmp/tmpusXDzT/4DEY4hShpt/keepass2-2.35+dfsg/Translation/TrlUtil/Resources/KeePass.ico and /tmp/tmpusXDzT/O4gh4lJ_eh/keepass2-2.36+dfsg/Translation/TrlUtil/Resources/KeePass.ico differ