# HG changeset patch # User Torsten # Date 1502577205 -7200 # Node ID b41792547237f05c02f362304b6f4d02fe50fbb4 # Parent 5c588c422e75ac5cd0e34be096ac8c72fe62f5a7 fix editor behavior when files are externally changed/removed * file-editor-tab.cc (file_has_changed): new boolean paramter for closing the file, string parameter is used by signal from file system watcher and must not be used for closing the file * file-editor-tab.h: new boolean parameter for closing, per default false for the signals from the file system watcher diff -r 5c588c422e75 -r b41792547237 libgui/src/m-editor/file-editor-tab.cc --- a/libgui/src/m-editor/file-editor-tab.cc Sat Aug 12 14:02:29 2017 -0700 +++ b/libgui/src/m-editor/file-editor-tab.cc Sun Aug 13 00:33:25 2017 +0200 @@ -2226,7 +2226,7 @@ } void -file_editor_tab::file_has_changed (const QString& do_close) +file_editor_tab::file_has_changed (const QString&, bool do_close) { // Prevent popping up multiple message boxes when the file has // been changed multiple times by temporarily removing from the @@ -2235,7 +2235,7 @@ if (! trackedFiles.isEmpty ()) _file_system_watcher.removePath (_file_name); - if (QFile::exists (_file_name) && do_close.isEmpty ()) + if (QFile::exists (_file_name) && ! do_close) { // The file is modified if (_always_reload_changed_files) @@ -2270,7 +2270,7 @@ { // If desired and if file is not modified, // close the file without any user interaction - if (! do_close.isEmpty () && ! _edit_area->isModified ()) + if (do_close && ! _edit_area->isModified ()) { handle_file_resave_answer (QMessageBox::Cancel); return; diff -r 5c588c422e75 -r b41792547237 libgui/src/m-editor/file-editor-tab.h --- a/libgui/src/m-editor/file-editor-tab.h Sat Aug 12 14:02:29 2017 -0700 +++ b/libgui/src/m-editor/file-editor-tab.h Sun Aug 13 00:33:25 2017 +0200 @@ -136,7 +136,7 @@ void new_file (const QString& commands = QString ()); - void file_has_changed (const QString& do_close); + void file_has_changed (const QString& path, bool do_close = false); void handle_context_menu_edit (const QString&); void handle_context_menu_break_condition (int linenr); diff -r 5c588c422e75 -r b41792547237 libgui/src/m-editor/file-editor.cc --- a/libgui/src/m-editor/file-editor.cc Sat Aug 12 14:02:29 2017 -0700 +++ b/libgui/src/m-editor/file-editor.cc Sun Aug 13 00:33:25 2017 +0200 @@ -602,7 +602,7 @@ if (editor_tab) { _external_close_request = true; // Remember for not focussing editor - editor_tab->file_has_changed ("close"); // Close the tab + editor_tab->file_has_changed (QString (), true); // Close the tab _external_close_request = false; // Back to normal } }