mirror of
https://github.com/moparisthebest/keepass2android
synced 2024-08-13 17:03:49 -04:00
bcbc225652
- AppTasks are now returned by ActivityResult through all AppTask-Related activities (includes ForwardResult) - AppTasks are now passed correctly even when using search (this fixes a problem that AppTasks like SearchUrl were not passed to EntryActivity so the App didn't return to the browser automatically) - AppTasks are deleted by ActivityResult or by checking for LaunchedFromHistory Added option to leave app with db unlocked (this is even the default now!) Added missing EntryActivity files
60 lines
1.5 KiB
C#
60 lines
1.5 KiB
C#
using System;
|
|
using KeePass.Util.Spr;
|
|
using KeePassLib;
|
|
using KeePassLib.Collections;
|
|
using KeePassLib.Security;
|
|
|
|
namespace keepass2android
|
|
{
|
|
/// <summary>
|
|
/// Represents the strings which are output from a PwEntry.
|
|
/// </summary>
|
|
/// In contrast to the original PwEntry, this means that placeholders are replaced. Also, plugins may modify
|
|
/// or add fields.
|
|
public class PwEntryOutput
|
|
{
|
|
private readonly PwEntry _entry;
|
|
private readonly PwDatabase _db;
|
|
private readonly ProtectedStringDictionary _outputStrings = new ProtectedStringDictionary();
|
|
|
|
/// <summary>
|
|
/// Constructs the PwEntryOutput by replacing the placeholders
|
|
/// </summary>
|
|
public PwEntryOutput(PwEntry entry, PwDatabase db)
|
|
{
|
|
_entry = entry;
|
|
_db = db;
|
|
|
|
foreach (var pair in entry.Strings)
|
|
{
|
|
_outputStrings.Set(pair.Key, new ProtectedString(entry.Strings.Get(pair.Key).IsProtected, GetStringAndReplacePlaceholders(pair.Key)));
|
|
}
|
|
}
|
|
|
|
string GetStringAndReplacePlaceholders(string key)
|
|
{
|
|
String value = Entry.Strings.ReadSafe(key);
|
|
value = SprEngine.Compile(value, new SprContext(Entry, _db, SprCompileFlags.All));
|
|
return value;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Returns the ID of the entry
|
|
/// </summary>
|
|
public PwUuid Uuid
|
|
{
|
|
get { return Entry.Uuid; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// The output strings for the represented entry
|
|
/// </summary>
|
|
public ProtectedStringDictionary OutputStrings { get { return _outputStrings; } }
|
|
|
|
public PwEntry Entry
|
|
{
|
|
get { return _entry; }
|
|
}
|
|
}
|
|
} |