def METHOD_NAME():
    assert not widget._dlg_applications.button_ok.isEnabled()
    count = widget._dlg_applications.list.count()
    if count > 0:
        widget._dlg_applications.list.setCurrentRow(count - 1)
        qtbot.keyClick(widget._dlg_applications.button_ok, Qt.Key_Return)
    else:
        qtbot.keyClick(widget._dlg_applications.button_cancel,
                       Qt.Key_Return)