diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index 268f265f2e0..731e0bd383a 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -2446,7 +2446,6 @@ BaseTextEditorWidgetPrivate::BaseTextEditorWidgetPrivate() m_linkPressed(false), m_delayedUpdateTimer(0), m_editor(0), - m_actionHack(0), m_inBlockSelectionMode(false), m_moveLineUndoHack(false), m_findScopeVerticalBlockSelectionFirstColumn(-1), @@ -5177,16 +5176,6 @@ void BaseTextEditorWidget::_q_highlightBlocks() } } -void BaseTextEditorWidget::setActionHack(QObject *hack) -{ - d->m_actionHack = hack; -} - -QObject *BaseTextEditorWidget::actionHack() const -{ - return d->m_actionHack; -} - void BaseTextEditorWidget::changeEvent(QEvent *e) { QPlainTextEdit::changeEvent(e); diff --git a/src/plugins/texteditor/basetexteditor.h b/src/plugins/texteditor/basetexteditor.h index 9ce78d77834..a1e7ed276f7 100644 --- a/src/plugins/texteditor/basetexteditor.h +++ b/src/plugins/texteditor/basetexteditor.h @@ -208,9 +208,6 @@ public: int columnCount() const; int rowCount() const; - void setActionHack(QObject *hack); - QObject *actionHack() const; - void setReadOnly(bool b); void setTextCursor(const QTextCursor &cursor); diff --git a/src/plugins/texteditor/basetexteditor_p.h b/src/plugins/texteditor/basetexteditor_p.h index e21677de32c..c970d6bc199 100644 --- a/src/plugins/texteditor/basetexteditor_p.h +++ b/src/plugins/texteditor/basetexteditor_p.h @@ -195,8 +195,6 @@ public: BaseTextEditor *m_editor; - QObject *m_actionHack; - QList m_extraSelections[BaseTextEditorWidget::NExtraSelectionKinds]; // block selection mode diff --git a/src/plugins/texteditor/texteditoractionhandler.cpp b/src/plugins/texteditor/texteditoractionhandler.cpp index 70d6ff508c2..7ba34667107 100644 --- a/src/plugins/texteditor/texteditoractionhandler.cpp +++ b/src/plugins/texteditor/texteditoractionhandler.cpp @@ -49,8 +49,7 @@ using namespace TextEditor; using namespace TextEditor::Internal; -TextEditorActionHandler::TextEditorActionHandler(const char *context, - uint optionalActions) +TextEditorActionHandler::TextEditorActionHandler(Core::Id contextId, uint optionalActions) : QObject(Core::ICore::instance()), m_undoAction(0), m_redoAction(0), @@ -104,7 +103,7 @@ TextEditorActionHandler::TextEditorActionHandler(const char *context, m_jumpToFileInNextSplitAction(0), m_optionalActions(optionalActions), m_currentEditor(0), - m_contextId(context), + m_contextId(contextId), m_initialized(false) { connect(Core::EditorManager::instance(), SIGNAL(currentEditorChanged(Core::IEditor*)), @@ -118,7 +117,6 @@ TextEditorActionHandler::~TextEditorActionHandler() void TextEditorActionHandler::setupActions(BaseTextEditorWidget *editor) { initializeActions(); - editor->setActionHack(this); QObject::connect(editor, SIGNAL(undoAvailable(bool)), this, SLOT(updateUndoAction())); QObject::connect(editor, SIGNAL(redoAvailable(bool)), this, SLOT(updateRedoAction())); QObject::connect(editor, SIGNAL(copyAvailable(bool)), this, SLOT(updateCopyAction())); @@ -382,7 +380,7 @@ QAction *TextEditorActionHandler::registerAction(const Core::Id &id, Core::ActionContainer *container) { QAction *result = new QAction(title, this); - Core::Command *command = Core::ActionManager::registerAction(result, id, m_contextId, scriptable); + Core::Command *command = Core::ActionManager::registerAction(result, id, Core::Context(m_contextId), scriptable); if (!keySequence.isEmpty()) command->setDefaultKeySequence(keySequence); @@ -570,15 +568,15 @@ void TextEditorActionHandler::updateCurrentEditor(Core::IEditor *editor) { m_currentEditor = 0; - if (!editor) + if (!editor || !editor->context().contains(m_contextId)) return; BaseTextEditorWidget *baseEditor = resolveTextEditorWidget(editor); - if (baseEditor && baseEditor->actionHack() == this) { - m_currentEditor = baseEditor; - updateActions(); - } + if (!baseEditor) + return; + m_currentEditor = baseEditor; + updateActions(); } const QPointer &TextEditorActionHandler::currentEditor() const diff --git a/src/plugins/texteditor/texteditoractionhandler.h b/src/plugins/texteditor/texteditoractionhandler.h index a09e6a3a84e..48f79408e00 100644 --- a/src/plugins/texteditor/texteditoractionhandler.h +++ b/src/plugins/texteditor/texteditoractionhandler.h @@ -65,7 +65,7 @@ public: JumpToFileUnderCursor = 16 }; - explicit TextEditorActionHandler(const char *context, uint optionalActions = None); + explicit TextEditorActionHandler(Core::Id contextId, uint optionalActions = None); ~TextEditorActionHandler(); void setupActions(BaseTextEditorWidget *editor); @@ -226,7 +226,7 @@ private: uint m_optionalActions; QPointer m_currentEditor; - Core::Context m_contextId; + Core::Id m_contextId; bool m_initialized; };