diff options
Diffstat (limited to 'OpenPGP-Keychain/src/org/sufficientlysecure')
4 files changed, 37 insertions, 16 deletions
diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/Id.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/Id.java index b0d60cf94..e9b0b67d4 100644 --- a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/Id.java +++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/Id.java @@ -63,6 +63,7 @@ public final class Id { public static final int import_from_qr_code = 0x21070021; public static final int import_from_nfc = 0x21070022; public static final int crypto_consumers = 0x21070023; + public static final int createExpert = 0x21070024; } } diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java index 5942eadab..40ab80856 100644 --- a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java +++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java @@ -89,13 +89,15 @@ public class ImportKeysActivity extends SherlockFragmentActivity { */ @Override public boolean onCreateOptionsMenu(Menu menu) { - menu.add(1, Id.menu.option.import_from_file, 0, R.string.menu_importFromFile) + menu.add(1, Id.menu.option.key_server, 0, R.string.menu_keyServer).setShowAsAction( + MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); + menu.add(1, Id.menu.option.import_from_file, 1, R.string.menu_importFromFile) .setShowAsAction( MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); - menu.add(1, Id.menu.option.import_from_qr_code, 1, R.string.menu_importFromQrCode) + menu.add(1, Id.menu.option.import_from_qr_code, 2, R.string.menu_importFromQrCode) .setShowAsAction( MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); - menu.add(1, Id.menu.option.import_from_nfc, 2, R.string.menu_importFromNfc) + menu.add(1, Id.menu.option.import_from_nfc, 3, R.string.menu_importFromNfc) .setShowAsAction( MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); @@ -113,6 +115,11 @@ public class ImportKeysActivity extends SherlockFragmentActivity { startActivity(intent); return true; + case Id.menu.option.key_server: + startActivityForResult(new Intent(this, KeyServerQueryActivity.class), 0); + + return true; + case Id.menu.option.import_from_file: showImportFromFileDialog(); return true; diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/KeyListSecretActivity.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/KeyListSecretActivity.java index 52ce19f97..a1de4b0bc 100644 --- a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/KeyListSecretActivity.java +++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/KeyListSecretActivity.java @@ -52,6 +52,8 @@ public class KeyListSecretActivity extends KeyListActivity { super.onCreateOptionsMenu(menu); menu.add(1, Id.menu.option.create, 1, R.string.menu_createKey).setShowAsAction( MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); + menu.add(1, Id.menu.option.createExpert, 2, R.string.menu_createKeyExpert).setShowAsAction( + MenuItem.SHOW_AS_ACTION_NEVER); return true; } @@ -64,6 +66,11 @@ public class KeyListSecretActivity extends KeyListActivity { return true; } + case Id.menu.option.createExpert: { + createKeyExpert(); + return true; + } + default: { return super.onOptionsItemSelected(item); } @@ -112,12 +119,23 @@ public class KeyListSecretActivity extends KeyListActivity { private void createKey() { PgpMain.setEditPassPhrase(""); - Intent intent = new Intent(EditKeyActivity.ACTION_CREATE_KEY); + Intent intent = new Intent(this, EditKeyActivity.class); + intent.setAction(EditKeyActivity.ACTION_CREATE_KEY); + intent.putExtra(EditKeyActivity.EXTRA_GENERATE_DEFAULT_KEYS, true); + intent.putExtra(EditKeyActivity.EXTRA_USER_IDS, ""); // show user id view + startActivityForResult(intent, 0); + } + + private void createKeyExpert() { + PgpMain.setEditPassPhrase(""); + Intent intent = new Intent(this, EditKeyActivity.class); + intent.setAction(EditKeyActivity.ACTION_CREATE_KEY); startActivityForResult(intent, 0); } private void editKey(long masterKeyId, boolean masterCanSign) { - Intent intent = new Intent(EditKeyActivity.ACTION_EDIT_KEY); + Intent intent = new Intent(this, EditKeyActivity.class); + intent.setAction(EditKeyActivity.ACTION_EDIT_KEY); intent.putExtra(EditKeyActivity.EXTRA_MASTER_KEY_ID, masterKeyId); intent.putExtra(EditKeyActivity.EXTRA_MASTER_CAN_SIGN, masterCanSign); startActivityForResult(intent, 0); diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/KeyListSecretFragment.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/KeyListSecretFragment.java index e41755840..2a6ce2808 100644 --- a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/KeyListSecretFragment.java +++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/KeyListSecretFragment.java @@ -17,28 +17,23 @@ package org.sufficientlysecure.keychain.ui; -import java.util.ArrayList; - import org.sufficientlysecure.keychain.Id; -import org.sufficientlysecure.keychain.provider.ProviderHelper; +import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings; import org.sufficientlysecure.keychain.provider.KeychainContract.UserIds; +import org.sufficientlysecure.keychain.provider.ProviderHelper; import org.sufficientlysecure.keychain.ui.widget.KeyListAdapter; -import org.sufficientlysecure.keychain.R; - -import com.google.zxing.integration.android.IntentIntegrator; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; +import android.support.v4.app.LoaderManager; import android.support.v4.content.CursorLoader; import android.support.v4.content.Loader; -import android.support.v4.app.LoaderManager; import android.view.ContextMenu; -import android.view.View; import android.view.ContextMenu.ContextMenuInfo; +import android.view.View; import android.widget.ExpandableListView; -import android.widget.Toast; import android.widget.ExpandableListView.ExpandableListContextMenuInfo; public class KeyListSecretFragment extends KeyListFragment implements @@ -91,7 +86,8 @@ public class KeyListSecretFragment extends KeyListFragment implements long masterKeyId = ProviderHelper .getSecretMasterKeyId(mKeyListSecretActivity, keyRingRowId); - boolean masterCanSign = ProviderHelper.getSecretMasterKeyCanSign(mKeyListSecretActivity, keyRingRowId); + boolean masterCanSign = ProviderHelper.getSecretMasterKeyCanSign(mKeyListSecretActivity, + keyRingRowId); switch (item.getItemId()) { case Id.menu.edit: @@ -105,7 +101,6 @@ public class KeyListSecretFragment extends KeyListFragment implements } } - // These are the rows that we will retrieve. static final String[] PROJECTION = new String[] { KeyRings._ID, KeyRings.MASTER_KEY_ID, UserIds.USER_ID }; |