Commit 42cef8ad authored by Nate Graham's avatar Nate Graham
Browse files

Port Addons view to ListView + Kirigami.CheckableListItem

This allows the Addons view to use entirely standard components rather
than a homegrown implementation.

This increases the Frameworks dependency version to 5.78 since that's
the version that includes Kirigami.CheckableListItem.

Depends on frameworks/kirigami!185
parent 2196ed49
......@@ -5,7 +5,7 @@ set(PROJECT_VERSION_MAJOR 5)
cmake_minimum_required(VERSION 2.8.12)
set(QT_MIN_VERSION "5.15.0")
set(KF5_MIN_VERSION "5.77")
set(KF5_MIN_VERSION "5.78")
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
......
import QtQuick 2.1
import QtQuick.Controls 2.1
import QtQuick.Controls 2.14
import QtQuick.Layouts 1.1
import org.kde.discover 2.0
import "navigation.js" as Navigation
import org.kde.kirigami 2.0 as Kirigami
import org.kde.kirigami 2.14 as Kirigami
Kirigami.OverlaySheet
{
......@@ -12,48 +12,37 @@ Kirigami.OverlaySheet
property alias application: addonsModel.application
property bool isInstalling: false
readonly property bool containsAddons: rep.count>0 || isExtended
readonly property bool containsAddons: listview.count > 0 || isExtended
readonly property bool isExtended: ResourcesModel.isExtended(application.appstreamId)
header: Kirigami.Heading { text: i18n("Addons") }
ColumnLayout
ListView
{
id: listview
implicitWidth: Kirigami.Units.gridUnit * 25
visible: addonsView.containsAddons
enabled: !addonsView.isInstalling
spacing: Kirigami.Units.largeSpacing
Repeater
{
id: rep
model: ApplicationAddonsModel { id: addonsModel }
model: ApplicationAddonsModel { id: addonsModel }
delegate: RowLayout {
Layout.fillWidth: true
delegate: Kirigami.CheckableListItem {
id: listItem
CheckBox {
enabled: !addonsView.isInstalling
checked: model.checked
onClicked: addonsModel.changeState(packageName, checked)
}
enabled: !addonsView.isInstalling
icon: undefined
label: model.display
subtitle: model.toolTip
checked: model.checked
ColumnLayout {
id: content
Layout.fillWidth: true
spacing: 0
Kirigami.Heading {
Layout.fillWidth: true
level: 5
elide: Text.ElideRight
text: display
}
Label {
Layout.fillWidth: true
elide: Text.ElideRight
text: toolTip
opacity: 0.6
font: theme.smallestFont
}
action: Action {
onTriggered: {
checked = !checked
addonsModel.changeState(packageName, listItem.checked)
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment