-rw-r--r-- | noncore/settings/packagemanager/ChangeLog | 8 | ||||
-rw-r--r-- | noncore/settings/packagemanager/README | 2 | ||||
-rw-r--r-- | noncore/settings/packagemanager/TODO | 14 | ||||
-rw-r--r-- | noncore/settings/packagemanager/installdlg.cpp | 104 | ||||
-rw-r--r-- | noncore/settings/packagemanager/installdlg.h | 7 | ||||
-rw-r--r-- | noncore/settings/packagemanager/mainwindow.cpp | 29 | ||||
-rw-r--r-- | noncore/settings/packagemanager/opie-packagemanager.control | 4 |
7 files changed, 105 insertions, 63 deletions
diff --git a/noncore/settings/packagemanager/ChangeLog b/noncore/settings/packagemanager/ChangeLog index c9e33c4..7799136 100644 --- a/noncore/settings/packagemanager/ChangeLog +++ b/noncore/settings/packagemanager/ChangeLog @@ -1,24 +1,32 @@ +2004-11-18 Dan Williams <drw@handhelds.org> + + * Released version 0.5.0 + * All v1.0 functionality implemented + * Implemented installation of local packages + * Implemented linking of non-root apps (using ipkg-link) + * Many UI tweaks for installation and filter dialogs + 2004-04-21 Dan Williams <drw@handhelds.org> * Released version 0.4.0 * Added saving of ipkg configuration information * Re-initialize ipkg when configuration information changes * Added QWhatsThis for all UI controls * Remove Location from OConfItem as it is not used/needed * Re-ordered includes to follow Opie standards 2004-02-13 Dan Williams <drw@handhelds.org> * Released version 0.3.0 * Fix handling of filtering options in View menu * Do proper version string comparison * Fix string alignment code in PromptDlg to eliminate QT warning messages 2004-02-12 Dan Williams <drw@handhelds.org> * Package information dialog implemented * What's This app icon enabled * Changed all QDialog::exec() occurences to QPEApplication::execDialog() 2004-01-23 Dan Williams <drw@handhelds.org> diff --git a/noncore/settings/packagemanager/README b/noncore/settings/packagemanager/README index bf93c98..c34a6af 100644 --- a/noncore/settings/packagemanager/README +++ b/noncore/settings/packagemanager/README @@ -1,29 +1,29 @@ /************************************************************************ /* /* Opie - Package Manager /* ======================== -/* Version 0.4.0 +/* Version 0.5.0 /* /* A package management client for Opie /* /************************************************************************ ------------------------------------------------------- Release Notes for Opie-PackageManager - January, 2004 ------------------------------------------------------- ====================== = To-do = ====================== - See $OPIEDIR/noncore/settings/packagemanager/TODO for more info. ====================== = Build = ====================== In order to build opie-packagemanager, libipkg needs to be present on the build system along with the appropriate headers. - libipkg source (best to use version 109 or greater): - Familiar CVS directory: familiar/dist/ipkg/C (e.g. 'cvs co familiar/dist/ipkg/C') diff --git a/noncore/settings/packagemanager/TODO b/noncore/settings/packagemanager/TODO index 633c589..265beda 100644 --- a/noncore/settings/packagemanager/TODO +++ b/noncore/settings/packagemanager/TODO @@ -1,27 +1,25 @@ /************************************************************************ /* /* Opie - Package Manager /* ======================== -/* Version 0.4.0 +/* Version 0.5.0 /* /* A package management client for Opie /* /************************************************************************ ---------------------------------------------- - To-do for Opie-PackageManager - April, 2004 ---------------------------------------------- +----------------------------------------------- + To-do for Opie-PackageManager - November, 2004 +----------------------------------------------- ====================== = Current release = ====================== -1. Link non-root destination apps -2. Implement QCOP interface for installing, removing, etc. -3. Redesign configuration dialog +1. Re-work package download dialog ====================== = Future releases = ====================== -1. ???
\ No newline at end of file +1. Re-work server and destination tabs in configuration dialog
\ No newline at end of file diff --git a/noncore/settings/packagemanager/installdlg.cpp b/noncore/settings/packagemanager/installdlg.cpp index 781f8f5..494603b 100644 --- a/noncore/settings/packagemanager/installdlg.cpp +++ b/noncore/settings/packagemanager/installdlg.cpp @@ -29,85 +29,95 @@ _;:, .> :=|. This file is free software; you can #include "installdlg.h" #include <opie2/ofiledialog.h> #include <opie2/oprocess.h> #include <qpe/fileselector.h> #include <qpe/resource.h> #include <qpe/storage.h> #include <qapplication.h> #include <qcombobox.h> #include <qfileinfo.h> #include <qgroupbox.h> #include <qlabel.h> #include <qlayout.h> #include <qmap.h> #include <qmultilineedit.h> #include <qpushbutton.h> #include <sys/vfs.h> #include "opackagemanager.h" -InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &caption, bool showDestInfo, +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 ) , m_packman( pm ) + , m_installFound( false ) , m_numCommands( 0 ) , m_currCommand( 0 ) , m_destItem( 0x0 ) { // Save command/package list information if ( command1 != OPackage::NotDefined ) { m_command[ m_numCommands ] = command1; m_packages[ m_numCommands ] = packages1; ++m_numCommands; + + if ( command1 == OPackage::Install ) + m_installFound = true; } if ( command2 != OPackage::NotDefined ) { m_command[ m_numCommands ] = command2; m_packages[ m_numCommands ] = packages2; ++m_numCommands; + + if ( command2 == OPackage::Install ) + m_installFound = true; } if ( command3 != OPackage::NotDefined ) { m_command[ m_numCommands ] = command3; m_packages[ m_numCommands ] = packages3; ++m_numCommands; + + if ( command3 == OPackage::Install ) + m_installFound = true; } // Initialize UI if ( parent ) parent->setCaption( caption ); QGridLayout *layout = new QGridLayout( this, 4, 2, 2, 4 ); - if ( showDestInfo ) + if ( m_installFound ) { QLabel *label = new QLabel( tr( "Destination" ), this ); layout->addWidget( label, 0, 0 ); m_destination = new QComboBox( this ); m_destination->insertStringList( m_packman->destinations() ); layout->addWidget( m_destination, 0, 1 ); connect( m_destination, SIGNAL(highlighted(const QString&)), this, SLOT(slotDisplayAvailSpace(const QString&)) ); label = new QLabel( tr( "Space Avail" ), this ); layout->addWidget( label, 1, 0 ); m_availSpace = new QLabel( this ); layout->addWidget( m_availSpace, 1, 1 ); // TODO - select correct destination slotDisplayAvailSpace( m_destination->currentText() ); } else { m_destination = 0x0; m_availSpace = 0x0; } QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, tr( "Output" ), this ); @@ -199,106 +209,132 @@ void InstallDlg::slotDisplayAvailSpace( const QString &destination ) } void InstallDlg::slotBtnStart() { QString btnText = m_btnStart->text(); if ( btnText == tr( "Abort" ) ) { // Prevent unexecuted commands from executing m_currCommand = 999; // Allow user to close dialog m_btnStart->setText( tr( "Close" ) ); m_btnStart->setIconSet( Resource::loadPixmap( "enter" ) ); return; } else if ( btnText == tr( "Close" ) ) { // TODO - force reload of package data emit closeInstallDlg(); return; } // Start was clicked, start executing QString dest; - if ( m_destination ) + if ( m_installFound ) { dest = m_destination->currentText(); m_destination->setEnabled( false ); } m_btnOptions->setEnabled( false ); if ( m_numCommands > 1 ) { m_btnStart->setText( tr( "Abort" ) ); m_btnStart->setIconSet( Resource::loadPixmap( "close" ) ); } else { m_btnStart->setEnabled( false ); } + Opie::Core::OProcess process( this ); 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 ) ) + { + //m_packman->findPackage( m_packages[ m_currCommand ]->destination() != "root"*/ ) + + // 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 ) + { + OPackage *currPackage = m_packman->findPackage( (*it) ); + + // 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 ); + m_output->append( tr( "Unable to run ipkg-link." ) ); + m_output->setCursorPosition( m_output->numLines(), 0 ); + return; + } + } + + } } - 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 ); - } -*/ + + slotProcessDone( 0x0 ); } 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 ); - + if ( proc ) + { + // Display message pnly if linking was done + m_output->append( tr( "The package linking is done." ) ); + m_output->setCursorPosition( m_output->numLines(), 0 ); + + delete proc; + } + // All commands executed, allow user to close dialog m_btnStart->setEnabled( true ); m_btnStart->setText( tr( "Close" ) ); m_btnStart->setIconSet( Resource::loadPixmap( "enter" ) ); m_btnOptions->setEnabled( true ); m_btnOptions->setText( tr( "Save output" ) ); m_btnOptions->setIconSet( Resource::loadPixmap( "save" ) ); } void InstallDlg::slotBtnOptions() { QString btnText = m_btnOptions->text(); if ( btnText == tr( "Options" ) ) { // Display configuration dialog (only options tab is enabled) m_packman->configureDlg( true ); return; } // Save output was clicked QMap<QString, QStringList> map; map.insert( tr( "All" ), QStringList() ); QStringList text; diff --git a/noncore/settings/packagemanager/installdlg.h b/noncore/settings/packagemanager/installdlg.h index f45c17c..eabb717 100644 --- a/noncore/settings/packagemanager/installdlg.h +++ b/noncore/settings/packagemanager/installdlg.h @@ -34,59 +34,62 @@ _;:, .> :=|. This file is free software; you can #include "opackage.h" class QComboBox; class QLabel; class QMultiLineEdit; class QPushButton; class OConfItem; class OPackageManager; namespace Opie { namespace Core { class OProcess; } } class InstallDlg : public QWidget { Q_OBJECT public: - InstallDlg( QWidget *parent = 0x0, OPackageManager *pm = 0x0, const QString &caption = QString::null, - bool showDestInfo = true, + InstallDlg( QWidget *parent = 0x0, OPackageManager *pm = 0x0, + const QString &caption = QString::null, OPackage::Command command1 = OPackage::NotDefined, const QStringList &packages1 = QStringList(), OPackage::Command command2 = OPackage::NotDefined, const QStringList &packages2 = QStringList(), OPackage::Command command3 = OPackage::NotDefined, const QStringList &packages3 = QStringList() ); private: OPackageManager *m_packman; // Pointer to application instance of package manager + + bool m_installFound; // Indicates if an install is being done, controls display of + // destination selection, available space // UI controls QComboBox *m_destination; // Destination selection list QLabel *m_availSpace; // Text label to display available space on selected destination QMultiLineEdit *m_output; // Multi-line edit to display status QPushButton *m_btnStart; // Start/abort/close button QPushButton *m_btnOptions; // Installation options button // Commands and packages to execute int m_numCommands; // Number of commands to be executed int m_currCommand; // Number of currently executing command OPackage::Command m_command[3]; // List of commands to be executed QStringList m_packages[3]; // Lists of package names associated to commands (m_command[]) OConfItem *m_destItem; // Pointer to destination for package installation private slots: // UI control slots void slotDisplayAvailSpace( const QString &destination ); void slotBtnStart(); void slotBtnOptions(); void slotProcessDone( Opie::Core::OProcess *proc ); // Execution slots void slotOutput( char *msg ); diff --git a/noncore/settings/packagemanager/mainwindow.cpp b/noncore/settings/packagemanager/mainwindow.cpp index 459a75b..8a5b90c 100644 --- a/noncore/settings/packagemanager/mainwindow.cpp +++ b/noncore/settings/packagemanager/mainwindow.cpp @@ -291,50 +291,50 @@ void MainWindow::searchForPackage( const QString &text ) if ( !text.isEmpty() ) { // look through package list for text startng at current position QCheckListItem *start = static_cast<QCheckListItem *>(m_packageList.currentItem()); if ( start == 0 ) start = static_cast<QCheckListItem *>(m_packageList.firstChild()); // for ( QCheckListItem *item = static_cast<QCheckListItem *>(start->nextSibling()); item != 0 ; for ( QCheckListItem *item = static_cast<QCheckListItem *>(start); item != 0 ; item = static_cast<QCheckListItem *>(item->nextSibling()) ) { if ( item->text().lower().find( text ) != -1 ) { m_packageList.ensureItemVisible( item ); m_packageList.setCurrentItem( item ); break; } } } } void MainWindow::installLocalPackage( const QString &ipkFile ) { // Install selected file - InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Install local package" ), true, - OPackage::Install, ipkFile ); + InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Install local package" ), + OPackage::Install, ipkFile ); connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); // Display widget m_widgetStack.addWidget( dlg, 3 ); m_widgetStack.raiseWidget( dlg ); } void MainWindow::setDocument( const QString &ipkFile ) { QString file = ipkFile; DocLnk lnk( ipkFile ); if ( lnk.isValid() ) file = lnk.file(); installLocalPackage( file ); } void MainWindow::initPackageInfo() { m_widgetStack.raiseWidget( &m_statusWidget ); // Load package list m_packman.loadAvailablePackages(); m_packman.loadInstalledPackages(); @@ -365,109 +365,109 @@ void MainWindow::slotWidgetStackShow( QWidget *widget ) { m_menuBar.hide(); m_toolBar.hide(); } } void MainWindow::slotInitStatusBar( int numSteps ) { m_statusBar.setTotalSteps( numSteps ); } void MainWindow::slotStatusText( const QString &status ) { m_statusText.setText( status ); } void MainWindow::slotStatusBar( int currStep ) { m_statusBar.setProgress( currStep ); } void MainWindow::slotUpdate() { // Create package manager output widget - InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Update package information" ), false, + InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Update package information" ), OPackage::Update ); connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); // Display widget m_widgetStack.addWidget( dlg, 3 ); m_widgetStack.raiseWidget( dlg ); } void MainWindow::slotUpgrade() { // Create package manager output widget - InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Upgrade installed packages" ), false, + InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Upgrade installed packages" ), OPackage::Upgrade ); connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); // Display widget m_widgetStack.addWidget( dlg, 3 ); m_widgetStack.raiseWidget( dlg ); } void MainWindow::slotDownload() { // Retrieve list of packages selected for download (if any) QStringList workingPackages; for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild()); item != 0 ; item = static_cast<QCheckListItem *>(item->nextSibling()) ) { if ( item->isOn() ) workingPackages.append( item->text() ); } if ( workingPackages.isEmpty() ) { QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) ); return; } else { // Download selected packages m_config.setGroup( "settings" ); QString workingDir = m_config.readEntry( "DownloadDir", "/tmp" ); bool ok = false; QString text = EntryDlg::getText( tr( "Download" ), tr( "Enter path to download package to:" ), workingDir, &ok, this ); if ( ok && !text.isEmpty() ) workingDir = text; // user entered something and pressed ok else return; // user entered nothing or pressed cancel // Store download directory in config file m_config.writeEntry( "DownloadDir", workingDir ); // Get starting directory QDir::setCurrent( workingDir ); // Create package manager output widget - InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Download packages" ), false, - OPackage::Download, workingPackages ); + InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Download packages" ), + OPackage::Download, workingPackages ); connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); // Display widget m_widgetStack.addWidget( dlg, 3 ); m_widgetStack.raiseWidget( dlg ); } } void MainWindow::slotApply() { QStringList removeList; QStringList installList; QStringList upgradeList; for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild()); item != 0 ; item = static_cast<QCheckListItem *>(item->nextSibling()) ) { if ( item->isOn() ) { OPackage *package = m_packman.findPackage( item->text() ); if ( package ) { if ( !package->versionInstalled().isNull() ) @@ -499,60 +499,57 @@ void MainWindow::slotApply() } else if ( answer == 2 ) // Reinstall { installList.append( item->text() ); } } } else { // Install package installList.append( item->text() ); } } } } // If nothing is selected, display message and exit if ( removeList.isEmpty() && installList.isEmpty() && upgradeList.isEmpty() ) { QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) ); return; } // Send command only if there are packages to process - OPackage::Command removeCmd = OPackage::NotDefined; - if ( !removeList.isEmpty() ) - removeCmd = OPackage::Remove; - OPackage::Command installCmd = OPackage::NotDefined; - if ( !installList.isEmpty() ) - installCmd = OPackage::Install; - OPackage::Command upgradeCmd = OPackage::NotDefined; - if ( !upgradeList.isEmpty() ) - upgradeCmd = OPackage::Upgrade; + OPackage::Command removeCmd = !removeList.isEmpty() ? OPackage::Remove + : OPackage::NotDefined; + OPackage::Command installCmd = !installList.isEmpty() ? OPackage::Install + : OPackage::NotDefined; + OPackage::Command upgradeCmd = !upgradeList.isEmpty() ? OPackage::Upgrade + : OPackage::NotDefined; // Create package manager output widget - InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Apply changes" ), !installList.isEmpty(), + InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Apply changes" ), removeCmd, removeList, installCmd, installList, upgradeCmd, upgradeList ); connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); // Display widget m_widgetStack.addWidget( dlg, 3 ); m_widgetStack.raiseWidget( dlg ); } void MainWindow::slotInstallLocal() { // Display file open dialog with only package files MimeTypes type; QStringList packages; packages << "application/ipkg"; type.insert( tr( "Application Packages" ), packages ); QString package = Opie::Ui::OFileDialog::getOpenFileName( Opie::Ui::OFileSelector::NORMAL, "/", QString::null, type ); if ( !package.isNull() ) installLocalPackage( package ); } void MainWindow::slotCloseDlg() diff --git a/noncore/settings/packagemanager/opie-packagemanager.control b/noncore/settings/packagemanager/opie-packagemanager.control index 5385ea5..aacd0ca 100644 --- a/noncore/settings/packagemanager/opie-packagemanager.control +++ b/noncore/settings/packagemanager/opie-packagemanager.control @@ -1,10 +1,10 @@ Package: opie-packagemanager Files: plugins/application/libpackagemanager.so* bin/packagemanager pics/packagemanager apps/Settings/packagemanager.desktop Priority: optional Section: opie/settings -Depends: task-opie-minimal, libopiecore2, libopieui2, libipkg (>=0.99.120) +Depends: task-opie-minimal, libopiecore2, libopieui2, libipkg (>=0.99.120), ipkg-link Replaces: packagemanager Architecture: arm Maintainer: Dan Williams (drw@handhelds.org) Description: Opie package management client -Version: 0.4.0$EXTRAVERSION +Version: 0.5.0$EXTRAVERSION |