Commit fadf0996 authored by Fushan Wen's avatar Fushan Wen 💬
Browse files

desktoppackage: use `Kirigami.PlaceholderMessage` for containment warning

This improves the consistency.
parent bce2f457
Pipeline #194250 passed with stage
in 3 minutes and 51 seconds
......@@ -4,14 +4,14 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
import QtQuick 2.0
import QtQuick 2.15
import org.kde.plasma.configuration 2.0
import QtQuick.Controls 2.3 as QQC2
import QtQuick.Layouts 1.1
import QtQml 2.15
import org.kde.newstuff 1.62 as NewStuff
import org.kde.kirigami 2.5 as Kirigami
import org.kde.kirigami 2.20 as Kirigami
import org.kde.kcm 1.4
import org.kde.plasma.plasmoid 2.0
......@@ -103,8 +103,9 @@ Item {
RowLayout {
Layout.fillWidth: true
visible: !switchContainmentWarning.visible
enabled: main.currentItem.objectName !== "switchContainmentWarningItem"
Kirigami.FormData.label: i18nd("plasma_shell_org.kde.plasma.desktop", "Wallpaper type:")
QQC2.ComboBox {
id: wallpaperComboBox
Layout.preferredWidth: Math.max(implicitWidth, pluginComboBox.implicitWidth)
......@@ -121,40 +122,12 @@ Item {
NewStuff.Button {
configFile: "wallpaperplugin.knsrc"
text: i18nd("plasma_shell_org.kde.plasma.desktop", "Get New Plugins…")
visibleWhenDisabled: true // don't hide on disabled
Layout.preferredHeight: wallpaperComboBox.height
}
}
}
ColumnLayout {
id: switchContainmentWarning
Layout.fillWidth: true
visible: configDialog.containmentPlugin !== appearanceRoot.containmentPlugin
QQC2.Label {
Layout.fillWidth: true
text: i18nd("plasma_shell_org.kde.plasma.desktop", "Layout changes must be applied before other changes can be made")
wrapMode: Text.Wrap
horizontalAlignment: Text.AlignHCenter
}
QQC2.Button {
Layout.alignment: Qt.AlignHCenter
text: i18nd("plasma_shell_org.kde.plasma.desktop", "Apply Now")
onClicked: saveConfig()
}
Binding {
target: categoriesScroll //from parent scope AppletConfiguration
property: "enabled"
value: !switchContainmentWarning.visible
restoreMode: Binding.RestoreBinding
}
}
Item {
Layout.fillHeight: true
visible: switchContainmentWarning.visible
}
Item {
id: emptyConfig
}
......@@ -167,8 +140,6 @@ Item {
Layout.fillHeight: true;
Layout.fillWidth: true;
visible: !switchContainmentWarning.visible
// Bug 360862: if wallpaper has no config, sourceFile will be ""
// so we wouldn't load emptyConfig and break all over the place
// hence set it to some random value initially
......@@ -205,4 +176,44 @@ Item {
}
}
}
Component {
id: switchContainmentWarning
Item {
objectName: "switchContainmentWarningItem"
Kirigami.PlaceholderMessage {
id: message
anchors {
centerIn: parent
verticalCenterOffset: -applyNowButton.implicitHeight - applyNowButton.anchors.topMargin
}
icon.name: "documentinfo"
width: parent.width - Kirigami.Units.largeSpacing * 8
text: i18nd("plasma_shell_org.kde.plasma.desktop", "Layout changes must be applied before other changes can be made")
}
QQC2.Button {
id: applyNowButton
anchors {
top: message.bottom
topMargin: Kirigami.Units.largeSpacing
horizontalCenter: parent.horizontalCenter
}
icon.name: "dialog-ok-apply"
text: i18nd("plasma_shell_org.kde.plasma.desktop", "Apply Now")
onClicked: saveConfig()
}
}
}
onContainmentPluginChanged: {
if (configDialog.containmentPlugin !== appearanceRoot.containmentPlugin) {
main.push(switchContainmentWarning);
categoriesScroll.enabled = false;
} else if (main.currentItem.objectName === "switchContainmentWarningItem") {
main.pop();
categoriesScroll.enabled = true;
}
}
}
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