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

@ -35,9 +35,9 @@ import QtQuick.Controls.Material 2.12
Item {
id: calendarDay
width: root.fontFactor*osSettings.bigFontSize*2//5*mm
height: root.fontFactor*osSettings.bigFontSize*2//5*mm
property int dateInt: Math.floor(Date.parse(model.date)/86400000) //Math.floor((Date.parse(model.date)-(new Date().getTimezoneOffset() * 60 * 1000))/86400000)
width: root.fontFactor*osSettings.bigFontSize*2
height: root.fontFactor*osSettings.bigFontSize*2
property int dateInt: Math.floor(model.date.valueOf()/86400000)
Rectangle {
id: placeHolder
color: model.today?'lightblue':'transparent';
@ -68,10 +68,8 @@ Item {
}
MouseArea {
anchors.fill: calendarDay
onClicked: {rootstackView.push("qrc:/qml/calendarqml/EventList.qml",{"dayint": dateInt,"events":events});
// var component = Qt.createComponent("qrc:/qml/calendarqml/EventList.qml");
// if (component.status== Component.Ready){
// var eventlist = component.createObject(calendartab,{"dayint": dateInt})}
onClicked: {
rootstackView.push("qrc:/qml/calendarqml/EventList.qml",{"dayint": dateInt,"events":events});
}
}
}

View file

@ -30,7 +30,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import QtQuick.Controls 2.12
import QtQuick.Controls 2.15
import QtQuick.Controls.Material 2.12
import QtQml 2.2
import Qt.labs.calendar 1.0
@ -42,7 +42,7 @@ import "qrc:/qml/genericqml"
Rectangle {
id:calendarrectangle
// y:1
// y:1
width:parent.width
height:parent.height
color: Material.backgroundColor
@ -53,21 +53,21 @@ Rectangle {
function showEvents(friend){
if(friend=="backButton"){Service.eventsfromdb(db,login.username,function(eventArray,dayArray){
events=eventArray;
events=cleanEvents(eventArray);
eventdays=dayArray})
}
else if (friend!=""){
calendartab.calendartabstatus=friend.url.substring(friend.url.lastIndexOf("/")+1,friend.url.length)
calendartab.calendartabstatus=friend.url.substring(friend.url.lastIndexOf("/")+1,friend.url.length)
Service.newRequestFriendsEvents(login,friend,calendartab,function(eventArray,dayArray){
events=eventArray;
eventdays=dayArray})
events=cleanEvents(eventArray);
eventdays=dayArray})
}
else {calendartab.calendartabstatus="Events";
Service.eventsfromdb(db,login.username,function(eventArray,dayArray){
events=eventArray;
events=cleanEvents(eventArray);
eventdays=dayArray;
calBusy.running=false
var currentevents=events;
var currentevents=events.filter(event=>(currentTime<=event.end));
for (var i=0; i<Math.min(5,currentevents.length);i++){
var liststate="";
@ -77,15 +77,23 @@ Rectangle {
}
}
function cleanEvents(events){
for (var item in events){
events[item].start=events[item].start-offsetTime;
if(events[item].end>0){events[item].end=events[item].end-offsetTime};
}
return events
}
BusyIndicator{
id: calBusy
anchors.horizontalCenter: calendarView.horizontalCenter
anchors.top:calendarView.top
anchors.topMargin: 2*mm
width:10*mm
height: 10*mm
running: false
}
id: calBusy
anchors.horizontalCenter: calendarView.horizontalCenter
anchors.top:calendarView.top
anchors.topMargin: 2*mm
width:10*mm
height: 10*mm
running: false
}
BlueButton{
z:2
@ -127,12 +135,56 @@ Rectangle {
}}
Connections{
target: updatenews
target: updatenews
function onSuccess(api){
calBusy.running=false;
showEvents("")
}
function onSuccess(api){
calBusy.running=false;
showEvents("")
}
}
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()}
}
MButton{
id: createNewEvent
anchors.top: parent.top
anchors.topMargin: 0.5*mm
anchors.right:updateEvents.left
anchors.rightMargin:mm
width: 2*root.fontFactor*osSettings.bigFontSize;
text:"+"
onClicked: {
rootstackView.push("qrc:/qml/calendarqml/EventCreate.qml")
}
}
Connections{
target: xhr
function onSuccess(text,api){
if(api=="/api/friendica/event_create"){
calBusy.running=true;
updatenews.setDatabase();
updatenews.login();
updatenews.setSyncAll(false);
updatenews.events();
}
}
}
MButton{
@ -152,7 +204,7 @@ Rectangle {
font.pointSize: osSettings.systemFontSize
onTriggered: {
calendartab.calendartabstatus="Events";
// calendartabstatusButton.text=qsTr("own Calendar");
// calendartabstatusButton.text=qsTr("own Calendar");
showEvents("")}
}
}
@ -176,41 +228,41 @@ Rectangle {
}
delegate:
Item{
width:Math.min(23*root.fontFactor*osSettings.bigFontSize,calendarView.width)
height: parent.height
Text{
font.bold: true
//Layout.fillWidth: true
width: parent.width-root.fontFactor*osSettings.bigFontSize
horizontalAlignment:Text.AlignHCenter
color: Material.primaryTextColor
text: model.year
font.pointSize: osSettings.systemFontSize
}
Text{y:1.5*root.fontFactor*osSettings.bigFontSize
width: parent.width-osSettings.bigFontSize
text: Qt.locale().standaloneMonthName(model.month)
//Layout.fillWidth: true
color: Material.primaryTextColor
horizontalAlignment:Text.AlignHCenter
font.pointSize: osSettings.systemFontSize
}
DayOfWeekRow{y:3*root.fontFactor*osSettings.bigFontSize
width: parent.width-root.fontFactor*osSettings.bigFontSize
locale: monthgrid.locale
//Layout.fillWidth: true
font.pointSize: osSettings.systemFontSize
}
width:Math.min(23*root.fontFactor*osSettings.bigFontSize,calendarView.width)
height: parent.height
Text{
font.bold: true
//Layout.fillWidth: true
width: parent.width-root.fontFactor*osSettings.bigFontSize
horizontalAlignment:Text.AlignHCenter
color: Material.primaryTextColor
text: model.year
font.pointSize: osSettings.systemFontSize
}
Text{y:1.5*root.fontFactor*osSettings.bigFontSize
width: parent.width-osSettings.bigFontSize
text: Qt.locale().standaloneMonthName(model.month)
//Layout.fillWidth: true
color: Material.primaryTextColor
horizontalAlignment:Text.AlignHCenter
font.pointSize: osSettings.systemFontSize
}
DayOfWeekRow{y:3*root.fontFactor*osSettings.bigFontSize
width: parent.width-root.fontFactor*osSettings.bigFontSize
locale: monthgrid.locale
//Layout.fillWidth: true
font.pointSize: osSettings.systemFontSize
}
MonthGrid {y:5*root.fontFactor*osSettings.bigFontSize
id: monthgrid
height: parent.height-5*root.fontFactor*osSettings.bigFontSize
width: parent.width-root.fontFactor*osSettings.bigFontSize
month: model.month
year: model.year
locale: Qt.locale()
delegate: CalendarDay{}
}
MonthGrid {y:5*root.fontFactor*osSettings.bigFontSize
id: monthgrid
height: parent.height-5*root.fontFactor*osSettings.bigFontSize
width: parent.width-root.fontFactor*osSettings.bigFontSize
month: model.month
year: model.year
locale: Qt.locale()
delegate: CalendarDay{}
}
}
ScrollIndicator.horizontal: ScrollIndicator { }
Component.onCompleted: positionViewAtBeginning()
@ -235,4 +287,4 @@ Rectangle {
root.eventSignal.connect(showEvents);
if (calendartab.calendartabstatus=="Events"){showEvents("")}
}
}
}

View file

@ -0,0 +1,391 @@
// This file is part of Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2020 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import QtQuick.Controls 2.12
import QtQuick.Controls.Material 2.12
import QtQuick.Controls 1.4 as Oldcontrols
import "qrc:/js/service.js" as Service
import "qrc:/js/helper.js" as Helperjs
import "qrc:/qml/genericqml"
import "qrc:/qml/calendarqml"
Rectangle{
id:eventCreateBox
color: Material.backgroundColor
property date startDate: new Date()
function formatText(count, modelData) {
var data = count === 12 ? modelData + 1 : modelData;
return data.toString().length < 2 ? "0" + data : data;
}
MButton{
id:closeButton
anchors.top: parent.top
anchors.topMargin: 1*mm
anchors.right: parent.right
anchors.rightMargin: 1*mm
text: "\uf057"
onClicked:{rootstackView.pop()}
}
Label{
x: 0.5*root.fontFactor*osSettings.bigFontSize
y: 2*root.fontFactor*osSettings.bigFontSize
width: 3*root.fontFactor*osSettings.bigFontSize
height: root.fontFactor*osSettings.bigFontSize
font.pointSize: osSettings.systemFontSize
//verticalAlignment: TextInput.AlignBottom
color: Material.primaryTextColor
text:qsTr("Start")
}
TextField {
id: textStartDate
property string dateDay:(startDate.getDate()).toString().length<2?"0"+(startDate.getDate()):(startDate.getDate())
property string dateMonth: (startDate.getMonth()+1).toString().length<2?"0"+(startDate.getMonth()+1):(startDate.getMonth()+1)
x: 4*root.fontFactor*osSettings.bigFontSize
y: root.fontFactor*osSettings.bigFontSize
width: 5*root.fontFactor*osSettings.bigFontSize
height: 2.5*root.fontFactor*osSettings.bigFontSize
font.pointSize: osSettings.systemFontSize
horizontalAlignment: TextInput.AlignRight
text: dateDay+"-"+dateMonth+"-"+startDate.getFullYear()
inputMask: "99-99-9999"
validator: RegExpValidator{regExp: /^([0-2\s]?[0-9\s]|3[0-1\s])-(0[0-9\s]|1[0-2\s])-([0-9\s][0-9\s][0-9\s][0-9\s])$ / }
font.bold: true
}
MButton {
id: textStartDateDropdown
x: 9.5*root.fontFactor*osSettings.bigFontSize
y: root.fontFactor*osSettings.bigFontSize
width: 2*root.fontFactor*osSettings.bigFontSize
height: 2*root.fontFactor*osSettings.bigFontSize
text:"\uf0d7"
onClicked:{
cal.visible=true;
cal.curSelection="start"
}
}
TextField {
id: textStartTime
x: 13*root.fontFactor*osSettings.bigFontSize
y: root.fontFactor*osSettings.bigFontSize
width: 3*root.fontFactor*osSettings.bigFontSize
height: 2.5*root.fontFactor*osSettings.bigFontSize
font.pointSize: osSettings.systemFontSize
inputMask: "99:99"
text: "00:00"
horizontalAlignment: TextInput.AlignRight
validator: RegExpValidator{regExp: /^([0-1\s]?[0-9\s]|2[0-3\s]):([0-5\s][0-9\s])$ / }
font.bold: true
}
MButton {
id: textStartTimeDropdown
x: 16.5*root.fontFactor*osSettings.bigFontSize
y: root.fontFactor*osSettings.bigFontSize
width: 2*root.fontFactor*osSettings.bigFontSize
height: 2*root.fontFactor*osSettings.bigFontSize
text:"\uf0d7"
onClicked:{
onClicked: {timeTumbler.visible=true;timeTumbler.curSelection="start"}
}
}
Label{
x: 0.5*root.fontFactor*osSettings.bigFontSize
y: 4*root.fontFactor*osSettings.bigFontSize
width: 3*root.fontFactor*osSettings.bigFontSize
height: root.fontFactor*osSettings.bigFontSize
font.pointSize: osSettings.systemFontSize
color: Material.primaryTextColor
text:qsTr("End")
}
TextField {
id: textEndDate
x: 4*root.fontFactor*osSettings.bigFontSize
y: 3*root.fontFactor*osSettings.bigFontSize
width: 5*root.fontFactor*osSettings.bigFontSize
height: 2.5*root.fontFactor*osSettings.bigFontSize
font.pointSize: osSettings.systemFontSize
horizontalAlignment: TextInput.AlignRight
inputMask: "99-99-9999"
validator: RegExpValidator{regExp: /^([0-2\s]?[0-9\s]|3[0-1\s])-(0[0-9\s]|1[0-2\s])-([0-9\s][0-9\s][0-9\s][0-9\s])$ / }
enabled: false
font.bold: true
}
MButton {
id: textEndDateDropdown
x: 9.5*root.fontFactor*osSettings.bigFontSize
y: 3*root.fontFactor*osSettings.bigFontSize
width: 2*root.fontFactor*osSettings.bigFontSize
height: 2*root.fontFactor*osSettings.bigFontSize
enabled: false
text:"\uf0d7"
onClicked:{
cal.visible=true;
cal.curSelection="end"
}
}
TextField {
id: textEndTime
x: 13*root.fontFactor*osSettings.bigFontSize
y: 3*root.fontFactor*osSettings.bigFontSize
width: 3*root.fontFactor*osSettings.bigFontSize
height: 2.5*root.fontFactor*osSettings.bigFontSize
font.pointSize: osSettings.systemFontSize
enabled: false
horizontalAlignment: TextInput.AlignRight
inputMask: "99:99"
validator: RegExpValidator{regExp: /^([0-1\s]?[0-9\s]|2[0-3\s]):([0-5\s][0-9\s])$ / }
font.bold: true
}
MButton {
id: textEndTimeDropdown
x: 16.5*root.fontFactor*osSettings.bigFontSize
y: 3*root.fontFactor*osSettings.bigFontSize
width: 2*root.fontFactor*osSettings.bigFontSize
height: 2*root.fontFactor*osSettings.bigFontSize
enabled: false
text:"\uf0d7"
onClicked:{
onClicked: {timeTumbler.visible=true;timeTumbler.curSelection="end"}
}
}
Column{
x: 4*root.fontFactor*osSettings.bigFontSize
y: 6*root.fontFactor*osSettings.bigFontSize
width: parent.width-7*root.fontFactor*osSettings.bigFontSize
Oldcontrols.Calendar{
id:cal
property string curSelection: "start"
width: 12*root.fontFactor*osSettings.bigFontSize
height: 15*root.fontFactor*osSettings.bigFontSize
visible: false
selectedDate: new Date()
onClicked: {
if (curSelection=="start"){
textStartDate.text=Qt.formatDate(cal.selectedDate, "dd-MM-yyyy");
}else{
textEndDate.text=Qt.formatDate(cal.selectedDate, "dd-MM-yyyy");
}
cal.visible=false
}
}
Frame {
id: timeTumbler
width: 12*root.fontFactor*osSettings.bigFontSize
height: 10*root.fontFactor*osSettings.bigFontSize
visible: false
property string curSelection: "start"
Row {
Tumbler {
id: hoursTumbler
model: 24
delegate: tumblerDelegateComponent
currentIndex: 12
}
Tumbler {
id: minutesTumbler
model: 60
delegate: tumblerDelegateComponent
}
}
MButton {
id: timeInputfinished
width: 2*root.fontFactor*osSettings.bigFontSize
height: 2*root.fontFactor*osSettings.bigFontSize
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
text:"\uf00c"
onClicked:{
if (timeTumbler.curSelection=="start"){
textStartTime.text=formatText(24,hoursTumbler.currentIndex)+":"+formatText(60,minutesTumbler.currentIndex);
}else{
textEndTime.text=formatText(24,hoursTumbler.currentIndex)+":"+formatText(60,minutesTumbler.currentIndex);
}
timeTumbler.visible=false
}
}
}
CheckBox{
id: checkNoEndTime
width: 12*root.fontFactor*osSettings.bigFontSize
height: 2.5*root.fontFactor*osSettings.bigFontSize
checked: true
font.pointSize: osSettings.systemFontSize
text: qsTr("no end")
onCheckedChanged: {
if(checked==true){
textEndDate.enabled=false;
textEndDateDropdown.enabled=false;
textEndTime.enabled=false;
textEndTimeDropdown.enabled=false;
textEndDate.text="";
textEndTime.text=""
}else{
textEndDate.enabled=true;
textEndDateDropdown.enabled=true;
textEndTime.enabled=true;
textEndTimeDropdown.enabled=true;
textEndDate.text=textStartDate.text;
textEndTime.text=textStartTime.text
}
}
}
TextField {
id: titleField
width: parent.width-root.fontFactor*osSettings.bigFontSize
font.pointSize: osSettings.systemFontSize
font.bold: true
placeholderText: qsTr("Title (required)")
}
Rectangle{
color: Material.backgroundColor
radius: 0.5*mm
width: parent.width-root.fontFactor*osSettings.bigFontSize
height:Math.max(bodyField.contentHeight+root.fontFactor*osSettings.bigFontSize,2.5*root.fontFactor*osSettings.bigFontSize)
TextArea {
id: bodyField
anchors.fill: parent
font.pointSize: osSettings.systemFontSize
font.family: "Noto Sans"
wrapMode: Text.Wrap
selectByMouse: true
placeholderText: qsTr("Event description (optional)")
textFormat: TextEdit.PlainText
onLinkActivated:{Qt.openUrlExternally(link)}
}
}
TextField {
id: locationField
width: parent.width-root.fontFactor*osSettings.bigFontSize
font.pointSize: osSettings.systemFontSize
placeholderText: qsTr("Location (optional)")
}
CheckBox{
id: chkbxPublish
width: 10*root.fontFactor*osSettings.bigFontSize
height: 2.5*root.fontFactor*osSettings.bigFontSize
checked: true
font.pointSize: osSettings.systemFontSize
text: qsTr("Publish event?")
}
BusyIndicator{
id: eventCreateBusy
anchors.horizontalCenter: eventCreateBox.horizontalCenter
anchors.top:eventCreateBox.top
anchors.topMargin: 2*root.fontFactor*osSettings.bigFontSize
width:3*root.fontFactor*osSettings.bigFontSize
height: 3*root.fontFactor*osSettings.bigFontSize
running: false
}
MButton{
id:createEventButton
text: qsTr("Create event")
onClicked:{
let startdatetext=textStartDate.getText(0,textStartDate.length);
let startdate=new Date(startdatetext.substring(6,10)+"-"+startdatetext.substring(3,5)+"-"+startdatetext.substring(0,2)+"T"+textStartTime.text)
if (titleField.text==""){
Helperjs.showMessage(qsTr("Error"),qsTr("No event name supplied"),eventCreateBox)
}else{
let startdatetext=textStartDate.getText(0,textStartDate.length);
let startdate=new Date(startdatetext.substring(6,10)+"-"+startdatetext.substring(3,5)+"-"+startdatetext.substring(0,2)+"T"+textStartTime.text)
eventCreateBusy.running=true;
xhr.setLogin(login.username+":"+Qt.atob(login.password));
xhr.setUrl(login.server);
xhr.setApi("/api/friendica/event_create");
xhr.clearParams();
xhr.setParam("name", titleField.text);
xhr.setParam("start_time",startdate.toISOString())
if(!checkNoEndTime.checked){
let enddatetext=textEndDate.getText(0,textEndDate.length);
let enddate=new Date(enddatetext.substring(6,10)+"-"+enddatetext.substring(3,5)+"-"+enddatetext.substring(0,2)+"T"+textEndTime.text)
xhr.setParam("end_time",enddate.toISOString())
}
xhr.setParam("name",titleField.text)
if (bodyField.text!=""){xhr.setParam("desc",bodyField.text)}
if (locationField.text!=""){xhr.setParam("place",locationField.text)}
xhr.setParam("publish",chkbxPublish.checked)
xhr.post();
}
}
}
Connections{
target: xhr
function onSuccess(text,api){
if (api=="/api/friendica/event_create"){
updatenews.setDatabase();
updatenews.login();
updatenews.setSyncAll(false);
updatenews.events();
try{while(rootstackView.depth>1){rootstackView.pop()}}catch(e){}
}
}
function onError(text,api){
if (api=="/api/friendica/event_create"){
Helperjs.showMessage(qsTr("Error"),text,root)
}
}
}
}
Component {
id: tumblerDelegateComponent
Label {
text: formatText(Tumbler.tumbler.count, modelData)
opacity: 1.0 - Math.abs(Tumbler.displacement) / (Tumbler.tumbler.visibleItemCount / 2)
color:Material.primaryTextColor
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.pointSize: osSettings.systemFontSize
}
}
}

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++){

View file

@ -42,8 +42,8 @@ Rectangle{
property string status: eventstatus
property var currEvent: event
width:parent.width
height:eventNameText.height+eventDetailsText.height+mm
border.color: Material.backgroundDimColor//"light grey"
height:Math.max(eventNameText.height+eventDetailsText.height,profileImage.height)+mm
border.color: Material.backgroundDimColor
color: Material.backgroundColor
border.width: 1
radius: 0.5*mm
@ -54,8 +54,6 @@ Rectangle{
y:1
width: 7*mm
height: 7*mm
//radius:mm
onStatusChanged: if (profileImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
}
Text {
@ -64,8 +62,9 @@ Rectangle{
width:parent.width-8*mm
height:contentHeight
color: Material.primaryTextColor
textFormat: Text.RichText
font.pointSize: osSettings.systemFontSize
text: new Date(event.start).toLocaleString(Qt.locale(),Locale.NarrowFormat)+ " - " +((event.end>0)&&(event.end!=null)?new Date(event.end).toLocaleString(Qt.locale(),Locale.NarrowFormat):"\u221E")+":\n"+event.title //+calendarrectangle.offsetTime
text: new Date(event.start).toLocaleString(Qt.locale(),Locale.NarrowFormat)+ " - " +((event.end>0)&&(event.end!=null)?new Date(event.end).toLocaleString(Qt.locale(),Locale.NarrowFormat):"\u221E")+":<br>"+(status=="large"?"<b>"+event.title+"</b>":event.title)
wrapMode:Text.Wrap
}
@ -77,18 +76,51 @@ Rectangle{
height: contentHeight
color: Material.primaryTextColor
textFormat: Text.RichText
text: status!="large"?"":Qt.atob(event.desc) + (event.location==""?"":"<br><br>"+qsTr("Location")+": "+event.location)//Qt.atob(event.html)
text: status!="large"?"":Qt.atob(event.desc) + (event.location==""?"":"<br><br>"+qsTr("Location")+": "+event.location)
anchors.top: eventNameText.bottom
font.pointSize: osSettings.systemFontSize
wrapMode:Text.Wrap
onLinkActivated:{Qt.openUrlExternally(link)}
}
MouseArea{
anchors.fill: parent
onClicked:{
MButton{
id: deleteEvent
anchors.top: parent.top
anchors.topMargin: 0.5*mm
anchors.right:parent.right
anchors.rightMargin:mm
width: 2*root.fontFactor*osSettings.bigFontSize;
text:"\uf1f8"
onClicked: {
deleteDialog.eventid=event.id
deleteDialog.open()
}
}
onClicked:{print("status "+status)
if (status==""){
rootstackView.push("qrc:/qml/calendarqml/EventList.qml",{"dayint": event.startday, "events":[event]});
} else {rootstackView.pop()}
}
}
Connections{
target: xhr
function onSuccess(text,api){
if (api=="/api/friendica/event_delete"){
let obj=JSON.parse(text);
if(obj.status=="deleted"&&obj.id==event.id){
Helperjs.deleteData(db,"events",login.username, function(){
eventModel.remove(index);
},"id",obj.id)
}
}
}
}
}