diff --git a/views/calendar/qml/AttendeeListEditor.qml b/views/calendar/qml/AttendeeListEditor.qml index 739450d7..80df7f70 100644 --- a/views/calendar/qml/AttendeeListEditor.qml +++ b/views/calendar/qml/AttendeeListEditor.qml @@ -1,142 +1,153 @@ /* * Copyright (C) 2017 Michael Bohlender, * Copyright (C) 2017 Christian Mollekopf, * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.7 import QtQuick.Layouts 1.1 import QtQuick.Controls 2.2 import org.kube.framework 1.0 as Kube FocusScope { id: root property var controller property var completer property alias count: listView.count - implicitHeight: listView.height + lineEdit.height - implicitWidth: listView.width + implicitHeight: flow.height + lineEdit.height height: implicitHeight Column { anchors.fill: parent spacing: Kube.Units.smallSpacing - ListView { - id: listView + Flow { + id: flow anchors { left: parent.left right: parent.right } - height: contentHeight spacing: Kube.Units.smallSpacing - model: controller.model - delegate: Rectangle { - height: Kube.Units.gridUnit + Kube.Units.smallSpacing * 2 //smallSpacing for padding - width: parent.width - color: "transparent" - Kube.Label { - id: label - anchors { - verticalCenter: parent.verticalCenter - left: parent.left - right: status.left - margins: Kube.Units.smallSpacing - } - text: model.name - elide: Text.ElideRight - MouseArea { - id: mouseArea + + + Repeater { + id: listView + + model: controller.model + delegate: Item { + height: Kube.Units.gridUnit + Kube.Units.smallSpacing * 2 //smallSpacing for padding + width: label.width + status.width + Kube.Units.gridUnit + Kube.Units.largeSpacing + Kube.Units.smallSpacing * 3 + + Rectangle { anchors.fill: parent - hoverEnabled: true + color: Kube.Colors.darkBackgroundColor + opacity: 0.7 } - ToolTip.visible: mouseArea.containsMouse - ToolTip.text: text - } - Kube.Label { - id: status - anchors { - verticalCenter: parent.verticalCenter - right: removeButton.left - rightMargin: Kube.Units.smallSpacing + + Kube.Label { + id: label + anchors { + left: parent.left + leftMargin: Kube.Units.smallSpacing + verticalCenter: parent.verticalCenter + } + text: model.name + elide: Text.ElideRight + color: Kube.Colors.highlightedTextColor + MouseArea { + id: mouseArea + anchors.fill: parent + hoverEnabled: true + } + ToolTip.visible: mouseArea.containsMouse + ToolTip.text: text } - text: model.status == Kube.EventController.Accepted ? qsTr("Attending") : qsTr("Invited") - font.italic: true - font.pointSize: Kube.Units.smallFontSize - } - Kube.IconButton { - id: removeButton - anchors { - right: parent.right - verticalCenter: parent.verticalCenter - margins: Kube.Units.smallSpacing + + Kube.Label { + id: status + anchors { + left: label.right + leftMargin: Kube.Units.largeSpacing + verticalCenter: parent.verticalCenter + } + text: model.status == Kube.EventController.Accepted ? qsTr("Attending") : qsTr("Invited") + font.italic: true + font.pointSize: Kube.Units.smallFontSize + color: Kube.Colors.highlightedTextColor + } + Kube.IconButton { + anchors { + left: status.right + leftMargin: Kube.Units.smallSpacing + verticalCenter: parent.verticalCenter + } + height: Kube.Units.gridUnit + width: height + onClicked: root.controller.remove(model.id) + padding: 0 + iconName: Kube.Icons.remove } - height: Kube.Units.gridUnit - width: height - onClicked: root.controller.remove(model.id) - padding: 0 - iconName: Kube.Icons.remove } } } FocusScope { height: Kube.Units.gridUnit + Kube.Units.smallSpacing * 2 width: parent.width focus: true Kube.TextButton { id: button text: "+ " + qsTr("Add recipient") textColor: Kube.Colors.highlightColor focus: true onClicked: { lineEdit.visible = true lineEdit.forceActiveFocus() } } Kube.AutocompleteLineEdit { id: lineEdit anchors { left: parent.left right: parent.right } visible: false placeholderText: "+ " + qsTr("Add attendee") model: root.completer.model onSearchTermChanged: root.completer.searchString = searchTerm onAccepted: { root.controller.add({name: text}); clear() visible = false button.forceActiveFocus(Qt.TabFocusReason) } onAborted: { clear() visible = false button.forceActiveFocus(Qt.TabFocusReason) } } } } } diff --git a/views/calendar/qml/EventEditor.qml b/views/calendar/qml/EventEditor.qml index e50b21b9..0e82a3dc 100644 --- a/views/calendar/qml/EventEditor.qml +++ b/views/calendar/qml/EventEditor.qml @@ -1,238 +1,238 @@ /* * Copyright (C) 2018 Michael Bohlender, * Copyright (C) 2019 Christian Mollekopf, * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.4 import QtQuick.Layouts 1.1 import org.kube.framework 1.0 as Kube import "dateutils.js" as DateUtils Item { id: root property bool editMode: false property date start: new Date() property bool allDay: false property var controller: Kube.EventController { allDay: root.allDay } property var accountId: null signal done() implicitWidth: contentLayout.implicitWidth + 2 * Kube.Units.largeSpacing implicitHeight: contentLayout.implicitHeight + buttons.implicitHeight + 2 * Kube.Units.largeSpacing states: [ State { name: "edit" PropertyChanges { target: deleteButton; visible: true } PropertyChanges { target: abortButton; visible: false } PropertyChanges { target: saveButton; visible: true } PropertyChanges { target: discardButton; visible: true } PropertyChanges { target: createButton; visible: false } PropertyChanges { target: calendarSelector; visible: false } }, State { name: "new" PropertyChanges { target: deleteButton; visible: false } PropertyChanges { target: abortButton; visible: true } PropertyChanges { target: saveButton; visible: false } PropertyChanges { target: discardButton; visible: false } PropertyChanges { target: createButton; visible: true } PropertyChanges { target: calendarSelector; visible: true } } ] state: editMode ? "edit" : "new" ColumnLayout { id: contentLayout anchors { fill: parent margins: Kube.Units.largeSpacing } spacing: Kube.Units.largeSpacing ColumnLayout { spacing: Kube.Units.largeSpacing Kube.HeaderField { id: titleEdit Layout.fillWidth: true placeholderText: qsTr("Event Title") text: controller.summary onTextChanged: controller.summary = text } ColumnLayout { id: dateAndTimeChooser spacing: Kube.Units.smallSpacing DateRangeChooser { Layout.fillWidth: true enableTime: !controller.allDay initialStart: root.editMode ? controller.start : root.start initialEnd: root.editMode ? controller.end : DateUtils.addMinutesToDate(root.start, 30) onStartChanged: controller.start = start onEndChanged: controller.end = end } RowLayout { spacing: Kube.Units.smallSpacing Kube.CheckBox { checked: controller.allDay onCheckedChanged: { if (controller.allDay != checked) { controller.allDay = checked } } } Kube.Label { text: qsTr("All day") } } } Kube.TextField { Layout.fillWidth: true placeholderText: qsTr("Location") text: controller.location onTextChanged: controller.location = text } ColumnLayout { spacing: Kube.Units.smallSpacing Layout.fillWidth: true RowLayout { visible: attendees.count Layout.maximumWidth: parent.width Layout.fillWidth: true Kube.Label { id: fromLabel text: qsTr("Organizer:") } Kube.ComboBox { id: identityCombo objectName: "identityCombo" width: parent.width - Kube.Units.largeSpacing * 2 model: root.controller.identitySelector.model textRole: "address" Layout.fillWidth: true //A regular binding is not enough in this case, we have to use the Binding element Binding { target: identityCombo; property: "currentIndex"; value: root.controller.identitySelector.currentIndex } onCurrentIndexChanged: { root.controller.identitySelector.currentIndex = currentIndex } } } AttendeeListEditor { id: attendees Layout.preferredHeight: implicitHeight - Layout.preferredWidth: Kube.Units.gridUnit * 12 + Layout.fillWidth: true focus: true activeFocusOnTab: true controller: root.controller.attendees completer: root.controller.attendeeCompleter } } Kube.TextEditor { Layout.fillWidth: true Layout.fillHeight: true Layout.minimumHeight: Kube.Units.gridUnit * 4 placeholderText: "Description" initialText: controller.description onTextChanged: controller.description = text } } RowLayout { id: buttons spacing: Kube.Units.largeSpacing Kube.Button { id: deleteButton text: qsTr("Delete") onClicked: { controller.remove() root.done() } } Kube.Button { id: abortButton text: qsTr("Abort") onClicked: { root.done() } } Item { Layout.fillWidth: true } Kube.CalendarComboBox { id: calendarSelector accountId: root.accountId contentType: "event" onSelected: { if (!root.editMode) { controller.calendar = calendar } } } Kube.Button { id: discardButton text: qsTr("Discard Changes") onClicked: { root.done() } } Kube.PositiveButton { id: saveButton text: qsTr("Save Changes") onClicked: { controller.saveAction.execute() root.done() } } Kube.PositiveButton { id: createButton text: qsTr("Create Event") onClicked: { controller.saveAction.execute() root.done() } } } } }