diff libgui/src/m-editor/file-editor-tab.cc @ 29698:bbf5d4ea616c

fix enabled state of editor save action depending on modification state * file-editor-tab.cc (set_file_name): signal editor_state_changed with additional boolean argument with modification state; (handle_copy_available): dito; (change_editor_state): dito * file-editor-tab.h: dito * file-editor.cc (file_editor): initialize new class variable m_current_tab_modified with modified state of current tab; (check_actions): enable save action depending on modification state (handle_file_name_changed): enable save action and set class related class variable; (handle_editor_state_changed): additional boolean argument with modification state, enable save action accordingly and set the related class variable * file-editor.h: handle_editor_state_changed with third argument, new class variable
author Torsten Lilge <ttl-octave@mailbox.org>
date Mon, 24 May 2021 20:05:23 +0200
parents ce4436d2b206
children 81be7e4ddb0f
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-tab.cc	Fri May 21 17:00:54 2021 +0200
+++ b/libgui/src/m-editor/file-editor-tab.cc	Mon May 24 20:05:23 2021 +0200
@@ -504,7 +504,8 @@
       }
 
     // update the file editor with current editing directory
-    emit editor_state_changed (m_copy_available, m_is_octave_file);
+    emit editor_state_changed (m_copy_available, m_is_octave_file,
+                               m_edit_area->isModified ());
 
     // add the new file to the most-recently-used list
     emit mru_add_file (m_file_name, m_encoding);
@@ -1645,7 +1646,8 @@
   void file_editor_tab::handle_copy_available (bool enableCopy)
   {
     m_copy_available = enableCopy;
-    emit editor_state_changed (m_copy_available, m_is_octave_file);
+    emit editor_state_changed (m_copy_available, m_is_octave_file,
+                               m_edit_area->isModified ());
   }
 
   // show_dialog: shows a modal or non modal dialog depending on input arg
@@ -2818,7 +2820,8 @@
     if (ID != this)
       return;
 
-    emit editor_state_changed (m_copy_available, m_is_octave_file);
+    emit editor_state_changed (m_copy_available, m_is_octave_file,
+                               m_edit_area->isModified ());
   }
 
   void file_editor_tab::handle_file_reload_answer (int decision)