presentation/QuickComposeBackend.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "QuickComposeBackend.h" | ||
| 2 | |||
| 3 | #include "app/core/MailSessionCore.h" | ||
| 4 | #include "controller/MailController.h" | ||
| 5 | |||
| 6 | // The reply/forward source pool and the composer sessions (formerly part of | ||
| 7 | // QuickMailBackend::wireComposeSource(), called at its position). | ||
| 8 | 795 | void QuickComposeBackend::connectComposeSource() { | |
| 9 | 795 | m_prefill.connectSource(); | |
| 10 | 795 | initComposeSessions(); | |
| 11 | 795 | } | |
| 12 | |||
| 13 | 774 | void QuickComposeBackend::setComposeWindowed(bool on) { | |
| 14 |
2/2✓ Branch 2 → 3 taken 764 times.
✓ Branch 2 → 4 taken 10 times.
|
774 | if (m_composeWindowed == on) return; |
| 15 | 10 | m_composeWindowed = on; | |
| 16 | 10 | emit composeWindowedChanged(); | |
| 17 | } | ||
| 18 | |||
| 19 | 795 | QuickComposeBackend::QuickComposeBackend(MailSessionCore &session, WorkspaceState &workspace, | |
| 20 | const QString &profileDirectory, QThreadPool &threadPool, | ||
| 21 | const QString &draftsFolder, const QString &sentFolder, | ||
| 22 | const QHash<qint64, QString> &folderPathById, | ||
| 23 | const QHash<qint64, quint32> &folderEpochById, | ||
| 24 | 795 | Deps deps, QObject *parent) | |
| 25 | 795 | : QObject(parent), m_session(session), m_workspace(workspace), | |
| 26 | 795 | m_profileDirectory(profileDirectory), m_threadPool(threadPool), | |
| 27 | 795 | m_draftsFolder(draftsFolder), m_sentFolder(sentFolder), | |
| 28 | 795 | m_folderPathById(folderPathById), m_folderEpochById(folderEpochById), | |
| 29 | 795 | m_deps(std::move(deps)), | |
| 30 |
1/1✓ Branch 11 → 12 taken 795 times.
|
797 | m_draftCleanup([&session] { return session.imap(); }, [&session] { return session.controller()->currentFolder(); }), |
| 31 | 795 | m_prefill(session, workspace, profileDirectory, folderPathById, folderEpochById, | |
| 32 |
4/4✓ Branch 25 → 26 taken 795 times.
✓ Branch 26 → 27 taken 795 times.
✓ Branch 27 → 28 taken 795 times.
✓ Branch 32 → 33 taken 795 times.
|
2385 | {m_deps.acceptsIdentity, m_deps.accountName, m_deps.accountEmail}) { |
| 33 | // Direct signal relay: a cancellation inside a selection change still | ||
| 34 | // reaches QML synchronously, as before the split. | ||
| 35 | 795 | connect(&m_prefill, &ComposeReplyPrefill::replyDraftReady, this, | |
| 36 |
1/1✓ Branch 37 → 38 taken 795 times.
|
795 | &QuickComposeBackend::replyDraftReady); |
| 37 | 1590 | } | |
| 38 | |||
| 39 | // The compose part of AccountSession::accountsLoaded: nothing account-bound | ||
| 40 | // is cached here any more (sessions carry their identity, the outbox its | ||
| 41 | // account). | ||
| 42 | 793 | void QuickComposeBackend::resetForAccountReload() {} | |
| 43 | |||
| 44 | // The compose part of QuickMailBackend::selectAccount() after the switch | ||
| 45 | // was accepted. | ||
| 46 | 7 | void QuickComposeBackend::resetForAccountSwitch() { | |
| 47 | 7 | cancelReplyDraft(); | |
| 48 | // The superseded appends belong to the previous account: its Drafts UIDs | ||
| 49 | // are nothing to delete on this one's connection. | ||
| 50 | 7 | m_supersededDraftTokens.clear(); | |
| 51 | 7 | } | |
| 52 | |||
| 53 | // The start of ~QuickMailBackend(): what waits in its undo window leaves now | ||
| 54 | // (D-20, the user pressed Send) and the reply source pool stops. The open | ||
| 55 | // sessions saved themselves (saveAll on quit). | ||
| 56 | 795 | void QuickComposeBackend::shutdown() { | |
| 57 | 795 | flushOutboxOnQuit(); | |
| 58 | 795 | m_prefill.shutdown(); | |
| 59 | 795 | } | |
| 60 |