Commit 7f200358 authored by hjk's avatar hjk Committed by Orgad Shaneh

Git: Replace two uses of QAction::setData

Change-Id: I540d1fd221cc331c230950cb97848e39780b650c
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
parent 8a3c5bc1
......@@ -242,22 +242,6 @@ void GitEditorWidget::revertChange()
sourceWorkingDirectory(), m_currentChange);
}
void GitEditorWidget::stageDiffChunk()
{
const QAction *a = qobject_cast<QAction *>(sender());
QTC_ASSERT(a, return);
const DiffChunk chunk = qvariant_cast<DiffChunk>(a->data());
return applyDiffChunk(chunk, false);
}
void GitEditorWidget::unstageDiffChunk()
{
const QAction *a = qobject_cast<QAction *>(sender());
QTC_ASSERT(a, return);
const DiffChunk chunk = qvariant_cast<DiffChunk>(a->data());
return applyDiffChunk(chunk, true);
}
void GitEditorWidget::applyDiffChunk(const DiffChunk& chunk, bool revert)
{
QTemporaryFile patchFile;
......@@ -303,12 +287,14 @@ void GitEditorWidget::addDiffActions(QMenu *menu, const DiffChunk &chunk)
menu->addSeparator();
QAction *stageAction = menu->addAction(tr("Stage Chunk..."));
stageAction->setData(qVariantFromValue(chunk));
connect(stageAction, &QAction::triggered, this, &GitEditorWidget::stageDiffChunk);
connect(stageAction, &QAction::triggered, this, [this, chunk] {
applyDiffChunk(chunk, false);
});
QAction *unstageAction = menu->addAction(tr("Unstage Chunk..."));
unstageAction->setData(qVariantFromValue(chunk));
connect(unstageAction, &QAction::triggered, this, &GitEditorWidget::unstageDiffChunk);
connect(unstageAction, &QAction::triggered, this, [this, chunk] {
applyDiffChunk(chunk, true);
});
}
bool GitEditorWidget::open(QString *errorString, const QString &fileName, const QString &realFileName)
......
......@@ -59,8 +59,6 @@ private slots:
void resetChange();
void cherryPickChange();
void revertChange();
void stageDiffChunk();
void unstageDiffChunk();
void applyDiffChunk(const VcsBase::DiffChunk& chunk, bool revert);
private:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment