Commit 6072783d authored by jan.koester's avatar jan.koester
Browse files

test

parent 637bbc92
Loading
Loading
Loading
Loading
+34 −30
Changes for client/qml/DocumentTree.qml: 34 added lines, 30 removed lines.
Original line number Diff line number Diff line
@@ -54,6 +54,34 @@ ColumnLayout {

                HoverHandler { id: nodeHover }

                MouseArea {
                    anchors.fill: parent
                    acceptedButtons: Qt.LeftButton | Qt.RightButton
                    onClicked: function(mouse) {
                        if (mouse.button === Qt.RightButton) {
                            nodeMenu.popup()
                        } else {
                            treeRoot.selectedUuid = node.uuid
                            propPanel.loadProperties(node.uuid)
                        }
                    }
                }

                Menu {
                    id: nodeMenu
                    MenuItem { text: qsTr("⚙  Settings");  onTriggered: { treeRoot.selectedUuid = node.uuid; propPanel.loadProperties(node.uuid) } }
                    MenuSeparator {}
                    MenuItem { text: qsTr("↑  Move up");    onTriggered: localApi.moveUp(node.uuid) }
                    MenuItem { text: qsTr("↓  Move down");  onTriggered: localApi.moveDown(node.uuid) }
                    MenuItem { text: qsTr("→  Indent");     onTriggered: localApi.indent(node.uuid) }
                    MenuItem { text: qsTr("←  Outdent");    onTriggered: localApi.outdent(node.uuid) }
                    MenuSeparator {}
                    MenuItem { text: qsTr("⎘  Copy");       onTriggered: { localApi.copyElement(node.uuid); root.setStatus("Copied") } }
                    MenuItem { text: qsTr("📋 Paste");      onTriggered: localApi.pasteElement(node.uuid) }
                    MenuSeparator {}
                    MenuItem { text: qsTr("✕  Remove");     onTriggered: localApi.removeElement(node.uuid) }
                }

                RowLayout {
                    anchors.fill: parent
                    anchors.leftMargin: 8; anchors.rightMargin: 4
@@ -80,37 +108,15 @@ ColumnLayout {
                        color: treeRoot.selectedUuid === node.uuid ? Theme.bgPrimary : Theme.textPrimary
                        elide: Text.ElideRight
                        Layout.fillWidth: true

                        MouseArea {
                            anchors.fill: parent
                            onClicked: {
                                treeRoot.selectedUuid = node.uuid
                                propPanel.loadProperties(node.uuid)
                            }
                        }
                    }

                    /* Action buttons (visible on hover) */
                    Row {
                        spacing: 2
                        visible: nodeHover.hovered
                        Repeater {
                            model: [
                                { icon: "⚙", tip: "Settings", action: function() { treeRoot.selectedUuid = node.uuid; propPanel.loadProperties(node.uuid) } },
                                { icon: "↑", tip: "Move up",  action: function() { localApi.moveUp(node.uuid) } },
                                { icon: "↓", tip: "Move down", action: function() { localApi.moveDown(node.uuid) } },
                                { icon: "→", tip: "Indent",   action: function() { localApi.indent(node.uuid) } },
                                { icon: "←", tip: "Outdent",  action: function() { localApi.outdent(node.uuid) } },
                                { icon: "⎘", tip: "Copy",     action: function() { localApi.copyElement(node.uuid); root.setStatus("Copied") } },
                                { icon: "📋", tip: "Paste",   action: function() { localApi.pasteElement(node.uuid) } },
                                { icon: "✕", tip: "Remove",   action: function() { localApi.removeElement(node.uuid) } }
                            ]

                    /* Quick-action: remove (visible on hover) */
                    ToolButton {
                                text: modelData.icon
                        visible: nodeHover.hovered
                        text: "✕"
                        font.pixelSize: 12
                        implicitWidth: 22; implicitHeight: 22
                                ToolTip.text: modelData.tip
                        ToolTip.text: qsTr("Remove")
                        ToolTip.visible: hovered

                        background: Rectangle {
@@ -119,14 +125,12 @@ ColumnLayout {
                        }
                        contentItem: Text {
                            text: parent.text; font: parent.font
                                    color: modelData.icon === "✕" && parent.hovered ? Theme.danger : Theme.textSecondary
                            color: parent.hovered ? Theme.danger : Theme.textSecondary
                            horizontalAlignment: Text.AlignHCenter
                            verticalAlignment: Text.AlignVCenter
                        }

                                onClicked: modelData.action()
                            }
                        }
                        onClicked: localApi.removeElement(node.uuid)
                    }
                }
            }