MailJDTourDownloadDocsQualityTestsCoverage

Which source lines and branches the tests execute. Lines 91.5 %, branches 75.0 % (minimum 85 % and 72 %). main @ 399ffe3d · 21 October 2026 · pipeline 7238.

GCC Code Coverage Report


Directory: src/
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 1 / 0 / 1
Functions: 100.0% 1 / 0 / 1
Branches: -% 0 / 0 / 0

controller/MailSelectionStateCommands.h
Line Branch Exec Source
1 #pragma once
2
3 #include <QObject>
4 #include <QPointer>
5 #include <QString>
6 #include <functional>
7 #include <memory>
8
9 #include "controller/FolderContext.h"
10 #include "data/MailSelectionMutation.h"
11
12 class MailCache;
13 class MailListModel;
14 class MailMutationPipeline;
15 class MailThreadModel;
16 class UndoManager;
17
18 // MAIL-SELECTION-ACTIONS: read/unread, important and labels for every
19 // message of a selection. The durable writer journals all changed messages
20 // in one transaction (MailCache::enqueueSelectionState); this unit then
21 // shows the result in the loaded rows and the thread list, starts the
22 // dispatch and keeps one Undo entry for the whole action. Unlike the
23 // single-message paths it is durable-first: the rows change when the
24 // journal has accepted the action (one worker round trip).
25 //
26 // Owner: MailController (value member, `controller.selectionStates()`).
27 // GUI thread. Members owned by the controller are read by reference;
28 // controller signals and the label projection are reached through Deps.
29 class MailSelectionStateCommands final : public QObject {
30 19 Q_OBJECT
31 public:
32 struct Deps {
33 std::function<void(qint64 uid, qint64 folderId, const QString &label, bool present)> applyVisibleLabel;
34 std::function<void(const QString &)> statusMessage;
35 std::function<void(const QString &)> actionError;
36 std::function<void(qint64 folderId, qint64 uid, bool seen)> seenVisualChanged;
37 std::function<void(qint64 folderId, qint64 uid, bool starred)> starVisualChanged;
38 std::function<void(const QString &folder, int count)> unreadCountChanged;
39 };
40 MailSelectionStateCommands(MailCache *cache, MailListModel *model, MailThreadModel *const &threadModel,
41 FolderContext &folder, MailMutationPipeline &mutations,
42 const QPointer<UndoManager> &undoManager, Deps deps, QObject *parent = nullptr);
43
44 // `kind` is Seen, Flagged or Keyword (`label` names the keyword). Either
45 // `selection` or `uids` (of `folderId`) names the messages.
46 // `done(journaled)` runs after the result is shown (junk chains its move
47 // there, so the label is journaled before the move).
48 void setState(std::shared_ptr<const MailSelectionSnapshot> selection, qint64 folderId,
49 const QList<qint64> &uids, MutationKind kind, const QString &label, bool desired,
50 bool undoable = true, std::function<void(bool journaled)> done = {});
51
52 // The confirmation for `count` changed messages (also the Undo text).
53 static QString describe(MutationKind kind, const QString &label, bool desired, int count);
54
55 private:
56 void applyResult(const MailSelectionStateResult &result, bool undoable);
57
58 MailCache *m_cache;
59 MailListModel *m_model;
60 MailThreadModel *const &m_threadModel; // MailController::setThreadModel
61 FolderContext &m_folder; // MailController::m_folder
62 MailMutationPipeline &m_mutations; // MailController::m_mutations
63 const QPointer<UndoManager> &m_undoManager;
64 Deps m_deps;
65 // F-67 (SPRINT-104): while an undo entry executes, the epoch the forward
66 // action was journaled under; 0 = use the current mailbox epoch.
67 quint32 m_epoch = 0;
68 };
69