Warning, /plasma/kwin/src/kcms/rules/ui/FileDialogLoader.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2020 Ismael Asensio <isma.af@gmail.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 0007 import QtCore 0008 import QtQuick 0009 import QtQuick.Dialogs as QtDialogs 0010 0011 Loader { 0012 id: root 0013 active: false 0014 0015 property string title : i18n("Select File"); 0016 property string lastFolder : "" 0017 property bool isSaveDialog : false 0018 0019 signal fileSelected(string path) 0020 0021 sourceComponent: QtDialogs.FileDialog { 0022 id: fileDialog 0023 0024 title: root.title 0025 fileMode: root.isSaveDialog ? QtDialogs.FileDialog.SaveFile : QtDialogs.FileDialog.OpenFile 0026 currentFolder: root.lastFolder || StandardPaths.standardLocations(StandardPaths.HomeLocation)[0] 0027 nameFilters: [ i18n("KWin Rules (*.kwinrule)") ] 0028 defaultSuffix: "*.kwinrule" 0029 0030 Component.onCompleted: { 0031 open(); 0032 } 0033 0034 onAccepted: { 0035 root.lastFolder = currentFolder; 0036 if (selectedFile != "") { 0037 root.fileSelected(selectedFile); 0038 } 0039 root.active = false; 0040 } 0041 0042 onRejected: { 0043 root.active = false; 0044 } 0045 } 0046 }