mirror of
https://github.com/moparisthebest/keepass2android
synced 2024-11-12 04:25:09 -05:00
Merging in changes
This commit is contained in:
parent
f442a04520
commit
dea5a7152f
@ -15,8 +15,9 @@ This file is part of Keepass2Android, Copyright 2013 Philipp Crocoll. This file
|
|||||||
along with Keepass2Android. If not, see <http://www.gnu.org/licenses/>.
|
along with Keepass2Android. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using KeePassLib;
|
using System.Collections.Generic;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
using KeePassLib;
|
||||||
using KeePassLib.Collections;
|
using KeePassLib.Collections;
|
||||||
using KeePassLib.Interfaces;
|
using KeePassLib.Interfaces;
|
||||||
using KeePassLib.Utility;
|
using KeePassLib.Utility;
|
||||||
|
@ -145,9 +145,9 @@ namespace keepass2android
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public PwGroup Search(SearchParameters searchParams)
|
public PwGroup Search(SearchParameters searchParams, IDictionary<PwUuid, String> resultContexts)
|
||||||
{
|
{
|
||||||
return SearchHelper.Search(this, searchParams);
|
return SearchHelper.Search(this, searchParams, resultContexts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ This file is part of Keepass2Android, Copyright 2013 Philipp Crocoll. This file
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
using Android.App;
|
using Android.App;
|
||||||
using Android.Content;
|
using Android.Content;
|
||||||
|
@ -61,7 +61,6 @@
|
|||||||
<string name="entry_user_name">User Name</string>
|
<string name="entry_user_name">User Name</string>
|
||||||
<string name="entry_extra_strings">Extra string fields</string>
|
<string name="entry_extra_strings">Extra string fields</string>
|
||||||
<string name="entry_binaries">File attachments</string>
|
<string name="entry_binaries">File attachments</string>
|
||||||
<string name="entry_notes">Notes</string>
|
|
||||||
<string name="error_arc4">The ArcFour stream cipher is not supported.</string>
|
<string name="error_arc4">The ArcFour stream cipher is not supported.</string>
|
||||||
<string name="error_can_not_handle_uri">Keepass2Android cannot handle this uri.</string>
|
<string name="error_can_not_handle_uri">Keepass2Android cannot handle this uri.</string>
|
||||||
<string name="error_could_not_create_group">Error creating group.</string>
|
<string name="error_could_not_create_group">Error creating group.</string>
|
||||||
|
@ -46,10 +46,8 @@ namespace keepass2android.search
|
|||||||
private const string GetIconPathQuery = "get_icon";
|
private const string GetIconPathQuery = "get_icon";
|
||||||
private const string IconIdParameter = "IconId";
|
private const string IconIdParameter = "IconId";
|
||||||
private const string CustomIconUuidParameter = "CustomIconUuid";
|
private const string CustomIconUuidParameter = "CustomIconUuid";
|
||||||
//public static readonly String AUTHORITY = "keepass2android.search.SearchProvider";
|
|
||||||
//public static readonly Android.Net.Uri CONTENT_URI = Android.Net.Uri.Parse("content://" + AUTHORITY + "/dictionary");
|
|
||||||
|
|
||||||
private Database mDb;
|
private Database _db;
|
||||||
|
|
||||||
private static UriMatcher UriMatcher = BuildUriMatcher();
|
private static UriMatcher UriMatcher = BuildUriMatcher();
|
||||||
|
|
||||||
@ -66,13 +64,13 @@ namespace keepass2android.search
|
|||||||
|
|
||||||
public override bool OnCreate()
|
public override bool OnCreate()
|
||||||
{
|
{
|
||||||
mDb = App.getDB();
|
_db = App.Kp2a.GetDb();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Android.Database.ICursor Query(Android.Net.Uri uri, string[] projection, string selection, string[] selectionArgs, string sortOrder)
|
public override Android.Database.ICursor Query(Android.Net.Uri uri, string[] projection, string selection, string[] selectionArgs, string sortOrder)
|
||||||
{
|
{
|
||||||
if (mDb.Open) // Can't show suggestions if the database is locked!
|
if (_db.Open) // Can't show suggestions if the database is locked!
|
||||||
{
|
{
|
||||||
switch ((UriMatches)UriMatcher.Match(uri))
|
switch ((UriMatches)UriMatcher.Match(uri))
|
||||||
{
|
{
|
||||||
@ -83,7 +81,7 @@ namespace keepass2android.search
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var resultsContexts = new Dictionary<PwUuid, String>();
|
var resultsContexts = new Dictionary<PwUuid, String>();
|
||||||
var result = mDb.Search(new SearchParameters { SearchString = searchString }, resultsContexts );
|
var result = _db.Search(new SearchParameters { SearchString = searchString }, resultsContexts );
|
||||||
return new GroupCursor(result, resultsContexts);
|
return new GroupCursor(result, resultsContexts);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
@ -112,7 +110,7 @@ namespace keepass2android.search
|
|||||||
var iconId = (PwIcon)Enum.Parse(typeof(PwIcon), uri.GetQueryParameter(IconIdParameter));
|
var iconId = (PwIcon)Enum.Parse(typeof(PwIcon), uri.GetQueryParameter(IconIdParameter));
|
||||||
var customIconUuid = new PwUuid(MemUtil.HexStringToByteArray(uri.GetQueryParameter(CustomIconUuidParameter)));
|
var customIconUuid = new PwUuid(MemUtil.HexStringToByteArray(uri.GetQueryParameter(CustomIconUuidParameter)));
|
||||||
|
|
||||||
var iconDrawable = mDb.drawFactory.getIconDrawable(App.Context.Resources, mDb.pm, iconId, customIconUuid) as BitmapDrawable;
|
var iconDrawable = _db.DrawableFactory.GetIconDrawable(App.Context.Resources, _db.KpDatabase, iconId, customIconUuid) as BitmapDrawable;
|
||||||
if (iconDrawable != null)
|
if (iconDrawable != null)
|
||||||
{
|
{
|
||||||
var pipe = ParcelFileDescriptor.CreatePipe();
|
var pipe = ParcelFileDescriptor.CreatePipe();
|
||||||
@ -273,7 +271,7 @@ namespace keepass2android.search
|
|||||||
intlResourceId = Resource.String.entry_url;
|
intlResourceId = Resource.String.entry_url;
|
||||||
break;
|
break;
|
||||||
case PwDefs.NotesField:
|
case PwDefs.NotesField:
|
||||||
intlResourceId = Resource.String.entry_notes;
|
intlResourceId = Resource.String.entry_comment;
|
||||||
break;
|
break;
|
||||||
case PwGroup.SearchContextTags:
|
case PwGroup.SearchContextTags:
|
||||||
intlResourceId = Resource.String.entry_tags;
|
intlResourceId = Resource.String.entry_tags;
|
||||||
|
@ -82,7 +82,7 @@ namespace keepass2android.search
|
|||||||
private void Query (SearchParameters searchParams)
|
private void Query (SearchParameters searchParams)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
Group = _db.Search (searchParams);
|
Group = _db.Search (searchParams, null);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Toast.MakeText(this,e.Message, ToastLength.Long).Show();
|
Toast.MakeText(this,e.Message, ToastLength.Long).Show();
|
||||||
Finish();
|
Finish();
|
||||||
|
Loading…
Reference in New Issue
Block a user