2
* Copyright (C) 2013 Canonical, Ltd.
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.
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.
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/>.
24
property var emails: ListModel {}
25
property var phones: ListModel {}
26
property string presenceStatus
27
property string presenceMessage
28
property url remoteSourceIcon
29
property string remotePost
30
property bool favorite
32
property url statusIcon
33
property string status: remotePost ? remotePost : presenceMessage
34
property url recentIcon
35
property string recentTime
37
statusIcon: switch(presenceStatus) {
38
case "offline": "graphics/icon_offline.png"; break
39
// FIXME random for now, as we don't get actual presence data on the phone
41
var r = Math.random();
42
if (r >= 0.7) "graphics/icon_online.png"
43
else if (r >= 0.4) "graphics/icon_offline.png"
44
else "graphics/icon_unknown.png"
46
default: "graphics/icon_online.png"
50
for (var i in value) switch (value[i][0]) {
51
case "presence-message": presenceMessage = value[i][1]; break
52
case "presence-status": presenceStatus = value[i][1]; break
53
case "remote-source-icon": remoteSourceIcon = value[i][1]; break
54
case "remote-post": remotePost = value[i][1]; break
55
case "recent-icon": recentIcon = value[i][1]; break
56
case "recent-time": recentTime = value[i][1]; break
57
case "phone": phones.append({"type": generateType(), "number": value[i][1]}); break
58
case "email": emails.append({"type": generateType(), "address": value[i][1]}); break
62
// FIXME: random for now, as we don't have multiple phone numbers in the backend yet
63
function generateType() {
65
var r = Math.random();
66
if (r >= 0.7) phoneType = "Private";
67
else if (r >= 0.4) phoneType = "Mobile";
68
else phoneType = "Work";