diff --git a/src/KeePassLib2Android/KeePassLib2Android.csproj b/src/KeePassLib2Android/KeePassLib2Android.csproj
index 14846ef9..275418c0 100644
--- a/src/KeePassLib2Android/KeePassLib2Android.csproj
+++ b/src/KeePassLib2Android/KeePassLib2Android.csproj
@@ -20,7 +20,7 @@
full
False
bin\Debug
- DEBUG;EXCLUDE_TWOFISH;INCLUDE_KEYBOARD;INCLUDE_FILECHOOSER;INCLUDE_JAVAFILESTORAGE;INCLUDE_KEYTRANSFORM
+ DEBUG;EXCLUDE_TWOFISH;EXCLUDE_KEYBOARD;EXCLUDE_FILECHOOSER;EXCLUDE_JAVAFILESTORAGE;EXCLUDE_KEYTRANSFORM
prompt
4
False
diff --git a/src/KeePassLib2Android/Resources/Resource.designer.cs b/src/KeePassLib2Android/Resources/Resource.designer.cs
index 8208d60e..316bfd06 100644
--- a/src/KeePassLib2Android/Resources/Resource.designer.cs
+++ b/src/KeePassLib2Android/Resources/Resource.designer.cs
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
//
// Dieser Code wurde von einem Tool generiert.
-// Laufzeitversion:4.0.30319.34011
+// Laufzeitversion:4.0.30319.34014
//
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
// der Code erneut generiert wird.
diff --git a/src/Kp2aBusinessLogic/Kp2aBusinessLogic.csproj b/src/Kp2aBusinessLogic/Kp2aBusinessLogic.csproj
index 486b049b..43b4ec11 100644
--- a/src/Kp2aBusinessLogic/Kp2aBusinessLogic.csproj
+++ b/src/Kp2aBusinessLogic/Kp2aBusinessLogic.csproj
@@ -20,7 +20,7 @@
full
false
bin\Debug\
- TRACE;DEBUG;EXCLUDE_TWOFISH;INCLUDE_KEYBOARD;INCLUDE_FILECHOOSER;INCLUDE_JAVAFILESTORAGE;INCLUDE_KEYTRANSFORM
+ TRACE;DEBUG;EXCLUDE_TWOFISH;EXCLUDE_KEYBOARD;EXCLUDE_FILECHOOSER;EXCLUDE_JAVAFILESTORAGE;EXCLUDE_KEYTRANSFORM
prompt
4
diff --git a/src/Kp2aUnitTests/Resources/Resource.Designer.cs b/src/Kp2aUnitTests/Resources/Resource.Designer.cs
index c93b7129..9835cde1 100644
--- a/src/Kp2aUnitTests/Resources/Resource.Designer.cs
+++ b/src/Kp2aUnitTests/Resources/Resource.Designer.cs
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
//
// Dieser Code wurde von einem Tool generiert.
-// Laufzeitversion:4.0.30319.34011
+// Laufzeitversion:4.0.30319.34014
//
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
// der Code erneut generiert wird.
diff --git a/src/PluginHostTest/App.cs b/src/PluginHostTest/App.cs
index a816d1bb..cf760f2a 100644
--- a/src/PluginHostTest/App.cs
+++ b/src/PluginHostTest/App.cs
@@ -1,63 +1,9 @@
-using System;
using KeePassLib;
-using KeePassLib.Collections;
using KeePassLib.Keys;
-using KeePassLib.Security;
using KeePassLib.Serialization;
namespace keepass2android
{
- ///
- /// Represents the strings which are output from a PwEntry.
- ///
- /// 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();
-
- ///
- /// Constructs the PwEntryOutput by replacing the placeholders
- ///
- 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;
- }
-
-
- ///
- /// Returns the ID of the entry
- ///
- public PwUuid Uuid
- {
- get { return Entry.Uuid; }
- }
-
- ///
- /// The output strings for the represented entry
- ///
- public ProtectedStringDictionary OutputStrings { get { return _outputStrings; } }
-
- public PwEntry Entry
- {
- get { return _entry; }
- }
- }
public class App
{
diff --git a/src/PluginHostTest/PluginDatabase.cs b/src/PluginHostTest/PluginDatabase.cs
index 5b24be28..2f5b015d 100644
--- a/src/PluginHostTest/PluginDatabase.cs
+++ b/src/PluginHostTest/PluginDatabase.cs
@@ -87,17 +87,8 @@ namespace keepass2android
public void StorePlugin(string pluginPackage, string accessToken, IList requestedScopes)
{
- ISharedPreferences hostPrefs = GetHostPrefs();
ISharedPreferences pluginPrefs = GetPreferencesForPlugin(pluginPackage);
- var stringSet = hostPrefs.GetStringSet(_pluginlist, new Collection());
- if (!stringSet.Contains(pluginPackage))
- {
- stringSet.Add(pluginPackage);
- hostPrefs.Edit()
- .PutStringSet(_pluginlist, stringSet)
- .Commit();
- }
-
+
pluginPrefs.Edit()
.PutString(_scopes, AccessManager.StringArrayToString(requestedScopes))
.PutString(_accessToken, accessToken)
diff --git a/src/PluginHostTest/PluginDetailsActivity.cs b/src/PluginHostTest/PluginDetailsActivity.cs
index 812e76ff..de2c3c95 100644
--- a/src/PluginHostTest/PluginDetailsActivity.cs
+++ b/src/PluginHostTest/PluginDetailsActivity.cs
@@ -21,6 +21,9 @@ using keepass2android.views;
namespace PluginHostTest
{
[Activity(Label = "TODO Details")]
+ [IntentFilter(new[] { Strings.ActionEditPluginSettings},
+ Label = AppNames.AppName,
+ Categories = new[] { Intent.CategoryDefault })]
public class PluginDetailsActivity : Activity
{
protected override void OnCreate(Bundle bundle)
diff --git a/src/PluginHostTest/PluginHost.cs b/src/PluginHostTest/PluginHost.cs
index 0c759e0e..259fc020 100644
--- a/src/PluginHostTest/PluginHost.cs
+++ b/src/PluginHostTest/PluginHost.cs
@@ -1,28 +1,19 @@
using System;
using System.Collections.Generic;
-using System.IO;
using System.Linq;
-using System.Text;
-using System.Xml.Linq;
using Android.App;
using Android.Content;
using Android.Content.PM;
-using Android.OS;
-using Android.Runtime;
using Android.Util;
-using Android.Views;
-using Android.Widget;
-using KeePassLib;
-using KeePassLib.Collections;
-using KeePassLib.Serialization;
using KeePassLib.Utility;
-using Keepass2android;
using Keepass2android.Pluginsdk;
using Org.Json;
-using PluginHostTest;
namespace keepass2android
{
+ ///
+ /// Class which manages plugins inside the app
+ ///
[BroadcastReceiver()]
[IntentFilter(new[] { Strings.ActionRequestAccess})]
public class PluginHost: BroadcastReceiver
@@ -33,6 +24,9 @@ namespace keepass2android
private static readonly string[] _validScopes = { Strings.ScopeDatabaseActions, Strings.ScopeCurrentEntry };
+ ///
+ /// Sends a broadcast to all potential plugins prompting them to request access to our app.
+ ///
public static void TriggerRequests(Context ctx)
{
Intent accessIntent = new Intent(Strings.ActionTriggerRequestAccess);
@@ -65,9 +59,6 @@ namespace keepass2android
}
-
-
-
public override void OnReceive(Context context, Intent intent)
{
PluginDatabase pluginDb = new PluginDatabase(context);
@@ -143,6 +134,9 @@ namespace keepass2android
return true;
}
+ ///
+ /// adds the entry output data to the intent to be sent to a plugin
+ ///
public static void AddEntryToIntent(Intent intent, PwEntryOutput entry)
{
/*//add the entry XML
diff --git a/src/PluginHostTest/PluginHostTest.csproj b/src/PluginHostTest/PluginHostTest.csproj
index 5be6575b..8f716b16 100644
--- a/src/PluginHostTest/PluginHostTest.csproj
+++ b/src/PluginHostTest/PluginHostTest.csproj
@@ -57,6 +57,7 @@
+
@@ -78,6 +79,7 @@
+
diff --git a/src/keepass2android/ChangeLog.cs b/src/keepass2android/ChangeLog.cs
index b0265368..fd5973b6 100644
--- a/src/keepass2android/ChangeLog.cs
+++ b/src/keepass2android/ChangeLog.cs
@@ -39,6 +39,7 @@ namespace keepass2android
};
builder.SetPositiveButton(Android.Resource.String.Ok, (dlgSender, dlgEvt) => { });
+ builder.SetCancelable(false);
builder.SetMessage("temp");
Dialog dialog = builder.Create();
diff --git a/src/keepass2android/Resources/Resource.designer.cs b/src/keepass2android/Resources/Resource.designer.cs
index e0cb5f80..94908e84 100644
--- a/src/keepass2android/Resources/Resource.designer.cs
+++ b/src/keepass2android/Resources/Resource.designer.cs
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
//
// Dieser Code wurde von einem Tool generiert.
-// Laufzeitversion:4.0.30319.34011
+// Laufzeitversion:4.0.30319.34014
//
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
// der Code erneut generiert wird.
diff --git a/src/keepass2android/Resources/values/strings.xml b/src/keepass2android/Resources/values/strings.xml
index e8bce0a5..29bfb1dc 100644
--- a/src/keepass2android/Resources/values/strings.xml
+++ b/src/keepass2android/Resources/values/strings.xml
@@ -79,7 +79,7 @@
Invalid database.
Invalid path.
A name is required.
- A password or a keyfile is required.
+ A password or a key file is required.
At least one password generation type must be selected
Passwords do not match.
Rounds must be a number.
@@ -150,8 +150,8 @@
Creating new database…
Create database
Working…
- Remembers the location of keyfiles
- Save keyfile
+ Remembers the location of key files
+ Save key file
Remove
Rijndael (AES)
Root
@@ -383,7 +383,7 @@
Choose if you want to use a key file in addition to your master password:
Use key file
- Error while adding the keyfile!
+ Error while adding the key file!
Load OTP auxiliary file…
Enter the next One-time-passwords (OTPs). Swipe your Yubikey NEO at the back of your device to enter via NFC.
diff --git a/src/keepass2android/ShareUrlResults.cs b/src/keepass2android/ShareUrlResults.cs
index feed86fd..79dc1c5e 100644
--- a/src/keepass2android/ShareUrlResults.cs
+++ b/src/keepass2android/ShareUrlResults.cs
@@ -180,7 +180,8 @@ namespace keepass2android
{
Finish();
return true;
- } else
+ }
+ else
{
return false;
}
diff --git a/src/keepass2android/app/AppTask.cs b/src/keepass2android/app/AppTask.cs
index 1961a432..5e687b1e 100644
--- a/src/keepass2android/app/AppTask.cs
+++ b/src/keepass2android/app/AppTask.cs
@@ -343,7 +343,10 @@ namespace keepass2android
{
//if the database is readonly, don't offer to modify the URL
if (App.Kp2a.GetDb().CanWrite == false)
+ {
base.OnCompleteCreateEntryActivity(entryActivity);
+ return;
+ }
entryActivity.AskAddUrlThenCompleteCreate(UrlToSearchFor);
}
diff --git a/src/keepass2android/intents/Intents.cs b/src/keepass2android/intents/Intents.cs
index 0b57d5df..888e455c 100644
--- a/src/keepass2android/intents/Intents.cs
+++ b/src/keepass2android/intents/Intents.cs
@@ -25,6 +25,7 @@ namespace keepass2android
public class Intents
{
+
/// Broadcast this intent to lock the database (with quick unlock if enabled)
public const String LockDatabase = "keepass2android.lock_database";
/// Broadcast this intent to close the database (no quick unlock, full close)
@@ -50,6 +51,8 @@ namespace keepass2android
public const int RequestCodeFileBrowseForKeyfile = 987324;
public const String ShowNotification = "keepass2android.show_notification";
+ public const String UpdateKeyboard = "keepass2android.update_keyboard";
+ public const String CopyStringToClipboard = "keepass2android.copy_string_to_clipboard";
}
}
diff --git a/src/keepass2android/keepass2android.csproj b/src/keepass2android/keepass2android.csproj
index 62735481..38d7c670 100644
--- a/src/keepass2android/keepass2android.csproj
+++ b/src/keepass2android/keepass2android.csproj
@@ -30,7 +30,7 @@
full
false
bin\Debug
- DEBUG;EXCLUDE_TWOFISH;INCLUDE_KEYBOARD;INCLUDE_FILECHOOSER;INCLUDE_JAVAFILESTORAGE;INCLUDE_KEYTRANSFORM
+ DEBUG;EXCLUDE_TWOFISH;EXCLUDE_KEYBOARD;EXCLUDE_FILECHOOSER;EXCLUDE_JAVAFILESTORAGE;EXCLUDE_KEYTRANSFORM
prompt
4
False
@@ -110,6 +110,12 @@
+
+
+
+
+
+
@@ -607,11 +613,11 @@
-
+
Designer
-
+
@@ -689,6 +695,10 @@
{a8779d4d-7c49-4c2f-82bd-2cdc448391da}
Kp2aKeyboardBinding
+
+ {3da3911e-36de-465e-8f15-f1991b6437e5}
+ PluginSdkBinding
+
{5cf675a5-9bee-4720-bed9-d5bf14a2ebf9}
TwofishCipher
@@ -957,4 +967,15 @@
+
+
+
+
+
+ AndroidResource
+
+
+
+
+
\ No newline at end of file
diff --git a/src/keepass2android/services/CopyToClipboardService.cs b/src/keepass2android/services/CopyToClipboardService.cs
index fbb95fef..480e0b5e 100644
--- a/src/keepass2android/services/CopyToClipboardService.cs
+++ b/src/keepass2android/services/CopyToClipboardService.cs
@@ -49,6 +49,13 @@ namespace keepass2android
public const int NotifyKeyboard = 3;
public const int ClearClipboard = 4;
+ public void CopyValueToClipboardWithTimeout(Context ctx, string text)
+ {
+ Intent i = new Intent(ctx, typeof(CopyToClipboardService));
+ i.SetAction(Intents.CopyStringToClipboard);
+ i.PutExtra(_stringtocopy, text);
+ ctx.StartService(i);
+ }
public CopyToClipboardService (IntPtr javaReference, JniHandleOwnership transfer)
: base(javaReference, transfer)
@@ -79,27 +86,46 @@ namespace keepass2android
filter.AddAction(Intents.DatabaseLocked);
RegisterReceiver(_stopOnLockBroadcastReceiver, filter);
- String uuidBytes = intent.GetStringExtra(EntryActivity.KeyEntry);
- bool closeAfterCreate = intent.GetBooleanExtra(EntryActivity.KeyCloseAfterCreate, false);
-
- PwUuid entryId = PwUuid.Zero;
- if (uuidBytes != null)
- entryId = new PwUuid(MemUtil.HexStringToByteArray(uuidBytes));
-
- PwEntry entry;
- try
+ if ((intent.Action == Intents.ShowNotification) || (intent.Action == Intents.UpdateKeyboard))
{
- entry = App.Kp2a.GetDb().Entries[entryId];
- }
- catch(Exception)
- {
- //seems like restarting the service happened after closing the DB
- StopSelf();
- return StartCommandResult.NotSticky;
- }
-
- DisplayAccessNotifications(entry, closeAfterCreate);
+ String uuidBytes = intent.GetStringExtra(EntryActivity.KeyEntry);
+ PwUuid entryId = PwUuid.Zero;
+ if (uuidBytes != null)
+ entryId = new PwUuid(MemUtil.HexStringToByteArray(uuidBytes));
+
+ PwEntry entry;
+ try
+ {
+ entry = App.Kp2a.GetDb().Entries[entryId];
+ }
+ catch (Exception)
+ {
+ //seems like restarting the service happened after closing the DB
+ StopSelf();
+ return StartCommandResult.NotSticky;
+ }
+
+ if (intent.Action == Intents.ShowNotification)
+ {
+ //first time opening the entry -> bring up the notifications
+ bool closeAfterCreate = intent.GetBooleanExtra(EntryActivity.KeyCloseAfterCreate, false);
+ DisplayAccessNotifications(entry, closeAfterCreate);
+ }
+ else
+ {
+ //this action is received when the data in the entry has changed (e.g. by plugins)
+ //update the keyboard data.
+ //Check if keyboard is (still) available
+ if (Keepass2android.Kbbridge.KeyboardData.EntryId == entry.Uuid.ToHexString())
+ MakeAccessibleForKeyboard(entry);
+ }
+ }
+ if (intent.Action == Intents.CopyStringToClipboard)
+ {
+
+ TimeoutCopyToClipboard(intent.GetStringExtra(_stringtocopy));
+ }
return StartCommandResult.RedeliverIntent;
}
@@ -308,13 +334,7 @@ namespace keepass2android
#endif
}
- static string GetStringAndReplacePlaceholders(PwEntry entry, string key)
- {
- String value = entry.Strings.ReadSafe(key);
- value = SprEngine.Compile(value, new SprContext(entry, App.Kp2a.GetDb().KpDatabase, SprCompileFlags.All));
- return value;
- }
-
+
public void OnWaitElementDeleted(int itemId)
{
_numElementsToWaitFor--;
@@ -392,6 +412,9 @@ namespace keepass2android
// Setup to allow the toast to happen in the foreground
readonly Handler _uiThreadCallback = new Handler();
private ClearClipboardTask _clearClipboardTask;
+ private const string _stringtocopy = "StringToCopy";
+
+
private Notification GetNotification(String intentText, int descResId, int drawableResId, String entryName) {
String desc = GetString(descResId);