on 00a39ec help sign in
142 lines 4.1 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.IndicatorsLegacy 0.1 as Indicators
24import "utils.js" as Utils
26HeroMessage {
27 id: snapDecision
29 expandedHeight: buttons.y + buttons.height + quickreply.height + units.gu(2)
30 heroMessageHeader.titleText.text: menu ? menu.label : ""
31 heroMessageHeader.subtitleText.text: menu ? menu.extra.canonical_text : ""
32 heroMessageHeader.subtitleText.color: "#e8e1d0"
33 heroMessageHeader.bodyText.text: menu ? Utils.formatDate(menu.extra.canonical_time) : ""
34 heroMessageHeader.bodyText.color: "#8f8f88"
36 Item {
37 id: buttons
39 anchors.left: parent.left
40 anchors.leftMargin: units.gu(2)
41 anchors.right: parent.right
42 anchors.rightMargin: units.gu(2)
43 anchors.top: heroMessageHeader.bottom
44 anchors.topMargin: units.gu(1)
45 height: units.gu(4)
46 opacity: 0.0
48 Button {
49 text: "Message"
50 color: "#bababa"
51 anchors.left: parent.left
52 anchors.top: parent.top
53 anchors.bottom: parent.bottom
54 width: (parent.width - units.gu(1)) / 2
56 onClicked: {
57 if (quickreply.state === "") {
58 quickreply.state = "expanded";
59 } else {
60 quickreply.state = "";
61 }
62 }
63 }
65 ActionButton {
66 actionGroup: snapDecision.actionGroup
67 action: actionsDescription[0].name
69 text: actionsDescription ? actionsDescription[0].label : "Call back"
70 color: "#c94212"
71 anchors.right: parent.right
72 anchors.top: parent.top
73 anchors.bottom: parent.bottom
74 width: (parent.width - units.gu(1)) / 2
75 }
77 states: State {
78 name: "expanded"
79 when: snapDecision.state === "expanded"
81 PropertyChanges {
82 target: buttons
83 opacity: 1.0
84 }
85 }
86 transitions: Transition {
87 NumberAnimation {
88 property: "opacity"
89 duration: 200
90 easing.type: Easing.OutQuad
91 }
92 }
93 }
95 QuickReply {
96 id: quickreply
98 actionGroup: snapDecision.actionGroup
99 action: actionsDescription[1].name
101 messages: actionsDescription ? actionsDescription[1]["parameter-hint"] : ""
102 buttonText: actionsDescription ? actionsDescription[1].label : "send"
103 anchors {
104 top: buttons.bottom
105 topMargin: units.gu(2)
106 left: parent.left
107 right: parent.right
108 }
109 height: 0
110 opacity: 0.0
111 enabled: false
113 states: State {
114 name: "expanded"
116 PropertyChanges {
117 target: quickreply
118 height: expandedHeight
119 opacity: 1.0
120 }
122 PropertyChanges {
123 target: quickreply
124 enabled: true
125 }
126 }
128 transitions: Transition {
129 NumberAnimation {
130 properties: "opacity,height"
131 duration: 200
132 easing.type: Easing.OutQuad
133 }
134 }
135 }
137 onStateChanged: {
138 if (state === "") {
139 quickreply.state = "";
140 }
141 }