Certify not sign a key, added as button, does not belong to menu
This commit is contained in:
@@ -56,7 +56,7 @@ import com.beardedhen.androidbootstrap.BootstrapButton;
|
||||
/**
|
||||
* Signs the specified public key with the specified secret master key
|
||||
*/
|
||||
public class SignKeyActivity extends ActionBarActivity implements
|
||||
public class CertifyKeyActivity extends ActionBarActivity implements
|
||||
SelectSecretKeyLayoutFragment.SelectSecretKeyCallback {
|
||||
private BootstrapButton mSignButton;
|
||||
private CheckBox mUploadKeyCheckbox;
|
||||
@@ -72,7 +72,7 @@ public class SignKeyActivity extends ActionBarActivity implements
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.sign_key_activity);
|
||||
setContentView(R.layout.certify_key_activity);
|
||||
|
||||
final ActionBar actionBar = getSupportActionBar();
|
||||
actionBar.setDisplayShowTitleEnabled(true);
|
||||
@@ -196,8 +196,8 @@ public class SignKeyActivity extends ActionBarActivity implements
|
||||
String passphrase = PassphraseCacheService.getCachedPassphrase(this, mMasterKeyId);
|
||||
if (passphrase == null) {
|
||||
showPassphraseDialog(mMasterKeyId);
|
||||
return; // bail out; need to wait until the user has entered the passphrase
|
||||
// before trying again
|
||||
// bail out; need to wait until the user has entered the passphrase before trying again
|
||||
return;
|
||||
} else {
|
||||
startSigning();
|
||||
}
|
||||
@@ -218,13 +218,13 @@ public class SignKeyActivity extends ActionBarActivity implements
|
||||
// Send all information needed to service to sign key in other thread
|
||||
Intent intent = new Intent(this, KeychainIntentService.class);
|
||||
|
||||
intent.setAction(KeychainIntentService.ACTION_SIGN_KEYRING);
|
||||
intent.setAction(KeychainIntentService.ACTION_CERTIFY_KEYRING);
|
||||
|
||||
// fill values for this action
|
||||
Bundle data = new Bundle();
|
||||
|
||||
data.putLong(KeychainIntentService.SIGN_KEY_MASTER_KEY_ID, mMasterKeyId);
|
||||
data.putLong(KeychainIntentService.SIGN_KEY_PUB_KEY_ID, mPubKeyId);
|
||||
data.putLong(KeychainIntentService.CERTIFY_KEY_MASTER_KEY_ID, mMasterKeyId);
|
||||
data.putLong(KeychainIntentService.CERTIFY_KEY_PUB_KEY_ID, mPubKeyId);
|
||||
|
||||
intent.putExtra(KeychainIntentService.EXTRA_DATA, data);
|
||||
|
||||
@@ -237,14 +237,12 @@ public class SignKeyActivity extends ActionBarActivity implements
|
||||
|
||||
if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) {
|
||||
|
||||
Toast.makeText(SignKeyActivity.this, R.string.key_sign_success,
|
||||
Toast.makeText(CertifyKeyActivity.this, R.string.key_sign_success,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
|
||||
// check if we need to send the key to the server or not
|
||||
if (mUploadKeyCheckbox.isChecked()) {
|
||||
/*
|
||||
* upload the newly signed key to the key server
|
||||
*/
|
||||
// upload the newly signed key to the key server
|
||||
uploadKey();
|
||||
} else {
|
||||
setResult(RESULT_OK);
|
||||
@@ -291,7 +289,7 @@ public class SignKeyActivity extends ActionBarActivity implements
|
||||
super.handleMessage(message);
|
||||
|
||||
if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) {
|
||||
Toast.makeText(SignKeyActivity.this, R.string.key_send_success,
|
||||
Toast.makeText(CertifyKeyActivity.this, R.string.key_send_success,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
|
||||
setResult(RESULT_OK);
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2012 Dominik Schürmann <dominik@dominikschuermann.de>
|
||||
* Copyright (C) 2012-2014 Dominik Schürmann <dominik@dominikschuermann.de>
|
||||
* 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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user