Warning, /pim/kube/views/inbound/qml/EventView.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  *  Copyright (C) 2018 Michael Bohlender, <bohlender@kolabsys.com>
0003  *
0004  *  This program is free software; you can redistribute it and/or modify
0005  *  it under the terms of the GNU General Public License as published by
0006  *  the Free Software Foundation; either version 2 of the License, or
0007  *  (at your option) any later version.
0008  *
0009  *  This program is distributed in the hope that it will be useful,
0010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0012  *  GNU General Public License for more details.
0013  *
0014  *  You should have received a copy of the GNU General Public License along
0015  *  with this program; if not, write to the Free Software Foundation, Inc.,
0016  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0017  */
0018 
0019 import QtQuick 2.4
0020 import QtQuick.Layouts 1.1
0021 import QtQuick.Controls 2.3
0022 
0023 import org.kube.framework 1.0 as Kube
0024 
0025 import "dateutils.js" as DateUtils
0026 
0027 FocusScope {
0028     id: root
0029     property var controller: null
0030 
0031     signal done()
0032 
0033     onControllerChanged: {
0034         //Wait for a controller to be set before we add a view
0035         if (controller) {
0036             stackView.push(eventDetails, StackView.Immediate)
0037         }
0038     }
0039 
0040     // function edit() {
0041     //     var item = stackView.push(editor, StackView.Immediate)
0042     //     item.forceActiveFocus()
0043     // }
0044 
0045     StackView {
0046         id: stackView
0047         anchors.fill: parent
0048         clip: true
0049         visible: controller
0050     }
0051 
0052     Component {
0053         id: eventDetails
0054         Rectangle {
0055             color: Kube.Colors.paperWhite
0056 
0057             ColumnLayout {
0058                 id: contentLayout
0059                 anchors {
0060                     fill: parent
0061                     margins: Kube.Units.largeSpacing
0062                 }
0063 
0064                 spacing: Kube.Units.smallSpacing
0065 
0066                 Kube.Heading {
0067                     Layout.fillWidth: true
0068                     text: controller.summary
0069                     elide: Text.ElideRight
0070                 }
0071 
0072                 Kube.SelectableLabel {
0073                     visible: controller.allDay
0074                     text: controller.start.toLocaleString(Qt.locale(), "dd. MMMM") + (DateUtils.sameDay(controller.start, controller.end) ? "" : " - " + controller.end.toLocaleString(Qt.locale(), "dd. MMMM"))
0075                 }
0076 
0077                 Kube.SelectableLabel {
0078                     visible: !controller.allDay
0079                     text: controller.start.toLocaleString(Qt.locale(), "dd. MMMM hh:mm") + " - " + (DateUtils.sameDay(controller.start, controller.end) ? controller.end.toLocaleString(Qt.locale(), "hh:mm") : controller.end.toLocaleString(Qt.locale(), "dd. MMMM hh:mm"))
0080                 }
0081 
0082                 Kube.SelectableLabel {
0083                     visible: controller.recurring
0084                     text: qsTr("repeats %1").arg(controller.recurrenceString)
0085                 }
0086 
0087                 Kube.SelectableLabel {
0088                     text: "@" + controller.location
0089                     visible: controller.location
0090                 }
0091 
0092                 Kube.SelectableLabel {
0093                     text: qsTr("Organizer: %1").arg(controller.organizer)
0094                     visible: controller.organizer
0095                 }
0096 
0097                 Flow {
0098                     Layout.fillWidth: true
0099                     visible: attendeeRepeater.count
0100                     height: childrenRect.height
0101                     spacing: Kube.Units.smallSpacing
0102                     Kube.SelectableLabel {
0103                         text: qsTr("Attending:")
0104                         visible: controller.organizer
0105                     }
0106                     Repeater {
0107                         id: attendeeRepeater
0108                         model: controller.attendees.model
0109                         delegate: Kube.Label {
0110                             text: qsTr("%1").arg(model.name) + (index == (attendeeRepeater.count - 1) ? "" : ",")
0111                             elide: Text.ElideRight
0112                         }
0113                     }
0114                 }
0115 
0116                 Rectangle {
0117                     Layout.fillWidth: true
0118                     height: 1
0119                     color: Kube.Colors.textColor
0120                     opacity: 0.5
0121                 }
0122 
0123                 Kube.ScrollableTextArea {
0124                     id: textArea
0125                     Layout.fillHeight: true
0126                     Layout.fillWidth: true
0127                     text: Kube.HtmlUtils.toHtml(controller.description)
0128                     textFormat: Kube.TextArea.RichText
0129                 }
0130 
0131                 // RowLayout {
0132                 //     width: parent.width
0133                 //     Kube.Button {
0134                 //         text: qsTr("Remove")
0135                 //         onClicked: {
0136                 //             root.controller.remove()
0137                 //         }
0138                 //     }
0139                 //     Item {
0140                 //         Layout.fillWidth: true
0141                 //     }
0142                 //     Kube.Button {
0143                 //         text: qsTr("Edit")
0144                 //         onClicked: root.edit()
0145                 //     }
0146                 // }
0147             }
0148         }
0149     }
0150 
0151     //Component {
0152     //    id: editor
0153     //    TodoEditor {
0154     //        controller: root.controller
0155     //        editMode: true
0156     //        onDone: {
0157     //            //Reload
0158     //            root.controller.todo = root.controller.todo
0159     //            stackView.pop(StackView.Immediate)
0160     //        }
0161     //    }
0162     //}
0163 }