summaryrefslogtreecommitdiffstats
path: root/src/config.cpp
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-09-24 16:38:45 +0200
committerDanilo M. <danix@danix.xyz>2026-09-24 16:38:45 +0200
commit0ac517403ead1135bc5fe0e05c2b8b00382052ae (patch)
tree0112695473880aa173d5eb49928f15e23ce6e8f0 /src/config.cpp
parent4818cf555141d83b0d8414c86c3b7aef26286dd3 (diff)
downloadqtmaildir-0ac517403ead1135bc5fe0e05c2b8b00382052ae.tar.gz
qtmaildir-0ac517403ead1135bc5fe0e05c2b8b00382052ae.zip
feat: read the calendar's config keys
Diffstat (limited to 'src/config.cpp')
-rw-r--r--src/config.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/config.cpp b/src/config.cpp
index 3cd842b..23c08f7 100644
--- a/src/config.cpp
+++ b/src/config.cpp
@@ -272,6 +272,42 @@ void Config::load(const QString &path)
}
}
+ // Item 206. The same shape as contacts_dir: absent or blank is the feature
+ // off, silently; set and missing is reported and kept, since a vdirsyncer
+ // target may not exist before its first run.
+ const QString calendarsDir =
+ settings.value(QStringLiteral("calendars_dir")).toString().trimmed();
+ if (!calendarsDir.isEmpty()) {
+ m_calendarsDir = expandTilde(calendarsDir);
+ if (!QFileInfo::exists(m_calendarsDir)) {
+ addProblem(tr("Calendars directory '%1' does not exist; the "
+ "calendar will be empty.").arg(m_calendarsDir));
+ }
+ }
+ m_defaultCalendar =
+ settings.value(QStringLiteral("default_calendar")).toString().trimmed();
+
+ // An unquoted value holding a comma reaches here as a QStringList, whose
+ // toString() is empty; join it back rather than silently losing the
+ // command. Absent keeps the default; present and blank disables.
+ const QVariant calSync = settings.value(QStringLiteral("calendar_sync_command"));
+ if (calSync.isValid()) {
+ m_calendarSyncCommand = calSync.typeId() == QMetaType::QStringList
+ ? calSync.toStringList().join(QLatin1Char(','))
+ : calSync.toString();
+ m_calendarSyncCommand = m_calendarSyncCommand.trimmed();
+ }
+ const QVariant calDelay = settings.value(QStringLiteral("calendar_sync_delay_ms"));
+ if (calDelay.isValid()) {
+ bool ok = false;
+ const int value = calDelay.toString().toInt(&ok);
+ if (ok && value >= 0)
+ m_calendarSyncDelayMs = value;
+ else
+ addProblem(tr("Calendar sync delay '%1' is not a number; using the default.")
+ .arg(calDelay.toString()));
+ }
+
// 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 is enforced by MessageView::clampZoom(), the one place that