Warning, /plasma/plasma-nano/shell/contents/explorer/WidgetExplorer.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2011 Marco Martin <mart@kde.org> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 import QtQuick 2.2 0008 import QtQuick.Layouts 1.4 0009 0010 import org.kde.plasma.components 3.0 as PC3 0011 import org.kde.kirigami 2.20 as Kirigami 0012 0013 import QtQuick.Window 2.1 0014 0015 import org.kde.plasma.private.shell 2.0 0016 0017 PC3.Drawer { 0018 id: root 0019 0020 property QtObject containment 0021 property Item containmentInterface 0022 readonly property bool horizontal: containmentInterface.width <= containmentInterface.height 0023 readonly property int delegateSize: Kirigami.Units.gridUnit * 8 0024 0025 property int topPanelHeight 0026 property int bottomPanelHeight 0027 property int leftPanelWidth 0028 property int rightPanelWidth 0029 0030 visible: true 0031 0032 width: horizontal ? containmentInterface.screenGeometry.width : implicitWidth + leftPadding 0033 height: horizontal ? implicitHeight + bottomPadding : containmentInterface.screenGeometry.height 0034 edge: horizontal ? Qt.BottomEdge : Qt.LeftEdge 0035 0036 leftPadding: containmentInterface.availableScreenRect.x 0037 topPadding: horizontal ? Kirigami.Units.smallSpacing : containmentInterface.availableScreenRect.y 0038 rightPadding: horizontal ? containmentInterface.screenGeometry.width - containmentInterface.availableScreenRect.width - containmentInterface.availableScreenRect.x : 0 0039 bottomPadding: containmentInterface.screenGeometry.height - containmentInterface.availableScreenRect.height - containmentInterface.availableScreenRect.y 0040 0041 implicitWidth: categoriesView.shouldBeVisible ? layout.implicitWidth : view.implicitWidth + Kirigami.Units.smallSpacing 0042 implicitHeight: categoriesView.shouldBeVisible ? layout.implicitHeight : view.implicitHeight + Kirigami.Units.smallSpacing 0043 0044 Behavior on implicitWidth { 0045 NumberAnimation { 0046 duration: Kirigami.Units.longDuration 0047 easing.type: Easing.InOutQuad 0048 } 0049 } 0050 Behavior on implicitHeight { 0051 NumberAnimation { 0052 duration: Kirigami.Units.longDuration 0053 easing.type: Easing.InOutQuad 0054 } 0055 } 0056 contentItem: Item { 0057 implicitWidth: layout.implicitWidth 0058 implicitHeight: layout.implicitHeight 0059 clip: false 0060 0061 PC3.RoundButton { 0062 z: 1 0063 anchors.bottom: parent.bottom 0064 x: root.horizontal ? parent.width - width : 0 0065 width: Kirigami.Units.iconSizes.large 0066 height: width 0067 0068 icon.name: "view-filter" 0069 checked: categoriesView.shouldBeVisible 0070 onClicked: categoriesView.shouldBeVisible = !categoriesView.shouldBeVisible 0071 } 0072 0073 GridLayout { 0074 id: layout 0075 anchors { 0076 top: parent.top 0077 right: parent.right 0078 0079 bottom: root.horizontal ? undefined : parent.bottom 0080 left: root.horizontal ? parent.left : undefined 0081 } 0082 rows: root.horizontal ? 2 : 1 0083 columns: root.horizontal ? 1 : 2 0084 0085 PC3.ScrollView { 0086 id: categoriesView 0087 property bool shouldBeVisible: false 0088 clip: false 0089 Layout.fillWidth: root.horizontal 0090 Layout.fillHeight: !root.horizontal 0091 Layout.column: 0 0092 Layout.row: root.horizontal ? 1 : 0 0093 implicitHeight: Kirigami.Units.gridUnit * 2 0094 implicitWidth: Kirigami.Units.gridUnit * 8 0095 opacity: categoriesView.shouldBeVisible 0096 0097 Behavior on opacity { 0098 NumberAnimation { 0099 duration: Kirigami.Units.longDuration 0100 easing.type: Easing.InOutQuad 0101 } 0102 } 0103 0104 ListView { 0105 clip: false 0106 model: widgetExplorer.filterModel 0107 orientation: root.horizontal ? ListView.Horizontal : ListView.Vertical 0108 topMargin: root.horizontal ? 0 : root.topPanelHeight 0109 delegate: PC3.ItemDelegate { 0110 height: model.separator ? 1 : implicitHeight 0111 width: root.horizontal ? implicitWidth : parent.width 0112 text: model.separator ? "" : model.display 0113 checked: widgetExplorer.widgetsModel.filterType == model.filterType && widgetExplorer.widgetsModel.filterQuery == model.filterData 0114 0115 onClicked: { 0116 widgetExplorer.widgetsModel.filterQuery = model.filterData 0117 widgetExplorer.widgetsModel.filterType = model.filterType 0118 } 0119 } 0120 } 0121 } 0122 0123 PC3.ScrollView { 0124 id: view 0125 clip: false 0126 Layout.fillWidth: root.horizontal 0127 Layout.fillHeight: !root.horizontal 0128 Layout.row: 0 0129 Layout.column: root.horizontal ? 0 : 1 0130 implicitWidth: delegateSize + Kirigami.Units.gridUnit 0131 implicitHeight: delegateSize + Kirigami.Units.gridUnit * 3 0132 0133 ListView { 0134 id: appletsList 0135 clip: false 0136 topMargin: root.horizontal ? 0 : root.topPanelHeight 0137 header: Kirigami.Heading { 0138 text: i18n("Widgets") 0139 visible: !root.horizontal 0140 width: visible ? implicitWidth : 0 0141 height: visible ? implicitHeight : 0 0142 } 0143 orientation: root.horizontal ? ListView.Horizontal : ListView.Vertical 0144 model: widgetExplorer.widgetsModel 0145 delegate: AppletDelegate {} 0146 Component.onCompleted: appletsList.contentY = -appletsList.topMargin - headerItem.height 0147 } 0148 } 0149 } 0150 } 0151 0152 WidgetExplorer { 0153 id: widgetExplorer 0154 containment: root.containment 0155 //view: desktop 0156 onShouldClose: root.close(); 0157 } 0158 }