diff options
author | Eike Ziller <eike.ziller@digia.com> | 2013-12-10 15:54:20 +0100 |
---|---|---|
committer | Eike Ziller <eike.ziller@digia.com> | 2013-12-12 09:59:27 +0100 |
commit | 3d1b70c58e0d2eea47572ec4a018a18674508f9b (patch) | |
tree | 2217255fb7d6bc8e3e30603bb985cb655ab7be7d /src/plugins/texteditor/texteditoractionhandler.h | |
parent | 3ee9fb4d1c74058c785f24d19bac5fe879c75109 (diff) |
Remove the need to register editors in the action handler
The action handler already knows which editors to handle through the
context. It only needs to receive signals for updating the actions from
the current editor. So there is no need to tell the action handler about
every individual editor. This also removes some noise from the text
editor implementations.
Change-Id: I76dc5b1559cc8cf54ff313e6cdba4e789a3108aa
Reviewed-by: David Schulz <david.schulz@digia.com>
Diffstat (limited to 'src/plugins/texteditor/texteditoractionhandler.h')
-rw-r--r-- | src/plugins/texteditor/texteditoractionhandler.h | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/src/plugins/texteditor/texteditoractionhandler.h b/src/plugins/texteditor/texteditoractionhandler.h index 48f79408e0..eaea4735cf 100644 --- a/src/plugins/texteditor/texteditoractionhandler.h +++ b/src/plugins/texteditor/texteditoractionhandler.h @@ -68,20 +68,10 @@ public: explicit TextEditorActionHandler(Core::Id contextId, uint optionalActions = None); ~TextEditorActionHandler(); - void setupActions(BaseTextEditorWidget *editor); - - void initializeActions(); - -public slots: - void updateActions(); - void updateRedoAction(); - void updateUndoAction(); - void updateCopyAction(); - protected: virtual BaseTextEditorWidget *resolveTextEditorWidget(Core::IEditor *editor) const; - const QPointer<BaseTextEditorWidget> ¤tEditor() const; +private: QAction *registerAction(const Core::Id &id, const char *slot, bool scriptable = false, @@ -90,13 +80,14 @@ protected: const char *menueGroup = 0, Core::ActionContainer *container = 0); - enum UpdateMode { ReadOnlyMode, WriteMode }; - UpdateMode updateMode() const; - void createActions(); - void updateActions(UpdateMode um); private slots: + void updateActions(); + void updateRedoAction(); + void updateUndoAction(); + void updateCopyAction(); + void undoAction(); void redoAction(); void copyAction(); @@ -225,9 +216,8 @@ private: QList<QAction *> m_modifyingActions; uint m_optionalActions; - QPointer<BaseTextEditorWidget> m_currentEditor; + QPointer<BaseTextEditorWidget> m_currentEditorWidget; Core::Id m_contextId; - bool m_initialized; }; } // namespace TextEditor |