comparison libgui/src/m-editor/file-editor.cc @ 16638:3c2e457eeb72

ask for saving modified editor files if octave is closed (bug #38689) * files-editor-tab.cc(constrctor): init new flag indicating if app is closing, (check_file_modified): message box is modal if app is closing, no cancel, parent of box is the editor's tab widget for a correct palcement of the box, (conditional_close): new second arg: flag for closing app (default false), it is stored in the tab's class wide flag * file-editor-tab.h: second arg for conditional_close and new class wide flag * file-editor.cc(destructor): sending close requests to all editor tabs with flag indicating the application is closing (add_file_editor_tab): new arg for fetab_close_request and conditional_close * file-editor.h: new 2nd arg for fetab_close_request (closing app, def. false) * main-window.cc(destructor): delete editor window first for showing the message boxes for modified editor files in front of a complete gui
author Torsten <ttl@justmail.de>
date Sat, 11 May 2013 18:20:31 +0200
parents b3f4bdd7e5f4
children c6c4847aaf67
comparison
equal deleted inserted replaced
16637:b3f4bdd7e5f4 16638:3c2e457eeb72
69 p != editor_tab_map.end (); p++) 69 p != editor_tab_map.end (); p++)
70 fetFileNames.append (p->first); 70 fetFileNames.append (p->first);
71 71
72 settings->setValue ("editor/savedSessionTabs", fetFileNames); 72 settings->setValue ("editor/savedSessionTabs", fetFileNames);
73 settings->sync (); 73 settings->sync ();
74
75 for (int index = _tab_widget->count ()-1; index >= 0; index--)
76 emit fetab_close_request (_tab_widget->widget (index),true); // true: app closing
74 77
75 if (_mru_file_menu) 78 if (_mru_file_menu)
76 delete _mru_file_menu; 79 delete _mru_file_menu;
77 } 80 }
78 81
1081 1084
1082 // Signals from the file_editor non-trivial operations 1085 // Signals from the file_editor non-trivial operations
1083 connect (this, SIGNAL (fetab_settings_changed (const QSettings *)), 1086 connect (this, SIGNAL (fetab_settings_changed (const QSettings *)),
1084 f, SLOT (notice_settings (const QSettings *))); 1087 f, SLOT (notice_settings (const QSettings *)));
1085 1088
1086 connect (this, SIGNAL (fetab_close_request (const QWidget*)), 1089 connect (this, SIGNAL (fetab_close_request (const QWidget*,bool)),
1087 f, SLOT (conditional_close (const QWidget*))); 1090 f, SLOT (conditional_close (const QWidget*,bool)));
1088 1091
1089 connect (this, SIGNAL (fetab_change_request (const QWidget*)), 1092 connect (this, SIGNAL (fetab_change_request (const QWidget*)),
1090 f, SLOT (change_editor_state (const QWidget*))); 1093 f, SLOT (change_editor_state (const QWidget*)));
1091 1094
1092 connect (this, SIGNAL (fetab_file_name_query (const QWidget*)), 1095 connect (this, SIGNAL (fetab_file_name_query (const QWidget*)),