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

Option to have confirmation on deleting starred messages.

This commit is contained in:
ashley willis 2011-11-15 00:28:41 -06:00
parent ab46209b53
commit 3ffb5021e1
5 changed files with 19 additions and 3 deletions

View File

@ -342,6 +342,7 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
<string name="global_settings_confirm_actions_summary">Show a dialog whenever you perform selected actions</string> <string name="global_settings_confirm_actions_summary">Show a dialog whenever you perform selected actions</string>
<string name="global_settings_confirm_action_archive">Archive</string> <string name="global_settings_confirm_action_archive">Archive</string>
<string name="global_settings_confirm_action_delete">Delete (message view only)</string> <string name="global_settings_confirm_action_delete">Delete (message view only)</string>
<string name="global_settings_confirm_action_delete_starred">Delete Starred (message view only)</string>
<string name="global_settings_confirm_action_spam">Spam</string> <string name="global_settings_confirm_action_spam">Spam</string>
<string name="global_settings_confirm_action_mark_all_as_read">Mark all as read</string> <string name="global_settings_confirm_action_mark_all_as_read">Mark all as read</string>
<string name="global_settings_confirm_action_send">Send</string> <string name="global_settings_confirm_action_send">Send</string>

View File

@ -153,6 +153,7 @@ public class K9 extends Application {
private static boolean mAnimations = true; private static boolean mAnimations = true;
private static boolean mConfirmDelete = false; private static boolean mConfirmDelete = false;
private static boolean mConfirmDeleteStarred = false;
private static boolean mConfirmSpam = false; private static boolean mConfirmSpam = false;
private static boolean mConfirmMarkAllAsRead = true; private static boolean mConfirmMarkAllAsRead = true;
private static boolean mKeyguardPrivacy = false; private static boolean mKeyguardPrivacy = false;
@ -443,6 +444,7 @@ public class K9 extends Application {
editor.putBoolean("useGalleryBugWorkaround", useGalleryBugWorkaround); editor.putBoolean("useGalleryBugWorkaround", useGalleryBugWorkaround);
editor.putBoolean("confirmDelete", mConfirmDelete); editor.putBoolean("confirmDelete", mConfirmDelete);
editor.putBoolean("confirmDeleteStarred", mConfirmDeleteStarred);
editor.putBoolean("confirmSpam", mConfirmSpam); editor.putBoolean("confirmSpam", mConfirmSpam);
editor.putBoolean("confirmMarkAllAsRead", mConfirmMarkAllAsRead); editor.putBoolean("confirmMarkAllAsRead", mConfirmMarkAllAsRead);
@ -571,6 +573,7 @@ public class K9 extends Application {
useGalleryBugWorkaround = sprefs.getBoolean("useGalleryBugWorkaround", K9.isGalleryBuggy()); useGalleryBugWorkaround = sprefs.getBoolean("useGalleryBugWorkaround", K9.isGalleryBuggy());
mConfirmDelete = sprefs.getBoolean("confirmDelete", false); mConfirmDelete = sprefs.getBoolean("confirmDelete", false);
mConfirmDeleteStarred = sprefs.getBoolean("confirmDeleteStarred", false);
mConfirmSpam = sprefs.getBoolean("confirmSpam", false); mConfirmSpam = sprefs.getBoolean("confirmSpam", false);
mConfirmMarkAllAsRead = sprefs.getBoolean("confirmMarkAllAsRead", true); mConfirmMarkAllAsRead = sprefs.getBoolean("confirmMarkAllAsRead", true);
@ -951,6 +954,14 @@ public class K9 extends Application {
mConfirmDelete = confirm; mConfirmDelete = confirm;
} }
public static boolean confirmDeleteStarred() {
return mConfirmDeleteStarred;
}
public static void setConfirmDeleteStarred(final boolean confirm) {
mConfirmDeleteStarred = confirm;
}
public static boolean confirmSpam() { public static boolean confirmSpam() {
return mConfirmSpam; return mConfirmSpam;
} }

View File

@ -649,7 +649,7 @@ public class MessageView extends K9Activity implements OnClickListener {
* Called from UI thread when user select Delete * Called from UI thread when user select Delete
*/ */
private void onDelete() { private void onDelete() {
if (K9.confirmDelete()) { if (K9.confirmDelete() || (K9.confirmDeleteStarred() && mMessage.isSet(Flag.FLAGGED))) {
showDialog(R.id.dialog_confirm_delete); showDialog(R.id.dialog_confirm_delete);
} else { } else {
delete(); delete();

View File

@ -193,11 +193,13 @@ public class Prefs extends K9PreferenceActivity {
mConfirmActions = (CheckBoxListPreference) findPreference(PREFERENCE_CONFIRM_ACTIONS); mConfirmActions = (CheckBoxListPreference) findPreference(PREFERENCE_CONFIRM_ACTIONS);
mConfirmActions.setItems(new CharSequence[] { mConfirmActions.setItems(new CharSequence[] {
getString(R.string.global_settings_confirm_action_delete), 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_spam),
getString(R.string.global_settings_confirm_action_mark_all_as_read) getString(R.string.global_settings_confirm_action_mark_all_as_read)
}); });
mConfirmActions.setCheckedItems(new boolean[] { mConfirmActions.setCheckedItems(new boolean[] {
K9.confirmDelete(), K9.confirmDelete(),
K9.confirmDeleteStarred(),
K9.confirmSpam(), K9.confirmSpam(),
K9.confirmMarkAllAsRead() K9.confirmMarkAllAsRead()
}); });
@ -356,8 +358,9 @@ public class Prefs extends K9PreferenceActivity {
K9.setManageBack(mManageBack.isChecked()); K9.setManageBack(mManageBack.isChecked());
K9.setStartIntegratedInbox(!mHideSpecialAccounts.isChecked() && mStartIntegratedInbox.isChecked()); K9.setStartIntegratedInbox(!mHideSpecialAccounts.isChecked() && mStartIntegratedInbox.isChecked());
K9.setConfirmDelete(mConfirmActions.getCheckedItems()[0]); K9.setConfirmDelete(mConfirmActions.getCheckedItems()[0]);
K9.setConfirmSpam(mConfirmActions.getCheckedItems()[1]); K9.setConfirmDeleteStarred(mConfirmActions.getCheckedItems()[1]);
K9.setConfirmMarkAllAsRead(mConfirmActions.getCheckedItems()[2]); K9.setConfirmSpam(mConfirmActions.getCheckedItems()[2]);
K9.setConfirmMarkAllAsRead(mConfirmActions.getCheckedItems()[3]);
K9.setKeyguardPrivacy(mPrivacyMode.isChecked()); K9.setKeyguardPrivacy(mPrivacyMode.isChecked());
K9.setMeasureAccounts(mMeasureAccounts.isChecked()); K9.setMeasureAccounts(mMeasureAccounts.isChecked());
K9.setCountSearchMessages(mCountSearch.isChecked()); K9.setCountSearchMessages(mCountSearch.isChecked());

View File

@ -29,6 +29,7 @@ public class GlobalSettings {
s.put("changeRegisteredNameColor", new BooleanSetting(false)); s.put("changeRegisteredNameColor", new BooleanSetting(false));
s.put("compactLayouts", new BooleanSetting(false)); s.put("compactLayouts", new BooleanSetting(false));
s.put("confirmDelete", 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("confirmMarkAllAsRead", new BooleanSetting(false));
s.put("confirmSpam", new BooleanSetting(false)); s.put("confirmSpam", new BooleanSetting(false));
s.put("countSearchMessages", new BooleanSetting(false)); s.put("countSearchMessages", new BooleanSetting(false));