From: NeilBrown Date: Fri, 26 May 2023 09:07:14 +0000 (+1000) Subject: doc-email: send a notification when a 'transformed' pane is made visible. X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=7d29908b620d98530c74c26fd2d2a5ba9bc516b7;p=edlib.git doc-email: send a notification when a 'transformed' pane is made visible. We don't really want to process attachments until asked. So allow the transform tool to be notified when it is time. Signed-off-by: NeilBrown --- diff --git a/doc-email.c b/doc-email.c index 29145562..49d2cca3 100644 --- a/doc-email.c +++ b/doc-email.c @@ -590,22 +590,22 @@ static bool handle_text(struct pane *p safe, char *type, char *xfer, char *disp, else asprintf(&ctype, "%1.*s", majlen, major); if (ctype && strcasecmp(ctype, "text/html") == 0) { - transformed = call_ret(pane, "html-to-text-w3m", h); + transformed = call_ret(pane, "html-to-text-w3m", h, 1); if (!transformed) - transformed = call_ret(pane, "html-to-text", h); + transformed = call_ret(pane, "html-to-text", h, 1); } if (ctype && strcasecmp(ctype, "text/calendar") == 0) - transformed = call_ret(pane, "ical-to-text", h); + transformed = call_ret(pane, "ical-to-text", h, 1); if (ctype && strcasecmp(ctype, "application/pdf") == 0) - transformed = call_ret(pane, "pdf-to-text", h); + transformed = call_ret(pane, "pdf-to-text", h, 1); if (ctype && strcasecmp(ctype, "application/octet-stream") == 0 && fname && strcasestr(fname, ".pdf") != NULL) - transformed = call_ret(pane, "pdf-to-text", h); + transformed = call_ret(pane, "pdf-to-text", h, 1); if (major && strncasecmp(major, "application", majlen) == 0 && fname && (strcasestr(fname, ".docx") != NULL || strcasestr(fname, ".doc") != NULL || strcasestr(fname, ".odt") != NULL)) - transformed = call_ret(pane, "doc-to-text", h, 0, NULL, fname); + transformed = call_ret(pane, "doc-to-text", h, 1, NULL, fname); if (ctype && strncasecmp(ctype, "image/", 6) == 0) { struct mark *m; @@ -1206,6 +1206,17 @@ DEF_CMD(email_view_set_attr) mark_free(m1); mark_free(m2); + if (w && strcmp(w, "transformed") == 0) { + /* If the transformation was delayed, tell it + * to start now. + */ + struct pane *part = + call_ret(pane, "doc:multipart:get-part", + ci->home->parent, p+1); + if (part) + call("doc:notify:convert-now", part); + } + return 1; } return Efallthrough;