create and delete events

This commit is contained in:
LubuWest 2022-11-15 22:02:09 +01:00
commit 400241ec6a
34 changed files with 1346 additions and 614 deletions

View file

@ -39,10 +39,7 @@ import "qrc:/qml/calendarqml"
Rectangle{
id:eventList
// height: parent.height
// width:parent.width
color: Material.backgroundColor
//radius: 0.5*mm
property var daylist:[]
property int dayint: 0
property var events:[]
@ -56,6 +53,37 @@ Rectangle{
text: "\uf057"
onClicked:{rootstackView.pop()}
}
MButton{
id: createNewEvent
anchors.top: parent.top
anchors.topMargin: 1*mm
anchors.right:closeButton.left
anchors.rightMargin:mm
width: 2*root.fontFactor*osSettings.bigFontSize;
text:"+"
onClicked: {
rootstackView.push("qrc:/qml/calendarqml/EventCreate.qml",{"startDate": new Date(dayint*86400000)})
}
}
Dialog {
id: deleteDialog
anchors.centerIn: parent
property int eventid:0
title: qsTr("Delete Event?")
standardButtons: Dialog.Ok | Dialog.Cancel
modal: true
onAccepted: {//print("event.id"+event.id);
xhr.setUrl(login.server);
xhr.setLogin(login.username+":"+Qt.atob(login.password));
xhr.setApi("/api/friendica/event_delete");
xhr.clearParams();
xhr.setParam("id",eventid);
xhr.post();
}
onRejected: {print("eventid "+eventid);close()}
}
ListView {
id: eventlistView
y:closeButton.height+2*mm
@ -65,11 +93,9 @@ Rectangle{
model: eventModel
delegate: EventListItem{}
}
ListModel{
id: eventModel
}
Component.onCompleted:{
var currentevents=events.filter(event=>(dayint>=event.startday)&&(dayint<=event.endday));
for (var i=0; i<currentevents.length;i++){