mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-23 18:02:15 -05:00
Added support for Exchange path. This is not specifying the path for authentication or for the mailbox. This is support for situations like "https://www.myserver.com/owapath" for authentication.
This commit is contained in:
parent
b7ad91b7a5
commit
1cda221fa3
@ -99,8 +99,19 @@
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:text="@string/account_setup_incoming_webdav_path_prefix_label"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorPrimary" />
|
||||
<EditText
|
||||
android:id="@+id/webdav_path_prefix"
|
||||
android:hint="@string/account_setup_incoming_imap_path_prefix_hint"
|
||||
android:singleLine="true"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0px"
|
||||
|
@ -220,7 +220,7 @@ Welcome to K-9 Mail setup. K-9 is an open source email client for Android based
|
||||
|
||||
<string name="account_setup_incoming_imap_path_prefix_label">IMAP path prefix</string>
|
||||
<string name="account_setup_incoming_imap_path_prefix_hint">Optional</string>
|
||||
<string name="account_setup_incoming_webdav_path_prefix_label">WebDav(Exchange) path prefix</string>
|
||||
<string name="account_setup_incoming_webdav_path_prefix_label">WebDav(Exchange) path</string>
|
||||
<string name="account_setup_incoming_webdav_path_prefix_hint">Optional</string>
|
||||
|
||||
<string name="account_setup_outgoing_title">Outgoing server settings</string>
|
||||
|
@ -60,6 +60,7 @@ public class AccountSetupIncoming extends Activity implements OnClickListener {
|
||||
private Spinner mSecurityTypeView;
|
||||
private Spinner mDeletePolicyView;
|
||||
private EditText mImapPathPrefixView;
|
||||
private EditText mWebdavPathPrefixView;
|
||||
private Button mNextButton;
|
||||
private Account mAccount;
|
||||
private boolean mMakeDefault;
|
||||
@ -91,6 +92,7 @@ public class AccountSetupIncoming extends Activity implements OnClickListener {
|
||||
mSecurityTypeView = (Spinner)findViewById(R.id.account_security_type);
|
||||
mDeletePolicyView = (Spinner)findViewById(R.id.account_delete_policy);
|
||||
mImapPathPrefixView = (EditText)findViewById(R.id.imap_path_prefix);
|
||||
mWebdavPathPrefixView = (EditText)findViewById(R.id.webdav_path_prefix);
|
||||
mNextButton = (Button)findViewById(R.id.next);
|
||||
|
||||
mNextButton.setOnClickListener(this);
|
||||
@ -203,6 +205,7 @@ public class AccountSetupIncoming extends Activity implements OnClickListener {
|
||||
mAccountSchemes = popSchemes;
|
||||
|
||||
findViewById(R.id.imap_path_prefix_section).setVisibility(View.GONE);
|
||||
findViewById(R.id.webdav_path_prefix_section).setVisibility(View.GONE);
|
||||
} else if (uri.getScheme().startsWith("imap")) {
|
||||
serverLabelView.setText(R.string.account_setup_incoming_imap_server_label);
|
||||
mAccountPorts = imapPorts;
|
||||
@ -211,6 +214,7 @@ public class AccountSetupIncoming extends Activity implements OnClickListener {
|
||||
if (uri.getPath() != null && uri.getPath().length() > 0) {
|
||||
mImapPathPrefixView.setText(uri.getPath().substring(1));
|
||||
}
|
||||
findViewById(R.id.webdav_path_prefix_section).setVisibility(View.GONE);
|
||||
} else if (uri.getScheme().startsWith("webdav")) {
|
||||
serverLabelView.setText(R.string.account_setup_incoming_webdav_server_label);
|
||||
mAccountPorts = webdavPorts;
|
||||
@ -218,6 +222,9 @@ public class AccountSetupIncoming extends Activity implements OnClickListener {
|
||||
|
||||
/** Hide the unnecessary fields */
|
||||
findViewById(R.id.imap_path_prefix_section).setVisibility(View.GONE);
|
||||
if (uri.getPath() != null && uri.getPath().length() > 0) {
|
||||
mWebdavPathPrefixView.setText(uri.getPath().substring(1));
|
||||
}
|
||||
} else {
|
||||
throw new Error("Unknown account type: " + mAccount.getStoreUri());
|
||||
}
|
||||
@ -311,7 +318,10 @@ public class AccountSetupIncoming extends Activity implements OnClickListener {
|
||||
String path = null;
|
||||
if (mAccountSchemes[securityType].startsWith("imap")) {
|
||||
path = "/" + mImapPathPrefixView.getText();
|
||||
}
|
||||
} else if (mAccountSchemes[securityType].startsWith("webdav")) {
|
||||
path = "/" + mWebdavPathPrefixView.getText();
|
||||
}
|
||||
|
||||
URI uri = new URI(
|
||||
mAccountSchemes[securityType],
|
||||
mUsernameView.getText() + ":" + mPasswordView.getText(),
|
||||
|
@ -84,6 +84,7 @@ public class WebDavStore extends Store {
|
||||
private String mPassword; /* Stores the password for authentications */
|
||||
private String mUrl; /* Stores the base URL for the server */
|
||||
private String mHost; /* Stores the host name for the server */
|
||||
private String mPath; /* Stores the path for the server */
|
||||
private URI mUri; /* Stores the Uniform Resource Indicator with all connection info */
|
||||
|
||||
private CookieStore mAuthCookies; /* Stores cookies from authentication */
|
||||
@ -133,13 +134,18 @@ public class WebDavStore extends Store {
|
||||
}
|
||||
}
|
||||
|
||||
mPath = mUri.getPath();
|
||||
if (mPath == null) {
|
||||
mPath = "";
|
||||
}
|
||||
|
||||
if (mConnectionSecurity == CONNECTION_SECURITY_TLS_REQUIRED ||
|
||||
mConnectionSecurity == CONNECTION_SECURITY_SSL_REQUIRED ||
|
||||
mConnectionSecurity == CONNECTION_SECURITY_TLS_OPTIONAL ||
|
||||
mConnectionSecurity == CONNECTION_SECURITY_SSL_OPTIONAL) {
|
||||
this.mUrl = "https://" + mHost + ":" + mUri.getPort();
|
||||
this.mUrl = "https://" + mHost + ":" + mUri.getPort() + mPath;
|
||||
} else {
|
||||
this.mUrl = "http://" + mHost + ":" + mUri.getPort();
|
||||
this.mUrl = "http://" + mHost + ":" + mUri.getPort() + mPath;
|
||||
}
|
||||
|
||||
if (mUri.getUserInfo() != null) {
|
||||
|
Loading…
Reference in New Issue
Block a user