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 Ubuntu.Components 0.1
19import Unity.Notifications 1.0
26 property alias iconSource: icon.fileSource
27 property alias secondaryIconSource: secondaryIcon.source
28 property alias summary: summaryLabel.text
29 property alias body: bodyLabel.text
31 property var notificationId
34 property var notification
36 property bool fullscreen
37 property int maxHeight
41 objectName: "background"
42 implicitHeight: type !== Notification.PlaceHolder ? (fullscreen ? maxHeight : contentColumn.height + contentColumn.spacing * 2) : 0
44 color: Qt.rgba(0.132, 0.117, 0.109, 0.97)
48 var result = "undefined";
50 if (type == Notification.SnapDecision) {
51 if (notificationList.currentIndex == index) {
54 if (notificationList.count > 2) {
55 if (notificationList.currentIndex == -1 && index == 1) {
58 result = "contracted";
70 id: normalHeightBehavior
72 //enabled: menuItemFactory.progress == 1
76 duration: UbuntuAnimation.SnapDuration
78 UbuntuNumberAnimation {
79 duration: UbuntuAnimation.SnapDuration
87 PropertyChanges {target: notification; height: units.gu(8)}
91 PropertyChanges {target: notification; height: implicitHeight}
95 clip: fullscreen ? false : true
97 visible: type != Notification.PlaceHolder
104 anchors.leftMargin: notification.margins
105 anchors.rightMargin: notification.margins
107 opacity: parent.opacity
117 opacity: parent.opacity
122 anchors.fill: fullscreen ? nonShapedBack : shapedBack
124 UnityMenuModelPaths {
127 source: hints["x-canonical-private-menu-model"]
129 busNameHint: "busName"
130 actionsHint: "actions"
131 menuObjectPathHint: "menuPath"
137 busName: paths.busName
138 actions: paths.actions
139 menuObjectPath: paths.menuObjectPath
142 Behavior on implicitHeight {
146 UbuntuNumberAnimation {
147 duration: UbuntuAnimation.SnapDuration
151 // delay enabling height behavior until the add transition is complete
152 onOpacityChanged: if (opacity == 1) heightBehavior.enabled = true
158 objectName: "interactiveArea"
160 if (notification.type == Notification.Interactive) {
161 notification.notification.invokeAction(actionRepeater.itemAt(0).actionId)
163 notificationList.currentIndex = index;
175 margins: fullscreen ? 0 : spacing
183 spacing: contentColumn.spacing
195 shaped: notification.hints["x-canonical-non-shaped-icon"] == "true" ? false : true
196 visible: iconSource !== undefined && iconSource != ""
202 objectName: "secondaryIcon"
205 visible: source !== undefined && source != ""
206 fillMode: Image.PreserveAspectCrop
211 width: parent.width - x
213 anchors.verticalCenter: (icon.visible && !bodyLabel.visible) ? icon.verticalCenter : undefined
218 objectName: "summaryLabel"
225 color: Theme.palette.selected.backgroundText
226 elide: Text.ElideRight
232 objectName: "bodyLabel"
239 color: Theme.palette.selected.backgroundText
241 wrapMode: Text.WordWrap
243 elide: Text.ElideRight
249 objectName: "dialogListView"
254 anchors.left: parent.left; anchors.right: parent.right
255 anchors.top: fullscreen ? parent.top : undefined
256 anchors.bottom: fullscreen ? parent.bottom : undefined
259 model: unityMenuModel
261 NotificationMenuItemFactory {
264 anchors.left: parent.left; anchors.right: parent.right
266 menuModel: unityMenuModel
269 maxHeight: notification.maxHeight
272 notification.fullscreen = Qt.binding(function() { return fullscreen; });
281 objectName: "buttonRow"
286 visible: notification.type == Notification.SnapDecision && actionRepeater.count > 0
289 property real buttonWidth: (width - contentColumn.spacing) / 2
290 property bool expanded
295 objectName: "button1"
296 width: parent.expanded ? parent.width : parent.buttonWidth
299 bottom: parent.bottom
301 text: notification.type == Notification.SnapDecision && actionRepeater.count >= 2 ? actionRepeater.itemAt(1).actionLabel : ""
302 gradient: UbuntuColors.greyGradient
304 if (actionRepeater.count > 2) {
305 buttonRow.expanded = !buttonRow.expanded
307 notification.notification.invokeAction(actionRepeater.itemAt(1).actionId)
312 UbuntuNumberAnimation {
313 duration: UbuntuAnimation.SnapDuration
321 objectName: "button0"
323 left: leftButton.right
324 leftMargin: contentColumn.spacing
327 text: notification.type == Notification.SnapDecision && actionRepeater.count >= 1 ? actionRepeater.itemAt(0).actionLabel : ""
330 bottom: parent.bottom
332 gradient: notification.hints["x-canonical-private-button-tint"] == "true" ? UbuntuColors.orangeGradient : UbuntuColors.greyGradient
334 onClicked: notification.notification.invokeAction(actionRepeater.itemAt(0).actionId)
339 objectName: "buttonColumn"
340 spacing: contentColumn.spacing
346 // calculate initial position before Column takes over
347 y: buttonRow.y + buttonRow.height + contentColumn.spacing
349 visible: notification.type == Notification.SnapDecision && buttonRow.expanded
350 height: buttonRow.expanded ? implicitHeight : 0
355 model: notification.actions
359 property string actionId: id
360 property string actionLabel: label
371 objectName: "button" + index
377 text: loader.actionLabel
379 gradient: UbuntuColors.greyGradient
380 onClicked: notification.notification.invokeAction(loader.actionId)
383 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