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"
110 if (notification.type == Notification.Interactive) {
111 notification.notification.invokeAction(actionRepeater.itemAt(0).actionId)
123 margins: fullscreen ? 0 : spacing
131 spacing: contentColumn.spacing
143 shaped: notification.hints["x-canonical-non-shaped-icon"] == "true" ? false : true
144 visible: iconSource !== undefined && iconSource != ""
150 objectName: "secondaryIcon"
153 visible: source !== undefined && source != ""
154 fillMode: Image.PreserveAspectCrop
159 width: parent.width - x
161 anchors.verticalCenter: (icon.visible && !bodyLabel.visible) ? icon.verticalCenter : undefined
166 objectName: "summaryLabel"
173 color: Theme.palette.selected.backgroundText
174 elide: Text.ElideRight
180 objectName: "bodyLabel"
187 color: Theme.palette.selected.backgroundText
189 wrapMode: Text.WordWrap
191 elide: Text.ElideRight
197 objectName: "dialogListView"
202 anchors.left: parent.left; anchors.right: parent.right
203 anchors.top: fullscreen ? parent.top : undefined
204 anchors.bottom: fullscreen ? parent.bottom : undefined
207 model: unityMenuModel
209 NotificationMenuItemFactory {
210 anchors.left: parent.left; anchors.right: parent.right
212 menuModel: unityMenuModel
215 maxHeight: notification.maxHeight
218 notification.fullscreen = Qt.binding(function() { return fullscreen; });
227 objectName: "buttonRow"
232 visible: notification.type == Notification.SnapDecision && actionRepeater.count > 0
235 property real buttonWidth: (width - contentColumn.spacing) / 2
236 property bool expanded
241 objectName: "button1"
242 width: parent.expanded ? parent.width : parent.buttonWidth
245 bottom: parent.bottom
247 text: notification.type == Notification.SnapDecision && actionRepeater.count >= 2 ? actionRepeater.itemAt(1).actionLabel : ""
248 gradient: UbuntuColors.greyGradient
250 if (actionRepeater.count > 2) {
251 buttonRow.expanded = !buttonRow.expanded
253 notification.notification.invokeAction(actionRepeater.itemAt(1).actionId)
258 UbuntuNumberAnimation {
259 duration: UbuntuAnimation.SnapDuration
267 objectName: "button0"
269 left: leftButton.right
270 leftMargin: contentColumn.spacing
273 text: notification.type == Notification.SnapDecision && actionRepeater.count >= 1 ? actionRepeater.itemAt(0).actionLabel : ""
276 bottom: parent.bottom
278 gradient: notification.hints["x-canonical-private-button-tint"] == "true" ? UbuntuColors.orangeGradient : UbuntuColors.greyGradient
280 onClicked: notification.notification.invokeAction(actionRepeater.itemAt(0).actionId)
285 objectName: "buttonColumn"
286 spacing: contentColumn.spacing
292 // calculate initial position before Column takes over
293 y: buttonRow.y + buttonRow.height + contentColumn.spacing
295 visible: notification.type == Notification.SnapDecision && buttonRow.expanded
296 height: buttonRow.expanded ? implicitHeight : 0
301 model: notification.actions
305 property string actionId: id
306 property string actionLabel: label
317 objectName: "button" + index
323 text: loader.actionLabel
325 gradient: UbuntuColors.greyGradient
326 onClicked: notification.notification.invokeAction(loader.actionId)
329 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