~ci-train-bot/unity8/unity8-ubuntu-zesty-2404

« back to all changes in this revision

Viewing changes to qml/Notifications/Notification.qml

merge with prereq

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (C) 2013 Canonical, Ltd.
 
2
 * Copyright (C) 2013, 2015 Canonical, Ltd.
3
3
 *
4
4
 * This program is free software; you can redistribute it and/or modify
5
5
 * it under the terms of the GNU General Public License as published by
17
17
import QtQuick 2.0
18
18
import QtMultimedia 5.0
19
19
import Powerd 0.1
20
 
import Ubuntu.Components 1.1
 
20
import Ubuntu.Components 1.2
21
21
import Unity.Notifications 1.0
22
22
import QMenuModel 0.1
23
23
import Utils 0.1
24
 
 
25
24
import Ubuntu.Components.ListItems 0.1 as ListItem
26
25
 
27
26
Item {
49
48
    readonly property color sdDarkGrey: "#dddddd"
50
49
    readonly property color sdFontColor: "#5d5d5d"
51
50
    readonly property real contentSpacing: units.gu(2)
 
51
    readonly property bool canBeClosed: type === Notification.Ephemeral
 
52
    property bool hasMouse
52
53
 
53
54
    objectName: "background"
54
55
    implicitHeight: type !== Notification.PlaceHolder ? (fullscreen ? maxHeight : outterColumn.height - shapedBack.anchors.topMargin + contentSpacing * 2) : 0
216
217
            onClicked: {
217
218
                if (notification.type == Notification.Interactive) {
218
219
                    notification.notification.invokeAction(actionRepeater.itemAt(0).actionId)
 
220
                } else if (hasMouse && canBeClosed) {
 
221
                    notification.notification.close()
219
222
                } else {
220
223
                    notificationList.currentIndex = index;
221
224
                }
280
283
                        fontSize: "medium"
281
284
                        color: darkOnBright ? sdFontColor : Theme.palette.selected.backgroundText
282
285
                        elide: Text.ElideRight
283
 
                        textFormat: Text.PlainText
 
286
                        textFormat: Text.StyledText
284
287
                    }
285
288
 
286
289
                    Label {
297
300
                        wrapMode: Text.WordWrap
298
301
                        maximumLineCount: type == Notification.SnapDecision ? 12 : 2
299
302
                        elide: Text.ElideRight
300
 
                        textFormat: Text.PlainText
 
303
                        textFormat: Text.StyledText
301
304
                    }
302
305
                }
303
306
 
471
474
                                    onClicked: notification.notification.invokeAction(oneOverTwoLoaderBottom.actionId)
472
475
                                }
473
476
                            }
474
 
                            sourceComponent:  (index == 1 || index == 2) ? oneOverTwoButtonBottom : undefined
 
477
                            sourceComponent: (index == 1 || index == 2) ? oneOverTwoButtonBottom : undefined
475
478
                        }
476
479
                    }
477
480
                }
487
490
                    margins: contentSpacing
488
491
                }
489
492
                visible: notification.type === Notification.SnapDecision && actionRepeater.count > 0 && !oneOverTwoCase.visible
490
 
                spacing: units.gu(2)
 
493
                spacing: contentSpacing
491
494
                layoutDirection: Qt.RightToLeft
492
495
 
493
496
                Loader {
499
502
                        width: buttonRow.width
500
503
                        leftIconName: "call-end"
501
504
                        rightIconName: "call-start"
 
505
                        clickToAct: notification.hasMouse
502
506
                        onRightTriggered: {
503
507
                            notification.notification.invokeAction(notification.actions.data(0, ActionModel.RoleActionId))
504
508
                        }