mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-17 06:55:03 -05:00
Local pop3 folders -- woot! Create folder, move or copy a message anywhere. Deleting folders not implemented yet. Issues 2189 and 2969.
This commit is contained in:
parent
dedecedfe4
commit
d1dc346475
@ -310,8 +310,11 @@ public class ChooseFolder extends K9ListActivity {
|
||||
String toastText = "Creating WebDav Folders not currently implemented.";
|
||||
Toast.makeText(getApplication(), toastText, Toast.LENGTH_LONG).show();
|
||||
} else if (store instanceof Pop3Store) {
|
||||
String toastText = "Creating Local Folders not currently implemented.";
|
||||
boolean result = mAccount.getLocalStore().createFolder(folderName);
|
||||
String toastText = "Creation of folder \"" + folderName +
|
||||
((result) ? "\" succeeded." : "\" failed.");
|
||||
Toast.makeText(getApplication(), toastText, Toast.LENGTH_LONG).show();
|
||||
onRefresh(false);
|
||||
} else {
|
||||
Log.d(K9.LOG_TAG, "Unhandled store type " + store.getClass());
|
||||
}
|
||||
|
@ -499,8 +499,11 @@ public class FolderList extends K9ListActivity {
|
||||
String toastText = "Creating WebDav Folders not currently implemented.";
|
||||
Toast.makeText(getApplication(), toastText, Toast.LENGTH_LONG).show();
|
||||
} else if (store instanceof Pop3Store) {
|
||||
String toastText = "Creating Local Folders not currently implemented.";
|
||||
boolean result = mAccount.getLocalStore().createFolder(folderName);
|
||||
String toastText = "Creation of folder \"" + folderName +
|
||||
((result) ? "\" succeeded." : "\" failed.");
|
||||
Toast.makeText(getApplication(), toastText, Toast.LENGTH_LONG).show();
|
||||
onRefresh(false);
|
||||
} else {
|
||||
Log.d(K9.LOG_TAG, "Unhandled store type " + store.getClass());
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ import com.fsck.k9.mail.store.UnavailableStorageException;
|
||||
import com.fsck.k9.mail.store.LocalStore.LocalFolder;
|
||||
import com.fsck.k9.mail.store.LocalStore.LocalMessage;
|
||||
import com.fsck.k9.mail.store.LocalStore.PendingCommand;
|
||||
|
||||
import com.fsck.k9.mail.store.Pop3Store;
|
||||
|
||||
/**
|
||||
* Starts a long running (application) Thread that will run through commands
|
||||
@ -3168,7 +3168,13 @@ public class MessagingController implements Runnable {
|
||||
|
||||
|
||||
public boolean isMoveCapable(Message message) {
|
||||
return !message.getUid().startsWith(K9.LOCAL_UID_PREFIX);
|
||||
boolean isPop3Store = false;
|
||||
try {
|
||||
isPop3Store = message.getFolder().getAccount().getRemoteStore() instanceof Pop3Store;
|
||||
} catch (com.fsck.k9.mail.MessagingException me) {
|
||||
Log.e(K9.LOG_TAG, "MessagingException trying to get remote store of message: " + me);
|
||||
}
|
||||
return (!message.getUid().startsWith(K9.LOCAL_UID_PREFIX) || isPop3Store);
|
||||
}
|
||||
public boolean isCopyCapable(Message message) {
|
||||
return isMoveCapable(message);
|
||||
@ -3229,6 +3235,7 @@ public class MessagingController implements Runnable {
|
||||
|
||||
private void moveOrCopyMessageSynchronous(final Account account, final String srcFolder, final Message[] inMessages,
|
||||
final String destFolder, final boolean isCopy, MessagingListener listener) {
|
||||
|
||||
try {
|
||||
Store localStore = account.getLocalStore();
|
||||
Store remoteStore = account.getRemoteStore();
|
||||
@ -3245,7 +3252,7 @@ public class MessagingController implements Runnable {
|
||||
List<String> uids = new LinkedList<String>();
|
||||
for (Message message : inMessages) {
|
||||
String uid = message.getUid();
|
||||
if (!uid.startsWith(K9.LOCAL_UID_PREFIX)) {
|
||||
if (!uid.startsWith(K9.LOCAL_UID_PREFIX) || remoteStore instanceof Pop3Store) {
|
||||
uids.add(uid);
|
||||
}
|
||||
}
|
||||
@ -3280,7 +3287,10 @@ public class MessagingController implements Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
queueMoveOrCopy(account, srcFolder, destFolder, isCopy, origUidMap.keySet().toArray(EMPTY_STRING_ARRAY));
|
||||
if (!(remoteStore instanceof Pop3Store)) { // don't sync pop3
|
||||
queueMoveOrCopy(account, srcFolder, destFolder, isCopy,
|
||||
origUidMap.keySet().toArray(EMPTY_STRING_ARRAY));
|
||||
}
|
||||
}
|
||||
|
||||
processPendingCommands(account);
|
||||
|
@ -1045,6 +1045,11 @@ public class LocalStore extends Store implements Serializable {
|
||||
public String type;
|
||||
}
|
||||
|
||||
public boolean createFolder(String name) throws com.fsck.k9.mail.MessagingException {
|
||||
LocalFolder folder = new LocalFolder(name);
|
||||
return folder.create(null);
|
||||
}
|
||||
|
||||
public void createFolders(final List<LocalFolder> foldersToCreate, final int visibleLimit) throws UnavailableStorageException {
|
||||
database.execute(true, new DbCallback<Void>() {
|
||||
@Override
|
||||
|
@ -288,6 +288,17 @@ public class Pop3Store extends Store {
|
||||
folder.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMoveCapable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCopyCapable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
class Pop3Folder extends Folder {
|
||||
private Socket mSocket;
|
||||
private InputStream mIn;
|
||||
|
Loading…
Reference in New Issue
Block a user