diff --git a/res/values/strings.xml b/res/values/strings.xml
index 1cbe065c3..e16ca6622 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -326,7 +326,7 @@ Please submit bug reports, contribute new features and ask questions at
Confirm actions
Show a dialog whenever you perform selected actions
- Delete (in message view)
+ Delete
Delete Starred (in message view)
Spam
Delete (from notification)
diff --git a/src/com/fsck/k9/fragment/MessageListFragment.java b/src/com/fsck/k9/fragment/MessageListFragment.java
index 31365c2b1..4d8ebd41b 100644
--- a/src/com/fsck/k9/fragment/MessageListFragment.java
+++ b/src/com/fsck/k9/fragment/MessageListFragment.java
@@ -85,7 +85,6 @@ import com.fsck.k9.helper.Utility;
import com.fsck.k9.mail.Address;
import com.fsck.k9.mail.Flag;
import com.fsck.k9.mail.Folder;
-
import com.fsck.k9.mail.Message;
import com.fsck.k9.mail.MessagingException;
import com.fsck.k9.mail.store.LocalStore;
@@ -1313,6 +1312,16 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
}
private void onDelete(List messages) {
+ if (K9.confirmDelete()) {
+ // remember the message selection for #onCreateDialog(int)
+ mActiveMessages = messages;
+ showDialog(R.id.dialog_confirm_delete);
+ } else {
+ onDeleteConfirmed(messages);
+ }
+ }
+
+ private void onDeleteConfirmed(List messages) {
if (mThreadedList) {
mController.deleteThreads(messages);
} else {
@@ -1388,6 +1397,21 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
confirmText, cancelText);
break;
}
+ case R.id.dialog_confirm_delete: {
+ String title = getString(R.string.dialog_confirm_delete_title);
+
+ int selectionSize = mActiveMessages.size();
+ String message = getResources().getQuantityString(
+ R.plurals.dialog_confirm_delete_messages, selectionSize,
+ Integer.valueOf(selectionSize));
+
+ String confirmText = getString(R.string.dialog_confirm_delete_confirm_button);
+ String cancelText = getString(R.string.dialog_confirm_delete_cancel_button);
+
+ fragment = ConfirmationDialogFragment.newInstance(dialogId, title, message,
+ confirmText, cancelText);
+ break;
+ }
default: {
throw new RuntimeException("Called showDialog(int) with unknown dialog id.");
}
@@ -2902,13 +2926,19 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
mActiveMessages = null;
break;
}
+ case R.id.dialog_confirm_delete: {
+ onDeleteConfirmed(mActiveMessages);
+ mActiveMessage = null;
+ break;
+ }
}
}
@Override
public void doNegativeClick(int dialogId) {
switch (dialogId) {
- case R.id.dialog_confirm_spam: {
+ case R.id.dialog_confirm_spam:
+ case R.id.dialog_confirm_delete: {
// No further need for this reference
mActiveMessages = null;
break;