forked from lubuwest/Friendiqa
create and delete events
This commit is contained in:
parent
27cd83db3c
commit
400241ec6a
34 changed files with 1346 additions and 614 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue