MailJD nbsp;·nbsp; Test Dashboard nbsp;·nbsp; Coverage
LCOV - code coverage report
Current view: top level - service - DesktopNotifier.h (source / functions) Coverage Total Hit
Test: MailJD Coverage (Unit + E2E) Lines: 100.0 % 1 1
Test Date: 2026-06-21 21:10:19 Functions: 100.0 % 1 1
Legend: Lines:     hit not hit

            Line data    Source code
       1              : #pragma once
       2              : 
       3              : #include <QMap>
       4              : #include <QObject>
       5              : 
       6              : #ifdef MAILJD_KDE_INTEGRATION
       7              : class KNotification;
       8              : #endif
       9              : 
      10              : #ifndef MAILJD_KDE_INTEGRATION
      11              : class QDBusInterface;
      12              : #endif
      13              : 
      14              : class DesktopNotifier : public QObject {
      15            8 :   Q_OBJECT
      16              : #ifdef MAILJD_UNIT_TEST
      17              :   friend class TestDesktopNotifierKde;
      18              : #endif
      19              : public:
      20              :   explicit DesktopNotifier(QObject *parent = nullptr);
      21              :   ~DesktopNotifier() override;
      22              : 
      23              :   // replacesId (67.A2): non-zero replaces the still-visible notification
      24              :   // with that id in place (org.freedesktop.Notifications replaces_id).
      25              :   uint notify(const QString &summary, const QString &body = {},
      26              :               const QString &iconName = {}, int timeoutMs = 5000,
      27              :               uint replacesId = 0);
      28              : 
      29              :   // 67.A2: summary notification for a clustered new-mail burst.
      30              :   // Only offers the "open" action (mark-read makes no sense for N mails).
      31              :   uint notifySummary(const QString &title, const QString &body,
      32              :                      uint replacesId = 0);
      33              : 
      34              :   void close(uint id);
      35              :   bool isAvailable() const;
      36              : 
      37              : signals:
      38              :   void actionInvoked(uint id, const QString &actionKey);
      39              :   void notificationClosed(uint id);
      40              : 
      41              : private:
      42              :   bool m_available = false;
      43              :   uint m_nextId = 1;
      44              :   QMap<uint, QObject *> m_activeNotifications;
      45              : 
      46              : #ifdef MAILJD_KDE_INTEGRATION
      47              :   void configureKdeActions(KNotification *notification, uint id,
      48              :                            bool includeMarkRead);
      49              :   // Sprint 77 (T-77.A4) test seam: KF6's addAction does not reparent the
      50              :   // KNotificationAction to the notification, and KNotification::actions() is
      51              :   // private (QML-only), so a test cannot retrieve added actions post-hoc.
      52              :   // configureKdeActions records every action it creates here so the friend
      53              :   // test (TestDesktopNotifierKde) can drive them directly. Empty in normal use.
      54              :   QList<QObject *> m_kdeActionsForTest;
      55              : #endif
      56              : 
      57              : #ifndef MAILJD_KDE_INTEGRATION
      58              :   ::QDBusInterface *m_dbus = nullptr;
      59              :   void setupDBusConnections();
      60              : #endif
      61              : 
      62              : private slots:
      63              : #ifndef MAILJD_KDE_INTEGRATION
      64              :   void onDBusActionInvoked(uint id, const QString &action);
      65              :   void onDBusNotificationClosed(uint id, uint reason);
      66              : #endif
      67              : };
        

Generated by: LCOV version 2.0-1