From a01035fefb6a9f877ac86c332c102e397bf93ba3 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Fri, 28 Feb 2020 10:03:11 +0200 Subject: [PATCH] VcsBaseEditor: Highlight default actions on context menu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Idc493658dbc829394bd2898a59ba5686036bc3fe Reviewed-by: André Hartmann --- src/plugins/vcsbase/vcsbaseeditor.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/plugins/vcsbase/vcsbaseeditor.cpp b/src/plugins/vcsbase/vcsbaseeditor.cpp index 5338580354c..5dc03df32eb 100644 --- a/src/plugins/vcsbase/vcsbaseeditor.cpp +++ b/src/plugins/vcsbase/vcsbaseeditor.cpp @@ -255,7 +255,7 @@ private slots: void slotCopyRevision(); private: - QAction *createDescribeAction(const QString &change) const; + void addDescribeAction(QMenu *menu, const QString &change) const; QAction *createAnnotateAction(const QString &change, bool previous) const; QAction *createCopyRevisionAction(const QString &change) const; @@ -299,7 +299,7 @@ void ChangeTextCursorHandler::fillContextMenu(QMenu *menu, EditorContentType typ menu->addSeparator(); menu->addAction(createCopyRevisionAction(m_currentChange)); if (currentValid) - menu->addAction(createDescribeAction(m_currentChange)); + addDescribeAction(menu, m_currentChange); menu->addSeparator(); if (currentValid) menu->addAction(createAnnotateAction(widget->decorateVersion(m_currentChange), false)); @@ -313,7 +313,7 @@ void ChangeTextCursorHandler::fillContextMenu(QMenu *menu, EditorContentType typ default: // Describe current / Annotate file of current menu->addSeparator(); menu->addAction(createCopyRevisionAction(m_currentChange)); - menu->addAction(createDescribeAction(m_currentChange)); + addDescribeAction(menu, m_currentChange); if (widget->isFileLogAnnotateEnabled()) menu->addAction(createAnnotateAction(m_currentChange, false)); break; @@ -336,11 +336,12 @@ void ChangeTextCursorHandler::slotCopyRevision() QApplication::clipboard()->setText(m_currentChange); } -QAction *ChangeTextCursorHandler::createDescribeAction(const QString &change) const +void ChangeTextCursorHandler::addDescribeAction(QMenu *menu, const QString &change) const { auto a = new QAction(VcsBaseEditorWidget::tr("&Describe Change %1").arg(change), nullptr); connect(a, &QAction::triggered, this, &ChangeTextCursorHandler::slotDescribe); - return a; + menu->addAction(a); + menu->setDefaultAction(a); } QAction *ChangeTextCursorHandler::createAnnotateAction(const QString &change, bool previous) const