mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 19:52:17 -05:00
astyle
This commit is contained in:
parent
d2c56edbd2
commit
d3848d352d
@ -86,7 +86,7 @@ public class Account implements BaseAccount {
|
|||||||
private String mTrashFolderName;
|
private String mTrashFolderName;
|
||||||
private String mArchiveFolderName;
|
private String mArchiveFolderName;
|
||||||
private String mSpamFolderName;
|
private String mSpamFolderName;
|
||||||
private String mOutboxFolderName;
|
private String mOutboxFolderName;
|
||||||
private String mAutoExpandFolderName;
|
private String mAutoExpandFolderName;
|
||||||
private FolderMode mFolderDisplayMode;
|
private FolderMode mFolderDisplayMode;
|
||||||
private FolderMode mFolderSyncMode;
|
private FolderMode mFolderSyncMode;
|
||||||
@ -255,7 +255,7 @@ public class Account implements BaseAccount {
|
|||||||
mTrashFolderName = prefs.getString(mUuid + ".trashFolderName", "Trash");
|
mTrashFolderName = prefs.getString(mUuid + ".trashFolderName", "Trash");
|
||||||
mArchiveFolderName = prefs.getString(mUuid + ".archiveFolderName", "Archive");
|
mArchiveFolderName = prefs.getString(mUuid + ".archiveFolderName", "Archive");
|
||||||
mSpamFolderName = prefs.getString(mUuid + ".spamFolderName", "Spam");
|
mSpamFolderName = prefs.getString(mUuid + ".spamFolderName", "Spam");
|
||||||
mOutboxFolderName = prefs.getString(mUuid + ".outboxFolderName", "Outbox");
|
mOutboxFolderName = prefs.getString(mUuid + ".outboxFolderName", "Outbox");
|
||||||
mExpungePolicy = prefs.getString(mUuid + ".expungePolicy", EXPUNGE_IMMEDIATELY);
|
mExpungePolicy = prefs.getString(mUuid + ".expungePolicy", EXPUNGE_IMMEDIATELY);
|
||||||
mSyncRemoteDeletions = prefs.getBoolean(mUuid + ".syncRemoteDeletions", true);
|
mSyncRemoteDeletions = prefs.getBoolean(mUuid + ".syncRemoteDeletions", true);
|
||||||
|
|
||||||
@ -398,7 +398,7 @@ public class Account implements BaseAccount {
|
|||||||
editor.remove(mUuid + ".trashFolderName");
|
editor.remove(mUuid + ".trashFolderName");
|
||||||
editor.remove(mUuid + ".archiveFolderName");
|
editor.remove(mUuid + ".archiveFolderName");
|
||||||
editor.remove(mUuid + ".spamFolderName");
|
editor.remove(mUuid + ".spamFolderName");
|
||||||
editor.remove(mUuid + ".outboxFolderName");
|
editor.remove(mUuid + ".outboxFolderName");
|
||||||
editor.remove(mUuid + ".autoExpandFolderName");
|
editor.remove(mUuid + ".autoExpandFolderName");
|
||||||
editor.remove(mUuid + ".accountNumber");
|
editor.remove(mUuid + ".accountNumber");
|
||||||
editor.remove(mUuid + ".vibrate");
|
editor.remove(mUuid + ".vibrate");
|
||||||
@ -496,7 +496,7 @@ public class Account implements BaseAccount {
|
|||||||
editor.putString(mUuid + ".trashFolderName", mTrashFolderName);
|
editor.putString(mUuid + ".trashFolderName", mTrashFolderName);
|
||||||
editor.putString(mUuid + ".archiveFolderName", mArchiveFolderName);
|
editor.putString(mUuid + ".archiveFolderName", mArchiveFolderName);
|
||||||
editor.putString(mUuid + ".spamFolderName", mSpamFolderName);
|
editor.putString(mUuid + ".spamFolderName", mSpamFolderName);
|
||||||
editor.putString(mUuid + ".outboxFolderName", mOutboxFolderName);
|
editor.putString(mUuid + ".outboxFolderName", mOutboxFolderName);
|
||||||
editor.putString(mUuid + ".autoExpandFolderName", mAutoExpandFolderName);
|
editor.putString(mUuid + ".autoExpandFolderName", mAutoExpandFolderName);
|
||||||
editor.putInt(mUuid + ".accountNumber", mAccountNumber);
|
editor.putInt(mUuid + ".accountNumber", mAccountNumber);
|
||||||
editor.putString(mUuid + ".hideButtonsEnum", mScrollMessageViewButtons.name());
|
editor.putString(mUuid + ".hideButtonsEnum", mScrollMessageViewButtons.name());
|
||||||
@ -1316,12 +1316,12 @@ public class Account implements BaseAccount {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getInboxFolderName() {
|
public String getInboxFolderName() {
|
||||||
return mInboxFolderName;
|
return mInboxFolderName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInboxFolderName(String mInboxFolderName) {
|
public void setInboxFolderName(String mInboxFolderName) {
|
||||||
this.mInboxFolderName = mInboxFolderName;
|
this.mInboxFolderName = mInboxFolderName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized boolean syncRemoteDeletions() {
|
public synchronized boolean syncRemoteDeletions() {
|
||||||
return mSyncRemoteDeletions;
|
return mSyncRemoteDeletions;
|
||||||
|
@ -249,7 +249,7 @@ public class ChooseFolder extends K9ListActivity {
|
|||||||
|
|
||||||
// Inbox needs to be compared case-insensitively
|
// Inbox needs to be compared case-insensitively
|
||||||
if (hideCurrentFolder && (name.equals(mFolder) ||
|
if (hideCurrentFolder && (name.equals(mFolder) ||
|
||||||
(mAccount.getInboxFolderName().equalsIgnoreCase(mFolder) && mAccount.getInboxFolderName().equalsIgnoreCase(name)))) {
|
(mAccount.getInboxFolderName().equalsIgnoreCase(mFolder) && mAccount.getInboxFolderName().equalsIgnoreCase(name)))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@ -316,7 +316,7 @@ public class ChooseFolder extends K9ListActivity {
|
|||||||
selectedFolder = position;
|
selectedFolder = position;
|
||||||
}
|
}
|
||||||
} else if (name.equals(mFolder) ||
|
} else if (name.equals(mFolder) ||
|
||||||
(mAccount.getInboxFolderName().equalsIgnoreCase(mFolder) && mAccount.getInboxFolderName().equalsIgnoreCase(name))) {
|
(mAccount.getInboxFolderName().equalsIgnoreCase(mFolder) && mAccount.getInboxFolderName().equalsIgnoreCase(name))) {
|
||||||
selectedFolder = position;
|
selectedFolder = position;
|
||||||
}
|
}
|
||||||
position++;
|
position++;
|
||||||
|
@ -702,10 +702,10 @@ public class AccountSettings extends K9PreferenceActivity {
|
|||||||
|
|
||||||
// In webdav account we use the exact folder name also for inbox,
|
// In webdav account we use the exact folder name also for inbox,
|
||||||
// since it varies because of internationalization
|
// since it varies because of internationalization
|
||||||
if(mAccount.getStoreUri().startsWith("webdav"))
|
if (mAccount.getStoreUri().startsWith("webdav"))
|
||||||
mAccount.setAutoExpandFolderName(mAutoExpandFolder.getValue());
|
mAccount.setAutoExpandFolderName(mAutoExpandFolder.getValue());
|
||||||
else
|
else
|
||||||
mAccount.setAutoExpandFolderName(reverseTranslateFolder(mAutoExpandFolder.getValue()));
|
mAccount.setAutoExpandFolderName(reverseTranslateFolder(mAutoExpandFolder.getValue()));
|
||||||
|
|
||||||
mAccount.setArchiveFolderName(mArchiveFolder.getValue());
|
mAccount.setArchiveFolderName(mArchiveFolder.getValue());
|
||||||
mAccount.setDraftsFolderName(mDraftsFolder.getValue());
|
mAccount.setDraftsFolderName(mDraftsFolder.getValue());
|
||||||
|
@ -85,9 +85,9 @@ public class WebDavStore extends Store {
|
|||||||
private static final String DAV_MAIL_DRAFTS_FOLDER = "drafts";
|
private static final String DAV_MAIL_DRAFTS_FOLDER = "drafts";
|
||||||
private static final String DAV_MAIL_SPAM_FOLDER = "junkemail";
|
private static final String DAV_MAIL_SPAM_FOLDER = "junkemail";
|
||||||
private static final String DAV_MAIL_SEND_FOLDER = "##DavMailSubmissionURI##";
|
private static final String DAV_MAIL_SEND_FOLDER = "##DavMailSubmissionURI##";
|
||||||
private static final String DAV_MAIL_TRASH_FOLDER = "deleteditems";
|
private static final String DAV_MAIL_TRASH_FOLDER = "deleteditems";
|
||||||
private static final String DAV_MAIL_OUTBOX_FOLDER = "outbox";
|
private static final String DAV_MAIL_OUTBOX_FOLDER = "outbox";
|
||||||
private static final String DAV_MAIL_SENT_FOLDER = "sentitems";
|
private static final String DAV_MAIL_SENT_FOLDER = "sentitems";
|
||||||
|
|
||||||
private short mConnectionSecurity;
|
private short mConnectionSecurity;
|
||||||
private String mUsername; /* Stores the username for authentications */
|
private String mUsername; /* Stores the username for authentications */
|
||||||
@ -256,30 +256,30 @@ public class WebDavStore extends Store {
|
|||||||
|
|
||||||
HashMap<String, String> specialFoldersMap = dataset.getSpecialFolderToUrl();
|
HashMap<String, String> specialFoldersMap = dataset.getSpecialFolderToUrl();
|
||||||
String folderName = getFolderName(specialFoldersMap.get(DAV_MAIL_INBOX_FOLDER));
|
String folderName = getFolderName(specialFoldersMap.get(DAV_MAIL_INBOX_FOLDER));
|
||||||
if(folderName != null) {
|
if (folderName != null) {
|
||||||
mAccount.setAutoExpandFolderName(folderName);
|
mAccount.setAutoExpandFolderName(folderName);
|
||||||
mAccount.setInboxFolderName(folderName);
|
mAccount.setInboxFolderName(folderName);
|
||||||
}
|
}
|
||||||
|
|
||||||
folderName = getFolderName(specialFoldersMap.get(DAV_MAIL_DRAFTS_FOLDER));
|
folderName = getFolderName(specialFoldersMap.get(DAV_MAIL_DRAFTS_FOLDER));
|
||||||
if(folderName != null)
|
if (folderName != null)
|
||||||
mAccount.setDraftsFolderName(folderName);
|
mAccount.setDraftsFolderName(folderName);
|
||||||
|
|
||||||
folderName = getFolderName(specialFoldersMap.get(DAV_MAIL_TRASH_FOLDER));
|
folderName = getFolderName(specialFoldersMap.get(DAV_MAIL_TRASH_FOLDER));
|
||||||
if(folderName != null)
|
if (folderName != null)
|
||||||
mAccount.setTrashFolderName(folderName);
|
mAccount.setTrashFolderName(folderName);
|
||||||
|
|
||||||
folderName = getFolderName(specialFoldersMap.get(DAV_MAIL_SPAM_FOLDER));
|
folderName = getFolderName(specialFoldersMap.get(DAV_MAIL_SPAM_FOLDER));
|
||||||
if(folderName != null)
|
if (folderName != null)
|
||||||
mAccount.setSpamFolderName(folderName);
|
mAccount.setSpamFolderName(folderName);
|
||||||
|
|
||||||
folderName = getFolderName(specialFoldersMap.get(DAV_MAIL_OUTBOX_FOLDER));
|
folderName = getFolderName(specialFoldersMap.get(DAV_MAIL_OUTBOX_FOLDER));
|
||||||
if(folderName != null)
|
if (folderName != null)
|
||||||
mAccount.setOutboxFolderName(folderName);
|
mAccount.setOutboxFolderName(folderName);
|
||||||
|
|
||||||
folderName = getFolderName(specialFoldersMap.get(DAV_MAIL_SENT_FOLDER));
|
folderName = getFolderName(specialFoldersMap.get(DAV_MAIL_SENT_FOLDER));
|
||||||
if(folderName != null)
|
if (folderName != null)
|
||||||
mAccount.setSentFolderName(folderName);
|
mAccount.setSentFolderName(folderName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Next we get all the folders (including "special" ones)
|
* Next we get all the folders (including "special" ones)
|
||||||
@ -293,8 +293,8 @@ public class WebDavStore extends Store {
|
|||||||
for (int i = 0; i < folderUrls.length; i++) {
|
for (int i = 0; i < folderUrls.length; i++) {
|
||||||
String tempUrl = folderUrls[i];
|
String tempUrl = folderUrls[i];
|
||||||
WebDavFolder folder = createFolder(tempUrl);
|
WebDavFolder folder = createFolder(tempUrl);
|
||||||
if(folder != null)
|
if (folder != null)
|
||||||
folderList.add(folder);
|
folderList.add(folder);
|
||||||
}
|
}
|
||||||
|
|
||||||
return folderList;
|
return folderList;
|
||||||
@ -308,60 +308,60 @@ public class WebDavStore extends Store {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private WebDavFolder createFolder(String folderUrl) {
|
private WebDavFolder createFolder(String folderUrl) {
|
||||||
if(folderUrl == null)
|
if (folderUrl == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
WebDavFolder wdFolder=null;
|
WebDavFolder wdFolder = null;
|
||||||
String folderName = getFolderName(folderUrl);
|
String folderName = getFolderName(folderUrl);
|
||||||
if(folderName != null) {
|
if (folderName != null) {
|
||||||
if(!this.mFolderList.containsKey(folderName)) {
|
if (!this.mFolderList.containsKey(folderName)) {
|
||||||
wdFolder = new WebDavFolder(this, folderName);
|
wdFolder = new WebDavFolder(this, folderName);
|
||||||
wdFolder.setUrl(folderUrl);
|
wdFolder.setUrl(folderUrl);
|
||||||
mFolderList.put(folderName, wdFolder);
|
mFolderList.put(folderName, wdFolder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// else: Unknown URL format => NO Folder created
|
// else: Unknown URL format => NO Folder created
|
||||||
|
|
||||||
return wdFolder;
|
return wdFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getFolderName(String folderUrl) {
|
private String getFolderName(String folderUrl) {
|
||||||
if(folderUrl == null)
|
if (folderUrl == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
// Here we extract the folder name starting from the complete url.
|
// Here we extract the folder name starting from the complete url.
|
||||||
// folderUrl is in the form http://mail.domain.com/exchange/username/foldername
|
// folderUrl is in the form http://mail.domain.com/exchange/username/foldername
|
||||||
// so we need "foldername" which is the string after the fifth slash
|
// so we need "foldername" which is the string after the fifth slash
|
||||||
int folderSlash=-1;
|
int folderSlash = -1;
|
||||||
for(int j=0; j < 5; j++) {
|
for (int j = 0; j < 5; j++) {
|
||||||
folderSlash=folderUrl.indexOf('/', folderSlash+1);
|
folderSlash = folderUrl.indexOf('/', folderSlash + 1);
|
||||||
if(folderSlash < 0)
|
if (folderSlash < 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(folderSlash > 0) {
|
if (folderSlash > 0) {
|
||||||
String folderName;
|
String folderName;
|
||||||
String fullPathName;
|
String fullPathName;
|
||||||
|
|
||||||
// Removes the final slash if present
|
// Removes the final slash if present
|
||||||
if(folderUrl.charAt(folderUrl.length()-1) == '/')
|
if (folderUrl.charAt(folderUrl.length() - 1) == '/')
|
||||||
fullPathName = folderUrl.substring(folderSlash+1, folderUrl.length()-1);
|
fullPathName = folderUrl.substring(folderSlash + 1, folderUrl.length() - 1);
|
||||||
else
|
else
|
||||||
fullPathName = folderUrl.substring(folderSlash+1);
|
fullPathName = folderUrl.substring(folderSlash + 1);
|
||||||
|
|
||||||
// Decodes the url-encoded folder name (i.e. "My%20folder" => "My Folder"
|
// Decodes the url-encoded folder name (i.e. "My%20folder" => "My Folder"
|
||||||
try {
|
try {
|
||||||
folderName = java.net.URLDecoder.decode(fullPathName, "UTF-8");
|
folderName = java.net.URLDecoder.decode(fullPathName, "UTF-8");
|
||||||
} catch (UnsupportedEncodingException uee) {
|
} catch (UnsupportedEncodingException uee) {
|
||||||
/**
|
/**
|
||||||
* If we don't support UTF-8 there's a problem, don't decode
|
* If we don't support UTF-8 there's a problem, don't decode
|
||||||
* it then
|
* it then
|
||||||
*/
|
*/
|
||||||
folderName = fullPathName;
|
folderName = fullPathName;
|
||||||
}
|
}
|
||||||
|
|
||||||
return folderName;
|
return folderName;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -378,10 +378,10 @@ public class WebDavStore extends Store {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Folder getSendSpoolFolder() throws MessagingException {
|
public Folder getSendSpoolFolder() throws MessagingException {
|
||||||
if (mSendFolder == null)
|
if (mSendFolder == null)
|
||||||
mSendFolder = getFolder(DAV_MAIL_SEND_FOLDER);
|
mSendFolder = getFolder(DAV_MAIL_SEND_FOLDER);
|
||||||
|
|
||||||
return mSendFolder;
|
return mSendFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -394,25 +394,25 @@ public class WebDavStore extends Store {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getSpecialFoldersList() {
|
private String getSpecialFoldersList() {
|
||||||
StringBuffer buffer = new StringBuffer(200);
|
StringBuffer buffer = new StringBuffer(200);
|
||||||
buffer.append("<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>");
|
buffer.append("<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>");
|
||||||
buffer.append("<propfind xmlns=\"DAV:\">");
|
buffer.append("<propfind xmlns=\"DAV:\">");
|
||||||
buffer.append("<prop>");
|
buffer.append("<prop>");
|
||||||
buffer.append("<").append(DAV_MAIL_INBOX_FOLDER).append(" xmlns=\"urn:schemas:httpmail:\"/>");
|
buffer.append("<").append(DAV_MAIL_INBOX_FOLDER).append(" xmlns=\"urn:schemas:httpmail:\"/>");
|
||||||
buffer.append("<").append(DAV_MAIL_DRAFTS_FOLDER).append(" xmlns=\"urn:schemas:httpmail:\"/>");
|
buffer.append("<").append(DAV_MAIL_DRAFTS_FOLDER).append(" xmlns=\"urn:schemas:httpmail:\"/>");
|
||||||
buffer.append("<").append(DAV_MAIL_OUTBOX_FOLDER).append(" xmlns=\"urn:schemas:httpmail:\"/>");
|
buffer.append("<").append(DAV_MAIL_OUTBOX_FOLDER).append(" xmlns=\"urn:schemas:httpmail:\"/>");
|
||||||
buffer.append("<").append(DAV_MAIL_SENT_FOLDER).append(" xmlns=\"urn:schemas:httpmail:\"/>");
|
buffer.append("<").append(DAV_MAIL_SENT_FOLDER).append(" xmlns=\"urn:schemas:httpmail:\"/>");
|
||||||
buffer.append("<").append(DAV_MAIL_TRASH_FOLDER).append(" xmlns=\"urn:schemas:httpmail:\"/>");
|
buffer.append("<").append(DAV_MAIL_TRASH_FOLDER).append(" xmlns=\"urn:schemas:httpmail:\"/>");
|
||||||
// This should always be ##DavMailSubmissionURI## for which we already have a constant
|
// This should always be ##DavMailSubmissionURI## for which we already have a constant
|
||||||
// buffer.append("<sendmsg xmlns=\"urn:schemas:httpmail:\"/>");
|
// buffer.append("<sendmsg xmlns=\"urn:schemas:httpmail:\"/>");
|
||||||
|
|
||||||
buffer.append("<").append(DAV_MAIL_SPAM_FOLDER).append(" xmlns=\"urn:schemas:httpmail:\"/>");
|
buffer.append("<").append(DAV_MAIL_SPAM_FOLDER).append(" xmlns=\"urn:schemas:httpmail:\"/>");
|
||||||
|
|
||||||
buffer.append("</prop>");
|
buffer.append("</prop>");
|
||||||
buffer.append("</propfind>");
|
buffer.append("</propfind>");
|
||||||
return buffer.toString();
|
return buffer.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************
|
/***************************************************************
|
||||||
* WebDAV XML Request body retrieval functions
|
* WebDAV XML Request body retrieval functions
|
||||||
@ -1081,7 +1081,7 @@ public class WebDavStore extends Store {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendMessages(Message[] messages) throws MessagingException {
|
public void sendMessages(Message[] messages) throws MessagingException {
|
||||||
WebDavFolder tmpFolder = (WebDavStore.WebDavFolder) getFolder(mAccount.getDraftsFolderName());
|
WebDavFolder tmpFolder = (WebDavStore.WebDavFolder) getFolder(mAccount.getDraftsFolderName());
|
||||||
try {
|
try {
|
||||||
tmpFolder.open(OpenMode.READ_WRITE);
|
tmpFolder.open(OpenMode.READ_WRITE);
|
||||||
Message[] retMessages = tmpFolder.appendWebDavMessages(messages);
|
Message[] retMessages = tmpFolder.appendWebDavMessages(messages);
|
||||||
@ -2072,17 +2072,17 @@ public class WebDavStore extends Store {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a hashmap of special folder name => special folder url
|
* Returns a hashmap of special folder name => special folder url
|
||||||
*/
|
*/
|
||||||
public HashMap<String, String> getSpecialFolderToUrl() {
|
public HashMap<String, String> getSpecialFolderToUrl() {
|
||||||
// We return the first (and only) map
|
// We return the first (and only) map
|
||||||
for (HashMap<String, String> folderMap : mData.values()) {
|
for (HashMap<String, String> folderMap : mData.values()) {
|
||||||
return folderMap;
|
return folderMap;
|
||||||
}
|
}
|
||||||
return new HashMap<String, String>();
|
return new HashMap<String, String>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a hashmap of Message UID => Message Url
|
* Returns a hashmap of Message UID => Message Url
|
||||||
*/
|
*/
|
||||||
public HashMap<String, String> getUidToUrl() {
|
public HashMap<String, String> getUidToUrl() {
|
||||||
|
Loading…
Reference in New Issue
Block a user