From 3ffb5021e1e4e4e5432e8d4a259ad08ad84e51cb Mon Sep 17 00:00:00 2001 From: ashley willis Date: Tue, 15 Nov 2011 00:28:41 -0600 Subject: [PATCH] Option to have confirmation on deleting starred messages. --- res/values/strings.xml | 1 + src/com/fsck/k9/K9.java | 11 +++++++++++ src/com/fsck/k9/activity/MessageView.java | 2 +- src/com/fsck/k9/activity/setup/Prefs.java | 7 +++++-- src/com/fsck/k9/preferences/GlobalSettings.java | 1 + 5 files changed, 19 insertions(+), 3 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 4f024ecae..487745f5b 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -342,6 +342,7 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin Show a dialog whenever you perform selected actions Archive Delete (message view only) + Delete Starred (message view only) Spam Mark all as read Send diff --git a/src/com/fsck/k9/K9.java b/src/com/fsck/k9/K9.java index 6b8212295..6c88024b0 100644 --- a/src/com/fsck/k9/K9.java +++ b/src/com/fsck/k9/K9.java @@ -153,6 +153,7 @@ public class K9 extends Application { private static boolean mAnimations = true; private static boolean mConfirmDelete = false; + private static boolean mConfirmDeleteStarred = false; private static boolean mConfirmSpam = false; private static boolean mConfirmMarkAllAsRead = true; private static boolean mKeyguardPrivacy = false; @@ -443,6 +444,7 @@ public class K9 extends Application { editor.putBoolean("useGalleryBugWorkaround", useGalleryBugWorkaround); editor.putBoolean("confirmDelete", mConfirmDelete); + editor.putBoolean("confirmDeleteStarred", mConfirmDeleteStarred); editor.putBoolean("confirmSpam", mConfirmSpam); editor.putBoolean("confirmMarkAllAsRead", mConfirmMarkAllAsRead); @@ -571,6 +573,7 @@ public class K9 extends Application { useGalleryBugWorkaround = sprefs.getBoolean("useGalleryBugWorkaround", K9.isGalleryBuggy()); mConfirmDelete = sprefs.getBoolean("confirmDelete", false); + mConfirmDeleteStarred = sprefs.getBoolean("confirmDeleteStarred", false); mConfirmSpam = sprefs.getBoolean("confirmSpam", false); mConfirmMarkAllAsRead = sprefs.getBoolean("confirmMarkAllAsRead", true); @@ -951,6 +954,14 @@ public class K9 extends Application { mConfirmDelete = confirm; } + public static boolean confirmDeleteStarred() { + return mConfirmDeleteStarred; + } + + public static void setConfirmDeleteStarred(final boolean confirm) { + mConfirmDeleteStarred = confirm; + } + public static boolean confirmSpam() { return mConfirmSpam; } diff --git a/src/com/fsck/k9/activity/MessageView.java b/src/com/fsck/k9/activity/MessageView.java index f969b9d55..8625d3e00 100644 --- a/src/com/fsck/k9/activity/MessageView.java +++ b/src/com/fsck/k9/activity/MessageView.java @@ -649,7 +649,7 @@ public class MessageView extends K9Activity implements OnClickListener { * Called from UI thread when user select Delete */ private void onDelete() { - if (K9.confirmDelete()) { + if (K9.confirmDelete() || (K9.confirmDeleteStarred() && mMessage.isSet(Flag.FLAGGED))) { showDialog(R.id.dialog_confirm_delete); } else { delete(); diff --git a/src/com/fsck/k9/activity/setup/Prefs.java b/src/com/fsck/k9/activity/setup/Prefs.java index 86baa13fd..38c2d9396 100644 --- a/src/com/fsck/k9/activity/setup/Prefs.java +++ b/src/com/fsck/k9/activity/setup/Prefs.java @@ -193,11 +193,13 @@ public class Prefs extends K9PreferenceActivity { mConfirmActions = (CheckBoxListPreference) findPreference(PREFERENCE_CONFIRM_ACTIONS); mConfirmActions.setItems(new CharSequence[] { getString(R.string.global_settings_confirm_action_delete), + getString(R.string.global_settings_confirm_action_delete_starred), getString(R.string.global_settings_confirm_action_spam), getString(R.string.global_settings_confirm_action_mark_all_as_read) }); mConfirmActions.setCheckedItems(new boolean[] { K9.confirmDelete(), + K9.confirmDeleteStarred(), K9.confirmSpam(), K9.confirmMarkAllAsRead() }); @@ -356,8 +358,9 @@ public class Prefs extends K9PreferenceActivity { K9.setManageBack(mManageBack.isChecked()); K9.setStartIntegratedInbox(!mHideSpecialAccounts.isChecked() && mStartIntegratedInbox.isChecked()); K9.setConfirmDelete(mConfirmActions.getCheckedItems()[0]); - K9.setConfirmSpam(mConfirmActions.getCheckedItems()[1]); - K9.setConfirmMarkAllAsRead(mConfirmActions.getCheckedItems()[2]); + K9.setConfirmDeleteStarred(mConfirmActions.getCheckedItems()[1]); + K9.setConfirmSpam(mConfirmActions.getCheckedItems()[2]); + K9.setConfirmMarkAllAsRead(mConfirmActions.getCheckedItems()[3]); K9.setKeyguardPrivacy(mPrivacyMode.isChecked()); K9.setMeasureAccounts(mMeasureAccounts.isChecked()); K9.setCountSearchMessages(mCountSearch.isChecked()); diff --git a/src/com/fsck/k9/preferences/GlobalSettings.java b/src/com/fsck/k9/preferences/GlobalSettings.java index 746d96dbd..4554890e1 100644 --- a/src/com/fsck/k9/preferences/GlobalSettings.java +++ b/src/com/fsck/k9/preferences/GlobalSettings.java @@ -29,6 +29,7 @@ public class GlobalSettings { s.put("changeRegisteredNameColor", new BooleanSetting(false)); s.put("compactLayouts", new BooleanSetting(false)); s.put("confirmDelete", new BooleanSetting(false)); + s.put("confirmDeleteStarred", new BooleanSetting(false)); // added to version 2 s.put("confirmMarkAllAsRead", new BooleanSetting(false)); s.put("confirmSpam", new BooleanSetting(false)); s.put("countSearchMessages", new BooleanSetting(false));