Do not allow self certifying
This commit is contained in:
parent
eebd480e8d
commit
e1958009bd
|
@ -34,7 +34,6 @@ import android.support.v7.app.ActionBarActivity;
|
|||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
|
@ -203,6 +202,7 @@ public class CertifyKeyActivity extends ActionBarActivity implements LoaderManag
|
|||
if (data.moveToFirst()) {
|
||||
// TODO: put findViewById in onCreate!
|
||||
mPubKeyId = data.getLong(INDEX_MASTER_KEY_ID);
|
||||
mCertifyKeySpinner.setHiddenMasterKeyId(mPubKeyId);
|
||||
String keyIdStr = PgpKeyHelper.convertKeyIdToHex(mPubKeyId);
|
||||
((TextView) findViewById(R.id.key_id)).setText(keyIdStr);
|
||||
|
||||
|
|
|
@ -6,9 +6,13 @@ import android.net.Uri;
|
|||
import android.support.v4.content.CursorLoader;
|
||||
import android.support.v4.content.Loader;
|
||||
import android.util.AttributeSet;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainDatabase;
|
||||
|
||||
public class CertifyKeySpinner extends KeySpinner {
|
||||
private long mHiddenMasterKeyId = Constants.key.none;
|
||||
|
||||
public CertifyKeySpinner(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
@ -21,6 +25,11 @@ public class CertifyKeySpinner extends KeySpinner {
|
|||
super(context, attrs, defStyle);
|
||||
}
|
||||
|
||||
public void setHiddenMasterKeyId(long hiddenMasterKeyId) {
|
||||
this.mHiddenMasterKeyId = hiddenMasterKeyId;
|
||||
reload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Loader<Cursor> onCreateLoader() {
|
||||
// This is called when a new Loader needs to be created. This
|
||||
|
@ -38,8 +47,11 @@ public class CertifyKeySpinner extends KeySpinner {
|
|||
KeychainContract.KeyRings.HAS_ANY_SECRET
|
||||
};
|
||||
|
||||
String where = KeychainContract.KeyRings.HAS_ANY_SECRET + " = 1 AND " + KeychainContract.KeyRings.HAS_CERTIFY + " NOT NULL AND "
|
||||
+ KeychainContract.KeyRings.IS_REVOKED + " = 0 AND " + KeychainContract.KeyRings.IS_EXPIRED + " = 0";
|
||||
String where = KeychainContract.KeyRings.HAS_ANY_SECRET + " = 1 AND "
|
||||
+ KeychainContract.KeyRings.HAS_CERTIFY + " NOT NULL AND "
|
||||
+ KeychainContract.KeyRings.IS_REVOKED + " = 0 AND "
|
||||
+ KeychainContract.KeyRings.IS_EXPIRED + " = 0 AND " + KeychainDatabase.Tables.KEYS + "."
|
||||
+ KeychainContract.KeyRings.MASTER_KEY_ID + " != " + mHiddenMasterKeyId;
|
||||
|
||||
// Now create and return a CursorLoader that will take care of
|
||||
// creating a Cursor for the data being displayed.
|
||||
|
|
|
@ -80,8 +80,12 @@ public abstract class KeySpinner extends Spinner {
|
|||
@Override
|
||||
protected void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
reload();
|
||||
}
|
||||
|
||||
public void reload() {
|
||||
if (getContext() instanceof FragmentActivity) {
|
||||
((FragmentActivity) getContext()).getSupportLoaderManager().initLoader(hashCode(), null, new LoaderManager.LoaderCallbacks<Cursor>() {
|
||||
((FragmentActivity) getContext()).getSupportLoaderManager().restartLoader(hashCode(), null, new LoaderManager.LoaderCallbacks<Cursor>() {
|
||||
@Override
|
||||
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
|
||||
return KeySpinner.this.onCreateLoader();
|
||||
|
|
Loading…
Reference in New Issue