Warning, /plasma/xdg-desktop-portal-kde/src/kirigami-filepicker/declarative/CreateDirectorySheet.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2020 Jonah BrĂ¼chert <jbb@kaidan.im>
0002 //
0003 // SPDX-License-Identifier: LGPL-2.0-or-later
0004 
0005 import QtQuick
0006 import QtQuick.Layouts
0007 import QtQuick.Controls as QQC2
0008 
0009 import org.kde.kirigami as Kirigami
0010 import org.kde.kirigamifilepicker
0011 
0012 Kirigami.OverlaySheet {
0013     id: sheet
0014 
0015     property string parentPath
0016 
0017     header: Kirigami.Heading {
0018         text: i18n("Create New Folder")
0019     }
0020 
0021     ColumnLayout {
0022         spacing: Kirigami.Units.smallSpacing
0023 
0024         QQC2.Label {
0025             Layout.fillWidth: true
0026 
0027             wrapMode: Text.WordWrap
0028             text: i18n("Create new folder in %1", sheet.parentPath.replace("file://", ""))
0029         }
0030 
0031         QQC2.TextField {
0032             id: nameField
0033             Layout.fillWidth: true
0034 
0035             placeholderText: i18n("Folder name")
0036         }
0037 
0038         RowLayout {
0039             spacing: Kirigami.Units.smallSpacing
0040             Layout.fillWidth: true
0041 
0042             QQC2.Button {
0043                 Layout.alignment: Qt.AlignLeft
0044                 Layout.fillWidth: true
0045 
0046                 text: i18n("OK")
0047 
0048                 onClicked: {
0049                     DirModelUtils.mkdir(parentPath + "/" + nameField.text)
0050                     sheet.close()
0051                 }
0052             }
0053             QQC2.Button {
0054                 Layout.alignment: Qt.AlignRight
0055                 Layout.fillWidth: true
0056 
0057                 text: i18n("Cancel")
0058 
0059                 onClicked: {
0060                     nameField.clear()
0061                     sheet.close()
0062                 }
0063             }
0064         }
0065     }
0066 }