on 42b1bfc help sign in
unity8/Panel/Indicators/DatetimeIndicatorIcon.qml
67 lines 1.8 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 * Nick Dedekind <nick.dedekind@canonical.com>
18 */
20import QtQuick 2.0
21import Ubuntu.Components 0.1
22import IndicatorsClient 0.1 as IndicatorsClient
24IndicatorsClient.IndicatorIcon {
25 id: indicatorIcon
27 width: timeLabel.width + units.gu(1)
29 property alias label: timeLabel.text
30 property date __date
32 Label {
33 id: timeLabel
34 objectName: "timeLabel"
35 color: "#f3f3e7"
36 opacity: 0.8
37 font.family: "Ubuntu"
38 fontSize: "medium"
39 anchors {
40 verticalCenter: parent.verticalCenter
41 horizontalCenter: parent.horizontalCenter
42 }
43 text: Qt.formatTime(__date)
44 }
46 Timer {
47 id: timer
48 interval: 1000 * 60
49 running: indicatorIcon.visible
50 repeat: true
51 triggeredOnStart: true
52 onTriggered: __date = new Date
53 }
55 onActionStateChanged: {
56 if (action == undefined || !action.valid) {
57 return
58 }
60 if (action.state == undefined) {
61 visible = false;
62 return
63 }
65 indicatorIcon.visible = action.state[3]
66 }