Merge pull request #3956 from k9mail/remove_note_from_providers_xml
Remove support for 'note' attribute in providers.xml
This commit is contained in:
commit
c580b2b85c
3 changed files with 19 additions and 84 deletions
|
@ -1,15 +1,10 @@
|
|||
|
||||
package com.fsck.k9.activity.setup;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.res.XmlResourceParser;
|
||||
import android.os.Bundle;
|
||||
|
@ -29,17 +24,17 @@ import com.fsck.k9.Core;
|
|||
import com.fsck.k9.DI;
|
||||
import com.fsck.k9.EmailAddressValidator;
|
||||
import com.fsck.k9.Preferences;
|
||||
import com.fsck.k9.backend.BackendManager;
|
||||
import com.fsck.k9.preferences.Protocols;
|
||||
import com.fsck.k9.ui.R;
|
||||
import com.fsck.k9.account.AccountCreator;
|
||||
import com.fsck.k9.activity.K9Activity;
|
||||
import com.fsck.k9.activity.setup.AccountSetupCheckSettings.CheckDirection;
|
||||
import com.fsck.k9.backend.BackendManager;
|
||||
import com.fsck.k9.helper.UrlEncodingHelper;
|
||||
import com.fsck.k9.helper.Utility;
|
||||
import com.fsck.k9.mail.AuthType;
|
||||
import com.fsck.k9.mail.ConnectionSecurity;
|
||||
import com.fsck.k9.mail.ServerSettings;
|
||||
import com.fsck.k9.preferences.Protocols;
|
||||
import com.fsck.k9.ui.R;
|
||||
import com.fsck.k9.view.ClientCertificateSpinner;
|
||||
import com.fsck.k9.view.ClientCertificateSpinner.OnClientCertificateChangedListener;
|
||||
import timber.log.Timber;
|
||||
|
@ -54,11 +49,7 @@ import timber.log.Timber;
|
|||
public class AccountSetupBasics extends K9Activity
|
||||
implements OnClickListener, TextWatcher, OnCheckedChangeListener, OnClientCertificateChangedListener {
|
||||
private final static String EXTRA_ACCOUNT = "com.fsck.k9.AccountSetupBasics.account";
|
||||
private final static int DIALOG_NOTE = 1;
|
||||
private final static String STATE_KEY_PROVIDER =
|
||||
"com.fsck.k9.AccountSetupBasics.provider";
|
||||
private final static String STATE_KEY_CHECKED_INCOMING =
|
||||
"com.fsck.k9.AccountSetupBasics.checkedIncoming";
|
||||
private final static String STATE_KEY_CHECKED_INCOMING = "com.fsck.k9.AccountSetupBasics.checkedIncoming";
|
||||
|
||||
|
||||
private final BackendManager backendManager = DI.get(BackendManager.class);
|
||||
|
@ -70,7 +61,6 @@ public class AccountSetupBasics extends K9Activity
|
|||
private Button mNextButton;
|
||||
private Button mManualSetupButton;
|
||||
private Account mAccount;
|
||||
private Provider mProvider;
|
||||
|
||||
private EmailAddressValidator mEmailValidator = new EmailAddressValidator();
|
||||
private boolean mCheckedIncoming = false;
|
||||
|
@ -116,9 +106,6 @@ public class AccountSetupBasics extends K9Activity
|
|||
if (mAccount != null) {
|
||||
outState.putString(EXTRA_ACCOUNT, mAccount.getUuid());
|
||||
}
|
||||
if (mProvider != null) {
|
||||
outState.putSerializable(STATE_KEY_PROVIDER, mProvider);
|
||||
}
|
||||
outState.putBoolean(STATE_KEY_CHECKED_INCOMING, mCheckedIncoming);
|
||||
}
|
||||
|
||||
|
@ -131,10 +118,6 @@ public class AccountSetupBasics extends K9Activity
|
|||
mAccount = Preferences.getPreferences(this).getAccount(accountUuid);
|
||||
}
|
||||
|
||||
if (savedInstanceState.containsKey(STATE_KEY_PROVIDER)) {
|
||||
mProvider = (Provider) savedInstanceState.getSerializable(STATE_KEY_PROVIDER);
|
||||
}
|
||||
|
||||
mCheckedIncoming = savedInstanceState.getBoolean(STATE_KEY_CHECKED_INCOMING);
|
||||
|
||||
updateViewVisibility(mClientCertificateCheckBox.isChecked());
|
||||
|
@ -253,29 +236,7 @@ public class AccountSetupBasics extends K9Activity
|
|||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(int id) {
|
||||
if (id == DIALOG_NOTE) {
|
||||
if (mProvider != null && mProvider.note != null) {
|
||||
return new AlertDialog.Builder(this)
|
||||
.setMessage(mProvider.note)
|
||||
.setPositiveButton(
|
||||
getString(R.string.okay_action),
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
finishAutoSetup();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(
|
||||
getString(R.string.cancel_action),
|
||||
null)
|
||||
.create();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void finishAutoSetup() {
|
||||
private void finishAutoSetup(Provider provider) {
|
||||
String email = mEmailView.getText().toString();
|
||||
String password = mPasswordView.getText().toString();
|
||||
String[] emailParts = splitEmail(email);
|
||||
|
@ -285,18 +246,18 @@ public class AccountSetupBasics extends K9Activity
|
|||
String userEnc = UrlEncodingHelper.encodeUtf8(user);
|
||||
String passwordEnc = UrlEncodingHelper.encodeUtf8(password);
|
||||
|
||||
String incomingUsername = mProvider.incomingUsernameTemplate;
|
||||
String incomingUsername = provider.incomingUsernameTemplate;
|
||||
incomingUsername = incomingUsername.replaceAll("\\$email", email);
|
||||
incomingUsername = incomingUsername.replaceAll("\\$user", userEnc);
|
||||
incomingUsername = incomingUsername.replaceAll("\\$domain", domain);
|
||||
|
||||
URI incomingUriTemplate = mProvider.incomingUriTemplate;
|
||||
URI incomingUriTemplate = provider.incomingUriTemplate;
|
||||
URI incomingUri = new URI(incomingUriTemplate.getScheme(), incomingUsername + ":" + passwordEnc,
|
||||
incomingUriTemplate.getHost(), incomingUriTemplate.getPort(), null, null, null);
|
||||
|
||||
String outgoingUsername = mProvider.outgoingUsernameTemplate;
|
||||
String outgoingUsername = provider.outgoingUsernameTemplate;
|
||||
|
||||
URI outgoingUriTemplate = mProvider.outgoingUriTemplate;
|
||||
URI outgoingUriTemplate = provider.outgoingUriTemplate;
|
||||
|
||||
|
||||
URI outgoingUri;
|
||||
|
@ -349,20 +310,13 @@ public class AccountSetupBasics extends K9Activity
|
|||
String email = mEmailView.getText().toString();
|
||||
String[] emailParts = splitEmail(email);
|
||||
String domain = emailParts[1];
|
||||
mProvider = findProviderForDomain(domain);
|
||||
if (mProvider == null) {
|
||||
/*
|
||||
* We don't have default settings for this account, start the manual
|
||||
* setup process.
|
||||
*/
|
||||
onManualSetup();
|
||||
return;
|
||||
}
|
||||
|
||||
if (mProvider.note != null) {
|
||||
showDialog(DIALOG_NOTE);
|
||||
Provider provider = findProviderForDomain(domain);
|
||||
if (provider != null) {
|
||||
finishAutoSetup(provider);
|
||||
} else {
|
||||
finishAutoSetup();
|
||||
// We don't have default settings for this account, start the manual setup process.
|
||||
onManualSetup();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -461,7 +415,6 @@ public class AccountSetupBasics extends K9Activity
|
|||
provider.id = getXmlAttribute(xml, "id");
|
||||
provider.label = getXmlAttribute(xml, "label");
|
||||
provider.domain = getXmlAttribute(xml, "domain");
|
||||
provider.note = getXmlAttribute(xml, "note");
|
||||
} else if (xmlEventType == XmlResourceParser.START_TAG
|
||||
&& "incoming".equals(xml.getName())
|
||||
&& provider != null) {
|
||||
|
@ -492,24 +445,14 @@ public class AccountSetupBasics extends K9Activity
|
|||
return retParts;
|
||||
}
|
||||
|
||||
static class Provider implements Serializable {
|
||||
private static final long serialVersionUID = 8511656164616538989L;
|
||||
|
||||
static class Provider {
|
||||
public String id;
|
||||
|
||||
public String label;
|
||||
|
||||
public String domain;
|
||||
|
||||
public URI incomingUriTemplate;
|
||||
|
||||
public String incomingUsernameTemplate;
|
||||
|
||||
public URI outgoingUriTemplate;
|
||||
|
||||
public String outgoingUsernameTemplate;
|
||||
|
||||
public String note;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -800,10 +800,6 @@ Please submit bug reports, contribute new features and ask questions at
|
|||
|
||||
<string name="account_clear_dlg_title">Clear Account</string>
|
||||
|
||||
<string name="provider_note_auonejp">Be sure to enable IMAP or POP3 on the au one mail settings page.</string>
|
||||
<string name="provider_note_naver">Be sure to enable IMAP or POP3 on the Naver mail settings page.</string>
|
||||
<string name="provider_note_hanmail">Be sure to enable IMAP or POP3 on the Hanmail(Daum) mail settings page.</string>
|
||||
|
||||
<string name="account_setup_failed_dlg_invalid_certificate_title">Unrecognized Certificate</string>
|
||||
<string name="account_setup_failed_dlg_invalid_certificate_accept">Accept Key</string>
|
||||
<string name="account_setup_failed_dlg_invalid_certificate_reject">Reject Key</string>
|
||||
|
|
|
@ -456,25 +456,21 @@
|
|||
</provider>
|
||||
|
||||
<!-- Japanese -->
|
||||
<provider id="auone" label="au one" domain="auone.jp"
|
||||
note="@string/provider_note_auonejp">
|
||||
<provider id="auone" label="au one" domain="auone.jp">
|
||||
<incoming uri="imap+ssl+://imap.gmail.com" username="$email" />
|
||||
<outgoing uri="smtp+ssl+://smtp.gmail.com" username="$email" />
|
||||
</provider>
|
||||
|
||||
<!-- Korean -->
|
||||
<provider id="naver" label="Naver" domain="naver.com"
|
||||
note="@string/provider_note_naver">
|
||||
<provider id="naver" label="Naver" domain="naver.com">
|
||||
<incoming uri="imap+ssl+://imap.naver.com" username="$user" />
|
||||
<outgoing uri="smtp+tls+://smtp.naver.com:587" username="$user" />
|
||||
</provider>
|
||||
<provider id="hanmail" label="Hanmail" domain="hanmail.net"
|
||||
note="@string/provider_note_hanmail">
|
||||
<provider id="hanmail" label="Hanmail" domain="hanmail.net">
|
||||
<incoming uri="imap+ssl+://imap.hanmail.net" username="$user" />
|
||||
<outgoing uri="smtp+ssl+://smtp.hanmail.net" username="$user" />
|
||||
</provider>
|
||||
<provider id="daum" label="Hanmail" domain="daum.net"
|
||||
note="@string/provider_note_hanmail">
|
||||
<provider id="daum" label="Hanmail" domain="daum.net">
|
||||
<incoming uri="imap+ssl+://imap.hanmail.net" username="$user" />
|
||||
<outgoing uri="smtp+ssl+://smtp.hanmail.net" username="$user" />
|
||||
</provider>
|
||||
|
|
Loading…
Reference in a new issue