presentation/MessageCopyQueue.h
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #pragma once | ||
| 2 | #include "data/MutationJournal.h" | ||
| 3 | #include <QAbstractListModel> | ||
| 4 | #include <QTimer> | ||
| 5 | class MailSessionCore; | ||
| 6 | |||
| 7 | // Bounded metadata-only projection. MIME payloads stay in the session journal; | ||
| 8 | // this view cannot resubmit SMTP and only exposes explicit failed-copy retries. | ||
| 9 | class MessageCopyQueue final : public QAbstractListModel { | ||
| 10 | 4 | Q_OBJECT | |
| 11 | Q_PROPERTY(bool active READ active WRITE setActive NOTIFY stateChanged) | ||
| 12 | Q_PROPERTY(QString account READ account NOTIFY stateChanged) | ||
| 13 | Q_PROPERTY(QString error READ error NOTIFY stateChanged) | ||
| 14 | public: | ||
| 15 | explicit MessageCopyQueue(MailSessionCore &session, QObject *parent = nullptr); | ||
| 16 | enum Role { Token = Qt::UserRole + 1, Folder, State, Error, Retryable }; | ||
| 17 | int rowCount(const QModelIndex &parent = {}) const override; | ||
| 18 | QVariant data(const QModelIndex &index, int role) const override; | ||
| 19 | QHash<int, QByteArray> roleNames() const override; | ||
| 20 | 805 | bool active() const { return m_timer.isActive(); } | |
| 21 | void setActive(bool active); | ||
| 22 | 800 | QString account() const { return m_account; } | |
| 23 |
2/2✓ Branch 3 → 4 taken 2383 times.
✓ Branch 3 → 5 taken 5 times.
|
2388 | QString error() const { return m_error.isEmpty() ? m_loadError : m_error; } |
| 24 | Q_INVOKABLE void refresh(); | ||
| 25 | Q_INVOKABLE bool retryCopy(const QString &token); | ||
| 26 | signals: | ||
| 27 | void stateChanged(); | ||
| 28 | private: | ||
| 29 | MailSessionCore &m_session; | ||
| 30 | QList<MutationRecord> m_rows; | ||
| 31 | QString m_account, m_error, m_loadError; | ||
| 32 | quint64 m_generation = 0; | ||
| 33 | QTimer m_timer; | ||
| 34 | }; | ||
| 35 |