| 33 | using namespace KDevelop; |
| 34 | |
| 35 | VCSCommitDiffPatchSource::VCSCommitDiffPatchSource(VCSDiffUpdater* updater) |
| 36 | : VCSDiffPatchSource(updater), m_vcs(updater->vcs()) |
| 37 | { |
| 38 | Q_ASSERT(m_vcs); |
| 39 | m_commitMessageWidget = new QWidget; |
| 40 | auto* layout = new QVBoxLayout(m_commitMessageWidget.data()); |
| 41 | layout->setContentsMargins(0, 0, 0, 0); |
| 42 | |
| 43 | m_commitMessageEdit = new KTextEdit; |
| 44 | m_commitMessageEdit.data()->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont)); |
| 45 | m_commitMessageEdit.data()->setLineWrapMode(QTextEdit::NoWrap); |
| 46 | m_vcs->setupCommitMessageEditor(updater->url(), m_commitMessageEdit.data()); |
| 47 | |
| 48 | auto* titleLayout = new QHBoxLayout; |
| 49 | titleLayout->addWidget(new QLabel(i18nc("@label:textbox", "Commit message:"))); |
| 50 | |
| 51 | m_oldMessages = new KComboBox(m_commitMessageWidget.data()); |
| 52 | |
| 53 | m_oldMessages->addItem(i18n("Old Messages")); |
| 54 | const auto oldMessages = this->oldMessages(); |
| 55 | for (const QString& message : oldMessages) { |
| 56 | m_oldMessages->addItem(message, message); |
| 57 | } |
| 58 | m_oldMessages->setMaximumWidth(200); |
| 59 | |
| 60 | connect(m_oldMessages, &QComboBox::currentTextChanged, |
| 61 | this, &VCSCommitDiffPatchSource::oldMessageChanged); |
| 62 | |
| 63 | titleLayout->addWidget(m_oldMessages); |
| 64 | |
| 65 | layout->addLayout(titleLayout); |
| 66 | layout->addWidget(m_commitMessageEdit.data()); |
| 67 | connect(this, &VCSCommitDiffPatchSource::reviewCancelled, this, &VCSCommitDiffPatchSource::addMessageToHistory); |
| 68 | connect(this, &VCSCommitDiffPatchSource::reviewFinished, this, &VCSCommitDiffPatchSource::addMessageToHistory); |
| 69 | } |
| 70 | |
| 71 | QStringList VCSCommitDiffPatchSource::oldMessages() const |
| 72 | { |
nothing calls this directly
no test coverage detected