~unity-team/+junk/dashboard-playground

« back to all changes in this revision

Viewing changes to Dash/People/PeoplePreview.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"
 
20
import "../../Components/ListItems" as ListItems
 
21
import ".."
 
22
import "Preview"
 
23
 
 
24
DashPreview {
 
25
    id: preview
 
26
 
 
27
    property var model: undefined
 
28
 
 
29
    title: (model && model.displayName) ? model.displayName : ""
 
30
    url: (model && model.avatar) ? model.avatar : ""
 
31
    previewWidthRatio: 0.34
 
32
 
 
33
 
 
34
    description: Grid {
 
35
        spacing: columns > 1 ? units.gu(2) : 0
 
36
        columns: preview.narrowMode || width < units.gu(60) ? 1 : 2
 
37
        property int columnWidth: columns > 1 ? (width - spacing * (columns - 1)) / columns : width
 
38
        anchors {
 
39
            left: parent.left
 
40
            right: parent.right
 
41
        }
 
42
 
 
43
        Status {
 
44
            id: status
 
45
            objectName: "statusField"
 
46
            width: parent.columnWidth
 
47
            visible: preview.model != undefined && preview.model.status != undefined
 
48
            model: preview.model
 
49
            property int index: 1
 
50
            // FIXME that should trigger the action on the lens/scope, when there's support
 
51
            onClicked: shell.activateApplication("/usr/share/applications/%1-webapp.desktop".arg(model.statusService), "--homepage=%1".arg(model.statusPostUri))
 
52
        }
 
53
 
 
54
 
 
55
        Column {
 
56
            id: descriptionColumn
 
57
            width: parent.columnWidth
 
58
 
 
59
 
 
60
            Column {
 
61
                anchors {
 
62
                    left: parent.left
 
63
                    right: parent.right
 
64
                }
 
65
 
 
66
                Repeater {
 
67
                    model: preview.model ? preview.model.phoneNumbers : undefined
 
68
 
 
69
                    delegate: Phone {
 
70
                        objectName: "phoneField" + index
 
71
                        model: preview.model
 
72
                        // FIXME these should trigger actions on the lens/scope, when there's support
 
73
                        onPhoneClicked: shell.activateApplication("/usr/share/applications/phone-app.desktop", "call://%1".arg(number.replace(/[^\d\+]/g, "")))
 
74
                        onTextClicked: shell.activateApplication("/usr/share/applications/phone-app.desktop", "message://%1".arg(number.replace(/[^\d\+]/g, "")))
 
75
                    }
 
76
                }
 
77
            }
 
78
 
 
79
            Column {
 
80
                anchors {
 
81
                    left: parent.left
 
82
                    right: parent.right
 
83
                }
 
84
 
 
85
                Repeater {
 
86
                    model: preview.model ? preview.model.emailAddresses : undefined
 
87
                    delegate: Generic {
 
88
                        objectName: "emailField" + index
 
89
                        type: "email"
 
90
                    }
 
91
                }
 
92
            }
 
93
 
 
94
            Column {
 
95
                anchors {
 
96
                    left: parent.left
 
97
                    right: parent.right
 
98
                }
 
99
 
 
100
                Repeater {
 
101
                    model: preview.model ? preview.model.imAccounts : undefined
 
102
                    delegate: Generic {
 
103
                        objectName: "imField" + index
 
104
                        type: "imAccount"
 
105
                    }
 
106
                }
 
107
            }
 
108
 
 
109
            Column {
 
110
                anchors {
 
111
                    left: parent.left
 
112
                    right: parent.right
 
113
                }
 
114
 
 
115
                Repeater {
 
116
                    model: preview.model ? preview.model.addresses : undefined
 
117
                    delegate: Address {
 
118
                        objectName: "addressField" + index
 
119
                    }
 
120
                }
 
121
            }
 
122
        }
 
123
    }
 
124
}