Warning, /maui/mauikit-filebrowsing/src/controls.6/PlacesListBrowser.qml is written in an unsupported language. File is not indexed.
0001 import QtQuick 0002 import QtQuick.Controls 0003 import QtQuick.Layouts 0004 0005 import org.mauikit.controls 1.3 as Maui 0006 import org.mauikit.filebrowsing 1.3 as FB 0007 0008 /** 0009 * @inherit org::mauikit::controls::ListBrowser 0010 * @brief A browsing list of the system locations, such as common standard places, bookmarks and others as removable devices and networks. 0011 * 0012 * This control inherits from MauiKit ListBrowser, to checkout its inherited properties refer to docs. 0013 * 0014 * Most of the properties to control the behaviour is handled via the PlacesList model, which is exposed via the `list` property. 0015 * @see list 0016 * 0017 * @image html placeslistbrowser.png 0018 * 0019 * @code 0020 * Maui.SideBarView 0021 * { 0022 * anchors.fill: parent 0023 * 0024 * sideBar.content: Pane 0025 * { 0026 * Maui.Theme.colorSet: Maui.Theme.Window 0027 * anchors.fill: parent 0028 * FB.PlacesListBrowser 0029 * { 0030 * anchors.fill: parent 0031 * } 0032 * } 0033 * 0034 * Maui.Page 0035 * { 0036 * Maui.Controls.showCSD: true 0037 * anchors.fill: parent 0038 * } 0039 * } 0040 * @endcode 0041 * 0042 * <a href="https://invent.kde.org/maui/mauikit-filebrowser/examples/PlacesListBrowser.qml">You can find a more complete example at this link.</a> 0043 */ 0044 Maui.ListBrowser 0045 { 0046 id: control 0047 0048 /** 0049 * @brief The model list of the places. 0050 * @property PlacesList PlacesListBrowser::list 0051 */ 0052 readonly property alias list : placesList 0053 0054 /** 0055 * @brief The contextual menu for the entries. 0056 * @note The menu has an extra property `index`, which refers to the index position of the entry where the menu was invoked at. 0057 * 0058 * To add more entries, use the `itemMenu.data` property, or append/push methods. 0059 * @property Menu PlacesListBrowser::itemMenu 0060 */ 0061 readonly property alias itemMenu : _menu 0062 0063 /** 0064 * @brief The preferred size of the icon for the places delegates. 0065 * By default this is set to `Style.iconSizes.small` 0066 * @see Style::iconSizes 0067 */ 0068 property int iconSize : Maui.Style.iconSizes.small 0069 0070 /** 0071 * @brief The path of the current place selected. 0072 */ 0073 property string currentPath 0074 0075 /** 0076 * @brief Emitted when a entry has been clicked. 0077 * @param path the URL path of the entry 0078 */ 0079 signal placeClicked (string path) 0080 0081 Maui.Theme.colorSet: Maui.Theme.View 0082 Maui.Theme.inherit: false 0083 0084 focus: true 0085 model: Maui.BaseModel 0086 { 0087 list: FB.PlacesList 0088 { 0089 id: placesList 0090 groups: [ 0091 FB.FMList.BOOKMARKS_PATH, 0092 FB.FMList.DRIVES_PATH] 0093 } 0094 } 0095 0096 currentIndex: placesList.indexOfPath(control.currentPath) 0097 0098 section.property: "type" 0099 section.criteria: ViewSection.FullString 0100 section.delegate: Maui.LabelDelegate 0101 { 0102 id: delegate 0103 text: section 0104 0105 isSection: true 0106 width: parent.width 0107 height: Maui.Style.toolBarHeightAlt 0108 } 0109 0110 Maui.ContextualMenu 0111 { 0112 id: _menu 0113 property int index 0114 0115 MenuItem 0116 { 0117 text: i18nd("mauikitfilebrowsing", "Edit") 0118 } 0119 0120 MenuItem 0121 { 0122 text: i18nd("mauikitfilebrowsing", "Hide") 0123 } 0124 0125 MenuItem 0126 { 0127 text: i18nd("mauikitfilebrowsing", "Remove") 0128 Maui.Theme.textColor: Maui.Theme.negativeTextColor 0129 onTriggered: list.removePlace(control.currentIndex) 0130 } 0131 } 0132 0133 flickable.header: GridLayout 0134 { 0135 id: _quickSection 0136 0137 width: Math.min(parent.width, 180) 0138 rows: 3 0139 columns: 3 0140 columnSpacing: Maui.Style.space.small 0141 rowSpacing: Maui.Style.space.small 0142 0143 Repeater 0144 { 0145 model: Maui.BaseModel 0146 { 0147 list: FB.PlacesList 0148 { 0149 id: _quickPacesList 0150 groups: [FB.FMList.QUICK_PATH, FB.FMList.PLACES_PATH] 0151 } 0152 } 0153 0154 delegate: Maui.GridBrowserDelegate 0155 { 0156 Layout.preferredHeight: Math.min(50, width) 0157 Layout.preferredWidth: 50 0158 Layout.fillWidth: true 0159 Layout.fillHeight: true 0160 flat: false 0161 isCurrentItem: control.currentPath === model.path 0162 iconSource: model.icon + (Qt.platform.os == "android" || Qt.platform.os == "osx" ? ("-sidebar") : "") 0163 iconSizeHint: Maui.Style.iconSize 0164 template.isMask: true 0165 label1.text: model.label 0166 labelsVisible: false 0167 tooltipText: model.label 0168 onClicked: 0169 { 0170 placeClicked(model.path) 0171 } 0172 } 0173 } 0174 } 0175 0176 delegate: Maui.ListDelegate 0177 { 0178 width: ListView.view.width 0179 iconSize: control.iconSize 0180 labelVisible: true 0181 iconVisible: true 0182 label: model.label 0183 iconName: model.icon 0184 0185 onClicked: 0186 { 0187 placeClicked(model.path) 0188 } 0189 0190 onRightClicked: 0191 { 0192 _menu.index = index 0193 _menu.popup() 0194 } 0195 0196 onPressAndHold: 0197 { 0198 _menu.index = index 0199 _menu.popup() 0200 } 0201 } 0202 }