Warning, /pim/merkuro/src/contacts/qml/private/DeleteContactAction.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-FileCopyrightText: 2022 Carl Schwan <carl@carlschwan.eu> 0002 // SPDX-License-Identifier: LGPL-3.0-or-later 0003 0004 import QtQuick 0005 import QtQuick.Controls as QQC2 0006 import QtQuick.Layouts 0007 import org.kde.kirigami as Kirigami 0008 import org.kde.kirigamiaddons.components as Components 0009 import org.kde.merkuro.contact 0010 0011 Kirigami.Action { 0012 property string name 0013 property var item 0014 0015 readonly property Component deleteContactConfirmationDialogComponent: Component { 0016 id: deleteContactConfirmationDialogComponent 0017 QQC2.Dialog { 0018 id: deleteContactConfirmationDialog 0019 visible: false 0020 title: i18nc("@title:window", "Warning") 0021 modal: true 0022 focus: true 0023 x: Math.round((parent.width - width) / 2) 0024 y: Math.round(parent.height / 3) 0025 width: Math.min(parent.width - Kirigami.Units.gridUnit * 4, Kirigami.Units.gridUnit * 30) 0026 0027 background: Components.DialogRoundedBackground {} 0028 0029 contentItem: RowLayout { 0030 ColumnLayout { 0031 Layout.fillWidth: true 0032 0033 Kirigami.Heading { 0034 level: 4 0035 text: i18n("Do you really want to delete your contact: \"%1\"?", name.trim().length > 0 ? name : i18nc("Placeholder when no name is set", "No name")) 0036 wrapMode: Text.WordWrap 0037 Layout.fillWidth: true 0038 } 0039 QQC2.Label { 0040 text: i18n("You won't be able to revert this action") 0041 wrapMode: Text.WordWrap 0042 Layout.fillWidth: true 0043 } 0044 } 0045 0046 Kirigami.Icon { 0047 source: "data-warning" 0048 Layout.preferredWidth: Kirigami.Units.iconSizes.huge 0049 Layout.preferredHeight: Kirigami.Units.iconSizes.huge 0050 } 0051 } 0052 0053 onRejected: deleteContactConfirmationDialog.close() 0054 onAccepted: { 0055 ContactManager.deleteItem(item) 0056 if (applicationWindow().pageStack.depth > 1) { 0057 applicationWindow().pageStack.pop() 0058 } 0059 deleteContactConfirmationDialog.close(); 0060 } 0061 0062 footer: QQC2.DialogButtonBox { 0063 QQC2.Button { 0064 text: i18n("Cancel") 0065 QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.RejectRole 0066 } 0067 QQC2.Button { 0068 text: i18n("Delete contact") 0069 QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.AcceptRole 0070 } 0071 } 0072 } 0073 } 0074 0075 icon.name: "delete" 0076 text: i18nc("@action:inmenu", "Delete contact") 0077 onTriggered: { 0078 const dialog = deleteContactConfirmationDialogComponent.createObject(applicationWindow()) 0079 dialog.open() 0080 } 0081 }