Compare commits

..

1 Commits

9 changed files with 21 additions and 16 deletions

View File

@@ -185,7 +185,7 @@ namespace KeePassLib.Serialization
byte[] pbFile = StrUtil.Utf8.GetBytes(sb.ToString()); byte[] pbFile = StrUtil.Utf8.GetBytes(sb.ToString());
s = IOConnection.OpenWrite(iocLockFile); s = IOConnection.OpenWrite(iocLockFile);
if(s == null) throw new IOException(UrlUtil.GetFileName(iocLockFile.Path)); if(s == null) throw new IOException(iocLockFile.GetDisplayName());
s.Write(pbFile, 0, pbFile.Length); s.Write(pbFile, 0, pbFile.Length);
} }
finally { if(s != null) s.Close(); } finally { if(s != null) s.Close(); }
@@ -205,7 +205,8 @@ namespace KeePassLib.Serialization
if(lfiEx != null) if(lfiEx != null)
{ {
m_iocLockFile = null; // Otherwise Dispose deletes the existing one m_iocLockFile = null; // Otherwise Dispose deletes the existing one
throw new FileLockException(UrlUtil.GetFileName(iocBaseFile.Path), lfiEx.GetOwner()); throw new FileLockException(iocBaseFile.GetDisplayName(),
lfiEx.GetOwner());
} }
LockFileInfo.Create(m_iocLockFile); LockFileInfo.Create(m_iocLockFile);

View File

@@ -28,7 +28,6 @@ using System.Diagnostics;
using KeePassLib.Resources; using KeePassLib.Resources;
using KeePassLib.Serialization; using KeePassLib.Serialization;
using Android.Webkit;
namespace KeePassLib.Utility namespace KeePassLib.Utility
{ {
@@ -412,7 +411,7 @@ Clipboard.SetText(ObjectsToMessage(vLines, true));*/
public static void ShowLoadWarning(IOConnectionInfo ioConnection, Exception ex) public static void ShowLoadWarning(IOConnectionInfo ioConnection, Exception ex)
{ {
if (ioConnection != null) if (ioConnection != null)
ShowLoadWarning(UrlUtil.GetFileName(ioConnection.Path), ex, false); ShowLoadWarning(ioConnection.GetDisplayName(), ex, false);
else ShowWarning(ex); else ShowWarning(ex);
} }
@@ -445,7 +444,7 @@ Clipboard.SetText(ObjectsToMessage(vLines, true));*/
bool bCorruptionWarning) bool bCorruptionWarning)
{ {
if (ioConnection != null) if (ioConnection != null)
ShowSaveWarning(UrlUtil.GetFileName(ioConnection.Path), ex, bCorruptionWarning); ShowSaveWarning(ioConnection.GetDisplayName(), ex, bCorruptionWarning);
else ShowWarning(ex); else ShowWarning(ex);
} }

View File

@@ -124,7 +124,7 @@ namespace keepass2android.Io
&& File.Exists(VersionFilePath(ioc)) && File.Exists(VersionFilePath(ioc))
&& File.Exists(BaseVersionFilePath(ioc)); && File.Exists(BaseVersionFilePath(ioc));
Kp2aLog.Log(GetDisplayName(ioc) + " isCached = " + result); Kp2aLog.Log(ioc.GetDisplayName() + " isCached = " + result);
return result; return result;
} }
@@ -598,14 +598,13 @@ namespace keepass2android.Io
public string GetBaseVersionHash(IOConnectionInfo ioc) public string GetBaseVersionHash(IOConnectionInfo ioc)
{ {
string hash = File.ReadAllText(BaseVersionFilePath(ioc)); string hash = File.ReadAllText(BaseVersionFilePath(ioc));
Kp2aLog.Log(GetDisplayName(ioc) + " baseVersionHash = " + hash); Kp2aLog.Log(ioc.GetDisplayName() + " baseVersionHash = " + hash);
return hash; return hash;
} }
public string GetLocalVersionHash(IOConnectionInfo ioc) public string GetLocalVersionHash(IOConnectionInfo ioc)
{ {
string hash = File.ReadAllText(VersionFilePath(ioc)); string hash = File.ReadAllText(VersionFilePath(ioc));
Kp2aLog.Log(ioc.GetDisplayName() + " localVersionHash = " + hash);
Kp2aLog.Log(GetDisplayName(ioc) + " localVersionHash = " + hash);
return hash; return hash;
} }
public bool HasLocalChanges(IOConnectionInfo ioc) public bool HasLocalChanges(IOConnectionInfo ioc)

View File

