1/* 2 * SPDX-FileCopyrightText: 2018 Aleix Pol Gonzalez <aleixpol@blue-systems.com> 3 * 4 * SPDX-License-Identifier: LGPL-2.0-or-later 5 */ 6 7import QtQuick 2.8 8import QtQuick.Controls 2.1 9import org.kde.kirigami 2.14 as Kirigami 10 11Kirigami.LinkButton { 12 text: i18n("Show Dependencies…") 13 14 onClicked: overlay.open() 15 visible: view.model.count > 0 16 17 Connections { 18 target: resource 19 function onDependenciesFound() { 20 view.model.clear() 21 for (var v in resource.dependencies) { 22 view.model.append(resource.dependencies[v]) 23 } 24 } 25 } 26 27 Kirigami.OverlaySheet { 28 id: overlay 29 30 parent: applicationWindow().overlay 31 32 title: i18n("Dependencies for package: %1", resource.packageName) 33 34 ListView { 35 id: view 36 implicitWidth: Kirigami.Units.gridUnit * 26 37 clip: true 38 model: ListModel {} 39 // FIXME: Workaround for https://bugs.kde.org/show_bug.cgi?id=435546 40 headerPositioning: ListView.OverlayHeader 41 42 section.property: "packageInfo" 43 section.delegate: Kirigami.ListSectionHeader { 44 width: view.width 45 // FIXME: Workaround for https://bugs.kde.org/show_bug.cgi?id=435546 46 height: Kirigami.Units.fontMetrics.xHeight * 4 47 label: section 48 } 49 delegate: Kirigami.BasicListItem { 50 width: view.width 51 text: model.packageName 52 subtitle: model.packageDescription 53 // No need to offer a hover/selection effect since these list 54 // items are non-interactive and non-selectable 55 activeBackgroundColor: "transparent" 56 activeTextColor: Kirigami.Theme.textColor 57 } 58 } 59 } 60} 61