controller/MailDisplayPort.h
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #pragma once | ||
| 2 | #include "data/MailRequest.h" | ||
| 3 | #include "data/Models.h" | ||
| 4 | #include <QObject> | ||
| 5 | #include <functional> | ||
| 6 | |||
| 7 | // One controller-owned delivery stream, independent of Widgets or Quick. | ||
| 8 | // The controller rejects stale requests before publishing. Implementations must | ||
| 9 | // expose their QObject lifetime and bind retries to the supplied receiver. | ||
| 10 | class MailDisplayPort { | ||
| 11 | public: | ||
| 12 | 839 | virtual ~MailDisplayPort() = default; | |
| 13 | virtual QObject &displayObject() = 0; | ||
| 14 | virtual QMetaObject::Connection subscribeRetry(QObject *receiver, | ||
| 15 | std::function<void()> retry) = 0; | ||
| 16 | // Quick invalidates its document lease immediately. Legacy views retain their | ||
| 17 | // delayed placeholder behavior without mistaking loading text for a real body. | ||
| 18 | ✗ | virtual void presentLoading(const MailId &identity, quint64 generation, | |
| 19 | const MailHeader &header, const QString &message, | ||
| 20 | bool showPlaceholder) { | ||
| 21 | ✗ | if (!showPlaceholder) return; | |
| 22 | ✗ | MailBody body; | |
| 23 | ✗ | body.uid = identity.uid; | |
| 24 | ✗ | body.textPlain = message; | |
| 25 | ✗ | presentMail(identity, generation, header, body); | |
| 26 | ✗ | } | |
| 27 | virtual void presentMail(const MailId &identity, quint64 generation, | ||
| 28 | const MailHeader &header, const MailBody &body) = 0; | ||
| 29 | virtual void presentError(const MailId &identity, quint64 generation, | ||
| 30 | const MailHeader &header, const QString &reason, | ||
| 31 | bool retryable) = 0; | ||
| 32 | // P90.8: mode-switch reprojection delivers only the missing variant into | ||
| 33 | // the still-displayed body; a mode change is not a new mail selection. | ||
| 34 | ✗ | virtual void presentBodyVariant(const MailId &identity, | |
| 35 | ✗ | const MailBody &variant) { Q_UNUSED(identity); Q_UNUSED(variant); } | |
| 36 | virtual void clearDisplay() = 0; | ||
| 37 | // Sprint 105 S105.2.5: the spam filter fields of the displayed mail arrived | ||
| 38 | // after it was shown (one header fetch for a mail synced before schema v25). | ||
| 39 | ✗ | virtual void presentSpamVerdict(const MailId &identity, const MailHeader &header) { | |
| 40 | Q_UNUSED(identity); Q_UNUSED(header); | ||
| 41 | ✗ | } | |
| 42 | }; | ||
| 43 |