6import QtQuick.Controls as QQC2
8import org.kde.kirigami 2.20 as Kirigami
9import org.kde.kidentitymanagement 1.0
10import org.kde.kirigamiaddons.formcard 1.0 as FormCard
12FormCard.FormCardPage {
15 property alias mode: backend.mode
16 property alias identityUoid: backend.identityUoid
18 required property bool allowDelete
19 required property string identityName
20 required property var cryptographyEditorBackend
21 onCryptographyEditorBackendChanged: cryptographyEditorBackend.identity = identity
23 readonly property IdentityEditorBackend backend: IdentityEditorBackend {
25 mode: IdentityEditorBackend.CreateMode
27 readonly property var identity: backend.identity
28 onIdentityChanged: cryptographyEditorBackend.identity = identity
30 readonly property QQC2.Action submitAction: QQC2.Action {
32 enabled: !root.identity.isNull
35 root.backend.saveIdentity(root.identity);
40 title:
if (mode === IdentityEditorBackend.CreateMode) {
41 return i18n(
"Add Identity");
43 return i18n(
"Edit Identity");
46 header: QQC2.Control {
49 property bool displayError:
false
52 padding: contentItem.visible ?
Kirigami.Units.smallSpacing : 0
56 bottomPadding: padding
57 contentItem:
Kirigami.InlineMessage {
59 visible: errorContainer.displayError
60 text: errorContainer.errorMessage
65 BasicIdentityEditorCard {
66 identity: root.identity
70 visible: root.cryptographyEditorBackend.validBackend
71 title:
i18ndc(
"libkpimidentities6",
"@title:group",
"Cryptography")
75 Layout.fillWidth:
true
76 active: root.cryptographyEditorBackend.validBackend
77 sourceComponent: CryptographyEditorCard {
78 identity: root.identity
79 cryptographyEditorBackend: root.cryptographyEditorBackend
83 footer: ColumnLayout {
87 Layout.fillWidth:
true
90 QQC2.DialogButtonBox {
91 Layout.fillWidth:
true
93 standardButtons: QQC2.DialogButtonBox.Cancel
98 visible: root.mode === IdentityEditorBackend.EditMode
99 enabled: root.allowDelete
100 QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.DestructiveRole
104 icon.name: root.mode === IdentityEditorBackend.EditMode ?
"document-save" :
"list-add"
105 text: root.mode === IdentityEditorBackend.EditMode ?
i18n(
"Save") :
i18n(
"Add")
106 QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.AcceptRole
109 onRejected: root.closeDialog()
110 onAccepted: submitAction.trigger();
112 dialogLoader.active =
true;
113 dialogLoader.item.open();
118 sourceComponent:
Kirigami.PromptDialog {
120 title:
i18n(
"Delete %1", root.identityName)
121 subtitle: i18n("Are you sure you want to delete this identity?")
124 customFooterActions: [
129 IdentityUtils.removeIdentity(root.identity.identityName);
136 icon.name: "dialog-cancel"
137 onTriggered: dialog.close()
QString i18ndc(const char *domain, const char *context, const char *text, const TYPE &arg...)
QString i18n(const char *text, const TYPE &arg...)
Type type(const QSqlDatabase &db)
KCALUTILS_EXPORT QString errorMessage(const KCalendarCore::Exception &exception)