From d75ea3f9e5b891e2dced2bb7cc0700c35f5bb7d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Tue, 4 Feb 2014 14:20:49 +0100 Subject: [PATCH] Certify not sign a key, added as button, does not belong to menu --- OpenPGP-Keychain/src/main/AndroidManifest.xml | 4 +- .../keychain/pgp/PgpKeyOperation.java | 10 ++--- .../service/KeychainIntentService.java | 15 +++---- ...yActivity.java => CertifyKeyActivity.java} | 22 +++++----- .../keychain/ui/ImportKeysActivity.java | 8 ++-- .../keychain/ui/ImportKeysQrCodeFragment.java | 2 +- .../keychain/ui/ViewKeyActivity.java | 43 +++++++++++-------- ..._activity.xml => certify_key_activity.xml} | 2 +- .../src/main/res/layout/view_key_activity.xml | 9 ++++ .../src/main/res/menu/key_view.xml | 4 -- .../src/main/res/values-de/strings.xml | 2 +- .../src/main/res/values-es-rCO/strings.xml | 2 +- .../src/main/res/values-fr/strings.xml | 2 +- .../src/main/res/values-it-rIT/strings.xml | 2 +- .../src/main/res/values-nl-rNL/strings.xml | 2 +- .../src/main/res/values-ru/strings.xml | 2 +- .../src/main/res/values-tr/strings.xml | 2 +- .../src/main/res/values-uk/strings.xml | 2 +- .../src/main/res/values/strings.xml | 8 ++-- 19 files changed, 78 insertions(+), 65 deletions(-) rename OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/{SignKeyActivity.java => CertifyKeyActivity.java} (93%) rename OpenPGP-Keychain/src/main/res/layout/{sign_key_activity.xml => certify_key_activity.xml} (98%) diff --git a/OpenPGP-Keychain/src/main/AndroidManifest.xml b/OpenPGP-Keychain/src/main/AndroidManifest.xml index 3ef04e4f6..4102a882e 100644 --- a/OpenPGP-Keychain/src/main/AndroidManifest.xml +++ b/OpenPGP-Keychain/src/main/AndroidManifest.xml @@ -249,9 +249,9 @@ android:label="@string/title_key_server_preference" android:windowSoftInputMode="stateHidden" /> + android:label="@string/title_certify_key" /> + * Copyright (C) 2012-2014 Dominik Schürmann * Copyright (C) 2011 Senecaso * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -127,7 +127,7 @@ public class ImportKeysActivity extends DrawerActivity implements ActionBar.OnNa /* Scanning a fingerprint directly with Barcode Scanner */ getSupportActionBar().setSelectedNavigationItem(0); loadFragment(ImportKeysQrCodeFragment.class, null, mNavigationStrings[0]); - loadFromFingerprintUri(dataUri); + loadFromFingerprintUri(savedInstanceState, dataUri); } else if (ACTION_IMPORT_KEY.equals(action)) { /* Keychain's own Actions */ getSupportActionBar().setSelectedNavigationItem(1); @@ -248,7 +248,7 @@ public class ImportKeysActivity extends DrawerActivity implements ActionBar.OnNa ft.commit(); } - public void loadFromFingerprintUri(Uri dataUri) { + public void loadFromFingerprintUri(Bundle savedInstanceState, Uri dataUri) { String fingerprint = dataUri.toString().split(":")[1].toLowerCase(Locale.ENGLISH); Log.d(Constants.TAG, "fingerprint: " + fingerprint); @@ -267,7 +267,7 @@ public class ImportKeysActivity extends DrawerActivity implements ActionBar.OnNa args.putString(ImportKeysServerFragment.ARG_QUERY, query); loadFragment(ImportKeysServerFragment.class, args, mNavigationStrings[0]); - startListFragment(null, null, null, query); + startListFragment(savedInstanceState, null, null, query); } public void loadCallback(byte[] importData, Uri dataUri, String serverQuery, String keyServer) { diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysQrCodeFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysQrCodeFragment.java index 63727ad26..27628dad4 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysQrCodeFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysQrCodeFragment.java @@ -130,7 +130,7 @@ public class ImportKeysQrCodeFragment extends Fragment { } public void importFingerprint(Uri dataUri) { - mImportActivity.loadFromFingerprintUri(dataUri); + mImportActivity.loadFromFingerprintUri(null, dataUri); } private void importParts(String[] parts) { diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java index 99d93fbbd..0bfc51e67 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java @@ -75,6 +75,7 @@ public class ViewKeyActivity extends ActionBarActivity implements private TextView mCreation; private TextView mFingerprint; private BootstrapButton mActionEncrypt; + private BootstrapButton mActionCertify; private ListView mUserIds; private ListView mKeys; @@ -91,6 +92,7 @@ public class ViewKeyActivity extends ActionBarActivity implements mExportHelper = new ExportHelper(this); + // let the actionbar look like Android's contact app getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setIcon(android.R.color.transparent); getSupportActionBar().setHomeButtonEnabled(true); @@ -105,9 +107,10 @@ public class ViewKeyActivity extends ActionBarActivity implements mCreation = (TextView) findViewById(R.id.creation); mExpiry = (TextView) findViewById(R.id.expiry); mFingerprint = (TextView) findViewById(R.id.fingerprint); - mActionEncrypt = (BootstrapButton) findViewById(R.id.action_encrypt); mUserIds = (ListView) findViewById(R.id.user_ids); mKeys = (ListView) findViewById(R.id.keys); + mActionEncrypt = (BootstrapButton) findViewById(R.id.action_encrypt); + mActionCertify = (BootstrapButton) findViewById(R.id.action_certify); loadData(getIntent()); } @@ -130,9 +133,6 @@ public class ViewKeyActivity extends ActionBarActivity implements case R.id.menu_key_view_update: updateFromKeyserver(mDataUri); return true; - case R.id.menu_key_view_sign: - signKey(mDataUri); - return true; case R.id.menu_key_view_export_keyserver: uploadToKeyserver(mDataUri); return true; @@ -196,19 +196,18 @@ public class ViewKeyActivity extends ActionBarActivity implements @Override public void onClick(View v) { - long keyId = ProviderHelper.getMasterKeyId(ViewKeyActivity.this, mDataUri); + encryptToContact(mDataUri); + } + }); + mActionCertify.setOnClickListener(new OnClickListener() { - long[] encryptionKeyIds = new long[]{keyId}; - Intent intent = new Intent(ViewKeyActivity.this, EncryptActivity.class); - intent.setAction(EncryptActivity.ACTION_ENCRYPT); - intent.putExtra(EncryptActivity.EXTRA_ENCRYPTION_KEY_IDS, encryptionKeyIds); - // used instead of startActivity set actionbar based on callingPackage - startActivityForResult(intent, 0); + @Override + public void onClick(View v) { + certifyKey(mDataUri); } }); mUserIdsAdapter = new ViewKeyUserIdsAdapter(this, null, 0); - mUserIds.setAdapter(mUserIdsAdapter); // mUserIds.setEmptyView(findViewById(android.R.id.empty)); // mUserIds.setClickable(true); @@ -219,11 +218,10 @@ public class ViewKeyActivity extends ActionBarActivity implements // }); mKeysAdapter = new ViewKeyKeysAdapter(this, null, 0); - mKeys.setAdapter(mKeysAdapter); - // Prepare the loader. Either re-connect with an existing one, - // or start a new one. + // Prepare the loaders. Either re-connect with an existing ones, + // or start new ones. getSupportLoaderManager().initLoader(LOADER_ID_KEYRING, null, this); getSupportLoaderManager().initLoader(LOADER_ID_USER_IDS, null, this); getSupportLoaderManager().initLoader(LOADER_ID_KEYS, null, this); @@ -405,8 +403,19 @@ public class ViewKeyActivity extends ActionBarActivity implements startActivityForResult(queryIntent, Id.request.look_up_key_id); } - private void signKey(Uri dataUri) { - Intent signIntent = new Intent(this, SignKeyActivity.class); + private void encryptToContact(Uri dataUri) { + long keyId = ProviderHelper.getMasterKeyId(ViewKeyActivity.this, dataUri); + + long[] encryptionKeyIds = new long[]{keyId}; + Intent intent = new Intent(ViewKeyActivity.this, EncryptActivity.class); + intent.setAction(EncryptActivity.ACTION_ENCRYPT); + intent.putExtra(EncryptActivity.EXTRA_ENCRYPTION_KEY_IDS, encryptionKeyIds); + // used instead of startActivity set actionbar based on callingPackage + startActivityForResult(intent, 0); + } + + private void certifyKey(Uri dataUri) { + Intent signIntent = new Intent(this, CertifyKeyActivity.class); signIntent.setData(dataUri); startActivity(signIntent); } diff --git a/OpenPGP-Keychain/src/main/res/layout/sign_key_activity.xml b/OpenPGP-Keychain/src/main/res/layout/certify_key_activity.xml similarity index 98% rename from OpenPGP-Keychain/src/main/res/layout/sign_key_activity.xml rename to OpenPGP-Keychain/src/main/res/layout/certify_key_activity.xml index 07f63b91b..1dbd2476c 100644 --- a/OpenPGP-Keychain/src/main/res/layout/sign_key_activity.xml +++ b/OpenPGP-Keychain/src/main/res/layout/certify_key_activity.xml @@ -60,7 +60,7 @@ android:layout_height="60dp" android:layout_marginBottom="4dp" android:layout_marginTop="14dp" - android:text="@string/btn_sign" + android:text="@string/btn_certify" bootstrapbutton:bb_icon_left="fa-pencil" bootstrapbutton:bb_type="info" /> diff --git a/OpenPGP-Keychain/src/main/res/layout/view_key_activity.xml b/OpenPGP-Keychain/src/main/res/layout/view_key_activity.xml index 73a86a725..1c937430a 100644 --- a/OpenPGP-Keychain/src/main/res/layout/view_key_activity.xml +++ b/OpenPGP-Keychain/src/main/res/layout/view_key_activity.xml @@ -215,6 +215,15 @@ android:text="@string/key_view_action_encrypt" bootstrapbutton:bb_icon_left="fa-lock" bootstrapbutton:bb_type="info" /> + + \ No newline at end of file diff --git a/OpenPGP-Keychain/src/main/res/menu/key_view.xml b/OpenPGP-Keychain/src/main/res/menu/key_view.xml index acf3eb099..59247221a 100644 --- a/OpenPGP-Keychain/src/main/res/menu/key_view.xml +++ b/OpenPGP-Keychain/src/main/res/menu/key_view.xml @@ -64,10 +64,6 @@ android:title="@string/menu_export_key_to_server" /> - Schlüssel-Server abfragen Auf Schlüsselserver hochladen Unbekannter Signaturschlüssel - Schlüssel signieren + Schlüssel signieren Schlüsseldetails Hilfe diff --git a/OpenPGP-Keychain/src/main/res/values-es-rCO/strings.xml b/OpenPGP-Keychain/src/main/res/values-es-rCO/strings.xml index 8f508a885..6c520988f 100644 --- a/OpenPGP-Keychain/src/main/res/values-es-rCO/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-es-rCO/strings.xml @@ -22,7 +22,7 @@ Clave no encontrada Solicitar al servidor de claves Clave de firma desconocida - Clave de firma + Clave de firma Ayuda IDs de usuario diff --git a/OpenPGP-Keychain/src/main/res/values-fr/strings.xml b/OpenPGP-Keychain/src/main/res/values-fr/strings.xml index d427403dd..5f12275b9 100644 --- a/OpenPGP-Keychain/src/main/res/values-fr/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-fr/strings.xml @@ -25,7 +25,7 @@ Interroger le serveur de clefs Téléverser vers le serveur de clefs Clef de signature inconnue - Signer la clef + Signer la clef Détails sur la clef Aide diff --git a/OpenPGP-Keychain/src/main/res/values-it-rIT/strings.xml b/OpenPGP-Keychain/src/main/res/values-it-rIT/strings.xml index 44424561b..71783d3b2 100644 --- a/OpenPGP-Keychain/src/main/res/values-it-rIT/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-it-rIT/strings.xml @@ -15,7 +15,7 @@ Esportare Chiave Esportare Chiavi Chiave Non Trovata - Firma Chiave + Firma Chiave Aiuto ID Utente diff --git a/OpenPGP-Keychain/src/main/res/values-nl-rNL/strings.xml b/OpenPGP-Keychain/src/main/res/values-nl-rNL/strings.xml index b0d792708..7389664fe 100644 --- a/OpenPGP-Keychain/src/main/res/values-nl-rNL/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-nl-rNL/strings.xml @@ -22,7 +22,7 @@ Sleutel niet gevonden Sleutelserver verzoek zenden Onbekende handtekeningssleutel - Sleutel ondertekenen + Sleutel ondertekenen Help Gebruikers-id\'s diff --git a/OpenPGP-Keychain/src/main/res/values-ru/strings.xml b/OpenPGP-Keychain/src/main/res/values-ru/strings.xml index 91ec2d1af..dd9eaf86d 100644 --- a/OpenPGP-Keychain/src/main/res/values-ru/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-ru/strings.xml @@ -25,7 +25,7 @@ Запросить сервер ключей Загрузить на сервер ключей Неизвестная подпись - Ключ для подписи + Ключ для подписи Сведения о ключе Помощь diff --git a/OpenPGP-Keychain/src/main/res/values-tr/strings.xml b/OpenPGP-Keychain/src/main/res/values-tr/strings.xml index d9fe8713e..20d99ae2e 100644 --- a/OpenPGP-Keychain/src/main/res/values-tr/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-tr/strings.xml @@ -14,7 +14,7 @@ Anahtar Bulunamadı Anahtar Sunucusunu Sorgula Bilinmeyen İmza Anahtarı - Anahtarı İmzala + Anahtarı İmzala Anahtar Detayları Yardım diff --git a/OpenPGP-Keychain/src/main/res/values-uk/strings.xml b/OpenPGP-Keychain/src/main/res/values-uk/strings.xml index ac40311b0..b08c8edc2 100644 --- a/OpenPGP-Keychain/src/main/res/values-uk/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-uk/strings.xml @@ -25,7 +25,7 @@ Сервер запиту ключа Завантажити на сервер ключів Невідомий підпис ключа - Підписати ключ + Підписати ключ Подробиці про ключ Довідка diff --git a/OpenPGP-Keychain/src/main/res/values/strings.xml b/OpenPGP-Keychain/src/main/res/values/strings.xml index fb7b60b7c..0d8870a3e 100644 --- a/OpenPGP-Keychain/src/main/res/values/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values/strings.xml @@ -26,7 +26,7 @@ Query Key Server Upload to Key Server Unknown Signature Key - Sign Key + Certify Key Key Details Help @@ -39,7 +39,7 @@ Master Key Master User ID Actions - Your Key used for Signing + Your Key used for certification Upload Key Key Server Encrypt and/or Sign @@ -47,6 +47,7 @@ Sign + Certify Decrypt Decrypt and Verify Select Recipients @@ -126,7 +127,7 @@ Name Comment Email - Upload key to selected key server after signing + Upload key to selected key server after certification Fingerprint Select @@ -406,6 +407,7 @@ Encrypt to this contact + Certify User ID of this contact Contacts