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
")
212 Maui.Controls.status: Maui.Controls.Positive
215 console.log("CURRENT PATHb
", _browser.currentPath+"/
"+textField.text)
216 if(control.mode === FileDialog.Modes.Save && textField.text.length === 0)
219 if(control.mode === FileDialog.Modes.Save && FB.FM.fileExists(_browser.currentPath+"/
"+textField.text))
221 _confirmationDialog.open()
234 visible: control.mode === FileDialog.Modes.Save
236 position: ToolBar.Footer
238 middleContent: TextField
241 Layout.fillWidth: true
242 placeholderText: i18nd("mauikitfilebrowsing
", "File name...
")
243 text: suggestedFileName
250 id: _confirmationDialog
252 title: i18nd("mauikitfilebrowsing
", "Error
")
253 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)
254 template.iconSource: "dialog-warning
"
256 standardButtons: Dialog.Ok | Dialog.Cancel
258 onAccepted: control.done()
262 stack: Maui.SideBarView
266 Layout.fillHeight: true
267 Layout.fillWidth: true
269 sideBar.preferredWidth: 200
270 sideBar.minimumWidth: 200
271 sideBarContent: Loader
277 sourceComponent: FB.PlacesListBrowser
279 onPlaceClicked: (path) =>
281 //pageRow.currentIndex = 1
282 _browser.openFolder(path)
285 currentPath: _browser.currentPath
288 FB.FMList.BOOKMARKS_PATH,
289 FB.FMList.REMOTE_PATH,
290 FB.FMList.CLOUD_PATH,
291 FB.FMList.DRIVES_PATH]
301 flickable: _browser.flickable
302 headBar.visible: true
303 headerColorSet: Maui.Theme.Header
304 headBar.farLeftContent: ToolButton
306 icon.name: pageRow.sideBar.visible ? "sidebar-collapse
" : "sidebar-expand
"
307 onClicked: pageRow.sideBar.toggle()
308 checked: pageRow.sideBar.visible
310 ToolTip.timeout: 5000
311 ToolTip.visible: hovered
312 ToolTip.text: i18nd("mauikitfilebrowsing
", "Toogle
SideBar")
315 headBar.rightContent:[
320 icon.name: "edit-find
"
321 onClicked: browser.toggleSearchBar()
322 checked: browser.headBar.visible
328 sourceComponent: Maui.ToolButtonMenu
330 icon.name: browser.settings.viewType === FB.FMList.LIST_VIEW ? "view-list-details
" : "view-list-icons
"
332 Maui.MenuItemActionRow
336 icon.name: "view-hidden
"
337 // text: i18nd("mauikitfilebrowsing
", "Hidden Files
")
339 checked: browser.settings.showHiddenFiles
340 onTriggered: browser.settings.showHiddenFiles = !browser.settings.showHiddenFiles
345 icon.name: "folder-
new"
346 onTriggered: browser.newItem()
354 text: i18nd("mauikitfilebrowsing
", "View type
")
359 text: i18nd("mauikitfilebrowsing
", "List
")
360 icon.name: "view-list-details
"
361 checked: browser.settings.viewType === FB.FMList.LIST_VIEW
367 browser.settings.viewType = FB.FMList.LIST_VIEW
374 text: i18nd("mauikitfilebrowsing
", "Grid
")
375 icon.name: "view-list-icons
"
376 checked: browser.settings.viewType === FB.FMList.ICON_VIEW
383 browser.settings.viewType = FB.FMList.ICON_VIEW
394 text: i18nd("mauikitfilebrowsing
", "Sort by
")
399 text: i18nd("mauikitfilebrowsing
", "Type
")
400 checked: browser.settings.sortBy === FB.FMList.MIME
405 browser.settings.sortBy = FB.FMList.MIME
411 text: i18nd("mauikitfilebrowsing
", "Date
")
412 checked: browser.settings.sortBy === FB.FMList.DATE
417 browser.settings.sortBy = FB.FMList.DATE
423 text: i18nd("mauikitfilebrowsing
", "Modified
")
424 checked: browser.settings.sortBy === FB.FMList.MODIFIED
429 browser.settings.sortBy = FB.FMList.MODIFIED
435 text: i18nd("mauikitfilebrowsing
", "Size
")
436 checked: browser.settings.sortBy === FB.FMList.SIZE
441 browser.settings.sortBy = FB.FMList.SIZE
447 text: i18nd("mauikitfilebrowsing
", "Name
")
448 checked: browser.settings.sortBy === FB.FMList.LABEL
453 browser.settings.sortBy = FB.FMList.LABEL
461 text: i18nd("mauikitfilebrowsing
", "Show Folders First
")
462 checked: browser.settings.foldersFirst
467 browser.settings.foldersFirst = !browser.settings.foldersFirst
474 text: i18nd("mauikitfilebrowsing
", "Group
")
476 checked: browser.settings.group
479 browser.settings.group = !browser.settings.group
486 headBar.leftContent: Loader
489 sourceComponent: Maui.ToolActions
497 icon.name: "go-previous
"
498 onTriggered : browser.goBack()
504 onTriggered : browser.goUp()
510 onTriggered: browser.goNext()
515 footer: Maui.SelectionBar
519 anchors.horizontalCenter: parent.horizontalCenter
520 width: Math.min(parent.width-(Maui.Style.space.medium*2), implicitWidth)
521 maxListHeight: control.height - (Maui.Style.contentMargins*2)
523 listDelegate: Maui.ListBrowserDelegate
525 width: ListView.view.width
526 iconSource: model.icon
527 imageSource: model.thumbnail
528 label1.text: model.label
529 label2.text: model.url
534 _selectionBar.clear()
543 selectionBar: _selectionBar
544 settings.viewType: FB.FMList.LIST_VIEW
545 currentPath: FB.FM.homePath()
546 selectionMode: control.mode === FileDialog.Modes.Open
547 onItemClicked: (index) =>
549 if(Maui.Handy.singleClick)
555 onItemDoubleClicked: (index) =>
557 if(!Maui.Handy.singleClick)
563 function performAction(index)
565 if(currentFMModel.get(index).isdir == "true")
572 case FileDialog.Modes.Open :
573 addToSelection(currentFMModel.get(index))
576 case FileDialog.Modes.Save:
577 textField.text = currentFMModel.get(index).label
587 _selectionBar.clear()
595 var paths = _browser.selectionBar && _browser.selectionBar.visible ? _browser.selectionBar.uris : [_browser.currentPath]
597 if(control.mode === FileDialog.Modes.Save)
601 paths[i] = paths[i] + "/
" + textField.text
604 // _tagsBar.list.urls = paths
605 // _tagsBar.list.updateToUrls(_tagsBar.getTags())
608 control.finished(paths)
610 // if(control.mode === modes.SAVE) //do it after finished in cas ethe files need to be saved aka exists, before tryign to insert tags
612 // _tagsBar.list.urls = paths
613 // _tagsBar.list.updateToUrls(_tagsBar.getTags())
618 control.callback(paths)
621 control.urlsSelected(paths)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:32:33 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.