Warning, /frameworks/knewstuff/src/qtquick/qml/private/entrygriddelegates/ThumbDelegate.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 import QtQuick 2.11
0008 import QtQuick.Controls 2.11 as QtControls
0009 import QtQuick.Layouts 1.11 as QtLayouts
0010 import Qt5Compat.GraphicalEffects 6.0 as QtEffects
0011 
0012 import org.kde.kcmutils as KCM
0013 import org.kde.kirigami 2.7 as Kirigami
0014 
0015 import org.kde.newstuff as NewStuff
0016 
0017 import ".." as Private
0018 
0019 KCM.GridDelegate {
0020     id: component
0021     property string useLabel
0022     property string uninstallLabel
0023     text: model.name
0024     property var entry: model.entry
0025     actions: [
0026         Kirigami.Action {
0027             text: component.useLabel
0028             icon.name: "dialog-ok-apply"
0029             onTriggered: { newStuffModel.engine.adoptEntry(entry); }
0030             enabled: (entry.status == NewStuff.Entry.Installed || entry.status == NewStuff.Entry.Updateable) && newStuffEngine.hasAdoptionCommand
0031             visible: enabled
0032         },
0033         Kirigami.Action {
0034             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…");
0035             icon.name: "install"
0036             onTriggered: {
0037                 if (model.downloadLinks.length === 1) {
0038                     newStuffModel.engine.install(entry, NewStuff.Entry.FirstLinkId);
0039                 } else {
0040                     downloadItemsSheet.downloadLinks = model.downloadLinks;
0041                     downloadItemsSheet.entry = entry;
0042                     downloadItemsSheet.open();
0043                 }
0044             }
0045             enabled: entry.status == NewStuff.Entry.Downloadable || entry.status == NewStuff.Entry.Deleted
0046             visible: enabled
0047         },
0048         Kirigami.Action {
0049             text: i18ndc("knewstuff6", "Request updating of this item", "Update");
0050             icon.name: "update-none"
0051             onTriggered: { newStuffModel.engine.install(entry, NewStuff.ItemsModel.AutoDetectLinkId); }
0052             enabled: entry.status == NewStuff.Entry.Updateable
0053             visible: enabled
0054         },
0055         Kirigami.Action {
0056             text: component.uninstallLabel
0057             icon.name: "edit-delete"
0058             onTriggered: { newStuffModel.engine.uninstall(entry); }
0059             enabled: entry.status == NewStuff.Entry.Installed || entry.status == NewStuff.Entry.Updateable
0060             visible: enabled
0061         }
0062     ]
0063     thumbnailAvailable: model.previewsSmall.length > 0
0064     thumbnail: Image {
0065         anchors {
0066             fill: parent;
0067             margins: Kirigami.Units.smallSpacing;
0068         }
0069         asynchronous: true;
0070         fillMode: Image.PreserveAspectFit;
0071         source: thumbnailAvailable ? model.previewsSmall[0] : "";
0072         Kirigami.Icon {
0073             id: updateAvailableBadge;
0074             opacity: (entry.status == NewStuff.Entry.Updateable) ? 1 : 0;
0075             Behavior on opacity { NumberAnimation { duration: Kirigami.Units.shortDuration; } }
0076             anchors {
0077                 top: parent.top;
0078                 right: parent.right;
0079                 margins: -Kirigami.Units.smallSpacing;
0080             }
0081             height: Kirigami.Units.iconSizes.smallMedium;
0082             width: height;
0083             source: "package-installed-outdated";
0084         }
0085         Kirigami.Icon {
0086             id: installedBadge;
0087             opacity: (entry.status == NewStuff.Entry.Installed) ? 1 : 0;
0088             Behavior on opacity { NumberAnimation { duration: Kirigami.Units.shortDuration; } }
0089             anchors {
0090                 top: parent.top;
0091                 right: parent.right;
0092                 margins: -Kirigami.Units.smallSpacing;
0093             }
0094             height: Kirigami.Units.iconSizes.smallMedium;
0095             width: height;
0096             source: "package-installed-updated";
0097         }
0098         FeedbackOverlay {
0099             anchors.fill: parent
0100             newStuffModel: component.GridView.view.model
0101         }
0102         MouseArea {
0103             anchors.fill: parent;
0104             cursorShape: Qt.PointingHandCursor;
0105             onClicked: pageStack.push(detailsPage, {
0106                 newStuffModel: component.GridView.view.model,
0107                 entry: entry,
0108             });
0109 
0110         }
0111     }
0112 }