mirror of
https://github.com/moparisthebest/k-9
synced 2025-01-12 06:08:25 -05:00
Clean up method copyOrMove()
This commit is contained in:
parent
2cfd25fa23
commit
dfbfaf48dd
@ -2167,7 +2167,9 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
|||||||
* @param operation
|
* @param operation
|
||||||
* Specifies what operation to perform. Never {@code null}.
|
* Specifies what operation to perform. Never {@code null}.
|
||||||
*/
|
*/
|
||||||
private void copyOrMove(List<Message> messages, final String destination, final FolderOperation operation) {
|
private void copyOrMove(List<Message> messages, final String destination,
|
||||||
|
final FolderOperation operation) {
|
||||||
|
|
||||||
if (K9.FOLDER_NONE.equalsIgnoreCase(destination)) {
|
if (K9.FOLDER_NONE.equalsIgnoreCase(destination)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2181,27 +2183,36 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
|||||||
for (Message message : messages) {
|
for (Message message : messages) {
|
||||||
if (first) {
|
if (first) {
|
||||||
first = false;
|
first = false;
|
||||||
|
|
||||||
folderName = message.getFolder().getName();
|
folderName = message.getFolder().getName();
|
||||||
account = message.getFolder().getAccount();
|
account = message.getFolder().getAccount();
|
||||||
if ((operation == FolderOperation.MOVE && !mController.isMoveCapable(account)) || (operation == FolderOperation.COPY && !mController.isCopyCapable(account))) {
|
|
||||||
// account is not copy/move capable
|
if ((operation == FolderOperation.MOVE && !mController.isMoveCapable(account)) ||
|
||||||
|
(operation == FolderOperation.COPY &&
|
||||||
|
!mController.isCopyCapable(account))) {
|
||||||
|
|
||||||
|
// Account is not copy/move capable
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (!account.equals(message.getFolder().getAccount())
|
} else if (!message.getFolder().getAccount().equals(account) ||
|
||||||
|| !folderName.equals(message.getFolder().getName())) {
|
!message.getFolder().getName().equals(folderName)) {
|
||||||
// make sure all messages come from the same account/folder?
|
|
||||||
|
// Make sure all messages come from the same account/folder
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((operation == FolderOperation.MOVE && !mController.isMoveCapable(message)) || (operation == FolderOperation.COPY && !mController.isCopyCapable(message))) {
|
|
||||||
final Toast toast = Toast.makeText(getActivity(), R.string.move_copy_cannot_copy_unsynced_message,
|
if ((operation == FolderOperation.MOVE && !mController.isMoveCapable(message)) ||
|
||||||
Toast.LENGTH_LONG);
|
(operation == FolderOperation.COPY && !mController.isCopyCapable(message))) {
|
||||||
toast.show();
|
|
||||||
|
Toast.makeText(getActivity(), R.string.move_copy_cannot_copy_unsynced_message,
|
||||||
|
Toast.LENGTH_LONG).show();
|
||||||
|
|
||||||
// XXX return meaningful error value?
|
// XXX return meaningful error value?
|
||||||
|
|
||||||
// message isn't synchronized
|
// message isn't synchronized
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
outMessages.add(message);
|
outMessages.add(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user