1
0
mirror of https://github.com/moparisthebest/k-9 synced 2025-01-08 20:28:34 -05:00

added javadoc to build.xml. minor refactoring and reorganization of folder deletion and creation.

This commit is contained in:
ashley willis 2012-01-27 18:38:29 -06:00
parent a9ccad8d9f
commit 83cb0e892d
7 changed files with 35 additions and 25 deletions

View File

@ -203,7 +203,11 @@
<echo> astyle: Make K-9's source look like it's supposed to</echo>
<echo> eclipse: Apply template Eclipse settings</echo>
</target>
<target name="javadoc" description="Build Javadoc from Java source files">
<javadoc destdir="javadoc/" access="private">
<fileset includes="**/*.java" dir="src"/>
</javadoc>
</target>
<target name="eclipse" description="Apply template Eclipse settings">
<copy todir=".settings">
<fileset dir="tools/eclipse-settings"/>

View File

@ -820,9 +820,9 @@ public class FolderList extends K9ListActivity {
try {
Store store = mAccount.getRemoteStore();
if (store instanceof ImapStore) {
boolean result = ((ImapStore)store).deleteFolder(folder.name);
boolean result = ((ImapStore)store).delete(folder.name);
if (result) {
mAccount.getLocalStore().deleteFolder(folder.folder);
mAccount.getLocalStore().delete(folder.name);
if (mAccount.isSpecialFolder(folder.name)) {
resetSpecialFolders(folder.name, K9.FOLDER_NONE);
}
@ -835,7 +835,7 @@ public class FolderList extends K9ListActivity {
String toastText = "Deleting WebDav Folders not currently implemented.";
Toast.makeText(getApplication(), toastText, Toast.LENGTH_LONG).show();
} else if (store instanceof Pop3Store) {
boolean result = mAccount.getLocalStore().deleteFolder(folder.folder);
boolean result = mAccount.getLocalStore().delete(folder.name);
if (result && mAccount.isSpecialFolder(folder.name)) {
resetSpecialFolders(folder.name, K9.FOLDER_NONE);
}

View File

@ -133,7 +133,7 @@ public abstract class Folder {
Log.d(K9.LOG_TAG, "fetchPart() not implemented.");
}
public abstract void delete(boolean recurse) throws MessagingException;
public abstract boolean delete(boolean recurse) throws MessagingException;
public abstract String getName();

View File

@ -788,23 +788,29 @@ public class ImapStore extends Store {
}
public boolean createFolder(final String folderName) throws com.fsck.k9.mail.MessagingException {
ImapFolder folder = new ImapFolder(this, folderName);
//ImapFolder folder = new ImapFolder(this, folderName);
ImapFolder folder = (ImapFolder)getFolder(folderName);
return folder.create();
}
public boolean renameFolder(final String oldFolderName, final String newFolderName)
throws com.fsck.k9.mail.MessagingException {
ImapFolder oldFolder = new ImapFolder(this, oldFolderName);
ImapFolder newFolder = new ImapFolder(this, newFolderName);
//ImapFolder oldFolder = new ImapFolder(this, oldFolderName);
ImapFolder oldFolder = (ImapFolder)getFolder(oldFolderName);
//ImapFolder newFolder = new ImapFolder(this, newFolderName);
ImapFolder newFolder = (ImapFolder)getFolder(newFolderName);
if (oldFolder.exists() && !newFolder.exists()) {
mFolderCache.remove(oldFolderName);
return oldFolder.rename(newFolderName);
}
return false;
}
public boolean deleteFolder(final String folderName) throws com.fsck.k9.mail.MessagingException {
ImapFolder folder = new ImapFolder(this, folderName);
return ((ImapFolder)folder).deleteFolder();
public boolean delete(final String folderName) throws com.fsck.k9.mail.MessagingException {
//ImapFolder folder = new ImapFolder(this, folderName);
ImapFolder folder = (ImapFolder)getFolder(folderName);
mFolderCache.remove(folderName);
return folder.delete(false);
}
@Override
@ -1112,7 +1118,8 @@ public class ImapStore extends Store {
}
}
public boolean deleteFolder() throws MessagingException {
@Override
public boolean delete(boolean recurse) throws MessagingException {
/*
* This method needs to operate in the unselected mode as well as the selected mode
* so we must get the connection ourselves if it's not there. We are specifically
@ -1278,11 +1285,6 @@ public class ImapStore extends Store {
}
@Override
public void delete(boolean recurse) throws MessagingException {
throw new Error("ImapStore.delete() not yet implemented");
}
@Override
public Message getMessage(String uid) throws MessagingException {
return new ImapMessage(uid, this);

View File

@ -1107,11 +1107,13 @@ Log.d("ASH", "updatedb " + mAccount.getDescription());
return false;
}
public boolean deleteFolder(Folder folder) throws com.fsck.k9.mail.MessagingException {
if (folder instanceof LocalFolder) { // ASH do i need instanceof?
((LocalFolder)folder).delete(false); // delete the folder
((LocalFolder)folder).delete(); // delete its preferences
return !folder.exists();
public boolean delete(final String folderName) throws com.fsck.k9.mail.MessagingException {
LocalFolder folder = new LocalFolder(folderName);
if (folder.exists()) {
if (folder.delete(false)) { // deletes folder
folder.delete(); // deletes folder preferences
return true;
}
}
return false;
}
@ -2745,7 +2747,7 @@ Log.d("ASH", "setting folder " + mName + " to localOnly = " + localOnly);
@Override
public void delete(final boolean recurse) throws MessagingException {
public boolean delete(final boolean recurse) throws MessagingException {
try {
database.execute(false, new DbCallback<Void>() {
@Override
@ -2765,6 +2767,7 @@ Log.d("ASH", "setting folder " + mName + " to localOnly = " + localOnly);
return null;
}
});
return true;
} catch (WrappedException e) {
throw(MessagingException) e.getCause();
}

View File

@ -893,7 +893,8 @@ public class Pop3Store extends Store {
}
@Override
public void delete(boolean recurse) throws MessagingException {
public boolean delete(boolean recurse) throws MessagingException {
throw new Error("Pop3Folder.delete(boolean recurse): Sole POP3 folder is not deletable");
}
@Override

View File

@ -1456,7 +1456,7 @@ public class WebDavStore extends Store {
}
@Override
public void delete(boolean recursive) throws MessagingException {
public boolean delete(boolean recursive) throws MessagingException {
throw new Error("WebDavFolder.delete() not implemeneted");
}