This commit is contained in:
Domipoke
2026-06-25 19:58:23 +02:00
parent 372c622025
commit 955801c666
147 changed files with 18829 additions and 0 deletions
@@ -0,0 +1,49 @@
import QtQuick
import Quickshell
// Todo page selector wrapper - prepares menu items and handles selection
QtObject {
id: root
property var pluginApi: null
property string selectedText: ""
property var todoPages: []
property var selectionMenu: null
signal pageSelected(int pageId, string pageName)
function buildMenuModel() {
const model = [];
// Add existing todo pages only
for (let i = 0; i < todoPages.length; i++) {
const page = todoPages[i];
model.push({
"label": page.name || pluginApi?.tr("notecards.untitled-placeholder"),
"action": "page-" + page.id,
"icon": "list",
"pageId": page.id
});
}
return model;
}
function show(text, pages) {
selectedText = text || "";
todoPages = pages || [];
if (selectionMenu) {
const menuItems = buildMenuModel();
selectionMenu.show(menuItems);
} else {}
}
function handleItemSelected(action) {
if (action.startsWith("page-")) {
const pageId = parseInt(action.replace("page-", ""));
const page = todoPages.find(p => p.id === pageId);
root.pageSelected(pageId, page ? page.name : pluginApi?.tr("notecards.untitled-placeholder"));
}
}
}