mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-11 03:25:05 -05:00
use hashcode instead of keyid in import list (keyids may not be unique!)
This commit is contained in:
parent
a1525bffe2
commit
857b15cbd5
@ -46,6 +46,7 @@ public class ImportKeysListEntry implements Serializable, Parcelable {
|
||||
private String mExtraData;
|
||||
private String mQuery;
|
||||
private String mOrigin;
|
||||
private Integer mHashCode = null;
|
||||
|
||||
private boolean mSelected;
|
||||
|
||||
@ -98,6 +99,13 @@ public class ImportKeysListEntry implements Serializable, Parcelable {
|
||||
}
|
||||
};
|
||||
|
||||
public int hashCode() {
|
||||
if (mHashCode != null) {
|
||||
return mHashCode;
|
||||
}
|
||||
return super.hashCode();
|
||||
}
|
||||
|
||||
public String getKeyIdHex() {
|
||||
return mKeyIdHex;
|
||||
}
|
||||
@ -240,6 +248,8 @@ public class ImportKeysListEntry implements Serializable, Parcelable {
|
||||
mSecretKey = ring.isSecret();
|
||||
UncachedPublicKey key = ring.getPublicKey();
|
||||
|
||||
mHashCode = key.hashCode();
|
||||
|
||||
mPrimaryUserId = key.getPrimaryUserId();
|
||||
mUserIds = key.getUnorderedUserIds();
|
||||
|
||||
|
@ -79,7 +79,7 @@ public class ImportKeysListFragment extends ListFragment implements
|
||||
public ArrayList<ParcelableKeyRing> getSelectedData() {
|
||||
ArrayList<ParcelableKeyRing> result = new ArrayList<ParcelableKeyRing>();
|
||||
for (ImportKeysListEntry entry : getSelectedEntries()) {
|
||||
result.add(mCachedKeyData.get(entry.getKeyId()));
|
||||
result.add(mCachedKeyData.get(entry.hashCode()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ public class ImportKeysListLoader
|
||||
for(UncachedKeyRing key : rings) {
|
||||
ImportKeysListEntry item = new ImportKeysListEntry(getContext(), key);
|
||||
mData.add(item);
|
||||
mParcelableRings.put(key.getMasterKeyId(), new ParcelableKeyRing(key.getEncoded()));
|
||||
mParcelableRings.put(item.hashCode(), new ParcelableKeyRing(key.getEncoded()));
|
||||
isEmpty = false;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user