Warning, /frameworks/knewstuff/src/qtquick/qml/DownloadItemsSheet.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 SPDX-FileCopyrightText: 2019 Dan Leinir Turthra Jensen <admin@leinir.dk>
0003 SPDX-FileCopyrightText: 2023 ivan tkachenko <me@ratijas.tk>
0004
0005 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0006 */
0007
0008 import QtQuick
0009 import QtQuick.Controls as QQC2
0010 import QtQuick.Layouts
0011 import org.kde.kirigami 2 as Kirigami
0012 import org.kde.kirigami.delegates as KirigamiDelegates
0013 import org.kde.newstuff as NewStuff
0014
0015 /**
0016 * @brief An overlay sheet for showing a list of download options for one entry
0017 *
0018 * This is used by the NewStuff.Page component
0019 * @since 5.63
0020 */
0021 Kirigami.OverlaySheet {
0022 id: component
0023
0024 property var entry
0025
0026 property alias downloadLinks: itemsView.model
0027
0028 signal itemPicked(var entry, int downloadItemId, string downloadName)
0029
0030 showCloseButton: true
0031 title: i18nd("knewstuff6", "Pick Your Installation Option")
0032
0033 ListView {
0034 id: itemsView
0035
0036 headerPositioning: ListView.InlineHeader
0037 header: QQC2.Label {
0038 width: ListView.view.width - ListView.view.leftMargin - ListView.view.rightMargin
0039 padding: Kirigami.Units.largeSpacing
0040
0041 text: i18nd("knewstuff6", "Please select the option you wish to install from the list of downloadable items below. If it is unclear which you should chose out of the available options, please contact the author of this item and ask that they clarify this through the naming of the items.")
0042 wrapMode: Text.Wrap
0043 }
0044
0045 delegate: QQC2.ItemDelegate {
0046 id: delegate
0047
0048 width: itemsView.width
0049
0050 icon.name: modelData.icon
0051 text: modelData.name
0052
0053 // Don't need a highlight, hover, or pressed effects
0054 highlighted: false
0055 hoverEnabled: false
0056 down: false
0057
0058 contentItem: RowLayout {
0059 spacing: Kirigami.Units.smallSpacing
0060
0061 // TODO: switch to just IconTitle once it exists, since we don't need
0062 // the subtitle here and are only using a Kirigami delegate for the visual
0063 // consistency it offers
0064 Kirigami.IconTitleSubtitle {
0065 Layout.fillWidth: true
0066 icon.name: delegate.icon.name
0067 title: delegate.text
0068 selected: delegate.highlighted
0069 }
0070 QQC2.Label {
0071 text: modelData.formattedSize
0072 color: delegate.highlighted
0073 ? Kirigami.Theme.highlightedTextColor
0074 : Kirigami.Theme.textColor
0075 }
0076 QQC2.ToolButton {
0077 id: installButton
0078
0079 text: i18nd("knewstuff6", "Install")
0080 icon.name: "install-symbolic"
0081
0082 onClicked: {
0083 component.close();
0084 component.itemPicked(component.entry, modelData.id, modelData.name);
0085 }
0086 }
0087 }
0088 }
0089 }
0090 }