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

« back to all changes in this revision

Viewing changes to Dash/People/Preview/Phone.qml

  • Committer: Michał Sawicz
  • Date: 2013-06-05 22:03:08 UTC
  • Revision ID: michal.sawicz@canonical.com-20130605220308-yny8fv3futtr04fg
Inital unity8 commit.

Previous history can be found at https://code.launchpad.net/~unity-team/unity/phablet

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 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 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 General Public License for more details.
 
12
 *
 
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/>.
 
15
 */
 
16
 
 
17
import QtQuick 2.0
 
18
import Ubuntu.Components 0.1
 
19
import "../../../Components/ListItems" as ListItems
 
20
 
 
21
Base {
 
22
    id: root
 
23
    highlightWhenPressed: false
 
24
 
 
25
    signal phoneClicked
 
26
    signal textClicked
 
27
 
 
28
    Row {
 
29
        height: phoneButton.height
 
30
        anchors {
 
31
            left: parent.left
 
32
            right: parent.right
 
33
        }
 
34
        AbstractButton {
 
35
            id: phoneButton
 
36
            width: parent.width - units.gu(7)
 
37
            height: Math.max(units.gu(8), phoneColumn.height + units.gu(2))
 
38
            Column {
 
39
                id: phoneColumn
 
40
                spacing: units.gu(0.5)
 
41
                anchors {
 
42
                    top: parent.top
 
43
                    topMargin: units.gu(1)
 
44
                    left: parent.left
 
45
                    leftMargin: units.gu(2)
 
46
                    right: parent.right
 
47
                }
 
48
                Label {
 
49
                    text: {
 
50
                    var parts = []
 
51
                        if (location) parts.push(location)
 
52
                        if (type && type != "voice") parts.push(type)
 
53
                        if (parts.length == 0) return "other"
 
54
                        return parts.join(" ")
 
55
                    }
 
56
                    elide: Text.ElideRight
 
57
                    color: "#f3f3e7"
 
58
                    style: Text.Raised
 
59
                    styleColor: "black"
 
60
                    font.capitalization: Font.Capitalize
 
61
                    opacity: 0.7;
 
62
                    fontSize: "small"
 
63
                }
 
64
                Label {
 
65
                    width: parent.width
 
66
                    text: number
 
67
                    elide: Text.ElideRight
 
68
                    color: "#f3f3e7"
 
69
                    style: Text.Raised
 
70
                    styleColor: "black"
 
71
                    opacity: 0.9;
 
72
                    fontSize: "large"
 
73
                    wrapMode: Text.WordWrap
 
74
                    maximumLineCount: 2
 
75
                    font.weight: Font.Light
 
76
                }
 
77
            }
 
78
 
 
79
            ListItems.Highlight {
 
80
                anchors.fill: parent
 
81
                pressed: phoneButton.pressed
 
82
            }
 
83
 
 
84
            onClicked: phoneClicked()
 
85
        }
 
86
 
 
87
        AbstractButton {
 
88
            id: textButton
 
89
            width: units.gu(7)
 
90
            height: parent.height
 
91
 
 
92
            Image {
 
93
                anchors.centerIn: parent
 
94
                width: units.gu(4)
 
95
                height: units.gu(4)
 
96
                source: "../graphics/icon_write_text.png"
 
97
                fillMode: Image.PreserveAspectFit
 
98
            }
 
99
 
 
100
            ListItems.Highlight {
 
101
                anchors.fill: parent
 
102
                pressed: textButton.pressed
 
103
            }
 
104
 
 
105
            onClicked: textClicked()
 
106
        }
 
107
    }
 
108
}