mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-10-18 17:24:01 -04:00
@@ -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
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user