1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-08-13 17:03:48 -04:00

Issue 675

Prevent a crash, and puts up a Toast, but you have to start over
setting up the account again.

This page needs an effective Back button.
This commit is contained in:
Daniel Applebaum 2009-10-23 01:20:12 +00:00
parent e315ee9156
commit 99b239fa71
2 changed files with 26 additions and 21 deletions

View File

@ -320,6 +320,8 @@ Welcome to K-9 Mail setup. K-9 is an open source email client for Android based
<string name="account_setup_outgoing_authentication_imap_before_smtp_label">IMAP before SMTP</string>
<string name="account_setup_outgoing_authentication_webdav_before_smtp_label">WebDav(Exchange) before SMTP</string>
<string name="account_setup_bad_uri">Invalid account: <xliff:g id="err_mess">%s</xliff:g></string>
<string name="account_setup_options_title">Account options</string>
<string name="compact_action">Compact</string>

View File

@ -11,9 +11,11 @@ import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;
import com.android.email.Account;
import com.android.email.R;
import com.android.email.activity.SizeFormatter;
/**
* Prompts the user to select an account type. The account type, along with the
@ -53,14 +55,12 @@ public class AccountSetupAccountType extends K9Activity implements OnClickListen
URI uri = new URI(mAccount.getStoreUri());
uri = new URI("pop3", uri.getUserInfo(), uri.getHost(), uri.getPort(), null, null, null);
mAccount.setStoreUri(uri.toString());
} catch (URISyntaxException use) {
/*
* This should not happen.
*/
throw new Error(use);
AccountSetupIncoming.actionIncomingSettings(this, mAccount, mMakeDefault);
finish();
} catch (Exception use) {
failure(use);
}
AccountSetupIncoming.actionIncomingSettings(this, mAccount, mMakeDefault);
finish();
}
private void onImap() {
@ -68,14 +68,12 @@ public class AccountSetupAccountType extends K9Activity implements OnClickListen
URI uri = new URI(mAccount.getStoreUri());
uri = new URI("imap", uri.getUserInfo(), uri.getHost(), uri.getPort(), null, null, null);
mAccount.setStoreUri(uri.toString());
} catch (URISyntaxException use) {
/*
* This should not happen.
*/
throw new Error(use);
AccountSetupIncoming.actionIncomingSettings(this, mAccount, mMakeDefault);
finish();
} catch (Exception use) {
failure(use);
}
AccountSetupIncoming.actionIncomingSettings(this, mAccount, mMakeDefault);
finish();
}
private void onWebDav() {
@ -83,14 +81,12 @@ public class AccountSetupAccountType extends K9Activity implements OnClickListen
URI uri = new URI(mAccount.getStoreUri());
uri = new URI("webdav", uri.getUserInfo(), uri.getHost(), uri.getPort(), null, null, null);
mAccount.setStoreUri(uri.toString());
} catch (URISyntaxException use) {
/*
* This should not happen.
*/
throw new Error(use);
AccountSetupIncoming.actionIncomingSettings(this, mAccount, mMakeDefault);
finish();
} catch (Exception use) {
failure(use);
}
AccountSetupIncoming.actionIncomingSettings(this, mAccount, mMakeDefault);
finish();
}
public void onClick(View v) {
@ -106,4 +102,11 @@ public class AccountSetupAccountType extends K9Activity implements OnClickListen
break;
}
}
private void failure(Exception use)
{
String toastText = getString(R.string.account_setup_bad_uri, use.getMessage());
Toast toast = Toast.makeText(getApplication(), toastText, Toast.LENGTH_LONG);
toast.show();
}
}