<commit_before>import QtQuick 2.0
import Sailfish.Silica 1.0

Page {
    id: page

    property alias _slider: levelSlider.value
    property alias _field: inputField.text

    // To enable PullDownMenu, place our content in a SilicaFlickable
    SilicaFlickable {
        anchors.fill: parent
        
        PullDownMenu {
            id: pullDownMenu
            MenuItem {
                id: aboutMenuAction
                text: qsTr("About")
                onClicked: {
                    pageStack.push(Qt.resolvedUrl("AboutPage.qml"))
                }
            }
            MenuItem {
                id: helpMenuAction
                text: qsTr("Help")
                onClicked: {
                    pageStack.push(Qt.resolvedUrl("HelpPage.qml"))
                }
            }
        }
        
        // Tell SilicaFlickable the height of its content.
        contentHeight: childrenRect.height
        
        // Place our content in a Column.  The PageHeader is always placed at the top
        // of the page, followed by our content.
        Column {
            width: page.width
            spacing: Theme.paddingLarge
            PageHeader {
                title: qsTr("Factorization")
            }

            BackgroundItem {
                width: parent.width
                height: contentItem.childrenRect.height
                Row {
                    anchors.left: parent.left
                    anchors.right: parent.right
                    height: inputField.height
                    width: inputField.width

                    TextField {
                        id: inputField
                        width: parent.width
                        text: ""
                        placeholderText: qsTr("Enter an integer.")
                        // Ten million ought to be enough for anyone.
                        validator: IntValidator { bottom: -9999999; top: 9999999 }
                        // Show a numpad only, instead of a full keyboard
                        inputMethodHints: Qt.ImhDigitsOnly
                        focus: true
                    }
                }
            }
            Label {
                anchors.left: parent.left
                anchors.right: parent.right
                anchors.margins: Theme.paddingLarge
                height: 100

                id: factorizationResult
                text: fact.factorize(parseInt(inputField.text), levelSlider.value, false)
                wrapMode: Text.WordWrap
            }
            Slider {<commit_msg>Customize the Enter key, as suggested by the Common Pitfalls in Sailfish Application Development document.<commit_after>import QtQuick 2.0
import Sailfish.Silica 1.0

Page {
    id: page

    property alias _slider: levelSlider.value
    property alias _field: inputField.text

    // To enable PullDownMenu, place our content in a SilicaFlickable
    SilicaFlickable {
        anchors.fill: parent
        
        PullDownMenu {
            id: pullDownMenu
            MenuItem {
                id: aboutMenuAction
                text: qsTr("About")
                onClicked: {
                    pageStack.push(Qt.resolvedUrl("AboutPage.qml"))
                }
            }
            MenuItem {
                id: helpMenuAction
                text: qsTr("Help")
                onClicked: {
                    pageStack.push(Qt.resolvedUrl("HelpPage.qml"))
                }
            }
        }
        
        // Tell SilicaFlickable the height of its content.
        contentHeight: childrenRect.height
        
        // Place our content in a Column.  The PageHeader is always placed at the top
        // of the page, followed by our content.
        Column {
            width: page.width
            spacing: Theme.paddingLarge
            PageHeader {
                title: qsTr("Factorization")
            }

            BackgroundItem {
                width: parent.width
                height: contentItem.childrenRect.height
                Row {
                    anchors.left: parent.left
                    anchors.right: parent.right
                    height: inputField.height
                    width: inputField.width

                    TextField {
                        id: inputField
                        width: parent.width
                        text: ""
                        placeholderText: qsTr("Enter an integer.")
                        // Ten million ought to be enough for anyone.
                        validator: IntValidator { bottom: -9999999; top: 9999999 }
                        // Show a numpad only, instead of a full keyboard
                        inputMethodHints: Qt.ImhDigitsOnly
                        focus: true
                        EnterKey.iconSource: "image://theme/icon-m-enter-close"
                        EnterKey.onClicked: focus = false
                    }
                }
            }
            Label {
                anchors.left: parent.left
                anchors.right: parent.right
                anchors.margins: Theme.paddingLarge
                height: 100

                id: factorizationResult
                text: fact.factorize(parseInt(inputField.text), levelSlider.value, false)
                wrapMode: Text.WordWrap
            }
            Slider {
{'fraction_non_alphanumeric': 0.0628154795288839, 'fraction_numerical': 0.007851934941110488, 'mean_word_length': 1.123015873015873, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2334693', 'n_tokens_mistral': 1320, 'n_tokens_neox': 1200, 'n_words': 325}