on xenial help sign in
implement our own popup
commit942c252e61dbed4532d093f17384f0f72e113a75 authorMichael Zanetti <michael.zanetti@canonical.com> dateFri 17 Mar 2017, 13:11 (10 years ago) parent117f2d8
1 file changed+36−9
qml/Stage/Spread/ScreensAndWorkspaces.qml+36−9
qml/Stage/Spread/ScreensAndWorkspaces.qml+36−9
@@ -81,19 +81,47 @@ Item {
8181 anchors.fill: parent
8282
8383 onClicked: {
84− PopupUtils.open(contextMenu)
84+// PopupUtils.open(contextMenu)
85+ var obj = screensMenuComponent.createObject(header)
86+ obj.open(mouseX, mouseY)
8587 }
8688 }
8789
8890 Component {
89− id: contextMenu
90− ActionSelectionPopover {
91− actions: ActionList {
92− Action {
93− text: "Add workspace"
94− onTriggered: {
91+ id: screensMenuComponent
92+ UbuntuShape {
93+ id: screensMenu
94+ width: units.gu(20)
95+ height: contentColumn.childrenRect.height
96+ backgroundColor: "white"
97+
98+ function open(mouseX, mouseY) {
99+ x = Math.max(0, Math.min(mouseX - width / 2, parent.width - width))
100+ y = mouseY + units.gu(1)
101+ }
102+
103+ InverseMouseArea {
104+ anchors.fill: parent
105+ onClicked: {
106+ screensMenu.destroy()
107+ }
108+ }
109+
110+ Column {
111+ id: contentColumn
112+ width: parent.width
113+ ListItem {
114+ height: layout.height
115+ highlightColor: "transparent"
116+ ListItemLayout {
117+ id: layout
118+ title.text: qsTr("Add workspace")
119+ title.color: "black"
120+ }
121+ onClicked: {
95122 screen.addWorkspace();
96− Screens.sync(root.screensProxy)
123+ Screens.sync(root.screensProxy);
124+ screensMenu.destroy();
97125 }
98126 }
99127 }
@@ -101,7 +129,6 @@ Item {
101129 }
102130 }
103131
104−
105132 Workspaces {
106133 id: workspaces
107134 height: parent.height - header.height - units.gu(2)