Mercurial > octave
diff libgui/src/m-editor/file-editor.h @ 27605:60cecb3fed04
fix saving modified files when closing editor tabs or octave
* file-editor-tab.cc (closeEvent) also ignore evnet when file has
to be saved, it is directly removed after saving now; in case closing is
accepted, emit the related signal to the editor;
(check_modified_file): call check_file_modified with false as new boolean
parameter indicating that file should not be closed afterwards
(check_file_modified): new boolean parameter for removing the file after
checking for modification and possibly saving; use exec for the dialog
for directly getting the result without extra finish signal/slot; if
desired, call save_file from here;
(handle_file_modified_answer): removed obsolete slot for dialog result
(do_save_file): emit signal that tab could be closed now
* file-editor-tab.h: new signal tab_ready_to_close, removed slo
handle_file_modified_answer, slot check_file_modified with new
boolean parameter
* file-editor.cc (check_closing): if closing is not canceled connect
tab signals on being ready to close instead of directly closing all tabs
and store the number of tabs that have to be closed;
(handle_tab_ready_to_close): slot for tab ready to close signal, decreasing
number of tabs to be closed until it reaches zero and then close all tabs
and the editor itself;
(closeEvent): ignore event even when all tabs should be closed because
editor will close itself after all tabs are closed
* file-editor.h: new slot handle_tab_ready_to_close, new class variable
m_number_of_tabs for the number of tabs, for which the editor has to
wait for closing
author | Torsten Lilge <ttl-octave@mailbox.org> |
---|---|
date | Fri, 01 Nov 2019 09:26:22 +0100 |
parents | da1f59fe04b3 |
children | 0495b64288f7 |
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor.h Thu Oct 31 15:42:13 2019 -0400 +++ b/libgui/src/m-editor/file-editor.h Fri Nov 01 09:26:22 2019 +0100 @@ -187,6 +187,7 @@ void set_focus (QWidget *fet); void enable_menu_shortcuts (bool); bool check_closing (void); + void handle_tab_ready_to_close (void); void request_new_file (const QString& commands); void request_close_file (bool); @@ -342,6 +343,7 @@ QMenu * add_menu (QMenuBar *p, QString text); + int m_number_of_tabs; std::map<QString, tab_info> m_editor_tab_map; QHash<QMenu*, QStringList> m_hash_menu_text;