Verified Commit 85a960d9 authored by Jonah Brüchert's avatar Jonah Brüchert 🌳

Enable deleting contacts

parent 30ad5eb4
......@@ -29,7 +29,7 @@ include(KDECompilerSettings NO_POLICY_SCOPE)
################# Find dependencies #################
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Core Quick Test Gui Svg QuickControls2)
find_package(KF5 COMPONENTS Kirigami2 Contacts ${KF5_MIN_VERSION})
find_package(KF5 REQUIRED COMPONENTS Kirigami2 Contacts)
################# Enable C++11 features for clang and gcc #################
......
......@@ -36,17 +36,24 @@ Kirigami.SwipeListItem {
actions: [
Kirigami.Action {
iconName: "mail-message"
icon.name: "mail-message"
onTriggered: {
personActions.triggerAction(KPeople.TextChatAction)
}
},
Kirigami.Action {
iconName: "call-start"
icon.name: "call-start"
onTriggered: {
personActions.triggerAction(KPeople.AudioCallAction)
}
},
Kirigami.Action {
icon.name: "list-remove"
onTriggered: {
phonebook.deleteContact(personUri)
}
}
]
RowLayout {
......
......@@ -51,10 +51,6 @@ Kirigami.ScrollablePage {
onEditClicked: form.open();
}
FormPage {
id: form
}
actions {
left: Kirigami.Action {
iconName: "mail-message"
......
......@@ -74,19 +74,13 @@ ColumnLayout {
Kirigami.FormData.label: "Lastname:"
id: lastname
}
Kirigami.Separator {
Kirigami.FormData.isSection: true
Kirigami.FormData.label: "Phone"
}
TextField {
id: phoneNumber
}
Kirigami.Separator {
Kirigami.FormData.isSection: true
Kirigami.FormData.label: "Email"
Kirigami.FormData.label: "Phone"
}
TextField {
id: email
Kirigami.FormData.label: "Email"
}
Kirigami.Separator {
Kirigami.FormData.isSection: true
......
......@@ -64,3 +64,8 @@ void PhoneBook::addContact(QString name, QString tel, QString email)
file.write(vcard.data(), vcard.length());
file.close();
}
void PhoneBook::deleteContact(QString personUri)
{
QFile::remove(personUri.replace("vcard:/", ""));
}
......@@ -33,6 +33,7 @@ signals:
public slots:
void addContact(QString name, QString tel, QString email);
void deleteContact(QString personUri);
};
#endif // PHONEBOOK_H
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