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 
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 
0011 import org.kde.kirigami 2.7 as Kirigami
0012 
0013 import org.kde.newstuff 1.62 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 
0022 Kirigami.OverlaySheet {
0023     id: component
0024 
0025     property string entryId
0026     property alias downloadLinks: itemsView.model
0027     signal itemPicked(string entryId, int downloadItemId, string downloadName)
0028 
0029     showCloseButton: true
0030     title: i18nd("knewstuff5", "Pick Your Installation Option")
0031 
0032     ListView {
0033         id: itemsView
0034 
0035         headerPositioning: ListView.InlineHeader
0036         header: QtControls.Label {
0037             width: ListView.view.width - ListView.view.leftMargin - ListView.view.rightMargin
0038             padding: Kirigami.Units.largeSpacing
0039 
0040             text: i18nd("knewstuff5", "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.")
0041             wrapMode: Text.Wrap
0042         }
0043 
0044         delegate: Kirigami.BasicListItem {
0045             implicitHeight: installButton.implicitHeight + Kirigami.Units.smallSpacing * 2
0046 
0047             text: modelData.name
0048             icon: modelData.icon
0049 
0050             // Don't need a highlight or hover effects
0051             hoverEnabled: false
0052             activeBackgroundColor: "transparent"
0053             activeTextColor: Kirigami.Theme.textColor
0054 
0055             trailing: QtLayouts.RowLayout {
0056                 QtControls.Label {
0057                     text: modelData.formattedSize
0058                 }
0059 
0060                 QtControls.ToolButton {
0061                     id: installButton
0062                     text: i18nd("knewstuff5", "Install")
0063                     icon.name: "install"
0064                     onClicked: {
0065                         component.close();
0066                         component.itemPicked(component.entryId, modelData.id, modelData.name);
0067                     }
0068                 }
0069             }
0070         }
0071     }
0072 }