KNewStuff

DownloadItemsSheet.qml
1/*
2 SPDX-FileCopyrightText: 2019 Dan Leinir Turthra Jensen <admin@leinir.dk>
3 SPDX-FileCopyrightText: 2023 ivan tkachenko <me@ratijas.tk>
4
5 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
6*/
7
8import QtQuick
9import QtQuick.Controls as QQC2
10import QtQuick.Layouts
11import org.kde.kirigami 2 as Kirigami
12import org.kde.kirigami.delegates as KirigamiDelegates
13import org.kde.newstuff as NewStuff
14
15/**
16 * @brief An overlay sheet for showing a list of download options for one entry
17 *
18 * This is used by the NewStuff.Page component
19 * @since 5.63
20 */
21Kirigami.OverlaySheet {
22 id: component
23
24 property var entry
25
26 property alias downloadLinks: itemsView.model
27
28 signal itemPicked(var entry, int downloadItemId, string downloadName)
29
30 showCloseButton: true
31 title: i18nd("knewstuff6", "Pick Your Installation Option")
32
33 ListView {
34 id: itemsView
35
36 headerPositioning: ListView.InlineHeader
37 header: QQC2.Label {
38 width: ListView.view.width - ListView.view.leftMargin - ListView.view.rightMargin
39 padding: Kirigami.Units.largeSpacing
40
41 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.")
42 wrapMode: Text.Wrap
43 }
44
45 delegate: QQC2.ItemDelegate {
46 id: delegate
47
48 width: itemsView.width
49
50 icon.name: modelData.icon
51 text: modelData.name
52
53 // Don't need a highlight, hover, or pressed effects
54 highlighted: false
55 hoverEnabled: false
56 down: false
57
58 contentItem: RowLayout {
59 spacing: Kirigami.Units.smallSpacing
60
61 // TODO: switch to just IconTitle once it exists, since we don't need
62 // the subtitle here and are only using a Kirigami delegate for the visual
63 // consistency it offers
64 Kirigami.IconTitleSubtitle {
65 Layout.fillWidth: true
66 icon.name: delegate.icon.name
67 title: delegate.text
68 selected: delegate.highlighted
69 }
70 QQC2.Label {
71 text: modelData.formattedSize
72 color: delegate.highlighted
73 ? Kirigami.Theme.highlightedTextColor
74 : Kirigami.Theme.textColor
75 }
76 QQC2.ToolButton {
78
79 text: i18nd("knewstuff6", "Install")
80 icon.name: "install-symbolic"
81
82 onClicked: {
83 component.close();
84 component.itemPicked(component.entry, modelData.id, modelData.name);
85 }
86 }
87 }
88 }
89 }
90}
QString i18nd(const char *domain, const char *text, const TYPE &arg...)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:21:35 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.