summaryrefslogtreecommitdiff
path: root/raveos-hyprland-theme/theme-data/dms/Modals/FileBrowser/FileBrowserOverwriteDialog.qml
blob: a664be55a67c796cafaf4f6715816bf640372334 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
import QtQuick
import qs.Common
import qs.Widgets

Item {
    id: overwriteDialog

    property bool showDialog: false
    property string pendingFilePath: ""

    signal confirmed(string filePath)
    signal cancelled()

    visible: showDialog
    focus: showDialog

    Keys.onEscapePressed: {
        cancelled()
    }

    Keys.onReturnPressed: {
        confirmed(pendingFilePath)
    }

    Rectangle {
        anchors.fill: parent
        color: Theme.shadowStrong
        opacity: 0.8

        MouseArea {
            anchors.fill: parent
            onClicked: {
                cancelled()
            }
        }
    }

    StyledRect {
        anchors.centerIn: parent
        width: 400
        height: 160
        color: Theme.surfaceContainer
        radius: Theme.cornerRadius
        border.color: Theme.outlineMedium
        border.width: 1

        Column {
            anchors.centerIn: parent
            width: parent.width - Theme.spacingL * 2
            spacing: Theme.spacingM

            StyledText {
                text: I18n.tr("File Already Exists")
                font.pixelSize: Theme.fontSizeLarge
                font.weight: Font.Medium
                color: Theme.surfaceText
                anchors.horizontalCenter: parent.horizontalCenter
            }

            StyledText {
                text: I18n.tr("A file with this name already exists. Do you want to overwrite it?")
                font.pixelSize: Theme.fontSizeMedium
                color: Theme.surfaceTextMedium
                width: parent.width
                wrapMode: Text.WordWrap
                horizontalAlignment: Text.AlignHCenter
            }

            Row {
                anchors.horizontalCenter: parent.horizontalCenter
                spacing: Theme.spacingM

                StyledRect {
                    width: 80
                    height: 36
                    radius: Theme.cornerRadius
                    color: cancelArea.containsMouse ? Theme.surfaceVariantHover : Theme.surfaceVariant
                    border.color: Theme.outline
                    border.width: 1

                    StyledText {
                        anchors.centerIn: parent
                        text: I18n.tr("Cancel")
                        font.pixelSize: Theme.fontSizeMedium
                        color: Theme.surfaceText
                        font.weight: Font.Medium
                    }

                    MouseArea {
                        id: cancelArea
                        anchors.fill: parent
                        hoverEnabled: true
                        cursorShape: Qt.PointingHandCursor
                        onClicked: {
                            cancelled()
                        }
                    }
                }

                StyledRect {
                    width: 90
                    height: 36
                    radius: Theme.cornerRadius
                    color: overwriteArea.containsMouse ? Qt.darker(Theme.primary, 1.1) : Theme.primary

                    StyledText {
                        anchors.centerIn: parent
                        text: I18n.tr("Overwrite")
                        font.pixelSize: Theme.fontSizeMedium
                        color: Theme.background
                        font.weight: Font.Medium
                    }

                    MouseArea {
                        id: overwriteArea
                        anchors.fill: parent
                        hoverEnabled: true
                        cursorShape: Qt.PointingHandCursor
                        onClicked: {
                            confirmed(pendingFilePath)
                        }
                    }
                }
            }
        }
    }
}