diff options
| author | Danilo M. <danix@danix.xyz> | 2026-08-24 21:57:28 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-08-24 21:57:28 +0200 |
| commit | b7f2a4e0f8858b1aa0d86755ebab6826306f3eff (patch) | |
| tree | 542934c034716b69b15258bf06e491798408af84 /src/composewindow.cpp | |
| parent | f6ceeacad8e1fe15c30db66dcfde8efa9dfb4758 (diff) | |
| download | qtmaildir-b7f2a4e0f8858b1aa0d86755ebab6826306f3eff.tar.gz qtmaildir-b7f2a4e0f8858b1aa0d86755ebab6826306f3eff.zip | |
fix(drafts): index a saved draft so it appears without a sync
Autosave writes the draft to the Maildir drafts folder and stops, while
the Drafts view is a notmuch path: query, so a freshly saved draft was
invisible until notmuch new ran. saveDraftNow() now emits draftSaved, and
MainWindow connects it to a new NotmuchWorker::indexDraftFile() that
indexes the one file the way moveMessages() does, with the previous
revision removed so a rewrite leaves no ghost.
The send path unlinks a draft that was indexed while being composed, so
draftRemoved -> removeIndexedFile() drops its entry too.
Measured: notmuch_database_index_file assigns NO tags (unlike notmuch
new, which adds draft inbox unread), so no tag-stripping is needed and the
draft cannot leak into a tag:inbox view.
Item 158.
Diffstat (limited to 'src/composewindow.cpp')
| -rw-r--r-- | src/composewindow.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/composewindow.cpp b/src/composewindow.cpp index d781e52..c35bb5d 100644 --- a/src/composewindow.cpp +++ b/src/composewindow.cpp @@ -1018,6 +1018,7 @@ bool ComposeWindow::saveDraftNow() const QString folder = QDir(m_mailRoot).absoluteFilePath( account.maildir + QLatin1Char('/') + account.drafts); + const QString previousPath = m_draftPath; const DraftStore::Result written = DraftStore::write(folder, built.bytes, QStringLiteral("D"), m_draftPath); @@ -1038,6 +1039,10 @@ bool ComposeWindow::saveDraftNow() m_dirty = false; m_saveFailed = false; m_banner->hide(); + + // The write is done and the previous revision already unlinked; hand both + // paths up so the owner indexes the new one and drops the old (item 158). + emit draftSaved(written.path, previousPath); return true; } @@ -1200,6 +1205,7 @@ void ComposeWindow::send() dialog->setStage(SendDialog::Stage::RemovingDraft); if (!m_draftPath.isEmpty()) { QFile::remove(m_draftPath); + emit draftRemoved(m_draftPath); m_draftPath.clear(); } |
