VCS: Fix context menu for custom editors

Change-Id: I44718dce73bbcd376d90fdf40f4bb5ab4c57443a
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
Orgad Shaneh
2013-06-02 23:06:55 +03:00
committed by Orgad Shaneh
parent 3f1901cb1f
commit a91219c636

View File

@@ -297,14 +297,6 @@ void ChangeTextCursorHandler::fillContextMenu(QMenu *menu, EditorContentType typ
{
VcsBaseEditorWidget *widget = editorWidget();
switch (type) {
case LogOutput: { // Describe current / Annotate file of current
menu->addSeparator();
menu->addAction(createCopyRevisionAction(m_currentChange));
menu->addAction(createDescribeAction(m_currentChange));
if (widget->isFileLogAnnotateEnabled())
menu->addAction(createAnnotateAction(m_currentChange, false));
break;
}
case AnnotateOutput: { // Describe current / annotate previous
bool currentValid = widget->isValidRevision(m_currentChange);
menu->addSeparator();
@@ -321,7 +313,12 @@ void ChangeTextCursorHandler::fillContextMenu(QMenu *menu, EditorContentType typ
}
break;
}
default:
default: // Describe current / Annotate file of current
menu->addSeparator();
menu->addAction(createCopyRevisionAction(m_currentChange));
menu->addAction(createDescribeAction(m_currentChange));
if (widget->isFileLogAnnotateEnabled())
menu->addAction(createAnnotateAction(m_currentChange, false));
break;
}
widget->addChangeActions(menu, m_currentChange);
@@ -921,17 +918,13 @@ void VcsBaseEditorWidget::contextMenuEvent(QContextMenuEvent *e)
{
QPointer<QMenu> menu = createStandardContextMenu();
// 'click on change-interaction'
switch (d->m_parameters->type) {
case LogOutput:
case AnnotateOutput: {
if (supportChangeLinks()) {
const QTextCursor cursor = cursorForPosition(e->pos());
Internal::AbstractTextCursorHandler *handler = d->findTextCursorHandler(cursor);
if (handler != 0)
if (Internal::AbstractTextCursorHandler *handler = d->findTextCursorHandler(cursor))
handler->fillContextMenu(menu, d->m_parameters->type);
// Fall-through for log (might have diff)
if (d->m_parameters->type != LogOutput)
break;
}
switch (d->m_parameters->type) {
case LogOutput: // log might have diff
case DiffOutput: {
menu->addSeparator();
connect(menu->addAction(tr("Send to CodePaster...")), SIGNAL(triggered()),