feat: Add toggle for calendar event display

This commit is contained in:
loner
2025-10-21 20:33:39 +08:00
parent 95faefa8eb
commit dea916617a
5 changed files with 24 additions and 2 deletions
+4
View File
@@ -626,6 +626,10 @@
"week-numbers": {
"label": "Show week numbers",
"description": "Displays the week of the year (e.g., Week 38) in the calendar."
},
"show-events": {
"label": "Show calendar events",
"description": "Display events in the calendar panel."
}
}
},
+1
View File
@@ -202,6 +202,7 @@ Singleton {
property bool useFahrenheit: false
property bool use12hourFormat: false
property bool showWeekNumberInCalendar: false
property bool showCalendarEvents: true
}
// screen recorder
+2 -1
View File
@@ -561,7 +561,7 @@ NPanel {
// Event indicator dots
Row {
visible: parent.parent.parent.parent.parent.hasEventsOnDate(model.year, model.month, model.day)
visible: Settings.data.location.showCalendarEvents && parent.parent.parent.parent.parent.hasEventsOnDate(model.year, model.month, model.day)
spacing: 2
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
@@ -587,6 +587,7 @@ NPanel {
MouseArea {
anchors.fill: parent
hoverEnabled: true
enabled: Settings.data.location.showCalendarEvents
onEntered: {
const events = parent.parent.parent.parent.parent.getEventsForDate(model.year, model.month, model.day)
+7
View File
@@ -117,6 +117,13 @@ ColumnLayout {
checked: Settings.data.location.showWeekNumberInCalendar
onToggled: checked => Settings.data.location.showWeekNumberInCalendar = checked
}
NToggle {
label: I18n.tr("settings.location.date-time.show-events.label")
description: I18n.tr("settings.location.date-time.show-events.description")
checked: Settings.data.location.showCalendarEvents
onToggled: checked => Settings.data.location.showCalendarEvents = checked
}
}
NDivider {
+10 -1
View File
@@ -92,7 +92,11 @@ Singleton {
// Core functions
function checkAvailability() {
availabilityCheckProcess.running = true
if (Settings.data.location.showCalendarEvents) {
availabilityCheckProcess.running = true
} else {
root.available = false
}
}
function loadCalendars() {
@@ -100,6 +104,11 @@ Singleton {
}
function loadEvents(daysAhead = 31, daysBehind = 14) {
if (!Settings.data.location.showCalendarEvents) {
root.loading = false
root.events = []
return
}
if (loading)
return