KEY_IMPORT to IMPORT_KEY

This commit is contained in:
Dominik Schürmann 2013-09-09 14:33:37 +02:00
parent 1aabeefab7
commit 0ee205d245
6 changed files with 23 additions and 23 deletions

View File

@ -48,15 +48,15 @@ import com.google.zxing.integration.android.IntentIntegrator;
import com.google.zxing.integration.android.IntentResult; import com.google.zxing.integration.android.IntentResult;
public class ImportKeysActivity extends SherlockFragmentActivity { public class ImportKeysActivity extends SherlockFragmentActivity {
public static final String ACTION_KEY_IMPORT = Constants.INTENT_PREFIX + "KEY_IMPORT"; public static final String ACTION_IMPORT_KEY = Constants.INTENT_PREFIX + "IMPORT_KEY";
public static final String ACTION_KEY_IMPORT_FROM_QR_CODE = Constants.INTENT_PREFIX public static final String ACTION_IMPORT_KEY_FROM_QR_CODE = Constants.INTENT_PREFIX
+ "KEY_IMPORT_FROM_QR_CODE"; + "IMPORT_KEY_FROM_QR_CODE";
// Actions for internal use only: // Actions for internal use only:
public static final String ACTION_KEY_IMPORT_FROM_FILE = Constants.INTENT_PREFIX public static final String ACTION_IMPOR_KEY_FROM_FILE = Constants.INTENT_PREFIX
+ "KEY_IMPORT_FROM_FILE"; + "IMPORT_KEY_FROM_FILE";
public static final String ACTION_KEY_IMPORT_FROM_NFC = Constants.INTENT_PREFIX public static final String ACTION_IMPORT_KEY_FROM_NFC = Constants.INTENT_PREFIX
+ "KEY_IMPORT_FROM_NFC"; + "IMPORT_KEY_FROM_NFC";
// only used by IMPORT // only used by IMPORT
public static final String EXTRA_KEYRING_BYTES = "keyring_bytes"; public static final String EXTRA_KEYRING_BYTES = "keyring_bytes";
@ -145,13 +145,13 @@ public class ImportKeysActivity extends SherlockFragmentActivity {
if (Intent.ACTION_VIEW.equals(action)) { if (Intent.ACTION_VIEW.equals(action)) {
// Android's Action when opening file associated to Keychain (see AndroidManifest.xml) // Android's Action when opening file associated to Keychain (see AndroidManifest.xml)
// override action to delegate it to Keychains ACTION_IMPORT // override action to delegate it to Keychains ACTION_IMPORT
action = ACTION_KEY_IMPORT; action = ACTION_IMPORT_KEY;
} }
/** /**
* APG's own Actions * APG's own Actions
*/ */
if (ACTION_KEY_IMPORT.equals(action)) { if (ACTION_IMPORT_KEY.equals(action)) {
if ("file".equals(intent.getScheme()) && intent.getDataString() != null) { if ("file".equals(intent.getScheme()) && intent.getDataString() != null) {
mImportFilename = intent.getData().getPath(); mImportFilename = intent.getData().getPath();
mImportData = null; mImportData = null;
@ -160,15 +160,15 @@ public class ImportKeysActivity extends SherlockFragmentActivity {
mImportFilename = null; mImportFilename = null;
} }
loadKeyListFragment(); loadKeyListFragment();
} else if (ACTION_KEY_IMPORT_FROM_FILE.equals(action)) { } else if (ACTION_IMPOR_KEY_FROM_FILE.equals(action)) {
if ("file".equals(intent.getScheme()) && intent.getDataString() != null) { if ("file".equals(intent.getScheme()) && intent.getDataString() != null) {
mImportFilename = intent.getData().getPath(); mImportFilename = intent.getData().getPath();
mImportData = null; mImportData = null;
} }
showImportFromFileDialog(); showImportFromFileDialog();
} else if (ACTION_KEY_IMPORT_FROM_QR_CODE.equals(action)) { } else if (ACTION_IMPORT_KEY_FROM_QR_CODE.equals(action)) {
importFromQrCode(); importFromQrCode();
} else if (ACTION_KEY_IMPORT_FROM_NFC.equals(action)) { } else if (ACTION_IMPORT_KEY_FROM_NFC.equals(action)) {
importFromNfc(); importFromNfc();
} }
} }

View File

@ -154,7 +154,7 @@ public class KeyListActivity extends SherlockFragmentActivity {
case Id.menu.option.import_from_file: { case Id.menu.option.import_from_file: {
Intent intentImportFromFile = new Intent(this, ImportKeysActivity.class); Intent intentImportFromFile = new Intent(this, ImportKeysActivity.class);
intentImportFromFile.setAction(ImportKeysActivity.ACTION_KEY_IMPORT_FROM_FILE); intentImportFromFile.setAction(ImportKeysActivity.ACTION_IMPOR_KEY_FROM_FILE);
startActivityForResult(intentImportFromFile, 0); startActivityForResult(intentImportFromFile, 0);
return true; return true;
} }

View File

@ -67,7 +67,7 @@ public class KeyListPublicActivity extends KeyListActivity {
} }
case Id.menu.option.import_from_file: { case Id.menu.option.import_from_file: {
Intent intentImportFromFile = new Intent(this, ImportKeysActivity.class); Intent intentImportFromFile = new Intent(this, ImportKeysActivity.class);
intentImportFromFile.setAction(ImportKeysActivity.ACTION_KEY_IMPORT_FROM_FILE); intentImportFromFile.setAction(ImportKeysActivity.ACTION_IMPOR_KEY_FROM_FILE);
startActivityForResult(intentImportFromFile, 0); startActivityForResult(intentImportFromFile, 0);
return true; return true;
@ -75,7 +75,7 @@ public class KeyListPublicActivity extends KeyListActivity {
case Id.menu.option.import_from_qr_code: { case Id.menu.option.import_from_qr_code: {
Intent intentImportFromFile = new Intent(this, ImportKeysActivity.class); Intent intentImportFromFile = new Intent(this, ImportKeysActivity.class);
intentImportFromFile.setAction(ImportKeysActivity.ACTION_KEY_IMPORT_FROM_QR_CODE); intentImportFromFile.setAction(ImportKeysActivity.ACTION_IMPORT_KEY_FROM_QR_CODE);
startActivityForResult(intentImportFromFile, Id.request.import_from_qr_code); startActivityForResult(intentImportFromFile, Id.request.import_from_qr_code);
return true; return true;
@ -83,7 +83,7 @@ public class KeyListPublicActivity extends KeyListActivity {
case Id.menu.option.import_from_nfc: { case Id.menu.option.import_from_nfc: {
Intent intentImportFromFile = new Intent(this, ImportKeysActivity.class); Intent intentImportFromFile = new Intent(this, ImportKeysActivity.class);
intentImportFromFile.setAction(ImportKeysActivity.ACTION_KEY_IMPORT_FROM_NFC); intentImportFromFile.setAction(ImportKeysActivity.ACTION_IMPORT_KEY_FROM_NFC);
startActivityForResult(intentImportFromFile, 0); startActivityForResult(intentImportFromFile, 0);
return true; return true;

View File

@ -227,7 +227,7 @@ public class KeyServerQueryActivity extends SherlockFragmentActivity {
if (mKeyData != null) { if (mKeyData != null) {
Intent intent = new Intent(KeyServerQueryActivity.this, Intent intent = new Intent(KeyServerQueryActivity.this,
ImportKeysActivity.class); ImportKeysActivity.class);
intent.setAction(ImportKeysActivity.ACTION_KEY_IMPORT); intent.setAction(ImportKeysActivity.ACTION_IMPORT_KEY);
intent.putExtra(ImportKeysActivity.EXTRA_KEYRING_BYTES, mKeyData.getBytes()); intent.putExtra(ImportKeysActivity.EXTRA_KEYRING_BYTES, mKeyData.getBytes());
startActivity(intent); startActivity(intent);
} }

View File

@ -115,7 +115,7 @@ public class ShareNfcBeamActivity extends SherlockFragmentActivity implements
byte[] receivedKeyringBytes = msg.getRecords()[0].getPayload(); byte[] receivedKeyringBytes = msg.getRecords()[0].getPayload();
Intent importIntent = new Intent(this, ImportKeysActivity.class); Intent importIntent = new Intent(this, ImportKeysActivity.class);
importIntent.setAction(ImportKeysActivity.ACTION_KEY_IMPORT); importIntent.setAction(ImportKeysActivity.ACTION_IMPORT_KEY);
importIntent.putExtra(ImportKeysActivity.EXTRA_KEYRING_BYTES, receivedKeyringBytes); importIntent.putExtra(ImportKeysActivity.EXTRA_KEYRING_BYTES, receivedKeyringBytes);
finish(); finish();

View File

@ -50,17 +50,17 @@ These Intents require user interaction!
All Intents start with ``org.sufficientlysecure.keychain.action.`` All Intents start with ``org.sufficientlysecure.keychain.action.``
* ``KEY_IMPORT``
* Extras: ``keyring_bytes``
* or Uri in data with file schema
* ``KEY_IMPORT_FROM_QR_CODE``
* without extras
* ``ENCRYPT`` * ``ENCRYPT``
* TODO: explain extras (see source) * TODO: explain extras (see source)
* ``ENCRYPT_FILE`` * ``ENCRYPT_FILE``
* ``DECRYPT`` * ``DECRYPT``
* TODO: explain extras (see source) * TODO: explain extras (see source)
* ``DECRYPT_FILE`` * ``DECRYPT_FILE``
* ``IMPORT_KEY``
* Extras: ``keyring_bytes`` (``byte[]``)
* or Uri in data with file schema
* ``IMPORT_KEY_FROM_QR_CODE``
* without extras
TODO: TODO:
- new intent REGISTER_APP? - new intent REGISTER_APP?