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: 79.7% 55 / 0 / 69
Functions: 100.0% 5 / 0 / 5
Branches: 60.7% 54 / 0 / 89

presentation/QuickTaskMailLinks.cpp
Line Branch Exec Source
1 // Mail ↔ task links of QuickTaskActions (Sprint 94): tasks of a
2 // message, the selected mail as a task reference and opening a linked mail.
3 // Part of QuickTaskActions (see QuickTaskActions.cpp).
4 #include "QuickTaskActions.h"
5 #include "QuickTaskModel.h"
6 #include "TaskListLayout.h"
7 #include "WorkspaceState.h"
8 #include "app/core/CalendarSyncCoordinator.h"
9 #include "app/core/MailSessionCore.h"
10 #include "data/CalendarStore.h"
11 #include "data/MailCache.h"
12 #include "util/MessageId.h"
13
14 336 QVariantList QuickTaskActions::tasksForMessage(const QString &messageId) const {
15 336 QVariantList result;
16 336 auto *sync = m_session.calendarSync();
17
1/1
✓ Branch 3 → 4 taken 336 times.
336 const QString canonical = MessageId::canonicalFirst(messageId);
18
4/8
✓ Branch 4 → 5 taken 336 times.
✗ Branch 4 → 9 not taken.
✓ Branch 6 → 7 taken 336 times.
✗ Branch 6 → 9 not taken.
✗ Branch 8 → 9 not taken.
✓ Branch 8 → 10 taken 336 times.
✗ Branch 11 → 12 not taken.
✓ Branch 11 → 13 taken 336 times.
336 if (!sync || !sync->store() || canonical.isEmpty()) return result;
19
1/1
✓ Branch 13 → 14 taken 336 times.
336 const QDate today = QDate::currentDate();
20
5/5
✓ Branch 15 → 16 taken 336 times.
✓ Branch 16 → 17 taken 336 times.
✓ Branch 17 → 18 taken 336 times.
✓ Branch 46 → 19 taken 18 times.
✓ Branch 46 → 47 taken 336 times.
354 for (const auto &task : sync->store()->tasksForMessage(canonical)) {
21
1/1
✓ Branch 20 → 21 taken 18 times.
18 QVariantMap entry = QuickTaskModel::record(task);
22
2/2
✓ Branch 21 → 22 taken 18 times.
✓ Branch 26 → 27 taken 18 times.
36 entry.insert(QStringLiteral("dueLabel"), TaskListLayout::dueText(task, today));
23
2/2
✓ Branch 31 → 32 taken 18 times.
✓ Branch 36 → 37 taken 18 times.
36 entry.insert(QStringLiteral("open"), TaskListLayout::open(task));
24
1/1
✓ Branch 41 → 42 taken 18 times.
18 result.append(entry);
25 354 }
26 336 return result;
27 336 }
28
29 981 QSet<QString> QuickTaskActions::openTaskMessageIds() const {
30 981 auto *sync = m_session.calendarSync();
31
3/4
✓ Branch 3 → 4 taken 980 times.
✓ Branch 3 → 8 taken 1 time.
✓ Branch 5 → 6 taken 980 times.
✗ Branch 5 → 8 not taken.
981 return sync && sync->store() ? sync->store()->openTaskMessageIds() : QSet<QString>{};
32 }
33
34 2567 QVariantMap QuickTaskActions::currentMailReference() const {
35 2567 const MailId selected = m_workspace.mailId();
36
3/3
✓ Branch 4 → 5 taken 2567 times.
✓ Branch 5 → 6 taken 1240 times.
✓ Branch 5 → 7 taken 1327 times.
2567 if (!m_deps.acceptsIdentity(selected))
37 1240 return {};
38
1/1
✓ Branch 8 → 9 taken 1327 times.
1327 const auto header = m_session.cache()->header(selected.folderId, selected.uid);
39
1/2
✗ Branch 10 → 11 not taken.
✓ Branch 10 → 12 taken 1327 times.
1327 if (!header)
40 ✗ return {};
41
1/1
✓ Branch 13 → 14 taken 1327 times.
1327 const QString messageId = MessageId::canonicalFirst(header->messageId);
42
2/2
✓ Branch 15 → 16 taken 973 times.
✓ Branch 15 → 17 taken 354 times.
1327 if (messageId.isEmpty())
43 973 return {};
44 708 return {{QStringLiteral("messageId"), messageId},
45 708 {QStringLiteral("subject"), header->subject},
46
2/4
✓ Branch 33 → 34 taken 1062 times.
✓ Branch 33 → 35 taken 354 times.
✗ Branch 48 → 49 not taken.
✗ Branch 48 → 50 not taken.
2124 {QStringLiteral("sender"), header->from}};
47 3983 }
48
49 7 QVariantMap QuickTaskActions::taskMailReference(const QString &messageId) const {
50
1/1
✓ Branch 2 → 3 taken 7 times.
7 const QString canonical = MessageId::canonicalFirst(messageId);
51
2/2
✓ Branch 4 → 5 taken 7 times.
✓ Branch 5 → 6 taken 7 times.
7 const auto found = m_session.cache()->findByMessageId(m_deps.accountName(), canonical);
52
1/2
✗ Branch 8 → 9 not taken.
✓ Branch 8 → 26 taken 7 times.
7 if (!found)
53 ✗ return {{QStringLiteral("messageId"), canonical},
54 ✗ {QStringLiteral("available"), false}};
55
1/1
✓ Branch 26 → 27 taken 7 times.
7 const MailId id{m_deps.accountName(), found->first, found->second};
56
2/3
✓ Branch 29 → 30 taken 7 times.
✗ Branch 30 → 31 not taken.
✓ Branch 30 → 48 taken 7 times.
7 if (!m_deps.acceptsIdentity(id))
57 ✗ return {{QStringLiteral("messageId"), canonical},
58 ✗ {QStringLiteral("available"), false}};
59
1/1
✓ Branch 49 → 50 taken 7 times.
7 const auto header = m_session.cache()->header(id.folderId, id.uid);
60
1/2
✗ Branch 51 → 52 not taken.
✓ Branch 51 → 69 taken 7 times.
7 if (!header)
61 ✗ return {{QStringLiteral("messageId"), canonical},
62 ✗ {QStringLiteral("available"), false}};
63 14 return {{QStringLiteral("messageId"), canonical},
64 14 {QStringLiteral("available"), true},
65 14 {QStringLiteral("subject"), header->subject},
66
2/4
✓ Branch 89 → 90 taken 28 times.
✓ Branch 89 → 91 taken 7 times.
✗ Branch 178 → 179 not taken.
✗ Branch 178 → 180 not taken.
49 {QStringLiteral("sender"), header->from}};
67 49 }
68
69 5 bool QuickTaskActions::openTaskMail(const QString &messageId) {
70
1/1
✓ Branch 2 → 3 taken 5 times.
5 const QString canonical = MessageId::canonicalFirst(messageId);
71
2/2
✓ Branch 4 → 5 taken 5 times.
✓ Branch 5 → 6 taken 5 times.
5 const auto found = m_session.cache()->findByMessageId(m_deps.accountName(), canonical);
72
1/2
✗ Branch 8 → 9 not taken.
✓ Branch 8 → 13 taken 5 times.
5 if (!found) {
73 ✗ m_deps.setStatus(tr("The linked message is not available in this account."));
74 ✗ return false;
75 }
76
1/1
✓ Branch 13 → 14 taken 5 times.
5 const MailId id{m_deps.accountName(), found->first, found->second};
77
2/3
✓ Branch 16 → 17 taken 5 times.
✗ Branch 17 → 18 not taken.
✓ Branch 17 → 22 taken 5 times.
5 if (!m_deps.acceptsIdentity(id)) {
78 ✗ m_deps.setStatus(tr("The linked message is no longer available."));
79 ✗ return false;
80 }
81
1/1
✓ Branch 23 → 24 taken 5 times.
5 const auto header = m_session.cache()->header(id.folderId, id.uid);
82
1/2
✗ Branch 25 → 26 not taken.
✓ Branch 25 → 27 taken 5 times.
5 if (!header)
83 ✗ return false;
84
1/1
✓ Branch 30 → 31 taken 5 times.
10 m_workspace.setArea(QStringLiteral("mail"));
85
3/4
✓ Branch 34 → 35 taken 5 times.
✓ Branch 35 → 36 taken 5 times.
✗ Branch 37 → 38 not taken.
✓ Branch 37 → 42 taken 5 times.
5 if (m_workspace.openMail(WorkspaceState::encode(id), header->subject) < 0) {
86 ✗ m_deps.setStatus(tr("Cannot open another tab. Close a tab and retry."));
87 ✗ return false;
88 }
89 5 return true;
90 5 }
91