23import QtQuick.Controls
26import org.mauikit.controls as Maui
27import org.mauikit.filebrowsing as FB
106 maxHeight: Maui.Handy.isMobile ? parent.height * 0.95 : 500
112 closeButtonVisible: false
113 headBar.visible: false
119 property alias currentPath : _browser.currentPath
126 readonly property alias browser : _browser
133 readonly property alias selectionBar: _selectionBar
139 property alias singleSelection : _selectionBar.singleSelection
145 property string suggestedFileName : ""
150 property bool searchBar : false
151 onSearchBarChanged: if(!searchBar) _browser.quitSearch()
174 property int mode : FileDialog.Modes.Open
182 property var callback
187 readonly property alias textField: _textField
193 signal urlsSelected(var urls)
199 signal finished(var urls)
205 text: i18nd("mauikitfilebrowsing
", "Cancel
")
206 onTriggered: control.close()
211 text: control.mode === FileDialog.Modes.Save ? i18nd("mauikitfilebrowsing
", "Save
") : i18nd("mauikitfilebrowsing
", "Open
")
214 console.log("CURRENT PATHb
", _browser.currentPath+"/
"+textField.text)
215 if(control.mode === FileDialog.Modes.Save && textField.text.length === 0)
218 if(control.mode === FileDialog.Modes.Save && FB.FM.fileExists(_browser.currentPath+"/
"+textField.text))
220 _confirmationDialog.open()
233 visible: control.mode === FileDialog.Modes.Save
235 position: ToolBar.Footer
237 middleContent: TextField
240 Layout.fillWidth: true
241 placeholderText: i18nd("mauikitfilebrowsing
", "File name...
")
242 text: suggestedFileName
249 id: _confirmationDialog
251 title: i18nd("mauikitfilebrowsing
", "Error
")
252 message: i18nd("mauikitfilebrowsing
", "A file named
'%1' already exists!\n This action will overwrite
'%1'. Are you sure you want to
do this?
", control.textField.text)
253 template.iconSource: "dialog-warning
"
255 standardButtons: Dialog.Ok | Dialog.Cancel
257 onAccepted: control.done()
261 stack: Maui.SideBarView
265 Layout.fillHeight: true
266 Layout.fillWidth: true
268 sideBar.preferredWidth: 200
269 sideBar.minimumWidth: 200
270 sideBarContent: Loader
276 sourceComponent: FB.PlacesListBrowser
278 onPlaceClicked: (path) =>
280 //pageRow.currentIndex = 1
281 _browser.openFolder(path)
284 currentPath: _browser.currentPath
287 FB.FMList.BOOKMARKS_PATH,
288 FB.FMList.REMOTE_PATH,
289 FB.FMList.CLOUD_PATH,
290 FB.FMList.DRIVES_PATH]
300 flickable: _browser.flickable
301 headBar.visible: true
302 headerColorSet: Maui.Theme.Header
303 headBar.farLeftContent: ToolButton
305 icon.name: pageRow.sideBar.visible ? "sidebar-collapse
" : "sidebar-expand
"
306 onClicked: pageRow.sideBar.toggle()
307 checked: pageRow.sideBar.visible
309 ToolTip.timeout: 5000
310 ToolTip.visible: hovered
311 ToolTip.text: i18nd("mauikitfilebrowsing
", "Toogle
SideBar")
314 headBar.rightContent:[
319 icon.name: "edit-find
"
320 onClicked: browser.toggleSearchBar()
321 checked: browser.headBar.visible
327 sourceComponent: Maui.ToolButtonMenu
329 icon.name: browser.settings.viewType === FB.FMList.LIST_VIEW ? "view-list-details
" : "view-list-icons
"
331 Maui.MenuItemActionRow
335 icon.name: "view-hidden
"
336 // text: i18nd("mauikitfilebrowsing
", "Hidden Files
")
338 checked: browser.settings.showHiddenFiles
339 onTriggered: browser.settings.showHiddenFiles = !browser.settings.showHiddenFiles
344 icon.name: "folder-
new"
345 onTriggered: browser.newItem()
353 text: i18nd("mauikitfilebrowsing
", "View type
")
358 text: i18nd("mauikitfilebrowsing
", "List
")
359 icon.name: "view-list-details
"
360 checked: browser.settings.viewType === FB.FMList.LIST_VIEW
366 browser.settings.viewType = FB.FMList.LIST_VIEW
373 text: i18nd("mauikitfilebrowsing
", "Grid
")
374 icon.name: "view-list-icons
"
375 checked: browser.settings.viewType === FB.FMList.ICON_VIEW
382 browser.settings.viewType = FB.FMList.ICON_VIEW
393 text: i18nd("mauikitfilebrowsing
", "Sort by
")
398 text: i18nd("mauikitfilebrowsing
", "Type
")
399 checked: browser.settings.sortBy === FB.FMList.MIME
404 browser.settings.sortBy = FB.FMList.MIME
410 text: i18nd("mauikitfilebrowsing
", "Date
")
411 checked: browser.settings.sortBy === FB.FMList.DATE
416 browser.settings.sortBy = FB.FMList.DATE
422 text: i18nd("mauikitfilebrowsing
", "Modified
")
423 checked: browser.settings.sortBy === FB.FMList.MODIFIED
428 browser.settings.sortBy = FB.FMList.MODIFIED
434 text: i18nd("mauikitfilebrowsing
", "Size
")
435 checked: browser.settings.sortBy === FB.FMList.SIZE
440 browser.settings.sortBy = FB.FMList.SIZE
446 text: i18nd("mauikitfilebrowsing
", "Name
")
447 checked: browser.settings.sortBy === FB.FMList.LABEL
452 browser.settings.sortBy = FB.FMList.LABEL
460 text: i18nd("mauikitfilebrowsing
", "Show Folders First
")
461 checked: browser.settings.foldersFirst
466 browser.settings.foldersFirst = !browser.settings.foldersFirst
473 text: i18nd("mauikitfilebrowsing
", "Group
")
475 checked: browser.settings.group
478 browser.settings.group = !browser.settings.group
485 headBar.leftContent: Loader
488 sourceComponent: Maui.ToolActions
496 icon.name: "go-previous
"
497 onTriggered : browser.goBack()
503 onTriggered : browser.goUp()
509 onTriggered: browser.goNext()
514 footer: Maui.SelectionBar
518 anchors.horizontalCenter: parent.horizontalCenter
519 width: Math.min(parent.width-(Maui.Style.space.medium*2), implicitWidth)
520 maxListHeight: control.height - (Maui.Style.contentMargins*2)
522 listDelegate: Maui.ListBrowserDelegate
524 width: ListView.view.width
525 iconSource: model.icon
526 imageSource: model.thumbnail
527 label1.text: model.label
528 label2.text: model.url
533 _selectionBar.clear()
542 selectionBar: _selectionBar
543 settings.viewType: FB.FMList.LIST_VIEW
544 currentPath: FB.FM.homePath()
545 selectionMode: control.mode === FileDialog.Modes.Open
546 onItemClicked: (index) =>
548 if(Maui.Handy.singleClick)
554 onItemDoubleClicked: (index) =>
556 if(!Maui.Handy.singleClick)
562 function performAction(index)
564 if(currentFMModel.get(index).isdir == "true")
571 case FileDialog.Modes.Open :
572 addToSelection(currentFMModel.get(index))
575 case FileDialog.Modes.Save:
576 textField.text = currentFMModel.get(index).label
586 _selectionBar.clear()
594 var paths = _browser.selectionBar && _browser.selectionBar.visible ? _browser.selectionBar.uris : [_browser.currentPath]
596 if(control.mode === FileDialog.Modes.Save)
600 paths[i] = paths[i] + "/
" + textField.text
603 // _tagsBar.list.urls = paths
604 // _tagsBar.list.updateToUrls(_tagsBar.getTags())
607 control.finished(paths)
609 // if(control.mode === modes.SAVE) //do it after finished in cas ethe files need to be saved aka exists, before tryign to insert tags
611 // _tagsBar.list.urls = paths
612 // _tagsBar.list.updateToUrls(_tagsBar.getTags())
617 control.callback(paths)
620 control.urlsSelected(paths)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Oct 11 2024 12:11:22 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.