mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-26 19:05:23 +01:00
Allow disabling confirmation of deleting single messages
This commit is contained in:
2
FAQ.md
2
FAQ.md
@@ -3547,6 +3547,8 @@ please see [here](https://github.com/disconnectme/disconnect-tracking-protection
|
||||
Permanent deletion means that messages will *irreversibly* be lost, and to prevent this from happening accidentally, this always needs to be confirmed.
|
||||
Even with a confirmation, some very angry people who lost some of their messages through their own fault contacted me, which was a rather unpleasant experience :-(
|
||||
|
||||
Since version 1.1601 it is possible to disable confirmation of permanent deletion of individual messages.
|
||||
|
||||
Note that the POP3 protocol can download messages from the inbox only.
|
||||
So, deleted messages cannot be uploaded to the inbox again.
|
||||
This means that messages can only be permanently deleted when using a POP3 account.
|
||||
|
||||
@@ -4155,8 +4155,19 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||
aargs.putString("remark", message.getRemark());
|
||||
aargs.putLong("id", message.id);
|
||||
aargs.putInt("faq", 160);
|
||||
aargs.putString("notagain", "delete_asked");
|
||||
aargs.putString("accept", context.getString(R.string.title_ask_delete_accept));
|
||||
aargs.putBoolean("warning", true);
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean delete_asked = prefs.getBoolean("delete_asked", false);
|
||||
if (delete_asked) {
|
||||
Intent data = new Intent();
|
||||
data.putExtra("args", aargs);
|
||||
parentFragment.onActivityResult(FragmentMessages.REQUEST_MESSAGE_DELETE, RESULT_OK, data);
|
||||
return;
|
||||
}
|
||||
|
||||
FragmentDialogAsk ask = new FragmentDialogAsk();
|
||||
ask.setArguments(aargs);
|
||||
ask.setTargetFragment(parentFragment, FragmentMessages.REQUEST_MESSAGE_DELETE);
|
||||
|
||||
@@ -47,6 +47,7 @@ public class FragmentDialogAsk extends FragmentDialogBase {
|
||||
String remark = args.getString("remark");
|
||||
String confirm = args.getString("confirm");
|
||||
String notagain = args.getString("notagain");
|
||||
String accept = args.getString("accept");
|
||||
boolean warning = args.getBoolean("warning");
|
||||
int faq = args.getInt("faq");
|
||||
|
||||
@@ -58,6 +59,7 @@ public class FragmentDialogAsk extends FragmentDialogBase {
|
||||
TextView tvRemark = dview.findViewById(R.id.tvRemark);
|
||||
CheckBox cbConfirm = dview.findViewById(R.id.cbConfirm);
|
||||
CheckBox cbNotAgain = dview.findViewById(R.id.cbNotAgain);
|
||||
TextView tvAccept = dview.findViewById(R.id.tvAccept);
|
||||
ImageButton ibInfo = dview.findViewById(R.id.ibInfo);
|
||||
|
||||
tvMessage.setText(question);
|
||||
@@ -66,6 +68,8 @@ public class FragmentDialogAsk extends FragmentDialogBase {
|
||||
cbConfirm.setText(confirm);
|
||||
cbConfirm.setVisibility(confirm == null ? View.GONE : View.VISIBLE);
|
||||
cbNotAgain.setVisibility(notagain == null ? View.GONE : View.VISIBLE);
|
||||
tvAccept.setText(accept);
|
||||
tvAccept.setVisibility(View.GONE);
|
||||
ibInfo.setVisibility(faq == 0 ? View.GONE : View.VISIBLE);
|
||||
|
||||
if (warning) {
|
||||
@@ -80,8 +84,11 @@ public class FragmentDialogAsk extends FragmentDialogBase {
|
||||
cbNotAgain.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
prefs.edit().putBoolean(notagain, isChecked).apply();
|
||||
if (accept == null) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
prefs.edit().putBoolean(notagain, isChecked).apply();
|
||||
}
|
||||
tvAccept.setVisibility(isChecked && accept != null ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -98,9 +105,13 @@ public class FragmentDialogAsk extends FragmentDialogBase {
|
||||
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
if (confirm == null || cbConfirm.isChecked())
|
||||
if (confirm == null || cbConfirm.isChecked()) {
|
||||
if (notagain != null && accept != null) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
prefs.edit().putBoolean(notagain, cbNotAgain.isChecked()).apply();
|
||||
}
|
||||
sendResult(Activity.RESULT_OK);
|
||||
else
|
||||
} else
|
||||
sendResult(Activity.RESULT_CANCELED);
|
||||
}
|
||||
})
|
||||
|
||||
@@ -2353,8 +2353,19 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
||||
args.putString("remark", message.getRemark());
|
||||
args.putLong("id", message.id);
|
||||
args.putInt("faq", 160);
|
||||
args.putString("notagain", "delete_asked");
|
||||
args.putString("accept", getString(R.string.title_ask_delete_accept));
|
||||
args.putBoolean("warning", true);
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
boolean delete_asked = prefs.getBoolean("delete_asked", false);
|
||||
if (delete_asked) {
|
||||
Intent data = new Intent();
|
||||
data.putExtra("args", args);
|
||||
onActivityResult(REQUEST_MESSAGE_DELETE, RESULT_OK, data);
|
||||
return;
|
||||
}
|
||||
|
||||
FragmentDialogAsk ask = new FragmentDialogAsk();
|
||||
ask.setArguments(args);
|
||||
ask.setTargetFragment(FragmentMessages.this, REQUEST_MESSAGE_DELETE);
|
||||
|
||||
@@ -160,7 +160,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
||||
"selected_folders", "move_1_confirmed", "move_n_confirmed",
|
||||
"last_search_senders", "last_search_recipients", "last_search_subject", "last_search_keywords", "last_search_message",
|
||||
"identities_asked", "identities_primary_hint",
|
||||
"raw_asked", "all_read_asked",
|
||||
"raw_asked", "all_read_asked", "delete_asked",
|
||||
"cc_bcc", "inline_image_hint", "compose_reference", "send_dialog",
|
||||
"setup_reminder", "setup_advanced"
|
||||
};
|
||||
|
||||
@@ -75,5 +75,18 @@
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/cbConfirm" />
|
||||
|
||||
<eu.faircode.email.FixedTextView
|
||||
android:id="@+id/tvAccept"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="Irreversible"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||
android:textColor="?attr/colorWarning"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/cbNotAgain" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</eu.faircode.email.ScrollViewEx>
|
||||
@@ -994,6 +994,7 @@
|
||||
<string name="title_attachments_incomplete">Some attachments or images were not downloaded and could not be added</string>
|
||||
<string name="title_ask_save">Save changes?</string>
|
||||
<string name="title_ask_delete">Delete message permanently?</string>
|
||||
<string name="title_ask_delete_accept">I understand that permanently deleting messages is irreversible</string>
|
||||
<string name="title_ask_delete_answer">Delete reply template permanently?</string>
|
||||
<string name="title_ask_delete_rule">Delete rule permanently?</string>
|
||||
<string name="title_ask_discard">Discard draft?</string>
|
||||
|
||||
Reference in New Issue
Block a user