<commit_before>import QtQuick 2.0
import Sailfish.Silica 1.0
import harbour.orn 1.0

PullDownMenu {
    id: pullMenu
    enabled: networkManager.state === "online"

    onBusyChanged: {
        var length = children.length
        for (var i = 0; i < length; ++i) {
            children[i].enabled = !busy
        }
    }

    MenuItem {
        visible: text
        text: {
            switch (app.repoStatus) {
            case OrnApplication.RepoNotInstalled:
                //% "Add repository"
                return qsTrId("orn-repo-add")
            case OrnApplication.RepoDisabled:
                //% "Enable repository"
                return qsTrId("orn-repo-enable")
            default:
                return ""
            }
        }
        onClicked: {
            switch (app.repoStatus) {
            case OrnApplication.RepoNotInstalled:
                //% "Adding"
                Remorse.popupAction(page, qsTrId("orn-adding-repo"), function() {
                    app.enableRepo()
                })
                break
            case OrnApplication.RepoDisabled:
                app.enableRepo()
                break
            default:
                break
            }
        }
    }

    MenuItem {
        visible: text
        text: {
            if (app.installedVersion) {
                //% "Remove"
                return qsTrId("orn-remove")
            } else if (app.availableVersion) {
                //% "Install"
                return qsTrId("orn-install")
            } else {
                return ""
            }
        }
        onClicked: {
            if (app.installedVersion) {
                Remorse.popupAction(page, qsTrId("orn-removing"), function()
                {
                    pullMenu.busy = true
                    app.remove()
                })
            } else if (app.availableVersion) {
                pullMenu.busy = true
                app.install()
            }
        }
        onTextChanged: {
            pullMenu.busy = false
        }
    }

    MenuItem {
        visible: app.updateAvailable
        //% "Update"
        text: qsTrId("orn-update")
        onClicked: {
            pullMenu.busy = true
            app.install()
        }
    }

    MenuItem {
        visible: app.installedVersion
        //% "Launch"
        text: qsTrId("orn-launch")
        onClicked: app.launch()
    }
}<commit_msg>Fix freezing after installation/removing<commit_after>import QtQuick 2.0
import Sailfish.Silica 1.0
import harbour.orn 1.0

PullDownMenu {
    id: pullMenu
    visible: networkManager.state === "online" &&
             (repoMenuItem.text   || installMenuItem.text ||
              app.updateAvailable || app.installedVersion)

    MenuItem {
        id: repoMenuItem
        visible: text
        enabled: !parent.busy
        text: {
            switch (app.repoStatus) {
            case OrnApplication.RepoNotInstalled:
                //% "Add repository"
                return qsTrId("orn-repo-add")
            case OrnApplication.RepoDisabled:
                //% "Enable repository"
                return qsTrId("orn-repo-enable")
            default:
                return ""
            }
        }
        onClicked: {
            switch (app.repoStatus) {
            case OrnApplication.RepoNotInstalled:
                //% "Adding"
                Remorse.popupAction(page, qsTrId("orn-adding-repo"), function() {
                    app.enableRepo()
                })
                break
            case OrnApplication.RepoDisabled:
                app.enableRepo()
                break
            default:
                break
            }
        }
    }

    MenuItem {
        id: installMenuItem
        visible: text
        enabled: !parent.busy
        text: {
            if (app.installedVersion) {
                //% "Remove"
                return qsTrId("orn-remove")
            } else if (app.availableVersion) {
                //% "Install"
                return qsTrId("orn-install")
            } else {
                return ""
            }
        }
        onClicked: {
            if (app.installedVersion) {
                Remorse.popupAction(page, qsTrId("orn-removing"), function()
                {
                    pullMenu.busy = true
                    app.remove()
                })
            } else if (app.availableVersion) {
                pullMenu.busy = true
                app.install()
            }
        }
        onTextChanged: {
            pullMenu.busy = false
        }
    }

    MenuItem {
        id: updateMenuItem
        visible: app.updateAvailable
        enabled: !parent.busy
        //% "Update"
        text: qsTrId("orn-update")
        onClicked: {
            pullMenu.busy = true
            app.install()
        }
    }

    MenuItem {
        id: launchMenuItem
        visible: app.installedVersion
        enabled: !parent.busy
        //% "Launch"
        text: qsTrId("orn-launch")
        onClicked: app.launch()
    }
}
{'fraction_non_alphanumeric': 0.0977205153617443, 'fraction_numerical': 0.002576808721506442, 'mean_word_length': 1.1435853865760408, 'pattern_counts': {'":': 0, '<': 4, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5827692', 'n_tokens_mistral': 1390, 'n_tokens_neox': 1316, 'n_words': 246}