Warning, /pim/kube/framework/qml/mailpartview/ICalPart.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 Copyright (C) 2019 Christian Mollekopf, <mollekopf@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.7
0020 import QtQuick.Controls 2
0021 import QtQuick.Layouts 1
0022
0023 import org.kube.framework 1.0 as Kube
0024
0025 Item {
0026 id: root
0027
0028 property string content
0029 property bool autoLoadImages: false
0030
0031 property string searchString
0032 property int contentHeight: childrenRect.height
0033
0034 Kube.InvitationController {
0035 id: controller
0036 Component.onCompleted: loadICal(content)
0037 }
0038
0039 states: [
0040 State {
0041 name: "exceptioncancelled"
0042 extend: "cancelled"
0043 when: controller.method == Kube.InvitationController.Cancel && !isNaN(controller.recurrenceId)
0044 PropertyChanges {target: label; visible: true; text: qsTr("This is an exception for the event originally occurring at: \"%1\"").arg(controller.recurrenceId.toLocaleString(Qt.locale(), "dd. MMMM hh:mm"))}
0045 },
0046 State {
0047 name: "cancelledaccepted"
0048 extend: "cancelled"
0049 when: controller.method == Kube.InvitationController.Cancel && controller.state == Kube.InvitationController.Accepted
0050 PropertyChanges {target: buttons; visible: false}
0051 },
0052 State {
0053 name: "cancelled"
0054 when: controller.method == Kube.InvitationController.Cancel
0055 PropertyChanges {target: heading; text: qsTr("\"%1\" has been cancelled.").arg(controller.summary)}
0056 },
0057 State {
0058 name: "replyAccepted"
0059 when: controller.method == Kube.InvitationController.Reply && controller.state == Kube.InvitationController.Accepted
0060 PropertyChanges {target: heading; text: qsTr("%1 has accepted: \"%2\"").arg(controller.name).arg(controller.summary)}
0061 PropertyChanges {target: buttons; visible: false}
0062 },
0063 State {
0064 name: "replyDeclined"
0065 when: controller.method == Kube.InvitationController.Reply && controller.state == Kube.InvitationController.Declined
0066 PropertyChanges {target: heading; text: qsTr("%1 has declined: \"%2\"").arg(controller.name).arg(controller.summary)}
0067 PropertyChanges {target: buttons; visible: false}
0068 },
0069 State {
0070 name: "replyUnknown"
0071 when: controller.method == Kube.InvitationController.Reply && controller.state == Kube.InvitationController.Unknown
0072 PropertyChanges {target: heading; text: qsTr("%1 doesn't yet know about: \"%2\"").arg(controller.name).arg(controller.summary)}
0073 PropertyChanges {target: buttons; visible: false}
0074 },
0075 State {
0076 name: "updatedexception"
0077 extend: "updated"
0078 when: controller.method == Kube.InvitationController.Request && controller.eventState == Kube.InvitationController.Update && !isNaN(controller.recurrenceId)
0079 PropertyChanges {target: label; visible: true; text: qsTr("This is an exception for the event originally occurring at: \"%1\"").arg(controller.recurrenceId.toLocaleString(Qt.locale(), "dd. MMMM hh:mm"))}
0080 },
0081 State {
0082 name: "updated"
0083 when: controller.method == Kube.InvitationController.Request && controller.eventState == Kube.InvitationController.Update
0084 PropertyChanges {target: heading; text: qsTr("The invitation has been updated: \"%1\"").arg(controller.summary)}
0085 },
0086 State {
0087 name: "accepted"
0088 when: controller.method == Kube.InvitationController.Request && controller.state == Kube.InvitationController.Accepted
0089 PropertyChanges {target: heading; text: qsTr("You have accepted: \"%1\"").arg(controller.summary)}
0090 PropertyChanges {target: buttons; visible: false}
0091 },
0092 State {
0093 name: "declined"
0094 when: controller.method == Kube.InvitationController.Request && controller.state == Kube.InvitationController.Declined
0095 PropertyChanges {target: heading; text: qsTr("You have declined: \"%1\"").arg(controller.summary)}
0096 PropertyChanges {target: buttons; visible: false}
0097 },
0098 State {
0099 name: "invited"
0100 when: controller.method == Kube.InvitationController.Request && controller.state == Kube.InvitationController.Unknown
0101 PropertyChanges {target: heading; text: qsTr("You've been invited to: \"%1\"").arg(controller.summary)}
0102 },
0103 State {
0104 name: "notinvited"
0105 when: controller.method == Kube.InvitationController.Request && controller.state == Kube.InvitationController.NoMatch
0106 PropertyChanges {target: heading; text: qsTr("You are not listed as attendee to: \"%1\"").arg(controller.summary)}
0107 PropertyChanges {target: buttons; visible: false}
0108 }
0109 ]
0110
0111 ColumnLayout {
0112 anchors {
0113 left: parent.left
0114 right: parent.right
0115 }
0116 spacing: Kube.Units.smallSpacing
0117
0118 Kube.Heading {
0119 id: heading
0120 elide: Text.ElideRight
0121 Layout.fillWidth: true
0122 }
0123
0124 Kube.Label {
0125 id: label
0126 visible: false
0127 elide: Text.ElideRight
0128 Layout.fillWidth: true
0129 }
0130
0131 Kube.SelectableLabel {
0132 Layout.fillWidth: true
0133 visible: controller.allDay
0134 text: controller.start.toLocaleString(Qt.locale(), "dd. MMMM") + (/*DateUtils.sameDay(controller.start, controller.end)*/ true ? "" : " - " + controller.end.toLocaleString(Qt.locale(), "dd. MMMM"))
0135 elide: Text.ElideRight
0136 }
0137
0138 Kube.SelectableLabel {
0139 Layout.fillWidth: true
0140 visible: !controller.allDay
0141 text: controller.start.toLocaleString(Qt.locale(), "dd. MMMM hh:mm") + " - " + (/*DateUtils.sameDay(controller.start, controller.end)*/ true ? controller.end.toLocaleString(Qt.locale(), "hh:mm") : controller.end.toLocaleString(Qt.locale(), "dd. MMMM hh:mm"))
0142 elide: Text.ElideRight
0143 }
0144
0145 RowLayout {
0146 id: buttons
0147 spacing: Kube.Units.smallSpacing
0148 Layout.fillWidth: true
0149
0150 Kube.Button {
0151 text: qsTr("Decline")
0152 onClicked: {
0153 controller.declineAction.execute()
0154 }
0155 }
0156
0157 Kube.PositiveButton {
0158 text: qsTr("Accept")
0159 onClicked: {
0160 controller.acceptAction.execute()
0161 }
0162 }
0163
0164 Kube.Label {
0165 text: qsTr("in")
0166 }
0167
0168 Kube.EntityComboBox {
0169 id: calendarSelector
0170 Layout.fillWidth: true
0171 accountId: Kube.Context.currentAccountId
0172 type: "calendar"
0173 filter: {"contentTypes": "event", "enabled": true}
0174 onSelected: {
0175 if (entity) {
0176 controller.calendar = entity
0177 }
0178 }
0179 }
0180
0181 }
0182
0183 }
0184
0185 }