import QtQuick Item { property bool active: false property bool confirming: false property string error: "" property int submissions: 0 property int cancellations: 0 property int denials: 0 property bool receivedLiteral: false function stateJson() { return JSON.stringify({ active: active, confirming: confirming, error: error, request: { message: "fixture authorization only", prompt: "fixture input", responseVisible: false } }); } function begin() { confirming = false; error = ""; active = true; } function submit(secret) { submissions++; receivedLiteral = secret === "fixture-only"; if (submissions === 1 || !receivedLiteral) { error = "Authentication failed"; } else { confirming = true; active = false; error = ""; } return stateJson(); } function cancel() { cancellations++; active = false; confirming = false; error = ""; return stateJson(); } function deny() { denials++; active = false; return stateJson(); } }