dotfiles bugabingas dorkfiles
owned by bugabinga
README Source History Refs Compare Notes Search caldav: setup form and keyring-backed saveSetup 79c02f542e7d1b466bedf82a50b6ebd97af97265
Oliver Jan Krylow <oliver@bugabinga.net > · 28 Jun 2026
unsigned
Browse files Compare with HEAD
Task 10: when the service has no usable config (status needs-setup), the
clock popout shows a setup form instead of the calendar — URL, username,
app-password fields and a Speichern button. saveSetup persists the
non-secret url+username, then stores the password in gnome-keyring via
'secret-tool store', feeding the secret over stdin (printf is a shell
builtin, so it never reaches argv/ps) with the password travelling QML->sh
only as a transient env var. On keyring failure the error surfaces in the
form via secretError; on success it discovers calendars and fetches.
Verified live: empty-field validation, password stored to keyring and
read back, no password in process argv, form layout, and no regression
(status ok, 155 events, selfTest 6/6, JS tests pass).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Changed files (2) quickshell/nuguland/CalDav.qml Modified 33 33 backend:
"CalDav.qml" , 36 + secretError: secretError
, 37 38 username: config
? config.username
: "" , 38 39 calendarCount: config
&& config.calendars
? config.calendars.length
: 0 , 213 214 root.stale
= false ;
216 - function saveSetup (url, username, password) {}
218 + property string secretError:
"" 223 + function saveSetup (url, username, password) {
224 + root.secretError
= "" ;
225 + const u
= String (url
|| "" ).trim().replace(
/\/ +$ / ,
"" );
226 + const user
= String (username
|| "" ).trim();
227 + if (
! u
|| ! user
|| ! password) { root.secretError
= "URL, Benutzer und Passwort nötig" ;
return ; }
228 + const m
= / ^ https ? :\/\/([ ^ \/:] + )/ .exec(u);
229 + const h
= m
? m[
1 ]
: "" ;
230 + if (
! h) { root.secretError
= "URL ungültig (https://… erwartet)" ;
return ; }
231 + root.config.url
= u;
232 + root.config.username
= user;
233 + root.config.calendars
= [];
234 + root.persistConfig();
235 + root.status
= "loading" ;
237 + command: [
"sh" ,
"-c" , root.storeScript()],
238 + environment: { CALDAV_HOST: h, CALDAV_USER: user, CALDAV_NEWPW:
String (password) }
242 + function storeScript () {
243 + return 'printf %s "$CALDAV_NEWPW" | secret-tool store --label="nuguland caldav" service caldav host "$CALDAV_HOST" account "$CALDAV_USER"' ;
227 255 stderr:
StdioCollector { waitForEnd:
true ; onStreamFinished:
if (this.text.trim()) { root.stale
= true ;
if (root.status
=== "loading" ) root.status
= "offline" ; } }
260 + stderr : StdioCollector {
waitForEnd :
true ;
onStreamFinished :
if (this.text.trim()) root.secretError
= this.text.trim() }
261 + onExited : (code, status)
=> {
262 + if (code
=== 0 ) { root.secretError
= "" ; root.discoverAndFetch(); }
263 + else { root.status
= "needs-setup" ;
if (
! root.secretError) root.secretError
= "Keyring-Fehler (" + code
+ ")" ; }
231 268 interval :
15 * 60 * 1000 quickshell/nuguland/PopoutHost.qml Modified 266 266 property var days: calendar.weeks
? [].concat.apply([], calendar.weeks)
: []
268 + readonly property bool setupMode: root.caldavService
&& root.caldavService.status
=== "needs-setup" 270 272 readonly property
var caldavEvents: root.caldavService
? root.caldavService.events
: []
338 + visible :
! clockCol.setupMode
365 + visible :
! clockCol.setupMode
362 366 width : monthGrid.width
363 367 height : monthGrid.height
468 + visible :
! clockCol.setupMode
464 469 width : parent
? parent.width
: 0 521 + visible : clockCol.setupMode
522 + width : parent
? parent.width
: 0 525 + component
Field : Rectangle {
526 + property alias
field : ti
527 + property string
placeholder :
"" 528 + property bool
secret :
false 530 + width : setupForm.width
533 + color : root.theme
? root.theme.withAlpha(root.theme.ui.minor,
0.14 )
: "transparent" 538 + anchors.fill: parent
539 + anchors.leftMargin:
10 540 + anchors.rightMargin:
10 541 + verticalAlignment :
TextInput .AlignVCenter
542 + color : root.theme
? root.theme.content.normal
: "white" 543 + selectionColor : root.theme
? root.theme.ui.focus
: "#ffffff" 544 + selectedTextColor : root.theme
? root.theme.content.backdrop
: "black" 545 + font.family:
"IBM Plex Sans" 547 + echoMode : parent.secret
? TextInput .Password
: TextInput .Normal
552 + anchors.left: parent.left
553 + anchors.leftMargin:
10 554 + anchors.verticalCenter: parent.verticalCenter
555 + visible : ti.text.length
=== 0 558 + text : parent.placeholder
566 + text :
"CalDAV einrichten" 572 + placeholder :
"https://host/remote.php/dav" 578 + placeholder :
"Benutzername" 584 + placeholder :
"App-Passwort" 589 + width : parent.width
592 + color : root.theme
? root.theme.withAlpha(root.theme.ui.accent,
0.2 )
: "transparent" 595 + anchors.centerIn: parent
602 + anchors.fill: parent
603 + cursorShape :
Qt .PointingHandCursor
604 + onClicked :
if (root.caldavService) root.caldavService.saveSetup(urlField.field.text, userField.field.text, pwField.field.text)
610 + visible : root.caldavService
&& root.caldavService.secretError.length
> 0 613 + color : root.theme
? root.theme.error
: "red" 614 + text : root.caldavService
? root.caldavService.secretError
: ""