Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added a setting to disable marking messages as read on viewing

  • Loading branch information...
commit 1d28eb003df376a9ba186fece011d499ef1da96a 1 parent 5245191
@cketti cketti authored
View
2  res/values/strings.xml
@@ -549,6 +549,8 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
<string name="account_settings_notification_opens_unread_summary">Searches for unread messages when Notification is opened</string>
<string name="account_settings_notification_unread_count_label">Show unread count</string>
<string name="account_settings_notification_unread_count_summary">Show the number of unread messages in the notification bar.</string>
+ <string name="account_settings_mark_message_as_read_on_view_label">Mark message as read when opening</string>
+ <string name="account_settings_mark_message_as_read_on_view_summary">Mark a message as read when it is opened for viewing</string>
<string name="account_settings_enable_move_buttons_label">Enable refile buttons</string>
<string name="account_settings_enable_move_buttons_summary">Show the Archive, Move, and Spam buttons.</string>
View
11 res/xml/account_settings_preferences.xml
@@ -82,6 +82,17 @@
</PreferenceScreen>
<PreferenceScreen
+ android:title="@string/interaction_preferences">
+
+ <CheckBoxPreference
+ android:persistent="false"
+ android:key="mark_message_as_read_on_view"
+ android:title="@string/account_settings_mark_message_as_read_on_view_label"
+ android:summary="@string/account_settings_mark_message_as_read_on_view_summary" />
+
+ </PreferenceScreen>
+
+ <PreferenceScreen
android:title="@string/account_settings_sync"
android:key="incoming_prefs">
View
13 src/com/fsck/k9/Account.java
@@ -149,6 +149,7 @@
private String mCryptoApp;
private boolean mCryptoAutoSignature;
private boolean mCryptoAutoEncrypt;
+ private boolean mMarkMessageAsReadOnView;
private CryptoProvider mCryptoProvider = null;
@@ -236,6 +237,7 @@ protected Account(Context context) {
mCryptoAutoSignature = false;
mCryptoAutoEncrypt = false;
mEnabled = true;
+ mMarkMessageAsReadOnView = true;
searchableFolders = Searchable.ALL;
@@ -391,6 +393,7 @@ private synchronized void loadAccount(Preferences preferences) {
mCryptoAutoSignature = prefs.getBoolean(mUuid + ".cryptoAutoSignature", false);
mCryptoAutoEncrypt = prefs.getBoolean(mUuid + ".cryptoAutoEncrypt", false);
mEnabled = prefs.getBoolean(mUuid + ".enabled", true);
+ mMarkMessageAsReadOnView = prefs.getBoolean(mUuid + ".markMessageAsReadOnView", true);
}
protected synchronized void delete(Preferences preferences) {
@@ -472,6 +475,7 @@ protected synchronized void delete(Preferences preferences) {
editor.remove(mUuid + ".enabled");
editor.remove(mUuid + ".enableMoveButtons");
editor.remove(mUuid + ".hideMoveButtonsEnum");
+ editor.remove(mUuid + ".markMessageAsReadOnView");
for (String type : networkTypes) {
editor.remove(mUuid + ".useCompression." + type);
}
@@ -632,6 +636,7 @@ public synchronized void save(Preferences preferences) {
editor.putBoolean(mUuid + ".cryptoAutoSignature", mCryptoAutoSignature);
editor.putBoolean(mUuid + ".cryptoAutoEncrypt", mCryptoAutoEncrypt);
editor.putBoolean(mUuid + ".enabled", mEnabled);
+ editor.putBoolean(mUuid + ".markMessageAsReadOnView", mMarkMessageAsReadOnView);
editor.putBoolean(mUuid + ".vibrate", mNotificationSetting.shouldVibrate());
editor.putInt(mUuid + ".vibratePattern", mNotificationSetting.getVibratePattern());
@@ -1500,4 +1505,12 @@ public synchronized boolean isEnabled() {
public synchronized void setEnabled(boolean enabled) {
mEnabled = enabled;
}
+
+ public synchronized boolean isMarkMessageAsReadOnView() {
+ return mMarkMessageAsReadOnView;
+ }
+
+ public synchronized void setMarkMessageAsReadOnView(boolean value) {
+ mMarkMessageAsReadOnView = value;
+ }
}
View
13 src/com/fsck/k9/activity/MessageView.java
@@ -756,17 +756,16 @@ protected void onPrevious() {
mPrevious.requestFocus();
}
- private void onMarkAsUnread() {
+ private void onToggleRead() {
if (mMessage != null) {
mController.setFlag(mAccount, mMessage.getFolder().getName(),
- new Message[] { mMessage }, Flag.SEEN, false);
+ new Message[] { mMessage }, Flag.SEEN, !mMessage.isSet(Flag.SEEN));
mMessageView.setHeaders(mMessage, mAccount);
String subject = mMessage.getSubject();
setTitle(subject);
}
}
-
private void onDownloadRemainder() {
if (mMessage.isSet(Flag.X_DOWNLOADED_FULL)) {
return;
@@ -833,7 +832,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
onSendAlternate();
break;
case R.id.mark_as_unread:
- onMarkAsUnread();
+ onToggleRead();
break;
case R.id.flag:
onFlag();
@@ -944,6 +943,12 @@ public boolean onPrepareOptionsMenu(Menu menu) {
additionalHeadersItem.setTitle(mMessageView.additionalHeadersVisible() ?
R.string.hide_full_header_action : R.string.show_full_header_action);
}
+
+ if (mMessage != null) {
+ int actionTitle = mMessage.isSet(Flag.SEEN) ?
+ R.string.mark_as_unread_action : R.string.mark_as_read_action;
+ menu.findItem(R.id.mark_as_unread).setTitle(actionTitle);
+ }
}
return super.onPrepareOptionsMenu(menu);
}
View
11 src/com/fsck/k9/activity/setup/AccountSettings.java
@@ -48,6 +48,7 @@
private static final String PREFERENCE_SCREEN_PUSH_ADVANCED = "push_advanced";
private static final String PREFERENCE_DESCRIPTION = "account_description";
+ private static final String PREFERENCE_MARK_MESSAGE_AS_READ_ON_VIEW = "mark_message_as_read_on_view";
private static final String PREFERENCE_COMPOSITION = "composition";
private static final String PREFERENCE_MANAGE_IDENTITIES = "manage_identities";
private static final String PREFERENCE_FREQUENCY = "account_check_frequency";
@@ -94,9 +95,7 @@
private static final String PREFERENCE_CRYPTO_APP = "crypto_app";
private static final String PREFERENCE_CRYPTO_AUTO_SIGNATURE = "crypto_auto_signature";
private static final String PREFERENCE_CRYPTO_AUTO_ENCRYPT = "crypto_auto_encrypt";
-
private static final String PREFERENCE_LOCAL_STORAGE_PROVIDER = "local_storage_provider";
-
private static final String PREFERENCE_CATEGORY_FOLDERS = "folders";
private static final String PREFERENCE_ARCHIVE_FOLDER = "archive_folder";
private static final String PREFERENCE_DRAFTS_FOLDER = "drafts_folder";
@@ -114,6 +113,7 @@
private PreferenceScreen mComposingScreen;
private EditTextPreference mAccountDescription;
+ private CheckBoxPreference mMarkMessageAsReadOnView;
private ListPreference mCheckFrequency;
private ListPreference mDisplayCount;
private ListPreference mMessageAge;
@@ -157,10 +157,7 @@
private ListPreference mCryptoApp;
private CheckBoxPreference mCryptoAutoSignature;
private CheckBoxPreference mCryptoAutoEncrypt;
-
private ListPreference mLocalStorageProvider;
-
-
private ListPreference mArchiveFolder;
private ListPreference mDraftsFolder;
private ListPreference mSentFolder;
@@ -204,6 +201,9 @@ public boolean onPreferenceChange(Preference preference, Object newValue) {
}
});
+ mMarkMessageAsReadOnView = (CheckBoxPreference) findPreference(PREFERENCE_MARK_MESSAGE_AS_READ_ON_VIEW);
+ mMarkMessageAsReadOnView.setChecked(mAccount.isMarkMessageAsReadOnView());
+
mMessageFormat = (ListPreference) findPreference(PREFERENCE_MESSAGE_FORMAT);
mMessageFormat.setValue(mAccount.getMessageFormat().name());
mMessageFormat.setSummary(mMessageFormat.getEntry());
@@ -672,6 +672,7 @@ private void saveSettings() {
}
mAccount.setDescription(mAccountDescription.getText());
+ mAccount.setMarkMessageAsReadOnView(mMarkMessageAsReadOnView.isChecked());
mAccount.setNotifyNewMail(mAccountNotify.isChecked());
mAccount.setNotifySelfNewMail(mAccountNotifySelf.isChecked());
mAccount.setShowOngoing(mAccountNotifySync.isChecked());
View
2  src/com/fsck/k9/controller/MessagingController.java
@@ -2846,7 +2846,7 @@ public void run() {
|| message.getId() == 0) {
throw new IllegalArgumentException("Message not found: folder=" + folder + ", uid=" + uid);
}
- if (!message.isSet(Flag.SEEN)) {
+ if (account.isMarkMessageAsReadOnView() && !message.isSet(Flag.SEEN)) {
message.setFlag(Flag.SEEN, true);
setFlag(new Message[] { message }, Flag.SEEN, true);
}
View
3  src/com/fsck/k9/preferences/AccountSettings.java
@@ -96,6 +96,9 @@
s.put("localStorageProvider", Settings.versions(
new V(1, new StorageProviderSetting())
));
+ s.put("markMessageAsReadOnView", Settings.versions(
+ new V(7, new BooleanSetting(true))
+ ));
s.put("maxPushFolders", Settings.versions(
new V(1, new IntegerRangeSetting(0, 100, 10))
));
View
2  src/com/fsck/k9/preferences/Settings.java
@@ -35,7 +35,7 @@
*
* @see SettingsExporter
*/
- public static final int VERSION = 6;
+ public static final int VERSION = 7;
public static Map<String, Object> validate(int version, Map<String,
TreeMap<Integer, SettingsDescription>> settings,
Please sign in to comment.
Something went wrong with that request. Please try again.