aboutsummaryrefslogtreecommitdiffstats
path: root/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service
diff options
context:
space:
mode:
authoruberspot <onexemailx@gmail.com>2014-03-11 03:22:05 +0200
committeruberspot <onexemailx@gmail.com>2014-03-11 03:22:05 +0200
commit361c45a481c75b3c62f7d9f46c9a6d2a7c4f97f0 (patch)
treead3e8cc43429e2cf66b7ea1ecc7c919b15f6802b /OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service
parentd93731701255e082b02bf80c5c029db8838b15b0 (diff)
downloadopen-keychain-361c45a481c75b3c62f7d9f46c9a6d2a7c4f97f0.tar.gz
open-keychain-361c45a481c75b3c62f7d9f46c9a6d2a7c4f97f0.tar.bz2
open-keychain-361c45a481c75b3c62f7d9f46c9a6d2a7c4f97f0.zip
Make export work with rowIds instead of MasterKeyIds
Diffstat (limited to 'OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service')
-rw-r--r--OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java24
1 files changed, 15 insertions, 9 deletions
diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java
index 902c66fe9..93238349d 100644
--- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java
+++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java
@@ -50,6 +50,7 @@ import org.sufficientlysecure.keychain.pgp.PgpImportExport;
import org.sufficientlysecure.keychain.pgp.PgpKeyOperation;
import org.sufficientlysecure.keychain.pgp.PgpSignEncrypt;
import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
+import org.sufficientlysecure.keychain.provider.KeychainContract;
import org.sufficientlysecure.keychain.provider.KeychainContract.DataStream;
import org.sufficientlysecure.keychain.provider.ProviderHelper;
import org.sufficientlysecure.keychain.ui.adapter.ImportKeysListEntry;
@@ -153,6 +154,7 @@ public class KeychainIntentService extends IntentService implements ProgressDial
public static final String EXPORT_KEY_TYPE = "export_key_type";
public static final String EXPORT_ALL = "export_all";
public static final String EXPORT_KEY_RING_MASTER_KEY_ID = "export_key_ring_id";
+ public static final String EXPORT_KEY_RING_ROW_ID = "export_key_rind_row_id";
// upload key
public static final String UPLOAD_KEY_SERVER = "upload_key_server";
@@ -675,10 +677,12 @@ public class KeychainIntentService extends IntentService implements ProgressDial
String outputFile = data.getString(EXPORT_FILENAME);
+ long[] rowIds = new long[0];
+
+ // If not exporting all keys get the rowIds of the keys to export from the intent
boolean exportAll = data.getBoolean(EXPORT_ALL);
- long keyRingMasterKeyId = -1;
if (!exportAll) {
- keyRingMasterKeyId = data.getLong(EXPORT_KEY_RING_MASTER_KEY_ID);
+ rowIds = data.getLongArray(EXPORT_KEY_RING_ROW_ID);
}
/* Operation */
@@ -691,24 +695,26 @@ public class KeychainIntentService extends IntentService implements ProgressDial
// OutputStream
FileOutputStream outStream = new FileOutputStream(outputFile);
- ArrayList<Long> keyRingMasterKeyIds = new ArrayList<Long>();
+ ArrayList<Long> keyRingRowIds = new ArrayList<Long>();
if (exportAll) {
- // get all key ring row ids based on export type
+ // get all key ring row ids based on export type
if (keyType == Id.type.public_key) {
- keyRingMasterKeyIds = ProviderHelper.getPublicKeyRingsMasterKeyIds(this);
+ keyRingRowIds = ProviderHelper.getPublicKeyRingsRowIds(this);
} else {
- keyRingMasterKeyIds = ProviderHelper.getSecretKeyRingsMasterKeyIds(this);
+ keyRingRowIds = ProviderHelper.getSecretKeyRingsRowIds(this);
}
} else {
- keyRingMasterKeyIds.add(keyRingMasterKeyId);
+ for(long rowId : rowIds) {
+ keyRingRowIds.add(rowId);
+ }
}
- Bundle resultData = new Bundle();
+ Bundle resultData;
PgpImportExport pgpImportExport = new PgpImportExport(this, this);
resultData = pgpImportExport
- .exportKeyRings(keyRingMasterKeyIds, keyType, outStream);
+ .exportKeyRings(keyRingRowIds, keyType, outStream);
sendMessageToHandler(KeychainIntentServiceHandler.MESSAGE_OKAY, resultData);
} catch (Exception e) {