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 1.1
20import Unity.Notifications 1.0
24import Ubuntu.Components.ListItems 0.1 as ListItem
29 property alias iconSource: icon.fileSource
30 property alias secondaryIconSource: secondaryIcon.source
31 property alias summary: summaryLabel.text
32 property alias body: bodyLabel.text
34 property var notificationId
37 property var notification
39 property bool fullscreen: false
40 property int maxHeight
42 property Gradient greenGradient : Gradient {
43 GradientStop { position: 0.0; color: "#3fb24f" }
44 GradientStop { position: 1.0; color: "#3fb24f" }
46 property Gradient darkgreyGradient: Gradient {
47 GradientStop { position: 0.0; color: "#4d4745" }
48 GradientStop { position: 1.0; color: "#4d4745" }
51 objectName: "background"
52 implicitHeight: type !== Notification.PlaceHolder ? (fullscreen ? maxHeight : contentColumn.height + contentColumn.spacing * 2) : 0
54 color: Qt.rgba(0.132, 0.117, 0.109, 0.97)
60 if (type == Notification.SnapDecision) {
61 if (ListView.view.currentIndex == index) {
64 if (ListView.view.count > 2) {
65 if (ListView.view.currentIndex == -1 && index == 1) {
68 result = "contracted";
82 source: hints["suppress-sound"] != "true" && hints["sound-file"] != undefined ? hints["sound-file"] : ""
86 if (opacity == 1.0 && hints["suppress-sound"] != "true" && sound.source) {
92 id: normalHeightBehavior
94 //enabled: menuItemFactory.progress == 1
98 duration: UbuntuAnimation.SnapDuration
100 UbuntuNumberAnimation {
101 duration: UbuntuAnimation.SnapDuration
109 PropertyChanges {target: notification; height: units.gu(8)}
113 PropertyChanges {target: notification; height: implicitHeight}
117 clip: fullscreen ? false : true
119 visible: type != Notification.PlaceHolder
127 leftMargin: notification.margins
128 rightMargin: notification.margins
131 opacity: parent.opacity
141 opacity: parent.opacity
146 anchors.fill: fullscreen ? nonShapedBack : shapedBack
148 UnityMenuModelPaths {
151 source: hints["x-canonical-private-menu-model"]
153 busNameHint: "busName"
154 actionsHint: "actions"
155 menuObjectPathHint: "menuPath"
161 property string lastNameOwner: ""
163 busName: paths.busName
164 actions: paths.actions
165 menuObjectPath: paths.menuObjectPath
166 onNameOwnerChanged: {
167 if (lastNameOwner != "" && nameOwner == "" && notification.notification != undefined) {
168 notification.notification.close()
170 lastNameOwner = nameOwner
174 Behavior on implicitHeight {
178 UbuntuNumberAnimation {
179 duration: UbuntuAnimation.SnapDuration
183 // delay enabling height behavior until the add transition is complete
184 onOpacityChanged: if (opacity == 1) heightBehavior.enabled = true
190 objectName: "interactiveArea"
192 if (notification.type == Notification.Interactive) {
193 notification.notification.invokeAction(actionRepeater.itemAt(0).actionId)
195 notificationList.currentIndex = index;
202 objectName: "contentColumn"
208 margins: fullscreen ? 0 : spacing
216 spacing: contentColumn.spacing
228 shaped: notification.hints["x-canonical-non-shaped-icon"] == "true" ? false : true
229 visible: iconSource !== undefined && iconSource != ""
235 objectName: "secondaryIcon"
238 visible: source !== undefined && source != ""
239 fillMode: Image.PreserveAspectCrop
244 width: parent.width - x
246 anchors.verticalCenter: (icon.visible && !bodyLabel.visible) ? icon.verticalCenter : undefined
251 objectName: "summaryLabel"
258 color: Theme.palette.selected.backgroundText
259 elide: Text.ElideRight
265 objectName: "bodyLabel"
272 color: Theme.palette.selected.backgroundText
274 wrapMode: Text.WordWrap
276 elide: Text.ElideRight
283 objectName: "dialogListView"
291 top: fullscreen ? parent.top : undefined
292 bottom: fullscreen ? parent.bottom : undefined
296 model: unityMenuModel
298 NotificationMenuItemFactory {
302 left: dialogColumn.left
303 right: dialogColumn.right
306 menuModel: unityMenuModel
309 maxHeight: notification.maxHeight
312 notification.fullscreen = Qt.binding(function() { return fullscreen; });
321 objectName: "buttonRow"
326 visible: notification.type == Notification.SnapDecision && actionRepeater.count > 0
328 layoutDirection: Qt.RightToLeft
333 model: notification.actions
337 property string actionId: id
338 property string actionLabel: label
344 objectName: "button" + index
345 width: buttonRow.width / 2 - spacing
346 text: loader.actionLabel
347 gradient: notification.hints["x-canonical-private-button-tint"] == "true" && index == 0 ? greenGradient : darkgreyGradient
348 onClicked: notification.notification.invokeAction(loader.actionId)
351 sourceComponent: (index == 0 || index == 1) ? actionButton : undefined
359 objectName: "button2"
361 visible: notification.type == Notification.SnapDecision && actionRepeater.count > 3
362 gradient: darkgreyGradient
363 onClicked: notification.notification.invokeAction(comboRepeater.itemAt(2).actionId)
365 expandedHeight: (comboRepeater.count - 2) * units.gu(4) + units.gu(.5)
366 comboList: Flickable {
367 // this has to be wrapped inside a flickable
368 // to work around a feature/bug? of the
369 // ComboButton SDK-element, making a regular
370 // unwrapped Column item flickable
378 comboButton.text = comboRepeater.itemAt(2).actionLabel
381 model: notification.actions
386 visible: status == Loader.Ready
387 property string actionId: id
388 property string actionLabel: label
389 readonly property var splitLabel: actionLabel.match(/(^([-a-z0-9]+):)?(.*)$/)
396 objectName: "button" + index
397 width: comboButton.width
398 height: comboIcon.height + units.gu(2)
401 notification.notification.invokeAction(actionId)
404 ListItem.ThinDivider {
413 leftMargin: units.gu(.5)
414 verticalCenter: parent.verticalCenter
426 left: comboIcon.right
427 leftMargin: units.gu(1)
428 verticalCenter: comboIcon.verticalCenter
436 sourceComponent: (index > 2) ? comboEntry : undefined
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