summaryrefslogtreecommitdiff
path: root/kodereviewer/qml/FilesDrawer.qml
diff options
context:
space:
mode:
Diffstat (limited to 'kodereviewer/qml/FilesDrawer.qml')
-rw-r--r--kodereviewer/qml/FilesDrawer.qml70
1 files changed, 70 insertions, 0 deletions
diff --git a/kodereviewer/qml/FilesDrawer.qml b/kodereviewer/qml/FilesDrawer.qml
new file mode 100644
index 0000000..3f98290
--- /dev/null
+++ b/kodereviewer/qml/FilesDrawer.qml
@@ -0,0 +1,70 @@
+import QtQuick
+import QtQuick.Controls as QQC2
+import QtQuick.Layouts
+import org.kde.kirigami as Kirigami
+import org.kde.kirigamiaddons.delegates as Delegates
+import org.kde.kitemmodels
+
+import org.deprecated.kodereviewer 1.0
+
+
+Kirigami.ContextDrawer {
+ id: contextDrawer
+ modal: false
+ handleVisible: false
+ property alias model: descendantsModel.model
+ width: Kirigami.Units.gridUnit * 20
+
+ signal fileSelected(string filename, string text)
+
+ contentItem: ColumnLayout {
+ id: mainLayout
+ implicitWidth: Kirigami.Units.gridUnit * 20
+ QQC2.ToolBar {
+ id: toolbar
+ Layout.fillWidth: true
+
+ Layout.preferredHeight: pageStack.globalToolBar.preferredHeight
+
+ contentItem: RowLayout {
+ Kirigami.Heading {
+ Layout.fillWidth: true
+ text: "Files"
+ }
+ }
+ }
+
+ QQC2.ScrollView {
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+
+ ListView {
+ anchors.fill: parent
+ clip: true
+ id: menu
+ model: KDescendantsProxyModel {
+ id: descendantsModel
+ }
+
+ delegate: Delegates.RoundedTreeDelegate {
+ padding: 4
+ required property string filename
+ required property string iconName
+ required property string path
+ required property string patch
+ required property bool isFile
+ text: filename
+ icon.name: iconName
+
+ highlighted: menu.currentItem ? menu.currentItem.path == path : false
+ onClicked: {
+ menu.currentIndex = index
+ if (isFile) {
+ contextDrawer.fileSelected(filename, patch)
+ }
+ }
+ }
+ }
+ }
+ }
+}