# HG changeset patch # User Torsten # Date 1405884212 -7200 # Node ID 0be65bd7f369aed9e72f5e1a0e93439076df188e # Parent d2100cb2331a867a320ea669ab5edc16efc75c7a add an user preference for loading changed files without a prompt (bug #42678) * file-editor-tab.cc (file_has_changed): check user preference before prompting for reloading the file; (notice-settings): get flag for prompting before reloading file from settings; * file-editor-tab.h: new flag _always_reload_changed files * settings-dialog.ui: new check box for new preference * settings-dialog.cc (constructor): get state of new check box from settings; (write_changes_settings): write state of new check box into settings diff -r d2100cb2331a -r 0be65bd7f369 libgui/src/m-editor/file-editor-tab.cc --- a/libgui/src/m-editor/file-editor-tab.cc Sun Jul 20 20:52:08 2014 +0200 +++ b/libgui/src/m-editor/file-editor-tab.cc Sun Jul 20 21:23:32 2014 +0200 @@ -1432,21 +1432,28 @@ if (QFile::exists (_file_name)) { - // Create a WindowModal message that blocks the edit area - // by making _edit_area parent. - QMessageBox* msgBox - = new QMessageBox (QMessageBox::Warning, - tr ("Octave Editor"), - tr ("It seems that \'%1\' has been modified by another application. Do you want to reload it?"). - arg (_file_name), - QMessageBox::Yes | QMessageBox::No, this); + if (_always_reload_changed_files) + + load_file (_file_name); - connect (msgBox, SIGNAL (finished (int)), - this, SLOT (handle_file_reload_answer (int))); + else + { + // Create a WindowModal message that blocks the edit area + // by making _edit_area parent. + QMessageBox* msgBox + = new QMessageBox (QMessageBox::Warning, + tr ("Octave Editor"), + tr ("It seems that \'%1\' has been modified by another application. Do you want to reload it?"). + arg (_file_name), + QMessageBox::Yes | QMessageBox::No, this); - msgBox->setWindowModality (Qt::WindowModal); - msgBox->setAttribute (Qt::WA_DeleteOnClose); - msgBox->show (); + connect (msgBox, SIGNAL (finished (int)), + this, SLOT (handle_file_reload_answer (int))); + + msgBox->setWindowModality (Qt::WindowModal); + msgBox->setAttribute (Qt::WA_DeleteOnClose); + msgBox->show (); + } } else { @@ -1577,6 +1584,9 @@ else _edit_area->setEdgeMode (QsciScintilla::EdgeNone); + // reload changed files + _always_reload_changed_files = + settings->value ("editor/always_reload_changed_files",false).toBool (); } void diff -r d2100cb2331a -r 0be65bd7f369 libgui/src/m-editor/file-editor-tab.h --- a/libgui/src/m-editor/file-editor-tab.h Sun Jul 20 20:52:08 2014 +0200 +++ b/libgui/src/m-editor/file-editor-tab.h Sun Jul 20 21:23:32 2014 +0200 @@ -224,6 +224,7 @@ bool _app_closing; bool _is_octave_file; bool _modal_dialog; + bool _always_reload_changed_files; QFileSystemWatcher _file_system_watcher; diff -r d2100cb2331a -r 0be65bd7f369 libgui/src/settings-dialog.cc --- a/libgui/src/settings-dialog.cc Sun Jul 20 20:52:08 2014 +0200 +++ b/libgui/src/settings-dialog.cc Sun Jul 20 21:23:32 2014 +0200 @@ -206,6 +206,8 @@ settings->value ("editor/restoreSession", true).toBool ()); ui->editor_create_new_file->setChecked ( settings->value ("editor/create_new_file",false).toBool ()); + ui->editor_reload_changed_files->setChecked ( + settings->value ("editor/always_reload_changed_files",false).toBool ()); // terminal ui->terminal_fontName->setCurrentFont (QFont ( @@ -649,6 +651,8 @@ ui->editor_restoreSession->isChecked ()); settings->setValue ("editor/create_new_file", ui->editor_create_new_file->isChecked ()); + settings->setValue ("editor/always_reload_changed_files", + ui->editor_reload_changed_files->isChecked ()); settings->setValue ("terminal/fontSize", ui->terminal_fontSize->value ()); settings->setValue ("terminal/fontName", ui->terminal_fontName->currentFont ().family ()); diff -r d2100cb2331a -r 0be65bd7f369 libgui/src/settings-dialog.ui --- a/libgui/src/settings-dialog.ui Sun Jul 20 20:52:08 2014 +0200 +++ b/libgui/src/settings-dialog.ui Sun Jul 20 21:23:32 2014 +0200 @@ -404,9 +404,9 @@ 0 - -146 + -175 662 - 553 + 580 @@ -1083,6 +1083,13 @@ + + + + Reload externally changed files without prompt + + +