8import QtQuick.Controls 2.11 as QtControls
9import QtQuick.Layouts 1.11 as QtLayouts
11import org.kde.kirigami 2.12 as Kirigami
13import org.kde.newstuff as NewStuff
17Private.GridTileDelegate {
19 property var entry: model.entry
20 property string useLabel
21 property string uninstallLabel
22 function showDetails() {
23 if (entry.entryType ==
NewStuff.Entry.GroupEntry) {
24 newStuffEngine.storeSearch();
25 newStuffEngine.searchTerm = model.payload;
35 text: component.useLabel
36 icon.name:
"dialog-ok-apply"
37 onTriggered: { newStuffModel.adoptItem(model.index); }
38 enabled: (entry.status ==
NewStuff.Entry.Installed || entry.status ==
NewStuff.Entry.Updateable) && newStuffEngine.hasAdoptionCommand
42 text: model.downloadLinks.length === 1 ?
i18ndc(
"knewstuff6",
"Request installation of this item, available when there is exactly one downloadable item",
"Install") :
i18ndc(
"knewstuff6",
"Show installation options, where there is more than one downloadable item",
"Install…");
45 if (model.downloadLinks.length === 1) {
46 newStuffEngine.install(entry,
NewStuff.ItemsModel.FirstLinkId);
48 downloadItemsSheet.downloadLinks = model.downloadLinks;
49 downloadItemsSheet.entry = entry;
50 downloadItemsSheet.open();
53 enabled: entry.status ==
NewStuff.Entry.Downloadable || entry.status ==
NewStuff.Entry.Deleted;
57 text:
i18ndc(
"knewstuff6",
"Request updating of this item",
"Update");
58 icon.name:
"update-none"
59 onTriggered: { newStuffEngine.install(entry,
NewStuff.ItemsModel.AutoDetectLinkId); }
60 enabled: entry.status ==
NewStuff.Entry.Updateable
64 text: component.uninstallLabel
65 icon.name:
"edit-delete"
66 onTriggered: { newStuffEngine.uninstall(model.entry); }
67 enabled: entry.status ==
NewStuff.Entry.Installed|| entry.status ==
NewStuff.Entry.Updateable
68 visible: enabled && hovered
72 thumbnailAvailable: model.previewsSmall.length > 0
82 QtLayouts.Layout.minimumWidth: view.implicitCellWidth / 5
83 QtLayouts.Layout.maximumWidth: view.implicitCellWidth / 5
94 shadow.size:
Kirigami.Units.largeSpacing
95 shadow.color:
Qt.rgba(0, 0, 0, 0.3)
100 fillMode: Image.PreserveAspectFit;
101 source: thumbnailAvailable ? model.previewsSmall[0] :
"";
104 margins:
Kirigami.Units.smallSpacing
106 verticalAlignment: Image.AlignTop
110 opacity: (entry.status ==
NewStuff.Entry.Updateable) ? 1 : 0;
115 margins: -
Kirigami.Units.smallSpacing;
117 height:
Kirigami.Units.iconSizes.smallMedium;
119 source:
"package-installed-outdated";
123 opacity: (entry.status ==
NewStuff.Entry.Installed) ? 1 : 0;
128 margins: -
Kirigami.Units.smallSpacing;
130 height:
Kirigami.Units.iconSizes.smallMedium;
132 source:
"package-installed-updated";
144 elide: Text.ElideRight
150 elide: Text.ElideRight
152 textFormat: Text.StyledText
153 text:
i18ndc(
"knewstuff6",
"Subheading for the tile view, located immediately underneath the name of the item",
"By <i>%1</i>", entry.author.name)
159 text: entry.shortSummary.length > 0 ? entry.shortSummary : entry.summary
160 elide: Text.ElideRight
167 visible: entry.entryType ==
NewStuff.Entry.CatalogEntry;
171 horizontalAlignment: Text.AlignRight
173 elide: Text.ElideRight
174 text:
i18ndc(
"knewstuff6",
"The number of times the item has been downloaded",
"%1 downloads", entry.downloadCount)
175 visible: entry.entryType ==
NewStuff.Entry.CatalogEntry
180 newStuffModel: component.GridView.view.model
183 anchors.fill: parent;
184 cursorShape:
Qt.PointingHandCursor;
185 onClicked: component.showDetails();
QString i18ndc(const char *domain, const char *context, const char *text, const TYPE &arg...)
QStringView level(QStringView ifopt)
QTextStream & left(QTextStream &stream)