Commit bf1704d6 authored by Devin Lin's avatar Devin Lin 🎨
Browse files

kcm: Move quicksettings form to separate page

parent 3b6a3923
Pipeline #183151 passed with stage
in 1 minute and 20 seconds
/*
* SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
* SPDX-License-Identifier: LGPL-2.0-or-later
*/
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Controls 2.15 as QQC2
import org.kde.kirigami 2.19 as Kirigami
import org.kde.kcm 1.3 as KCM
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
import "mobileform" as MobileForm
Kirigami.ScrollablePage {
id: root
title: i18n("Quick Settings")
leftPadding: 0
rightPadding: 0
topPadding: Kirigami.Units.gridUnit
bottomPadding: Kirigami.Units.gridUnit
ColumnLayout {
spacing: 0
width: root.width
MobileForm.FormCard {
Layout.fillWidth: true
contentItem: ColumnLayout {
spacing: 0
MobileForm.FormCardHeader {
title: i18n("Quick Settings")
subtitle: i18n("Customize the order of quick settings in the pull-down panel.")
}
ListView {
id: enabledQSListView
Layout.fillWidth: true
Layout.preferredHeight: contentHeight
interactive: false
model: savedQuickSettings.enabledModel
moveDisplaced: Transition {
YAnimator {
duration: Kirigami.Units.longDuration
easing.type: Easing.InOutQuad
}
}
Component {
id: listItemComponent
MobileForm.AbstractFormDelegate {
id: qsDelegate
contentItem: RowLayout {
Kirigami.ListItemDragHandle {
Layout.rightMargin: Kirigami.Units.largeSpacing
listItem: qsDelegate
listView: enabledQSListView
onMoveRequested: savedQuickSettings.enabledModel.moveRow(oldIndex, newIndex)
}
Kirigami.Icon {
visible: model && model.icon !== ""
source: model ? model.icon : ""
Layout.rightMargin: (model && model.icon !== "") ? Kirigami.Units.largeSpacing : 0
implicitWidth: (model && model.icon !== "") ? Kirigami.Units.iconSizes.small : 0
implicitHeight: (model && model.icon !== "") ? Kirigami.Units.iconSizes.small : 0
}
ColumnLayout {
Layout.fillWidth: true
spacing: Kirigami.Units.smallSpacing
QQC2.Label {
Layout.fillWidth: true
text: model ? model.name : ""
elide: Text.ElideRight
}
}
}
}
}
delegate: Kirigami.DelegateRecycler {
width: enabledQSListView.width
sourceComponent: listItemComponent
}
}
}
MobileShell.SavedQuickSettings {
id: savedQuickSettings
}
}
}
}
......@@ -120,71 +120,15 @@ KCM.SimpleKCM {
spacing: 0
MobileForm.FormCardHeader {
title: i18n("Quick Settings")
subtitle: i18n("Customize the order of quick settings in the pull-down panel.")
title: i18n("Action Drawer")
}
ListView {
id: enabledQSListView
Layout.fillWidth: true
Layout.preferredHeight: contentHeight
interactive: false
model: savedQuickSettings.enabledModel
moveDisplaced: Transition {
YAnimator {
duration: Kirigami.Units.longDuration
easing.type: Easing.InOutQuad
}
}
Component {
id: listItemComponent
MobileForm.AbstractFormDelegate {
id: qsDelegate
contentItem: RowLayout {
Kirigami.ListItemDragHandle {
Layout.rightMargin: Kirigami.Units.largeSpacing
listItem: qsDelegate
listView: enabledQSListView
onMoveRequested: savedQuickSettings.enabledModel.moveRow(oldIndex, newIndex)
}
Kirigami.Icon {
visible: model && model.icon !== ""
source: model ? model.icon : ""
Layout.rightMargin: (model && model.icon !== "") ? Kirigami.Units.largeSpacing : 0
implicitWidth: (model && model.icon !== "") ? Kirigami.Units.iconSizes.small : 0
implicitHeight: (model && model.icon !== "") ? Kirigami.Units.iconSizes.small : 0
}
ColumnLayout {
Layout.fillWidth: true
spacing: Kirigami.Units.smallSpacing
QQC2.Label {
Layout.fillWidth: true
text: model ? model.name : ""
elide: Text.ElideRight
}
}
}
}
}
delegate: Kirigami.DelegateRecycler {
width: enabledQSListView.width
sourceComponent: listItemComponent
}
MobileForm.FormButtonDelegate {
id: quickSettingsButton
text: i18n("Quick Settings")
onClicked: kcm.push("QuickSettingsForm.qml")
}
}
MobileShell.SavedQuickSettings {
id: savedQuickSettings
}
}
}
}
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