Mercurial > hg > octave-nkf
diff libgui/src/m-editor/file-editor-tab.cc @ 19136:0be65bd7f369 gui-release
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
author | Torsten <ttl@justmail.de> |
---|---|
date | Sun, 20 Jul 2014 21:23:32 +0200 (2014-07-20) |
parents | b43157d085ba |
children | e87e65bc71ae |
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-tab.cc +++ b/libgui/src/m-editor/file-editor-tab.cc @@ -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