Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 61 additions & 1 deletion config/Config.qml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import "defaults/prefix.js" as PrefixDefaults
import "defaults/system.js" as SystemDefaults
import "defaults/dock.js" as DockDefaults
import "defaults/ai.js" as AiDefaults
import "defaults/calendar.js" as CalendarDefaults
import "ConfigValidator.js" as ConfigValidator

Singleton {
Expand Down Expand Up @@ -55,9 +56,10 @@ Singleton {
property bool systemReady: false
property bool dockReady: false
property bool aiReady: false
property bool calendarReady: false
property bool keybindsInitialLoadComplete: false

property bool initialLoadComplete: themeReady && barReady && workspacesReady && overviewReady && notchReady && compositorReady && performanceReady && weatherReady && desktopReady && lockscreenReady && prefixReady && systemReady && dockReady && aiReady
property bool initialLoadComplete: themeReady && barReady && workspacesReady && overviewReady && notchReady && compositorReady && performanceReady && weatherReady && desktopReady && lockscreenReady && prefixReady && systemReady && dockReady && aiReady && calendarReady

// Compatibility aliases
property alias loader: themeLoader
Expand Down Expand Up @@ -1184,6 +1186,58 @@ Singleton {
}
}

// ============================================
// CALENDAR MODULE
// ============================================
FileView {
id: calendarLoader
path: root.configDir + "/calendar.json"
atomicWrites: true
watchChanges: true
onLoaded: {
if (!root.calendarReady) {
validateModule("calendar", calendarLoader, CalendarDefaults.data, () => {
root.calendarReady = true;
});
}
}
onLoadFailed: {
if (error.toString().includes("FileNotFound") && !root.calendarReady) {
handleMissingConfig("calendar", calendarLoader, CalendarDefaults.data, () => {
root.calendarReady = true;
});
}
}
onFileChanged: {
root.pauseAutoSave = true;
reload();
root.pauseAutoSave = false;
}
onPathChanged: reload()
onAdapterUpdated: {
if (root.calendarReady && !root.pauseAutoSave) {
calendarLoader.writeAdapter();
}
}

adapter: JsonAdapter {
property bool enabled: true
property int syncInterval: 15
property bool notifications: true
property bool barIndicator: true
property bool barShowNextEvent: false
property int defaultReminder: 15
property string googleClientId: ""
property string googleClientSecret: ""
property list<var> accounts: []
property var calendars: ({})
property bool soundOnArrival: true
property bool blinkOnArrival: true
property string arrivalSoundPath: ""
property bool barAlwaysShow: false
}
}

// Keybinds (binds.json)
// Timer to repair keybinds after initial load
Timer {
Expand Down Expand Up @@ -3150,6 +3204,9 @@ Singleton {
// AI configuration
property QtObject ai: aiLoader.adapter

// Calendar configuration
property QtObject calendar: calendarLoader.adapter

// Module save functions
function saveBar() {
barLoader.writeAdapter();
Expand Down Expand Up @@ -3193,6 +3250,9 @@ Singleton {
function saveAi() {
aiLoader.writeAdapter();
}
function saveCalendar() {
calendarLoader.writeAdapter();
}

// Color helpers
function isHexColor(colorValue) {
Expand Down
18 changes: 18 additions & 0 deletions config/defaults/calendar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.pragma library

var data = {
"enabled": true,
"syncInterval": 15,
"notifications": true,
"barIndicator": true,
"barShowNextEvent": false,
"defaultReminder": 15,
"soundOnArrival": true,
"arrivalSoundPath": "",
"blinkOnArrival": true,
"barAlwaysShow": false,
"googleClientId": "",
"googleClientSecret": "",
"accounts": [],
"calendars": {}
}
Loading