mirror of https://github.com/M66B/FairEmail.git
Added edit as new
This commit is contained in:
parent
adad5602f0
commit
3d5d994852
|
@ -2196,6 +2196,13 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
context.startActivity(forward);
|
||||
}
|
||||
|
||||
private void onMenuEditAsNew(final TupleMessageEx message) {
|
||||
Intent asnew = new Intent(context, ActivityCompose.class)
|
||||
.putExtra("action", "editasnew")
|
||||
.putExtra("reference", message.id);
|
||||
context.startActivity(asnew);
|
||||
}
|
||||
|
||||
private void onMenuUnseen(final TupleMessageEx message) {
|
||||
Bundle args = new Bundle();
|
||||
args.putLong("id", message.id);
|
||||
|
@ -2549,6 +2556,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
popupMenu.inflate(R.menu.menu_message);
|
||||
|
||||
popupMenu.getMenu().findItem(R.id.menu_forward).setEnabled(data.message.content);
|
||||
popupMenu.getMenu().findItem(R.id.menu_editasnew).setEnabled(data.message.content);
|
||||
|
||||
popupMenu.getMenu().findItem(R.id.menu_unseen).setEnabled(data.message.uid != null && !data.message.folderReadOnly);
|
||||
popupMenu.getMenu().findItem(R.id.menu_flag_color).setEnabled(data.message.uid != null && !data.message.folderReadOnly);
|
||||
|
@ -2586,6 +2594,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
case R.id.menu_forward:
|
||||
onMenuForward(data.message);
|
||||
return true;
|
||||
case R.id.menu_editasnew:
|
||||
onMenuEditAsNew(data.message);
|
||||
return true;
|
||||
case R.id.menu_unseen:
|
||||
onMenuUnseen(data.message);
|
||||
return true;
|
||||
|
|
|
@ -109,6 +109,7 @@ import com.google.android.material.bottomnavigation.LabelVisibilityMode;
|
|||
import com.google.android.material.snackbar.Snackbar;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.nodes.Document;
|
||||
import org.jsoup.nodes.Element;
|
||||
import org.openintents.openpgp.OpenPgpError;
|
||||
import org.openintents.openpgp.util.OpenPgpApi;
|
||||
|
@ -2057,7 +2058,7 @@ public class FragmentCompose extends FragmentBase {
|
|||
else if ("receipt".equals(action))
|
||||
draft.receipt_request = true;
|
||||
|
||||
} else if ("forward".equals(action))
|
||||
} else if ("forward".equals(action) || "editasnew".equals(action))
|
||||
draft.thread = draft.msgid; // new thread
|
||||
|
||||
String subject = (ref.subject == null ? "" : ref.subject);
|
||||
|
@ -2070,6 +2071,14 @@ public class FragmentCompose extends FragmentBase {
|
|||
draft.subject = ref.subject;
|
||||
} else if ("list".equals(action)) {
|
||||
draft.subject = ref.subject;
|
||||
} else if ("editasnew".equals(action)) {
|
||||
draft.subject = ref.subject;
|
||||
if (ref.content) {
|
||||
String html = Helper.readText(ref.getFile(context));
|
||||
Document document = Jsoup.parse(html);
|
||||
if (document.body() != null)
|
||||
body = document.body().html();
|
||||
}
|
||||
} else if ("receipt".equals(action)) {
|
||||
draft.subject = context.getString(R.string.title_receipt_subject, subject);
|
||||
|
||||
|
@ -2173,7 +2182,8 @@ public class FragmentCompose extends FragmentBase {
|
|||
}
|
||||
|
||||
// Write reference text
|
||||
if (ref != null && ref.content && !"list".equals(action) && !"receipt".equals(action)) {
|
||||
if (ref != null && ref.content &&
|
||||
!"editasnew".equals(action) && !"list".equals(action) && !"receipt".equals(action)) {
|
||||
String refBody = String.format("<p>%s %s:</p>\n<blockquote>%s</blockquote>",
|
||||
Html.escapeHtml(new Date(ref.received).toString()),
|
||||
Html.escapeHtml(MessageHelper.formatAddresses(ref.from)),
|
||||
|
@ -2196,7 +2206,7 @@ public class FragmentCompose extends FragmentBase {
|
|||
db.message().setMessageEncrypt(draft.id, true);
|
||||
|
||||
} else if (attachment.encryption == null &&
|
||||
("forward".equals(action) ||
|
||||
("forward".equals(action) || "editasnew".equals(action) ||
|
||||
(attachment.isInline() && attachment.isImage()))) {
|
||||
if (attachment.available) {
|
||||
File source = attachment.getFile(context);
|
||||
|
|
|
@ -4,6 +4,10 @@
|
|||
android:id="@+id/menu_forward"
|
||||
android:title="@string/title_forward" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_editasnew"
|
||||
android:title="@string/title_editasnew" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_unseen"
|
||||
android:title="@string/title_unseen" />
|
||||
|
|
|
@ -432,6 +432,7 @@
|
|||
<string name="title_flag_color">Colored star …</string>
|
||||
<string name="title_unflag">Remove star</string>
|
||||
<string name="title_forward">Forward</string>
|
||||
<string name="title_editasnew">Edit as new</string>
|
||||
<string name="title_create_rule">Create rule …</string>
|
||||
<string name="title_share">Share</string>
|
||||
<string name="title_print">Print</string>
|
||||
|
|
Loading…
Reference in New Issue