on xenial help sign in
There's no need for WindowDecoration to access the appDelegate
30ca5f3Daniel d'Andrada
qml/Stage/DecoratedWindow.qml+1−1
@@ -149,7 +149,7 @@ FocusScope {
149
149
150 WindowDecoration {
150 WindowDecoration {
151 id: decoration
151 id: decoration
152− target: root.parent || null
152+ closeButtonVisible: root.application.appId !== "unity8-dash"
153 objectName: "appWindowDecoration"
153 objectName: "appWindowDecoration"
154 anchors { left: parent.left; top: parent.top; right: parent.right }
154 anchors { left: parent.left; top: parent.top; right: parent.right }
155 height: units.gu(3)
155 height: units.gu(3)
qml/Stage/Stage.qml+15−3
@@ -1529,9 +1529,21 @@ FocusScope {
1529 onRequestedHeightChanged: oldRequestedHeight = requestedHeight
1529 onRequestedHeightChanged: oldRequestedHeight = requestedHeight
1530
1530
1531 onCloseClicked: { appDelegate.close(); }
1531 onCloseClicked: { appDelegate.close(); }
1532+ onMaximizeClicked: {
1533+ if (appDelegate.canBeMaximized) {
1532− onMaximizeClicked: appDelegate.anyMaximized ? appDelegate.restoreFromMaximized() : appDelegate.maximize();
1534+ appDelegate.anyMaximized ? appDelegate.restoreFromMaximized() : appDelegate.maximize();
1535+ }
1536+ }
1537+ onMaximizeHorizontallyClicked: {
1538+ if (appDelegate.canBeMaximizedHorizontally) {
1533− onMaximizeHorizontallyClicked: appDelegate.maximizedHorizontally ? appDelegate.restoreFromMaximized() : appDelegate.maximizeHorizontally()
1539+ appDelegate.maximizedHorizontally ? appDelegate.restoreFromMaximized() : appDelegate.maximizeHorizontally()
1540+ }
1541+ }
1542+ onMaximizeVerticallyClicked: {
1543+ if (appDelegate.canBeMaximizedVertically) {
1534− onMaximizeVerticallyClicked: appDelegate.maximizedVertically ? appDelegate.restoreFromMaximized() : appDelegate.maximizeVertically()
1544+ appDelegate.maximizedVertically ? appDelegate.restoreFromMaximized() : appDelegate.maximizeVertically()
1545+ }
1546+ }
1535 onMinimizeClicked: appDelegate.minimize()
1547 onMinimizeClicked: appDelegate.minimize()
1536 onDecorationPressed: { appDelegate.focus = true; }
1548 onDecorationPressed: { appDelegate.focus = true; }
1537 onDecorationReleased: fakeRectangle.commit();
1549 onDecorationReleased: fakeRectangle.commit();
qml/Stage/WindowDecoration.qml+4−5
@@ -22,7 +22,7 @@ MouseArea {
22 id: root
22 id: root
23 clip: true
23 clip: true
24
24
25− property Item target // appDelegate
25+ property alias closeButtonVisible: buttons.closeButtonShown
26 property alias title: titleLabel.text
26 property alias title: titleLabel.text
27 property alias maximizeButtonShown: buttons.maximizeButtonShown
27 property alias maximizeButtonShown: buttons.maximizeButtonShown
28 property bool active: false
28 property bool active: false
@@ -40,7 +40,7 @@ MouseArea {
40 signal maximizeVerticallyClicked()
40 signal maximizeVerticallyClicked()
41
41
42 onDoubleClicked: {
42 onDoubleClicked: {
43− if (target.canBeMaximized && mouse.button == Qt.LeftButton) {
43+ if (mouse.button == Qt.LeftButton) {
44 root.maximizeClicked();
44 root.maximizeClicked();
45 }
45 }
46 }
46 }
@@ -77,9 +77,8 @@ MouseArea {
77 onCloseClicked: root.closeClicked();
77 onCloseClicked: root.closeClicked();
78 onMinimizeClicked: root.minimizeClicked();
78 onMinimizeClicked: root.minimizeClicked();
79 onMaximizeClicked: root.maximizeClicked();
79 onMaximizeClicked: root.maximizeClicked();
80− onMaximizeHorizontallyClicked: if (root.target.canBeMaximizedHorizontally) root.maximizeHorizontallyClicked();
80+ onMaximizeHorizontallyClicked: root.maximizeHorizontallyClicked();
81− onMaximizeVerticallyClicked: if (root.target.canBeMaximizedVertically) root.maximizeVerticallyClicked();
81+ onMaximizeVerticallyClicked: root.maximizeVerticallyClicked();
82− closeButtonShown: root.target.appId !== "unity8-dash"
83 }
82 }
84
83
85 Label {
84 Label {