Warning, /plasma/xdg-desktop-portal-kde/src/kirigami-filepicker/declarative/PlacesGlobalDrawer.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2020 Linus Jahn <lnj@kaidan.im>
0002 //
0003 // SPDX-License-Identifier: LGPL-2.0-or-later
0004 
0005 import QtQuick
0006 import QtQuick.Controls as QQC2
0007 import QtQuick.Layouts
0008 import org.kde.kirigami as Kirigami
0009 import org.kde.kirigamifilepicker
0010 
0011 /**
0012  * The PlacesGlobalDrawer type provides a GlobalDrawer containing common places on the file system
0013  */
0014 Kirigami.OverlayDrawer {
0015     id: root
0016 
0017     signal placeOpenRequested(url place)
0018 
0019     handleClosedIcon.source: null
0020     handleOpenIcon.source: null
0021     width: Math.min(applicationWindow().width * 0.8, Kirigami.Units.gridUnit * 20)
0022 
0023     leftPadding: 0
0024     rightPadding: 0
0025 
0026     contentItem: ListView {
0027         spacing: 0
0028         model: FilePlacesModel {
0029             id: filePlacesModel
0030         }
0031 
0032         section.property: "group"
0033         section.delegate: Kirigami.Heading {
0034             leftPadding: Kirigami.Units.smallSpacing
0035             level: 6
0036             text: section
0037         }
0038 
0039         delegate: QQC2.ItemDelegate {
0040             required property string displayRole
0041             required property string iconName
0042             required property bool hidden
0043             required property url url
0044 
0045             visible: !hidden
0046             width: ListView.view.width
0047             text: displayRole
0048             icon.name: iconName
0049             onClicked: {
0050                 root.placeOpenRequested(url)
0051             }
0052         }
0053     }
0054 }