mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-08-12 09:10:39 +00:00
NInputButton.qml: new input+button widget FileManagerService.qml: singleton service for file/folder dialogs NFileManager.qml: create first iteration of filemanager WallpaperTab.qml: integrate NInputButton ScreenRecorderTab.qml: integrate NInputButton GeneralTab.qml: integrate NInputButton
37 lines
1.3 KiB
QML
37 lines
1.3 KiB
QML
pragma Singleton
|
|
|
|
import QtQuick
|
|
import Quickshell
|
|
|
|
QtObject {
|
|
id: root
|
|
|
|
// Function to open a file manager dialog
|
|
function open(options) {
|
|
var component = Qt.createComponent(Qt.resolvedUrl(Quickshell.shellDir + "/Widgets/NFileManager.qml"))
|
|
if (component.status === Component.Ready) {
|
|
var dialog = component.createObject(options.parent || Overlay.overlay, {
|
|
"title": options.title || "Select File/Folder",
|
|
"initialPath": options.initialPath || Quickshell.env("HOME"),
|
|
"selectFiles": options.selectFiles || false,
|
|
"selectFolders": !options.selectFiles || false,
|
|
"scaling": options.scaling || 1.0
|
|
})
|
|
if (dialog) {
|
|
if (options.onSelected) {
|
|
if (options.selectFiles) {
|
|
dialog.fileSelected.connect(options.onSelected)
|
|
} else {
|
|
dialog.folderSelected.connect(options.onSelected)
|
|
}
|
|
}
|
|
dialog.open()
|
|
return dialog
|
|
}
|
|
} else {
|
|
console.error("Component error:", component.errorString())
|
|
}
|
|
return null
|
|
}
|
|
}
|