2 * Copyright (C) 2013 Canonical, Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18import QtMultimedia 5.0
19import Ubuntu.Components 0.1
20import Unity.Notifications 1.0
27 property alias iconSource: icon.fileSource
28 property alias secondaryIconSource: secondaryIcon.source
29 property alias summary: summaryLabel.text
30 property alias body: bodyLabel.text
32 property var notificationId
35 property var notification
37 property bool fullscreen
38 property int maxHeight
42 objectName: "background"
43 implicitHeight: type !== Notification.PlaceHolder ? (fullscreen ? maxHeight : contentColumn.height + contentColumn.spacing * 2) : 0
45 color: Qt.rgba(0.132, 0.117, 0.109, 0.97)
51 if (type == Notification.SnapDecision) {
52 if (ListView.view.currentIndex == index) {
55 if (ListView.view.count > 2) {
56 if (ListView.view.currentIndex == -1 && index == 1) {
59 result = "contracted";
73 source: hints["suppress-sound"] != "" ? hints["sound-file"] : undefined
77 if (opacity == 1.0 && hints["suppress-sound"] != "true" && sound.source) {
83 id: normalHeightBehavior
85 //enabled: menuItemFactory.progress == 1
89 duration: UbuntuAnimation.SnapDuration
91 UbuntuNumberAnimation {
92 duration: UbuntuAnimation.SnapDuration
100 PropertyChanges {target: notification; height: units.gu(8)}
104 PropertyChanges {target: notification; height: implicitHeight}
108 clip: fullscreen ? false : true
110 visible: type != Notification.PlaceHolder
118 leftMargin: notification.margins
119 rightMargin: notification.margins
122 opacity: parent.opacity
132 opacity: parent.opacity
137 anchors.fill: fullscreen ? nonShapedBack : shapedBack
139 UnityMenuModelPaths {
142 source: hints["x-canonical-private-menu-model"]
144 busNameHint: "busName"
145 actionsHint: "actions"
146 menuObjectPathHint: "menuPath"
152 busName: paths.busName
153 actions: paths.actions
154 menuObjectPath: paths.menuObjectPath
157 Behavior on implicitHeight {
161 UbuntuNumberAnimation {
162 duration: UbuntuAnimation.SnapDuration
166 // delay enabling height behavior until the add transition is complete
167 onOpacityChanged: if (opacity == 1) heightBehavior.enabled = true
173 objectName: "interactiveArea"
175 if (notification.type == Notification.Interactive) {
176 notification.notification.invokeAction(actionRepeater.itemAt(0).actionId)
178 notificationList.currentIndex = index;
185 objectName: "contentColumn"
191 margins: fullscreen ? 0 : spacing
199 spacing: contentColumn.spacing
211 shaped: notification.hints["x-canonical-non-shaped-icon"] == "true" ? false : true
212 visible: iconSource !== undefined && iconSource != ""
218 objectName: "secondaryIcon"
221 visible: source !== undefined && source != ""
222 fillMode: Image.PreserveAspectCrop
227 width: parent.width - x
229 anchors.verticalCenter: (icon.visible && !bodyLabel.visible) ? icon.verticalCenter : undefined
234 objectName: "summaryLabel"
241 color: Theme.palette.selected.backgroundText
242 elide: Text.ElideRight
248 objectName: "bodyLabel"
255 color: Theme.palette.selected.backgroundText
257 wrapMode: Text.WordWrap
259 elide: Text.ElideRight
265 objectName: "dialogListView"
270 anchors.left: parent.left; anchors.right: parent.right
271 anchors.top: fullscreen ? parent.top : undefined
272 anchors.bottom: fullscreen ? parent.bottom : undefined
275 model: unityMenuModel
277 NotificationMenuItemFactory {
280 anchors.left: parent.left; anchors.right: parent.right
282 menuModel: unityMenuModel
285 maxHeight: notification.maxHeight
288 notification.fullscreen = Qt.binding(function() { return fullscreen; });
297 objectName: "buttonRow"
302 visible: notification.type == Notification.SnapDecision && actionRepeater.count > 0
305 property real buttonWidth: (width - contentColumn.spacing) / 2
306 property bool expanded
311 objectName: "button1"
312 width: parent.expanded ? parent.width : parent.buttonWidth
315 bottom: parent.bottom
317 text: notification.type == Notification.SnapDecision && actionRepeater.count >= 2 ? actionRepeater.itemAt(1).actionLabel : ""
318 gradient: UbuntuColors.greyGradient
320 if (actionRepeater.count > 2) {
321 buttonRow.expanded = !buttonRow.expanded
323 notification.notification.invokeAction(actionRepeater.itemAt(1).actionId)
328 UbuntuNumberAnimation {
329 duration: UbuntuAnimation.SnapDuration
337 objectName: "button0"
339 left: leftButton.right
340 leftMargin: contentColumn.spacing
343 text: notification.type == Notification.SnapDecision && actionRepeater.count >= 1 ? actionRepeater.itemAt(0).actionLabel : ""
346 bottom: parent.bottom
348 gradient: notification.hints["x-canonical-private-button-tint"] == "true" ? UbuntuColors.orangeGradient : UbuntuColors.greyGradient
350 onClicked: notification.notification.invokeAction(actionRepeater.itemAt(0).actionId)
355 objectName: "buttonColumn"
356 spacing: contentColumn.spacing
362 // calculate initial position before Column takes over
363 y: buttonRow.y + buttonRow.height + contentColumn.spacing
365 visible: notification.type == Notification.SnapDecision && buttonRow.expanded
366 height: buttonRow.expanded ? implicitHeight : 0
371 model: notification.actions
375 property string actionId: id
376 property string actionLabel: label
387 objectName: "button" + index
393 text: loader.actionLabel
395 gradient: UbuntuColors.greyGradient
396 onClicked: notification.notification.invokeAction(loader.actionId)
399 sourceComponent: (index == 0 || index == 1) ? undefined : actionButton
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list