85 lines
2.4 KiB
QML
85 lines
2.4 KiB
QML
import QtQuick 2.0
|
|
import QtQuick.Controls 1.2
|
|
import "qrc:/js/service.js" as Service
|
|
import "qrc:/js/helper.js" as Helperjs
|
|
import "qrc:/qml/genericqml"
|
|
|
|
Rectangle{
|
|
id:eventList
|
|
z:2
|
|
border.color: "grey"
|
|
width: parent.width-4*mm
|
|
height:parent.height-12*mm
|
|
x:mm
|
|
y:mm
|
|
property var daylist:[]
|
|
|
|
BlueButton{
|
|
id:closeButton
|
|
anchors.top: parent.top
|
|
anchors.topMargin: 1*mm
|
|
anchors.right: parent.right
|
|
anchors.rightMargin: 1*mm
|
|
text: "\uf057"
|
|
onClicked:{eventList.destroy()}
|
|
}
|
|
ListView {
|
|
id: eventlistView
|
|
x: mm
|
|
y:closeButton.height+2*mm
|
|
width: eventList.width-2*mm
|
|
height: eventList.height-closeButton.height-4*mm
|
|
clip: true
|
|
model: eventModel
|
|
delegate: eventItem
|
|
}
|
|
|
|
ListModel{
|
|
id: eventModel
|
|
}
|
|
|
|
Component.onCompleted:{
|
|
//print(JSON.stringify(daylist))
|
|
for (var i=0; i<daylist.length;i++){//print(JSON.stringify(events[daylist[i]]));
|
|
var liststate="";if(daylist.length<2){liststate="large"}
|
|
eventModel.append({"event":events[daylist[i]],"eventstatus":liststate});
|
|
}
|
|
}
|
|
|
|
Component{
|
|
id:eventItem
|
|
Rectangle{
|
|
property string status: eventstatus
|
|
width:eventlistView.width
|
|
height:eventNameText.height+eventDetailsText.height+mm
|
|
border.color: "light grey"
|
|
border.width: 1
|
|
Text {
|
|
id:eventNameText
|
|
x:mm
|
|
width:parent.width
|
|
height:contentHeight
|
|
text: new Date(event.start+calendarrectangle.offsetTime).toLocaleTimeString()+": "+event.title
|
|
font.pixelSize: 3*mm
|
|
wrapMode:Text.Wrap
|
|
}
|
|
|
|
Text {
|
|
id:eventDetailsText
|
|
x:mm
|
|
z:4
|
|
width: parent.width
|
|
height: contentHeight
|
|
text: status==""?"":Qt.atob(event.html)
|
|
anchors.top: eventNameText.bottom
|
|
font.pixelSize: 3*mm
|
|
wrapMode:Text.Wrap
|
|
}
|
|
MouseArea{
|
|
anchors.fill: parent
|
|
onClicked:{if (status==""){status="large"} else {status=""}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|