VCS: Prevent display of "Describe Change" for invalid revision

Change-Id: I0e0d3429819c4dc72071106c680e9db5d4f5cd32
Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
This commit is contained in:
Orgad Shaneh
2012-07-29 17:56:59 +03:00
committed by Tobias Hunger
parent 686c085062
commit 3f74332f97

View File

@@ -337,26 +337,29 @@ void ChangeTextCursorHandler::handleCurrentContents()
void ChangeTextCursorHandler::fillContextMenu(QMenu *menu, EditorContentType type) const void ChangeTextCursorHandler::fillContextMenu(QMenu *menu, EditorContentType type) const
{ {
VcsBaseEditorWidget *widget = editorWidget();
switch (type) { switch (type) {
case LogOutput: { // Describe current / Annotate file of current case LogOutput: { // Describe current / Annotate file of current
menu->addSeparator(); menu->addSeparator();
menu->addAction(createCopyRevisionAction(m_currentChange)); menu->addAction(createCopyRevisionAction(m_currentChange));
menu->addAction(createDescribeAction(m_currentChange)); menu->addAction(createDescribeAction(m_currentChange));
if (editorWidget()->isFileLogAnnotateEnabled()) if (widget->isFileLogAnnotateEnabled())
menu->addAction(createAnnotateAction(m_currentChange, false)); menu->addAction(createAnnotateAction(m_currentChange, false));
break; break;
} }
case AnnotateOutput: { // Describe current / annotate previous case AnnotateOutput: { // Describe current / annotate previous
bool currentValid = widget->isValidRevision(m_currentChange);
menu->addSeparator(); menu->addSeparator();
menu->addAction(createCopyRevisionAction(m_currentChange)); menu->addAction(createCopyRevisionAction(m_currentChange));
menu->addAction(createDescribeAction(m_currentChange)); if (currentValid)
menu->addAction(createDescribeAction(m_currentChange));
menu->addSeparator(); menu->addSeparator();
if (editorWidget()->isValidRevision(m_currentChange)) if (currentValid)
menu->addAction(createAnnotateAction(editorWidget()->decorateVersion(m_currentChange), false)); menu->addAction(createAnnotateAction(widget->decorateVersion(m_currentChange), false));
const QStringList previousVersions = editorWidget()->annotationPreviousVersions(m_currentChange); const QStringList previousVersions = widget->annotationPreviousVersions(m_currentChange);
if (!previousVersions.isEmpty()) { if (!previousVersions.isEmpty()) {
foreach (const QString &pv, previousVersions) foreach (const QString &pv, previousVersions)
menu->addAction(createAnnotateAction(editorWidget()->decorateVersion(pv), true)); menu->addAction(createAnnotateAction(widget->decorateVersion(pv), true));
} }
break; break;
} }