Warning, /maui/pix/src/widgets/Sidebar.qml is written in an unsupported language. File is not indexed.
0001 // Copyright 2018-2020 Camilo Higuita <milo.h@aol.com>
0002 // Copyright 2018-2020 Nitrux Latinoamericana S.C.
0003 //
0004 // SPDX-License-Identifier: GPL-3.0-or-later
0005
0006
0007 import QtQuick 2.14
0008 import QtQml 2.14
0009
0010 import QtQuick.Controls 2.14
0011 import QtQuick.Layouts 1.12
0012
0013 import org.mauikit.controls 1.3 as Maui
0014 import org.mauikit.filebrowsing 1.0 as FB
0015
0016 import org.maui.pix 1.0 as Pix
0017
0018 Loader
0019 {
0020 id: control
0021 asynchronous: true
0022 active: (control.enabled && control.visible) || item
0023
0024 readonly property alias list : placesList
0025
0026 Pix.PlacesList
0027 {
0028 id: placesList
0029 }
0030
0031 sourceComponent: Maui.ListBrowser
0032 {
0033 id: _listBrowser
0034 topPadding: 0
0035 bottomPadding: 0
0036 verticalScrollBarPolicy: ScrollBar.AlwaysOff
0037
0038 signal placeClicked (string path, string filters, var mouse)
0039
0040 holder.visible: count === 0
0041 holder.title: i18n("Bookmarks!")
0042 holder.body: i18n("Your bookmarks will be listed here")
0043
0044 onPlaceClicked: (path, filters, mouse) =>
0045 {
0046 root.openFolder(path, filters.split(","))
0047
0048 if(sideBar.collapsed)
0049 sideBar.close()
0050 }
0051
0052
0053 flickable.topMargin: Maui.Style.contentMargins
0054 flickable.bottomMargin: Maui.Style.contentMargins
0055 flickable.header: Loader
0056 {
0057 asynchronous: true
0058 width: parent.width
0059 visible: active
0060
0061 sourceComponent: Item
0062 {
0063 implicitHeight: _quickSection.implicitHeight
0064
0065 GridLayout
0066 {
0067 id: _quickSection
0068 width: Math.min(parent.width, 180)
0069 anchors.centerIn: parent
0070 rows: 3
0071 columns: 3
0072 columnSpacing: Maui.Style.space.small
0073 rowSpacing: Maui.Style.space.small
0074
0075 Repeater
0076 {
0077 model: placesList.quickPlaces
0078
0079 delegate: Maui.GridBrowserDelegate
0080 {
0081 Layout.preferredHeight: Math.min(50, width)
0082 Layout.preferredWidth: 50
0083 Layout.fillWidth: true
0084 Layout.fillHeight: true
0085 Layout.columnSpan: modelData.path === "tags:///fav" ? 2 : (modelData.path === "collection:///" ? 3 : 1)
0086
0087
0088 isCurrentItem: currentFolder === modelData.path
0089 iconSource: modelData.icon + (Qt.platform.os == "android" || Qt.platform.os == "osx" ? ("-sidebar") : "")
0090 iconSizeHint: Maui.Style.iconSize
0091 template.isMask: true
0092 label1.text: modelData.label
0093 labelsVisible: false
0094 tooltipText: modelData.label
0095 flat: false
0096
0097 onClicked:
0098 {
0099 _listBrowser.placeClicked(modelData.path, modelData.filters, mouse)
0100 if(sideBar.collapsed)
0101 sideBar.close()
0102 }
0103 }
0104
0105 }
0106 }
0107 }
0108 }
0109
0110 model: Maui.BaseModel
0111 {
0112 id: placesModel
0113 list: placesList
0114 }
0115
0116 Component.onCompleted:
0117 {
0118 _listBrowser.flickable.positionViewAtBeginning()
0119 }
0120
0121 delegate: Maui.ListDelegate
0122 {
0123 isCurrentItem: currentFolder === model.path
0124 width: ListView.view.width
0125
0126 iconSize: Maui.Style.iconSize
0127 label: model.name
0128 iconName: model.icon + (Qt.platform.os == "android" || Qt.platform.os == "osx" ? ("-sidebar") : "")
0129 iconVisible: true
0130 template.isMask: iconSize <= Maui.Style.iconSizes.medium
0131
0132 onClicked:
0133 {
0134 _listBrowser.placeClicked(model.path, model.key, mouse)
0135 if(sideBar.collapsed)
0136 sideBar.close()
0137 }
0138 }
0139
0140 section.property: "type"
0141 section.criteria: ViewSection.FullString
0142 section.delegate: Maui.LabelDelegate
0143 {
0144 width: ListView.view.width
0145 label: section
0146 isSection: true
0147 }
0148 }
0149 }
0150
0151