Warning, /frameworks/knewstuff/src/qtquick/qml/EntryDetails.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2019 Dan Leinir Turthra Jensen <admin@leinir.dk> 0003 0004 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 0007 /** 0008 * @brief A Kirigami.Page component used for displaying the details for a single entry 0009 * 0010 * This component is equivalent to the details view in the old DownloadDialog 0011 * @see KNewStuff::DownloadDialog 0012 * @since 5.63 0013 */ 0014 0015 import QtQuick 2.11 0016 import QtQuick.Controls 2.11 as QtControls 0017 import QtQuick.Layouts 1.11 as QtLayouts 0018 0019 import org.kde.kirigami 2.20 as Kirigami 0020 import org.kde.kcm 1.2 as KCM 0021 0022 import org.kde.newstuff 1.62 as NewStuff 0023 0024 import "private" as Private 0025 0026 KCM.SimpleKCM { 0027 id: component 0028 property QtObject newStuffModel 0029 property int index 0030 property string name 0031 property var author 0032 property alias shortSummary: shortSummaryItem.text 0033 property alias summary: summaryItem.text; 0034 property alias previews: screenshotsItem.screenshotsModel 0035 property string homepage 0036 property string donationLink 0037 property int status 0038 property int commentsCount 0039 property int rating 0040 property int downloadCount 0041 property var downloadLinks 0042 property string providerId 0043 property int entryType 0044 0045 NewStuff.DownloadItemsSheet { 0046 id: downloadItemsSheet 0047 onItemPicked: { 0048 var entryName = newStuffModel.data(newStuffModel.index(entryId, 0), NewStuff.ItemsModel.NameRole); 0049 applicationWindow().showPassiveNotification(i18ndc("knewstuff5", "A passive notification shown when installation of an item is initiated", "Installing %1 from %2", downloadName, entryName), 1500); 0050 newStuffModel.installItem(entryId, downloadItemId); 0051 } 0052 } 0053 Private.ErrorDisplayer { engine: component.newStuffModel.engine; active: component.isCurrentPage; } 0054 0055 Connections { 0056 target: newStuffModel 0057 function onEntryChanged(index) { 0058 var status = newStuffModel.data(newStuffModel.index(index, 0), NewStuff.ItemsModel.StatusRole); 0059 if (status == NewStuff.ItemsModel.DownloadableStatus 0060 || status == NewStuff.ItemsModel.InstalledStatus 0061 || status == NewStuff.ItemsModel.UpdateableStatus 0062 || status == NewStuff.ItemsModel.DeletedStatus) { 0063 statusCard.message = ""; 0064 } else if (status == NewStuff.ItemsModel.InstallingStatus) { 0065 statusCard.message = i18ndc("knewstuff5", "Status message to be shown when the entry is in the process of being installed OR uninstalled", "Currently working on the item %1 by %2. Please wait...", component.name, entryAuthor.name); 0066 } else if (status == NewStuff.ItemsModel.UpdatingStatus) { 0067 statusCard.message = i18ndc("knewstuff5", "Status message to be shown when the entry is in the process of being updated", "Currently updating the item %1 by %2. Please wait...", component.name, entryAuthor.name); 0068 } else { 0069 statusCard.message = i18ndc("knewstuff5", "Status message which should only be shown when the entry has been given some unknown or invalid status.", "This item is currently in an invalid or unknown state. <a href=\"https://bugs.kde.org/enter_bug.cgi?product=frameworks-knewstuff\">Please report this to the KDE Community in a bug report</a>."); 0070 } 0071 if (component.status != status) { 0072 component.status = status; 0073 } 0074 } 0075 } 0076 0077 NewStuff.Author { 0078 id: entryAuthor 0079 engine: component.newStuffModel.engine 0080 providerId: component.providerId 0081 username: author.name 0082 } 0083 title: i18ndc("knewstuff5", "Combined title for the entry details page made of the name of the entry, and the author's name", "%1 by %2", component.name, entryAuthor.name) 0084 actions { 0085 contextualActions: [ 0086 Kirigami.Action { 0087 text: component.downloadLinks.length == 1 ? i18ndc("knewstuff5", "Request installation of this item, available when there is exactly one downloadable item", "Install") : i18ndc("knewstuff5", "Show installation options, where there is more than one downloadable item", "Install..."); 0088 icon.name: "install" 0089 onTriggered: { 0090 if (component.downloadLinks.length == 1) { 0091 newStuffModel.installItem(component.index, NewStuff.ItemsModel.FirstLinkId); 0092 } else { 0093 downloadItemsSheet.downloadLinks = component.downloadLinks; 0094 downloadItemsSheet.entryId = component.index; 0095 downloadItemsSheet.open(); 0096 } 0097 } 0098 enabled: component.status == NewStuff.ItemsModel.DownloadableStatus || component.status == NewStuff.ItemsModel.DeletedStatus; 0099 visible: enabled; 0100 }, 0101 Kirigami.Action { 0102 text: i18ndc("knewstuff5", "Request updating of this item", "Update"); 0103 icon.name: "update-none" 0104 onTriggered: { newStuffModel.updateItem(component.index); } 0105 enabled: component.status == NewStuff.ItemsModel.UpdateableStatus; 0106 visible: enabled; 0107 }, 0108 Kirigami.Action { 0109 text: i18ndc("knewstuff5", "Request uninstallation of this item", "Uninstall"); 0110 icon.name: "edit-delete" 0111 onTriggered: { newStuffModel.uninstallItem(component.index); } 0112 enabled: component.status == NewStuff.ItemsModel.InstalledStatus || component.status == NewStuff.ItemsModel.UpdateableStatus 0113 visible: enabled; 0114 } 0115 ] 0116 } 0117 QtLayouts.ColumnLayout { 0118 spacing: Kirigami.Units.smallSpacing 0119 Kirigami.AbstractCard { 0120 id: statusCard 0121 property string message; 0122 visible: opacity > 0 0123 opacity: message.length > 0 ? 1 : 0 0124 Behavior on opacity { NumberAnimation { duration: Kirigami.Units.longDuration; } } 0125 QtLayouts.Layout.fillWidth: true 0126 QtLayouts.Layout.margins: Kirigami.Units.largeSpacing 0127 contentItem: QtLayouts.RowLayout { 0128 QtLayouts.Layout.fillWidth: true 0129 QtControls.Label { 0130 QtLayouts.Layout.fillWidth: true 0131 text: statusCard.message 0132 wrapMode: Text.Wrap 0133 onLinkActivated: Qt.openUrlExternally(link); 0134 } 0135 QtControls.BusyIndicator { 0136 running: statusCard.opacity > 0 0137 } 0138 } 0139 } 0140 Item { width: parent.width; height: Kirigami.Units.gridUnit * 3; } 0141 Private.EntryScreenshots { 0142 id: screenshotsItem 0143 QtLayouts.Layout.fillWidth: true 0144 } 0145 Kirigami.Heading { 0146 id: shortSummaryItem 0147 wrapMode: Text.Wrap 0148 QtLayouts.Layout.fillWidth: true 0149 } 0150 Kirigami.FormLayout { 0151 QtLayouts.Layout.fillWidth: true 0152 Kirigami.LinkButton { 0153 Kirigami.FormData.label: i18nd("knewstuff5", "Comments and Reviews:") 0154 enabled: component.commentsCount > 0 0155 text: i18ndc("knewstuff5", "A link which, when clicked, opens a new sub page with comments (comments with or without ratings) for this entry", "%1 Reviews and Comments", component.commentsCount) 0156 onClicked: pageStack.push(commentsPage) 0157 } 0158 Private.Rating { 0159 id: ratingsItem 0160 Kirigami.FormData.label: i18nd("knewstuff5", "Rating:") 0161 rating: component.rating 0162 } 0163 Kirigami.UrlButton { 0164 Kirigami.FormData.label: i18nd("knewstuff5", "Homepage:") 0165 text: i18ndc("knewstuff5", "A link which, when clicked, opens the website associated with the entry (this could be either one specific to the project, the author's homepage, or any other website they have chosen for the purpose)", "Open the homepage for %1", component.name) 0166 url: component.homepage 0167 visible: component.homepage 0168 } 0169 Kirigami.UrlButton { 0170 Kirigami.FormData.label: i18nd("knewstuff5", "How To Donate:") 0171 text: i18ndc("knewstuff5", "A link which, when clicked, opens a website with information on donation in support of the entry", "Find out how to donate to this project") 0172 url: component.donationLink 0173 visible: component.donationLink 0174 } 0175 } 0176 Kirigami.SelectableLabel { 0177 id: summaryItem 0178 0179 QtLayouts.Layout.fillWidth: true 0180 QtLayouts.Layout.margins: Kirigami.Units.largeSpacing 0181 0182 textFormat: Text.RichText 0183 } 0184 Component { 0185 id: commentsPage 0186 Private.EntryCommentsPage { 0187 itemsModel: component.newStuffModel 0188 entryIndex: component.index 0189 entryName: component.name 0190 entryAuthorId: component.author.name 0191 entryProviderId: component.providerId 0192 } 0193 } 0194 } 0195 }