on xenial help sign in
fix logical issues, rename clickToAct to hasMouse
commit291b90dca2162d5d2913d7fdf727a1fd84954968 authorLukáš Tinkl <lukas.tinkl@canonical.com> dateTue 22 Sep 2015, 16:23 (11 years ago) parentbd00ab2
6 files changed+17−14
qml/Notifications/Notification.qml+6−6 qml/Notifications/Notifications.qml+2−2 qml/OrientedShell.qml+1−1 qml/Shell.qml+2−2 tests/qmltests/Notifications/tst_Notifications.qml+1−1 tests/qmltests/Notifications/tst_SwipeToAct.qml+5−2
qml/Notifications/Notification.qml+6−6
@@ -49,7 +49,7 @@ Item {
4949 readonly property color sdFontColor: "#5d5d5d"
5050 readonly property real contentSpacing: units.gu(2)
5151 readonly property bool canBeClosed: type === Notification.Ephemeral
52− property bool clickToClose
52+ property bool hasMouse
5353
5454 objectName: "background"
5555 implicitHeight: type !== Notification.PlaceHolder ? (fullscreen ? maxHeight : outterColumn.height - shapedBack.anchors.topMargin + contentSpacing * 2) : 0
@@ -217,7 +217,7 @@ Item {
217217 onClicked: {
218218 if (notification.type == Notification.Interactive) {
219219 notification.notification.invokeAction(actionRepeater.itemAt(0).actionId)
220− } else if (clickToClose && canBeClosed) {
220+ } else if (hasMouse && canBeClosed) {
221221 notification.notification.close()
222222 } else {
223223 notificationList.currentIndex = index;
@@ -442,7 +442,7 @@ Item {
442442 objectName: "notify_oot_button" + index
443443 width: oneOverTwoCase.width
444444 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
446446 onClicked: notification.notification.invokeAction(oneOverTwoLoaderTop.actionId)
447447 }
448448 }
@@ -470,7 +470,7 @@ Item {
470470 objectName: "notify_oot_button" + index
471471 width: oneOverTwoCase.width / 2 - spacing * 2
472472 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
474474 onClicked: notification.notification.invokeAction(oneOverTwoLoaderBottom.actionId)
475475 }
476476 }
@@ -490,7 +490,7 @@ Item {
490490 margins: contentSpacing
491491 }
492492 visible: notification.type === Notification.SnapDecision && actionRepeater.count > 0 && !oneOverTwoCase.visible
493− spacing: units.gu(2)
493+ spacing: contentSpacing
494494 layoutDirection: Qt.RightToLeft
495495
496496 Loader {
@@ -502,7 +502,7 @@ Item {
502502 width: buttonRow.width
503503 leftIconName: "call-end"
504504 rightIconName: "call-start"
505− clickToAct: notification.clickToClose
505+ clickToAct: notification.hasMouse
506506 onRightTriggered: {
507507 notification.notification.invokeAction(notification.actions.data(0, ActionModel.RoleActionId))
508508 }
qml/Notifications/Notifications.qml+2−2
@@ -28,7 +28,7 @@ ListView {
2828
2929 property real margin
3030 property bool useModal: snapDecisionProxyModel.count > 0
31− property bool clickToCloseNotifications
31+ property bool hasMouse
3232
3333 UnitySortFilterProxyModel {
3434 id: snapDecisionProxyModel
@@ -59,7 +59,7 @@ ListView {
5959 notification: notificationList.model.getRaw(notificationId)
6060 maxHeight: notificationList.height
6161 margins: notificationList.margin
62− clickToClose: notificationList.clickToCloseNotifications
62+ hasMouse: notificationList.hasMouse
6363
6464 // make sure there's no opacity-difference between the several
6565 // elements in a notification
qml/OrientedShell.qml+1−1
@@ -155,7 +155,7 @@ Rectangle {
155155 nativeWidth: root.width
156156 nativeHeight: root.height
157157 mode: applicationArguments.mode
158− clickToCloseNotifications: UnityInputInfo.mice > deviceConfiguration.ignoredMice
158+ hasMouse: UnityInputInfo.mice > deviceConfiguration.ignoredMice
159159
160160 // TODO: Factor in the connected input devices (eg: physical keyboard, mouse, touchscreen),
161161 // what's the output device (eg: big TV, desktop monitor, phone display), etc.
qml/Shell.qml+2−2
@@ -63,7 +63,7 @@ Item {
6363 function updateFocusedAppOrientationAnimated() {
6464 applicationsDisplayLoader.item.updateFocusedAppOrientationAnimated();
6565 }
66− property bool clickToCloseNotifications
66+ property bool hasMouse
6767
6868 // to be read from outside
6969 readonly property int mainAppWindowOrientationAngle:
@@ -637,7 +637,7 @@ Item {
637637
638638 model: NotificationBackend.Model
639639 margin: units.gu(1)
640− clickToCloseNotifications: shell.clickToCloseNotifications
640+ hasMouse: shell.hasMouse
641641
642642 y: topmostIsFullscreen ? 0 : panel.panelHeight
643643 height: parent.height - (topmostIsFullscreen ? 0 : panel.panelHeight)
tests/qmltests/Notifications/tst_Notifications.qml+1−1
@@ -188,7 +188,7 @@ Item {
188188
189189 anchors.fill: parent
190190 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
192192 }
193193 }
194194
tests/qmltests/Notifications/tst_SwipeToAct.qml+5−2
@@ -76,7 +76,10 @@ Item {
7676 icon: "../graphics/avatars/amanda.png",
7777 secondaryIcon: "incoming-call",
7878 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+ ]
8083 }
8184
8285 mockModel.append(n)
@@ -109,7 +112,7 @@ Item {
109112
110113 anchors.fill: parent
111114 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
113116 }
114117 }
115118