quick/ReminderNotifications.h
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include <QHash> | ||
| 4 | #include <QObject> | ||
| 5 | #include <QVariantList> | ||
| 6 | #include <QVariantMap> | ||
| 7 | #include <memory> | ||
| 8 | |||
| 9 | class CalendarSyncCoordinator; | ||
| 10 | class DesktopNotifier; | ||
| 11 | class QuickPimBackend; | ||
| 12 | class ReminderScheduler; | ||
| 13 | class WorkspaceState; | ||
| 14 | |||
| 15 | // Sprint 93/94: appointment and task reminders as desktop | ||
| 16 | // notifications. Owns the ReminderScheduler on the sync coordinator's | ||
| 17 | // store and turns its batches into one notification each: the | ||
| 18 | // appointment (or "3 appointments start soon"), "Join" for a meeting link, | ||
| 19 | // "Remind in 10 minutes" and "Dismiss"; a click opens the day in the | ||
| 20 | // calendar. Without a notification service the reminder goes to the | ||
| 21 | // status line. lastReminder() keeps the last shown text for tests. | ||
| 22 | class ReminderNotifications final : public QObject { | ||
| 23 | 56 | Q_OBJECT | |
| 24 | public: | ||
| 25 | ReminderNotifications(CalendarSyncCoordinator &sync, DesktopNotifier ¬ifier, QuickPimBackend &pim, | ||
| 26 | WorkspaceState &workspace, QObject *parent = nullptr); | ||
| 27 | ~ReminderNotifications() override; | ||
| 28 | void start(); | ||
| 29 | 7 | ReminderScheduler *scheduler() const { return m_scheduler.get(); } | |
| 30 | 4 | QVariantMap lastReminder() const { return m_lastReminder; } | |
| 31 | // Action keys: open, join, complete, snooze, snooze60, tomorrow, dismiss. | ||
| 32 | bool handleAction(uint id, const QString &action); | ||
| 33 | // The notification closed without an action (S106-360). | ||
| 34 | void forget(uint id); | ||
| 35 | |||
| 36 | signals: | ||
| 37 | void statusMessage(const QString &message); | ||
| 38 | |||
| 39 | private: | ||
| 40 | void show(const QVariantList &items, bool missed); | ||
| 41 | |||
| 42 | CalendarSyncCoordinator &m_sync; | ||
| 43 | DesktopNotifier &m_notifier; | ||
| 44 | QuickPimBackend &m_pim; | ||
| 45 | WorkspaceState &m_workspace; | ||
| 46 | std::unique_ptr<ReminderScheduler> m_scheduler; | ||
| 47 | QHash<uint, QVariantList> m_targets; | ||
| 48 | QHash<uint, QString> m_joinUrls; | ||
| 49 | QVariantMap m_lastReminder; | ||
| 50 | }; | ||
| 51 |