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.cpp52
1 files changed, 25 insertions, 27 deletions
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp
index 9f6429a..fe200f5 100644
--- a/noncore/unsupported/oipkg/pmipkg.cpp
+++ b/noncore/unsupported/oipkg/pmipkg.cpp
@@ -201,52 +201,49 @@ void PmIpkg::processLinkDir( QString file, QString dest )
} else {
const char *linkFile = strdup( (destFile).ascii());
if( linkOpp==removeLink )
{
pvDebug(4,"removing "+destFile+" no "+file);
QFileInfo toRemoveLink( destFile );
if ( !QFile::exists( file ) && toRemoveLink.isSymLink() )
unlink( linkFile );
}
}
}
-void PmIpkg::commit( PackageList pl )
+void PmIpkg::loadList( PackageList pl )
{
- int sizecount = 0;
- to_install.clear();
- to_remove.clear();
- QString rem="<b>"+tr("To remove:")+"</b><br>\n";
- QString inst="<b>"+tr("To install:")+"</b><br>\n";
for( Package *pack = pl.first();pack ; (pack = pl.next()) )
- {
- if ( pack && (pack->name() != "") && pack)
- {
- if ( pack->toInstall() )
- {
+ {
+ if ( pack && (pack->name() != "") && pack)
+ {
+ if ( pack->toInstall() )
to_install.append( pack );
- sizecount += pack->size().toInt();
- inst += pack->name()+"\t("+tr("on ")+pack->dest()+")<br>";
- }
- if ( pack->toRemove() )
- {
+ if ( pack->toRemove() )
to_remove.append( pack );
- sizecount += 1;
- rem += pack->name()+"<br>";
- }
- }
- }
+ }
+ }
+}
+void PmIpkg::commit( PackageList pl )
+{
+ sizecount = 0;
+ QString rem="<b>"+tr("To remove:")+"</b><br>\n";
+ QString inst="<b>"+tr("To install:")+"</b><br>\n";
+ loadList(pl);
+ 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();
startDialog();
-
}
void PmIpkg::startDialog()
{
installDialog = new QDialog(0,0,true);
QGridLayout *RunWindowLayout = new QGridLayout( installDialog );
RunWindowLayout->setSpacing( 2 );
RunWindowLayout->setMargin( 2 );
PackageListView *plv = new PackageListView(installDialog, "install",settings);
plv->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding, plv->sizePolicy().mayShrinkVertically()) );
RunWindowLayout->addWidget( plv, 1, 0 );
@@ -257,37 +254,37 @@ void PmIpkg::startDialog()
{
toRemoveItem->insertItem( new PackageListItem(plv, it,settings) );
}
QCheckListItem *toInstallItem;
toInstallItem = new QCheckListItem( plv, QObject::tr("To install") );
toInstallItem->setOpen( true );
for (Package *it=to_install.first(); it != 0; it=to_install.next() )
{
toInstallItem->insertItem( new PackageListItem(plv, it,settings) );
}
QGroupBox *GroupBox1 = new QGroupBox( installDialog, "Ipkg" );
- GroupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, GroupBox1->sizePolicy().hasHeightForWidth() ) );
+ GroupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, GroupBox1->sizePolicy().mayShrinkVertically() ) );
GroupBox1->setTitle( tr( "Ipkg options" ) );
GroupBox1->setColumnLayout(0, Qt::Vertical );
GroupBox1->layout()->setSpacing( 0 );
GroupBox1->layout()->setMargin( 0 );
QGridLayout *GroupBox1Layout = new QGridLayout( GroupBox1->layout() );
GroupBox1Layout->setAlignment( Qt::AlignTop );
GroupBox1Layout->setSpacing( 3 );
GroupBox1Layout->setMargin( 3 );
-
_force_depends = new QCheckBox( GroupBox1, "_force_depends" );
_force_depends->setText( tr( "-force-depends" ) );
_force_depends->setAutoResize( TRUE );
+ _force_depends->setChecked(true);
GroupBox1Layout->addWidget( _force_depends, 0, 0 );
_force_reinstall = new QCheckBox( GroupBox1, "_force_reinstall" );
_force_reinstall->setText( tr( "-force-reinstall" ) );
_force_reinstall->setAutoResize( TRUE );
GroupBox1Layout->addWidget( _force_reinstall, 1, 0 );
_force_remove = new QCheckBox( GroupBox1, "_force_remove" );
_force_remove->setText( tr( "-force-removal-of-essential-packages" ) );
_force_remove->setAutoResize( TRUE );
GroupBox1Layout->addWidget( _force_remove, 1, 0 );
RunWindowLayout->addWidget( GroupBox1 , 3, 0 );
// connect( doItButton, SIGNAL( clicked() ),
@@ -310,57 +307,58 @@ void PmIpkg::doIt()
remove();
install();
}
void PmIpkg::remove()
{
if ( to_remove.count() == 0 ) return;
out("<b>"+tr("Removing")+"<br>"+tr("please wait")+"</b><br><hr>");
QStringList *fileList;
- for (Package *it=to_remove.first(); it != 0; it=to_remove.next() )
- {
+ for (Package *it=to_remove.first(); it != 0; it=to_remove.next() )
+ {
if ( it->link() )fileList = getList( it->name(), it->dest() );
if ( runIpkg("remove " + it->name()) == 0)
{
runwindow->progress->setProgress( 1 + runwindow->progress->progress() );
linkOpp = removeLink;
if ( it->link() )
{
out( "<br>removing links<br>" );
out( "for package "+it->name()+" in "+it->dest()+"<br>" );
processFileList( fileList, it->dest() );
}
it->processed();
+
out("<br><hr>");
}else{
out("<b>"+tr("Error while removing")+"</b><hr>"+it->name());
}
pvDebug(2,"delete File List");
if ( it->link() )delete fileList;
}
out("<br>");
}
void PmIpkg::install()
{
if ( to_install.count() == 0 ) return;
out("<b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>");
for (Package *it=to_install.first(); it != 0; it=to_install.next() )
{
- if ( runIpkg("install " + it->getPackageName(), it->dest() ) == 0 )
+ if ( runIpkg("install " + it->installName(), it->dest() ) == 0 )
{
runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress());
linkOpp = createLink;
if ( it->link() )
{
out( "<br>creating links<br>" );
out( "for package "+it->name()+" in "+it->dest()+"<br>" );
makeLinks( it );
}
it->processed();
out("<br><hr>");
}else{