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)
50 if (type == Notification.SnapDecision) {
51 if (ListView.view.currentIndex == index) {
54 if (ListView.view.count > 2) {
55 if (ListView.view.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
105 leftMargin: notification.margins
106 rightMargin: notification.margins
109 opacity: parent.opacity
119 opacity: parent.opacity
124 anchors.fill: fullscreen ? nonShapedBack : shapedBack
126 UnityMenuModelPaths {
129 source: hints["x-canonical-private-menu-model"]
131 busNameHint: "busName"
132 actionsHint: "actions"
133 menuObjectPathHint: "menuPath"
139 busName: paths.busName
140 actions: paths.actions
141 menuObjectPath: paths.menuObjectPath
144 Behavior on implicitHeight {
148 UbuntuNumberAnimation {
149 duration: UbuntuAnimation.SnapDuration
153 // delay enabling height behavior until the add transition is complete
154 onOpacityChanged: if (opacity == 1) heightBehavior.enabled = true
160 objectName: "interactiveArea"
162 if (notification.type == Notification.Interactive) {
163 notification.notification.invokeAction(actionRepeater.itemAt(0).actionId)
165 notificationList.currentIndex = index;
172 objectName: "contentColumn"
178 margins: fullscreen ? 0 : spacing
186 spacing: contentColumn.spacing
198 shaped: notification.hints["x-canonical-non-shaped-icon"] == "true" ? false : true
199 visible: iconSource !== undefined && iconSource != ""
205 objectName: "secondaryIcon"
208 visible: source !== undefined && source != ""
209 fillMode: Image.PreserveAspectCrop
214 width: parent.width - x
216 anchors.verticalCenter: (icon.visible && !bodyLabel.visible) ? icon.verticalCenter : undefined
221 objectName: "summaryLabel"
228 color: Theme.palette.selected.backgroundText
229 elide: Text.ElideRight
235 objectName: "bodyLabel"
242 color: Theme.palette.selected.backgroundText
244 wrapMode: Text.WordWrap
246 elide: Text.ElideRight
252 objectName: "dialogListView"
257 anchors.left: parent.left; anchors.right: parent.right
258 anchors.top: fullscreen ? parent.top : undefined
259 anchors.bottom: fullscreen ? parent.bottom : undefined
262 model: unityMenuModel
264 NotificationMenuItemFactory {
267 anchors.left: parent.left; anchors.right: parent.right
269 menuModel: unityMenuModel
272 maxHeight: notification.maxHeight
275 notification.fullscreen = Qt.binding(function() { return fullscreen; });
284 objectName: "buttonRow"
289 visible: notification.type == Notification.SnapDecision && actionRepeater.count > 0
292 property real buttonWidth: (width - contentColumn.spacing) / 2
293 property bool expanded
298 objectName: "button1"
299 width: parent.expanded ? parent.width : parent.buttonWidth
302 bottom: parent.bottom
304 text: notification.type == Notification.SnapDecision && actionRepeater.count >= 2 ? actionRepeater.itemAt(1).actionLabel : ""
305 gradient: UbuntuColors.greyGradient
307 if (actionRepeater.count > 2) {
308 buttonRow.expanded = !buttonRow.expanded
310 notification.notification.invokeAction(actionRepeater.itemAt(1).actionId)
315 UbuntuNumberAnimation {
316 duration: UbuntuAnimation.SnapDuration
324 objectName: "button0"
326 left: leftButton.right
327 leftMargin: contentColumn.spacing
330 text: notification.type == Notification.SnapDecision && actionRepeater.count >= 1 ? actionRepeater.itemAt(0).actionLabel : ""
333 bottom: parent.bottom
335 gradient: notification.hints["x-canonical-private-button-tint"] == "true" ? UbuntuColors.orangeGradient : UbuntuColors.greyGradient
337 onClicked: notification.notification.invokeAction(actionRepeater.itemAt(0).actionId)
342 objectName: "buttonColumn"
343 spacing: contentColumn.spacing
349 // calculate initial position before Column takes over
350 y: buttonRow.y + buttonRow.height + contentColumn.spacing
352 visible: notification.type == Notification.SnapDecision && buttonRow.expanded
353 height: buttonRow.expanded ? implicitHeight : 0
358 model: notification.actions
362 property string actionId: id
363 property string actionLabel: label
374 objectName: "button" + index
380 text: loader.actionLabel
382 gradient: UbuntuColors.greyGradient
383 onClicked: notification.notification.invokeAction(loader.actionId)
386 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