| 849 | } |
| 850 | |
| 851 | void GitWidget::openCommitChangesDialog(bool amend) |
| 852 | { |
| 853 | if (!amend && m_model->stagedFiles().isEmpty()) { |
| 854 | sendMessage(i18n("Nothing to commit. Please stage your changes first."), true); |
| 855 | return; |
| 856 | } |
| 857 | |
| 858 | auto *dialog = new GitCommitDialog(m_commitMessage, this); |
| 859 | |
| 860 | if (amend) { |
| 861 | dialog->setAmendingCommit(); |
| 862 | } |
| 863 | |
| 864 | connect(dialog, &QDialog::finished, this, [this, dialog](int res) { |
| 865 | dialog->deleteLater(); |
| 866 | if (res == QDialog::Accepted) { |
| 867 | if (dialog->subject().isEmpty()) { |
| 868 | sendMessage(i18n("Commit message cannot be empty."), true); |
| 869 | return; |
| 870 | } |
| 871 | m_commitMessage = dialog->subject() + QStringLiteral("[[\n\n]]") + dialog->description(); |
| 872 | commitChanges(dialog->subject(), dialog->description(), dialog->signoff(), dialog->amendingLastCommit()); |
| 873 | } |
| 874 | }); |
| 875 | |
| 876 | dialog->open(); |
| 877 | } |
| 878 | |
| 879 | void GitWidget::handleClick(const QModelIndex &idx, ClickAction clickAction) |
| 880 | { |
nothing calls this directly
no test coverage detected