author | tille <tille> | 2002-07-19 12:44:48 (UTC) |
---|---|---|
committer | tille <tille> | 2002-07-19 12:44:48 (UTC) |
commit | 8a1649fdf89b0bdc09869e0cc7cebe0d40ce1b19 (patch) (side-by-side diff) | |
tree | 80226f49cd3d881d9e5b7eec1cc53ebbe9a46276 /noncore/unsupported/oipkg/pmipkg.cpp | |
parent | c100ad1cb7db849aec5b9baa7df1a88980602688 (diff) | |
download | opie-8a1649fdf89b0bdc09869e0cc7cebe0d40ce1b19.zip opie-8a1649fdf89b0bdc09869e0cc7cebe0d40ce1b19.tar.gz opie-8a1649fdf89b0bdc09869e0cc7cebe0d40ce1b19.tar.bz2 |
fixes bug #131
ipkg commandstring moved to conf file
Diffstat (limited to 'noncore/unsupported/oipkg/pmipkg.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 74 |
1 files changed, 5 insertions, 69 deletions
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index bffad15..a7deb8f 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp @@ -9,13 +9,13 @@ // (c) 2002 Patrick S. Vogt <tille@handhelds.org> #include "pmipkg.h" #include "pksettings.h" #include "package.h" #include "packagelistitem.h" -#include <opie/oprocess.h> +//#include <opie/oprocess.h> #include <qpe/resource.h> #include <qpe/config.h> #include <qpe/stringutil.h> #include <qpe/qpeapplication.h> #include <qdir.h> #include <qfile.h> @@ -33,48 +33,33 @@ #include <stdlib.h> #include <unistd.h> #include "mainwindow.h" -//#define OPROCESS PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) : QObject ( p ) { settings = s; runwindow = new RunWindow( p, name, true, f ); -#ifdef OPROCESS - ipkgProcess = new OProcess(); - connect ( ipkgProcess, SIGNAL(receivedStdout(OProcess*,char*,int)), - this, SLOT(getIpkgOutput(OProcess*,char*,int))); - connect ( ipkgProcess, SIGNAL(receivedStderr(OProcess*,char*,int)), - this, SLOT(getIpkgOutput(OProcess*,char*,int))); - installDialog = 0; -#endif + Config cfg( "oipkg", Config::User ); + cfg.setGroup( "ipkg" ); + ipkg_cmd = cfg.readEntry( "cmd", "ipkg" ); } PmIpkg::~PmIpkg() { -#ifdef OPROCESS - delete ipkgProcess; -#endif } bool PmIpkg::runIpkg(const QString& args, const QString& dest ) { bool ret=false; QDir::setCurrent("/tmp"); - QString cmd = "/usr/bin/ipkg "; -#ifdef OPROCESS - ipkgProcess->kill(); - ipkgProcess->clearArguments(); - *ipkgProcess << "/usr/bin/ipkg "; - cmd = ""; -#endif + QString cmd = ipkg_cmd; pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); if (!args.contains("update")) { if ( dest == "" ) cmd += " -dest "+settings->getDestinationName(); else @@ -95,49 +80,12 @@ bool PmIpkg::runIpkg(const QString& args, const QString& dest ) out( "Starting to "+ args+"\n"); qApp->processEvents(); cmd += args; out( "running:\n"+cmd+"\n" ); pvDebug(2,"running:"+cmd); -#ifdef OPROCESS - *ipkgProcess << args; - out( "running:\n" + cmd); - *ipkgProcess << cmd; - -//debug - delete ipkgProcess; - ipkgProcess = new OProcess(); - ipkgProcess->clearArguments(); - *ipkgProcess << "/bin/ls "; -//debug - QValueList<QCString> a = ipkgProcess->args(); - QValueList<QCString>::Iterator it; - for( it = a.begin(); it != a.end(); ++it ) - { - out( *it ); - cmd += *it; - } - - pvDebug(2,"running:"+cmd); - qApp->processEvents(); -// sleep(1); - ret = ipkgProcess->start(OProcess::NotifyOnExit,OProcess::AllOutput); - if ( !ret ) { - pvDebug(2,"Could not execute '" + cmd); - out("\nError while executing "+ cmd+"\n\n"); - out("\nError while executing\n\n"); - // return false; - } - - while ( ipkgProcess->isRunning() ) - { - out("."); - pvDebug(7,"wait for oprocess to terminate"); - qApp->processEvents(); - }; -#else qApp->processEvents(); FILE *fp; char line[130]; QString lineStr, lineStrOld; sleep(1); cmd +=" 2>&1"; @@ -157,14 +105,12 @@ bool PmIpkg::runIpkg(const QString& args, const QString& dest ) out(lineStr); lineStrOld = lineStr; qApp->processEvents(); } } pclose(fp); -#endif - //out( "Finished!"); pvDebug(2,QString(ret?"success\n":"failure\n")); return ret; } void PmIpkg::makeLinks(Package *pack) { @@ -490,16 +436,6 @@ void PmIpkg::clearLists() { to_remove.clear(); to_install.clear(); } -void PmIpkg::getIpkgOutput(OProcess *proc, char *buffer, int buflen) -{ - QString lineStr, lineStrOld; - lineStr = buffer; - lineStr=lineStr.left(buflen); - //Configuring opie-oipkg...Done - if (lineStr!=lineStrOld) - out(lineStr); - lineStrOld = lineStr; -} |