Warn when enabling config "only_fetch_mvbox"

This commit is contained in:
Hocuri
2022-04-12 17:58:53 +02:00
committed by bjoern
parent 0b9b0ff484
commit a4efe7f47f
2 changed files with 20 additions and 6 deletions
+1 -1
View File
@@ -600,7 +600,7 @@
<string name="pref_background_btn_default">Use Default Image</string>
<string name="pref_background_btn_gallery">Select From Gallery</string>
<string name="pref_imap_folder_handling">IMAP Folder Handling</string>
<string name="pref_imap_folder_warn_disable_defaults">If you disable this option, make sure, your server and your other clients are configured accordingly.\n\nOtherwise things may not work at all.</string>
<string name="pref_imap_folder_warn_disable_defaults">If you change this option, make sure, your server and your other clients are configured accordingly.\n\nOtherwise things may not work at all.</string>
<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>
@@ -92,11 +92,25 @@ public class AdvancedPreferenceFragment extends ListSummaryPreferenceFragment
onlyFetchMvboxCheckbox = this.findPreference("pref_only_fetch_mvbox");
onlyFetchMvboxCheckbox.setOnPreferenceChangeListener(((preference, newValue) -> {
boolean enabled = (Boolean) newValue;
DcHelper.getAccounts(getContext()).stopIo();
dcContext.setConfigInt(CONFIG_ONLY_FETCH_MVBOX, enabled? 1 : 0);
DcHelper.getAccounts(getContext()).startIo();
return true;
final boolean enabled = (Boolean) newValue;
if (enabled) {
new AlertDialog.Builder(getContext())
.setMessage(R.string.pref_imap_folder_warn_disable_defaults)
.setPositiveButton(R.string.ok, (dialogInterface, i) -> {
DcHelper.getAccounts(getContext()).stopIo();
dcContext.setConfigInt(CONFIG_ONLY_FETCH_MVBOX, 1);
((CheckBoxPreference)preference).setChecked(true);
DcHelper.getAccounts(getContext()).startIo();
})
.setNegativeButton(R.string.cancel, null)
.show();
return false;
} else {
DcHelper.getAccounts(getContext()).stopIo();
dcContext.setConfigInt(CONFIG_ONLY_FETCH_MVBOX, 0);
DcHelper.getAccounts(getContext()).startIo();
return true;
}
}));
Preference manageKeys = this.findPreference("pref_manage_keys");