Merge pull request #1062 from deltachat/add-bcc-self-switch

add a switch to set the bcc_self option
This commit is contained in:
björn petersen
2019-10-11 17:57:37 +02:00
committed by GitHub
4 changed files with 17 additions and 0 deletions
+1
View File
@@ -441,6 +441,7 @@
<string name="pref_watch_inbox_folder">Watch Inbox folder</string>
<string name="pref_watch_sent_folder">Watch Sent folder</string>
<string name="pref_watch_mvbox_folder">Watch DeltaChat folder</string>
<string name="pref_send_copy_to_self">Send copy to self</string>
<string name="pref_auto_folder_moves">Automatic moves to DeltaChat folder</string>
<string name="pref_auto_folder_moves_explain">Chat conversations are moved to avoid cluttering the Inbox folder</string>
<string name="pref_email_interaction_title">Email interaction</string>
+5
View File
@@ -32,6 +32,11 @@
android:key="pref_mvbox_watch"
android:title="@string/pref_watch_mvbox_folder"/>
<org.thoughtcrime.securesms.components.SwitchPreferenceCompat
android:defaultValue="true"
android:key="pref_bcc_self"
android:title="@string/pref_send_copy_to_self"/>
<org.thoughtcrime.securesms.components.SwitchPreferenceCompat
android:defaultValue="true"
android:key="pref_mvbox_move"
@@ -27,6 +27,7 @@ public class DcHelper {
public static final String CONFIG_SENTBOX_WATCH = "sentbox_watch";
public static final String CONFIG_MVBOX_WATCH = "mvbox_watch";
public static final String CONFIG_MVBOX_MOVE = "mvbox_move";
public static final String CONFIG_BCC_SELF = "bcc_self";
public static final String CONFIG_SHOW_EMAILS = "show_emails";
public static ApplicationDcContext getContext(Context context) {
@@ -28,6 +28,7 @@ import org.thoughtcrime.securesms.util.Util;
import org.thoughtcrime.securesms.util.views.ProgressDialog;
import static android.app.Activity.RESULT_OK;
import static org.thoughtcrime.securesms.connect.DcHelper.CONFIG_BCC_SELF;
import static org.thoughtcrime.securesms.connect.DcHelper.CONFIG_E2EE_ENABLED;
import static org.thoughtcrime.securesms.connect.DcHelper.CONFIG_INBOX_WATCH;
import static org.thoughtcrime.securesms.connect.DcHelper.CONFIG_MVBOX_MOVE;
@@ -47,6 +48,7 @@ public class AdvancedPreferenceFragment extends ListSummaryPreferenceFragment
CheckBoxPreference inboxWatchCheckbox;
CheckBoxPreference sentboxWatchCheckbox;
CheckBoxPreference mvboxWatchCheckbox;
CheckBoxPreference bccSelfCheckbox;
CheckBoxPreference mvboxMoveCheckbox;
@Override
@@ -74,6 +76,13 @@ public class AdvancedPreferenceFragment extends ListSummaryPreferenceFragment
handleImapCheck(preference, newValue, CONFIG_MVBOX_WATCH)
);
bccSelfCheckbox = (CheckBoxPreference) this.findPreference("pref_bcc_self");
bccSelfCheckbox.setOnPreferenceChangeListener((preference, newValue) -> {
boolean enabled = (Boolean) newValue;
dcContext.setConfigInt(CONFIG_BCC_SELF, enabled? 1 : 0);
return true;
});
mvboxMoveCheckbox = (CheckBoxPreference) this.findPreference("pref_mvbox_move");
mvboxMoveCheckbox.setOnPreferenceChangeListener((preference, newValue) -> {
boolean enabled = (Boolean) newValue;
@@ -127,6 +136,7 @@ public class AdvancedPreferenceFragment extends ListSummaryPreferenceFragment
inboxWatchCheckbox.setChecked(0!=dcContext.getConfigInt(CONFIG_INBOX_WATCH));
sentboxWatchCheckbox.setChecked(0!=dcContext.getConfigInt(CONFIG_SENTBOX_WATCH));
mvboxWatchCheckbox.setChecked(0!=dcContext.getConfigInt(CONFIG_MVBOX_WATCH));
bccSelfCheckbox.setChecked(0!=dcContext.getConfigInt(CONFIG_BCC_SELF));
mvboxMoveCheckbox.setChecked(0!=dcContext.getConfigInt(CONFIG_MVBOX_MOVE));
}