1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-07 14:05:38 -05:00

Implement calendar events with khal

This commit is contained in:
bbedward
2025-07-12 13:26:09 -04:00
parent 095606f6e9
commit 8a2b81aafb
8 changed files with 876 additions and 34 deletions

View File

@@ -80,7 +80,69 @@ PanelWindow {
anchors.verticalCenter: parent.verticalCenter
}
Item { width: parent.width - 200; height: 1 }
Item { width: parent.width - 300; height: 1 }
// Calendar status indicator
Rectangle {
width: 100
height: 24
radius: Theme.cornerRadiusSmall
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.16)
anchors.verticalCenter: parent.verticalCenter
visible: CalendarService && CalendarService.khalAvailable
Row {
anchors.centerIn: parent
spacing: Theme.spacingXS
Text {
text: "event"
font.family: Theme.iconFont
font.pixelSize: Theme.iconSize - 6
color: Theme.primary
anchors.verticalCenter: parent.verticalCenter
}
Text {
id: todayEventsText
property var todayEvents: []
text: todayEvents.length === 0 ? "No events today" :
todayEvents.length === 1 ? "1 event today" :
todayEvents.length + " events today"
function updateTodayEvents() {
if (CalendarService && CalendarService.khalAvailable) {
todayEvents = CalendarService.getEventsForDate(new Date())
} else {
todayEvents = []
}
}
Component.onCompleted: {
console.log("ControlCenter: Calendar status text initialized, CalendarService available:", !!CalendarService)
if (CalendarService) {
console.log("ControlCenter: khal available:", CalendarService.khalAvailable)
}
updateTodayEvents()
}
font.pixelSize: Theme.fontSizeXS
color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter
// Update when events change or khal becomes available
Connections {
target: CalendarService
enabled: CalendarService !== null
function onEventsByDateChanged() {
todayEventsText.updateTodayEvents()
}
function onKhalAvailableChanged() {
todayEventsText.updateTodayEvents()
}
}
}
}
}
}
// Tab buttons