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
74 UbuntuNumberAnimation {
75 duration: UbuntuAnimation.FastDuration
82 PropertyChanges {target: notification; height: units.gu(8)}
86 PropertyChanges {target: notification; height: implicitHeight}
90 clip: fullscreen ? false : true
92 visible: type != Notification.PlaceHolder
99 anchors.leftMargin: notification.margins
100 anchors.rightMargin: notification.margins
102 opacity: parent.opacity
112 opacity: parent.opacity
117 anchors.fill: fullscreen ? nonShapedBack : shapedBack
119 UnityMenuModelPaths {
122 source: hints["x-canonical-private-menu-model"]
124 busNameHint: "busName"
125 actionsHint: "actions"
126 menuObjectPathHint: "menuPath"
132 busName: paths.busName
133 actions: paths.actions
134 menuObjectPath: paths.menuObjectPath
137 Behavior on implicitHeight {
141 UbuntuNumberAnimation {
142 duration: UbuntuAnimation.SnapDuration
146 // delay enabling height behavior until the add transition is complete
147 onOpacityChanged: if (opacity == 1) heightBehavior.enabled = true
153 objectName: "interactiveArea"
155 if (notification.type == Notification.Interactive) {
156 notification.notification.invokeAction(actionRepeater.itemAt(0).actionId)
158 notificationList.currentIndex = index;
170 margins: fullscreen ? 0 : spacing
178 spacing: contentColumn.spacing
190 shaped: notification.hints["x-canonical-non-shaped-icon"] == "true" ? false : true
191 visible: iconSource !== undefined && iconSource != ""
197 objectName: "secondaryIcon"
200 visible: source !== undefined && source != ""
201 fillMode: Image.PreserveAspectCrop
206 width: parent.width - x
208 anchors.verticalCenter: (icon.visible && !bodyLabel.visible) ? icon.verticalCenter : undefined
213 objectName: "summaryLabel"
220 color: Theme.palette.selected.backgroundText
221 elide: Text.ElideRight
227 objectName: "bodyLabel"
234 color: Theme.palette.selected.backgroundText
236 wrapMode: Text.WordWrap
238 elide: Text.ElideRight
244 objectName: "dialogListView"
249 anchors.left: parent.left; anchors.right: parent.right
250 anchors.top: fullscreen ? parent.top : undefined
251 anchors.bottom: fullscreen ? parent.bottom : undefined
254 model: unityMenuModel
256 NotificationMenuItemFactory {
259 anchors.left: parent.left; anchors.right: parent.right
261 menuModel: unityMenuModel
264 maxHeight: notification.maxHeight
267 notification.fullscreen = Qt.binding(function() { return fullscreen; });
276 objectName: "buttonRow"
281 visible: notification.type == Notification.SnapDecision && actionRepeater.count > 0
284 property real buttonWidth: (width - contentColumn.spacing) / 2
285 property bool expanded
290 objectName: "button1"
291 width: parent.expanded ? parent.width : parent.buttonWidth
294 bottom: parent.bottom
296 text: notification.type == Notification.SnapDecision && actionRepeater.count >= 2 ? actionRepeater.itemAt(1).actionLabel : ""
297 gradient: UbuntuColors.greyGradient
299 if (actionRepeater.count > 2) {
300 buttonRow.expanded = !buttonRow.expanded
302 notification.notification.invokeAction(actionRepeater.itemAt(1).actionId)
307 UbuntuNumberAnimation {
308 duration: UbuntuAnimation.SnapDuration
316 objectName: "button0"
318 left: leftButton.right
319 leftMargin: contentColumn.spacing
322 text: notification.type == Notification.SnapDecision && actionRepeater.count >= 1 ? actionRepeater.itemAt(0).actionLabel : ""
325 bottom: parent.bottom
327 gradient: notification.hints["x-canonical-private-button-tint"] == "true" ? UbuntuColors.orangeGradient : UbuntuColors.greyGradient
329 onClicked: notification.notification.invokeAction(actionRepeater.itemAt(0).actionId)
334 objectName: "buttonColumn"
335 spacing: contentColumn.spacing
341 // calculate initial position before Column takes over
342 y: buttonRow.y + buttonRow.height + contentColumn.spacing
344 visible: notification.type == Notification.SnapDecision && buttonRow.expanded
345 height: buttonRow.expanded ? implicitHeight : 0
350 model: notification.actions
354 property string actionId: id
355 property string actionLabel: label
366 objectName: "button" + index
372 text: loader.actionLabel
374 gradient: UbuntuColors.greyGradient
375 onClicked: notification.notification.invokeAction(loader.actionId)
378 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