Added option to disable saving drafts on the server

This commit is contained in:
M66B 2020-07-18 08:02:31 +02:00
parent cc5eb085df
commit df17d655b0
3 changed files with 24 additions and 2 deletions

View File

@ -1236,9 +1236,11 @@ public class FragmentCompose extends FragmentBase {
}
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
boolean save_drafts = prefs.getBoolean("save_drafts", true);
boolean send_dialog = prefs.getBoolean("send_dialog", true);
boolean image_dialog = prefs.getBoolean("image_dialog", true);
menu.findItem(R.id.menu_save_drafts).setChecked(save_drafts);
menu.findItem(R.id.menu_send_dialog).setChecked(send_dialog);
menu.findItem(R.id.menu_image_dialog).setChecked(image_dialog);
menu.findItem(R.id.menu_media).setChecked(media);
@ -1263,6 +1265,9 @@ public class FragmentCompose extends FragmentBase {
case R.id.menu_zoom:
onMenuZoom();
return true;
case R.id.menu_save_drafts:
onMenuSaveDrafts();
return true;
case R.id.menu_send_dialog:
onMenuSendDialog();
return true;
@ -1369,6 +1374,12 @@ public class FragmentCompose extends FragmentBase {
}
}
private void onMenuSaveDrafts() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
boolean save_drafts = prefs.getBoolean("save_drafts", true);
prefs.edit().putBoolean("save_drafts", !save_drafts).apply();
}
private void onMenuSendDialog() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
boolean send_dialog = prefs.getBoolean("send_dialog", true);
@ -4261,8 +4272,11 @@ public class FragmentCompose extends FragmentBase {
action == R.id.action_undo ||
action == R.id.action_redo ||
action == R.id.action_check) {
if ((dirty || encrypted) && !needsEncryption)
EntityOperation.queue(context, draft, EntityOperation.ADD);
if ((dirty || encrypted) && !needsEncryption) {
boolean save_drafts = prefs.getBoolean("save_drafts", true);
if (save_drafts)
EntityOperation.queue(context, draft, EntityOperation.ADD);
}
if (action == R.id.action_check) {
// Check data

View File

@ -13,6 +13,13 @@
android:title="@string/title_zoom"
app:showAsAction="ifRoom" />
<item
android:id="@+id/menu_save_drafts"
android:checkable="true"
android:checked="true"
android:title="@string/title_save_drafts"
app:showAsAction="never" />
<item
android:id="@+id/menu_send_dialog"
android:checkable="true"

View File

@ -911,6 +911,7 @@
<string name="title_attachment_audio">Record audio</string>
<string name="title_show_addresses">Show CC/BCC</string>
<string name="title_save_drafts">Save drafts on the server</string>
<string name="title_send_dialog">Show send options</string>
<string name="title_image_dialog">Show image options</string>
<string name="title_media_toolbar">Media toolbar</string>