diff options
author | David Schulz <david.schulz@qt.io> | 2020-06-15 12:40:08 +0200 |
---|---|---|
committer | David Schulz <david.schulz@qt.io> | 2020-06-17 07:51:35 +0000 |
commit | 5f9198593105c6a5e1bef1dc77a4447ea5a2c704 (patch) | |
tree | f363cd981a48f61b2a733f742fcab6d18b39cbe0 /src/plugins/texteditor/texteditoractionhandler.cpp | |
parent | bdc8411af5d73187955e7d612b4795bab8049647 (diff) |
Editor: enable optional actions per editor
Use an additional action mask to enable actions like find usage and
rename symbol per editor instance.
Change-Id: Iabee1820d0f3c156ad30ba760bfce9f6181045e6
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/texteditor/texteditoractionhandler.cpp')
-rw-r--r-- | src/plugins/texteditor/texteditoractionhandler.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/plugins/texteditor/texteditoractionhandler.cpp b/src/plugins/texteditor/texteditoractionhandler.cpp index b04e89af32..23f0c640e9 100644 --- a/src/plugins/texteditor/texteditoractionhandler.cpp +++ b/src/plugins/texteditor/texteditoractionhandler.cpp @@ -543,20 +543,23 @@ void TextEditorActionHandlerPrivate::updateActions() void TextEditorActionHandlerPrivate::updateOptionalActions() { + uint optionalActions = m_optionalActions; + if (m_currentEditorWidget) + optionalActions |= m_currentEditorWidget->optionalActionMask(); m_followSymbolAction->setEnabled( - m_optionalActions & TextEditorActionHandler::FollowSymbolUnderCursor); + optionalActions & TextEditorActionHandler::FollowSymbolUnderCursor); m_followSymbolInNextSplitAction->setEnabled( - m_optionalActions & TextEditorActionHandler::FollowSymbolUnderCursor); + optionalActions & TextEditorActionHandler::FollowSymbolUnderCursor); m_jumpToFileAction->setEnabled( - m_optionalActions & TextEditorActionHandler::JumpToFileUnderCursor); + optionalActions & TextEditorActionHandler::JumpToFileUnderCursor); m_jumpToFileInNextSplitAction->setEnabled( - m_optionalActions & TextEditorActionHandler::JumpToFileUnderCursor); + optionalActions & TextEditorActionHandler::JumpToFileUnderCursor); m_unfoldAllAction->setEnabled( - m_optionalActions & TextEditorActionHandler::UnCollapseAll); + optionalActions & TextEditorActionHandler::UnCollapseAll); m_renameSymbolAction->setEnabled( - m_optionalActions & TextEditorActionHandler::RenameSymbol); + optionalActions & TextEditorActionHandler::RenameSymbol); - bool formatEnabled = (m_optionalActions & TextEditorActionHandler::Format) + bool formatEnabled = (optionalActions & TextEditorActionHandler::Format) && m_currentEditorWidget && !m_currentEditorWidget->isReadOnly(); m_autoIndentAction->setEnabled(formatEnabled); m_autoFormatAction->setEnabled(formatEnabled); @@ -599,6 +602,8 @@ void TextEditorActionHandlerPrivate::updateCurrentEditor(Core::IEditor *editor) this, &TextEditorActionHandlerPrivate::updateCopyAction); connect(editorWidget, &TextEditorWidget::readOnlyChanged, this, &TextEditorActionHandlerPrivate::updateActions); + connect(editorWidget, &TextEditorWidget::optionalActionMaskChanged, + this, &TextEditorActionHandlerPrivate::updateOptionalActions); } updateActions(); } |