calendar: add default task list setting for dash quick-add

fixes #3134
This commit is contained in:
bbedward
2026-08-27 14:57:16 -04:00
parent b97c9b0b9a
commit 48e4709eb5
5 changed files with 58 additions and 1 deletions
+1
View File
@@ -228,6 +228,7 @@ Singleton {
property int firstDayOfWeek: -1
property bool showWeekNumber: false
property string calendarBackend: "auto"
property string defaultTaskCalendarId: ""
property string clockFormat: "auto"
readonly property bool localeUses24Hour: {
const fmt = Qt.locale().timeFormat(Locale.ShortFormat).replace(/'[^']*'/g, "");
@@ -78,6 +78,7 @@ var SPEC = {
firstDayOfWeek: { def: -1 },
showWeekNumber: { def: false },
calendarBackend: { def: "auto" },
defaultTaskCalendarId: { def: "" },
clockFormat: { def: "auto", onChange: "markGreeterSyncPending" },
showSeconds: { def: false, onChange: "markGreeterSyncPending" },
padHours12Hour: { def: false, onChange: "markGreeterSyncPending" },
@@ -166,6 +166,26 @@ Item {
}
}
SettingsDropdownRow {
tab: "time"
tags: ["calendar", "tasks", "list", "default", "caldav", "todo"]
settingKey: "defaultTaskCalendarId"
visible: CalendarService.isDankActive && _taskLists.length > 0
text: I18n.tr("Default Task List")
description: I18n.tr("Task list used when adding tasks from the dash calendar")
readonly property var _taskLists: (CalendarService.calendars || []).filter(c => c.holdsTasks && !c.readOnly && !c.hidden)
readonly property var _labels: [I18n.tr("Auto")].concat(_taskLists.map(c => c.name))
options: _labels
currentValue: {
const idx = _taskLists.findIndex(c => c.id === SettingsData.defaultTaskCalendarId);
return idx >= 0 ? _labels[idx + 1] : I18n.tr("Auto");
}
onValueChanged: value => {
const idx = _labels.indexOf(value);
SettingsData.set("defaultTaskCalendarId", idx > 0 ? _taskLists[idx - 1].id : "");
}
}
Rectangle {
width: parent.width
height: 1
+10 -1
View File
@@ -573,7 +573,16 @@ Item {
function defaultTaskCalendar() {
const writable = taskCalendars().filter(c => !c.hidden);
return writable.length > 0 ? writable[0] : null;
if (writable.length === 0)
return null;
const preferred = SettingsData.defaultTaskCalendarId;
if (preferred) {
for (let i = 0; i < writable.length; i++) {
if (writable[i].id === preferred)
return writable[i];
}
}
return writable[0];
}
function _taskAsEvent(t) {
@@ -494,6 +494,32 @@
],
"icon": "calendar_today"
},
{
"section": "defaultTaskCalendarId",
"label": "Default Task List",
"tabIndex": 1,
"category": "Time & Weather",
"keywords": [
"adding",
"caldav",
"calendar",
"clock",
"dash",
"date",
"day",
"default",
"forecast",
"list",
"month",
"task",
"tasks",
"time",
"todo",
"weather",
"year"
],
"description": "Task list used when adding tasks from the dash calendar"
},
{
"section": "weatherEnabled",
"label": "Enable Weather",