1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 03:32:16 -05:00

Removed display of path prefix. System now pulls all folders/subfolders. Does not display in a hierarchy, but will load messages from each folder. Only the final folder name is displayed instead of the path off of Inbox right now

This commit is contained in:
Matthew Brace 2008-12-15 02:18:02 +00:00
parent 453406a5a5
commit c544596d8f
2 changed files with 28 additions and 4 deletions

View File

@ -210,6 +210,9 @@ public class AccountSetupIncoming extends Activity implements OnClickListener {
serverLabelView.setText(R.string.account_setup_incoming_webdav_server_label); serverLabelView.setText(R.string.account_setup_incoming_webdav_server_label);
mAccountPorts = webdavPorts; mAccountPorts = webdavPorts;
mAccountSchemes = webdavSchemes; mAccountSchemes = webdavSchemes;
/** Hide the unnecessary fields */
findViewById(R.id.imap_path_prefix_section).setVisibility(View.GONE);
} else { } else {
throw new Error("Unknown account type: " + mAccount.getStoreUri()); throw new Error("Unknown account type: " + mAccount.getStoreUri());
} }

View File

@ -79,7 +79,8 @@ public class WebDavStore extends Store {
private boolean mAuthenticated = false; /* Stores authentication state */ private boolean mAuthenticated = false; /* Stores authentication state */
private long mLastAuth = -1; /* Stores the timestamp of last auth */ private long mLastAuth = -1; /* Stores the timestamp of last auth */
private long mAuthTimeout = 5 * 60; private long mAuthTimeout = 5 * 60;
private HashMap<String, WebDavFolder> mFolderList = new HashMap<String, WebDavFolder>();
/** /**
* webdav://user:password@server:port CONNECTION_SECURITY_NONE * webdav://user:password@server:port CONNECTION_SECURITY_NONE
* webdav+tls://user:password@server:port CONNECTION_SECURITY_TLS_OPTIONAL * webdav+tls://user:password@server:port CONNECTION_SECURITY_TLS_OPTIONAL
@ -216,10 +217,19 @@ public class WebDavStore extends Store {
for (int i = 0; i < urlLength; i++) { for (int i = 0; i < urlLength; i++) {
String[] urlParts = folderUrls[i].split("/"); String[] urlParts = folderUrls[i].split("/");
String folderName = urlParts[urlParts.length - 1]; String folderName = urlParts[urlParts.length - 1];
String fullUrl = "";
WebDavFolder wdFolder;
if (folderName.equalsIgnoreCase(k9.INBOX)) { if (folderName.equalsIgnoreCase(k9.INBOX)) {
folderName = "INBOX"; folderName = "INBOX";
} }
folderList.add(getFolder(java.net.URLDecoder.decode(folderName, "UTF-8")));
folderName = java.net.URLDecoder.decode(folderName, "UTF-8");
wdFolder = new WebDavFolder(folderName);
wdFolder.setUrl(folderUrls[i]);
folderList.add(wdFolder);
this.mFolderList.put(folderName, wdFolder);
//folderList.add(getFolder(java.net.URLDecoder.decode(folderName, "UTF-8")));
} }
} catch (SAXException se) { } catch (SAXException se) {
Log.e(k9.LOG_TAG, "Error with SAXParser " + se); Log.e(k9.LOG_TAG, "Error with SAXParser " + se);
@ -239,7 +249,11 @@ public class WebDavStore extends Store {
@Override @Override
public Folder getFolder(String name) throws MessagingException { public Folder getFolder(String name) throws MessagingException {
WebDavFolder folder; WebDavFolder folder;
folder = new WebDavFolder(name);
if ((folder = this.mFolderList.get(name)) == null) {
folder = new WebDavFolder(name);
}
return folder; return folder;
} }
@ -252,7 +266,8 @@ public class WebDavStore extends Store {
buffer.append("<?xml version='1.0' ?>"); buffer.append("<?xml version='1.0' ?>");
buffer.append("<a:searchrequest xmlns:a='DAV:'><a:sql>\r\n"); buffer.append("<a:searchrequest xmlns:a='DAV:'><a:sql>\r\n");
buffer.append("SELECT \"DAV:ishidden\"\r\n"); buffer.append("SELECT \"DAV:ishidden\"\r\n");
buffer.append(" FROM \"\"\r\n"); // buffer.append(" FROM \"\"\r\n");
buffer.append(" FROM SCOPE('deep traversal of \""+this.mUrl+"\"')\r\n");
buffer.append(" WHERE \"DAV:ishidden\"=False AND \"DAV:isfolder\"=True\r\n"); buffer.append(" WHERE \"DAV:ishidden\"=False AND \"DAV:isfolder\"=True\r\n");
buffer.append("</a:sql></a:searchrequest>\r\n"); buffer.append("</a:sql></a:searchrequest>\r\n");
@ -536,6 +551,12 @@ public class WebDavStore extends Store {
this.mFolderUrl = WebDavStore.this.mUrl + encodedName; this.mFolderUrl = WebDavStore.this.mUrl + encodedName;
} }
public void setUrl(String url) {
if (url != null) {
this.mFolderUrl = url;
}
}
@Override @Override
public void open(OpenMode mode) throws MessagingException { public void open(OpenMode mode) throws MessagingException {
if (needAuth()) { if (needAuth()) {