changeset 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 50fccff7651c
children 0b657f4e7780
files libgui/src/m-editor/file-editor.cc
diffstat 1 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor.cc	Sun Aug 03 19:39:34 2014 -0400
+++ b/libgui/src/m-editor/file-editor.cc	Mon Aug 04 15:05:15 2014 -0400
@@ -261,7 +261,21 @@
       editor.replace ("%f", file_name);
       editor.replace ("%l", QString::number (line));
 
-      QProcess::startDetached (editor);
+      bool started_ok = QProcess::startDetached (editor);
+
+      if (started_ok != true)
+        {
+          QMessageBox *msgBox
+            = new QMessageBox (QMessageBox::Critical,
+                               tr ("Octave Editor"),
+                               tr ("Could not start custom file editor\n%1").
+                               arg (editor),
+                               QMessageBox::Ok, this);
+
+           msgBox->setWindowModality (Qt::NonModal);
+           msgBox->setAttribute (Qt::WA_DeleteOnClose);
+           msgBox->show ();
+        }
 
       if (line < 0 && ! file_name.isEmpty ())
         handle_mru_add_file (QFileInfo (file_name).canonicalFilePath ());