Blob Blame Raw
diff -Nur qcad-2.0.4.0-1.src-orig/qcad/src/qc_applicationwindow.cpp qcad-2.0.4.0-1.src/qcad/src/qc_applicationwindow.cpp
--- qcad-2.0.4.0-1.src-orig/qcad/src/qc_applicationwindow.cpp	2004-09-14 22:13:07.000000000 +0200
+++ qcad-2.0.4.0-1.src/qcad/src/qc_applicationwindow.cpp	2005-04-05 15:40:25.000000000 +0200
@@ -27,6 +27,9 @@
 #include "qc_applicationwindow.h"
 
 #include <fstream>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <unistd.h>
 
 #include <qaccel.h>
 #include <qaction.h>
@@ -2774,11 +2777,44 @@
 #if QT_VERSION>=0x030200 
         assistant->setArguments(args);
 #endif
+        connect( assistant, SIGNAL(error(const QString&)), this, SLOT(slotAssistantError(const QString&)) );
     }
     assistant->openAssistant();
     //assistant->showPage("index.html");
 }
 
+void QC_ApplicationWindow::slotAssistantError(const QString&) {
+    if ( !assistant->isOpen() ) {
+        pid_t pid;
+	if ( (pid = fork()) < 0 ) {
+	    perror( "fork" );
+	    QMessageBox::critical( this, QC_APPNAME, "Could not fork child process." );
+	    return;
+	}
+	if ( pid==0 ) {  // child
+  	    pid_t gcpid;
+	    if ( (gcpid = fork()) < 0 ) {
+	        perror( "fork" );
+		_exit(1);
+	    }
+	    if ( gcpid==0 ) {  // grandchild
+	        char* argv[] = { "gnome-open",
+				 "/usr/share/qcad/doc/cad/index.html",
+				 0
+		};
+		execvp( argv[0], argv);
+		perror( "execvp" );
+		_exit(1);
+	    }
+	    int status;
+	    waitpid( pid, &status, 0 );
+	    _exit(0);
+	}
+	// parent
+	int status;
+	waitpid( pid, &status, 0 );
+    }
+}
 
 
 /**
diff -Nur qcad-2.0.4.0-1.src-orig/qcad/src/qc_applicationwindow.h qcad-2.0.4.0-1.src/qcad/src/qc_applicationwindow.h
--- qcad-2.0.4.0-1.src-orig/qcad/src/qc_applicationwindow.h	2004-09-14 22:13:07.000000000 +0200
+++ qcad-2.0.4.0-1.src/qcad/src/qc_applicationwindow.h	2005-02-14 23:03:46.000000000 +0100
@@ -224,6 +224,8 @@
     /** resizes window to 640x480 for screen shots */
     void slotTestResize1024();
 
+    void slotAssistantError(const QString&);
+
 signals:
     void gridChanged(bool on);
     void draftChanged(bool on);