on xenial help sign in
fix logical issues, rename clickToAct to hasMouse
291b90dLukáš Tinkl
qml/Notifications/Notification.qml+6−6
@@ -49,7 +49,7 @@ Item {
49 readonly property color sdFontColor: "#5d5d5d"
49 readonly property color sdFontColor: "#5d5d5d"
50 readonly property real contentSpacing: units.gu(2)
50 readonly property real contentSpacing: units.gu(2)
51 readonly property bool canBeClosed: type === Notification.Ephemeral
51 readonly property bool canBeClosed: type === Notification.Ephemeral
52− property bool clickToClose
52+ property bool hasMouse
53
53
54 objectName: "background"
54 objectName: "background"
55 implicitHeight: type !== Notification.PlaceHolder ? (fullscreen ? maxHeight : outterColumn.height - shapedBack.anchors.topMargin + contentSpacing * 2) : 0
55 implicitHeight: type !== Notification.PlaceHolder ? (fullscreen ? maxHeight : outterColumn.height - shapedBack.anchors.topMargin + contentSpacing * 2) : 0
@@ -217,7 +217,7 @@ Item {
217 onClicked: {
217 onClicked: {
218 if (notification.type == Notification.Interactive) {
218 if (notification.type == Notification.Interactive) {
219 notification.notification.invokeAction(actionRepeater.itemAt(0).actionId)
219 notification.notification.invokeAction(actionRepeater.itemAt(0).actionId)
220− } else if (clickToClose && canBeClosed) {
220+ } else if (hasMouse && canBeClosed) {
221 notification.notification.close()
221 notification.notification.close()
222 } else {
222 } else {
223 notificationList.currentIndex = index;
223 notificationList.currentIndex = index;
@@ -442,7 +442,7 @@ Item {
442 objectName: "notify_oot_button" + index
442 objectName: "notify_oot_button" + index
443 width: oneOverTwoCase.width
443 width: oneOverTwoCase.width
444 text: oneOverTwoLoaderTop.actionLabel
444 text: oneOverTwoLoaderTop.actionLabel
445− color: index == 1 && notification.hints["x-canonical-private-rejection-tint"] == "true" ? red : sdDarkGrey
445+ color: notification.hints["x-canonical-private-rejection-tint"] == "true" ? red : sdDarkGrey
446 onClicked: notification.notification.invokeAction(oneOverTwoLoaderTop.actionId)
446 onClicked: notification.notification.invokeAction(oneOverTwoLoaderTop.actionId)
447 }
447 }
448 }
448 }
@@ -470,7 +470,7 @@ Item {
470 objectName: "notify_oot_button" + index
470 objectName: "notify_oot_button" + index
471 width: oneOverTwoCase.width / 2 - spacing * 2
471 width: oneOverTwoCase.width / 2 - spacing * 2
472 text: oneOverTwoLoaderBottom.actionLabel
472 text: oneOverTwoLoaderBottom.actionLabel
473− color: index == 1 && notification.hints["x-canonical-private-rejection-tint"] === "true" ? red : sdDarkGrey
473+ color: index == 1 && notification.hints["x-canonical-private-rejection-tint"] == "true" ? red : sdDarkGrey
474 onClicked: notification.notification.invokeAction(oneOverTwoLoaderBottom.actionId)
474 onClicked: notification.notification.invokeAction(oneOverTwoLoaderBottom.actionId)
475 }
475 }
476 }
476 }
@@ -490,7 +490,7 @@ Item {
490 margins: contentSpacing
490 margins: contentSpacing
491 }
491 }
492 visible: notification.type === Notification.SnapDecision && actionRepeater.count > 0 && !oneOverTwoCase.visible
492 visible: notification.type === Notification.SnapDecision && actionRepeater.count > 0 && !oneOverTwoCase.visible
493− spacing: units.gu(2)
493+ spacing: contentSpacing
494 layoutDirection: Qt.RightToLeft
494 layoutDirection: Qt.RightToLeft
495
495
496 Loader {
496 Loader {
@@ -502,7 +502,7 @@ Item {
502 width: buttonRow.width
502 width: buttonRow.width
503 leftIconName: "call-end"
503 leftIconName: "call-end"
504 rightIconName: "call-start"
504 rightIconName: "call-start"
505− clickToAct: notification.clickToClose
505+ clickToAct: notification.hasMouse
506 onRightTriggered: {
506 onRightTriggered: {
507 notification.notification.invokeAction(notification.actions.data(0, ActionModel.RoleActionId))
507 notification.notification.invokeAction(notification.actions.data(0, ActionModel.RoleActionId))
508 }
508 }
qml/Notifications/Notifications.qml+2−2
@@ -28,7 +28,7 @@ ListView {
28
28
29 property real margin
29 property real margin
30 property bool useModal: snapDecisionProxyModel.count > 0
30 property bool useModal: snapDecisionProxyModel.count > 0
31− property bool clickToCloseNotifications
31+ property bool hasMouse
32
32
33 UnitySortFilterProxyModel {
33 UnitySortFilterProxyModel {
34 id: snapDecisionProxyModel
34 id: snapDecisionProxyModel
@@ -59,7 +59,7 @@ ListView {
59 notification: notificationList.model.getRaw(notificationId)
59 notification: notificationList.model.getRaw(notificationId)
60 maxHeight: notificationList.height
60 maxHeight: notificationList.height
61 margins: notificationList.margin
61 margins: notificationList.margin
62− clickToClose: notificationList.clickToCloseNotifications
62+ hasMouse: notificationList.hasMouse
63
63
64 // make sure there's no opacity-difference between the several
64 // make sure there's no opacity-difference between the several
65 // elements in a notification
65 // elements in a notification
qml/OrientedShell.qml+1−1
@@ -155,7 +155,7 @@ Rectangle {
155 nativeWidth: root.width
155 nativeWidth: root.width
156 nativeHeight: root.height
156 nativeHeight: root.height
157 mode: applicationArguments.mode
157 mode: applicationArguments.mode
158− clickToCloseNotifications: UnityInputInfo.mice > deviceConfiguration.ignoredMice
158+ hasMouse: UnityInputInfo.mice > deviceConfiguration.ignoredMice
159
159
160 // TODO: Factor in the connected input devices (eg: physical keyboard, mouse, touchscreen),
160 // TODO: Factor in the connected input devices (eg: physical keyboard, mouse, touchscreen),
161 // what's the output device (eg: big TV, desktop monitor, phone display), etc.
161 // what's the output device (eg: big TV, desktop monitor, phone display), etc.
qml/Shell.qml+2−2
@@ -63,7 +63,7 @@ Item {
63 function updateFocusedAppOrientationAnimated() {
63 function updateFocusedAppOrientationAnimated() {
64 applicationsDisplayLoader.item.updateFocusedAppOrientationAnimated();
64 applicationsDisplayLoader.item.updateFocusedAppOrientationAnimated();
65 }
65 }
66− property bool clickToCloseNotifications
66+ property bool hasMouse
67
67
68 // to be read from outside
68 // to be read from outside
69 readonly property int mainAppWindowOrientationAngle:
69 readonly property int mainAppWindowOrientationAngle:
@@ -637,7 +637,7 @@ Item {
637
637
638 model: NotificationBackend.Model
638 model: NotificationBackend.Model
639 margin: units.gu(1)
639 margin: units.gu(1)
640− clickToCloseNotifications: shell.clickToCloseNotifications
640+ hasMouse: shell.hasMouse
641
641
642 y: topmostIsFullscreen ? 0 : panel.panelHeight
642 y: topmostIsFullscreen ? 0 : panel.panelHeight
643 height: parent.height - (topmostIsFullscreen ? 0 : panel.panelHeight)
643 height: parent.height - (topmostIsFullscreen ? 0 : panel.panelHeight)
tests/qmltests/Notifications/tst_Notifications.qml+1−1
@@ -188,7 +188,7 @@ Item {
188
188
189 anchors.fill: parent
189 anchors.fill: parent
190 model: mockModel
190 model: mockModel
191− clickToCloseNotifications: UnityInputInfo.mice > 0 // for testing, we add/remove only a mock mouse
191+ hasMouse: UnityInputInfo.mice > 0 // for testing, we add/remove only a mock mouse
192 }
192 }
193 }
193 }
194
194
tests/qmltests/Notifications/tst_SwipeToAct.qml+5−2
@@ -76,7 +76,10 @@ Item {
76 icon: "../graphics/avatars/amanda.png",
76 icon: "../graphics/avatars/amanda.png",
77 secondaryIcon: "incoming-call",
77 secondaryIcon: "incoming-call",
78 actions: [{ id: "ok_id", label: "Ok"},
78 actions: [{ id: "ok_id", label: "Ok"},
79− { id: "cancel_id", label: "Cancel"}]
79+ { id: "cancel_id", label: "Cancel"},
80+ { id: "foo_id", label: "Foo"},
81+ { id: "bar_id", label: "Bar"}
82+ ]
80 }
83 }
81
84
82 mockModel.append(n)
85 mockModel.append(n)
@@ -109,7 +112,7 @@ Item {
109
112
110 anchors.fill: parent
113 anchors.fill: parent
111 model: mockModel
114 model: mockModel
112− clickToCloseNotifications: UnityInputInfo.mice > 0 // for testing, we add/remove only a mock mouse
115+ hasMouse: UnityInputInfo.mice > 0 // for testing, we add/remove only a mock mouse
113 }
116 }
114 }
117 }
115
118