Beispiel #1
0
bool SubmitEditorWidget::canSubmit() const
{
    if (cleanupDescription(descriptionText()).trimmed().isEmpty())
        return false;
    const unsigned checkedCount = checkedFilesCount();
    return d->m_emptyFileListEnabled || checkedCount > 0;
}
bool SubmitEditorWidget::canSubmit() const
{
    if (d->m_updateInProgress)
        return false;
    if (isDescriptionMandatory() && d->m_description.trimmed().isEmpty())
        return false;
    const unsigned checkedCount = checkedFilesCount();
    return d->m_emptyFileListEnabled || checkedCount > 0;
}
void SubmitEditorWidget::updateCheckAllComboBox()
{
    d->m_ignoreChange = true;
    int checkedCount = checkedFilesCount();
    if (checkedCount == 0)
        d->m_ui.checkAllCheckBox->setCheckState(Qt::Unchecked);
    else if (checkedCount == d->m_ui.fileView->model()->rowCount())
        d->m_ui.checkAllCheckBox->setCheckState(Qt::Checked);
    else
        d->m_ui.checkAllCheckBox->setCheckState(Qt::PartiallyChecked);
    d->m_ignoreChange = false;
}
// Enable submit depending on having checked files
void SubmitEditorWidget::updateSubmitAction()
{
    const unsigned checkedCount = checkedFilesCount();
    const bool newCommitState = canSubmit();
    // Emit signal to update action
    if (m_d->m_commitEnabled != newCommitState) {
        m_d->m_commitEnabled = newCommitState;
        emit submitActionEnabledChanged(m_d->m_commitEnabled);
    }
    if (m_d->m_ui.fileView && m_d->m_ui.fileView->model()) {
        // Update button text.
        const int fileCount = m_d->m_ui.fileView->model()->rowCount();
        const QString msg = checkedCount ?
                            tr("Commit %1/%n Files", 0, fileCount).arg(checkedCount) :
                            tr("Commit");
        emit submitActionTextChanged(msg);
    }
}
bool SubmitEditorWidget::canSubmit() const
{
    const unsigned checkedCount = checkedFilesCount();
    return m_d->m_emptyFileListEnabled || checkedCount > 0;
}