summaryrefslogtreecommitdiffstats
path: root/src/config.cpp
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-08-03 09:28:33 +0200
committerDanilo M. <danix@danix.xyz>2026-08-03 09:28:33 +0200
commit3ee73d48c9d819b2e186655b7ba86ebc2a961baf (patch)
tree1e5b9c45ef7a83c50fe47eba7adf4bde0a5f5c39 /src/config.cpp
parent633ae0c09a4a3bb1cfdf15b36328d8e2ced55d30 (diff)
downloadqtmaildir-3ee73d48c9d819b2e186655b7ba86ebc2a961baf.tar.gz
qtmaildir-3ee73d48c9d819b2e186655b7ba86ebc2a961baf.zip
fix: only interrupt startup for real configuration problems
Found while walking the task 13 checklist against real mail. Item 1 ("startup shows no configuration warnings with a valid config") failed: with a perfectly valid config that simply had no [sync] command, every launch opened a blocking modal that had to be dismissed before the window could be used. Config now separates the two cases. A problem is something configured but wrong (a sync command that does not exist, an account with no maildir); those still open a dialog, as does every KeyMap warning, since each one means a binding the user wrote is being ignored. A notice is an optional feature simply not being configured; it reports to the status bar only. Nothing is broken in that case, and a modal on every launch teaches the user to dismiss dialogs unread, which defeats the ones that matter. problems() is a subset of warnings(), so callers wanting everything need only the latter. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'src/config.cpp')
-rw-r--r--src/config.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/config.cpp b/src/config.cpp
index b12130d..0253a74 100644
--- a/src/config.cpp
+++ b/src/config.cpp
@@ -19,6 +19,17 @@ QString Config::defaultPath()
return base + QStringLiteral("/qtmaildir/qtmaildir.conf");
}
+void Config::addProblem(const QString &message)
+{
+ m_warnings.append(message);
+ m_problems.append(message);
+}
+
+void Config::addNotice(const QString &message)
+{
+ m_warnings.append(message);
+}
+
void Config::load(const QString &path)
{
QSettings settings(path, QSettings::IniFormat);
@@ -28,10 +39,12 @@ void Config::load(const QString &path)
m_syncCommand = settings.value(QStringLiteral("sync/command")).toString();
if (m_syncCommand.isEmpty()) {
- m_warnings.append(QStringLiteral(
+ // Not a problem: sync is optional, and nothing the user asked for is
+ // being ignored. A modal here would fire on every launch.
+ addNotice(QStringLiteral(
"No sync command configured ([sync] command); syncing is disabled."));
} else if (!QFileInfo::exists(m_syncCommand.split(QLatin1Char(' ')).first())) {
- m_warnings.append(
+ addProblem(
QStringLiteral("Sync command '%1' does not exist; syncing is disabled.")
.arg(m_syncCommand));
m_syncCommand.clear();
@@ -61,7 +74,7 @@ void Config::load(const QString &path)
settings.endGroup();
if (!account.isValid()) {
- m_warnings.append(
+ addProblem(
QStringLiteral("Account '%1' has no maildir; ignoring it.")
.arg(account.key));
continue;