-rw-r--r-- | noncore/settings/packagemanager/installdlg.cpp | 61 | ||||
-rw-r--r-- | noncore/settings/packagemanager/installdlg.h | 14 | ||||
-rw-r--r-- | noncore/settings/packagemanager/mainwindow.cpp | 2 |
3 files changed, 63 insertions, 14 deletions
diff --git a/noncore/settings/packagemanager/installdlg.cpp b/noncore/settings/packagemanager/installdlg.cpp index 945dfed..781f8f5 100644 --- a/noncore/settings/packagemanager/installdlg.cpp +++ b/noncore/settings/packagemanager/installdlg.cpp @@ -32,2 +32,3 @@ _;:, .> :=|. This file is free software; you can #include <opie2/ofiledialog.h> +#include <opie2/oprocess.h> @@ -59,2 +60,3 @@ InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &cap , m_currCommand( 0 ) + , m_destItem( 0x0 ) { @@ -165,6 +167,2 @@ InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &cap -InstallDlg::~InstallDlg() -{ -} - void InstallDlg::slotDisplayAvailSpace( const QString &destination ) @@ -178,5 +176,6 @@ void InstallDlg::slotDisplayAvailSpace( const QString &destination ) // Get destination - OConfItem *dest = m_packman->findConfItem( OConfItem::Destination, destination ); + if ( !destination.isNull() ) + m_destItem = m_packman->findConfItem( OConfItem::Destination, destination ); - if ( dest ) + if ( m_destItem ) { @@ -184,3 +183,3 @@ void InstallDlg::slotDisplayAvailSpace( const QString &destination ) struct statfs fs; - if ( !statfs( dest->value(), &fs ) ) + if ( !statfs( m_destItem->value(), &fs ) ) { @@ -222,2 +221,9 @@ void InstallDlg::slotBtnStart() // Start was clicked, start executing + QString dest; + if ( m_destination ) + { + dest = m_destination->currentText(); + m_destination->setEnabled( false ); + } + m_btnOptions->setEnabled( false ); @@ -233,6 +239,2 @@ void InstallDlg::slotBtnStart() - QString dest; - if ( m_destination ) - dest = m_destination->currentText(); - for ( m_currCommand = 0; m_currCommand < m_numCommands; m_currCommand++ ) @@ -243,2 +245,36 @@ void InstallDlg::slotBtnStart() } + slotProcessDone(0l); + + // Get destination +/* + if ( dest == "root" ) + { + slotProcessDone(0l); + return; + } + + m_destItem = m_packman->findConfItem( OConfItem::Destination, dest ); + if ( m_destItem ) + { + QString path = m_destItem->value(); + Opie::Core::OProcess *process = new Opie::Core::OProcess( this, "ipkg-link process" ); + connect( process, SIGNAL(processExited(Opie::Core::OProcess*)), + this, SLOT(slotProcessDone(Opie::Core::OProcess*)) ); + + *process << "ipkg-link" << "mount" << path; + if ( !process->start( Opie::Core::OProcess::NotifyOnExit, + Opie::Core::OProcess::NoCommunication ) ) + slotProcessDone( 0l ); + m_output->append( tr( "Starting ipkg-link to link installed applications." ) ); + m_output->setCursorPosition( m_output->numLines(), 0 ); + } +*/ +} + +void InstallDlg::slotProcessDone( Opie::Core::OProcess *proc ) +{ + delete proc; + + m_output->append( tr( "The package linking is done." ) ); + m_output->setCursorPosition( m_output->numLines(), 0 ); @@ -296,2 +332,5 @@ void InstallDlg::slotOutput( char *msg ) m_output->setCursorPosition( m_output->numLines(), 0 ); + + // Update available space + slotDisplayAvailSpace( QString::null ); } diff --git a/noncore/settings/packagemanager/installdlg.h b/noncore/settings/packagemanager/installdlg.h index cddc911..f45c17c 100644 --- a/noncore/settings/packagemanager/installdlg.h +++ b/noncore/settings/packagemanager/installdlg.h @@ -41,4 +41,13 @@ class QPushButton; +class OConfItem; class OPackageManager; +namespace Opie +{ + namespace Core + { + class OProcess; + } +} + class InstallDlg : public QWidget @@ -56,3 +65,2 @@ public: const QStringList &packages3 = QStringList() ); - ~InstallDlg(); @@ -73,2 +81,3 @@ private: QStringList m_packages[3]; // Lists of package names associated to commands (m_command[]) + OConfItem *m_destItem; // Pointer to destination for package installation @@ -79,3 +88,4 @@ private slots: void slotBtnOptions(); - + void slotProcessDone( Opie::Core::OProcess *proc ); + // Execution slots diff --git a/noncore/settings/packagemanager/mainwindow.cpp b/noncore/settings/packagemanager/mainwindow.cpp index 5e15874..459a75b 100644 --- a/noncore/settings/packagemanager/mainwindow.cpp +++ b/noncore/settings/packagemanager/mainwindow.cpp @@ -533,3 +533,3 @@ void MainWindow::slotApply() // Create package manager output widget - InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Apply changes" ), true, + InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Apply changes" ), !installList.isEmpty(), removeCmd, removeList, |