kdeconnect-kde/app/qml/PluginSettings.qml
Nicolas Fella 6366ceb530 [app] Fixup plugin config pages
Depending on the content we want to use Page or ScrollablePage

The runcommand config should be a scrollablepage, but isn't right now

The code even (incompletely) works around that

To address this make the individual config files add their page instead of an additional wrapper page
2024-06-06 02:27:40 +02:00

79 lines
2.4 KiB
QML

/*
* SPDX-FileCopyrightText: 2019 Nicolas Fella <nicolas.fella@gmx.de>
*
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import org.kde.kirigami as Kirigami
import org.kde.kdeconnect
Kirigami.ScrollablePage {
id: root
title: i18n("Plugin Settings")
property string device
ListView {
anchors.fill: parent
model: PluginModel {
deviceId: device
}
delegate: Kirigami.SwipeListItem {
contentItem: RowLayout {
CheckBox {
id: serviceCheck
Layout.alignment: Qt.AlignVCenter
checked: model.isChecked
onToggled: model.isChecked = checked
Accessible.name: model.name
Accessible.description: model.description
}
ColumnLayout {
spacing: 0
Layout.fillWidth: true
Layout.alignment: Qt.AlignVCenter
Label {
Layout.fillWidth: true
text: model.name
elide: Text.ElideRight
}
Label {
Layout.fillWidth: true
text: model.description
elide: Text.ElideRight
font: Kirigami.Theme.smallFont
opacity: 0.7
}
}
}
actions: [
Kirigami.Action {
icon.name: "settings-configure"
visible: configSource != ""
// FIXME: not accessible. screen readers won't read this and just say "push button".
// https://bugreports.qt.io/browse/QTBUG-123123
Accessible.name: i18nd("kdeconnect-app", "Configure plugin")
onTriggered: {
if (!pageStack.lastItem.toString().startsWith("PluginSettings")) {
pageStack.pop()
}
pageStack.push(configSource, {
title: name,
device: root.device,
});
}
}
]
}
}
}