Diffstat (limited to 'noncore/unsupported/oipkg/pmipkg.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 89 |
1 files changed, 40 insertions, 49 deletions
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index fd8279b..0ae74da 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp @@ -46,3 +46,3 @@ int PmIpkg::runIpkg(const QString& args, const QString& dest ) #ifdef PROC - QStringList cmd = "/usr/bin/ipkg "; + QStringList cmd = "ipkg "; #endif @@ -77,4 +77,4 @@ int PmIpkg::runIpkg(const QString& args, const QString& dest ) QString description; - ipkg->exec("",o); -// out( o ); + r = ipkg->exec("",o); + out( o ); #endif @@ -179,3 +179,2 @@ void PmIpkg::processLinkDir( QString file, QString dest ) QFileInfo *fi; - qDebug( "while %i",list->count()); while ( (fi=it.current()) ) @@ -210,5 +209,5 @@ void PmIpkg::processLinkDir( QString file, QString dest ) -void PmIpkg::loadList( PackageList pl ) +void PmIpkg::loadList( PackageList *pl ) { - for( Package *pack = pl.first();pack ; (pack = pl.next()) ) + for( Package *pack = pl->first();pack ; (pack = pl->next()) ) { @@ -227,27 +226,19 @@ void PmIpkg::commit() int sizecount = 0; - for (uint i=0; i < to_remove.count(); i++) - sizecount += 1; - for (uint i=0; i < to_install.count(); i++) - sizecount += to_install.at(i)->size().toInt(); - runwindow->progress->setTotalSteps(sizecount); - startDialog(); -} - -void PmIpkg::startDialog() -{ installDialog = new InstallDialog(settings,0,0,true); - QCheckListItem *toRemoveItem; - toRemoveItem= new QCheckListItem( installDialog->ListViewPackages, QObject::tr("To remove") ); + QCheckListItem *toRemoveItem = new QCheckListItem( installDialog->ListViewPackages, QObject::tr("To remove") ); + QCheckListItem *toInstallItem = new QCheckListItem( installDialog->ListViewPackages, QObject::tr("To install") ); toRemoveItem->setOpen( true ); - for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) + toInstallItem->setOpen( true ); + for (uint i=0; i < to_remove.count(); i++) { - toRemoveItem->insertItem( new PackageListItem(installDialog->ListViewPackages, it,settings) ); + sizecount += 1; + toRemoveItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_remove.at(i),settings) ); } - QCheckListItem *toInstallItem; - toInstallItem = new QCheckListItem( installDialog->ListViewPackages, QObject::tr("To install") ); - toInstallItem->setOpen( true ); - for (Package *it=to_install.first(); it != 0; it=to_install.next() ) + for (uint i=0; i < to_install.count(); i++) { - toInstallItem->insertItem( new PackageListItem(installDialog->ListViewPackages, it,settings) ); + sizecount += to_install.at(i)->size().toInt(); + toInstallItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_install.at(i),settings) ); } + runwindow->progress->setTotalSteps(sizecount); + qDebug("Install size %i",sizecount); installDialog->showMaximized(); @@ -255,4 +246,4 @@ void PmIpkg::startDialog() installDialog->close(); + runwindow->showMaximized(); out(tr("<b>All done.</b>")); - to_install.clear(); } @@ -274,23 +265,24 @@ void PmIpkg::remove() QStringList *fileList; - for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) + for (uint i=0; i < to_remove.count(); i++) { - if ( it->link() )fileList = getList( it->name(), it->dest() ); - if ( runIpkg("remove " + it->name(), it->dest() ) == 0) + if ( to_remove.at(i)->link() )fileList = getList( to_remove.at(i)->name(), to_remove.at(i)->dest() ); + if ( runIpkg("remove " + to_remove.at(i)->name(), to_remove.at(i)->dest() ) == 0) { - runwindow->progress->setProgress( 1 + runwindow->progress->progress() ); + runwindow->progress->setProgress( 1 ); linkOpp = removeLink; - if ( it->link() ) + if ( to_remove.at(i)->link() ) { out( "<br>removing links<br>" ); - out( "for package "+it->name()+" in "+it->dest()+"<br>" ); - processFileList( fileList, it->dest() ); + out( "for package "+to_remove.at(i)->name()+" in "+to_remove.at(i)->dest()+"<br>" ); + processFileList( fileList, to_remove.at(i)->dest() ); } - it->processed(); -// to_install.take( it ); + to_remove.at(i)->processed(); + to_remove.take( i ); out("<br><hr>"); }else{ - out("<b>"+tr("Error while removing")+"</b><hr>"+it->name()); + out("<b>"+tr("Error while removing")+"</b><hr>"+to_remove.at(i)->name()); } - if ( it->link() )delete fileList; + if ( to_remove.at(i)->link() )delete fileList; } + to_remove.clear(); out("<br>"); @@ -303,20 +295,19 @@ void PmIpkg::install() out("<b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>"); - for (Package *it=to_install.first(); it != 0; it=to_install.next() ) + for (uint i=0; i < to_install.count(); i++) { - - if ( runIpkg("install " + it->installName(), it->dest() ) == 0 ) + if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() ) == 0 ) { - runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); + runwindow->progress->setProgress( to_install.at(i)->size().toInt() ); linkOpp = createLink; - if ( it->link() ) + if ( to_install.at(i)->link() ) { out( "<br>creating links<br>" ); - out( "for package "+it->name()+" in "+it->dest()+"<br>" ); - makeLinks( it ); + out( "for package "+to_install.at(i)->name()+" in "+to_install.at(i)->dest()+"<br>" ); + makeLinks( to_install.at(i) ); } - it->processed(); -// to_install.take( it->name() ); + to_install.at(i)->processed(); + to_install.take( i ); out("<br><hr>"); }else{ - out("<b>"+tr("Error while installing")+"</b><hr>"+it->name()); + out("<b>"+tr("Error while installing")+"</b><hr>"+to_install.at(i)->name()); } @@ -400,3 +391,3 @@ void PmIpkg::installFile(const QString &fileName, const QString &dest) to_install.append( p ); - startDialog(); + commit(); delete p; @@ -413,3 +404,3 @@ void PmIpkg::removeFile(const QString &fileName, const QString &dest) to_remove.append( p ); - startDialog(); + commit(); delete p; |