-rw-r--r-- | noncore/settings/packagemanager/ChangeLog | 4 | ||||
-rw-r--r-- | noncore/settings/packagemanager/mainwindow.cpp | 51 |
2 files changed, 48 insertions, 7 deletions
diff --git a/noncore/settings/packagemanager/ChangeLog b/noncore/settings/packagemanager/ChangeLog index 744122f..6ad724f 100644 --- a/noncore/settings/packagemanager/ChangeLog +++ b/noncore/settings/packagemanager/ChangeLog @@ -1,21 +1,25 @@ +2004-02-13 Dan Williams <drw@handhelds.org> + + * Fix handling of filtering options in View menu + 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> * Added package download functionality * Have Opie update links after install/removal so that apps will display properly in Launcher 2004-01-20 Dan Williams <drw@handhelds.org> * Released version 0.2.0 * Converted to use libipkg in place of spawning ipkg process 2004-01-13 Dan Williams <drw@handhelds.org> * Released version 0.1.0 * Initial check-in of new package management client to eventually replace AQPkg diff --git a/noncore/settings/packagemanager/mainwindow.cpp b/noncore/settings/packagemanager/mainwindow.cpp index 2cb11ba..8fd960f 100644 --- a/noncore/settings/packagemanager/mainwindow.cpp +++ b/noncore/settings/packagemanager/mainwindow.cpp @@ -152,140 +152,140 @@ void MainWindow::initUI() QWhatsThis::add( m_findEdit, tr( "Type the text to search for here." ) ); m_findBar.setStretchableWidget( m_findEdit ); connect( m_findEdit, SIGNAL(textChanged(const QString &)), this, SLOT(slotFindChanged(const QString &)) ); // Packages menu QPopupMenu *popup = new QPopupMenu( this ); QAction *a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "packagemanager/update" ), QString::null, 0, this, 0 ); a->setWhatsThis( tr( "Click here to update package lists from servers." ) ); connect( a, SIGNAL(activated()), this, SLOT(slotUpdate()) ); a->addTo( popup ); a->addTo( &m_toolBar ); QAction *actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "packagemanager/upgrade" ), QString::null, 0, this, 0 ); actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) ); connect( actionUpgrade, SIGNAL(activated()), this, SLOT(slotUpgrade()) ); actionUpgrade->addTo( popup ); actionUpgrade->addTo( &m_toolBar ); QPixmap iconDownload = Resource::loadPixmap( "packagemanager/download" ); QPixmap iconRemove = Resource::loadPixmap( "packagemanager/remove" ); QAction *actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); connect( actionDownload, SIGNAL(activated()), this, SLOT(slotDownload()) ); actionDownload->addTo( popup ); actionDownload->addTo( &m_toolBar ); a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "packagemanager/apply" ), QString::null, 0, this, 0 ); a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) ); connect( a, SIGNAL(activated()), this, SLOT(slotApply()) ); a->addTo( popup ); a->addTo( &m_toolBar ); popup->insertSeparator(); a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 ); a->setWhatsThis( tr( "Click here to configure this application." ) ); connect( a, SIGNAL(activated()), this, SLOT(slotConfigure()) ); a->addTo( popup ); mb->insertItem( tr( "Actions" ), popup ); // View menu popup = new QPopupMenu( this ); m_actionShowNotInstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 ); m_actionShowNotInstalled->setToggleAction( true ); m_actionShowNotInstalled->setWhatsThis( tr( "Click here to show packages available which have not been installed." ) ); connect( m_actionShowNotInstalled, SIGNAL(activated()), this, SLOT(slotShowNotInstalled()) ); m_actionShowNotInstalled->addTo( popup ); m_actionShowInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 ); m_actionShowInstalled->setToggleAction( true ); m_actionShowInstalled->setWhatsThis( tr( "Click here to show packages currently installed on this device." ) ); connect( m_actionShowInstalled, SIGNAL(activated()), this, SLOT(slotShowInstalled()) ); m_actionShowInstalled->addTo( popup ); m_actionShowUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 ); m_actionShowUpdated->setToggleAction( true ); m_actionShowUpdated->setWhatsThis( tr( "Click here to show packages currently installed on this device which have a newer version available." ) ); connect( m_actionShowUpdated, SIGNAL(activated()), this, SLOT(slotShowUpdated()) ); m_actionShowUpdated->addTo( popup ); popup->insertSeparator(); - a = new QAction( tr( "Configure filter" ), QString::null, 0, this, 0 ); - a->setWhatsThis( tr( "Click here to change package filter criteria." ) ); - connect( a, SIGNAL(activated()), this, SLOT(slotFilterChange()) ); - a->addTo( popup ); - m_actionFilter = new QAction( tr( "Filter" ), Resource::loadPixmap( "packagemanager/filter" ), QString::null, 0, this, 0 ); m_actionFilter->setToggleAction( true ); m_actionFilter->setWhatsThis( tr( "Click here to apply current filter." ) ); connect( m_actionFilter, SIGNAL(toggled(bool)), this, SLOT(slotFilter(bool)) ); m_actionFilter->addTo( popup ); + a = new QAction( tr( "Filter settings" ), QString::null, 0, this, 0 ); + a->setWhatsThis( tr( "Click here to change the package filter criteria." ) ); + connect( a, SIGNAL(activated()), this, SLOT(slotFilterChange()) ); + a->addTo( popup ); + popup->insertSeparator(); a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); a->setWhatsThis( tr( "Click here to search for text in package names." ) ); connect( a, SIGNAL(activated()), this, SLOT(slotFindShowToolbar()) ); a->addTo( popup ); m_actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 ); m_actionFindNext->setEnabled( false ); m_actionFindNext->setWhatsThis( tr( "Click here to find the next package name containing the text you are searching for." ) ); connect( m_actionFindNext, SIGNAL(activated()), this, SLOT(slotFindNext()) ); m_actionFindNext->addTo( popup ); m_actionFindNext->addTo( &m_findBar ); mb->insertItem( tr( "View" ), popup ); // Finish find toolbar creation a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); a->setWhatsThis( tr( "Click here to hide the find toolbar." ) ); connect( a, SIGNAL(activated()), this, SLOT(slotFindHideToolbar()) ); a->addTo( &m_findBar ); m_findBar.hide(); } void MainWindow::loadPackageList( OPackageList *packages, bool clearList ) { if ( clearList ) m_packageList.clear(); if ( packages ) { for ( OPackageListIterator packageIt( *packages ); packageIt.current(); ++packageIt ) { OPackage *package = packageIt.current(); QCheckListItem *item = new QCheckListItem( &m_packageList, package->name(), QCheckListItem::CheckBox ); m_packageList.insertItem( item ); // If a different version of package is available, show update available icon // Otherwise, show installed icon if ( !package->versionInstalled().isNull() ) { if ( m_packman.compareVersions( package->version(), package->versionInstalled() ) == 1 ) item->setPixmap( 0, m_iconUpdated ); else item->setPixmap( 0, m_iconInstalled ); } else item->setPixmap( 0, m_iconNull ); } } } 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 ; @@ -493,190 +493,227 @@ void MainWindow::slotApply() if ( !removeList && !installList && !upgradeList ) { 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 && !removeList->isEmpty() ) removeCmd = OPackage::Remove; OPackage::Command installCmd = OPackage::NotDefined; if ( installList && !installList->isEmpty() ) installCmd = OPackage::Install; OPackage::Command upgradeCmd = OPackage::NotDefined; if ( upgradeList && !upgradeList->isEmpty() ) upgradeCmd = OPackage::Upgrade; // Create package manager output widget InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Apply changes" ), true, 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::slotCloseDlg() { // Close install dialog delete m_widgetStack.visibleWidget(); // Reload package list initPackageInfo(); // Update Opie launcher links QCopEnvelope e("QPE/System", "linkChanged(QString)"); QString lf = QString::null; e << lf; } void MainWindow::slotConfigure() { if ( m_packman.configureDlg( false ) ) { if ( PromptDlg::ask( tr( "Config updated" ), tr( "The configuration has been updated. Do you want to update server and package information now?" ), tr( "Yes" ), tr( "No" ), this ) == 1 ) { // Update package list and reload package info slotUpdate(); } } } void MainWindow::slotShowNotInstalled() { OPackageList *packageList; if ( m_actionShowNotInstalled->isOn() ) { m_actionShowInstalled->setOn( false ); m_actionShowUpdated->setOn( false ); + m_actionFilter->setOn( false ); packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, OPackageManager::NotInstalled, QString::null ); } else packageList = m_packman.packages(); if ( packageList ) { loadPackageList( packageList, true ); delete packageList; } } void MainWindow::slotShowInstalled() { OPackageList *packageList; if ( m_actionShowInstalled->isOn() ) { m_actionShowNotInstalled->setOn( false ); m_actionShowUpdated->setOn( false ); + m_actionFilter->setOn( false ); packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, OPackageManager::Installed, QString::null ); } else packageList = m_packman.packages(); if ( packageList ) { loadPackageList( packageList, true ); delete packageList; } } void MainWindow::slotShowUpdated() { OPackageList *packageList; if ( m_actionShowUpdated->isOn() ) { m_actionShowInstalled->setOn( false ); m_actionShowNotInstalled->setOn( false ); + m_actionFilter->setOn( false ); packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, OPackageManager::Updated, QString::null ); } else packageList = m_packman.packages(); if ( packageList ) { loadPackageList( packageList, true ); delete packageList; } } void MainWindow::slotFilterChange() { FilterDlg dlg( this, &m_packman, m_filterName, m_filterServer, m_filterDest, m_filterStatus, m_filterCategory ); if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) { m_filterName = dlg.name(); m_filterServer = dlg.server(); m_filterDest = dlg.destination(); m_filterStatus = dlg.status(); m_filterCategory = dlg.category(); m_actionFilter->setOn( true ); slotFilter( true ); } else { m_actionFilter->setOn( false ); slotFilter( false ); } } void MainWindow::slotFilter( bool isOn ) { OPackageList *packageList; if ( isOn ) { - packageList = m_packman.filterPackages( m_filterName, m_filterServer, m_filterDest, - m_filterStatus, m_filterCategory ); + // Turn off other filtering options + m_actionShowNotInstalled->setOn( false ); + m_actionShowInstalled->setOn( false ); + m_actionShowUpdated->setOn( false ); + + // If the filter settings have not been set yet, display filter dialog + if ( m_filterName.isNull() && m_filterServer.isNull() && m_filterDest.isNull() && + m_filterStatus == OPackageManager::NotDefined && m_filterCategory.isNull() ) + { + FilterDlg dlg( this, &m_packman, m_filterName, m_filterServer, m_filterDest, m_filterStatus, + m_filterCategory ); + if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) + { + m_filterName = dlg.name(); + m_filterServer = dlg.server(); + m_filterDest = dlg.destination(); + m_filterStatus = dlg.status(); + m_filterCategory = dlg.category(); + m_actionFilter->setOn( true ); + packageList = m_packman.filterPackages( m_filterName, m_filterServer, m_filterDest, + m_filterStatus, m_filterCategory ); + } + else + { + m_actionFilter->setOn( false ); + packageList = m_packman.packages(); + } + } + else + { + m_actionFilter->setOn( true ); + packageList = m_packman.filterPackages( m_filterName, m_filterServer, m_filterDest, + m_filterStatus, m_filterCategory ); + } + + } else packageList = m_packman.packages(); if ( packageList ) { loadPackageList( packageList, true ); delete packageList; } } void MainWindow::slotFindShowToolbar() { m_findBar.show(); m_findEdit->setFocus(); } void MainWindow::slotFindHideToolbar() { m_findBar.hide(); } void MainWindow::slotFindChanged( const QString &findText ) { m_actionFindNext->setEnabled( !findText.isEmpty() ); searchForPackage( findText ); } void MainWindow::slotFindNext() { searchForPackage( m_findEdit->text() ); } void MainWindow::slotDisplayPackageInfo( QListViewItem *packageItem ) { QString packageName( ( static_cast<QCheckListItem*>( packageItem ) )->text() ); // Create package manager output widget PackageInfoDlg *dlg = new PackageInfoDlg( this, &m_packman, packageName ); // Display widget m_widgetStack.addWidget( dlg, 3 ); m_widgetStack.raiseWidget( dlg ); } |