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

Make accidental panel and panel widget deletion more difficult

Summary:
We make it very easy to delete panels and panel widgets--perhaps a bit too easy. User
feedback has indicated that we may need to re-work this a bit, and that perhaps D20144 was a
mistake.

This patch moves the {nav Remove Panel} button back into the {nav More} menu where it used to
be, to make it harder to accidentally click on. It also moves the {nav Remove} button for
panel widgets higher up in the menu so it's not so close to the cursor.

To adjust to these changes, the layout of buttons on the panel toolbar is changed to
preserve visual balance, and the {nav More} menu's name is adjusted to reflect the fact that
removing a panel is not a setting.

BUG: 419853
FIXED-IN: 5.18.5

Test Plan: {F8227561}

Reviewers: #vdg, #plasma, ndavis

Reviewed By: #vdg, ndavis

Subscribers: rikmills, broulik, plasma-devel

Tags: #plasma

Maniphest Tasks: T12942

Differential Revision: https://phabricator.kde.org/D28710
parent a2c69db5
......@@ -360,7 +360,6 @@ MouseArea {
currentApplet.applet.prepareContextualActions();
alternativesButton.visible = currentApplet.applet.action("alternatives") && currentApplet.applet.action("alternatives").enabled;
configureButton.visible = currentApplet.applet.action("configure") && currentApplet.applet.action("configure").enabled;
closeButton.visible = currentApplet.applet.action("remove") && currentApplet.applet.action("remove").enabled;
label.text = currentApplet.applet.title;
}
}
......@@ -384,6 +383,21 @@ MouseArea {
Layout.leftMargin: units.smallSpacing * 2
Layout.rightMargin: units.smallSpacing * 2
}
PlasmaComponents.ToolButton {
Layout.fillWidth: true
// we want destructive actions to be far from the initial
// cursor position, so show this on the top unless it's on
// a top panel
visible: tooltip.location !== PlasmaCore.Types.TopEdge
&& currentApplet.applet.action("remove")
&& currentApplet.applet.action("remove").enabled
iconSource: "delete"
text: i18n("Remove")
onClicked: {
tooltip.visible = false;
currentApplet.applet.action("remove").trigger();
}
}
PlasmaComponents.ToolButton {
id: configureButton
Layout.fillWidth: true
......@@ -405,8 +419,12 @@ MouseArea {
}
}
PlasmaComponents.ToolButton {
id: closeButton
Layout.fillWidth: true
// we want destructive actions to be far from the initial
// cursor position, so show this on the bottom for top panels
visible: tooltip.location === PlasmaCore.Types.TopEdge
&& currentApplet.applet.action("remove")
&& currentApplet.applet.action("remove").enabled
iconSource: "delete"
text: i18n("Remove")
onClicked: {
......
......@@ -38,6 +38,16 @@ PlasmaCore.Dialog {
LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft
LayoutMirroring.childrenInherit: true
PlasmaComponents.ToolButton {
Layout.fillWidth: true
// we want destructive actions to be far from the initial cursor
// position, so show this on the top unless it's on a top panel
visible: location !== PlasmaCore.Types.TopEdge
text: i18nd("plasma_shell_org.kde.plasma.desktop", "Remove Panel")
iconSource: "delete"
onClicked: plasmoid.action("remove").trigger();
}
PlasmaExtras.Heading {
level: 3
text: i18nd("plasma_shell_org.kde.plasma.desktop", "Panel Alignment")
......@@ -127,6 +137,15 @@ PlasmaCore.Dialog {
iconSource: panel.formFactor === PlasmaCore.Types.Vertical ? "zoom-fit-height" : "zoom-fit-width"
onClicked: panel.maximize();
}
PlasmaComponents.ToolButton {
Layout.fillWidth: true
// we want destructive actions to be far from the initial cursor
// position, so show this on the bottom for top panels
visible: location === PlasmaCore.Types.TopEdge
text: i18nd("plasma_shell_org.kde.plasma.desktop", "Remove Panel")
iconSource: "delete"
onClicked: plasmoid.action("remove").trigger();
}
}
function hide() {
......
......@@ -30,7 +30,6 @@ Item {
implicitWidth: Math.max(buttonsLayout_1.width, buttonsLayout_2.width, row.width) + units.smallSpacing * 2
implicitHeight: row.height + 20
readonly property string removePanelButtonText: i18nd("plasma_shell_org.kde.plasma.desktop", "Remove Panel")
readonly property string addWidgetsButtonText: i18nd("plasma_shell_org.kde.plasma.desktop", "Add Widgets...")
readonly property string addSpacerButtonText: i18nd("plasma_shell_org.kde.plasma.desktop", "Add Spacer")
readonly property string settingsButtonText: i18nd("plasma_shell_org.kde.plasma.desktop", "More Settings...")
......@@ -67,12 +66,23 @@ Item {
columnSpacing: units.smallSpacing
PlasmaComponents.Button {
iconSource: "delete"
text: buttonsLayout_1.showText ? root.removePanelButtonText : ""
tooltip: buttonsLayout_1.showText ? "" : root.removePanelButtonText
text: buttonsLayout_2.showText ? root.addWidgetsButtonText : ""
tooltip: buttonsLayout_2.showText ? "" : root.addWidgetsButtonText
iconSource: "list-add"
Layout.fillWidth: true
onClicked: {
configDialog.close();
configDialog.showAddWidgetDialog();
}
}
PlasmaComponents.Button {
iconSource: "distribute-horizontal-x"
text: buttonsLayout_2.showText ? root.addSpacerButtonText : ""
tooltip: buttonsLayout_2.showText ? "" : root.addSpacerButtonText
Layout.fillWidth: true
onClicked: {
plasmoid.action("remove").trigger();
configDialog.addPanelSpacer();
}
}
}
......@@ -124,27 +134,6 @@ Item {
rowSpacing: units.smallSpacing
columnSpacing: units.smallSpacing
PlasmaComponents.Button {
text: buttonsLayout_2.showText ? root.addWidgetsButtonText : ""
tooltip: buttonsLayout_2.showText ? "" : root.addWidgetsButtonText
iconSource: "list-add"
Layout.fillWidth: true
onClicked: {
configDialog.close();
configDialog.showAddWidgetDialog();
}
}
PlasmaComponents.Button {
iconSource: "distribute-horizontal-x"
text: buttonsLayout_2.showText ? root.addSpacerButtonText : ""
tooltip: buttonsLayout_2.showText ? "" : root.addSpacerButtonText
Layout.fillWidth: true
onClicked: {
configDialog.addPanelSpacer();
}
}
PlasmaComponents.Button {
id: settingsButton
iconSource: "configure"
......
Markdown is supported
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