@@ -348,7 +348,7 @@ namespace keepass2android.Io
} }
catch (Exception e) catch (Exception e)
{ {
throw new Exception("Error finding " + filename + " in " + GetDisplayName(folderPath), e); throw new Exception("Error finding " + filename + " in " + folderPath.GetDisplayName(), e);
} }
} }

View File

@@ -937,9 +937,8 @@ namespace keepass2android
iv.SetImageDrawable(Resources.GetDrawable(Resource.Drawable.ic00)); iv.SetImageDrawable(Resources.GetDrawable(Resource.Drawable.ic00));
} }
SupportActionBar.Title = Entry.Strings.ReadSafe(PwDefs.TitleField); SupportActionBar.Title = Entry.Strings.ReadSafe(PwDefs.TitleField);
SupportActionBar.Title = SprEngine.Compile(SupportActionBar.Title, new SprContext(Entry, App.Kp2a.CurrentDb.KpDatabase, SprCompileFlags.All));
SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetDisplayHomeAsUpEnabled(true);
SupportActionBar.SetHomeButtonEnabled(true); SupportActionBar.SetHomeButtonEnabled(true);

View File

@@ -129,7 +129,7 @@ namespace OtpKeyProv
if(!OtpInfo.Save(auxFileIoc, otpInfo)) if(!OtpInfo.Save(auxFileIoc, otpInfo))
{ {
MessageService.ShowWarning("Failed to save auxiliary OTP info file:", MessageService.ShowWarning("Failed to save auxiliary OTP info file:",
UrlUtil.GetFileName(auxFileIoc.Path)); auxFileIoc.GetDisplayName());
return false; return false;
} }

View File

@@ -30,6 +30,7 @@ using KeePassLib;
using KeePassLib.Utility; using KeePassLib.Utility;
using System.Threading; using System.Threading;
using System.Collections.Generic; using System.Collections.Generic;
using KeePass.Util.Spr;
namespace keepass2android.search namespace keepass2android.search
{ {
@@ -294,7 +295,10 @@ namespace keepass2android.search
return Position.ToString(CultureInfo.InvariantCulture); return Position.ToString(CultureInfo.InvariantCulture);
case 1: // SuggestColumnText1 case 1: // SuggestColumnText1
string username = CurrentEntry.Strings.ReadSafe(PwDefs.UserNameField); string username = CurrentEntry.Strings.ReadSafe(PwDefs.UserNameField);
return CurrentEntry.Strings.ReadSafe(PwDefs.TitleField) + (string.IsNullOrWhiteSpace(username) ? "" : " ("+username+")"); username = SprEngine.Compile(username, new SprContext(CurrentEntry, App.Kp2a.CurrentDb.KpDatabase, SprCompileFlags.All));
var title = CurrentEntry.Strings.ReadSafe(PwDefs.TitleField);
title = SprEngine.Compile(title, new SprContext(CurrentEntry, App.Kp2a.CurrentDb.KpDatabase, SprCompileFlags.All));
return title + (string.IsNullOrWhiteSpace(username) ? "" : " ("+username+")");
case 2: // SuggestColumnText2 case 2: // SuggestColumnText2
return Internationalise(_entriesWithContexts[Position].resultContext); return Internationalise(_entriesWithContexts[Position].resultContext);
case 3: // SuggestColumnIcon1 case 3: // SuggestColumnIcon1

View File

@@ -10,6 +10,7 @@ using Android.OS;
using Android.Runtime; using Android.Runtime;
using Android.Views; using Android.Views;
using Android.Widget; using Android.Widget;
using KeePass.Util.Spr;
using keepass2android.services.AutofillBase; using keepass2android.services.AutofillBase;
using keepass2android.services.AutofillBase.model; using keepass2android.services.AutofillBase.model;
using Keepass2android.Pluginsdk; using Keepass2android.Pluginsdk;
@@ -108,6 +109,7 @@ namespace keepass2android.services.Kp2aAutofill
fieldCollection.DatasetName = pwEntry.Strings.ReadSafe(PwDefs.TitleField); fieldCollection.DatasetName = pwEntry.Strings.ReadSafe(PwDefs.TitleField);
fieldCollection.DatasetName = SprEngine.Compile(fieldCollection.DatasetName, new SprContext(pwEntry, App.Kp2a.CurrentDb.KpDatabase, SprCompileFlags.All));
return fieldCollection; return fieldCollection;
} }

View File

@@ -125,6 +125,7 @@ namespace keepass2android.view
} }
String title = pw.Strings.ReadSafe(PwDefs.TitleField); String title = pw.Strings.ReadSafe(PwDefs.TitleField);
title = SprEngine.Compile(title, new SprContext(_entry, db.KpDatabase, SprCompileFlags.All));
var str = new SpannableString(title); var str = new SpannableString(title);
if (isExpired) if (isExpired)