diff options
author | Dominik Schürmann <dominik@dominikschuermann.de> | 2013-01-08 17:48:56 +0100 |
---|---|---|
committer | Dominik Schürmann <dominik@dominikschuermann.de> | 2013-01-08 17:48:56 +0100 |
commit | 6fd44a0ec5fcf7d45042ca0eaaed4906ccfcdf12 (patch) | |
tree | 3af1c890ece970cfdef8df4981907a08c493bd67 /APG/src/org/thialfihar/android/apg/ui | |
parent | 68039d3a8a0ce9b20ee426765094807112a634d7 (diff) | |
download | open-keychain-6fd44a0ec5fcf7d45042ca0eaaed4906ccfcdf12.tar.gz open-keychain-6fd44a0ec5fcf7d45042ca0eaaed4906ccfcdf12.tar.bz2 open-keychain-6fd44a0ec5fcf7d45042ca0eaaed4906ccfcdf12.zip |
When exporting secret keyrings, also export public part
Diffstat (limited to 'APG/src/org/thialfihar/android/apg/ui')
3 files changed, 18 insertions, 12 deletions
diff --git a/APG/src/org/thialfihar/android/apg/ui/ImportKeysActivity.java b/APG/src/org/thialfihar/android/apg/ui/ImportKeysActivity.java index 355214ab5..84359f1da 100644 --- a/APG/src/org/thialfihar/android/apg/ui/ImportKeysActivity.java +++ b/APG/src/org/thialfihar/android/apg/ui/ImportKeysActivity.java @@ -441,6 +441,7 @@ public class ImportKeysActivity extends SherlockFragmentActivity { // mScannedContent = scanResult.getContents(); mImportData = scanResult.getContents().getBytes(); + mImportFilename = null; // mContentView.setText(mScannedContent); // String[] bits = scanResult.getContents().split(","); diff --git a/APG/src/org/thialfihar/android/apg/ui/KeyListActivity.java b/APG/src/org/thialfihar/android/apg/ui/KeyListActivity.java index ac4798f7c..4b4a5daac 100644 --- a/APG/src/org/thialfihar/android/apg/ui/KeyListActivity.java +++ b/APG/src/org/thialfihar/android/apg/ui/KeyListActivity.java @@ -87,7 +87,6 @@ public class KeyListActivity extends SherlockFragmentActivity { } } - // if (searchString == null) { // mFilterLayout.setVisibility(View.GONE); // } else { @@ -134,8 +133,8 @@ public class KeyListActivity extends SherlockFragmentActivity { // TODO: reimplement! // menu.add(3, Id.menu.option.search, 0, R.string.menu_search) // .setIcon(R.drawable.ic_menu_search).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); - menu.add(0, Id.menu.option.import_from_file, 5, R.string.menu_importFromFile).setShowAsAction( - MenuItem.SHOW_AS_ACTION_NEVER | MenuItem.SHOW_AS_ACTION_WITH_TEXT); + menu.add(0, Id.menu.option.import_from_file, 5, R.string.menu_importFromFile) + .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER | MenuItem.SHOW_AS_ACTION_WITH_TEXT); menu.add(0, Id.menu.option.export_keys, 6, R.string.menu_exportKeys).setShowAsAction( MenuItem.SHOW_AS_ACTION_NEVER | MenuItem.SHOW_AS_ACTION_WITH_TEXT); @@ -178,10 +177,10 @@ public class KeyListActivity extends SherlockFragmentActivity { /** * Show dialog where to export keys * - * @param keyRingRowId + * @param keyRingMasterKeyId * if -1 export all keys */ - public void showExportKeysDialog(final long keyRingRowId) { + public void showExportKeysDialog(final long keyRingMasterKeyId) { // Message is received after file is selected Handler returnHandler = new Handler() { @Override @@ -190,7 +189,7 @@ public class KeyListActivity extends SherlockFragmentActivity { Bundle data = message.getData(); mExportFilename = data.getString(FileDialogFragment.MESSAGE_DATA_FILENAME); - exportKeys(keyRingRowId); + exportKeys(keyRingMasterKeyId); } } }; @@ -201,7 +200,7 @@ public class KeyListActivity extends SherlockFragmentActivity { DialogFragmentWorkaround.INTERFACE.runnableRunDelayed(new Runnable() { public void run() { String title = null; - if (keyRingRowId != -1) { + if (keyRingMasterKeyId != -1) { // single key export title = getString(R.string.title_exportKey); } else { @@ -251,10 +250,10 @@ public class KeyListActivity extends SherlockFragmentActivity { /** * Export keys * - * @param keyRingRowId + * @param keyRingMasterKeyId * if -1 export all keys */ - public void exportKeys(long keyRingRowId) { + public void exportKeys(long keyRingMasterKeyId) { Log.d(Constants.TAG, "exportKeys started"); // Send all information needed to service to export key in other thread @@ -268,10 +267,10 @@ public class KeyListActivity extends SherlockFragmentActivity { data.putString(ApgIntentService.EXPORT_FILENAME, mExportFilename); data.putInt(ApgIntentService.EXPORT_KEY_TYPE, mKeyType); - if (keyRingRowId == -1) { + if (keyRingMasterKeyId == -1) { data.putBoolean(ApgIntentService.EXPORT_ALL, true); } else { - data.putLong(ApgIntentService.EXPORT_KEY_RING_ROW_ID, keyRingRowId); + data.putLong(ApgIntentService.EXPORT_KEY_RING_MASTER_KEY_ID, keyRingMasterKeyId); } intent.putExtra(ApgIntentService.EXTRA_DATA, data); diff --git a/APG/src/org/thialfihar/android/apg/ui/KeyListFragment.java b/APG/src/org/thialfihar/android/apg/ui/KeyListFragment.java index f8f62287c..dc50c2dd6 100644 --- a/APG/src/org/thialfihar/android/apg/ui/KeyListFragment.java +++ b/APG/src/org/thialfihar/android/apg/ui/KeyListFragment.java @@ -19,6 +19,7 @@ package org.thialfihar.android.apg.ui; import org.thialfihar.android.apg.Id; import org.thialfihar.android.apg.R; +import org.thialfihar.android.apg.provider.ProviderHelper; import org.thialfihar.android.apg.ui.widget.ExpandableListFragment; import android.os.Bundle; @@ -66,7 +67,12 @@ public class KeyListFragment extends ExpandableListFragment { switch (item.getItemId()) { case Id.menu.export: - mKeyListActivity.showExportKeysDialog(keyRingRowId); + long masterKeyId = ProviderHelper.getPublicMasterKeyId(mKeyListActivity, keyRingRowId); + if (masterKeyId == -1) { + masterKeyId = ProviderHelper.getSecretMasterKeyId(mKeyListActivity, keyRingRowId); + } + + mKeyListActivity.showExportKeysDialog(masterKeyId); return true; case Id.menu.delete: |