From a111f57eedcf27623e9bff2816c83d3287272aff Mon Sep 17 00:00:00 2001 From: tille Date: Fri, 26 Apr 2002 00:50:30 +0000 Subject: added support for scipt ipkg (again;) --- (limited to 'noncore/unsupported/oipkg/pmipkg.cpp') diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index b23b9ea..eae73ad 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp @@ -43,6 +43,14 @@ PmIpkg::~PmIpkg() int PmIpkg::runIpkg(const QString& args) { pvDebug(2,"PmIpkg::runIpkg "+args); + + //to make script ipkg happy + pvDebug(2, "cd "+settings->getDestinationUrl()+"/tmp/ipkg"); + if (!QDir::setCurrent(settings->getDestinationUrl()+"/tmp/ipkg")) + { + QDir instDir = QDir(settings->getDestinationUrl()+"/tmp/ipkg"); + instDir.mkdir(settings->getDestinationUrl()+"/tmp/ipkg"); + } #ifdef PROC QStringList cmd = "/usr/bin/ipkg "; #endif @@ -153,6 +161,9 @@ void PmIpkg::commit( PackageList pl ) runwindow->outPut->setText(""); out( "

"+tr("Todo")+"

\n"); + to_install.clear(); + to_remove.clear(); + int sizecount = 0; QString rem="To remove:
\n"; QString inst="To install:
\n";; for( Package *pack = pl.first();pack ; (pack = pl.next()) ) @@ -161,12 +172,24 @@ void PmIpkg::commit( PackageList pl ) { if ( pack->toInstall() ) { + #ifndef NEWLIST to_install.append( pack->name() ); + #endif + #ifdef NEWLIST + to_install.append( pack ); + sizecount += pack->size().toInt(); + #endif inst += pack->name()+"
"; } if ( pack->toRemove() ) { + #ifndef NEWLIST to_remove.append( pack->name() ); + #endif + #ifdef NEWLIST + to_remove.append( pack ); + sizecount += 1; + #endif rem += pack->name()+"
"; } } @@ -176,6 +199,8 @@ void PmIpkg::commit( PackageList pl ) qDebug("to remove=%i; to install=%i",to_remove.count(),to_install.count()); + runwindow->progress->setTotalSteps( sizecount ); + connect( runwindow->doItButton, SIGNAL( clicked() ), SLOT( doIt() ) ); connect( runwindow->installButton, SIGNAL( clicked() ), @@ -207,8 +232,10 @@ void PmIpkg::remove() show( true ); out("

"+tr("Removing")+"
"+tr("please wait")+"

"); - for (QStringList::ConstIterator it=to_remove.begin(); it!=to_remove.end(); ++it) - { + + #ifndef NEWLIST + for (QStringList::ConstIterator it=to_remove.begin(); it!=to_remove.end(); ++it) + { if ( runIpkg("remove " + *it) == 0) { @@ -216,6 +243,20 @@ void PmIpkg::remove() out(""+tr("Error while removing")+""+*it); } } +#endif + #ifdef NEWLIST + for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) + { + if ( runIpkg("remove " + it->name()) == 0) + { + runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); + it->processed(); + runwindow->progress->setProgress( 1 ); + }else{ + out(""+tr("Error while removing")+""+it->name()); + } + } +#endif } @@ -223,19 +264,33 @@ void PmIpkg::install() { if ( to_install.count() == 0 ) return; show( true ); - out("

"+tr("Installing")+"
"+tr("please wait")+"
"); - if ( to_install.count() ) + out("

"+tr("Installing")+"
"+tr("please wait")+"

"); + #ifndef NEWLIST for (QStringList::ConstIterator it=to_install.begin(); it!=to_install.end(); ++it) { if ( runIpkg("install " + *it) == 0 ) - { + { if ( settings->createLinks() ) makeLinks( *it ); }else{ out(""+tr("Error while installing")+""+*it); } } - +#endif + #ifdef NEWLIST + for (Package *it=to_install.first(); it != 0; it=to_install.next() ) + { + if ( runIpkg("install " + it->name()) == 0 ) + { + runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); + if ( settings->createLinks() ) + makeLinks( it->name() ); + it->processed(); + }else{ + out(""+tr("Error while installing")+""+it->name()); + } + } +#endif } void PmIpkg::linkDestination( const QString msg, const QByteArray dest ) @@ -290,8 +345,8 @@ void PmIpkg::show(bool b) if (!runwindow->isVisible()) runwindow->showMaximized(); showButtons(b); - if ( b ) - runwindow->progress->show(); - else - runwindow->progress->show(); +// if ( b ) + runwindow->progress->hide(); +// else +// runwindow->progress->show(); } -- cgit v0.9.0.2