Mercurial > hg > octave-nkf
diff libgui/src/m-editor/file-editor-tab.cc @ 19027:08d7dbd728bc gui-release
save a new file before trying to run it from the editor (bug #42571)
* file-editor-tab.h: new flag for modal/modeless file dialogs
* file-editor-tab.cc (constructor): iniitalize new flag to its default value,
(run_file): set dialogs to modeless before saving the file preventing running
the file before saving is complete,
(show_dialog): set mode of dialog corresponding to the new flag
author | Torsten <ttl@justmail.de> |
---|---|
date | Mon, 16 Jun 2014 20:30:28 +0200 |
parents | 0e6f7b5f6556 |
children | b43157d085ba |
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-tab.cc +++ b/libgui/src/m-editor/file-editor-tab.cc @@ -69,6 +69,7 @@ _lexer_apis = 0; _app_closing = false; _is_octave_file = true; + _modal_dialog = false; // Make sure there is a slash at the end of the directory name // for identification when saved later. @@ -573,7 +574,11 @@ return; if (_edit_area->isModified ()) - save_file (_file_name); + { + _modal_dialog = true; // force modal dialog if the file is a new one + save_file (_file_name); // save file dialog + _modal_dialog = false; // back to non-modal dialogs + } QFileInfo info (_file_name); emit run_file_signal (info); @@ -1077,12 +1082,12 @@ } // show_dialog: shows a modal or non modal dialog depeding on the closing -// of the app +// of the app and the flag _modal_dialog void file_editor_tab::show_dialog (QDialog *dlg) { dlg->setAttribute (Qt::WA_DeleteOnClose); - if (_app_closing) + if (_app_closing | _modal_dialog) dlg->exec (); else {