mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-22 22:21:18 +00:00
Added reset link questions
This commit is contained in:
parent
825c7dfb6c
commit
4fdb1ae4de
3 changed files with 70 additions and 0 deletions
|
@ -6041,6 +6041,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
} else if (itemId == R.id.menu_thread_info) {
|
||||
onMenuThreadInfo(message);
|
||||
return true;
|
||||
} else if (itemId == R.id.menu_reset_questions) {
|
||||
onMenuResetQuestions(message);
|
||||
return true;
|
||||
} else if (itemId == R.id.menu_resync) {
|
||||
onMenuResync(message);
|
||||
return true;
|
||||
|
@ -6541,6 +6544,67 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
|
||||
}
|
||||
|
||||
private void onMenuResetQuestions(TupleMessageEx message) {
|
||||
Bundle args = new Bundle();
|
||||
args.putLong("id", message.id);
|
||||
|
||||
new SimpleTask<Void>() {
|
||||
@Override
|
||||
protected Void onExecute(Context context, Bundle args) throws Throwable {
|
||||
long id = args.getLong("id");
|
||||
|
||||
DB db = DB.getInstance(context);
|
||||
EntityMessage message = db.message().getMessage(id);
|
||||
if (message == null)
|
||||
return null;
|
||||
|
||||
SharedPreferences.Editor editor = prefs.edit();
|
||||
|
||||
List<EntityAttachment> attachments = db.attachment().getAttachments(id);
|
||||
if (attachments != null)
|
||||
for (EntityAttachment attachment : attachments) {
|
||||
String ext = Helper.getExtension(attachment.name);
|
||||
if (ext == null)
|
||||
continue;
|
||||
editor.remove(ext.toLowerCase(Locale.ROOT) + ".confirm_files");
|
||||
}
|
||||
|
||||
if (message.content) {
|
||||
Document d = JsoupEx.parse(message.getFile(context));
|
||||
for (Element a : d.select("a")) {
|
||||
String href = a.attr("href");
|
||||
if (TextUtils.isEmpty(href))
|
||||
continue;
|
||||
|
||||
Uri uri = Uri.parse(href);
|
||||
if (uri == null || !UriHelper.isHyperLink(uri))
|
||||
continue;
|
||||
|
||||
String host = uri.getHost();
|
||||
if (TextUtils.isEmpty(host))
|
||||
continue;
|
||||
|
||||
editor.remove(host + ".confirm_link");
|
||||
}
|
||||
}
|
||||
|
||||
editor.apply();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, Void data) {
|
||||
ToastEx.makeText(context, R.string.title_completed, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Log.unexpectedError(parentFragment.getParentFragmentManager(), ex);
|
||||
}
|
||||
}.execute(context, owner, args, "reset");
|
||||
}
|
||||
|
||||
private void onMenuResync(TupleMessageEx message) {
|
||||
Bundle args = new Bundle();
|
||||
args.putLong("id", message.id);
|
||||
|
|
|
@ -160,6 +160,11 @@
|
|||
android:icon="@drawable/baseline_mail_more_24"
|
||||
android:title="@string/title_thread_info" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_reset_questions"
|
||||
android:icon="@drawable/twotone_restart_alt_24"
|
||||
android:title="@string/title_reset_message_questions" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_resync"
|
||||
android:icon="@drawable/twotone_sync_24"
|
||||
|
|
|
@ -1694,6 +1694,7 @@
|
|||
<string name="title_encrypt">Encrypt</string>
|
||||
<string name="title_decrypt">Decrypt</string>
|
||||
<string name="title_thread_info" translatable="false">Thread info</string>
|
||||
<string name="title_reset_message_questions">Reset link questions</string>
|
||||
<string name="title_resync">Resync</string>
|
||||
<string name="title_charset">Encoding</string>
|
||||
<string name="title_charset_auto">Automatic</string>
|
||||
|
|
Loading…
Reference in a new issue