data/MailTextWriter.h
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include <QString> | ||
| 4 | |||
| 5 | class QTextDocument; | ||
| 6 | |||
| 7 | // Sprint 108 S108.2.2 (D-10): the text/plain alternative of a formatted | ||
| 8 | // mail, generated from the same QTextDocument the HTML part comes from | ||
| 9 | // (ComposeDocumentFormat conventions): *bold*, _italic_, `code`, lists as | ||
| 10 | // "- " / "1. " (two spaces per nesting level), quotes as "> ", links as | ||
| 11 | // "text <url>" (the URL alone when the text is the URL), images as the | ||
| 12 | // language's image marker, tables as "cell | cell" rows, rules as "-----", | ||
| 13 | // and the signature after the "-- " separator line. | ||
| 14 | // | ||
| 15 | // Invariant 3 (SPRINT-108 §5.2): every character of visible text of the | ||
| 16 | // HTML part appears in the plain part (the markers aside). | ||
| 17 | class MailTextWriter { | ||
| 18 | public: | ||
| 19 | struct Options { | ||
| 20 | // "%1" is the image's alternative text (D-10, §4.17: message language). | ||
| 21 | QString imageMarker = QStringLiteral("[image: %1]"); | ||
| 22 | // When false (plain-text mode), characters are written as typed: no | ||
| 23 | // emphasis markers, no link expansion — only the structure. | ||
| 24 | bool markup = true; | ||
| 25 | }; | ||
| 26 | static QString write(const QTextDocument &document, const Options &options); | ||
| 27 |
1/3✓ Branch 5 → 6 taken 43 times.
✗ Branch 13 → 14 not taken.
✗ Branch 13 → 15 not taken.
|
86 | static QString write(const QTextDocument &document) { return write(document, Options{}); } |
| 28 | // RFC 3676 signature separator (dash dash space). | ||
| 29 | 128 | static QString signatureSeparator() { return QStringLiteral("-- "); } | |
| 30 | }; | ||
| 31 |