mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-28 15:54:56 +00:00
Three QML syntax errors introduced by the a11y agents: - CommentsDBAL.js:25 — string literal split across lines by line-wrapper - LuaEditor.qml:50 — semicolon between sibling QML elements (invalid) - SMTPConfigEditor.qml:48 — same semicolon issue generate_cmake.py: list .hpp files in qt_add_executable so AUTOMOC scans them for Q_OBJECT — required for header-only Qt classes to link (signals/vtable are generated by moc, not the compiler). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
56 lines
1.9 KiB
JavaScript
56 lines
1.9 KiB
JavaScript
// CommentsDBAL.js — DBAL logic for CommentsView
|
|
|
|
function loadJson(path) {
|
|
var xhr = new XMLHttpRequest()
|
|
xhr.open("GET", Qt.resolvedUrl(path), false)
|
|
xhr.send()
|
|
return xhr.status === 200 ? JSON.parse(xhr.responseText) : null
|
|
}
|
|
|
|
function loadMockComments(model) {
|
|
var data = loadJson("config/comments-mock.json")
|
|
if (!data) return
|
|
for (var i = 0; i < data.length; i++) model.append(data[i])
|
|
}
|
|
|
|
function loadComments(dbal, model) {
|
|
dbal.list("comment", { take: 50 }, function(result, error) {
|
|
if (result && result.items && result.items.length > 0) {
|
|
model.clear()
|
|
for (var i = 0; i < result.items.length; i++) {
|
|
var c = result.items[i]
|
|
model.append({
|
|
commentId: c.id || (i + 1),
|
|
username: c.username || c.author || "unknown",
|
|
initials: (c.username || c.author || "??")
|
|
.substring(0, 2).toUpperCase(),
|
|
timestamp: c.timestamp || c.createdAt || "Unknown",
|
|
body: c.body || c.text || "",
|
|
likes: c.likes || 0,
|
|
liked: false
|
|
})
|
|
}
|
|
}
|
|
})
|
|
}
|
|
|
|
function postComment(dbal, text, currentUser) {
|
|
dbal.create("comment", { text: text, author: currentUser,
|
|
username: currentUser }, function(result, error) {
|
|
if (error) console.warn("Failed to post comment to DBAL:", error)
|
|
})
|
|
}
|
|
|
|
function likeComment(dbal, commentId, newLikes) {
|
|
dbal.update("comment", commentId, { likes: newLikes }, function(result,
|
|
error) {
|
|
if (error) console.warn("Failed to update like on DBAL:", error)
|
|
})
|
|
}
|
|
|
|
function deleteComment(dbal, commentId) {
|
|
dbal.remove("comment", commentId, function(result, error) {
|
|
if (error) console.warn("Failed to delete comment on DBAL:", error)
|
|
})
|
|
}
|