on xenial help sign in
close the app only when the close button is tapped, not the entire thumbnail
19d9027om26er@ubuntu.com
Dash/Apps/RunningApplicationTile.qml+7−3
@@ -39,9 +39,7 @@ AbstractButton {
39 property bool terminationModeEnabled: false
39 property bool terminationModeEnabled: false
40
40
41 onClicked: {
41 onClicked: {
42− if (terminationModeEnabled)
42+ if (!terminationModeEnabled)
43− requestedApplicationTermination(application)
44− else
45 requestedApplicationActivation(application)
43 requestedApplicationActivation(application)
46 }
44 }
47
45
@@ -123,6 +121,7 @@ AbstractButton {
123 }
121 }
124
122
125 CloseIcon {
123 CloseIcon {
124+ objectName: "closeIcon " + model.name
126 anchors {
125 anchors {
127 left: shapedApplicationImage.left
126 left: shapedApplicationImage.left
128 leftMargin: -units.gu(1)
127 leftMargin: -units.gu(1)
@@ -133,5 +132,10 @@ AbstractButton {
133 width: units.gu(6)
132 width: units.gu(6)
134 id: closeIcon
133 id: closeIcon
135 enabled: root.terminationModeEnabled
134 enabled: root.terminationModeEnabled
135+
136+ MouseArea {
137+ anchors { fill: parent; margins: -units.gu(1) }
138+ onClicked: requestedApplicationTermination(application)
139+ }
136 }
140 }
137}
141}
tests/qmltests/Dash/Apps/tst_RunningApplicationsGrid.qml+24−4
@@ -195,9 +195,9 @@ Item {
195 !runningApplicationsGrid.terminationModeEnabled
195 !runningApplicationsGrid.terminationModeEnabled
196 }
196 }
197
197
198− // While on termination mode, clicking a running application tile causes the
198+ // While on termination mode, clicking a running application tile, outside of
199− // corresponding application to be terminated.
199+ // the close icon should do nothing
200− function test_clickTileToTerminateApp() {
200+ function test_clickTileNotClose() {
201 runningApplicationsGrid.terminationModeEnabled = true
201 runningApplicationsGrid.terminationModeEnabled = true
202
202
203 var calendarTile = findChild(runningApplicationsGrid, "runningAppTile Calendar")
203 var calendarTile = findChild(runningApplicationsGrid, "runningAppTile Calendar")
@@ -207,10 +207,30 @@ Item {
207
207
208 mouseClick(calendarTile, calendarTile.width/2, calendarTile.height/2)
208 mouseClick(calendarTile, calendarTile.width/2, calendarTile.height/2)
209
209
210+ verify(fakeRunningAppsModel.contains("calendar"))
211+
212+ // The tile for the Calendar app should stay there
213+ tryCompareFunction(checkCalendarTileExists, true)
214+ }
215+
216+ // While in termination mode, clicking on a running application tile's close icon
217+ // causes the corresponding application to be terminated
218+ function test_clickCloseIconToTerminateApp() {
219+ runningApplicationsGrid.terminationModeEnabled = true
220+
221+ var calendarTile = findChild(runningApplicationsGrid, "runningAppTile Calendar")
222+ var calendarTileCloseButton = findChild(runningApplicationsGrid, "closeIcon Calendar")
223+
224+ verify(calendarTile != undefined)
225+ verify(calendarTileCloseButton != undefined)
226+ verify(fakeRunningAppsModel.contains("calendar"))
227+
228+ mouseClick(calendarTileCloseButton, calendarTileCloseButton.width/2, calendarTileCloseButton.height/2)
229+
210 verify(!fakeRunningAppsModel.contains("calendar"))
230 verify(!fakeRunningAppsModel.contains("calendar"))
211
231
212 // The tile for the Calendar app should eventually vanish since the
232 // The tile for the Calendar app should eventually vanish since the
213− // application has been terminated
233+ // application has been terminated.
214 tryCompareFunction(checkCalendarTileExists, false)
234 tryCompareFunction(checkCalendarTileExists, false)
215 }
235 }
216
236