mirror of
https://github.com/moparisthebest/keepass2android
synced 2025-02-14 05:50:32 -05:00
different comparison mode for TAN entries
This commit is contained in:
parent
ba6b848e63
commit
b68ef33515
@ -17,6 +17,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.Globalization;
|
||||||
using Android.Content;
|
using Android.Content;
|
||||||
using Android.Views;
|
using Android.Views;
|
||||||
using Android.Widget;
|
using Android.Widget;
|
||||||
@ -75,13 +76,36 @@ namespace keepass2android
|
|||||||
_groupsForViewing.Sort( (x, y) => { return String.Compare (x.Name, y.Name, true); });
|
_groupsForViewing.Sort( (x, y) => { return String.Compare (x.Name, y.Name, true); });
|
||||||
_entriesForViewing.Sort( (x, y) =>
|
_entriesForViewing.Sort( (x, y) =>
|
||||||
{
|
{
|
||||||
String nameX = x.Strings.ReadSafe(PwDefs.TitleField);
|
String nameX = x.Strings.ReadSafe(PwDefs.TitleField);
|
||||||
String nameY = y.Strings.ReadSafe(PwDefs.TitleField);
|
String nameY = y.Strings.ReadSafe(PwDefs.TitleField);
|
||||||
if (nameX.ToLower() != nameY.ToLower())
|
if (nameX.ToLower() != nameY.ToLower())
|
||||||
return String.Compare(nameX, nameY, StringComparison.OrdinalIgnoreCase);
|
return String.Compare(nameX, nameY, StringComparison.OrdinalIgnoreCase);
|
||||||
else
|
else
|
||||||
return x.CreationTime.CompareTo(y.CreationTime);
|
{
|
||||||
}
|
if (PwDefs.IsTanEntry(x) && PwDefs.IsTanEntry(y))
|
||||||
|
{
|
||||||
|
//compare the user name fields (=TAN index)
|
||||||
|
String userX = x.Strings.ReadSafe(PwDefs.UserNameField);
|
||||||
|
String userY = y.Strings.ReadSafe(PwDefs.UserNameField);
|
||||||
|
if (userX != userY)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return int.Parse(userX).CompareTo(int.Parse(userY));
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
//ignore
|
||||||
|
}
|
||||||
|
return String.Compare(userX, userY, StringComparison.OrdinalIgnoreCase);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//use creation time for non-tan entries:
|
||||||
|
|
||||||
|
return x.CreationTime.CompareTo(y.CreationTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
_groupsForViewing = new List<PwGroup>(_group.Groups);
|
_groupsForViewing = new List<PwGroup>(_group.Groups);
|
||||||
|
Loading…
Reference in New Issue
Block a user