mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-04 08:15:02 -05:00
Better handling if no api key is selected
This commit is contained in:
parent
45b02008fb
commit
7646baf486
@ -410,9 +410,16 @@ public class OpenPgpService extends RemoteService {
|
|||||||
if (sign) {
|
if (sign) {
|
||||||
|
|
||||||
// Find the appropriate subkey to sign with
|
// Find the appropriate subkey to sign with
|
||||||
CachedPublicKeyRing signingRing =
|
long sigSubKeyId;
|
||||||
new ProviderHelper(this).getCachedPublicKeyRing(accSettings.getKeyId());
|
try {
|
||||||
final long sigSubKeyId = signingRing.getSecretSignId();
|
CachedPublicKeyRing signingRing =
|
||||||
|
new ProviderHelper(this).getCachedPublicKeyRing(accSettings.getKeyId());
|
||||||
|
sigSubKeyId = signingRing.getSecretSignId();
|
||||||
|
} catch (PgpKeyNotFoundException e) {
|
||||||
|
// secret key that is set for this account is deleted?
|
||||||
|
// show account config again!
|
||||||
|
return getCreateAccountIntent(data, getAccountName(data));
|
||||||
|
}
|
||||||
|
|
||||||
String passphrase;
|
String passphrase;
|
||||||
if (data.hasExtra(OpenPgpApi.EXTRA_PASSPHRASE)) {
|
if (data.hasExtra(OpenPgpApi.EXTRA_PASSPHRASE)) {
|
||||||
|
@ -31,7 +31,6 @@ import android.text.style.ForegroundColorSpan;
|
|||||||
import android.text.style.StyleSpan;
|
import android.text.style.StyleSpan;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import org.openintents.openpgp.util.OpenPgpApi;
|
import org.openintents.openpgp.util.OpenPgpApi;
|
||||||
import org.sufficientlysecure.keychain.Constants;
|
import org.sufficientlysecure.keychain.Constants;
|
||||||
@ -42,6 +41,7 @@ import org.sufficientlysecure.keychain.remote.AccountSettings;
|
|||||||
import org.sufficientlysecure.keychain.remote.AppSettings;
|
import org.sufficientlysecure.keychain.remote.AppSettings;
|
||||||
import org.sufficientlysecure.keychain.ui.SelectPublicKeyFragment;
|
import org.sufficientlysecure.keychain.ui.SelectPublicKeyFragment;
|
||||||
import org.sufficientlysecure.keychain.ui.util.ActionBarHelper;
|
import org.sufficientlysecure.keychain.ui.util.ActionBarHelper;
|
||||||
|
import org.sufficientlysecure.keychain.ui.util.Notify;
|
||||||
import org.sufficientlysecure.keychain.util.Log;
|
import org.sufficientlysecure.keychain.util.Log;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -176,10 +176,9 @@ public class RemoteServiceActivity extends ActionBarActivity {
|
|||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
// Save
|
// Save
|
||||||
|
|
||||||
// user needs to select a key!
|
// user needs to select a key, but also allow None for mUpdateExistingAccount
|
||||||
if (mAccSettingsFragment.getAccSettings().getKeyId() == Constants.key.none) {
|
if (mUpdateExistingAccount && mAccSettingsFragment.getAccSettings().getKeyId() == Constants.key.none) {
|
||||||
// TODO
|
Notify.showNotify(RemoteServiceActivity.this, getString(R.string.api_register_error_select_key), Notify.Style.ERROR);
|
||||||
Toast.makeText(RemoteServiceActivity.this, getString(R.string.api_register_error_select_key), Toast.LENGTH_LONG).show();
|
|
||||||
} else {
|
} else {
|
||||||
if (mUpdateExistingAccount) {
|
if (mUpdateExistingAccount) {
|
||||||
Uri baseUri = KeychainContract.ApiAccounts.buildBaseUri(packageName);
|
Uri baseUri = KeychainContract.ApiAccounts.buildBaseUri(packageName);
|
||||||
|
@ -1,29 +1,37 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<LinearLayout
|
<include layout="@layout/notify_area" />
|
||||||
|
|
||||||
|
<ScrollView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content">
|
||||||
android:padding="16dp"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:id="@+id/api_remote_create_account_text"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:paddingBottom="3dip"
|
|
||||||
android:text="@string/api_create_account_text"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
|
||||||
|
|
||||||
<fragment
|
|
||||||
android:id="@+id/api_account_settings_fragment"
|
|
||||||
android:name="org.sufficientlysecure.keychain.remote.ui.AccountSettingsFragment"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
tools:layout="@layout/api_app_settings_fragment" />
|
android:padding="16dp"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
</LinearLayout>
|
<TextView
|
||||||
</ScrollView>
|
android:id="@+id/api_remote_create_account_text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingBottom="3dip"
|
||||||
|
android:text="@string/api_create_account_text"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||||
|
|
||||||
|
<fragment
|
||||||
|
android:id="@+id/api_account_settings_fragment"
|
||||||
|
android:name="org.sufficientlysecure.keychain.remote.ui.AccountSettingsFragment"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
tools:layout="@layout/api_app_settings_fragment" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</ScrollView>
|
||||||
|
</LinearLayout>
|
Loading…
Reference in New Issue
Block a user