diff options
Diffstat (limited to 'src/archive_parser.cpp')
-rw-r--r-- | src/archive_parser.cpp | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/src/archive_parser.cpp b/src/archive_parser.cpp index 30e613a..98056e2 100644 --- a/src/archive_parser.cpp +++ b/src/archive_parser.cpp @@ -210,21 +210,25 @@ QString Archive::get_html_status_attachments(QJsonValueRef attachments_ref) { QString att_html(*get_html_status_info_attachment_template()); QJsonObject attachment = attachment_ref.toObject(); - if (attachment.contains("mediaType") and attachment["mediaType"].toString().startsWith("image/")) { - att_html.replace("{{id}}", QString::number(i)); - - if (attachment.contains("url")) { - QString url = attachment["url"].toString(); - QFileInfo path(outbox_filename); - url.prepend(path.absolutePath()); - att_html.replace("{{path}}", url); - } + att_html.replace("{{id}}", QString::number(i)); + + if (attachment.contains("url")) { + QString url = attachment["url"].toString(); + QFileInfo path(outbox_filename); + url.prepend(path.absolutePath()); + att_html.replace("{{path}}", url); + att_html.replace("{{filename}}", QFileInfo(url).fileName()); // FIXME: this is ugly + } - if (attachment.contains("name")) - att_html.replace("{{alt-text}}", attachment["name"].toString()); + if (attachment.contains("mediaType") and attachment["mediaType"].toString().startsWith("image/")) + att_html.replace("{{img-width}}", "440"); + else + att_html.replace("{{img-width}}", "0"); - text.append(att_html); - } + if (attachment.contains("name")) + att_html.replace("{{alt-text}}", attachment["name"].toString()); + + text.append(att_html); ++i; } |