1
/****************************************************************************
3
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4
** Contact: http://www.qt-project.org/legal
6
** This file is part of the documentation of the Qt Pim Module.
8
** $QT_BEGIN_LICENSE:FDL$
9
** Commercial License Usage
10
** Licensees holding valid commercial Qt licenses may use this file in
11
** accordance with the commercial license agreement provided with the
12
** Software or, alternatively, in accordance with the terms contained in
13
** a written agreement between you and Digia. For licensing terms and
14
** conditions see http://qt.digia.com/licensing. For further information
15
** use the contact form at http://qt.digia.com/contact-us.
17
** GNU Free Documentation License Usage
18
** Alternatively, this file may be used under the terms of the GNU Free
19
** Documentation License version 1.3 as published by the Free Software
20
** Foundation and appearing in the file included in the packaging of
21
** this file. Please review the following information to ensure
22
** the GNU Free Documentation License version 1.3 requirements
23
** will be met: http://www.gnu.org/copyleft/fdl.html.
26
****************************************************************************/
31
id: contactsApplication
43
height: contactsApplication.height - btnArea.height - statusBar.height
49
Component.onCompleted: {
50
contactsModel.importContacts(Qt.resolvedUrl("example.vcf"))
54
detail: ContactDetail.Name
56
direction: Qt.AscendingOrder
61
// ![Contact delegate]
70
border.color: "darkgreen"
71
color: delRect.ListView.isCurrentItem ? "#F5678A" : browsingArea.color
75
verticalCenter: parent.verticalCenter
80
text: contact.name.firstName
83
Text { text: contact.phoneNumber.number }
86
Keys.onReturnPressed: {
87
contactEditor.contact = contact
94
contactsView.currentIndex = index
99
// ![Contact delegate]
101
// ![ListView for showing the contacts]
104
anchors.fill: browsingArea
105
width: browsingArea.width
106
height: browsingArea.height
110
delegate: contactDelegate
112
// ![ListView for showing the contacts]
122
bottom: statusBar.top
128
anchors.centerIn: parent
131
// buttons for 'listView' state
135
buttonText: "Add New Contact"
138
contactEditor.contact = 0
145
buttonText: "Edit Contact"
148
contactEditor.contact = contactsView.model.contacts[contactsView.currentIndex]
152
// buttons for 'editView' state
159
contactEditor.cancel()
170
contactEditor.deleteContact()
181
contactEditor.updateContact()
189
// ![Status bar area]
193
bottom: parent.bottom
203
anchors.centerIn: parent
216
function updateMsg(msg) {
221
// ![Status bar area]
223
// ![Custom contact editor]
226
height: parent.height - statusBar.height - btnArea.height
229
// ![Custom contact editor]
231
// ![Applications state changes]
236
target: contactEditor
247
target: contactEditor
250
PropertyChanges { target: btnNew; visible: false }
251
PropertyChanges { target: btnEdit; visible: false }
252
PropertyChanges { target: btnCancel; visible: true }
253
PropertyChanges { target: btnDelete; visible: true }
254
PropertyChanges { target: btnSave; visible: true }
255
StateChangeScript { script: contactEditor.resetToDefaults() }
258
// ![Applications state changes]
260
function goToListView() {
261
contactEditor.contact = ""
262
contactsApplication.state = "listView"
265
function goToEditView() {
266
contactsApplication.state = "editView"