Mercurial > octave
diff libgui/src/m-editor/file-editor.cc @ 27075:fb427fafd494
fix enabled copy action in editor without selected text
* file-editor.cc (file_editor): initialize boolean class variables for
storing the enable state of copy and undo actions;
(enable_menu_shortcuts): save enable state of copy and undo actions when
losing focus, restore in the other case;
(handle_editor_state_changed): store the enabled state for copy and undo
actions
* file-editor.h: new boolean class variables for storing the enable state
of copy and undo actions
author | Torsten Lilge <ttl-octave@mailbox.org> |
---|---|
date | Wed, 01 May 2019 12:33:55 +0200 |
parents | d302dfa0c572 |
children | 9326c2258e60 |
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor.cc Tue Apr 30 21:58:59 2019 +0200 +++ b/libgui/src/m-editor/file-editor.cc Wed May 01 12:33:55 2019 +0200 @@ -96,6 +96,9 @@ m_closed = false; m_no_focus = false; + m_copy_action_enabled = false; + m_undo_action_enabled = false; + construct (); // actions that should also be available in the find dialog @@ -349,10 +352,20 @@ // when editor loses focus, enable the actions, which are always active // in the main window due to missing info on selected text and undo actions - if (! enable && m_copy_action && m_undo_action) + if (m_copy_action && m_undo_action) { - m_copy_action->setEnabled (true); - m_undo_action->setEnabled (true); + if (enable) + { + m_copy_action->setEnabled (m_copy_action_enabled); + m_undo_action->setEnabled (m_undo_action_enabled); + } + else + { + m_copy_action_enabled = m_copy_action->isEnabled (); + m_undo_action_enabled = m_undo_action->isEnabled (); + m_copy_action->setEnabled (true); + m_undo_action->setEnabled (true); + } } } @@ -840,6 +853,9 @@ setFocusProxy (m_tab_widget->currentWidget ()); } + + m_copy_action_enabled = m_copy_action->isEnabled (); + m_undo_action_enabled = m_undo_action->isEnabled (); } void file_editor::handle_mru_add_file (const QString& file_name,