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

Copy/move all messages in a thread when copying/moving placeholder

This commit is contained in:
cketti 2012-11-03 08:30:32 +01:00
parent dfbfaf48dd
commit d530b20e2b
2 changed files with 48 additions and 2 deletions

View File

@ -3442,6 +3442,27 @@ public class MessagingController implements Runnable {
}); });
} }
public void moveMessagesInThread(final Account account, final String srcFolder,
final List<Message> messages, final String destFolder) {
for (Message message : messages) {
suppressMessage(account, srcFolder, message);
}
putBackground("moveMessagesInThread", null, new Runnable() {
@Override
public void run() {
try {
List<Message> messagesInThreads = collectMessagesInThreads(account, messages);
moveOrCopyMessageSynchronous(account, srcFolder, messagesInThreads, destFolder,
false, null);
} catch (MessagingException e) {
addErrorMessage(account, "Exception while moving messages", e);
}
}
});
}
public void moveMessage(final Account account, final String srcFolder, final Message message, public void moveMessage(final Account account, final String srcFolder, final Message message,
final String destFolder, final MessagingListener listener) { final String destFolder, final MessagingListener listener) {
@ -3461,6 +3482,23 @@ public class MessagingController implements Runnable {
}); });
} }
public void copyMessagesInThread(final Account account, final String srcFolder,
final List<Message> messages, final String destFolder) {
putBackground("copyMessagesInThread", null, new Runnable() {
@Override
public void run() {
try {
List<Message> messagesInThreads = collectMessagesInThreads(account, messages);
moveOrCopyMessageSynchronous(account, srcFolder, messagesInThreads, destFolder,
true, null);
} catch (MessagingException e) {
addErrorMessage(account, "Exception while copying messages", e);
}
}
});
}
public void copyMessage(final Account account, final String srcFolder, final Message message, public void copyMessage(final Account account, final String srcFolder, final Message message,
final String destFolder, final MessagingListener listener) { final String destFolder, final MessagingListener listener) {

View File

@ -2217,9 +2217,17 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
} }
if (operation == FolderOperation.MOVE) { if (operation == FolderOperation.MOVE) {
mController.moveMessages(account, folderName, outMessages, destination, null); if (mThreadedList) {
mController.moveMessagesInThread(account, folderName, outMessages, destination);
} else {
mController.moveMessages(account, folderName, outMessages, destination, null);
}
} else { } else {
mController.copyMessages(account, folderName, outMessages, destination, null); if (mThreadedList) {
mController.copyMessagesInThread(account, folderName, outMessages, destination);
} else {
mController.copyMessages(account, folderName, outMessages, destination, null);
}
} }
} }