on 77121cf help sign in
120 lines 3.3 kB history raw
1/*
2 * Copyright 2013 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
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 Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Renato Araujo Oliveira Filho <renato@canonical.com>
18 * Olivier Tilloy <olivier.tilloy@canonical.com>
19 */
21import QtQuick 2.0
22import Ubuntu.Components 0.1
23import Unity.Indicators 0.1 as Indicators
25Indicators.BasicMenuItem {
26 id: heroMessage
28 property variant actionsDescription: null
29 property alias heroMessageHeader: __heroMessageHeader
30 property real collapsedHeight: heroMessageHeader.y + heroMessageHeader.bodyBottom + units.gu(2)
31 property real expandedHeight: collapsedHeight
33 color: "#221e1c"
35 removable: state !== "expanded"
36 implicitHeight: collapsedHeight
38 Indicators.MenuAction {
39 id: menuAction
40 actionGroup: heroMessage.actionGroup
41 action: menu ? menu.action : ""
42 }
44 HeroMessageHeader {
45 id: __heroMessageHeader
47 anchors.top: parent.top
48 anchors.left: parent.left
49 anchors.right: parent.right
51 avatar: menu && (menu.extra.canonical_icon.length > 0) ? "image://gicon/" + encodeURI(menu.extra.canonical_icon) : "qrc:/indicators/artwork/messaging/default_contact.png"
52 icon: menu && (menu.extra.canonical_app_icon.length > 0) ? "image://gicon/" + encodeURI(menu.extra.canonical_app_icon) : ""
53 appIcon: icon
55 state: heroMessage.state
57 onAppIconClicked: {
58 if (menuAction.valid) {
59 deactivateMenu();
60 action.activate(true);
61 }
62 }
63 }
65 onClicked: {
66 if (menuActivated) {
67 deactivateMenu();
68 } else {
69 activateMenu();
70 }
71 }
73 Indicators.HLine {
74 id: __topHLine
75 anchors.top: parent.top
76 color: "#403b37"
77 }
79 Indicators.HLine {
80 id: __bottomHLine
81 anchors.bottom: parent.bottom
82 color: "#060606"
83 }
85 states: State {
86 name: "expanded"
87 when: menuActivated
89 PropertyChanges {
90 target: heroMessage
91 color: "#333130"
92 implicitHeight: heroMessage.expandedHeight
93 }
94 PropertyChanges {
95 target: __topHLine
96 opacity: 0.0
97 }
98 PropertyChanges {
99 target: __bottomHLine
100 opacity: 0.0
101 }
102 }
104 transitions: Transition {
105 ParallelAnimation {
106 NumberAnimation {
107 properties: "opacity,implicitHeight"
108 duration: 200
109 easing.type: Easing.OutQuad
110 }
111 ColorAnimation {}
112 }
113 }
115 onItemRemoved: {
116 if (menuAction.valid) {
117 menuAction.activate(false);
118 }
119 }