Commit d02123c6 authored by Nicolas Fella's avatar Nicolas Fella Committed by Jonah Brüchert

Adapt editing to sheet->page changes

parent 9f1b5df9
......@@ -21,12 +21,15 @@ import QtQuick 2.6
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.2
import org.kde.kirigami 2.4 as Kirigami
import org.kde.people 1.0 as KPeople
Kirigami.Page {
id: root
title: state === "create" ? i18n("Add contact") : i18n("Edit contact")
property string personUri
property url personUri
states: [
State {
......@@ -37,6 +40,11 @@ Kirigami.Page {
}
]
KPeople.PersonData {
id: personData
personUri: root.personUri
}
actions {
main: Kirigami.Action {
icon.name: "dialog-ok-apply"
......@@ -59,19 +67,25 @@ Kirigami.Page {
TextField {
Kirigami.FormData.label: i18n("First name:")
// FIXME PersonData doesn't have separate first/last name
text: personUri ? personData.person.name.split(" ")[0] : ""
id: firstname
}
TextField {
Kirigami.FormData.label: i18n("Last name:")
// FIXME KPeople doesn't have separate first/last name
text: personUri ? personData.person.name.split(" ")[1] : ""
id: lastname
}
TextField {
id: phoneNumber
Kirigami.FormData.label: i18n("Phone:")
// FIXME PersonData doesn't have phonenumber property
}
TextField {
id: email
Kirigami.FormData.label: i18n("Email:")
// FIXME PersonData doesn't have email property
}
}
}
......@@ -109,20 +109,6 @@ Kirigami.ScrollablePage {
onTriggered: {
personActions.triggerAction(KPeople.AudioCallAction)
}
},
Kirigami.Action {
icon.name: "list-remove-user"
onTriggered: {
phonebook.deleteContact(personUri)
}
},
Kirigami.Action {
icon.name: "document-edit"
onTriggered: {
form.state = "update"
form.personUri = personUri
form.open()
}
}
]
......
......@@ -67,28 +67,20 @@ Kirigami.ScrollablePage {
text: i18n("Write SMS")
onTriggered: personActions.triggerAction(KPeople.TextChatAction)
}
contextualActions: [
Kirigami.Action {
iconName: "document-edit"
text: "Edit"
onTriggered: {
console.log(page.personUri)
pageStack.push(Qt.resolvedUrl("AddContactPage.qml"), {state: "update", personUri: page.personUri})
}
},
Kirigami.Action {
iconName: "delete"
text: "Delete contact"
onTriggered: phonebook.deleteContact(page.personUri)
}
]
}
/* contextualActions: [
Kirigami.Action {
iconName: "favorite"
text: "Select as favorite"
},
Kirigami.Action {
iconName: "document-share"
text: "Share"
},
Kirigami.Action {
iconName: "document-edit"
text: "Edit"
},
Kirigami.Action {
iconName: "edit-image-face-add"
text: "Choose photo"
},
Kirigami.Action {
iconName: "delete"
text: "Delete contact"
}
]*/
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment