Warning, /pim/kube/views/calendar/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 import "dateutils.js" as DateUtils 0025 0026 FocusScope { 0027 id: root 0028 property var controller 0029 0030 implicitWidth: stackView.currentItem.implicitWidth 0031 implicitHeight: stackView.currentItem.implicitHeight 0032 0033 signal done() 0034 0035 StackView { 0036 id: stackView 0037 anchors.fill: parent 0038 initialItem: eventDetails 0039 clip: true 0040 } 0041 0042 Component { 0043 id: eventDetails 0044 Rectangle { 0045 implicitWidth: contentLayout.implicitWidth + 2 * Kube.Units.largeSpacing 0046 implicitHeight: contentLayout.implicitHeight + 2 * Kube.Units.largeSpacing 0047 color: Kube.Colors.viewBackgroundColor 0048 0049 ColumnLayout { 0050 id: contentLayout 0051 anchors { 0052 fill: parent 0053 margins: Kube.Units.largeSpacing 0054 } 0055 0056 spacing: Kube.Units.smallSpacing 0057 0058 Kube.Heading { 0059 Layout.fillWidth: true 0060 text: controller.summary 0061 elide: Text.ElideRight 0062 } 0063 0064 Kube.SelectableLabel { 0065 visible: controller.allDay 0066 text: controller.start.toLocaleString(Qt.locale(), "dd. MMMM") + (DateUtils.sameDay(controller.start, controller.end) ? "" : " - " + controller.end.toLocaleString(Qt.locale(), "dd. MMMM")) 0067 } 0068 0069 Kube.SelectableLabel { 0070 visible: !controller.allDay 0071 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")) 0072 } 0073 0074 Kube.SelectableLabel { 0075 visible: controller.recurring 0076 text: qsTr("repeats %1").arg(controller.recurrenceString) 0077 } 0078 0079 Kube.SelectableLabel { 0080 text: "@" + controller.location 0081 copyText: controller.location 0082 visible: controller.location 0083 } 0084 0085 Kube.SelectableLabel { 0086 text: qsTr("Organizer: %1").arg(controller.organizer) 0087 visible: controller.organizer 0088 } 0089 0090 Flow { 0091 Layout.fillWidth: true 0092 visible: attendeeRepeater.count 0093 height: childrenRect.height 0094 spacing: Kube.Units.smallSpacing 0095 Kube.SelectableLabel { 0096 text: qsTr("Attending:") 0097 visible: controller.organizer 0098 } 0099 Repeater { 0100 id: attendeeRepeater 0101 model: controller.attendees.model 0102 delegate: Kube.Label { 0103 text: qsTr("%1").arg(model.name) + (index == (attendeeRepeater.count - 1) ? "" : ",") 0104 elide: Text.ElideRight 0105 } 0106 } 0107 } 0108 0109 Kube.ScrollableTextArea { 0110 id: textArea 0111 Layout.fillHeight: true 0112 Layout.fillWidth: true 0113 text: Kube.HtmlUtils.toHtml(controller.description) 0114 textFormat: Kube.TextArea.RichText 0115 } 0116 0117 RowLayout { 0118 Kube.Button { 0119 text: qsTr("Remove") 0120 onClicked: { 0121 root.controller.remove() 0122 root.done() 0123 } 0124 } 0125 Item { 0126 Layout.fillWidth: true 0127 } 0128 Kube.Button { 0129 enabled: controller.ourEvent 0130 text: qsTr("Edit") 0131 onClicked: { 0132 stackView.push(editor, StackView.Immediate) 0133 } 0134 } 0135 0136 } 0137 } 0138 } 0139 } 0140 0141 Component { 0142 id: editor 0143 EventEditor { 0144 controller: root.controller 0145 editMode: true 0146 onDone: root.done() 0147 } 0148 } 0149 }