ContactEditor.qml Example File
addressbook/assets/ContactEditor.qml
import bb.cascades 1.0
import com.example.bb10samples.pim.addressbook 1.0
Page {
id: root
onCreationCompleted: {
if (_addressBook.contactEditor.mode == ContactEditor.EditMode) {
firstNameField.text = _addressBook.contactEditor.firstName
lastNameField.text = _addressBook.contactEditor.lastName
birthdayField.value = _addressBook.contactEditor.birthday
emailField.text = _addressBook.contactEditor.email
}
}
titleBar: TitleBar {
id: pageTitleBar
acceptAction: ActionItem {
title: (_addressBook.contactEditor.mode == ContactEditor.CreateMode ? qsTr ("Create" ) : qsTr ("Save"))
onTriggered: {
_addressBook.contactEditor.saveContact()
navigationPane.pop()
}
}
dismissAction: ActionItem {
title: qsTr ("Cancel")
onTriggered: navigationPane.pop()
}
}
Container {
layout: DockLayout {}
BackgroundImage {
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Fill
}
AddressbookScrollView {
Container {
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Fill
leftPadding: 30
topPadding: 30
rightPadding: 30
TextField {
id: firstNameField
hintText: qsTr("First Name")
onTextChanging: _addressBook.contactEditor.firstName = text
}
TextField {
id: lastNameField
hintText: qsTr("Last Name")
onTextChanging: _addressBook.contactEditor.lastName = text
}
DateTimePicker {
id: birthdayField
title: qsTr("Birthday")
onValueChanged: _addressBook.contactEditor.birthday = value
}
TextField {
id: emailField
hintText: qsTr("Email")
inputMode: TextFieldInputMode.EmailAddress
onTextChanging: _addressBook.contactEditor.email = text
}
}
}
}
}