| 1 |
/* |
| 2 |
* Copyright (C) 2012-2015 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.4 |
| 18 |
import QtContacts 5.0 as QtContacts |
| 19 |
|
| 20 |
ListModel { |
| 21 |
id: typeModel |
| 22 |
|
| 23 |
signal loaded() |
| 24 |
|
| 25 |
function getTypeIndex(detail) { |
| 26 |
var protocol = detail.value(2) |
| 27 |
switch(protocol) { |
| 28 |
case 1: |
| 29 |
return 0; |
| 30 |
case 2: |
| 31 |
return 1; |
| 32 |
case 4: |
| 33 |
return 2; |
| 34 |
case 5: |
| 35 |
return 3; |
| 36 |
case 7: |
| 37 |
return 4; |
| 38 |
case 8: |
| 39 |
return 5; |
| 40 |
default: |
| 41 |
return 4; //default value is "Skype" |
| 42 |
} |
| 43 |
} |
| 44 |
|
| 45 |
function updateDetail(detail, index) { |
| 46 |
var modelData = get(index) |
| 47 |
if (!modelData) { |
| 48 |
return false |
| 49 |
} |
| 50 |
|
| 51 |
if (detail.value(2) != modelData.value) { |
| 52 |
detail.setValue(2, modelData.value) |
| 53 |
return true |
| 54 |
} |
| 55 |
|
| 56 |
return false |
| 57 |
} |
| 58 |
|
| 59 |
Component.onCompleted: { |
| 60 |
//append({"value": 0, "label": i18n.dtr("lomiri-addressbook-app", "Other"), icon: "artwork:/protocol-other.svg"}) |
| 61 |
/*0*/ // TRANSLATORS: This refers to the AIM chat network http://en.wikipedia.org/wiki/AOL_Instant_Messenger |
| 62 |
append({"value": 1, "label": i18n.dtr("lomiri-addressbook-app", "Aim"), "icon": "artwork:/protocol-aim.svg"}) |
| 63 |
/*1*/ append({"value": 2, "label": i18n.dtr("lomiri-addressbook-app", "ICQ"), "icon": "artwork:/protocol-icq.svg"}) |
| 64 |
//append({"value": 3, "label": i18n.dtr("lomiri-addressbook-app", "IRC"), icon: "artwork:/protocol-irc.svg"}) |
| 65 |
/*2*/ append({"value": 4, "label": i18n.dtr("lomiri-addressbook-app", "Jabber"), "icon": "artwork:/protocol-jabber.svg"}) |
| 66 |
/*3*/ append({"value": 5, "label": i18n.dtr("lomiri-addressbook-app", "MSN"), "icon": "artwork:/protocol-msn.svg"}) |
| 67 |
// append({"value": 6, "label": i18n.dtr("lomiri-addressbook-app", "QQ"), icon: "artwork:/protocol-qq.svg"}) |
| 68 |
/*4*/ append({"value": 7, "label": i18n.dtr("lomiri-addressbook-app", "Skype"), "icon": "artwork:/protocol-skype.svg"}) |
| 69 |
/*5*/ append({"value": 8, "label": i18n.dtr("lomiri-addressbook-app", "Yahoo"), "icon": "artwork:/protocol-yahoo.svg"}) |
| 70 |
loaded() |
| 71 |
} |
| 72 |
} |