app/core/MailSessionCore.h
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include <QObject> | ||
| 4 | #include <memory> | ||
| 5 | |||
| 6 | class SmtpService; | ||
| 7 | |||
| 8 | class ImapService; | ||
| 9 | class MailCache; | ||
| 10 | class MailListModel; | ||
| 11 | class MailThreadModel; | ||
| 12 | class UndoManager; | ||
| 13 | class ConnectionHealthMonitor; | ||
| 14 | class MailController; | ||
| 15 | class AccountSession; | ||
| 16 | class BackgroundAccountSession; | ||
| 17 | class FtsIndexCoordinator; | ||
| 18 | class SmtpService; | ||
| 19 | class FolderPredictionSession; | ||
| 20 | class CalendarSyncCoordinator; | ||
| 21 | class ContactSyncCoordinator; | ||
| 22 | class CalendarStore; | ||
| 23 | class SettingsSyncSession; | ||
| 24 | class DavPushCoordinator; | ||
| 25 | |||
| 26 | // Mail-session ownership is independent of the Widgets or Quick scene tree. | ||
| 27 | // The application owns this object; windows borrow its models and controller. | ||
| 28 | class MailSessionCore final : public QObject { | ||
| 29 | Q_OBJECT | ||
| 30 | public: | ||
| 31 | explicit MailSessionCore(QObject *parent = nullptr); | ||
| 32 | ~MailSessionCore() override; | ||
| 33 | |||
| 34 | 13819 | ImapService *imap() const { return m_imap.get(); } | |
| 35 | 71386 | MailCache *cache() const { return m_cache.get(); } | |
| 36 | 9767 | MailListModel *headers() const { return m_headers.get(); } | |
| 37 | 3424 | MailThreadModel *threads() const { return m_threads.get(); } | |
| 38 | 1042 | UndoManager *undo() const { return m_undo.get(); } | |
| 39 | 6613 | ConnectionHealthMonitor *health() const { return m_health.get(); } | |
| 40 | 45962 | MailController *controller() const { return m_controller.get(); } | |
| 41 | 328551 | AccountSession *accounts() const { return m_accounts.get(); } | |
| 42 | // F-50 (SPRINT-104): background connections for the non-selected | ||
| 43 | // accounts — unread badges and arrival signals only. | ||
| 44 | 796 | BackgroundAccountSession *backgroundAccounts() const { return m_backgroundAccounts.get(); } | |
| 45 | 2680 | FtsIndexCoordinator *fts() const { return m_fts.get(); } | |
| 46 | 179162 | FolderPredictionSession *predictions() const { return m_predictions.get(); } | |
| 47 | // D2: session-owned background CalDAV sync writing into the shared | ||
| 48 | // <config>/mailjd/cache/calendar.db; Quick projections listen to its | ||
| 49 | // storeChanged() signal. Created lazily with the profile. | ||
| 50 | 32488 | CalendarSyncCoordinator *calendarSync() const { return m_calendarSync.get(); } | |
| 51 | // Q09: session-owned CardDAV contact sync into the shared contacts DB. | ||
| 52 | 37164 | ContactSyncCoordinator *contactSync() const { return m_contactSync.get(); } | |
| 53 | // The session's shared calendar database (the Quick projections read it). | ||
| 54 | 248 | CalendarStore *calendarStore() const { return m_calendarStore.get(); } | |
| 55 | 4777 | SettingsSyncSession *settingsSync() const { return m_settingsSync.get(); } | |
| 56 | // Sprint 96: profile-bound DAV-Push automation (null when the calendar | ||
| 57 | // store is unavailable). Owned by the session, i.e. only by the process | ||
| 58 | // that holds the profile lease. | ||
| 59 | 795 | DavPushCoordinator *davPush() const { return m_davPush.get(); } | |
| 60 | // Session-owned outgoing transport (C3): one service per session, used by | ||
| 61 | // both frontends' compose surfaces. | ||
| 62 | 1 | SmtpService *smtp() const { return m_smtp.get(); } | |
| 63 | bool openProfile(const QString &directory); | ||
| 64 | 3196 | QString profileDirectory() const { return m_profileDirectory; } | |
| 65 | 1 | QString profileError() const { return m_profileError; } | |
| 66 | |||
| 67 | private: | ||
| 68 | // Reverse destruction releases the controller/consumers before models/cache | ||
| 69 | // and keeps the transport alive until its monitors have been detached. | ||
| 70 | std::unique_ptr<ImapService> m_imap; | ||
| 71 | std::unique_ptr<MailCache> m_cache; | ||
| 72 | std::unique_ptr<MailListModel> m_headers; | ||
| 73 | std::unique_ptr<MailThreadModel> m_threads; | ||
| 74 | std::unique_ptr<UndoManager> m_undo; | ||
| 75 | std::unique_ptr<ConnectionHealthMonitor> m_health; | ||
| 76 | std::unique_ptr<MailController> m_controller; | ||
| 77 | std::unique_ptr<AccountSession> m_accounts; | ||
| 78 | std::unique_ptr<BackgroundAccountSession> m_backgroundAccounts; | ||
| 79 | std::unique_ptr<FolderPredictionSession> m_predictions; | ||
| 80 | std::unique_ptr<FtsIndexCoordinator> m_fts; | ||
| 81 | std::unique_ptr<SmtpService> m_smtp; | ||
| 82 | std::unique_ptr<CalendarStore> m_calendarStore; | ||
| 83 | std::unique_ptr<CalendarSyncCoordinator> m_calendarSync; | ||
| 84 | std::unique_ptr<ContactSyncCoordinator> m_contactSync; | ||
| 85 | std::unique_ptr<SettingsSyncSession> m_settingsSync; | ||
| 86 | std::unique_ptr<DavPushCoordinator> m_davPush; | ||
| 87 | QString m_profileDirectory; | ||
| 88 | QString m_profileError; | ||
| 89 | qint64 m_ftsRebuildStartNs = 0; | ||
| 90 | }; | ||
| 91 |