2019-10-27 17:08:51 +00:00
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
2023-12-23 16:48:04 +00:00
|
|
|
import QtQuick
|
|
|
|
import QtQuick.Controls
|
|
|
|
import QtQuick.Layouts
|
|
|
|
import org.kde.kirigami as Kirigami
|
2024-10-05 20:16:14 +01:00
|
|
|
import org.kde.kitemmodels as KItemModels
|
2023-12-23 16:48:04 +00:00
|
|
|
import org.kde.kdeconnect
|
2019-10-27 17:08:51 +00:00
|
|
|
|
2022-12-13 20:49:21 +00:00
|
|
|
Kirigami.ScrollablePage {
|
2019-10-27 17:08:51 +00:00
|
|
|
id: root
|
2024-10-05 20:16:14 +01:00
|
|
|
|
2019-10-27 17:08:51 +00:00
|
|
|
property string device
|
2024-10-05 20:16:14 +01:00
|
|
|
property string filterString
|
|
|
|
|
|
|
|
title: i18n("Plugin Settings")
|
|
|
|
|
|
|
|
header: Control {
|
|
|
|
topPadding: Kirigami.Units.smallSpacing
|
|
|
|
bottomPadding: Kirigami.Units.smallSpacing
|
|
|
|
leftPadding: Kirigami.Units.smallSpacing
|
|
|
|
rightPadding: Kirigami.Units.smallSpacing
|
|
|
|
|
|
|
|
background: Rectangle {
|
|
|
|
Kirigami.Theme.colorSet: Kirigami.Theme.Window
|
|
|
|
Kirigami.Theme.inherit: false
|
|
|
|
color: Kirigami.Theme.backgroundColor
|
|
|
|
|
|
|
|
Kirigami.Separator {
|
|
|
|
anchors {
|
|
|
|
left: parent.left
|
|
|
|
bottom: parent.bottom
|
|
|
|
right: parent.right
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
contentItem: Kirigami.SearchField {
|
|
|
|
id: searchField
|
|
|
|
onTextChanged: root.filterString = text;
|
|
|
|
autoAccept: false
|
|
|
|
}
|
|
|
|
}
|
2019-10-27 17:08:51 +00:00
|
|
|
|
|
|
|
ListView {
|
2024-10-05 20:16:14 +01:00
|
|
|
model: KItemModels.KSortFilterProxyModel {
|
|
|
|
filterString: root.filterString
|
|
|
|
filterRoleName: "name"
|
|
|
|
filterCaseSensitivity: Qt.CaseInsensitive
|
2019-10-27 17:08:51 +00:00
|
|
|
|
2024-10-05 20:16:14 +01:00
|
|
|
sourceModel: PluginModel {
|
|
|
|
deviceId: device
|
|
|
|
}
|
2019-10-27 17:08:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
delegate: Kirigami.SwipeListItem {
|
|
|
|
|
2023-11-08 21:06:14 +00:00
|
|
|
contentItem: RowLayout {
|
2020-11-15 23:39:23 +00:00
|
|
|
CheckBox {
|
|
|
|
id: serviceCheck
|
|
|
|
Layout.alignment: Qt.AlignVCenter
|
|
|
|
checked: model.isChecked
|
|
|
|
onToggled: model.isChecked = checked
|
2024-03-12 14:26:37 +00:00
|
|
|
Accessible.name: model.name
|
|
|
|
Accessible.description: model.description
|
2020-11-15 23:39:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|
2019-10-27 17:08:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
actions: [
|
|
|
|
Kirigami.Action {
|
|
|
|
icon.name: "settings-configure"
|
|
|
|
visible: configSource != ""
|
2024-03-12 14:26:37 +00:00
|
|
|
// 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")
|
2019-10-27 17:08:51 +00:00
|
|
|
onTriggered: {
|
2024-10-05 21:53:32 +01:00
|
|
|
pageStack.push(configSource, {
|
|
|
|
title: name,
|
|
|
|
device: root.device,
|
|
|
|
});
|
2019-10-27 17:08:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|