Move Calendar to its own view

This commit is contained in:
Vyn 2025-06-17 17:03:07 +02:00
parent a03e71890c
commit d26f2f5a9f
Signed by: vyn
GPG key ID: E1B2BE34E7A971E7
19 changed files with 407 additions and 137 deletions

View file

@ -3,6 +3,8 @@ import { VCheckBox, VButton, VActionButton, Svg, VTag, VPopupIconMenu, VText, Pa
import { Utils } from "../shared/Utils.slint";
export struct CalendarDayEvent {
sourceId: int,
id: int,
title: string,
startsAt: Time,
endsAt: Time
@ -28,7 +30,12 @@ export component Calendar inherits Rectangle {
private property <length> available-day-space: self.height - header-height;
private property <length> day-start-y: header-height;
private property <length> hour-spacing: available-day-space / 24;
background: Palette.pane;
private property <int> contextMenuEventSourceId: -1;
callback delete-event-request(source-id: int, event-id: int);
HorizontalLayout {
Rectangle {
@ -58,6 +65,7 @@ export component Calendar inherits Rectangle {
}
Rectangle {
min-width: 400px;
//background: green;
HorizontalLayout {
for day[day-index] in root.days: Rectangle {
@ -113,6 +121,40 @@ export component Calendar inherits Rectangle {
}
}
}
eventActionsPopup := VPopupIconMenu {
//VActionButton {
//icon-svg: Svg.pen;
//icon-colorize: Colors.grey;
//icon-size: 1.5rem;
//border-radius: 0;
//clicked => {
//taskEdit.show({
//title: title,
//date: date
//});
//}
//}
VActionButton {
icon-svg: Svg.trash;
icon-colorize: Colors.pink;
icon-size: 1.5rem;
border-radius: 0;
clicked => {
delete-event-request(event.sourceId, event.id);
}
}
}
ta := TouchArea {
pointer-event(e) => {
if (e.button == PointerEventButton.right && e.kind == PointerEventKind.up) {
debug(ta.mouse-x, " ", ta.mouse-y);
eventActionsPopup.show(ta.mouse-x, ta.mouse-y);
}
}
}
}
}
}