From c544596d8f578c21f1982d1dd0004ca38ba953d6 Mon Sep 17 00:00:00 2001 From: Matthew Brace Date: Mon, 15 Dec 2008 02:18:02 +0000 Subject: [PATCH] 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 --- .../activity/setup/AccountSetupIncoming.java | 3 ++ src/com/fsck/k9/mail/store/WebDavStore.java | 29 ++++++++++++++++--- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/com/fsck/k9/activity/setup/AccountSetupIncoming.java b/src/com/fsck/k9/activity/setup/AccountSetupIncoming.java index e7ef237d4..919ef1caf 100644 --- a/src/com/fsck/k9/activity/setup/AccountSetupIncoming.java +++ b/src/com/fsck/k9/activity/setup/AccountSetupIncoming.java @@ -210,6 +210,9 @@ public class AccountSetupIncoming extends Activity implements OnClickListener { serverLabelView.setText(R.string.account_setup_incoming_webdav_server_label); mAccountPorts = webdavPorts; mAccountSchemes = webdavSchemes; + + /** Hide the unnecessary fields */ + findViewById(R.id.imap_path_prefix_section).setVisibility(View.GONE); } else { throw new Error("Unknown account type: " + mAccount.getStoreUri()); } diff --git a/src/com/fsck/k9/mail/store/WebDavStore.java b/src/com/fsck/k9/mail/store/WebDavStore.java index 0832dea47..226aff13c 100644 --- a/src/com/fsck/k9/mail/store/WebDavStore.java +++ b/src/com/fsck/k9/mail/store/WebDavStore.java @@ -79,7 +79,8 @@ public class WebDavStore extends Store { private boolean mAuthenticated = false; /* Stores authentication state */ private long mLastAuth = -1; /* Stores the timestamp of last auth */ private long mAuthTimeout = 5 * 60; - + + private HashMap mFolderList = new HashMap(); /** * webdav://user:password@server:port CONNECTION_SECURITY_NONE * 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++) { String[] urlParts = folderUrls[i].split("/"); String folderName = urlParts[urlParts.length - 1]; + String fullUrl = ""; + WebDavFolder wdFolder; + if (folderName.equalsIgnoreCase(k9.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) { Log.e(k9.LOG_TAG, "Error with SAXParser " + se); @@ -239,7 +249,11 @@ public class WebDavStore extends Store { @Override public Folder getFolder(String name) throws MessagingException { WebDavFolder folder; - folder = new WebDavFolder(name); + + if ((folder = this.mFolderList.get(name)) == null) { + folder = new WebDavFolder(name); + } + return folder; } @@ -252,7 +266,8 @@ public class WebDavStore extends Store { buffer.append(""); buffer.append("\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("\r\n"); @@ -536,6 +551,12 @@ public class WebDavStore extends Store { this.mFolderUrl = WebDavStore.this.mUrl + encodedName; } + public void setUrl(String url) { + if (url != null) { + this.mFolderUrl = url; + } + } + @Override public void open(OpenMode mode) throws MessagingException { if (needAuth()) {