[Pkg-cli-apps-commits] [SCM] keepass2 branch, master, updated. debian/2.15+dfsg-1-6-gbd9c0ca
Julian Taylor
jtaylor.debian at googlemail.com
Tue Apr 19 18:09:29 UTC 2011
The following commit has been merged in the master branch:
commit 442da1ca16a6c94b5d0ba23d1b8fd76f81261f89
Author: Julian Taylor <jtaylor.debian at googlemail.com>
Date: Mon Apr 18 20:11:27 2011 +0200
add three new patches
* 06_add-translation-search-paths.patch:
- search in XDG directories for translation files
* 07_fix-quicksearch-losing-results-on-defocus.patch
* 08_work-around-quicksearch-crash.patch
diff --git a/debian/patches/06_add-translation-search-paths.patch b/debian/patches/06_add-translation-search-paths.patch
new file mode 100644
index 0000000..ca7c8ef
--- /dev/null
+++ b/debian/patches/06_add-translation-search-paths.patch
@@ -0,0 +1,266 @@
+From: Julian Taylor <jtaylor.debian at googlemail.com>
+Date: Sun, 17 Apr 2011 18:54:38 +0200
+Subject: add translation search paths
+
+ also search for translations in XDG_CONFIG_HOME and XDG_DATA_HOME
+Applied-Upstream: 2.16
+---
+ KeePass/App/Configuration/AppConfigSerializer.cs | 24 ++++++-
+ KeePass/Forms/LanguageForm.cs | 70 +++++++++++++++-------
+ KeePass/Program.cs | 60 ++++++++++++-------
+ 3 files changed, 106 insertions(+), 48 deletions(-)
+
+diff --git a/KeePass/App/Configuration/AppConfigSerializer.cs b/KeePass/App/Configuration/AppConfigSerializer.cs
+index 24deaa1..62f58fe 100644
+--- a/KeePass/App/Configuration/AppConfigSerializer.cs
++++ b/KeePass/App/Configuration/AppConfigSerializer.cs
+@@ -40,6 +40,7 @@ namespace KeePass.App.Configuration
+ private static string m_strBaseName = null; // Null prop allowed
+
+ private static string m_strCreateDir = null;
++ private static string m_strCreateDirLocal = null;
+ private static string m_strEnforcedConfigFile = null;
+ private static string m_strGlobalConfigFile = null;
+ private static string m_strUserConfigFile = null;
+@@ -53,6 +54,15 @@ namespace KeePass.App.Configuration
+ }
+ }
+
++ public static string LocalAppDataDirectory
++ {
++ get
++ {
++ AppConfigSerializer.GetConfigPaths();
++ return m_strCreateDirLocal;
++ }
++ }
++
+ /// <summary>
+ /// Get/set the base name for the configuration. If this property is
+ /// <c>null</c>, the class constructs names based on the current
+@@ -67,6 +77,7 @@ namespace KeePass.App.Configuration
+ m_strBaseName = value;
+
+ m_strCreateDir = null;
++ m_strCreateDirLocal = null;
+ m_strEnforcedConfigFile = null; // Invalidate paths
+ m_strGlobalConfigFile = null;
+ m_strUserConfigFile = null;
+@@ -125,19 +136,24 @@ namespace KeePass.App.Configuration
+ strUserDir = UrlUtil.GetFileDirectory(UrlUtil.FileUrlToPath(
+ Assembly.GetExecutingAssembly().GetName().CodeBase), true, false);
+ }
++ strUserDir = UrlUtil.EnsureTerminatingSeparator(strUserDir, false);
+
+- if(!strUserDir.EndsWith(new string(Path.DirectorySeparatorChar, 1)) &&
+- !strUserDir.EndsWith("\\") && !strUserDir.EndsWith("/"))
++ string strUserDirLocal;
++ try
+ {
+- strUserDir += new string(Path.DirectorySeparatorChar, 1);
++ strUserDirLocal = Environment.GetFolderPath(
++ Environment.SpecialFolder.LocalApplicationData);
+ }
++ catch(Exception) { strUserDirLocal = strUserDir; }
++ strUserDirLocal = UrlUtil.EnsureTerminatingSeparator(strUserDirLocal, false);
+
+ m_strCreateDir = strUserDir + strBaseDirName;
++ m_strCreateDirLocal = strUserDirLocal + strBaseDirName;
+ m_strUserConfigFile = m_strCreateDir + Path.DirectorySeparatorChar +
+ strBaseDirName + ".config.xml";
+ }
+
+- Debug.Assert(m_strCreateDir != null); Debug.Assert(m_strCreateDir.Length > 0);
++ Debug.Assert(!string.IsNullOrEmpty(m_strCreateDir));
+ }
+
+ private static void EnsureAppDataDirAvailable()
+diff --git a/KeePass/Forms/LanguageForm.cs b/KeePass/Forms/LanguageForm.cs
+index 8478a23..c5c9360 100644
+--- a/KeePass/Forms/LanguageForm.cs
++++ b/KeePass/Forms/LanguageForm.cs
+@@ -26,6 +26,7 @@ using System.Windows.Forms;
+ using System.IO;
+
+ using KeePass.App;
++using KeePass.App.Configuration;
+ using KeePass.UI;
+ using KeePass.Resources;
+ using KeePass.Util;
+@@ -68,37 +69,62 @@ namespace KeePass.Forms
+ lvi.SubItems.Add(AppDefs.DefaultTrlAuthor);
+ lvi.SubItems.Add(AppDefs.DefaultTrlContact);
+
++ List<string> vList = new List<string>();
++ GetAvailableTranslations(AppConfigSerializer.AppDataDirectory, vList);
++ GetAvailableTranslations(AppConfigSerializer.LocalAppDataDirectory, vList);
++
+ string strExe = WinUtil.GetExecutable();
+ string strPath = UrlUtil.GetFileDirectory(strExe, false, true);
+- GetAvailableTranslations(strPath);
++ GetAvailableTranslations(strPath, vList);
+ }
+
+- private void GetAvailableTranslations(string strPath)
++ private void GetAvailableTranslations(string strPath, List<string> vList)
+ {
+- DirectoryInfo di = new DirectoryInfo(strPath);
+- FileInfo[] vFiles = di.GetFiles();
+-
+- foreach(FileInfo fi in vFiles)
++ try
+ {
+- if(fi.FullName.ToLower().EndsWith("." + KPTranslation.FileExtension))
++ DirectoryInfo di = new DirectoryInfo(strPath);
++ FileInfo[] vFiles = di.GetFiles();
++
++ foreach(FileInfo fi in vFiles)
+ {
+- try
+- {
+- KPTranslation kpTrl = KPTranslation.LoadFromFile(fi.FullName);
+-
+- ListViewItem lvi = m_lvLanguages.Items.Add(
+- kpTrl.Properties.NameEnglish, 0);
+- lvi.SubItems.Add(kpTrl.Properties.ApplicationVersion);
+- lvi.SubItems.Add(kpTrl.Properties.AuthorName);
+- lvi.SubItems.Add(kpTrl.Properties.AuthorContact);
+- lvi.Tag = UrlUtil.GetFileName(fi.FullName);
+- }
+- catch(Exception ex)
++ string strFullName = fi.FullName;
++
++ if(strFullName.ToLower().EndsWith("." + KPTranslation.FileExtension))
+ {
+- MessageService.ShowWarning(ex.Message);
++ string strFileName = UrlUtil.GetFileName(strFullName);
++
++ bool bFound = false;
++ foreach(string strExisting in vList)
++ {
++ if(strExisting.Equals(strFileName, StrUtil.CaseIgnoreCmp))
++ {
++ bFound = true;
++ break;
++ }
++ }
++ if(bFound) continue;
++
++ try
++ {
++ KPTranslation kpTrl = KPTranslation.LoadFromFile(strFullName);
++
++ ListViewItem lvi = m_lvLanguages.Items.Add(
++ kpTrl.Properties.NameEnglish, 0);
++ lvi.SubItems.Add(kpTrl.Properties.ApplicationVersion);
++ lvi.SubItems.Add(kpTrl.Properties.AuthorName);
++ lvi.SubItems.Add(kpTrl.Properties.AuthorContact);
++ lvi.Tag = strFileName;
++
++ vList.Add(strFileName);
++ }
++ catch(Exception ex)
++ {
++ MessageService.ShowWarning(ex.Message);
++ }
+ }
+ }
+ }
++ catch(Exception) { } // Directory might not exist or cause access violation
+ }
+
+ private void OnBtnClose(object sender, EventArgs e)
+@@ -113,13 +139,13 @@ namespace KeePass.Forms
+ if(lvic[0].Index == 0) // First item selected = English
+ {
+ if(Program.Config.Application.LanguageFile.Length == 0)
+- return; // Is built-English already
++ return; // Is English already
+
+ Program.Config.Application.LanguageFile = string.Empty;
+ }
+ else
+ {
+- string strSelID = lvic[0].Tag as string;
++ string strSelID = (lvic[0].Tag as string);
+ if(strSelID == Program.Config.Application.LanguageFile) return;
+
+ Program.Config.Application.LanguageFile = strSelID;
+diff --git a/KeePass/Program.cs b/KeePass/Program.cs
+index c8e9ef4..9cd0417 100644
+--- a/KeePass/Program.cs
++++ b/KeePass/Program.cs
+@@ -225,28 +225,7 @@ namespace KeePass
+ string strHelpFile = UrlUtil.StripExtension(WinUtil.GetExecutable()) + ".chm";
+ AppHelp.LocalHelpFile = strHelpFile;
+
+- string strLangFile = m_appConfig.Application.LanguageFile;
+- if((strLangFile != null) && (strLangFile.Length > 0))
+- {
+- strLangFile = UrlUtil.GetFileDirectory(WinUtil.GetExecutable(), true,
+- false) + strLangFile;
+-
+- try
+- {
+- m_kpTranslation = KPTranslation.LoadFromFile(strLangFile);
+-
+- KPRes.SetTranslatedStrings(
+- m_kpTranslation.SafeGetStringTableDictionary(
+- "KeePass.Resources.KPRes"));
+- KLRes.SetTranslatedStrings(
+- m_kpTranslation.SafeGetStringTableDictionary(
+- "KeePassLib.Resources.KLRes"));
+-
+- StrUtil.RightToLeft = m_kpTranslation.Properties.RightToLeft;
+- }
+- catch(FileNotFoundException) { } // Ignore
+- catch(Exception) { Debug.Assert(false); }
+- }
++ LoadTranslation();
+
+ if(m_appConfig.Application.Start.PluginCacheClearOnce)
+ {
+@@ -574,5 +553,42 @@ namespace KeePass
+
+ MainCleanUp();
+ }
++
++ private static void LoadTranslation()
++ {
++ string strLangFile = m_appConfig.Application.LanguageFile;
++ if((strLangFile != null) && (strLangFile.Length > 0))
++ {
++ string[] vLangDirs = new string[]{
++ AppConfigSerializer.AppDataDirectory,
++ AppConfigSerializer.LocalAppDataDirectory,
++ UrlUtil.GetFileDirectory(WinUtil.GetExecutable(), false, false)
++ };
++
++ foreach(string strLangDir in vLangDirs)
++ {
++ string strLangPath = UrlUtil.EnsureTerminatingSeparator(
++ strLangDir, false) + strLangFile;
++
++ try
++ {
++ m_kpTranslation = KPTranslation.LoadFromFile(strLangPath);
++
++ KPRes.SetTranslatedStrings(
++ m_kpTranslation.SafeGetStringTableDictionary(
++ "KeePass.Resources.KPRes"));
++ KLRes.SetTranslatedStrings(
++ m_kpTranslation.SafeGetStringTableDictionary(
++ "KeePassLib.Resources.KLRes"));
++
++ StrUtil.RightToLeft = m_kpTranslation.Properties.RightToLeft;
++ break;
++ }
++ catch(DirectoryNotFoundException) { } // Ignore
++ catch(FileNotFoundException) { } // Ignore
++ catch(Exception) { Debug.Assert(false); }
++ }
++ }
++ }
+ }
+ }
+--
diff --git a/debian/patches/07_fix-quicksearch-losing-results-on-defocus.patch b/debian/patches/07_fix-quicksearch-losing-results-on-defocus.patch
new file mode 100644
index 0000000..50484b9
--- /dev/null
+++ b/debian/patches/07_fix-quicksearch-losing-results-on-defocus.patch
@@ -0,0 +1,38 @@
+From: Julian Taylor <jtaylor.debian at googlemail.com>
+Date: Mon, 18 Apr 2011 19:44:53 +0200
+Subject: fix quicksearch losing results on defocus
+
+Applied-Upstream: 2.16
+---
+ KeePass/Forms/MainForm.cs | 10 ++++------
+ 1 files changed, 4 insertions(+), 6 deletions(-)
+
+diff --git a/KeePass/Forms/MainForm.cs b/KeePass/Forms/MainForm.cs
+index 441f06a..ee82a9f 100644
+--- a/KeePass/Forms/MainForm.cs
++++ b/KeePass/Forms/MainForm.cs
+@@ -999,6 +999,7 @@ namespace KeePass.Forms
+ private void OnQuickFindSelectedIndexChanged(object sender, EventArgs e)
+ {
+ if(m_bBlockQuickFind) return;
++ m_bBlockQuickFind = true;
+
+ string strSearch = m_tbQuickFind.Text; // Text, not selected index!
+ string strGroupName = KPRes.SearchGroupName + " (\"" + strSearch + "\" ";
+@@ -1031,12 +1032,9 @@ namespace KeePass.Forms
+
+ m_tbQuickFind.Items.Insert(0, strSearch);
+
+- if(bDoSetText)
+- {
+- m_bBlockQuickFind = true;
+- m_tbQuickFind.Text = strSearch;
+- m_bBlockQuickFind = false;
+- }
++ if(bDoSetText) m_tbQuickFind.Text = strSearch;
++
++ m_bBlockQuickFind = false;
+ }
+
+ private void OnQuickFindKeyDown(object sender, KeyEventArgs e)
+--
diff --git a/debian/patches/08_work-around-quicksearch-crash.patch b/debian/patches/08_work-around-quicksearch-crash.patch
new file mode 100644
index 0000000..b1bbe7c
--- /dev/null
+++ b/debian/patches/08_work-around-quicksearch-crash.patch
@@ -0,0 +1,59 @@
+From: Julian Taylor <jtaylor.debian at googlemail.com>
+Date: Tue, 19 Apr 2011 19:44:11 +0200
+Subject: work around quicksearch crash
+
+Bug: http://sourceforge.net/tracker/?func=detail&aid=3286048&group_id=95013&atid=609908
+Applied-Upstream: 2.16
+---
+ KeePass/Forms/MainForm.cs | 8 +++-----
+ KeePass/Forms/MainForm_Functions.cs | 10 +++++++++-
+ 2 files changed, 12 insertions(+), 6 deletions(-)
+
+diff --git a/KeePass/Forms/MainForm.cs b/KeePass/Forms/MainForm.cs
+index ee82a9f..e0e1bcb 100644
+--- a/KeePass/Forms/MainForm.cs
++++ b/KeePass/Forms/MainForm.cs
+@@ -1021,18 +1021,16 @@ namespace KeePass.Forms
+ }
+
+ // Update the history items in the combobox
+- bool bDoSetText = false;
+ if(nExistsAlready >= 0)
+- {
+ m_tbQuickFind.Items.RemoveAt(nExistsAlready);
+- bDoSetText = true;
+- }
+ else if(m_tbQuickFind.Items.Count >= 8)
+ m_tbQuickFind.Items.RemoveAt(m_tbQuickFind.Items.Count - 1);
+
+ m_tbQuickFind.Items.Insert(0, strSearch);
+
+- if(bDoSetText) m_tbQuickFind.Text = strSearch;
++ // if(bDoSetText) m_tbQuickFind.Text = strSearch;
++ m_tbQuickFind.SelectedIndex = 0;
++ m_tbQuickFind.Select(0, strSearch.Length);
+
+ m_bBlockQuickFind = false;
+ }
+diff --git a/KeePass/Forms/MainForm_Functions.cs b/KeePass/Forms/MainForm_Functions.cs
+index 708f815..8f21a4f 100644
+--- a/KeePass/Forms/MainForm_Functions.cs
++++ b/KeePass/Forms/MainForm_Functions.cs
+@@ -1074,7 +1074,15 @@ namespace KeePass.Forms
+ }
+ }
+
+- if(lviFocused != null) m_lvEntries.FocusedItem = lviFocused;
++ if(lviFocused != null)
++ {
++ try { m_lvEntries.FocusedItem = lviFocused; } // .NET
++ catch(Exception)
++ {
++ try { lviFocused.Focused = true; } // Mono
++ catch(Exception) { Debug.Assert(false); }
++ }
++ }
+
+ View view = m_lvEntries.View;
+ if(m_bSimpleTanView)
+--
diff --git a/debian/patches/series b/debian/patches/series
index 48636c6..46b1027 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,3 +3,6 @@
03_use_free_icon.patch
04_no_sgen.patch
05_find_xsl.patch
+06_add-translation-search-paths.patch
+07_fix-quicksearch-losing-results-on-defocus.patch
+08_work-around-quicksearch-crash.patch
--
keepass2
More information about the Pkg-cli-apps-commits
mailing list