on xenial help sign in
cleanup unrelated stuff
bd00ab2Lukáš Tinkl
qml/Notifications/Notification.qml+18−19
@@ -21,7 +21,6 @@ import Ubuntu.Components 1.2
21import Unity.Notifications 1.0
21import Unity.Notifications 1.0
22import QMenuModel 0.1
22import QMenuModel 0.1
23import Utils 0.1
23import Utils 0.1
24−import "../Components/UnityInputInfo"
25import Ubuntu.Components.ListItems 0.1 as ListItem
24import Ubuntu.Components.ListItems 0.1 as ListItem
26
25
27Item {
26Item {
@@ -61,12 +60,12 @@ Item {
61 state: {
60 state: {
62 var result = "";
61 var result = "";
63
62
64− if (type === Notification.SnapDecision) {
63+ if (type == Notification.SnapDecision) {
65− if (ListView.view.currentIndex === index) {
64+ if (ListView.view.currentIndex == index) {
66 result = "expanded";
65 result = "expanded";
67 } else {
66 } else {
68 if (ListView.view.count > 2) {
67 if (ListView.view.count > 2) {
69− if (ListView.view.currentIndex === -1 && index == 1) {
68+ if (ListView.view.currentIndex == -1 && index == 1) {
70 result = "expanded";
69 result = "expanded";
71 } else {
70 } else {
72 result = "contracted";
71 result = "contracted";
@@ -84,7 +83,7 @@ Item {
84 id: sound
83 id: sound
85 objectName: "sound"
84 objectName: "sound"
86 audioRole: MediaPlayer.alert
85 audioRole: MediaPlayer.alert
87− source: hints["suppress-sound"] !== "true" && !!hints["sound-file"] ? hints["sound-file"] : ""
86+ source: hints["suppress-sound"] !== "true" && hints["sound-file"] !== undefined ? hints["sound-file"] : ""
88 }
87 }
89
88
90 Component.onCompleted: {
89 Component.onCompleted: {
@@ -141,7 +140,7 @@ Item {
141
140
142 clip: fullscreen ? false : true
141 clip: fullscreen ? false : true
143
142
144− visible: type !== Notification.PlaceHolder
143+ visible: type != Notification.PlaceHolder
145
144
146 UbuntuShape {
145 UbuntuShape {
147 id: shapedBack
146 id: shapedBack
@@ -197,7 +196,7 @@ Item {
197 actions: paths.actions
196 actions: paths.actions
198 menuObjectPath: paths.menuObjectPath
197 menuObjectPath: paths.menuObjectPath
199 onNameOwnerChanged: {
198 onNameOwnerChanged: {
200− if (lastNameOwner !== "" && nameOwner === "" && !!notification.notification) {
199+ if (lastNameOwner !== "" && nameOwner === "" && notification.notification !== undefined) {
201 notification.notification.close()
200 notification.notification.close()
202 }
201 }
203 lastNameOwner = nameOwner
202 lastNameOwner = nameOwner
@@ -216,7 +215,7 @@ Item {
216 drag.maximumX: notification.width
215 drag.maximumX: notification.width
217
216
218 onClicked: {
217 onClicked: {
219− if (notification.type === Notification.Interactive) {
218+ if (notification.type == Notification.Interactive) {
220 notification.notification.invokeAction(actionRepeater.itemAt(0).actionId)
219 notification.notification.invokeAction(actionRepeater.itemAt(0).actionId)
221 } else if (clickToClose && canBeClosed) {
220 } else if (clickToClose && canBeClosed) {
222 notification.notification.close()
221 notification.notification.close()
@@ -260,10 +259,10 @@ Item {
260 id: icon
259 id: icon
261
260
262 objectName: "icon"
261 objectName: "icon"
263− width: type === Notification.Ephemeral && !bodyLabel.visible ? units.gu(3) : units.gu(6)
262+ width: type == Notification.Ephemeral && !bodyLabel.visible ? units.gu(3) : units.gu(6)
264 height: width
263 height: width
265− shaped: notification.hints["x-canonical-non-shaped-icon"] === "true" ? false : true
264+ shaped: notification.hints["x-canonical-non-shaped-icon"] == "true" ? false : true
266− visible: !!iconSource && iconSource !== "" && type !== Notification.Confirmation
265+ visible: iconSource !== undefined && iconSource !== "" && type !== Notification.Confirmation
267 }
266 }
268
267
269 Column {
268 Column {
@@ -299,7 +298,7 @@ Item {
299 fontSize: "small"
298 fontSize: "small"
300 color: darkOnBright ? sdFontColor : Theme.palette.selected.backgroundText
299 color: darkOnBright ? sdFontColor : Theme.palette.selected.backgroundText
301 wrapMode: Text.WordWrap
300 wrapMode: Text.WordWrap
302− maximumLineCount: type === Notification.SnapDecision ? 12 : 2
301+ maximumLineCount: type == Notification.SnapDecision ? 12 : 2
303 elide: Text.ElideRight
302 elide: Text.ElideRight
304 textFormat: Text.StyledText
303 textFormat: Text.StyledText
305 }
304 }
@@ -317,7 +316,7 @@ Item {
317 }
316 }
318
317
319 ListItem.ThinDivider {
318 ListItem.ThinDivider {
320− visible: type === Notification.SnapDecision
319+ visible: type == Notification.SnapDecision
321 }
320 }
322
321
323 ShapedIcon {
322 ShapedIcon {
@@ -325,9 +324,9 @@ Item {
325 objectName: "centeredIcon"
324 objectName: "centeredIcon"
326 width: units.gu(5)
325 width: units.gu(5)
327 height: width
326 height: width
328− shaped: notification.hints["x-canonical-non-shaped-icon"] === "true" ? false : true
327+ shaped: notification.hints["x-canonical-non-shaped-icon"] == "true" ? false : true
329 fileSource: icon.fileSource
328 fileSource: icon.fileSource
330− visible: !!fileSource && fileSource !== "" && type === Notification.Confirmation
329+ visible: fileSource !== undefined && fileSource !== "" && type === Notification.Confirmation
331 anchors.horizontalCenter: parent.horizontalCenter
330 anchors.horizontalCenter: parent.horizontalCenter
332 }
331 }
333
332
@@ -443,7 +442,7 @@ Item {
443 objectName: "notify_oot_button" + index
442 objectName: "notify_oot_button" + index
444 width: oneOverTwoCase.width
443 width: oneOverTwoCase.width
445 text: oneOverTwoLoaderTop.actionLabel
444 text: oneOverTwoLoaderTop.actionLabel
446− color: notification.hints["x-canonical-private-affirmative-tint"] === "true" ? green : sdDarkGrey
445+ color: index == 1 && notification.hints["x-canonical-private-rejection-tint"] == "true" ? red : sdDarkGrey
447 onClicked: notification.notification.invokeAction(oneOverTwoLoaderTop.actionId)
446 onClicked: notification.notification.invokeAction(oneOverTwoLoaderTop.actionId)
448 }
447 }
449 }
448 }
@@ -533,10 +532,10 @@ Item {
533 text: loader.actionLabel
532 text: loader.actionLabel
534 color: {
533 color: {
535 var result = sdDarkGrey;
534 var result = sdDarkGrey;
536− if (index == 0 && notification.hints["x-canonical-private-affirmative-tint"] === "true") {
535+ if (index == 0 && notification.hints["x-canonical-private-affirmative-tint"] == "true") {
537 result = green;
536 result = green;
538 }
537 }
539− if (index == 1 && notification.hints["x-canonical-private-rejection-tint"] === "true") {
538+ if (index == 1 && notification.hints["x-canonical-private-rejection-tint"] == "true") {
540 result = red;
539 result = red;
541 }
540 }
542 return result;
541 return result;
@@ -559,7 +558,7 @@ Item {
559 margins: contentSpacing
558 margins: contentSpacing
560 }
559 }
561
560
562− visible: notification.type === Notification.SnapDecision && actionRepeater.count > 3 && !oneOverTwoCase.visible
561+ visible: notification.type == Notification.SnapDecision && actionRepeater.count > 3 && !oneOverTwoCase.visible
563 model: notification.actions
562 model: notification.actions
564 expanded: false
563 expanded: false
565 startIndex: 2
564 startIndex: 2
qml/Notifications/SwipeToAct.qml+2−5
@@ -16,7 +16,6 @@
16
16
17import QtQuick 2.3
17import QtQuick 2.3
18import Ubuntu.Components 1.2
18import Ubuntu.Components 1.2
19−import "../Components/UnityInputInfo"
20
19
21Item {
20Item {
22 id: swipeToAct
21 id: swipeToAct
@@ -75,7 +74,6 @@ Item {
75 iconName: leftIconName
74 iconName: leftIconName
76 visible: clickToAct
75 visible: clickToAct
77 width: (parent.width / 2) - priv.gap
76 width: (parent.width / 2) - priv.gap
78− height: leftShape.height
79 color: UbuntuColors.red
77 color: UbuntuColors.red
80 onClicked: {
78 onClicked: {
81 leftTriggered()
79 leftTriggered()
@@ -90,7 +88,6 @@ Item {
90 iconName: rightIconName
88 iconName: rightIconName
91 visible: clickToAct
89 visible: clickToAct
92 width: (parent.width / 2) - priv.gap
90 width: (parent.width / 2) - priv.gap
93− height: rightShape.height
94 color: UbuntuColors.green
91 color: UbuntuColors.green
95 onClicked: {
92 onClicked: {
96 rightTriggered()
93 rightTriggered()
@@ -126,7 +123,6 @@ Item {
126 height: units.gu(3.5)
123 height: units.gu(3.5)
127 name: leftIconName
124 name: leftIconName
128 color: "white"
125 color: "white"
129−
130 }
126 }
131 }
127 }
132
128
@@ -178,7 +174,8 @@ Item {
178
174
179 onXChanged: {
175 onXChanged: {
180 var factor
176 var factor
181− if (slider.x <= priv.gap + leftShape.width) {
177+ if (slider.x <= priv.gap + leftShape.width)
178+ {
182 factor = (slider.x - priv.gap) / leftShape.width
179 factor = (slider.x - priv.gap) / leftShape.width
183 slider.color = priv.interpolate(leftShape.color, priv.sliderMainColor, factor)
180 slider.color = priv.interpolate(leftShape.color, priv.sliderMainColor, factor)
184 } else if (slider.x >= rightShape.x - slider.width) {
181 } else if (slider.x >= rightShape.x - slider.width) {
qml/OrientedShell.qml+1
@@ -44,6 +44,7 @@ Rectangle {
44 name: applicationArguments.deviceName
44 name: applicationArguments.deviceName
45 }
45 }
46
46
47+
47 // to be overwritten by tests
48 // to be overwritten by tests
48 property var unity8Settings: Unity8Settings {}
49 property var unity8Settings: Unity8Settings {}
49 property var oskSettings: GSettings { schema.id: "com.canonical.keyboard.maliit" }
50 property var oskSettings: GSettings { schema.id: "com.canonical.keyboard.maliit" }
tests/qmltests/Notifications/tst_Notifications.qml+2−2
@@ -578,7 +578,7 @@ Item {
578 waitForRendering(notifications);
578 waitForRendering(notifications);
579
579
580 var notification = findChild(notifications, "notification" + (mockModel.count - 1))
580 var notification = findChild(notifications, "notification" + (mockModel.count - 1))
581− verify(!!notification, "notification wasn't found");
581+ verify(notification !== undefined, "notification wasn't found");
582
582
583 waitForRendering(notification);
583 waitForRendering(notification);
584 tryCompare(notification, "height", notification.state === "contracted" ? units.gu(10) : notification.implicitHeight);
584 tryCompare(notification, "height", notification.state === "contracted" ? units.gu(10) : notification.implicitHeight);
@@ -672,7 +672,7 @@ Item {
672 actionSpy.clear()
672 actionSpy.clear()
673
673
674 // click to collapse
674 // click to collapse
675− tryCompareFunction(function() { mouseClick(comboButton, comboButton.width / 2, comboButton.height / 2); return comboButton.expanded === false; }, true);
675+ tryCompareFunction(function() { mouseClick(comboButton, comboButton.width / 2, comboButton.height / 2); return comboButton.expanded == false; }, true);
676 } else {
676 } else {
677 mouseClick(buttonCancel)
677 mouseClick(buttonCancel)
678 compare(actionSpy.signalArguments[0][0], data.n.actions.data(1, ActionModel.RoleActionId), "got wrong id for negative action")
678 compare(actionSpy.signalArguments[0][0], data.n.actions.data(1, ActionModel.RoleActionId), "got wrong id for negative action")
tests/qmltests/Notifications/tst_SwipeToAct.qml+2−2
@@ -247,7 +247,7 @@ Item {
247 waitForRendering(notifications);
247 waitForRendering(notifications);
248
248
249 var notification = findChild(notifications, "notification" + (mockModel.count - 1))
249 var notification = findChild(notifications, "notification" + (mockModel.count - 1))
250− verify(!!notification, "notification wasn't found");
250+ verify(notification !== undefined, "notification wasn't found");
251
251
252 waitForRendering(notification);
252 waitForRendering(notification);
253
253
@@ -265,7 +265,7 @@ Item {
265
265
266 // test input does not fall through
266 // test input does not fall through
267 mouseClick(notification)
267 mouseClick(notification)
268− if(data.type === Notification.Interactive) {
268+ if(data.type == Notification.Interactive) {
269 actionSpy.wait()
269 actionSpy.wait()
270 compare(actionSpy.signalArguments[0][0], data.actions[0]["id"], "got wrong id for interactive action")
270 compare(actionSpy.signalArguments[0][0], data.actions[0]["id"], "got wrong id for interactive action")
271 }
271 }