author | andyq <andyq> | 2002-11-17 20:03:25 (UTC) |
---|---|---|
committer | andyq <andyq> | 2002-11-17 20:03:25 (UTC) |
commit | d94c9d39ab6e744f848a04c07eac03f20c91987c (patch) (unidiff) | |
tree | a9f32cca7c59ae565ab9caa3caf567100ed07cb4 /noncore/settings/aqpkg/networkpkgmgr.cpp | |
parent | a94877f543bf0ebc2ec9c4c931cb5f21713b7872 (diff) | |
download | opie-d94c9d39ab6e744f848a04c07eac03f20c91987c.zip opie-d94c9d39ab6e744f848a04c07eac03f20c91987c.tar.gz opie-d94c9d39ab6e744f848a04c07eac03f20c91987c.tar.bz2 |
Added filter by category, and added extra fields to package display (Section and size)
Diffstat (limited to 'noncore/settings/aqpkg/networkpkgmgr.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/aqpkg/networkpkgmgr.cpp | 63 |
1 files changed, 56 insertions, 7 deletions
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp index 188f90d..0814121 100644 --- a/noncore/settings/aqpkg/networkpkgmgr.cpp +++ b/noncore/settings/aqpkg/networkpkgmgr.cpp | |||
@@ -41,4 +41,5 @@ using namespace std; | |||
41 | #include "inputdlg.h" | 41 | #include "inputdlg.h" |
42 | #include "letterpushbutton.h" | 42 | #include "letterpushbutton.h" |
43 | #include "categoryfilterimpl.h" | ||
43 | 44 | ||
44 | #include "global.h" | 45 | #include "global.h" |
@@ -63,5 +64,5 @@ NetworkPackageManager::NetworkPackageManager( DataManager *dataManager, QWidget | |||
63 | showInstalledPkgs = false; | 64 | showInstalledPkgs = false; |
64 | showUpgradedPkgs = false; | 65 | showUpgradedPkgs = false; |
65 | 66 | categoryFilterEnabled = false; | |
66 | 67 | ||
67 | initGui(); | 68 | initGui(); |
@@ -240,4 +241,11 @@ void NetworkPackageManager :: serverSelected( int ) | |||
240 | } | 241 | } |
241 | 242 | ||
243 | // Apply the section filter | ||
244 | if ( categoryFilterEnabled && categoryFilter != "" ) | ||
245 | { | ||
246 | if ( it->getSection() == "" || categoryFilter.find( it->getSection().lower() ) == -1 ) | ||
247 | continue; | ||
248 | } | ||
249 | |||
242 | // If the local server, only display installed packages | 250 | // If the local server, only display installed packages |
243 | if ( serverName == LOCAL_SERVER && !it->isInstalled() ) | 251 | if ( serverName == LOCAL_SERVER && !it->isInstalled() ) |
@@ -296,4 +304,7 @@ void NetworkPackageManager :: serverSelected( int ) | |||
296 | } | 304 | } |
297 | } | 305 | } |
306 | |||
307 | new QCheckListItem( item, QString( "Size - " ) + it->getPackageSize() ); | ||
308 | new QCheckListItem( item, QString( "Section - " ) + it->getSection() ); | ||
298 | packagesList->insertItem( item ); | 309 | packagesList->insertItem( item ); |
299 | } | 310 | } |
@@ -326,8 +337,4 @@ void NetworkPackageManager :: updateServer() | |||
326 | // Update the current server | 337 | // Update the current server |
327 | // Display dialog | 338 | // Display dialog |
328 | // ProgressDlg *progDlg = new ProgressDlg( this ); | ||
329 | // QString status = "Updating package lists..."; | ||
330 | // progDlg->show(); | ||
331 | // progDlg->setText( status ); | ||
332 | 339 | ||
333 | // Disable buttons to stop silly people clicking lots on them :) | 340 | // Disable buttons to stop silly people clicking lots on them :) |
@@ -687,5 +694,5 @@ InstallData NetworkPackageManager :: dealWithItem( QCheckListItem *item ) | |||
687 | { | 694 | { |
688 | case 0: // Try again or Enter | 695 | case 0: // Try again or Enter |
689 | // option 0 = Remove | 696 | // option 0 = Remove |
690 | item.option = "D"; | 697 | item.option = "D"; |
691 | break; | 698 | break; |
@@ -744,5 +751,5 @@ void NetworkPackageManager :: letterPushed( QString t ) | |||
744 | packagesList->ensureItemVisible( item ); | 751 | packagesList->ensureItemVisible( item ); |
745 | break; | 752 | break; |
746 | } | 753 | } |
747 | 754 | ||
748 | item = (QCheckListItem *)item->nextSibling(); | 755 | item = (QCheckListItem *)item->nextSibling(); |
@@ -805,2 +812,44 @@ void NetworkPackageManager :: showUpgradedPackages( bool val ) | |||
805 | serverSelected( -1 ); | 812 | serverSelected( -1 ); |
806 | } | 813 | } |
814 | |||
815 | bool NetworkPackageManager :: filterByCategory( bool val ) | ||
816 | { | ||
817 | if ( val ) | ||
818 | { | ||
819 | if ( categoryFilter == "" ) | ||
820 | { | ||
821 | if ( !setFilterCategory() ) | ||
822 | return false; | ||
823 | } | ||
824 | |||
825 | categoryFilterEnabled = true; | ||
826 | serverSelected( -1 ); | ||
827 | return true; | ||
828 | } | ||
829 | else | ||
830 | { | ||
831 | // Turn off filter | ||
832 | categoryFilterEnabled = false; | ||
833 | serverSelected( -1 ); | ||
834 | return false; | ||
835 | } | ||
836 | } | ||
837 | |||
838 | bool NetworkPackageManager :: setFilterCategory( ) | ||
839 | { | ||
840 | // Get categories; | ||
841 | CategoryFilterImpl dlg( DataManager::getAvailableCategories(), categoryFilter, this ); | ||
842 | if ( dlg.exec() == QDialog::Accepted ) | ||
843 | { | ||
844 | categoryFilter = dlg.getSelectedFilter(); | ||
845 | |||
846 | if ( categoryFilter == "" ) | ||
847 | return false; | ||
848 | |||
849 | categoryFilterEnabled = true; | ||
850 | serverSelected( -1 ); | ||
851 | return true; | ||
852 | } | ||
853 | |||
854 | return false; | ||
855 | } | ||