<commit_before>import QtQuick 2.5
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.2
import QtQuick.Dialogs 1.2

DefaultDialog {
    title: qsTr("Configure FIDO")
    minimumHeight: calcHeight()
    height: minimumHeight
    minimumWidth: calcWidth()
    width: minimumWidth

    property var device
    property bool hasPin
    property int pinRetries
    property string pinMessage
    property bool pinBlocked

    function calcWidth() {
        return stack.currentItem ? Math.max(
                                       350,
                                       stack.currentItem.implicitWidth + (margins * 2)) : 0
    }

    function calcHeight() {
        return stack.currentItem ? stack.currentItem.implicitHeight + (margins * 2) : 0
    }

    function load() {
        stack.push({
                       item: fidoOverview,
                       immediate: true,
                       replace: true
                   })

        function handlePinResp(resp) {
            if (!resp.error) {
                hasPin = resp.hasPin
                if (hasPin) {
                    device.fido_pin_retries(handleRetriesResp)
                } else {
                    pinMessage = qsTr("No PIN is set.")
                    show()
                }
            }
        }
        function handleRetriesResp(resp) {
            if (!resp.error) {
                pinRetries = resp.retries
                pinMessage = qsTr("A PIN is set, ") + pinRetries + qsTr(
                            " retries left.")
            } else {
                pinMessage = resp.error
                pinBlocked = (resp.error === 'PIN is blocked.')
            }
            show()
        }
        device.fido_has_pin(handlePinResp)
    }<commit_msg>FidoDialog: reset pinBlocked value on load<commit_after>import QtQuick 2.5
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.2
import QtQuick.Dialogs 1.2

DefaultDialog {
    title: qsTr("Configure FIDO")
    minimumHeight: calcHeight()
    height: minimumHeight
    minimumWidth: calcWidth()
    width: minimumWidth

    property var device
    property bool hasPin
    property int pinRetries
    property string pinMessage
    property bool pinBlocked

    function calcWidth() {
        return stack.currentItem ? Math.max(
                                       350,
                                       stack.currentItem.implicitWidth + (margins * 2)) : 0
    }

    function calcHeight() {
        return stack.currentItem ? stack.currentItem.implicitHeight + (margins * 2) : 0
    }

    function load() {
        stack.push({
                       item: fidoOverview,
                       immediate: true,
                       replace: true
                   })

        function handlePinResp(resp) {
            if (!resp.error) {
                hasPin = resp.hasPin
                if (hasPin) {
                    device.fido_pin_retries(handleRetriesResp)
                } else {
                    pinBlocked = false
                    pinMessage = qsTr("No PIN is set.")
                    show()
                }
            }
        }
        function handleRetriesResp(resp) {
            if (!resp.error) {
                pinRetries = resp.retries
                pinMessage = qsTr("A PIN is set, ") + pinRetries + qsTr(
                            " retries left.")
            } else {
                pinMessage = resp.error
                pinBlocked = (resp.error === 'PIN is blocked.')
            }
            show()
        }
        device.fido_has_pin(handlePinResp)
    }
{'fraction_non_alphanumeric': 0.07937395192845165, 'fraction_numerical': 0.008384572386808273, 'mean_word_length': 1.3075435203094778, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4012817', 'n_tokens_mistral': 985, 'n_tokens_neox': 906, 'n_words': 221}