Warning, /utilities/kongress/src/contents/ui/FavoritesView.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  * SPDX-FileCopyrightText: 2020 Dimitris Kardarakos <dimkard@posteo.net>
0003  *
0004  * SPDX-License-Identifier: GPL-3.0-or-later
0005  */
0006 
0007 import QtQuick 2.7
0008 import QtQuick.Controls 2.4 as Controls2
0009 import QtQuick.Layouts 1.11
0010 import org.kde.kirigami 2.12 as Kirigami
0011 import org.kde.kongress 0.1 as Kongress
0012 
0013 Kirigami.ScrollablePage {
0014     id: root
0015 
0016     property date eventStartDt
0017     property var roCalendar
0018     property var rwCalendar
0019     property string category
0020     property bool showCategories: true
0021 
0022     leftPadding: 0
0023     rightPadding: 0
0024 
0025     actions: [
0026         Kirigami.Action {
0027             text: i18n("Export")
0028             icon.name: "document-export"
0029 
0030             onTriggered: {
0031                 var exportResult = Kongress.CalendarController.exportData(Kongress.ConferenceController.activeConference.id, root.rwCalendar);
0032                 footerMessage.text = exportResult.reason;
0033 
0034                 if (!(exportResult.success)) {
0035                     footerMessage.type = Kirigami.MessageType.Warning;
0036                 }
0037                 else {
0038                     footerMessage.targetFolder = exportResult.targetFolder;
0039                     footerMessage.type = Kirigami.MessageType.Positive;
0040                 }
0041                 footerMessage.visible = true;
0042             }
0043         }
0044     ]
0045 
0046     footer: Kirigami.InlineMessage {
0047             id: footerMessage
0048 
0049             property string targetFolder
0050 
0051             showCloseButton: true
0052             visible: false
0053             actions: [
0054                 Kirigami.Action {
0055                     id: openFolderAction
0056 
0057                     text: i18n("Open folder")
0058                     icon.name: "folder-open"
0059 
0060                     onTriggered: {
0061                         Qt.openUrlExternally(footerMessage.targetFolder);
0062                         footerMessage.visible = false;
0063                     }
0064                 }
0065             ]
0066     }
0067 
0068 
0069     Kirigami.PlaceholderMessage {
0070         visible: cardsListview.count === 0
0071         width: parent.width - (Kirigami.Units.largeSpacing * 4)
0072         text: eventStartDt.toLocaleDateString() !== "" ? i18n("No favorite talks found for %1", eventStartDt.toLocaleDateString(Qt.locale(), Locale.ShortFormat)) : i18n("No favorite talks found")
0073         icon.name: "favorite"
0074 
0075         anchors.centerIn: parent
0076     }
0077 
0078     Component {
0079         id: eventInfo
0080 
0081         EventInfo {
0082             rwCalendar: root.rwCalendar
0083             viewMode: "favorites"
0084         }
0085     }
0086 
0087     Kirigami.CardsListView {
0088         id: cardsListview
0089 
0090         anchors.fill: parent
0091         clip: true
0092         model: eventsModel
0093 
0094         delegate: Kirigami.AbstractCard {
0095             id: cardDelegate
0096 
0097             showClickFeedback: true
0098 
0099             header: Kirigami.Heading {
0100                 text: model && model.summary
0101                 wrapMode: Text.WordWrap
0102             }
0103 
0104             onClicked: pageStack.push(eventInfo, {event: model})
0105 
0106             contentItem: Column {
0107                 spacing: Kirigami.Units.largeSpacing
0108                 topPadding: 0
0109                 bottomPadding: 0
0110 
0111                 RowLayout {
0112                     width: cardDelegate.availableWidth
0113                     spacing: Kirigami.Units.smallSpacing
0114 
0115                     Kirigami.Icon {
0116                         source: "view-calendar-day"
0117                         width: Kirigami.Units.iconSizes.small
0118                         height: width
0119                     }
0120 
0121                     Controls2.Label {
0122                         wrapMode: Text.WordWrap
0123                         text: Kongress.SettingsController.displayInLocalTimezone ? (model && model.startEndDtLocal) : (model && model.startEndDt)
0124                         Layout.fillWidth: true
0125                     }
0126                 }
0127 
0128                 RowLayout {
0129                     visible: model && model.location !== ""
0130                     width: cardDelegate.availableWidth
0131                     spacing: Kirigami.Units.smallSpacing
0132 
0133                     Kirigami.Icon {
0134                         source: "find-location"
0135                         width: Kirigami.Units.iconSizes.small
0136                         height: width
0137                     }
0138 
0139                     Controls2.Label {
0140                         wrapMode: Text.WordWrap
0141                         text: model && model.location
0142                         Layout.fillWidth: true
0143                     }
0144                 }
0145 
0146                 RowLayout {
0147                     visible: root.showCategories && model && (model.eventCategories !== "")
0148                     width: cardDelegate.availableWidth
0149                     spacing: Kirigami.Units.smallSpacing
0150 
0151                     Kirigami.Icon {
0152                         source: "category"
0153                         width: Kirigami.Units.iconSizes.small
0154                         height: width
0155                     }
0156 
0157                     Controls2.Label {
0158                         wrapMode: Text.WordWrap
0159                         text: model && model.eventCategories
0160                         Layout.fillWidth: true
0161                     }
0162                 }
0163 
0164                 Kirigami.InlineMessage {
0165                     visible: model && model.overlapping > 0
0166                     type: Kirigami.MessageType.Information
0167                     text: model && i18np("Overlaps with another talk", "Overlaps with %1 other talks", model.overlapping)
0168                     width: cardDelegate.availableWidth
0169                 }
0170 
0171             }
0172         }
0173     }
0174 
0175     Kongress.EventModel {
0176         id: eventsModel
0177 
0178         filterdt: root.eventStartDt
0179         calendar: root.roCalendar
0180         eventCategory: root.category
0181     }
0182 
0183 }