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% 7 / 0 / 7
Functions: 100.0% 7 / 0 / 7
Branches: -% 0 / 0 / 0

presentation/QuickContactNavigation.h
Line Branch Exec Source
1 #pragma once
2
3 #include <QObject>
4 #include <QStringList>
5 #include <QTimer>
6 #include <QVariantList>
7 #include <QVariantMap>
8 #include <functional>
9
10 class ContactSyncCoordinator;
11
12 // Data of the contact sidebar (Sprint 97 S97.3.1, P-19): smart-list counts,
13 // address books with their groups, the sync failure line and the remembered
14 // expanded books. Exposed as backend.pim.contactNavigation.
15 //
16 // After a sync or a write (coalesced, at most every 150 ms) `revision`
17 // grows and the counts, books and problem are read again; `changed` is
18 // emitted only when they differ, so the rows built from them keep focus and
19 // hover. The relative sync texts age on `summaryChanged` every 30 s.
20 class QuickContactNavigation final : public QObject {
21 416 Q_OBJECT
22 Q_PROPERTY(int revision READ revision NOTIFY revisionChanged)
23 // {all, frequent, collected}
24 Q_PROPERTY(QVariantMap counts READ counts NOTIFY changed)
25 // [{bookId, name, account, accountId, path, readOnly, local, count,
26 // error, problem (F98-04: the error in plain words), skipped, lastSync
27 // (epoch s, 0 = never), pushKey, showInAll,
28 // useForCompletion, groups: [{name, count, cardId}]}] — sidebar order:
29 // CardDAV books by account label and name, the local book last.
30 Q_PROPERTY(QVariantList books READ books NOTIFY changed)
31 // F94-20: the last successful sync, for the Sync button's tooltip.
32 Q_PROPERTY(QString syncSummary READ syncSummary NOTIFY summaryChanged)
33 // S93.6.3 pattern: "" or the first failing book ("Arbeit: …").
34 Q_PROPERTY(QVariantMap problem READ problem NOTIFY changed)
35 // Books whose groups are shown (remembered, collapsed by default).
36 Q_PROPERTY(QStringList expandedBooks READ expandedBooks NOTIFY expandedChanged)
37 public:
38 using CoordinatorProvider = std::function<ContactSyncCoordinator *()>;
39 using Clock = std::function<qint64()>;
40 // Store reads behind counts()/books()/problem() (also used by tests).
41 QVariantMap readCounts() const;
42 QVariantList readBooks() const;
43 static QString fallbackName(const QString &path);
44 static QString problemText(const QString &error);
45 QVariantMap readProblem() const;
46 // "Synchronized 2 minutes ago" for a sync at `secs` (epoch seconds).
47 QString ageText(qint64 secs) const;
48 explicit QuickContactNavigation(CoordinatorProvider coordinator, QObject *parent = nullptr);
49
50 103 int revision() const { return m_revision; }
51 789 QVariantMap counts() const { return m_counts; }
52 4361 QVariantList books() const { return m_books; }
53 QString syncSummary() const;
54 2337 QVariantMap problem() const { return m_problem; }
55 1026 QStringList expandedBooks() const { return m_expanded; }
56 Q_INVOKABLE void setBookExpanded(qint64 bookId, bool expanded);
57 // S97.5.11, DAV settings: one line per book ("Synchronized 2 minutes
58 // ago", "Not synchronized", "3 contacts could not be read"; G16: never
59 // the server's text) and a sync run of just that book.
60 Q_INVOKABLE QString bookStatus(qint64 bookId) const;
61 Q_INVOKABLE void syncBook(qint64 bookId);
62 // "user@host" of a CardDAV account (its id when unknown).
63 static QString accountLabel(const QString &accountId);
64 // Tests: a fixed "now" for the relative sync text.
65 2 void setClock(Clock clock) { m_clock = std::move(clock); }
66
67 public slots:
68 // A sync, write or book change happened; coalesced into one `changed`.
69 void noteChanged();
70
71 signals:
72 void changed();
73 void summaryChanged();
74 // Every coalesced data change (cards too), for bindings that re-query.
75 void revisionChanged();
76 void expandedChanged();
77
78 private:
79 CoordinatorProvider m_coordinator;
80 QTimer m_coalesce;
81 QTimer m_age;
82 Clock m_clock;
83 int m_revision = 0;
84 // Last published values (re-read after noteChanged).
85 QVariantMap m_counts;
86 QVariantList m_books;
87 QVariantMap m_problem;
88 void refresh();
89 QStringList m_expanded;
90 };
91