summaryrefslogtreecommitdiff
path: root/noncore/unsupported/oipkg/pmipkg.cpp
Side-by-side diff
Diffstat (limited to 'noncore/unsupported/oipkg/pmipkg.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/pmipkg.cpp72
1 files changed, 70 insertions, 2 deletions
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp
index 7b3fa1e..2a534d2 100644
--- a/noncore/unsupported/oipkg/pmipkg.cpp
+++ b/noncore/unsupported/oipkg/pmipkg.cpp
@@ -5,3 +5,5 @@
-#include <qpe/process.h>
+//#infdef OPROCESS
+#include <opie/oprocess.h>
+//#endif
#include <qpe/resource.h>
@@ -34,2 +36,11 @@ PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlag
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
}
@@ -38,2 +49,5 @@ PmIpkg::~PmIpkg()
{
+#ifdef OPROCESS
+ delete ipkgProcess;
+#endif
}
@@ -45,2 +59,7 @@ bool PmIpkg::runIpkg(const QString& args, const QString& dest )
QString cmd = "/usr/bin/ipkg ";
+#ifdef OPROCESS
+ ipkgProcess->clearArguments();
+ *ipkgProcess << "/usr/bin/ipkg ";
+ QString cmd = "";
+#endif
pvDebug( 3,"PmIpkg::runIpkg got dest="+dest);
@@ -67,2 +86,37 @@ bool PmIpkg::runIpkg(const QString& args, const QString& dest )
pvDebug(2,"running:"+cmd);
+#ifdef OPROCESS
+ *ipkgProcess << args;
+ out( "running:\n" + cmd);
+ *ipkgProcess << cmd;
+
+//debug
+ 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();
@@ -93,2 +147,3 @@ bool PmIpkg::runIpkg(const QString& args, const QString& dest )
}
+#endif
//out( "Finished!");
@@ -101,3 +156,3 @@ void PmIpkg::makeLinks(Package *pack)
pvDebug( 2, "PmIpkg::makeLinks "+ pack->name());
- linkPackage( pack->installName(), pack->dest() );
+ linkPackage( pack->name(), pack->dest() );
}
@@ -244,2 +299,3 @@ void PmIpkg::commit()
delete installDialog;
+ installDialog = 0;
out(tr("\nAll done."));
@@ -398 +454,13 @@ void PmIpkg::clearLists()
}
+
+
+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;
+} \ No newline at end of file