on xenial help sign in
Hide the close button for dash Fixes: #1550056, #1564347

Approved by: Josh Arenson

commitea8906fd623ea7b62c2a4efb9195c8827b26f5b1 authorLukáš Tinkl <lukas.tinkl@canonical.com> dateWed 27 Apr 2016, 14:56 (10 years ago) parente6335b5ccdf96f
6 files changed+18
qml/Components/PanelState/PanelState.qml+1 qml/Components/WindowControlButtons.qml+2 qml/Panel/Panel.qml+1 qml/Stages/DesktopStage.qml+6 qml/Stages/WindowDecoration.qml+1 tests/qmltests/Stages/tst_DesktopStage.qml+7
qml/Components/PanelState/PanelState.qml+1
@@ -22,6 +22,7 @@ QtObject {
2222
2323 property string title: ""
2424 property bool buttonsVisible: false
25+ property bool closeButtonShown: true
2526 property bool dropShadow: false
2627 property int panelHeight: units.gu(3)
2728
qml/Components/WindowControlButtons.qml+2
@@ -23,6 +23,7 @@ Row {
2323
2424 // to be set from outside
2525 property bool active: false
26+ property bool closeButtonShown: true
2627
2728 signal close()
2829 signal minimize()
@@ -35,6 +36,7 @@ Row {
3536 height: parent.height
3637 width: height
3738 onClicked: root.close()
39+ visible: root.closeButtonShown
3840
3941 Rectangle {
4042 anchors.centerIn: parent
qml/Panel/Panel.qml+1
@@ -126,6 +126,7 @@ Item {
126126 height: indicators.minimizedPanelHeight - anchors.topMargin - anchors.bottomMargin
127127 visible: PanelState.buttonsVisible && parent.containsMouse && !root.locked && !callHint.visible
128128 active: PanelState.buttonsVisible
129+ closeButtonShown: PanelState.closeButtonShown
129130 onClose: PanelState.close()
130131 onMinimize: PanelState.minimize()
131132 onMaximize: PanelState.maximize()
qml/Stages/DesktopStage.qml+6
@@ -190,6 +190,12 @@ AbstractStage {
190190 value: priv.focusedAppDelegate && !priv.focusedAppDelegate.maximized && priv.foregroundMaximizedAppDelegate !== null
191191 }
192192
193+ Binding {
194+ target: PanelState
195+ property: "closeButtonShown"
196+ value: priv.focusedAppDelegate && priv.focusedAppDelegate.maximized && priv.focusedAppDelegate.application.appId !== "unity8-dash"
197+ }
198+
193199 Component.onDestruction: {
194200 PanelState.title = "";
195201 PanelState.buttonsVisible = false;
qml/Stages/WindowDecoration.qml+1
@@ -84,6 +84,7 @@ MouseArea {
8484 id: buttons
8585 height: parent.height
8686 active: root.active
87+ closeButtonShown: root.target.application.appId !== "unity8-dash"
8788 onClose: root.close();
8889 onMinimize: root.minimize();
8990 onMaximize: root.maximize();
tests/qmltests/Stages/tst_DesktopStage.qml+7
@@ -616,5 +616,12 @@ Item {
616616 // verify the drop shadow is gone
617617 tryCompare(PanelState, "dropShadow", false);
618618 }
619+
620+ function test_dashHasNoCloseButton() {
621+ var dashAppDelegate = startApplication("unity8-dash");
622+ verify(dashAppDelegate);
623+ var closeButton = findChild(dashAppDelegate, "closeWindowButton");
624+ tryCompare(closeButton, "visible", false);
625+ }
619626 }
620627}