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 * 4) : 0
44 color: Qt.rgba(0.132, 0.117, 0.109, 0.97)
47 clip: fullscreen ? false : true
48 visible: type != Notification.PlaceHolder
55 anchors.margins: notification.margins
57 opacity: parent.opacity
67 opacity: parent.opacity
72 anchors.fill: fullscreen ? nonShapedBack : shapedBack
77 source: hints["x-canonical-private-menu-model"]
79 busNameHint: "busName"
80 actionsHint: "actions"
81 menuObjectPathHint: "menuPath"
87 busName: paths.busName
88 actions: paths.actions
89 menuObjectPath: paths.menuObjectPath
92 Behavior on implicitHeight {
96 UbuntuNumberAnimation {
97 duration: UbuntuAnimation.SnapDuration
101 // delay enabling height behavior until the add transition is complete
102 onOpacityChanged: if (opacity == 1) heightBehavior.enabled = true
107 anchors.fill: contentColumn
108 objectName: "interactiveArea"
109 enabled: notification.type == Notification.Interactive
110 onClicked: notification.notification.invokeAction(actionRepeater.itemAt(0).actionId)
120 margins: fullscreen ? 0 : spacing
128 spacing: contentColumn.spacing
140 shaped: notification.hints["x-canonical-non-shaped-icon"] == "true" ? false : true
141 visible: iconSource !== undefined && iconSource != ""
147 objectName: "secondaryIcon"
150 visible: source !== undefined && source != ""
151 fillMode: Image.PreserveAspectCrop
156 width: parent.width - x
158 anchors.verticalCenter: (icon.visible && !bodyLabel.visible) ? icon.verticalCenter : undefined
163 objectName: "summaryLabel"
170 color: Theme.palette.selected.backgroundText
171 elide: Text.ElideRight
177 objectName: "bodyLabel"
184 color: Theme.palette.selected.backgroundText
186 wrapMode: Text.WordWrap
188 elide: Text.ElideRight
194 objectName: "dialogListView"
199 anchors.left: parent.left; anchors.right: parent.right
200 anchors.top: fullscreen ? parent.top : undefined
201 anchors.bottom: fullscreen ? parent.bottom : undefined
204 model: unityMenuModel
206 NotificationMenuItemFactory {
207 anchors.left: parent.left; anchors.right: parent.right
209 menuModel: unityMenuModel
212 maxHeight: notification.maxHeight
215 notification.fullscreen = Qt.binding(function() { return fullscreen; });
224 objectName: "buttonRow"
229 visible: notification.type == Notification.SnapDecision && actionRepeater.count > 0
232 property real buttonWidth: (width - contentColumn.spacing) / 2
233 property bool expanded
238 objectName: "button1"
239 width: parent.expanded ? parent.width : parent.buttonWidth
242 bottom: parent.bottom
244 text: notification.type == Notification.SnapDecision && actionRepeater.count >= 2 ? actionRepeater.itemAt(1).actionLabel : ""
245 gradient: UbuntuColors.greyGradient
247 if (actionRepeater.count > 2) {
248 buttonRow.expanded = !buttonRow.expanded
250 notification.notification.invokeAction(actionRepeater.itemAt(1).actionId)
255 UbuntuNumberAnimation {
256 duration: UbuntuAnimation.SnapDuration
264 objectName: "button0"
266 left: leftButton.right
267 leftMargin: contentColumn.spacing
270 text: notification.type == Notification.SnapDecision && actionRepeater.count >= 1 ? actionRepeater.itemAt(0).actionLabel : ""
273 bottom: parent.bottom
275 gradient: notification.hints["x-canonical-private-button-tint"] == "true" ? UbuntuColors.orangeGradient : UbuntuColors.greyGradient
277 onClicked: notification.notification.invokeAction(actionRepeater.itemAt(0).actionId)
282 objectName: "buttonColumn"
283 spacing: contentColumn.spacing
289 // calculate initial position before Column takes over
290 y: buttonRow.y + buttonRow.height + contentColumn.spacing
292 visible: notification.type == Notification.SnapDecision && buttonRow.expanded
293 height: buttonRow.expanded ? implicitHeight : 0
298 model: notification.actions
302 property string actionId: id
303 property string actionLabel: label
314 objectName: "button" + index
320 text: loader.actionLabel
322 gradient: UbuntuColors.greyGradient
323 onClicked: notification.notification.invokeAction(loader.actionId)
326 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