8import QtQuick.Controls as QQC2
11import org.kde.kirigami as Kirigami
13import org.kde.newstuff as NewStuff
17Private.GridTileDelegate {
20 property var entry: model.entry
21 property string useLabel
22 property string uninstallLabel
24 function showDetails() {
25 if (entry.entryType === NewStuff.Entry.GroupEntry) {
26 newStuffEngine.storeSearch();
27 newStuffEngine.searchTerm = model.payload;
29 pageStack.push(detailsPage, {
38 text: component.useLabel
39 icon.name:
"dialog-ok-apply"
40 onTriggered: source => {
41 newStuffModel.engine.adoptEntry(model.entry);
43 enabled: (entry.status === NewStuff.Entry.Installed || entry.status === NewStuff.Entry.Updateable) && newStuffEngine.hasAdoptionCommand
47 text: model.downloadLinks.length === 1
48 ?
i18ndc(
"knewstuff6",
"Request installation of this item, available when there is exactly one downloadable item",
"Install")
49 :
i18ndc(
"knewstuff6",
"Show installation options, where there is more than one downloadable item",
"Install…")
51 onTriggered: source => {
52 if (model.downloadLinks.length === 1) {
53 newStuffEngine.installLinkId(entry, NewStuff.ItemsModel.FirstLinkId);
55 downloadItemsSheet.downloadLinks = model.downloadLinks;
56 downloadItemsSheet.entry = entry;
57 downloadItemsSheet.open();
60 enabled: entry.status === NewStuff.Entry.Downloadable || entry.status === NewStuff.Entry.Deleted
64 text:
i18ndc(
"knewstuff6",
"Request updating of this item",
"Update")
65 icon.name: "update-none"
66 onTriggered: source => {
67 newStuffEngine.installLatest(entry);
69 enabled: entry.status === NewStuff.Entry.Updateable
73 text: component.uninstallLabel
74 icon.name:
"edit-delete"
75 onTriggered: source => {
76 newStuffEngine.uninstall(model.entry);
78 enabled: entry.status === NewStuff.Entry.Installed || entry.status === NewStuff.Entry.Updateable
79 visible: enabled && hovered
82 thumbnailArea: tilePreview
83 thumbnailAvailable: model.previewsSmall.length > 0
93 Layout.minimumWidth: view.implicitCellWidth / 5
94 Layout.maximumWidth: view.implicitCellWidth / 5
96 Layout.fillWidth:
true
97 Layout.minimumHeight: width
98 Layout.maximumHeight: width
100 visible: tilePreview.status === Image.Ready
101 anchors.centerIn: tilePreview
102 width: Math.min(tilePreview.paintedWidth, tilePreview.width)
103 height: Math.min(tilePreview.paintedHeight, tilePreview.height)
105 shadow.size:
Kirigami.Units.largeSpacing
106 shadow.color:
Qt.rgba(0, 0, 0, 0.3)
111 fillMode: Image.PreserveAspectFit
112 source: thumbnailAvailable ? model.previewsSmall[0] :
""
115 margins:
Kirigami.Units.smallSpacing
117 verticalAlignment: Image.AlignTop
120 id: updateAvailableBadge
121 opacity: (entry.status === NewStuff.Entry.Updateable) ? 1 : 0
122 Behavior on opacity { NumberAnimation { duration:
Kirigami.
Units.shortDuration } }
130 source:
"package-installed-outdated"
134 opacity: (entry.
status === NewStuff.Entry.Installed) ? 1 : 0
135 Behavior on opacity { NumberAnimation { duration:
Kirigami.
Units.shortDuration } }
143 source:
"package-installed-updated"
147 Layout.fillHeight: true
151 Layout.fillWidth: true
152 Layout.fillHeight: true
154 Layout.fillWidth: true
160 Layout.fillWidth: true
163 textFormat:
Text.StyledText
164 text:
i18ndc(
"knewstuff6",
"Subheading for the tile view, located immediately underneath the name of the item",
"By <i>%1</i>", entry.author.
name)
167 Layout.fillWidth: true
168 Layout.fillHeight: true
170 text: entry.shortSummary.length > 0 ? entry.shortSummary : entry.summary
176 Layout.fillWidth: true
178 visible: entry.entryType === NewStuff.Entry.CatalogEntry
181 Layout.fillWidth: true
185 text:
i18ndc(
"knewstuff6",
"The number of times the item has been downloaded",
"%1 downloads", entry.downloadCount)
186 visible: entry.entryType === NewStuff.Entry.CatalogEntry
191 newStuffModel: component.
GridView.view.model
196 onClicked: mouse => {
197 component.showDetails();
Q_SCRIPTABLE CaptureState status()
QString i18ndc(const char *domain, const char *context, const char *text, const TYPE &arg...)
QStringView level(QStringView ifopt)
QString name(StandardAction id)
QTextStream & left(QTextStream &stream)