From 99709c65f674385d6fbe9da53fe91c5f6a715880 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Sun, 9 Aug 2026 11:06:16 +0200 Subject: fix(config): report an out-of-range message_zoom The documented 0.5 to 3.0 range was already enforced, by MessageView::clampZoom(), so message_zoom = 500 rendered at 3.0 rather than unusably. What was missing is the report: the key parses, so nothing ever told the user that the value in their file is not the value on screen. Reported rather than clamped a second time. MessageView owns the bounds and does the work; a copy of the range in Config would be free to drift from the one that matters, so config.cpp reports against kMinZoom and kMaxZoom directly. This is where it differs from toolbar_icon_size, which has no widget-side enforcement to defer to. Backlog item 58, whose recorded cause was wrong on this point and has been corrected in place. --- src/config.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'src/config.cpp') diff --git a/src/config.cpp b/src/config.cpp index b54d5c6..4f5831c 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -19,6 +19,9 @@ #include "config.h" #include "mailsync.h" +// For kMinZoom/kMaxZoom. The bounds live with the widget that enforces them, +// so this reports the same numbers rather than keeping a second copy. +#include "messageview.h" #include #include @@ -76,8 +79,8 @@ void Config::load(const QString &path) // Absent is fine and silent: the default is 1.0. Present but unparseable // is a problem, since the user asked for something and is not getting it. - // The range check lives in MessageView::clampZoom(), the one place that - // knows what the web view can render. + // The range is enforced by MessageView::clampZoom(), the one place that + // knows what the web view can render; out of range is reported below. // Empty is treated as unset rather than as "a query named nothing". const QString startup = settings.value(QStringLiteral("startup_query")).toString().trimmed(); @@ -92,6 +95,18 @@ void Config::load(const QString &path) const double value = zoom.toString().toDouble(&ok); if (ok) { m_messageZoom = value; + // Reported, not clamped: MessageView::clampZoom() owns the bounds + // and already stops this reaching the web view, so clamping here + // too would be a second copy of the range, free to drift from the + // first. What was missing is the report. The value parses, so + // nothing ever said the 500 in the file is not what is on screen. + if (value < MessageView::kMinZoom || value > MessageView::kMaxZoom) { + addProblem(QStringLiteral("Message zoom %1 is outside %2 to %3; " + "using the nearest allowed value.") + .arg(value) + .arg(MessageView::kMinZoom) + .arg(MessageView::kMaxZoom)); + } } else { addProblem(QStringLiteral("Message zoom '%1' is not a number; " "using the default.") -- cgit v1.2.3