diff libgui/src/m-editor/file-editor-tab.cc @ 27633:fd009322dd9f

eliminate static variable in file_editor_tab class * file_editor_tab.h, file_editor_tab.cc (file_editor_tab::m_cancelled): Delete static variable and all uses. (file_editor_tab::reset_cancel, file_editor_tab::was_cancelled): Delete static functions. (file_editor_tab::check_modified_file): Delete slot. (file_editor_tab::check_file_modified): Declare public. * file-editor.h, file-editor.cc (file_editor_tab_widget::tab_list): New function to get list of widgets managed by QTabWidget object directly. (file_editor::check_closing): Directly loop over list of widgets to check for closing status. Break from loop if closing is canceled. (file_editor::fetab_check_modified_file): Delete signal. (file_editor::make_file_editor_tab): Delete connection from fetab_check_modified_file to check_modified_file.
author John W. Eaton <jwe@octave.org>
date Mon, 04 Nov 2019 17:05:09 -0500
parents 8b6e928e0705
children a18081db8fa3
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-tab.cc	Mon Nov 04 12:22:23 2019 -0800
+++ b/libgui/src/m-editor/file-editor-tab.cc	Mon Nov 04 17:05:09 2019 -0500
@@ -86,8 +86,6 @@
 
 namespace octave
 {
-  bool file_editor_tab::m_cancelled = false;
-
   //! A file_editor_tab object consists of a text area and three left margins.
   //! The first holds breakpoints, bookmarks, and the debug program counter.
   //! The second holds line numbers.  The third holds "fold" marks, to hide
@@ -309,9 +307,6 @@
 
   void file_editor_tab::closeEvent (QCloseEvent *e)
   {
-    m_cancelled = false;  // prevent unwanted interaction of previous
-    // exits of octave which were canceled by the user
-
     int save_dialog = check_file_modified (true);
     if ((save_dialog == QMessageBox::Cancel) ||
         (save_dialog == QMessageBox::Save))
@@ -1001,15 +996,6 @@
     m_edit_area->context_edit ();
   }
 
-  void file_editor_tab::check_modified_file (void)
-  {
-    if (m_cancelled)
-      return;
-
-    if (check_file_modified (false) == QMessageBox::Cancel)
-      m_cancelled = true;
-  }
-
   void file_editor_tab::save_file (const QWidget *ID)
   {
     if (ID != this)
@@ -1875,10 +1861,7 @@
         decision = msgBox->exec (); // show_dialog (msgBox, true);
 
         if (decision == QMessageBox::Cancel)
-          {
-            m_cancelled = true;
-            m_edit_area->setReadOnly (false);
-          }
+          m_edit_area->setReadOnly (false);
         else if (decision == QMessageBox::Save)
           save_file (m_file_name, remove, false);   // Remove on success
       }