Merge branch 'development' of github.com:open-keychain/open-keychain into development

This commit is contained in:
Dominik Schürmann 2014-10-25 22:25:14 +02:00
commit 8dddc82f69
3 changed files with 20 additions and 8 deletions

View File

@ -62,12 +62,19 @@ import java.util.concurrent.atomic.AtomicBoolean;
/** An operation class which implements high level import and export
* operations.
*
* This class receivs a source and/or destination of keys as input and performs
* This class receives a source and/or destination of keys as input and performs
* all steps for this import or export.
*
* For the import operation, the only valid source is an Iterator of
* ParcelableKeyRing, each of which must contain exactly a single keyring
* encoded as bytes.
* ParcelableKeyRing, each of which must contain either a single
* keyring encoded as bytes, or a unique reference to a keyring
* on keyservers and/or keybase.io.
* It is important to note that public keys should generally be imported before
* secret keys, because some implementations (notably Symantec PGP Desktop) do
* not include self certificates for user ids in the secret keyring. The import
* method here will generally import keyrings in the order given by the
* iterator. so this should be ensured beforehand.
* @see org.sufficientlysecure.keychain.ui.adapter.ImportKeysAdapter#getSelectedEntries()
*
* For the export operation, the input consists of a set of key ids and
* either the name of a file or an output uri to write to.

View File

@ -165,10 +165,6 @@ public class UncachedKeyRing {
// if there are no objects left from the last factory, create a new one
if (mObjectFactory == null) {
InputStream in = PGPUtil.getDecoderStream(stream);
if (!BufferedInputStream.class.isInstance(in)) {
in = new BufferedInputStream(in);
}
mObjectFactory = new PGPObjectFactory(in, new JcaKeyFingerprintCalculator());
}

View File

@ -70,6 +70,7 @@ public class ImportKeysAdapter extends ArrayAdapter<ImportKeysListEntry> {
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void setData(List<ImportKeysListEntry> data) {
clear();
if (data != null) {
this.mData = data;
@ -89,16 +90,24 @@ public class ImportKeysAdapter extends ArrayAdapter<ImportKeysListEntry> {
return mData;
}
/** This method returns a list of all selected entries, with public keys sorted
* before secret keys, see ImportExportOperation for specifics.
* @see org.sufficientlysecure.keychain.operations.ImportExportOperation
*/
public ArrayList<ImportKeysListEntry> getSelectedEntries() {
ArrayList<ImportKeysListEntry> result = new ArrayList<ImportKeysListEntry>();
ArrayList<ImportKeysListEntry> secrets = new ArrayList<ImportKeysListEntry>();
if (mData == null) {
return result;
}
for (ImportKeysListEntry entry : mData) {
if (entry.isSelected()) {
result.add(entry);
// add this entry to either the secret or the public list
(entry.isSecretKey() ? secrets : result).add(entry);
}
}
// add secret keys at the end of the list
result.addAll(secrets);
return result;
}