~ken-vandine/address-book-app/add_profile

« back to all changes in this revision

Viewing changes to src/imports/Ubuntu/Contacts/ContactDetailPickerDelegate.qml

  • Committer: CI bot
  • Author(s): Tarmac, Renato Araujo Oliveira Filho
  • Date: 2014-06-16 13:12:46 UTC
  • mfrom: (169.1.22 release-2014-06-12)
  • Revision ID: ps-jenkins@lists.canonical.com-20140616131246-rzqpkq95ut0j8gka
Implemented contact share.
Replaced ContentHub API with QML API.
Removed ContactSearchListView component.
Moved ContactSimpleListView to the private API.
Added documentation for ContactListView properties.
Created "contactNameFilter" into ContactListView.
Update contact list visuals.
Implemented fast scroll.
Implemented contact search.
Initial refactor of autopilot tests.
Used new SDK header. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright (C) 2012-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.2
18
 
import QtContacts 5.0
19
 
 
20
 
Item {
21
 
    id: detailPickerDelegate
22
 
 
23
 
    property string contactId
24
 
    property QtObject contact: null
25
 
    property int currentOperation: -1
26
 
    property int detailType: 0
27
 
    property QtObject contactsModel
28
 
 
29
 
    signal detailClicked(QtObject contact, QtObject detail)
30
 
 
31
 
    width: parent ? parent.width : 0
32
 
    height: (delegateLoaderPicker.status === Loader.Ready) && delegateLoaderPicker.item ? delegateLoaderPicker.item.height : 0
33
 
 
34
 
    onContactIdChanged: {
35
 
        currentOperation = contactsModel.fetchContacts(contactId)
36
 
    }
37
 
 
38
 
    Loader {
39
 
        id: delegateLoaderPicker
40
 
        anchors.left: parent.left
41
 
        anchors.right: parent.right
42
 
    }
43
 
 
44
 
    Connections {
45
 
        target: contactsModel
46
 
        onContactsFetched: {
47
 
            if (currentOperation == requestId) {
48
 
                detailPickerDelegate.contact = fetchedContacts[0]
49
 
                // TODO: add more types and delegates
50
 
                switch(detailType) {
51
 
                case ContactDetail.PhoneNumber:
52
 
                    delegateLoaderPicker.source = Qt.resolvedUrl("ContactDetailPickerPhoneNumberDelegate.qml")
53
 
                    break
54
 
                default:
55
 
                }
56
 
                delegateLoaderPicker.item.contact = contact
57
 
            }
58
 
        }
59
 
    }
60
 
 
61
 
    Connections {
62
 
        target: delegateLoaderPicker.item
63
 
        onDetailClicked: detailClicked(contact, detail)
64
 
    }
65
 
}