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

presentation/QuickCalendarSync.h
Line Branch Exec Source
1 #pragma once
2
3 #include <QObject>
4 #include <QTimer>
5 #include <QVariantList>
6 #include <QVariantMap>
7 #include <functional>
8
9 class CalendarSyncCoordinator;
10 class ContactSyncCoordinator;
11
12 // Sprint 93 S93.6.3 (F-14): the sync state for QML — per DAV account the
13 // last success ("Synced 2 min ago"), a running indicator and the last
14 // error with a next step; "Sync now" for calendars and contacts.
15 // Exposed as backend.pim.sync. The relative texts refresh every 30 s.
16 class QuickCalendarSync final : public QObject {
17 3408 Q_OBJECT
18 Q_PROPERTY(bool running READ running NOTIFY changed)
19 Q_PROPERTY(QVariantList accounts READ accounts NOTIFY changed)
20 Q_PROPERTY(QString summaryText READ summaryText NOTIFY changed)
21 // The first account whose sync needs the user (missing or rejected
22 // password, …) as an accounts() entry; empty map when all is well.
23 Q_PROPERTY(QVariantMap problem READ problem NOTIFY changed)
24 // S93.5.4: ICS URL subscriptions: [{accountId, name, url, stateText,
25 // error}] (accountId = the calendar's accountId).
26 Q_PROPERTY(QVariantList subscriptions READ subscriptions NOTIFY changed)
27 public:
28 using Clock = std::function<qint64()>;
29 QuickCalendarSync(CalendarSyncCoordinator *calendars, ContactSyncCoordinator *contacts,
30 QObject *parent = nullptr);
31
32 bool running() const;
33 QVariantList accounts() const;
34 QString summaryText() const;
35 QVariantMap problem() const;
36 // "Synced 2 min ago" for an epoch-seconds success time (0 = never).
37 QString lastSyncText(qint64 lastSuccess) const;
38
39 Q_INVOKABLE void syncNow();
40 QVariantList subscriptions() const;
41 // {ok, error}; intervalHours >= 1.
42 // username/password: optional, for a protected feed (https only).
43 Q_INVOKABLE QVariantMap subscribe(const QString &url, const QString &name, int intervalHours,
44 const QString &username = {}, const QString &password = {});
45 Q_INVOKABLE bool unsubscribe(const QString &accountId);
46 // Sprint 100 S100.4.9 (D-23): rename / change the update interval.
47 Q_INVOKABLE bool updateSubscription(const QString &accountId, const QString &name, int intervalMinutes);
48 Q_INVOKABLE void refreshSubscription(const QString &accountId);
49 1 void setClock(Clock clock) { m_clock = std::move(clock); }
50
51 signals:
52 void changed();
53
54 private:
55 qint64 now() const;
56
57 CalendarSyncCoordinator *m_calendars = nullptr;
58 ContactSyncCoordinator *m_contacts = nullptr;
59 QTimer m_refresh;
60 Clock m_clock;
61 };
62