From 7aa4c1308e4e17844d81a85485a0e03d619962b6 Mon Sep 17 00:00:00 2001 From: Philipp Haselwarter Date: Wed, 6 Aug 2014 11:04:07 +0200 Subject: [PATCH] Configure mail notifications by folder class In response to Issue 1794, - add a configuration option in the account preferences to show notifications only for 1st/2nd/etc class folders - add an option in the folder preferences to set the notification class as 1st, 2nd or inherited from the folder's push class The default behaviour remains unchanged. --- res/values/arrays.xml | 30 ++++++ res/values/strings.xml | 14 +++ res/xml/account_settings_preferences.xml | 9 ++ res/xml/folder_settings_preferences.xml | 8 ++ src/com/fsck/k9/Account.java | 17 +++ .../k9/activity/setup/AccountSettings.java | 16 +++ .../k9/activity/setup/FolderSettings.java | 16 +++ .../k9/controller/MessagingController.java | 25 +++++ src/com/fsck/k9/mail/Folder.java | 3 + src/com/fsck/k9/mail/store/LocalStore.java | 100 +++++++++++++++++- .../fsck/k9/preferences/AccountSettings.java | 3 + .../fsck/k9/preferences/FolderSettings.java | 3 + src/com/fsck/k9/preferences/Settings.java | 2 +- 13 files changed, 241 insertions(+), 5 deletions(-) diff --git a/res/values/arrays.xml b/res/values/arrays.xml index 45e0314e1..185dfcdd4 100644 --- a/res/values/arrays.xml +++ b/res/values/arrays.xml @@ -231,6 +231,22 @@ 1000 + + @string/account_settings_folder_notify_new_mail_mode_all + @string/account_settings_folder_notify_new_mail_mode_first_class + @string/account_settings_folder_notify_new_mail_mode_first_and_second_class + @string/account_settings_folder_notify_new_mail_mode_not_second_class + @string/account_settings_folder_notify_new_mail_mode_none + + + + ALL + FIRST_CLASS + FIRST_AND_SECOND_CLASS + NOT_SECOND_CLASS + NONE + + @string/account_settings_folder_target_mode_all @string/account_settings_folder_target_mode_first_class @@ -285,6 +301,20 @@ INHERITED + + @string/folder_settings_folder_notify_mode_normal + @string/folder_settings_folder_notify_mode_first_class + @string/folder_settings_folder_notify_mode_second_class + @string/folder_settings_folder_notify_mode_inherited + + + + NO_CLASS + FIRST_CLASS + SECOND_CLASS + INHERITED + + @string/account_setup_incoming_delete_policy_never_label @string/account_setup_incoming_delete_policy_delete_label diff --git a/res/values/strings.xml b/res/values/strings.xml index 6e509193c..040c1166c 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -504,6 +504,14 @@ Please submit bug reports, contribute new features and ask questions at Default account Send mail from this account by default New mail notifications + + Notifications folders + All + Only 1st Class folders + 1st and 2nd Class folders + All except 2nd Class folders + None + Sync notifications Your email address Notify in status bar when mail arrives @@ -655,6 +663,12 @@ Please submit bug reports, contribute new features and ask questions at 2nd Class Same as sync class + Folder notification class + None + 1st Class + 2nd Class + Same as push class + Incoming server Configure the incoming mail server Outgoing server diff --git a/res/xml/account_settings_preferences.xml b/res/xml/account_settings_preferences.xml index b0f487b1f..9940c3ccf 100644 --- a/res/xml/account_settings_preferences.xml +++ b/res/xml/account_settings_preferences.xml @@ -343,6 +343,15 @@ android:defaultValue="true" android:summary="@string/account_settings_notify_summary" /> + + + + (FolderMode.class, FolderMode.ALL)) + )); s.put("notifySelfNewMail", Settings.versions( new V(1, new BooleanSetting(true)) )); diff --git a/src/com/fsck/k9/preferences/FolderSettings.java b/src/com/fsck/k9/preferences/FolderSettings.java index aae048092..202d5f09d 100644 --- a/src/com/fsck/k9/preferences/FolderSettings.java +++ b/src/com/fsck/k9/preferences/FolderSettings.java @@ -28,6 +28,9 @@ public class FolderSettings { s.put("displayMode", Settings.versions( new V(1, new EnumSetting(FolderClass.class, FolderClass.NO_CLASS)) )); + s.put("notifyMode", Settings.versions( + new V(33, new EnumSetting(FolderClass.class, FolderClass.INHERITED)) + )); s.put("syncMode", Settings.versions( new V(1, new EnumSetting(FolderClass.class, FolderClass.INHERITED)) )); diff --git a/src/com/fsck/k9/preferences/Settings.java b/src/com/fsck/k9/preferences/Settings.java index b4dd8ef41..22ed1cb1f 100644 --- a/src/com/fsck/k9/preferences/Settings.java +++ b/src/com/fsck/k9/preferences/Settings.java @@ -35,7 +35,7 @@ public class Settings { * * @see SettingsExporter */ - public static final int VERSION = 32; + public static final int VERSION = 33; public static Map validate(int version, Map> settings,