@@ -20,7 +20,7 @@ import Unity.Notifications 1.0
20import QMenuModel 0.1
20import QMenuModel 0.1
21import Utils 0.1
21import Utils 0.1
23−UbuntuShape {
23+Item {
24 id: notification
24 id: notification
26 property alias iconSource: avatarIcon.source
26 property alias iconSource: avatarIcon.source
@@ -32,266 +32,297 @@ UbuntuShape {
32 property var type
32 property var type
33 property var hints
33 property var hints
34 property var notification
34 property var notification
36+ property bool fullscreen
38+ fullscreen: notification.hints["x-canonical-private-fullscreen"] == "true" ? true : false
36 objectName: "background"
39 objectName: "background"
37− implicitHeight: type != Notification.PlaceHolder ? contentColumn.height + contentColumn.spacing * 2 : 0
40+ implicitHeight: type != Notification.PlaceHolder ? (fullscreen ? notificationList.fullHeight : contentColumn.height + contentColumn.spacing * 2) : 0
42+ //parent.anchors.leftMargin: fullscreen ? 0 : notificationList.margin
43+ //parent.anchors.rightMargin: fullscreen ? 0 : notificationList.margin
44+ //parent.anchors.topMargin: fullscreen ? notificationList.panelHeight : notificationList.panelHeight + notificationList.margin
38 color: Qt.rgba(0.132, 0.117, 0.109, 0.97)
46 color: Qt.rgba(0.132, 0.117, 0.109, 0.97)
39 opacity: 0
47 opacity: 0
42 clip: true
49 clip: true
43 visible: type != Notification.PlaceHolder
50 visible: type != Notification.PlaceHolder
45− UnityMenuModelPaths {
52+ UbuntuShape {
46− id: paths
53+ id: shapedBack
48− source: hints["x-canonical-private-menu-model"]
50− busNameHint: "busName"
55+ visible: !fullscreen
51− actionsHint: "actions"
56+ anchors.fill: parent
52− menuObjectPathHint: "menuPath"
57+ color: parent.color
58+ opacity: parent.opacity
55− UnityMenuModel {
62+ Rectangle {
56− id: unityMenuModel
63+ id: nonShapedBack
58− busName: paths.busName
65+ visible: fullscreen
59− actions: paths.actions
66+ anchors.fill: parent
60− menuObjectPath: paths.menuObjectPath
67+ color: parent.color
68+ opacity: parent.opacity
63− Behavior on implicitHeight {
71+ Item {
64− id: heightBehavior
72+ id: contents
66− enabled: false
75+ UnityMenuModelPaths {
67− UbuntuNumberAnimation {
76+ id: paths
68− duration: UbuntuAnimation.SnapDuration
72− // delay enabling height behavior until the add transition is complete
78+ source: hints["x-canonical-private-menu-model"]
73− onOpacityChanged: if (opacity == 1) heightBehavior.enabled = true
75− MouseArea {
80+ busNameHint: "busName"
76− id: interactiveArea
81+ actionsHint: "actions"
82+ menuObjectPathHint: "menuPath"
78− anchors.fill: contentColumn
85+ UnityMenuModel {
79− objectName: "interactiveArea"
86+ id: unityMenuModel
80− enabled: notification.type == Notification.Interactive
81− onClicked: notification.notification.invokeAction(actionRepeater.itemAt(0).actionId)
84− Column {
88+ busName: paths.busName
85− id: contentColumn
89+ actions: paths.actions
90+ menuObjectPath: paths.menuObjectPath
87− anchors {
93+ Behavior on implicitHeight {
88− left: parent.left
94+ id: heightBehavior
89− right: parent.right
95+
90− top: parent.top
96+ enabled: false
91− margins: spacing
97+ UbuntuNumberAnimation {
98+ duration: UbuntuAnimation.SnapDuration
94− spacing: units.gu(1)
102+ // delay enabling height behavior until the add transition is complete
103+ onOpacityChanged: if (opacity == 1) heightBehavior.enabled = true
96− Row {
105+ MouseArea {
97− id: topRow
106+ id: interactiveArea
108+ anchors.fill: contentColumn
109+ objectName: "interactiveArea"
110+ enabled: notification.type == Notification.Interactive
111+ onClicked: notification.notification.invokeAction(actionRepeater.itemAt(0).actionId)
99− spacing: contentColumn.spacing
100 anchors {
117 anchors {
101 left: parent.left
118 left: parent.left
102 right: parent.right
119 right: parent.right
105− UbuntuShape {
124+ spacing: units.gu(1)
108− objectName: "icon"
126+ Row {
109− width: units.gu(6)
127+ id: topRow
111− visible: iconSource !== undefined && iconSource != ""
115− fillMode: Image.PreserveAspectCrop
129+ spacing: contentColumn.spacing
119− Image {
135+ UbuntuShape {
120− id: secondaryIcon
136+ id: icon
122− objectName: "secondaryIcon"
138+ objectName: "icon"
123− width: units.gu(2)
139+ width: units.gu(6)
124− height: units.gu(2)
140+ height: units.gu(6)
125− visible: source !== undefined && source != ""
141+ visible: iconSource !== undefined && iconSource != ""
126− fillMode: Image.PreserveAspectCrop
142+ image: Image {
127− }
143+ id: avatarIcon
129− Column {
145+ fillMode: Image.PreserveAspectCrop
130− id: labelColumn
146+ }
131− width: parent.width - x
147+ }
152+ objectName: "secondaryIcon"
155+ visible: source !== undefined && source != ""
156+ fillMode: Image.PreserveAspectCrop
133− anchors.verticalCenter: (icon.visible && !bodyLabel.visible) ? icon.verticalCenter : undefined
159+ Column {
161+ width: parent.width - x
135− Label {
163+ anchors.verticalCenter: (icon.visible && !bodyLabel.visible) ? icon.verticalCenter : undefined
138− objectName: "summaryLabel"
168+ objectName: "summaryLabel"
139− anchors {
169+ anchors {
140− left: parent.left
170+ left: parent.left
141− right: parent.right
171+ right: parent.right
175+ color: Theme.palette.selected.backgroundText
176+ elide: Text.ElideRight
145− color: Theme.palette.selected.backgroundText
146− elide: Text.ElideRight
150− id: bodyLabel
180+ id: bodyLabel
152− objectName: "bodyLabel"
182+ objectName: "bodyLabel"
153− anchors {
183+ anchors {
154− left: parent.left
184+ left: parent.left
155− right: parent.right
185+ right: parent.right
189+ color: Theme.palette.selected.backgroundText
191+ wrapMode: Text.WordWrap
192+ maximumLineCount: 10
193+ elide: Text.ElideRight
159− color: Theme.palette.selected.backgroundText
161− wrapMode: Text.WordWrap
162− maximumLineCount: 10
163− elide: Text.ElideRight
168− Column {
198+ Column {
169− objectName: "dialogListView"
199+ objectName: "dialogListView"
170− spacing: units.gu(2)
200+ spacing: units.gu(2)
172− visible: count > 0
202+ visible: count > 0
174− anchors.left: parent.left; anchors.right: parent.right
204+ anchors.left: parent.left; anchors.right: parent.right
176− Repeater {
206+ Repeater {
177− model: unityMenuModel
207+ model: unityMenuModel
179− NotificationMenuItemFactory {
209+ NotificationMenuItemFactory {
180− anchors.left: parent.left; anchors.right: parent.right
210+ anchors.left: parent.left; anchors.right: parent.right
182− menuModel: unityMenuModel
212+ menuModel: unityMenuModel
183− menuData: model
213+ menuData: model
184− menuIndex: index
214+ menuIndex: index
190− id: buttonRow
220+ id: buttonRow
192− objectName: "buttonRow"
222+ objectName: "buttonRow"
193− anchors {
223+ anchors {
194− left: parent.left
224+ left: parent.left
195− right: parent.right
225+ right: parent.right
197− visible: notification.type == Notification.SnapDecision && actionRepeater.count > 0
227+ visible: notification.type == Notification.SnapDecision && actionRepeater.count > 0
198− height: units.gu(5)
228+ height: units.gu(5)
200− property real buttonWidth: (width - contentColumn.spacing) / 2
230+ property real buttonWidth: (width - contentColumn.spacing) / 2
201− property bool expanded
231+ property bool expanded
203− Button {
233+ Button {
204− id: leftButton
234+ id: leftButton
206− objectName: "button1"
236+ objectName: "button1"
207− width: parent.expanded ? parent.width : parent.buttonWidth
237+ width: parent.expanded ? parent.width : parent.buttonWidth
208− anchors {
238+ anchors {
209− top: parent.top
239+ top: parent.top
210− bottom: parent.bottom
240+ bottom: parent.bottom
212− text: notification.type == Notification.SnapDecision && actionRepeater.count >= 2 ? actionRepeater.itemAt(1).actionLabel : ""
242+ text: notification.type == Notification.SnapDecision && actionRepeater.count >= 2 ? actionRepeater.itemAt(1).actionLabel : ""
213− gradient: UbuntuColors.greyGradient
243+ gradient: UbuntuColors.greyGradient
214− onClicked: {
244+ onClicked: {
215− if (actionRepeater.count > 2) {
245+ if (actionRepeater.count > 2) {
216− buttonRow.expanded = !buttonRow.expanded
246+ buttonRow.expanded = !buttonRow.expanded
217− } else {
247+ } else {
218− notification.notification.invokeAction(actionRepeater.itemAt(1).actionId)
248+ notification.notification.invokeAction(actionRepeater.itemAt(1).actionId)
253+ UbuntuNumberAnimation {
254+ duration: UbuntuAnimation.SnapDuration
222− Behavior on width {
259+ Button {
223− UbuntuNumberAnimation {
260+ id: rightButton
224− duration: UbuntuAnimation.SnapDuration
261+
262+ objectName: "button0"
264+ left: leftButton.right
265+ leftMargin: contentColumn.spacing
268+ text: notification.type == Notification.SnapDecision && actionRepeater.count >= 1 ? actionRepeater.itemAt(0).actionLabel : ""
271+ bottom: parent.bottom
273+ gradient: notification.hints["x-canonical-private-button-tint"] == "true" ? UbuntuColors.orangeGradient : UbuntuColors.greyGradient
275+ onClicked: notification.notification.invokeAction(actionRepeater.itemAt(0).actionId)
229− Button {
279+ Column {
232− objectName: "button0"
280+ objectName: "buttonColumn"
281+ spacing: contentColumn.spacing
233 anchors {
282 anchors {
234− left: leftButton.right
283+ left: parent.left
235− leftMargin: contentColumn.spacing
236 right: parent.right
284 right: parent.right
238− text: notification.type == Notification.SnapDecision && actionRepeater.count >= 1 ? actionRepeater.itemAt(0).actionLabel : ""
241− bottom: parent.bottom
243− gradient: notification.hints["x-canonical-private-button-tint"] == "true" ? UbuntuColors.orangeGradient : UbuntuColors.greyGradient
245− onClicked: notification.notification.invokeAction(actionRepeater.itemAt(0).actionId)
249− Column {
287+ // calculate initial position before Column takes over
250− objectName: "buttonColumn"
251− spacing: contentColumn.spacing
288+ y: buttonRow.y + buttonRow.height + contentColumn.spacing
257− // calculate initial position before Column takes over
290+ visible: notification.type == Notification.SnapDecision
258− y: buttonRow.y + buttonRow.height + contentColumn.spacing
291+ height: buttonRow.expanded ? implicitHeight : 0
260− visible: notification.type == Notification.SnapDecision
293+ Repeater {
261− height: buttonRow.expanded ? implicitHeight : 0
294+ id: actionRepeater
263− Repeater {
296+ model: notification.actions
264− id: actionRepeater
297+ delegate: Loader {
266− model: notification.actions
300+ property string actionId: id
267− delegate: Loader {
301+ property string actionLabel: label
270− property string actionId: id
303+ anchors {
271− property string actionLabel: label
304+ left: parent.left
273− anchors {
308+ Component {
274− left: parent.left
309+ id: actionButton
278− Component {
311+ Button {
279− id: actionButton
312+ objectName: "button" + index
281− Button {
318+ text: loader.actionLabel
282− objectName: "button" + index
319+ height: units.gu(5)
283− anchors {
320+ gradient: UbuntuColors.greyGradient
284− left: parent.left
321+ onClicked: notification.notification.invokeAction(loader.actionId)
288− text: loader.actionLabel
290− gradient: UbuntuColors.greyGradient
291− onClicked: notification.notification.invokeAction(loader.actionId)
324+ sourceComponent: (index == 0 || index == 1) ? undefined : actionButton
294− sourceComponent: (index == 0 || index == 1) ? undefined : actionButton