aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mainwindow.cpp21
-rw-r--r--src/mainwindow.h20
2 files changed, 38 insertions, 3 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index df7062d..1da9ac7 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -3638,7 +3638,7 @@ void MainWindow::markAllRead()
description);
m_undoStack.push(command);
- showTransientStatus(
+ announceAction(
tr("%1: %n thread(s)", "", threadIds.size()).arg(description));
}
@@ -5198,6 +5198,21 @@ void MainWindow::onExternalSyncStateChanged(SyncMonitor::State state)
}
+void MainWindow::announceAction(const QString &text)
+{
+ if (!aSyncHoldsTheWriteLock()) {
+ showTransientStatus(text);
+ return;
+ }
+
+ // Not showTransientStatus(): this describes state that lasts until the
+ // sync ends. The hold branch that queued the edit set the same kind of
+ // label and this replaces it, naming the action it was silent about.
+ m_statusLabel->setText(
+ tr("%1, waiting for the running sync to finish").arg(text));
+ m_statusTimer->stop();
+}
+
void MainWindow::showTransientStatus(const QString &text)
{
m_transientMessage = text;
@@ -5843,7 +5858,7 @@ void MainWindow::tagSelected(const QStringList &add, const QStringList &remove,
// dialog CLAUDE.md rules out: undo is the safety net, and undo is only
// usable if the user can tell that something larger than they meant has
// just happened.
- showTransientStatus(
+ announceAction(
scope.wholeThread
? tr("%1: %n message(s) (whole thread)", "", scope.messageCount)
.arg(description)
@@ -6101,7 +6116,7 @@ void MainWindow::trashMessages(const QStringList &messageIds,
tr("Delete"), false, wholeThreadIds);
}
- showTransientStatus(
+ announceAction(
tr("%1: %n message(s)", "", messageCount).arg(tr("Delete")));
}
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 1f68733..2b217d2 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -680,6 +680,26 @@ private slots:
/// drive it through the meta-object.
void showTransientStatus(const QString &text);
+ /// Announces an action that has just been sent, saying so when a sync is
+ /// holding it rather than claiming it landed.
+ ///
+ /// Item 182. The three hold branches set a deliberately NON-transient label
+ /// explaining that the change will be applied when the sync finishes, and
+ /// every caller overwrote it a line later with the bare action, which
+ /// claims a write that has not happened. The user then saw the same work
+ /// reported again by flushHeldEdits() and read it as double reporting.
+ ///
+ /// The action is still named, because that announcement is what stands in
+ /// for the confirmation dialog this project rules out: it is how a user
+ /// tells that something larger than they meant has just happened. So the
+ /// hold is ADDED to it rather than replacing it.
+ ///
+ /// Held text is not transient, for the reason the hold branches give: it
+ /// describes state lasting until the sync ends, and a message that expired
+ /// would leave rows showing a tag the database has not got and no
+ /// explanation of why.
+ void announceAction(const QString &text);
+
/// Reacts to a sync started outside this window, by cron or by hand.
///
/// A private slot rather than a plain method so tests can drive it through