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
24 property alias iconSource: avatarIcon.source
25 property alias secondaryIconSource: secondaryIcon.source
26 property alias summary: summaryLabel.text
27 property alias body: bodyLabel.text
29 property var notificationId
31 property var notification
33 objectName: "background"
34 implicitHeight: contentColumn.height + contentColumn.spacing * 2
35 color: Qt.rgba(0, 0, 0, 0.85)
40 Behavior on implicitHeight {
44 UbuntuNumberAnimation {
45 duration: UbuntuAnimation.SnapDuration
49 // delay enabling height behavior until the add transition is complete
50 onOpacityChanged: if (opacity == 1) heightBehavior.enabled = true
55 anchors.fill: contentColumn
56 objectName: "interactiveArea"
57 enabled: notification.type == Notification.Interactive
58 onClicked: notification.notification.invokeAction(actionRepeater.itemAt(0).actionId)
76 spacing: contentColumn.spacing
88 visible: iconSource !== undefined && iconSource != ""
92 fillMode: Image.PreserveAspectCrop
99 objectName: "secondaryIcon"
102 visible: source !== undefined && source != ""
103 fillMode: Image.PreserveAspectCrop
108 width: parent.width - x
113 objectName: "summaryLabel"
121 elide: Text.ElideRight
127 objectName: "bodyLabel"
136 wrapMode: Text.WordWrap
138 elide: Text.ElideRight
146 objectName: "buttonRow"
151 visible: notification.type == Notification.SnapDecision
154 property real buttonWidth: (width - contentColumn.spacing) / 2
155 property bool expanded
160 objectName: "button1"
161 width: parent.expanded ? parent.width : parent.buttonWidth
164 bottom: parent.bottom
166 text: notification.type == Notification.SnapDecision && actionRepeater.count >= 2 ? actionRepeater.itemAt(1).actionLabel : ""
169 if (actionRepeater.count > 2) {
170 buttonRow.expanded = !buttonRow.expanded
172 notification.notification.invokeAction(actionRepeater.itemAt(1).actionId)
177 UbuntuNumberAnimation {
178 duration: UbuntuAnimation.SnapDuration
186 objectName: "button0"
188 left: leftButton.right
189 leftMargin: contentColumn.spacing
192 text: notification.type == Notification.SnapDecision && actionRepeater.count >= 1 ? actionRepeater.itemAt(0).actionLabel : ""
195 bottom: parent.bottom
199 onClicked: notification.notification.invokeAction(actionRepeater.itemAt(0).actionId)
204 objectName: "buttonColumn"
205 spacing: contentColumn.spacing
211 // calculate initial position before Column takes over
212 y: buttonRow.y + buttonRow.height + contentColumn.spacing
214 visible: notification.type == Notification.SnapDecision
215 height: buttonRow.expanded ? implicitHeight : 0
220 model: notification.actions
224 property string actionId: id
225 property string actionLabel: label
236 objectName: "button" + index
242 text: loader.actionLabel
245 onClicked: notification.notification.invokeAction(loader.actionId)
248 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