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.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp
index 2ed313c..cfaadbf 100644
--- a/noncore/unsupported/oipkg/pmipkg.cpp
+++ b/noncore/unsupported/oipkg/pmipkg.cpp
@@ -93,49 +93,49 @@ bool PmIpkg::runIpkg(const QString& args, const QString& dest )
cmd +=" 2>&1";
fp = popen( (const char *) cmd, "r");
if ( fp == NULL ) {
qDebug("Could not execute '" + cmd + "'! err=%d", fp);
out("\nError while executing "+ cmd+"\n\n");
ret = false;
} else {
while ( fgets( line, sizeof line, fp) != NULL)
{
lineStr = line;
lineStr=lineStr.left(lineStr.length()-1);
//Configuring opie-oipkg...Done
if (lineStr.contains("Done")) ret = true;
if (lineStr!=lineStrOld)
out(lineStr);
lineStrOld = lineStr;
qApp->processEvents();
}
}
pclose(fp);
pvDebug(2,QString(ret?"success\n":"failure\n"));
return ret;
}
-void PmIpkg::makeLinks(Package *pack)
+void PmIpkg::makeLinks(OipkgPackage *pack)
{
pvDebug( 2, "PmIpkg::makeLinks "+ pack->name());
QString pn = pack->name();
linkPackage( pack->packageName(), pack->dest() );
}
QStringList* PmIpkg::getList( QString packFileName, QString d )
{
QString dest = settings->getDestinationUrlByName( d );
dest = dest==""?d:dest;
// if (dest == "/" ) return 0;
{
Config cfg( "oipkg", Config::User );
cfg.setGroup( "Common" );
QString statusDir = cfg.readEntry( "statusDir", "" );
}
QString packFileDir = dest+"/"+statusDir+"/info/"+packFileName+".list";
QFile f( packFileDir );
qDebug("Try to open %s", packFileDir.latin1());
if ( ! f.open(IO_ReadOnly) )
{
out( "Could not open:\n"+packFileDir );
f.close();
packFileDir = "/"+statusDir+"/info/"+packFileName+".list";
@@ -211,49 +211,49 @@ void PmIpkg::processLinkDir( QString file, QString dest )
{
const char *instFile = strdup( (file).latin1() );
const char *linkFile = strdup( (destFile).latin1());
if( linkOpp==createLink )
{
pvDebug(4, "linking: "+file+" -> "+destFile );
symlink( instFile, linkFile );
}
} else {
const char *linkFile = strdup( (destFile).latin1());
if( linkOpp==removeLink )
{
QFileInfo toRemoveLink( destFile );
if ( !QFile::exists( file ) && toRemoveLink.isSymLink() )
{
pvDebug(4,"removing "+destFile+" no "+file);
unlink( linkFile );
}
}
}
}
void PmIpkg::loadList( PackageList *pl )
{
- for( Package *pack = pl->first();pack ; (pack = pl->next()) )
+ for( OipkgPackage *pack = pl->first();pack ; (pack = pl->next()) )
{
if ( pack && (pack->name() != "") && pack)
{
if ( pack->toInstall() )
to_install.append( pack );
if ( pack->toRemove() )
to_remove.append( pack );
}
}
}
void PmIpkg::commit()
{
int sizecount = 0;
installDialog = new InstallDialog(settings,0,0,true);
installDialog->toRemoveItem->setOpen( true );
installDialog->toInstallItem->setOpen( true );
for (uint i=0; i < to_remove.count(); i++)
{
sizecount += 1;
installDialog->toRemoveItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_remove.at(i),settings) );
}
for (uint i=0; i < to_install.count(); i++)
{
@@ -270,49 +270,49 @@ void PmIpkg::commit()
runwindow->showMaximized();
runwindow->show();
}
installDialog->close();
delete installDialog;
installDialog = 0;
out(tr("\nAll done."));
}
void PmIpkg::doIt()
{
runwindow->progress->setProgress(0);
show();
remove();
install();
}
void PmIpkg::remove()
{
if ( to_remove.count() == 0 ) return;
out(tr("Removing")+"\n"+tr("please wait")+"\n\n");
- QStringList *fileList;
+ QStringList *fileList = new QStringList;
for (uint i=0; i < to_remove.count(); i++)
{
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)->installName(), to_remove.at(i)->dest() ))
{
runwindow->progress->setProgress( 1 );
linkOpp = removeLink;
to_remove.at(i)->processed();
pvDebug(3,"link "+QString::number(i));
if ( to_remove.at(i)->link() )
processFileList( fileList, to_remove.at(i)->dest() );
//pvDebug(3,"take "+QString::number(i)+" of "+QString::number(to_remove.count()));
//if ( to_remove.at(i) ) to_remove.take( i );
out("\n");
}else{
out(tr("Error while removing ")+to_remove.at(i)->name()+"\n");
if ( to_remove.at(i)->link() )
processFileList( fileList, to_remove.at(i)->dest() );
}
if ( to_remove.at(i)->link() )
processFileList( fileList, to_remove.at(i)->dest() );
if ( to_remove.at(i)->link() )delete fileList;
}
@@ -393,52 +393,52 @@ void PmIpkg::out( QString o )
// runwindow->outPut->append(o);
runwindow->outPut->setText(runwindow->outPut->text()+o);
runwindow->outPut->setCursorPosition(runwindow->outPut->numLines() + 1,0,FALSE);
}
void PmIpkg::show()
{
if (!runwindow->isVisible())
{
runwindow->showMaximized();
runwindow->show();
}
runwindow->outPut->setText("");
}
void PmIpkg::installFile(const QString &fileName, const QString &dest)
{
to_install.clear();
to_remove.clear();
pvDebug( 2,"PmIpkg::installFile "+ fileName);
- Package *p = new Package(fileName,settings);
+ OipkgPackage *p = new OipkgPackage(fileName,settings);
if ( dest!="") p->setDest( dest );
to_install.append( p );
commit();
delete p;
}
void PmIpkg::removeFile(const QString &fileName, const QString &dest)
{
to_install.clear();
to_remove.clear();
pvDebug( 2,"PmIpkg::removeFile "+ fileName);
- Package *p = new Package(fileName,settings);
+ OipkgPackage *p = new OipkgPackage(fileName,settings);
if ( dest!="") p->setDest( dest );
to_remove.append( p );
commit();
delete p;
}
void PmIpkg::clearLists()
{
to_remove.clear();
to_install.clear();
}