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

ColumnLayout {

    property string codeName: qsTr('PIN')
    //: Input field for the current value of the code (for example PIN) to be changed
    property string currentCodeLabel: qsTr('Current %1:').arg(codeName)
    property string acceptBtnName: qsTr('Ok')
    property bool showRequirements: true
    property int maxLength: 8
    property int minLength: 6
    property bool hasCode: true
    property string headerText: ''

    signal accepted
    signal canceled
    signal codeChanged(string currentCode, string newCode)

    onAccepted: {
        if (valid(currentInput.text, newInput.text, repeatInput.text)) {
            codeChanged(currentInput.text, newInput.text)
        }
    }

    Label {
        visible: headerText !== ''
        text: headerText
        font.bold: true
    }

    GridLayout {
        columns: 2
        Label {
            visible: hasCode
            text: currentCodeLabel
            Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
            Layout.fillWidth: false
        }

        TextField {
            id: currentInput
            Layout.fillWidth: true
            visible: hasCode
            echoMode: TextInput.Password
            focus: true
        }

        Label {
            //: Input field for the new value to change the code (for example PIN) to
            text: showRequirements ? qsTr('New %1 (%2-%3 characters):').arg(
                                         codeName).arg(minLength).arg(
                                         maxLength) : qsTr(
                                         'New %1:').arg(codeName)
            Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
            Layout.fillWidth: false
        }

        TextField {
            id: newInput
            Layout.fillWidth: true
            echoMode: TextInput.Password
        }<commit_msg>fido set-pin: focus on first text field<commit_after>import QtQuick 2.5
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.2

ColumnLayout {

    property string codeName: qsTr('PIN')
    //: Input field for the current value of the code (for example PIN) to be changed
    property string currentCodeLabel: qsTr('Current %1:').arg(codeName)
    property string acceptBtnName: qsTr('Ok')
    property bool showRequirements: true
    property int maxLength: 8
    property int minLength: 6
    property bool hasCode: true
    property string headerText: ''

    signal accepted
    signal canceled
    signal codeChanged(string currentCode, string newCode)

    onAccepted: {
        if (valid(currentInput.text, newInput.text, repeatInput.text)) {
            codeChanged(currentInput.text, newInput.text)
        }
    }

    onActiveFocusChanged: {
        hasCode ? currentInput.forceActiveFocus() : newInput.forceActiveFocus()
    }

    Label {
        visible: headerText !== ''
        text: headerText
        font.bold: true
    }

    GridLayout {
        columns: 2
        Label {
            visible: hasCode
            text: currentCodeLabel
            Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
            Layout.fillWidth: false
        }

        TextField {
            id: currentInput
            Layout.fillWidth: true
            visible: hasCode
            echoMode: TextInput.Password
        }

        Label {
            //: Input field for the new value to change the code (for example PIN) to
            text: showRequirements ? qsTr('New %1 (%2-%3 characters):').arg(
                                         codeName).arg(minLength).arg(
                                         maxLength) : qsTr(
                                         'New %1:').arg(codeName)
            Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
            Layout.fillWidth: false
        }

        TextField {
            id: newInput
            Layout.fillWidth: true
            echoMode: TextInput.Password
        }
{'fraction_non_alphanumeric': 0.077909022367429, 'fraction_numerical': 0.007036943955767781, 'mean_word_length': 1.7429359062715368, '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': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '749153', 'n_tokens_mistral': 1042, 'n_tokens_neox': 997, 'n_words': 292}