Diffstat (limited to 'noncore/settings/packagemanager/installdlg.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/packagemanager/installdlg.cpp | 46 |
1 files changed, 31 insertions, 15 deletions
diff --git a/noncore/settings/packagemanager/installdlg.cpp b/noncore/settings/packagemanager/installdlg.cpp index 494603b..985e2bd 100644 --- a/noncore/settings/packagemanager/installdlg.cpp +++ b/noncore/settings/packagemanager/installdlg.cpp @@ -51,18 +51,18 @@ _;:, .> :=|. This file is free software; you can #include "opackagemanager.h" InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &caption, OPackage::Command command1, const QStringList &packages1, OPackage::Command command2, const QStringList &packages2, OPackage::Command command3, const QStringList &packages3 ) - : QWidget( 0x0 ) + : QWidget( 0l ) , m_packman( pm ) , m_installFound( false ) , m_numCommands( 0 ) , m_currCommand( 0 ) - , m_destItem( 0x0 ) + , m_destItem( 0l ) { // Save command/package list information if ( command1 != OPackage::NotDefined ) { m_command[ m_numCommands ] = command1; m_packages[ m_numCommands ] = packages1; @@ -113,14 +113,14 @@ InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &cap // TODO - select correct destination slotDisplayAvailSpace( m_destination->currentText() ); } else { - m_destination = 0x0; - m_availSpace = 0x0; + m_destination = 0l; + m_availSpace = 0l; } QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, tr( "Output" ), this ); groupBox->layout()->setSpacing( 0 ); groupBox->layout()->setMargin( 4 ); @@ -251,18 +251,15 @@ void InstallDlg::slotBtnStart() for ( m_currCommand = 0; m_currCommand < m_numCommands; m_currCommand++ ) { // Execute next command m_packman->executeCommand( m_command[ m_currCommand ], m_packages[ m_currCommand ], dest, this, SLOT(slotOutput(char*)), true ); - // Link/Unlink application if the package was removed from or installed to a destination - // other than root - if ( ( m_command[ m_currCommand ] == OPackage::Install && dest != "root" ) || - ( m_command[ m_currCommand ] == OPackage::Remove ) ) + if ( m_command[ m_currCommand ] == OPackage::Remove ) { - //m_packman->findPackage( m_packages[ m_currCommand ]->destination() != "root"*/ ) + // Unlink application if the package was removed // Loop through all package names in the command group for ( QStringList::Iterator it = m_packages[ m_currCommand ].begin(); it != m_packages[ m_currCommand ].end(); ++it ) { @@ -271,39 +268,58 @@ void InstallDlg::slotBtnStart() // Skip package if it is not found or being removed from 'root' if ( !currPackage || ( m_command[ m_currCommand ] == OPackage::Remove && currPackage->destination() == "root" ) ) continue; // Display feedback to user - if ( m_command[ m_currCommand ] == OPackage::Install ) - m_output->append( tr( QString( "Running ipkg-link to link package '%1'." ) - .arg( currPackage->name() ) ) ); - else m_output->append( tr( QString( "Running ipkg-link to remove links for package '%1'." ) .arg( currPackage->name() ) ) ); m_output->setCursorPosition( m_output->numLines(), 0 ); // Execute ipkg-link process.clearArguments(); process << "ipkg-link" << ( ( m_command[ m_currCommand ] == OPackage::Install ) ? "add" : "remove" ) << currPackage->name(); if ( !process.start( Opie::Core::OProcess::Block, Opie::Core::OProcess::NoCommunication ) ) { - slotProcessDone( 0x0 ); + slotProcessDone( 0l ); m_output->append( tr( "Unable to run ipkg-link." ) ); m_output->setCursorPosition( m_output->numLines(), 0 ); return; } } + } + else if ( m_command[ m_currCommand ] == OPackage::Install && dest != "root" ) + { + // Link applications in the destination directory + m_output->append( tr( "Running ipkg-link to link packages in '%1'." ).arg( dest ) ); + m_output->setCursorPosition( m_output->numLines(), 0 ); + + QString destPath; + OConfItem *destItem = m_packman->findConfItem( OConfItem::Destination, dest ); + + // Execute ipkg-link + process.clearArguments(); + process << "ipkg-link" + << "mount" + << destItem->value(); + if ( !process.start( Opie::Core::OProcess::Block, + Opie::Core::OProcess::NoCommunication ) ) + { + slotProcessDone( 0l ); + m_output->append( tr( "Unable to run ipkg-link." ) ); + m_output->setCursorPosition( m_output->numLines(), 0 ); + return; + } } } - slotProcessDone( 0x0 ); + slotProcessDone( 0l ); } void InstallDlg::slotProcessDone( Opie::Core::OProcess *proc ) { if ( proc ) { |