Commit 43390558 authored by Nate Graham's avatar Nate Graham
Browse files

AppChooser portal: move delegate code inline

It's only used once so we don't need to put it in a separate component
that's named but never explicitly referred to.
parent 6b8d5603
Pipeline #169796 failed with stage
in 21 seconds
......@@ -3,6 +3,7 @@
* SPDX-License-Identifier: LGPL-2.0-or-later
*
* SPDX-FileCopyrightText: 2019 Jan Grulich <jgrulich@redhat.com>
* SPDX-FileCopyrightText: 2022 Nate Graham <nate@kde.org>
*/
......@@ -60,7 +61,53 @@ PWD.SystemDialog
cellHeight: Kirigami.Units.iconSizes.huge + (Kirigami.Units.gridUnit * 4)
cellWidth: Kirigami.Units.iconSizes.huge + (Kirigami.Units.gridUnit * 4)
model: AppModel
delegate: appDelegate
delegate: Item {
height: grid.cellHeight
width: grid.cellWidth
HoverHandler {
acceptedButtons: Qt.NoButton
cursorShape: hovered ? Qt.PointingHandCursor : Qt.ArrowCursor
}
TapHandler {
onTapped: AppChooserData.applicationSelected(model.applicationDesktopFile)
}
Rectangle {
anchors.fill: parent
color: Kirigami.Theme.highlightColor
visible: model.applicationDesktopFile === AppChooserData.defaultApp
radius: 2
}
ColumnLayout {
anchors {
top: parent.top
left: parent.left
right: parent.right
margins: Kirigami.Units.largeSpacing
}
spacing: Kirigami.Units.largeSpacing
Kirigami.Icon {
anchors.horizontalCenter: parent.horizontalCenter
Layout.preferredWidth: Kirigami.Units.iconSizes.huge
Layout.preferredHeight: Kirigami.Units.iconSizes.huge
source: model.applicationIcon
smooth: true
}
Label {
Layout.fillWidth: true
Layout.alignment: Qt.AlignTop
horizontalAlignment: Text.AlignHCenter
elide: Text.ElideRight
maximumLineCount: 2
text: model.applicationName
wrapMode: Text.WordWrap
}
}
}
}
}
......@@ -84,57 +131,5 @@ PWD.SystemDialog
onTextChanged: AppModel.filter = text
}
}
readonly property var p0: Component {
id: appDelegate
Item {
height: grid.cellHeight
width: grid.cellWidth
HoverHandler {
acceptedButtons: Qt.NoButton
cursorShape: hovered ? Qt.PointingHandCursor : Qt.ArrowCursor
}
TapHandler {
onTapped: AppChooserData.applicationSelected(model.applicationDesktopFile)
}
Rectangle {
anchors.fill: parent
color: Kirigami.Theme.highlightColor
visible: model.applicationDesktopFile === AppChooserData.defaultApp
radius: 2
}
ColumnLayout {
anchors {
top: parent.top
left: parent.left
right: parent.right
margins: Kirigami.Units.largeSpacing
}
spacing: Kirigami.Units.largeSpacing
Kirigami.Icon {
anchors.horizontalCenter: parent.horizontalCenter
Layout.preferredWidth: Kirigami.Units.iconSizes.huge
Layout.preferredHeight: Kirigami.Units.iconSizes.huge
source: model.applicationIcon
smooth: true
}
Label {
Layout.fillWidth: true
Layout.alignment: Qt.AlignTop
horizontalAlignment: Text.AlignHCenter
elide: Text.ElideRight
maximumLineCount: 2
text: model.applicationName
wrapMode: Text.WordWrap
}
}
}
}
}
Supports Markdown
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