From 662cc53859760c4a8a792fc3653eaf7ad6e89ab4 Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Fri, 3 Oct 2014 04:25:00 +0200 Subject: clean up PgpImportExport a bit --- .../org/sufficientlysecure/keychain/pgp/PgpImportExport.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'OpenKeychain/src/main/java/org') diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java index 26c705347..dd0549adc 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java @@ -47,7 +47,6 @@ import java.io.IOException; import java.io.OutputStream; import java.util.ArrayList; import java.util.Iterator; -import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; public class PgpImportExport { @@ -116,11 +115,6 @@ public class PgpImportExport { } } - /** Imports keys from given data. If keyIds is given only those are imported */ - public ImportKeyResult importKeyRings(List entries) { - return importKeyRings(entries.iterator(), entries.size()); - } - public ImportKeyResult importKeyRings(Iterator entries, int num) { updateProgress(R.string.progress_importing, 0, 100); @@ -134,7 +128,11 @@ public class PgpImportExport { int position = 0; double progSteps = 100.0 / num; - for (ParcelableKeyRing entry : new IterableIterator(entries)) { + + // iterate over all entries + while (entries.hasNext()) { + ParcelableKeyRing entry = entries.next(); + // Has this action been cancelled? If so, don't proceed any further if (mCancelled != null && mCancelled.get()) { break; -- cgit v1.2.3