author | andyq <andyq> | 2002-11-09 15:39:15 (UTC) |
---|---|---|
committer | andyq <andyq> | 2002-11-09 15:39:15 (UTC) |
commit | 5ab7af2bb5d98aef639cbc2ca14f630813fd4fe9 (patch) (unidiff) | |
tree | 3a43ab203aa57960151ba11a091aefaebbf1a566 /noncore/settings/aqpkg/networkpkgmgr.cpp | |
parent | a121ae6e8e6f16ba355e8c86eba2b98792c93091 (diff) | |
download | opie-5ab7af2bb5d98aef639cbc2ca14f630813fd4fe9.zip opie-5ab7af2bb5d98aef639cbc2ca14f630813fd4fe9.tar.gz opie-5ab7af2bb5d98aef639cbc2ca14f630813fd4fe9.tar.bz2 |
Added filter menu - contains 3 filters - show uninstalled packages,
show installed packages and show upgraded packages
Diffstat (limited to 'noncore/settings/aqpkg/networkpkgmgr.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/aqpkg/networkpkgmgr.cpp | 51 |
1 files changed, 43 insertions, 8 deletions
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp index 76c7a9c..d43c6ac 100644 --- a/noncore/settings/aqpkg/networkpkgmgr.cpp +++ b/noncore/settings/aqpkg/networkpkgmgr.cpp | |||
@@ -47,48 +47,48 @@ extern int compareVersions( const char *v1, const char *v2 ); | |||
47 | 47 | ||
48 | NetworkPackageManager::NetworkPackageManager( DataManager *dataManager, QWidget *parent, const char *name) | 48 | NetworkPackageManager::NetworkPackageManager( DataManager *dataManager, QWidget *parent, const char *name) |
49 | : QWidget(parent, name) | 49 | : QWidget(parent, name) |
50 | { | 50 | { |
51 | dataMgr = dataManager; | 51 | dataMgr = dataManager; |
52 | 52 | ||
53 | #ifdef QWS | 53 | #ifdef QWS |
54 | // read download directory from config file | 54 | // read download directory from config file |
55 | Config cfg( "aqpkg" ); | 55 | Config cfg( "aqpkg" ); |
56 | cfg.setGroup( "settings" ); | 56 | cfg.setGroup( "settings" ); |
57 | currentlySelectedServer = cfg.readEntry( "selectedServer", "local" ); | 57 | currentlySelectedServer = cfg.readEntry( "selectedServer", "local" ); |
58 | showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" ); | 58 | showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" ); |
59 | |||
59 | #endif | 60 | #endif |
61 | |||
62 | showUninstalledPkgs = false; | ||
63 | showInstalledPkgs = false; | ||
64 | showUpgradedPkgs = false; | ||
60 | 65 | ||
61 | 66 | ||
62 | initGui(); | 67 | initGui(); |
63 | setupConnections(); | 68 | setupConnections(); |
64 | 69 | ||
65 | updateData(); | 70 | updateData(); |
66 | // progressDlg = 0; | ||
67 | // timerId = startTimer( 100 ); | ||
68 | } | 71 | } |
69 | 72 | ||
70 | NetworkPackageManager::~NetworkPackageManager() | 73 | NetworkPackageManager::~NetworkPackageManager() |
71 | { | 74 | { |
72 | } | 75 | } |
73 | 76 | ||
74 | void NetworkPackageManager :: timerEvent ( QTimerEvent * ) | 77 | void NetworkPackageManager :: timerEvent ( QTimerEvent * ) |
75 | { | 78 | { |
76 | killTimer( timerId ); | 79 | killTimer( timerId ); |
77 | 80 | ||
78 | // showProgressDialog(); | ||
79 | // Add server names to listbox | 81 | // Add server names to listbox |
80 | updateData(); | 82 | updateData(); |
81 | |||
82 | // progressDlg->hide(); | ||
83 | } | 83 | } |
84 | 84 | ||
85 | void NetworkPackageManager :: updateData() | 85 | void NetworkPackageManager :: updateData() |
86 | { | 86 | { |
87 | serversList->clear(); | 87 | serversList->clear(); |
88 | packagesList->clear(); | 88 | packagesList->clear(); |
89 | 89 | ||
90 | 90 | ||
91 | vector<Server>::iterator it; | 91 | vector<Server>::iterator it; |
92 | int activeItem = -1; | 92 | int activeItem = -1; |
93 | int i; | 93 | int i; |
94 | for ( i = 0, it = dataMgr->getServerList().begin() ; it != dataMgr->getServerList().end() ; ++it, ++i ) | 94 | for ( i = 0, it = dataMgr->getServerList().begin() ; it != dataMgr->getServerList().end() ; ++it, ++i ) |
@@ -214,27 +214,44 @@ void NetworkPackageManager :: serverSelected( int ) | |||
214 | cfg.writeEntry( "selectedServer", currentlySelectedServer ); | 214 | cfg.writeEntry( "selectedServer", currentlySelectedServer ); |
215 | #endif | 215 | #endif |
216 | 216 | ||
217 | Server *s = dataMgr->getServer( serverName ); | 217 | Server *s = dataMgr->getServer( serverName ); |
218 | 218 | ||
219 | vector<Package> &list = s->getPackageList(); | 219 | vector<Package> &list = s->getPackageList(); |
220 | vector<Package>::iterator it; | 220 | vector<Package>::iterator it; |
221 | for ( it = list.begin() ; it != list.end() ; ++it ) | 221 | for ( it = list.begin() ; it != list.end() ; ++it ) |
222 | { | 222 | { |
223 | 223 | ||
224 | QString text = ""; | 224 | QString text = ""; |
225 | 225 | ||
226 | // If the local server, only display installed packages | 226 | // Apply show only uninstalled packages filter |
227 | if ( serverName == LOCAL_SERVER && !it->isInstalled() ) | 227 | if ( showUninstalledPkgs && it->isInstalled() ) |
228 | continue; | 228 | continue; |
229 | |||
230 | // Apply show only installed packages filter | ||
231 | if ( showInstalledPkgs && !it->isInstalled() ) | ||
232 | continue; | ||
233 | |||
234 | // Apply show only new installed packages filter | ||
235 | if ( showUpgradedPkgs ) | ||
236 | { | ||
237 | if ( !it->isInstalled() || | ||
238 | compareVersions( it->getInstalledVersion(), it->getVersion() ) != 1 ) | ||
239 | continue; | ||
240 | } | ||
241 | |||
242 | // If the local server, only display installed packages | ||
243 | if ( serverName == LOCAL_SERVER && !it->isInstalled() ) | ||
244 | continue; | ||
245 | |||
229 | 246 | ||
230 | text += it->getPackageName(); | 247 | text += it->getPackageName(); |
231 | if ( it->isInstalled() ) | 248 | if ( it->isInstalled() ) |
232 | { | 249 | { |
233 | text += " (installed)"; | 250 | text += " (installed)"; |
234 | 251 | ||
235 | // If a different version of package is available, postfix it with an * | 252 | // If a different version of package is available, postfix it with an * |
236 | if ( it->getVersion() != it->getInstalledVersion() ) | 253 | if ( it->getVersion() != it->getInstalledVersion() ) |
237 | { | 254 | { |
238 | 255 | ||
239 | if ( compareVersions( it->getInstalledVersion(), it->getVersion() ) == 1 ) | 256 | if ( compareVersions( it->getInstalledVersion(), it->getVersion() ) == 1 ) |
240 | text += "*"; | 257 | text += "*"; |
@@ -760,12 +777,30 @@ void NetworkPackageManager :: searchForPackage( bool findNext ) | |||
760 | { | 777 | { |
761 | cout << "checking " << item->text().lower() << endl; | 778 | cout << "checking " << item->text().lower() << endl; |
762 | if ( item->text().lower().find( lastSearchText ) != -1 ) | 779 | if ( item->text().lower().find( lastSearchText ) != -1 ) |
763 | { | 780 | { |
764 | cout << "matched " << item->text() << endl; | 781 | cout << "matched " << item->text() << endl; |
765 | packagesList->ensureItemVisible( item ); | 782 | packagesList->ensureItemVisible( item ); |
766 | packagesList->setCurrentItem( item ); | 783 | packagesList->setCurrentItem( item ); |
767 | break; | 784 | break; |
768 | } | 785 | } |
769 | } | 786 | } |
770 | } | 787 | } |
771 | } | 788 | } |
789 | |||
790 | void NetworkPackageManager :: showOnlyUninstalledPackages( bool val ) | ||
791 | { | ||
792 | showUninstalledPkgs = val; | ||
793 | serverSelected( -1 ); | ||
794 | } | ||
795 | |||
796 | void NetworkPackageManager :: showOnlyInstalledPackages( bool val ) | ||
797 | { | ||
798 | showInstalledPkgs = val; | ||
799 | serverSelected( -1 ); | ||
800 | } | ||
801 | |||
802 | void NetworkPackageManager :: showUpgradedPackages( bool val ) | ||
803 | { | ||
804 | showUpgradedPkgs = val; | ||
805 | serverSelected( -1 ); | ||
806 | } | ||