import QtQuick Item { // Synthetic vault: a configured profile, locked at rest, twenty notes once // unlocked. No native boundary, no secrets; the master password is never kept. // Inputs the registry forwards to the production service. property var clipboardService: null property bool panelOpen: false // Diagnostics redaction sentinel: the endpoint must never project it. property string account: "diagnostic-private-sentinel" property string status: "locked" readonly property bool unlocked: status === "unlocked" property var profile: ({ serverUrl: "https://vault.example.invalid", account: "fixture@example.invalid" }) property bool setupEditing: false property bool setupSaving: false property bool connectionBusy: false property bool connectionTesting: false property string connectionResult: "" property string setupError: "" property string setupUrlDraft: "" property string setupAccountDraft: "" property bool lockPending: false property int lockGeneration: 0 property string message: "" property string feedback: "" property string repromptError: "" property var cache: ({ available: true, stale: false }) property var challenge: ({ providers: [] }) property bool verificationPending: false property int secondFactorProvider: -1 property string secondFactorDraft: "" property string query: "" property string selectedId: "" property real resultScrollPosition: 0 property real detailScrollPosition: 0 property var detail: ({}) // Focused application at the latest opening, and how often the host opened it. property string context: "" property int opens: 0 property int unlocks: 0 property int locks: 0 // An unlocked vault without items, e.g. a fresh account. property bool emptyVault: false property int setupEntries: 0 property int tests: 0 property int saves: 0 property bool failSave: true readonly property var items: Array.from({ length: emptyVault ? 0 : 20 }, (_, i) => ({ id: `item-${i}`, // The last item was imported without a name: its id stands in. title: i === 19 ? "23965d8a-47d6-45ce-9d1a-f83c6b805220" : `fixture item ${i}`, itemType: "note", favorite: false, subtitle: "synthetic" })) readonly property var visibleItems: unlocked ? items.filter(item => item.title.includes(query)) : [] readonly property var groupedItems: visibleItems.length > 0 ? [ { label: "items", items: visibleItems } ] : [] function prepareOpen(appId) { context = String(appId || ""); opens++; } // Production sends the password once to the native boundary; the double drops it. function unlock(password) { unlocks++; status = "unlocked"; select("item-0"); } function secondFactorHint() { return "verification code"; } function sectionExpanded(name) { return true; } function isRevealed(id) { return false; } function select(id) { selectedId = id; const item = items.find(row => row.id === id); detail = item ? Object.assign({}, item, { fields: [], uris: [], notes: "", attachments: [] }) : ({}); } function moveSelection(delta) { const index = visibleItems.findIndex(row => row.id === selectedId); if (visibleItems.length > 0) select(visibleItems[Math.max(0, Math.min(visibleItems.length - 1, index + delta))].id); } function refreshDetail() { select(selectedId); } function sync() { } function setEmptyVault(empty) { emptyVault = !!empty; select(emptyVault ? "" : "item-0"); } function beginSetup() { if (setupEditing || setupSaving) return; setupEntries++; setupUrlDraft = profile.serverUrl; setupAccountDraft = profile.account; setupEditing = true; lock(); } function cancelSetup() { if (setupSaving || lockPending) return; stopConnectionTest(); setupEditing = false; setupError = ""; setupUrlDraft = profile.serverUrl; setupAccountDraft = profile.account; } function stopConnectionTest() { connectionTesting = false; connectionBusy = false; connectionResult = ""; } function testConnection() { if (connectionBusy || setupSaving || lockPending) return; tests++; connectionBusy = true; connectionTesting = true; connectionResult = ""; } function finishTest(success) { connectionBusy = false; connectionTesting = false; connectionResult = success ? "connection ready" : "connection unavailable; retry"; } function saveSetup() { if (connectionBusy || setupSaving || lockPending) return; saves++; setupSaving = true; } function finishSave() { if (!setupSaving) return; setupSaving = false; if (failSave) { setupError = "profile could not be saved; retry"; failSave = false; } else { profile = { serverUrl: setupUrlDraft, account: setupAccountDraft }; setupEditing = false; setupError = ""; } } function lock() { locks++; status = "locked"; lockGeneration++; query = ""; selectedId = ""; detail = ({}); resultScrollPosition = 0; detailScrollPosition = 0; } // Coarse state only: never records, queries, profile or context. function fixtureState() { return { "status": status, "setupEntries": setupEntries, "tests": tests, "saves": saves, "setupSaving": setupSaving, "connectionBusy": connectionBusy, "setupEditing": setupEditing, "knownDrafts": setupUrlDraft === "https://profile.invalid" && setupAccountDraft === "profile-user", "opens": opens, "unlocks": unlocks, "locks": locks, "selectedId": selectedId, "count": visibleItems.length, "emptyVault": emptyVault, "scrollY": resultScrollPosition, "detailEmpty": !detail.id }; } }