comparison libgui/src/m-editor/file-editor.cc @ 18983:724fc0a9eeb1 gui-release

gui: notify user if custom editor failed to start * libgui/src/m-editor/file-editor.cc (file_editor::call_custom_editor): check status of starting custom file editor, and show message box if it did not start.
author John Donoghue
date Mon, 04 Aug 2014 15:05:15 -0400
parents 12462638ab20
children
comparison
equal deleted inserted replaced
18980:50fccff7651c 18983:724fc0a9eeb1
259 { 259 {
260 QString editor = settings->value ("customFileEditor").toString (); 260 QString editor = settings->value ("customFileEditor").toString ();
261 editor.replace ("%f", file_name); 261 editor.replace ("%f", file_name);
262 editor.replace ("%l", QString::number (line)); 262 editor.replace ("%l", QString::number (line));
263 263
264 QProcess::startDetached (editor); 264 bool started_ok = QProcess::startDetached (editor);
265
266 if (started_ok != true)
267 {
268 QMessageBox *msgBox
269 = new QMessageBox (QMessageBox::Critical,
270 tr ("Octave Editor"),
271 tr ("Could not start custom file editor\n%1").
272 arg (editor),
273 QMessageBox::Ok, this);
274
275 msgBox->setWindowModality (Qt::NonModal);
276 msgBox->setAttribute (Qt::WA_DeleteOnClose);
277 msgBox->show ();
278 }
265 279
266 if (line < 0 && ! file_name.isEmpty ()) 280 if (line < 0 && ! file_name.isEmpty ())
267 handle_mru_add_file (QFileInfo (file_name).canonicalFilePath ()); 281 handle_mru_add_file (QFileInfo (file_name).canonicalFilePath ());
268 282
269 return true; 283 return true;