Commit f6f822f5 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh
Browse files

VCS: Remove Apply/Revert Chunk when they are not applicable

Having disabled entries in a context menu without any additional
information why they are disabled is confusing

Change-Id: Idb3d5a7befe57b84adb2f7cb58b2cbc1331039ec
Reviewed-by: default avatarTobias Hunger <>
parent 7fb9f7b8
......@@ -934,23 +934,22 @@ void VcsBaseEditorWidget::contextMenuEvent(QContextMenuEvent *e)
// Apply/revert diff chunk.
const DiffChunk chunk = diffChunk(cursorForPosition(e->pos()));
const bool canApply = canApplyDiffChunk(chunk);
if (!canApplyDiffChunk(chunk))
// Apply a chunk from a diff loaded into the editor. This typically will
// not have the 'source' property set and thus will only work if the working
// directory matches that of the patch (see findDiffFile()). In addition,
// the user has "Open With" and choose the right diff editor so that
// fileNameFromDiffSpecification() works.
QAction *applyAction = menu->addAction(tr("Apply Chunk..."));
applyAction->setData(qVariantFromValue(Internal::DiffChunkAction(chunk, false)));
connect(applyAction, SIGNAL(triggered()), this, SLOT(slotApplyDiffChunk()));
// Revert a chunk from a VCS diff, which might be linked to reloading the diff.
QAction *revertAction = menu->addAction(tr("Revert Chunk..."));
revertAction->setData(qVariantFromValue(Internal::DiffChunkAction(chunk, true)));
connect(revertAction, SIGNAL(triggered()), this, SLOT(slotApplyDiffChunk()));
Supports Markdown
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