DeleteCalendarSheet.qml 1.91 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// SPDX-FileCopyrightText: 2021 Claudio Cambra <claudio.cambra@gmail.com>
// SPDX-License-Identifier: LGPL-2.1-or-later

import QtQuick 2.15
import QtQuick.Controls 2.15 as QQC2
import QtQuick.Layouts 1.15
import org.kde.kirigami 2.15 as Kirigami
import org.kde.kalendar 1.0

Kirigami.Page {
    id: deleteSheet

    signal deleteCollection(int collectionId)
    signal cancel

    // For calendar deletion
    property int collectionId
    property var collectionDetails

    padding: Kirigami.Units.largeSpacing

    title: collectionId ? i18n("Delete calendar") : i18n("Delete")

24
25
26
27
28
29
30
31
32
    QQC2.Action {
        id: deleteAction
        enabled: collectionId !== undefined
        shortcut: "Return"
        onTriggered: {
            deleteCollection(deleteSheet.collectionId);
        }
    }

33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
    ColumnLayout {
        anchors.fill: parent

        RowLayout {
            Layout.fillWidth: true
            Layout.fillHeight: true

            Kirigami.Icon {
                Layout.fillHeight: true
                Layout.minimumHeight: Kirigami.Units.gridUnit * 3
                Layout.minimumWidth: height
                source: "dialog-warning"
            }

            QQC2.Label {
                Layout.fillWidth: true
                text: if(collectionDetails) i18n("Do you want to delete calendar: \"%1\"?", collectionDetails.displayName)
                wrapMode: Text.WordWrap
            }
        }


        RowLayout {
            Layout.fillWidth: true
            spacing: Kirigami.Units.smallSpacing

            Item {
                Layout.fillWidth: true
            }

            QQC2.Button {
                icon.name: "delete"
                text: i18n("Delete")
                onClicked: deleteCollection(deleteSheet.collectionId)
            }

            QQC2.Button {
                icon.name: "dialog-cancel"
                text: i18n("Cancel")
                onClicked: cancel()
            }
        }
    }
}