summaryrefslogtreecommitdiff
path: root/noncore/settings/aqpkg/installdlgimpl.cpp
Side-by-side diff
Diffstat (limited to 'noncore/settings/aqpkg/installdlgimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/installdlgimpl.cpp130
1 files changed, 97 insertions, 33 deletions
diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp
index 76d0a80..896e370 100644
--- a/noncore/settings/aqpkg/installdlgimpl.cpp
+++ b/noncore/settings/aqpkg/installdlgimpl.cpp
@@ -46,13 +46,13 @@
#include "global.h"
enum {
MAXLINES = 100,
};
-InstallDlgImpl::InstallDlgImpl( QList<InstallData> &packageList, DataManager *dataManager, const char *title )
+InstallDlgImpl::InstallDlgImpl( const QList<InstallData> &packageList, DataManager *dataManager, const char *title )
: QWidget( 0, 0, 0 )
{
setCaption( title );
init( TRUE );
pIpkg = 0;
@@ -98,42 +98,41 @@ InstallDlgImpl::InstallDlgImpl( QList<InstallData> &packageList, DataManager *da
QString install = tr( "Install\n" );
QString upgrade = tr( "Upgrade\n" );
for ( ; it.current(); ++it )
{
InstallData *item = it.current();
InstallData *newitem = new InstallData();
-
- newitem->option = item->option;
- newitem->packageName = item->packageName;
- newitem->destination = item->destination;
- newitem->recreateLinks = item->recreateLinks;
-
- if ( item->option == "I" )
+
+ newitem->option = item->option;
+ newitem->packageName = item->packageName;
+ newitem->destination = item->destination;
+ newitem->recreateLinks = item->recreateLinks;
+ packages.append( newitem );
+
+ if ( item->option == "I" )
{
- installList.append( newitem );
install.append( QString( " %1\n" ).arg( item->packageName ) );
}
else if ( item->option == "D" )
{
- removeList.append( newitem );
remove.append( QString( " %1\n" ).arg( item->packageName ) );
}
else if ( item->option == "U" || item->option == "R" )
{
- updateList.append( newitem );
- QString type;
- if ( item->option == "R" )
- type = tr( "(ReInstall)" );
- else
- type = tr( "(Upgrade)" );
- upgrade.append( QString( " %1 %2\n" ).arg( item->packageName ).arg( type ) );
- }
- }
- output->setText( QString( "%1\n%2\n%3\n" ).arg( remove ).arg( install ).arg( upgrade ) );
+ QString type;
+ if ( item->option == "R" )
+ type = tr( "(ReInstall)" );
+ else
+ type = tr( "(Upgrade)" );
+ upgrade.append( QString( " %1 %2\n" ).arg( item->packageName ).arg( type ) );
+ }
+ }
- displayAvailableSpace( destination->currentText() );
+ output->setText( QString( "%1\n%2\n%3\n" ).arg( remove ).arg( install ).arg( upgrade ) );
+
+ displayAvailableSpace( destination->currentText() );
}
InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, const char *title )
: QWidget( 0, 0, 0 )
{
setCaption( title );
@@ -265,12 +264,13 @@ void InstallDlgImpl :: installSelected()
btnInstall->setIconSet( Resource::loadPixmap( "close" ) );
if ( pIpkg )
{
output->setText( "" );
connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
+ connect( pIpkg, SIGNAL(ipkgFinished()), this, SLOT(ipkgFinished()));
pIpkg->runIpkg();
}
else
{
output->setText( "" );
Destination *d = dataMgr->getDestination( destination->currentText() );
@@ -286,15 +286,20 @@ void InstallDlgImpl :: installSelected()
cfg.setGroup( "settings" );
cfg.writeEntry( "dest", dest );
#endif
pIpkg = new Ipkg;
connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
+ connect( pIpkg, SIGNAL(ipkgFinished()), this, SLOT(ipkgFinished()));
+
+ firstPackage = TRUE;
+ ipkgFinished();
// First run through the remove list, then the install list then the upgrade list
- pIpkg->setOption( "remove" );
+/*
+ pIpkg->setOption( "remove" );
QListIterator<InstallData> it( removeList );
InstallData *idata;
for ( ; it.current(); ++it )
{
idata = it.current();
pIpkg->setDestination( idata->destination->getDestinationName() );
@@ -339,24 +344,14 @@ void InstallDlgImpl :: installSelected()
pIpkg->setFlags( tmpFlags, infoLevel );
pIpkg->runIpkg();
}
delete pIpkg;
pIpkg = 0;
+*/
}
-
- btnOptions->setEnabled( true );
-// btnInstall->setEnabled( true );
- btnInstall->setText( tr( "Close" ) );
- btnInstall->setIconSet( Resource::loadPixmap( "enter" ) );
-
- btnOptions->setText( tr( "Save output" ) );
- btnOptions->setIconSet( Resource::loadPixmap( "save" ) );
-
- if ( destination && destination->currentText() != 0 && destination->currentText() != "" )
- displayAvailableSpace( destination->currentText() );
}
void InstallDlgImpl :: displayText(const QString &text )
{
QString newtext = QString( "%1\n%2" ).arg( output->text() ).arg( text );
@@ -397,6 +392,75 @@ void InstallDlgImpl :: displayAvailableSpace( const QString &text )
space = tr( "Unknown" );
if ( txtAvailableSpace )
txtAvailableSpace->setText( space );
}
+void InstallDlgImpl :: ipkgFinished()
+{
+ InstallData *item;
+ if ( firstPackage )
+ item = packages.first();
+ else
+ {
+ // Create symlinks if necessary before moving on to next package
+ pIpkg->createSymLinks();
+
+ item = packages.next();
+ }
+
+ firstPackage = FALSE;
+ if ( item )
+ {
+ pIpkg->setPackage( item->packageName );
+ int tmpFlags = flags;
+
+ if ( item->option == "I" )
+ {
+ pIpkg->setOption( "install" );
+ Destination *d = dataMgr->getDestination( destination->currentText() );
+ pIpkg->setDestination( d->getDestinationName() );
+ pIpkg->setDestinationDir( d->getDestinationPath() );
+
+ if ( d->linkToRoot() )
+ tmpFlags |= MAKE_LINKS;
+ }
+ else if ( item->option == "D" )
+ {
+ pIpkg->setOption( "remove" );
+ pIpkg->setDestination( item->destination->getDestinationName() );
+ pIpkg->setDestinationDir( item->destination->getDestinationPath() );
+
+ if ( item->destination->linkToRoot() )
+ tmpFlags |= MAKE_LINKS;
+ }
+ else
+ {
+ if ( item->option == "R" )
+ pIpkg->setOption( "reinstall" );
+ else
+ pIpkg->setOption( "upgrade" );
+
+ pIpkg->setDestination( item->destination->getDestinationName() );
+ pIpkg->setDestinationDir( item->destination->getDestinationPath() );
+ pIpkg->setPackage( item->packageName );
+
+ tmpFlags |= FORCE_REINSTALL;
+ if ( item->destination->linkToRoot() && item->recreateLinks )
+ tmpFlags |= MAKE_LINKS;
+ }
+ pIpkg->setFlags( tmpFlags, infoLevel );
+ pIpkg->runIpkg();
+ }
+ else
+ {
+ btnOptions->setEnabled( true );
+ btnInstall->setText( tr( "Close" ) );
+ btnInstall->setIconSet( Resource::loadPixmap( "enter" ) );
+
+ btnOptions->setText( tr( "Save output" ) );
+ btnOptions->setIconSet( Resource::loadPixmap( "save" ) );
+
+ if ( destination && destination->currentText() != 0 && destination->currentText() != "" )
+ displayAvailableSpace( destination->currentText() );
+ }
+} \ No newline at end of file