Commit 0cf91d01 authored by jan.koester's avatar jan.koester
Browse files

test

parent 356c86e5
Loading
Loading
Loading
Loading
+43 −0
Changes for client/qml/PropertyPanel.qml: 43 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -447,6 +447,49 @@ ColumnLayout {
                    onTextEdited: propPanel.debounceSave(field.key, text)
                }
            }

            /* section_select — pick a section/container from the document tree */
            ComboBox {
                visible: field.type === "section_select"
                Layout.fillWidth: true
                font.pixelSize: 13
                palette.text: Theme.textPrimary
                palette.buttonText: Theme.textPrimary
                textRole: "text"
                valueRole: "value"
                model: ListModel { id: sectionListModel }
                background: Rectangle { color: Theme.bgTertiary; border.color: Theme.border; radius: Theme.radius }

                Component.onCompleted: {
                    sectionListModel.clear()
                    sectionListModel.append({ text: qsTr("(none)"), value: "" })
                    try {
                        var tree = JSON.parse(localApi.getDocTree())
                        function collectSections(nodes) {
                            for (var i = 0; i < nodes.length; i++) {
                                var n = nodes[i]
                                var label = (n.type || "?") + " — " + (n.uuid || "").substring(0, 8)
                                sectionListModel.append({ text: label, value: n.uuid || "" })
                                if (n.children) collectSections(n.children)
                            }
                        }
                        if (tree.children) collectSections(tree.children)
                    } catch(e) {}

                    // Select current value
                    for (var j = 0; j < sectionListModel.count; j++) {
                        if (sectionListModel.get(j).value === String(val)) { currentIndex = j; return }
                    }
                    currentIndex = 0
                }

                onActivated: {
                    if (currentIndex >= 0) {
                        var item = sectionListModel.get(currentIndex)
                        if (item) propPanel.saveProperty(field.key, item.value)
                    }
                }
            }
        }
    }