diff options
Diffstat (limited to 'kdpkg-install/console.cpp')
-rw-r--r-- | kdpkg-install/console.cpp | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/kdpkg-install/console.cpp b/kdpkg-install/console.cpp index cc6f450..f1dfaa9 100644 --- a/kdpkg-install/console.cpp +++ b/kdpkg-install/console.cpp @@ -28,21 +28,51 @@ #include <qwidgetstack.h> #include <qlistview.h> #include <qtextedit.h> +#include <qstring.h> #include <qlabel.h> #include <qpushbutton.h> #include "console.h" +#include <string> +#include <stdio.h> + +using namespace std; + console::console(QWidget *parent, const QStrList &run, const char *name, const QStringList &) : Widget(parent,name) { + + // Get KDE prefix + // FIXME Is there a better way to do this??? + string prefixcommand="kde-config --prefix"; + FILE *pipe_prefix; + char prefix_result[2048]; + int i; + + if ((pipe_prefix = popen(prefixcommand.c_str(), "r")) == NULL) + { + m_kdePrefix = "/usr"; + } + else { + fgets(prefix_result, 2048, pipe_prefix); + pclose(pipe_prefix); + for (i=0;i<2048;i++) { + if (prefix_result[i] == 0) { + prefix_result[i-1]=0; + i=2048; + } + } + m_kdePrefix = QString(prefix_result); + } + //label->setText( name ); loadKonsole(); konsoleFrame->installEventFilter( this ); // run command - terminal()->startProgram( "/usr/share/kdpkg/sh/kdpkg-sh", run ); + terminal()->startProgram( m_kdePrefix + "/share/kdpkg/sh/kdpkg-sh", run ); connect( konsole, SIGNAL(destroyed()), this, SLOT( finish() ) ); } |