author | drw <drw> | 2003-02-06 01:19:25 (UTC) |
---|---|---|
committer | drw <drw> | 2003-02-06 01:19:25 (UTC) |
commit | 79588befde53765db0a92977c6890a4d226096e7 (patch) (unidiff) | |
tree | 83b6dd14c49733b9759fad04147bf0bee50793fe | |
parent | bbb3690f12191763a407e6a0edd521113b3c25ac (diff) | |
download | opie-79588befde53765db0a92977c6890a4d226096e7.zip opie-79588befde53765db0a92977c6890a4d226096e7.tar.gz opie-79588befde53765db0a92977c6890a4d226096e7.tar.bz2 |
Change all vector<> to QList<>. First step in removing dependency on libstdc++.
-rw-r--r-- | noncore/settings/aqpkg/datamgr.cpp | 82 | ||||
-rw-r--r-- | noncore/settings/aqpkg/datamgr.h | 15 | ||||
-rw-r--r-- | noncore/settings/aqpkg/installdlgimpl.cpp | 82 | ||||
-rw-r--r-- | noncore/settings/aqpkg/installdlgimpl.h | 12 | ||||
-rw-r--r-- | noncore/settings/aqpkg/mainwin.cpp | 143 | ||||
-rw-r--r-- | noncore/settings/aqpkg/mainwin.h | 2 | ||||
-rw-r--r-- | noncore/settings/aqpkg/server.cpp | 69 | ||||
-rw-r--r-- | noncore/settings/aqpkg/server.h | 8 | ||||
-rw-r--r-- | noncore/settings/aqpkg/settingsimpl.cpp | 38 |
9 files changed, 241 insertions, 210 deletions
diff --git a/noncore/settings/aqpkg/datamgr.cpp b/noncore/settings/aqpkg/datamgr.cpp index 2c83e28..79f36e1 100644 --- a/noncore/settings/aqpkg/datamgr.cpp +++ b/noncore/settings/aqpkg/datamgr.cpp | |||
@@ -38,4 +38,7 @@ DataManager::DataManager() | |||
38 | activeServer = ""; | 38 | activeServer = ""; |
39 | availableCategories = "#"; | 39 | availableCategories = "#"; |
40 | |||
41 | serverList.setAutoDelete( TRUE ); | ||
42 | destList.setAutoDelete( TRUE ); | ||
40 | } | 43 | } |
41 | 44 | ||
@@ -44,30 +47,24 @@ DataManager::~DataManager() | |||
44 | } | 47 | } |
45 | 48 | ||
46 | vector<Server>::iterator DataManager :: getServer( const char *name ) | 49 | Server *DataManager :: getServer( const char *name ) |
47 | { | 50 | { |
48 | vector<Server>::iterator it = serverList.begin(); | 51 | QListIterator<Server> it( serverList ); |
49 | while ( it != serverList.end() ) | 52 | while ( it.current() && it.current()->getServerName() != name ) |
50 | { | 53 | { |
51 | if ( it->getServerName() == name ) | ||
52 | return it; | ||
53 | |||
54 | ++it; | 54 | ++it; |
55 | } | 55 | } |
56 | 56 | ||
57 | return serverList.end(); | 57 | return it.current(); |
58 | } | 58 | } |
59 | 59 | ||
60 | vector<Destination>::iterator DataManager :: getDestination( const char *name ) | 60 | Destination *DataManager :: getDestination( const char *name ) |
61 | { | 61 | { |
62 | vector<Destination>::iterator it = destList.begin(); | 62 | QListIterator<Destination> it( destList ); |
63 | while ( it != destList.end() ) | 63 | while ( it.current() && it.current()->getDestinationName() != name ) |
64 | { | 64 | { |
65 | if ( it->getDestinationName() == name ) | ||
66 | return it; | ||
67 | |||
68 | ++it; | 65 | ++it; |
69 | } | 66 | } |
70 | 67 | ||
71 | return destList.end(); | 68 | return it.current(); |
72 | } | 69 | } |
73 | 70 | ||
@@ -76,6 +73,6 @@ void DataManager :: loadServers() | |||
76 | // First add our local server - not really a server but | 73 | // First add our local server - not really a server but |
77 | // the local config (which packages are installed) | 74 | // the local config (which packages are installed) |
78 | serverList.push_back( Server( LOCAL_SERVER, "" ) ); | 75 | serverList.append( new Server( LOCAL_SERVER, "" ) ); |
79 | serverList.push_back( Server( LOCAL_IPKGS, "" ) ); | 76 | serverList.append( new Server( LOCAL_IPKGS, "" ) ); |
80 | 77 | ||
81 | #ifdef QWS | 78 | #ifdef QWS |
@@ -110,11 +107,11 @@ void DataManager :: loadServers() | |||
110 | // Should Handle #src, # src, src, and combinations of | 107 | // Should Handle #src, # src, src, and combinations of |
111 | sscanf( lineStr, "%*[^r]%*[^ ] %s %s", alias, url ); | 108 | sscanf( lineStr, "%*[^r]%*[^ ] %s %s", alias, url ); |
112 | Server s( alias, url ); | 109 | Server *s = new Server( alias, url ); |
113 | if ( lineStr.startsWith( "src" ) ) | 110 | if ( lineStr.startsWith( "src" ) ) |
114 | s.setActive( true ); | 111 | s->setActive( true ); |
115 | else | 112 | else |
116 | s.setActive( false ); | 113 | s->setActive( false ); |
117 | 114 | ||
118 | serverList.push_back( s ); | 115 | serverList.append( s ); |
119 | 116 | ||
120 | } | 117 | } |
@@ -124,5 +121,5 @@ void DataManager :: loadServers() | |||
124 | char path[50]; | 121 | char path[50]; |
125 | sscanf( lineStr, "%*[^ ] %s %s", alias, path ); | 122 | sscanf( lineStr, "%*[^ ] %s %s", alias, path ); |
126 | Destination d( alias, path ); | 123 | Destination *d = new Destination( alias, path ); |
127 | bool linkToRoot = true; | 124 | bool linkToRoot = true; |
128 | #ifdef QWS | 125 | #ifdef QWS |
@@ -131,7 +128,7 @@ void DataManager :: loadServers() | |||
131 | linkToRoot = cfg.readBoolEntry( key, true ); | 128 | linkToRoot = cfg.readBoolEntry( key, true ); |
132 | #endif | 129 | #endif |
133 | d.linkToRoot( linkToRoot ); | 130 | d->linkToRoot( linkToRoot ); |
134 | 131 | ||
135 | destList.push_back( d ); | 132 | destList.append( d ); |
136 | } | 133 | } |
137 | else if ( lineStr.startsWith( "option" ) || lineStr.startsWith( "#option" ) ) | 134 | else if ( lineStr.startsWith( "option" ) || lineStr.startsWith( "#option" ) ) |
@@ -170,13 +167,16 @@ void DataManager :: loadServers() | |||
170 | void DataManager :: reloadServerData( ) | 167 | void DataManager :: reloadServerData( ) |
171 | { | 168 | { |
172 | emit progressSetSteps( serverList.size() ); | 169 | emit progressSetSteps( serverList.count() ); |
173 | emit progressSetMessage( tr( "Reading configuration..." ) ); | 170 | emit progressSetMessage( tr( "Reading configuration..." ) ); |
174 | 171 | ||
175 | vector<Server>::iterator it = serverList.begin(); | ||
176 | QString serverName; | 172 | QString serverName; |
177 | int i = 0; | 173 | int i = 0; |
178 | for ( it = serverList.begin() ; it != serverList.end() ; ++it ) | 174 | |
175 | Server *server; | ||
176 | QListIterator<Server> it( serverList ); | ||
177 | for ( ; it.current(); ++it ) | ||
179 | { | 178 | { |
180 | serverName = it->getServerName(); | 179 | server = it.current(); |
180 | serverName = server->getServerName(); | ||
181 | i++; | 181 | i++; |
182 | emit progressUpdate( i ); | 182 | emit progressUpdate( i ); |
@@ -189,9 +189,9 @@ void DataManager :: reloadServerData( ) | |||
189 | // The other servers files hold the contents of the server package list | 189 | // The other servers files hold the contents of the server package list |
190 | if ( serverName == LOCAL_SERVER ) | 190 | if ( serverName == LOCAL_SERVER ) |
191 | it->readStatusFile( destList ); | 191 | server->readStatusFile( destList ); |
192 | else if ( serverName == LOCAL_IPKGS ) | 192 | else if ( serverName == LOCAL_IPKGS ) |
193 | it->readLocalIpks( &( *getServer( LOCAL_SERVER ) ) ); | 193 | server->readLocalIpks( getServer( LOCAL_SERVER ) ); |
194 | else | 194 | else |
195 | it->readPackageFile( &( *getServer( LOCAL_SERVER ) ) ); | 195 | server->readPackageFile( getServer( LOCAL_SERVER ) ); |
196 | } | 196 | } |
197 | } | 197 | } |
@@ -218,19 +218,21 @@ void DataManager :: writeOutIpkgConf() | |||
218 | 218 | ||
219 | // Write out servers | 219 | // Write out servers |
220 | vector<Server>::iterator it = serverList.begin(); | 220 | Server *server; |
221 | while ( it != serverList.end() ) | 221 | QListIterator<Server> it( serverList ); |
222 | while ( it.current() ) | ||
222 | { | 223 | { |
223 | QString alias = it->getServerName(); | 224 | server = it.current(); |
225 | QString alias = server->getServerName(); | ||
224 | // Don't write out local as its a dummy | 226 | // Don't write out local as its a dummy |
225 | if ( alias != LOCAL_SERVER && alias != LOCAL_IPKGS ) | 227 | if ( alias != LOCAL_SERVER && alias != LOCAL_IPKGS ) |
226 | { | 228 | { |
227 | QString url = it->getServerUrl();; | 229 | QString url = server->getServerUrl();; |
228 | 230 | ||
229 | if ( !it->isServerActive() ) | 231 | if ( !server->isServerActive() ) |
230 | out << "#"; | 232 | out << "#"; |
231 | out << "src " << alias << " " << url << endl; | 233 | out << "src " << alias << " " << url << endl; |
232 | } | 234 | } |
233 | 235 | ||
234 | it++; | 236 | ++it; |
235 | } | 237 | } |
236 | 238 | ||
@@ -238,9 +240,9 @@ void DataManager :: writeOutIpkgConf() | |||
238 | 240 | ||
239 | // Write out destinations | 241 | // Write out destinations |
240 | vector<Destination>::iterator it2 = destList.begin(); | 242 | QListIterator<Destination> it2( destList ); |
241 | while ( it2 != destList.end() ) | 243 | while ( it2.current() ) |
242 | { | 244 | { |
243 | out << "dest " << it2->getDestinationName() << " " << it2->getDestinationPath() << endl; | 245 | out << "dest " << it2.current()->getDestinationName() << " " << it2.current()->getDestinationPath() << endl; |
244 | it2++; | 246 | ++it2; |
245 | } | 247 | } |
246 | 248 | ||
diff --git a/noncore/settings/aqpkg/datamgr.h b/noncore/settings/aqpkg/datamgr.h index 90328ab..7fa42c1 100644 --- a/noncore/settings/aqpkg/datamgr.h +++ b/noncore/settings/aqpkg/datamgr.h | |||
@@ -22,4 +22,5 @@ | |||
22 | using namespace std; | 22 | using namespace std; |
23 | 23 | ||
24 | #include <qlist.h> | ||
24 | #include <qobject.h> | 25 | #include <qobject.h> |
25 | #include <qstring.h> | 26 | #include <qstring.h> |
@@ -46,10 +47,10 @@ public: | |||
46 | QString &getActiveServer( ) { return activeServer; } | 47 | QString &getActiveServer( ) { return activeServer; } |
47 | 48 | ||
48 | Server *getLocalServer() { return &( *getServer( LOCAL_SERVER ) ); } | 49 | Server *getLocalServer() { return ( getServer( LOCAL_SERVER ) ); } |
49 | vector<Server> &getServerList() { return serverList; } | 50 | QList<Server> &getServerList() { return serverList; } |
50 | vector<Server>::iterator getServer( const char *name ); | 51 | Server *getServer( const char *name ); |
51 | 52 | ||
52 | vector<Destination> &getDestinationList() { return destList; } | 53 | QList<Destination> &getDestinationList() { return destList; } |
53 | vector<Destination>::iterator getDestination( const char *name ); | 54 | Destination *getDestination( const char *name ); |
54 | 55 | ||
55 | void loadServers(); | 56 | void loadServers(); |
@@ -87,6 +88,6 @@ private: | |||
87 | bool ftpProxyEnabled; | 88 | bool ftpProxyEnabled; |
88 | 89 | ||
89 | vector<Server> serverList; | 90 | QList<Server> serverList; |
90 | vector<Destination> destList; | 91 | QList<Destination> destList; |
91 | 92 | ||
92 | signals: | 93 | signals: |
diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp index 19fe46a..9339086 100644 --- a/noncore/settings/aqpkg/installdlgimpl.cpp +++ b/noncore/settings/aqpkg/installdlgimpl.cpp | |||
@@ -42,5 +42,5 @@ | |||
42 | #include "global.h" | 42 | #include "global.h" |
43 | 43 | ||
44 | InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, const char *title ) | 44 | InstallDlgImpl::InstallDlgImpl( QList<InstallData> &packageList, DataManager *dataManager, const char *title ) |
45 | : QWidget( 0, 0, 0 ) | 45 | : QWidget( 0, 0, 0 ) |
46 | { | 46 | { |
@@ -51,5 +51,4 @@ InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *d | |||
51 | upgradePackages = false; | 51 | upgradePackages = false; |
52 | dataMgr = dataManager; | 52 | dataMgr = dataManager; |
53 | vector<Destination>::iterator dit; | ||
54 | 53 | ||
55 | QString defaultDest = "root"; | 54 | QString defaultDest = "root"; |
@@ -75,8 +74,9 @@ InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *d | |||
75 | int defIndex = 0; | 74 | int defIndex = 0; |
76 | int i; | 75 | int i; |
77 | for ( i = 0 , dit = dataMgr->getDestinationList().begin() ; dit != dataMgr->getDestinationList().end() ; ++dit, ++i ) | 76 | QListIterator<Destination> dit( dataMgr->getDestinationList() ); |
77 | for ( i = 0; dit.current(); ++dit, ++i ) | ||
78 | { | 78 | { |
79 | destination->insertItem( dit->getDestinationName() ); | 79 | destination->insertItem( dit.current()->getDestinationName() ); |
80 | if ( dit->getDestinationName() == defaultDest ) | 80 | if ( dit.current()->getDestinationName() == defaultDest ) |
81 | defIndex = i; | 81 | defIndex = i; |
82 | } | 82 | } |
@@ -84,34 +84,40 @@ InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *d | |||
84 | destination->setCurrentItem( defIndex ); | 84 | destination->setCurrentItem( defIndex ); |
85 | 85 | ||
86 | vector<InstallData>::iterator it; | 86 | QListIterator<InstallData> it( packageList ); |
87 | // setup package data | 87 | // setup package data |
88 | QString remove = tr( "Remove\n" ); | 88 | QString remove = tr( "Remove\n" ); |
89 | QString install = tr( "Install\n" ); | 89 | QString install = tr( "Install\n" ); |
90 | QString upgrade = tr( "Upgrade\n" ); | 90 | QString upgrade = tr( "Upgrade\n" ); |
91 | for ( it = packageList.begin() ; it != packageList.end() ; ++it ) | 91 | for ( ; it.current(); ++it ) |
92 | { | 92 | { |
93 | InstallData item = *it; | 93 | InstallData *item = it.current(); |
94 | if ( item.option == "I" ) | 94 | InstallData *newitem = new InstallData(); |
95 | |||
96 | newitem->option = item->option; | ||
97 | newitem->packageName = item->packageName; | ||
98 | newitem->destination = item->destination; | ||
99 | newitem->recreateLinks = item->recreateLinks; | ||
100 | |||
101 | if ( item->option == "I" ) | ||
95 | { | 102 | { |
96 | installList.push_back( item ); | 103 | installList.append( newitem ); |
97 | install.append( QString( " %1\n" ).arg( item.packageName ) ); | 104 | install.append( QString( " %1\n" ).arg( item->packageName ) ); |
98 | } | 105 | } |
99 | else if ( item.option == "D" ) | 106 | else if ( item->option == "D" ) |
100 | { | 107 | { |
101 | removeList.push_back( item ); | 108 | removeList.append( newitem ); |
102 | remove.append( QString( " %1\n" ).arg( item.packageName ) ); | 109 | remove.append( QString( " %1\n" ).arg( item->packageName ) ); |
103 | } | 110 | } |
104 | else if ( item.option == "U" || item.option == "R" ) | 111 | else if ( item->option == "U" || item->option == "R" ) |
105 | { | 112 | { |
106 | updateList.push_back( item ); | 113 | updateList.append( newitem ); |
107 | QString type; | 114 | QString type; |
108 | if ( item.option == "R" ) | 115 | if ( item->option == "R" ) |
109 | type = tr( "(ReInstall)" ); | 116 | type = tr( "(ReInstall)" ); |
110 | else | 117 | else |
111 | type = tr( "(Upgrade)" ); | 118 | type = tr( "(Upgrade)" ); |
112 | upgrade.append( QString( " %1 %2\n" ).arg( item.packageName ).arg( type ) ); | 119 | upgrade.append( QString( " %1 %2\n" ).arg( item->packageName ).arg( type ) ); |
113 | } | 120 | } |
114 | } | 121 | } |
115 | |||
116 | output->setText( QString( "%1\n%2\n%3\n" ).arg( remove ).arg( install ).arg( upgrade ) ); | 122 | output->setText( QString( "%1\n%2\n%3\n" ).arg( remove ).arg( install ).arg( upgrade ) ); |
117 | 123 | ||
@@ -230,5 +236,5 @@ void InstallDlgImpl :: installSelected() | |||
230 | { | 236 | { |
231 | output->setText( "" ); | 237 | output->setText( "" ); |
232 | vector<Destination>::iterator d = dataMgr->getDestination( destination->currentText() ); | 238 | Destination *d = dataMgr->getDestination( destination->currentText() ); |
233 | QString dest = d->getDestinationName(); | 239 | QString dest = d->getDestinationName(); |
234 | QString destDir = d->getDestinationPath(); | 240 | QString destDir = d->getDestinationPath(); |
@@ -248,14 +254,16 @@ void InstallDlgImpl :: installSelected() | |||
248 | 254 | ||
249 | // First run through the remove list, then the install list then the upgrade list | 255 | // First run through the remove list, then the install list then the upgrade list |
250 | vector<InstallData>::iterator it; | ||
251 | pIpkg->setOption( "remove" ); | 256 | pIpkg->setOption( "remove" ); |
252 | for ( it = removeList.begin() ; it != removeList.end() ; ++it ) | 257 | QListIterator<InstallData> it( removeList ); |
258 | InstallData *idata; | ||
259 | for ( ; it.current(); ++it ) | ||
253 | { | 260 | { |
254 | pIpkg->setDestination( it->destination->getDestinationName() ); | 261 | idata = it.current(); |
255 | pIpkg->setDestinationDir( it->destination->getDestinationPath() ); | 262 | pIpkg->setDestination( idata->destination->getDestinationName() ); |
256 | pIpkg->setPackage( it->packageName ); | 263 | pIpkg->setDestinationDir( idata->destination->getDestinationPath() ); |
264 | pIpkg->setPackage( idata->packageName ); | ||
257 | 265 | ||
258 | int tmpFlags = flags; | 266 | int tmpFlags = flags; |
259 | if ( it->destination->linkToRoot() ) | 267 | if ( idata->destination->linkToRoot() ) |
260 | tmpFlags |= MAKE_LINKS; | 268 | tmpFlags |= MAKE_LINKS; |
261 | 269 | ||
@@ -268,23 +276,26 @@ void InstallDlgImpl :: installSelected() | |||
268 | pIpkg->setDestinationDir( destDir ); | 276 | pIpkg->setDestinationDir( destDir ); |
269 | pIpkg->setFlags( instFlags ); | 277 | pIpkg->setFlags( instFlags ); |
270 | for ( it = installList.begin() ; it != installList.end() ; ++it ) | 278 | QListIterator<InstallData> it2( installList ); |
279 | for ( ; it2.current(); ++it2 ) | ||
271 | { | 280 | { |
272 | pIpkg->setPackage( it->packageName ); | 281 | pIpkg->setPackage( it2.current()->packageName ); |
273 | pIpkg->runIpkg(); | 282 | pIpkg->runIpkg(); |
274 | } | 283 | } |
275 | 284 | ||
276 | flags |= FORCE_REINSTALL; | 285 | flags |= FORCE_REINSTALL; |
277 | for ( it = updateList.begin() ; it != updateList.end() ; ++it ) | 286 | QListIterator<InstallData> it3( updateList ); |
287 | for ( ; it3.current() ; ++it3 ) | ||
278 | { | 288 | { |
279 | if ( it->option == "R" ) | 289 | idata = it3.current(); |
290 | if ( idata->option == "R" ) | ||
280 | pIpkg->setOption( "reinstall" ); | 291 | pIpkg->setOption( "reinstall" ); |
281 | else | 292 | else |
282 | pIpkg->setOption( "upgrade" ); | 293 | pIpkg->setOption( "upgrade" ); |
283 | pIpkg->setDestination( it->destination->getDestinationName() ); | 294 | pIpkg->setDestination( idata->destination->getDestinationName() ); |
284 | pIpkg->setDestinationDir( it->destination->getDestinationPath() ); | 295 | pIpkg->setDestinationDir( idata->destination->getDestinationPath() ); |
285 | pIpkg->setPackage( it->packageName ); | 296 | pIpkg->setPackage( idata->packageName ); |
286 | 297 | ||
287 | int tmpFlags = flags; | 298 | int tmpFlags = flags; |
288 | if ( it->destination->linkToRoot() && it->recreateLinks ) | 299 | if ( idata->destination->linkToRoot() && idata->recreateLinks ) |
289 | tmpFlags |= MAKE_LINKS; | 300 | tmpFlags |= MAKE_LINKS; |
290 | pIpkg->setFlags( tmpFlags ); | 301 | pIpkg->setFlags( tmpFlags ); |
@@ -308,5 +319,4 @@ void InstallDlgImpl :: installSelected() | |||
308 | void InstallDlgImpl :: displayText(const QString &text ) | 319 | void InstallDlgImpl :: displayText(const QString &text ) |
309 | { | 320 | { |
310 | //output->setText( QString( "%1\n%2" ).arg( output->text() ).arg( text ) ); | ||
311 | QString newtext = QString( "%1\n%2" ).arg( output->text() ).arg( text ); | 321 | QString newtext = QString( "%1\n%2" ).arg( output->text() ).arg( text ); |
312 | output->setText( newtext ); | 322 | output->setText( newtext ); |
@@ -317,5 +327,5 @@ void InstallDlgImpl :: displayText(const QString &text ) | |||
317 | void InstallDlgImpl :: displayAvailableSpace( const QString &text ) | 327 | void InstallDlgImpl :: displayAvailableSpace( const QString &text ) |
318 | { | 328 | { |
319 | vector<Destination>::iterator d = dataMgr->getDestination( text ); | 329 | Destination *d = dataMgr->getDestination( text ); |
320 | QString destDir = d->getDestinationPath(); | 330 | QString destDir = d->getDestinationPath(); |
321 | 331 | ||
diff --git a/noncore/settings/aqpkg/installdlgimpl.h b/noncore/settings/aqpkg/installdlgimpl.h index 4c9f087..d7509bb 100644 --- a/noncore/settings/aqpkg/installdlgimpl.h +++ b/noncore/settings/aqpkg/installdlgimpl.h | |||
@@ -18,9 +18,9 @@ | |||
18 | #define INSTALLDLGIMPL_H | 18 | #define INSTALLDLGIMPL_H |
19 | 19 | ||
20 | #include <vector> | ||
21 | using namespace std; | 20 | using namespace std; |
22 | 21 | ||
23 | #include <qwidget.h> | 22 | #include <qlist.h> |
24 | #include <qstring.h> | 23 | #include <qstring.h> |
24 | #include <qwidget.h> | ||
25 | 25 | ||
26 | class QComboBox; | 26 | class QComboBox; |
@@ -46,5 +46,5 @@ class InstallDlgImpl : public QWidget | |||
46 | Q_OBJECT | 46 | Q_OBJECT |
47 | public: | 47 | public: |
48 | InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, const char *title = 0 ); | 48 | InstallDlgImpl( QList<InstallData> &packageList, DataManager *dataManager, const char *title = 0 ); |
49 | InstallDlgImpl( Ipkg *ipkg, QString initialText, const char *title = 0 ); | 49 | InstallDlgImpl( Ipkg *ipkg, QString initialText, const char *title = 0 ); |
50 | ~InstallDlgImpl(); | 50 | ~InstallDlgImpl(); |
@@ -56,7 +56,7 @@ protected: | |||
56 | private: | 56 | private: |
57 | DataManager *dataMgr; | 57 | DataManager *dataMgr; |
58 | vector<InstallData> installList; | 58 | QList<InstallData> installList; |
59 | vector<InstallData> removeList; | 59 | QList<InstallData> removeList; |
60 | vector<InstallData> updateList; | 60 | QList<InstallData> updateList; |
61 | int flags; | 61 | int flags; |
62 | Ipkg *pIpkg; | 62 | Ipkg *pIpkg; |
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp index 361946c..8ae5815 100644 --- a/noncore/settings/aqpkg/mainwin.cpp +++ b/noncore/settings/aqpkg/mainwin.cpp | |||
@@ -544,16 +544,20 @@ void MainWindow :: updateProgress( int progress ) | |||
544 | void MainWindow :: updateData() | 544 | void MainWindow :: updateData() |
545 | { | 545 | { |
546 | m_progress->setTotalSteps( mgr->getServerList().size() ); | 546 | m_progress->setTotalSteps( mgr->getServerList().count() ); |
547 | 547 | ||
548 | serversList->clear(); | 548 | serversList->clear(); |
549 | packagesList->clear(); | 549 | packagesList->clear(); |
550 | 550 | ||
551 | vector<Server>::iterator it; | ||
552 | int activeItem = -1; | 551 | int activeItem = -1; |
553 | int i; | 552 | int i = 0; |
554 | QString serverName; | 553 | QString serverName; |
555 | for ( i = 0, it = mgr->getServerList().begin() ; it != mgr->getServerList().end() ; ++it, ++i ) | 554 | |
555 | QListIterator<Server> it( mgr->getServerList() ); | ||
556 | Server *server; | ||
557 | |||
558 | for ( ; it.current(); ++it, ++i ) | ||
556 | { | 559 | { |
557 | serverName = it->getServerName(); | 560 | server = it.current(); |
561 | serverName = server->getServerName(); | ||
558 | m_status->setText( tr( "Building server list:\n\t%1" ).arg( serverName ) ); | 562 | m_status->setText( tr( "Building server list:\n\t%1" ).arg( serverName ) ); |
559 | m_progress->setProgress( i ); | 563 | m_progress->setProgress( i ); |
@@ -561,5 +565,5 @@ void MainWindow :: updateData() | |||
561 | 565 | ||
562 | // cout << "Adding " << it->getServerName() << " to combobox" << endl; | 566 | // cout << "Adding " << it->getServerName() << " to combobox" << endl; |
563 | if ( !it->isServerActive() ) | 567 | if ( !server->isServerActive() ) |
564 | { | 568 | { |
565 | // cout << serverName << " is not active" << endl; | 569 | // cout << serverName << " is not active" << endl; |
@@ -593,11 +597,11 @@ void MainWindow :: serverSelected( int, bool raiseProgress ) | |||
593 | currentlySelectedServer = serverName; | 597 | currentlySelectedServer = serverName; |
594 | 598 | ||
595 | vector<Server>::iterator s = mgr->getServer( serverName ); | 599 | Server *s = mgr->getServer( serverName ); |
596 | 600 | ||
597 | vector<Package> &list = s->getPackageList(); | 601 | QList<Package> &list = s->getPackageList(); |
598 | vector<Package>::iterator it; | 602 | QListIterator<Package> it( list ); |
599 | 603 | ||
600 | // Display progress widget while loading list | 604 | // Display progress widget while loading list |
601 | bool doProgress = ( list.size() > 200 ); | 605 | bool doProgress = ( list.count() > 200 ); |
602 | if ( doProgress ) | 606 | if ( doProgress ) |
603 | { | 607 | { |
@@ -606,5 +610,5 @@ void MainWindow :: serverSelected( int, bool raiseProgress ) | |||
606 | stack->raiseWidget( progressWindow ); | 610 | stack->raiseWidget( progressWindow ); |
607 | } | 611 | } |
608 | m_progress->setTotalSteps( list.size() ); | 612 | m_progress->setTotalSteps( list.count() ); |
609 | m_status->setText( tr( "Building package list for:\n\t%1" ).arg( serverName ) ); | 613 | m_status->setText( tr( "Building package list for:\n\t%1" ).arg( serverName ) ); |
610 | } | 614 | } |
@@ -620,5 +624,6 @@ void MainWindow :: serverSelected( int, bool raiseProgress ) | |||
620 | 624 | ||
621 | int i = 0; | 625 | int i = 0; |
622 | for ( it = list.begin() ; it != list.end() ; ++it ) | 626 | Package *package; |
627 | for ( ; it.current(); ++it ) | ||
623 | { | 628 | { |
624 | // Update progress after every 100th package (arbitrary value, seems to give good balance) | 629 | // Update progress after every 100th package (arbitrary value, seems to give good balance) |
@@ -635,10 +640,12 @@ void MainWindow :: serverSelected( int, bool raiseProgress ) | |||
635 | QString text = ""; | 640 | QString text = ""; |
636 | 641 | ||
642 | package = it.current(); | ||
643 | |||
637 | // Apply show only uninstalled packages filter | 644 | // Apply show only uninstalled packages filter |
638 | if ( showUninstalledPkgs && it->isInstalled() ) | 645 | if ( showUninstalledPkgs && package->isInstalled() ) |
639 | continue; | 646 | continue; |
640 | 647 | ||
641 | // Apply show only installed packages filter | 648 | // Apply show only installed packages filter |
642 | if ( showInstalledPkgs && !it->isInstalled() ) | 649 | if ( showInstalledPkgs && !package->isInstalled() ) |
643 | continue; | 650 | continue; |
644 | 651 | ||
@@ -646,6 +653,6 @@ void MainWindow :: serverSelected( int, bool raiseProgress ) | |||
646 | if ( showUpgradedPkgs ) | 653 | if ( showUpgradedPkgs ) |
647 | { | 654 | { |
648 | if ( !it->isInstalled() || | 655 | if ( !package->isInstalled() || |
649 | compareVersions( it->getInstalledVersion(), it->getVersion() ) != 1 ) | 656 | compareVersions( package->getInstalledVersion(), package->getVersion() ) != 1 ) |
650 | continue; | 657 | continue; |
651 | } | 658 | } |
@@ -654,21 +661,22 @@ void MainWindow :: serverSelected( int, bool raiseProgress ) | |||
654 | if ( categoryFilterEnabled && categoryFilter != "" ) | 661 | if ( categoryFilterEnabled && categoryFilter != "" ) |
655 | { | 662 | { |
656 | if ( it->getSection() == "" || categoryFilter.find( it->getSection().lower() ) == -1 ) | 663 | if ( package->getSection() == "" || categoryFilter.find( package->getSection().lower() ) == -1 ) |
657 | continue; | 664 | continue; |
658 | } | 665 | } |
659 | 666 | ||
660 | // If the local server, only display installed packages | 667 | // If the local server, only display installed packages |
661 | if ( serverName == LOCAL_SERVER && !it->isInstalled() ) | 668 | if ( serverName == LOCAL_SERVER && !package->isInstalled() ) |
662 | continue; | 669 | continue; |
663 | 670 | ||
664 | 671 | ||
665 | QCheckListItem *item = new QCheckListItem( packagesList, it->getPackageName(), QCheckListItem::CheckBox ); | 672 | QCheckListItem *item = new QCheckListItem( packagesList, package->getPackageName(), |
673 | QCheckListItem::CheckBox ); | ||
666 | 674 | ||
667 | if ( it->isInstalled() ) | 675 | if ( package->isInstalled() ) |
668 | { | 676 | { |
669 | // If a different version of package is available, show update available icon | 677 | // If a different version of package is available, show update available icon |
670 | // Otherwise, show installed icon | 678 | // Otherwise, show installed icon |
671 | if ( it->getVersion() != it->getInstalledVersion() && | 679 | if ( package->getVersion() != package->getInstalledVersion() && |
672 | compareVersions( it->getInstalledVersion(), it->getVersion() ) == 1) | 680 | compareVersions( package->getInstalledVersion(), package->getVersion() ) == 1) |
673 | { | 681 | { |
674 | 682 | ||
@@ -681,13 +689,13 @@ void MainWindow :: serverSelected( int, bool raiseProgress ) | |||
681 | 689 | ||
682 | QString destName = ""; | 690 | QString destName = ""; |
683 | if ( it->getLocalPackage() ) | 691 | if ( package->getLocalPackage() ) |
684 | { | 692 | { |
685 | if ( it->getLocalPackage()->getInstalledTo() ) | 693 | if ( package->getLocalPackage()->getInstalledTo() ) |
686 | destName = it->getLocalPackage()->getInstalledTo()->getDestinationName(); | 694 | destName = package->getLocalPackage()->getInstalledTo()->getDestinationName(); |
687 | } | 695 | } |
688 | else | 696 | else |
689 | { | 697 | { |
690 | if ( it->getInstalledTo() ) | 698 | if ( package->getInstalledTo() ) |
691 | destName = it->getInstalledTo()->getDestinationName(); | 699 | destName = package->getInstalledTo()->getDestinationName(); |
692 | } | 700 | } |
693 | if ( destName != "" ) | 701 | if ( destName != "" ) |
@@ -699,24 +707,24 @@ void MainWindow :: serverSelected( int, bool raiseProgress ) | |||
699 | } | 707 | } |
700 | 708 | ||
701 | if ( !it->isPackageStoredLocally() ) | 709 | if ( !package->isPackageStoredLocally() ) |
702 | { | 710 | { |
703 | new QCheckListItem( item, QString( tr( "Description - %1" ).arg( it->getDescription() ) ) ); | 711 | new QCheckListItem( item, QString( tr( "Description - %1" ).arg( package->getDescription() ) ) ); |
704 | new QCheckListItem( item, QString( tr( "Size - %1" ).arg( it->getPackageSize() ) ) ); | 712 | new QCheckListItem( item, QString( tr( "Size - %1" ).arg( package->getPackageSize() ) ) ); |
705 | new QCheckListItem( item, QString( tr( "Section - %1" ).arg( it->getSection() ) ) ); | 713 | new QCheckListItem( item, QString( tr( "Section - %1" ).arg( package->getSection() ) ) ); |
706 | } | 714 | } |
707 | else | 715 | else |
708 | new QCheckListItem( item, QString( tr( "Filename - %1" ).arg( it->getFilename() ) ) ); | 716 | new QCheckListItem( item, QString( tr( "Filename - %1" ).arg( package->getFilename() ) ) ); |
709 | 717 | ||
710 | if ( serverName == LOCAL_SERVER ) | 718 | if ( serverName == LOCAL_SERVER ) |
711 | { | 719 | { |
712 | new QCheckListItem( item, QString( tr( "V. Installed - %1" ).arg( it->getVersion() ) ) ); | 720 | new QCheckListItem( item, QString( tr( "V. Installed - %1" ).arg( package->getVersion() ) ) ); |
713 | } | 721 | } |
714 | else | 722 | else |
715 | { | 723 | { |
716 | new QCheckListItem( item, QString( tr( "V. Available - %1" ).arg( it->getVersion() ) ) ); | 724 | new QCheckListItem( item, QString( tr( "V. Available - %1" ).arg( package->getVersion() ) ) ); |
717 | if ( it->getLocalPackage() ) | 725 | if ( package->getLocalPackage() ) |
718 | { | 726 | { |
719 | if ( it->isInstalled() ) | 727 | if ( package->isInstalled() ) |
720 | new QCheckListItem( item, QString( tr( "V. Installed - %1" ).arg( it->getInstalledVersion() ) ) ); | 728 | new QCheckListItem( item, QString( tr( "V. Installed - %1" ).arg( package->getInstalledVersion() ) ) ); |
721 | } | 729 | } |
722 | } | 730 | } |
@@ -756,5 +764,5 @@ void MainWindow :: searchForPackage( const QString &text ) | |||
756 | // cout << "searching for " << text << endl; | 764 | // cout << "searching for " << text << endl; |
757 | // look through package list for text startng at current position | 765 | // look through package list for text startng at current position |
758 | vector<InstallData> workingPackages; | 766 | // vector<InstallData> workingPackages; |
759 | QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); | 767 | QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); |
760 | // if ( start != 0 ) | 768 | // if ( start != 0 ) |
@@ -958,9 +966,10 @@ void MainWindow :: downloadRemotePackage() | |||
958 | // QString package = dlg.getPackageLocation(); | 966 | // QString package = dlg.getPackageLocation(); |
959 | 967 | ||
960 | InstallData item; | 968 | InstallData *item = new InstallData(); |
961 | item.option = "I"; | 969 | item->option = "I"; |
962 | item.packageName = package; | 970 | item->packageName = package; |
963 | vector<InstallData> workingPackages; | 971 | QList<InstallData> workingPackages; |
964 | workingPackages.push_back( item ); | 972 | workingPackages.setAutoDelete( TRUE ); |
973 | workingPackages.append( item ); | ||
965 | 974 | ||
966 | InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Download" ) ); | 975 | InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Download" ) ); |
@@ -980,5 +989,6 @@ void MainWindow :: applyChanges() | |||
980 | // deal with it | 989 | // deal with it |
981 | 990 | ||
982 | vector<InstallData> workingPackages; | 991 | QList<InstallData> workingPackages; |
992 | workingPackages.setAutoDelete( TRUE ); | ||
983 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); | 993 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); |
984 | item != 0 ; | 994 | item != 0 ; |
@@ -987,10 +997,9 @@ void MainWindow :: applyChanges() | |||
987 | if ( item->isOn() ) | 997 | if ( item->isOn() ) |
988 | { | 998 | { |
989 | InstallData data = dealWithItem( item ); | 999 | workingPackages.append( dealWithItem( item ) ); |
990 | workingPackages.push_back( data ); | ||
991 | } | 1000 | } |
992 | } | 1001 | } |
993 | 1002 | ||
994 | if ( workingPackages.size() == 0 ) | 1003 | if ( workingPackages.count() == 0 ) |
995 | { | 1004 | { |
996 | // Nothing to do | 1005 | // Nothing to do |
@@ -1012,10 +1021,10 @@ void MainWindow :: applyChanges() | |||
1012 | // If installed and different version available - upgrade | 1021 | // If installed and different version available - upgrade |
1013 | // If installed and version up to date - remove | 1022 | // If installed and version up to date - remove |
1014 | InstallData MainWindow :: dealWithItem( QCheckListItem *item ) | 1023 | InstallData *MainWindow :: dealWithItem( QCheckListItem *item ) |
1015 | { | 1024 | { |
1016 | QString name = item->text(); | 1025 | QString name = item->text(); |
1017 | 1026 | ||
1018 | // Get package | 1027 | // Get package |
1019 | vector<Server>::iterator s = mgr->getServer( serversList->currentText() ); | 1028 | Server *s = mgr->getServer( serversList->currentText() ); |
1020 | Package *p = s->getPackage( name ); | 1029 | Package *p = s->getPackage( name ); |
1021 | 1030 | ||
@@ -1028,21 +1037,21 @@ InstallData MainWindow :: dealWithItem( QCheckListItem *item ) | |||
1028 | if ( !p->isInstalled() ) | 1037 | if ( !p->isInstalled() ) |
1029 | { | 1038 | { |
1030 | InstallData item; | 1039 | InstallData *newitem = new InstallData();; |
1031 | item.option = "I"; | 1040 | newitem->option = "I"; |
1032 | item.packageName = name; | 1041 | newitem->packageName = name; |
1033 | return item; | 1042 | return newitem; |
1034 | } | 1043 | } |
1035 | else | 1044 | else |
1036 | { | 1045 | { |
1037 | InstallData item; | 1046 | InstallData *newitem = new InstallData();; |
1038 | item.option = "D"; | 1047 | newitem->option = "D"; |
1039 | if ( !p->isPackageStoredLocally() ) | 1048 | if ( !p->isPackageStoredLocally() ) |
1040 | item.packageName = p->getInstalledPackageName(); | 1049 | newitem->packageName = p->getInstalledPackageName(); |
1041 | else | 1050 | else |
1042 | item.packageName = name; | 1051 | newitem->packageName = name; |
1043 | 1052 | ||
1044 | if ( p->getInstalledTo() ) | 1053 | if ( p->getInstalledTo() ) |
1045 | { | 1054 | { |
1046 | item.destination = p->getInstalledTo(); | 1055 | newitem->destination = p->getInstalledTo(); |
1047 | // cout << "dest - " << p->getInstalledTo()->getDestinationName() << endl; | 1056 | // cout << "dest - " << p->getInstalledTo()->getDestinationName() << endl; |
1048 | // cout << "dest - " << p->getInstalledTo()->getDestinationPath() << endl; | 1057 | // cout << "dest - " << p->getInstalledTo()->getDestinationPath() << endl; |
@@ -1050,5 +1059,5 @@ InstallData MainWindow :: dealWithItem( QCheckListItem *item ) | |||
1050 | else | 1059 | else |
1051 | { | 1060 | { |
1052 | item.destination = p->getLocalPackage()->getInstalledTo(); | 1061 | newitem->destination = p->getLocalPackage()->getInstalledTo(); |
1053 | } | 1062 | } |
1054 | 1063 | ||
@@ -1067,5 +1076,5 @@ InstallData MainWindow :: dealWithItem( QCheckListItem *item ) | |||
1067 | { | 1076 | { |
1068 | // Version available is older - remove only | 1077 | // Version available is older - remove only |
1069 | item.option = "D"; | 1078 | newitem->option = "D"; |
1070 | } | 1079 | } |
1071 | else | 1080 | else |
@@ -1103,8 +1112,8 @@ InstallData MainWindow :: dealWithItem( QCheckListItem *item ) | |||
1103 | case 0: // Try again or Enter | 1112 | case 0: // Try again or Enter |
1104 | // option 0 = Remove | 1113 | // option 0 = Remove |
1105 | item.option = "D"; | 1114 | newitem->option = "D"; |
1106 | break; | 1115 | break; |
1107 | case 1: // Quit or Escape | 1116 | case 1: // Quit or Escape |
1108 | item.option = secondOption; | 1117 | newitem->option = secondOption; |
1109 | break; | 1118 | break; |
1110 | } | 1119 | } |
@@ -1112,5 +1121,5 @@ InstallData MainWindow :: dealWithItem( QCheckListItem *item ) | |||
1112 | else | 1121 | else |
1113 | { | 1122 | { |
1114 | // item.option = stickyOption; | 1123 | // newitem->option = stickyOption; |
1115 | } | 1124 | } |
1116 | } | 1125 | } |
@@ -1118,11 +1127,11 @@ InstallData MainWindow :: dealWithItem( QCheckListItem *item ) | |||
1118 | 1127 | ||
1119 | // Check if we are reinstalling the same version | 1128 | // Check if we are reinstalling the same version |
1120 | if ( item.option != "R" ) | 1129 | if ( newitem->option != "R" ) |
1121 | item.recreateLinks = true; | 1130 | newitem->recreateLinks = true; |
1122 | else | 1131 | else |
1123 | item.recreateLinks = false; | 1132 | newitem->recreateLinks = false; |
1124 | 1133 | ||
1125 | // User hit cancel (on dlg - assume remove) | 1134 | // User hit cancel (on dlg - assume remove) |
1126 | return item; | 1135 | return newitem; |
1127 | } | 1136 | } |
1128 | } | 1137 | } |
diff --git a/noncore/settings/aqpkg/mainwin.h b/noncore/settings/aqpkg/mainwin.h index d0777fb..db06e16 100644 --- a/noncore/settings/aqpkg/mainwin.h +++ b/noncore/settings/aqpkg/mainwin.h | |||
@@ -93,5 +93,5 @@ private: | |||
93 | void downloadSelectedPackages(); | 93 | void downloadSelectedPackages(); |
94 | void downloadRemotePackage(); | 94 | void downloadRemotePackage(); |
95 | InstallData dealWithItem( QCheckListItem *item ); | 95 | InstallData *dealWithItem( QCheckListItem *item ); |
96 | 96 | ||
97 | // Progress widget | 97 | // Progress widget |
diff --git a/noncore/settings/aqpkg/server.cpp b/noncore/settings/aqpkg/server.cpp index fc5ed12..04f5ab7 100644 --- a/noncore/settings/aqpkg/server.cpp +++ b/noncore/settings/aqpkg/server.cpp | |||
@@ -60,15 +60,17 @@ void Server :: cleanUp() | |||
60 | } | 60 | } |
61 | 61 | ||
62 | void Server :: readStatusFile( vector<Destination> &destList ) | 62 | void Server :: readStatusFile( QList<Destination> &destList ) |
63 | { | 63 | { |
64 | cleanUp(); | 64 | cleanUp(); |
65 | 65 | ||
66 | vector<Destination>::iterator dit; | 66 | Destination *dest; |
67 | QListIterator<Destination> dit( destList ); | ||
67 | bool rootRead = false; | 68 | bool rootRead = false; |
68 | for ( dit = destList.begin() ; dit != destList.end() ; ++dit ) | 69 | for ( ; dit.current(); ++dit ) |
69 | { | 70 | { |
71 | dest = dit.current(); | ||
70 | bool installingToRoot = false; | 72 | bool installingToRoot = false; |
71 | 73 | ||
72 | QString path = dit->getDestinationPath(); | 74 | QString path = dest->getDestinationPath(); |
73 | if ( path.right( 1 ) != "/" ) | 75 | if ( path.right( 1 ) != "/" ) |
74 | path += "/"; | 76 | path += "/"; |
@@ -81,5 +83,5 @@ void Server :: readStatusFile( vector<Destination> &destList ) | |||
81 | 83 | ||
82 | packageFile = path + "usr/lib/ipkg/status"; | 84 | packageFile = path + "usr/lib/ipkg/status"; |
83 | readPackageFile( 0, false, installingToRoot, &( *dit ) ); | 85 | readPackageFile( 0, false, installingToRoot, &( *dest ) ); |
84 | } | 86 | } |
85 | 87 | ||
@@ -116,9 +118,9 @@ void Server :: readLocalIpks( Server *local ) | |||
116 | QString packageName = Utils::getFilenameFromIpkFilename( file ); | 118 | QString packageName = Utils::getFilenameFromIpkFilename( file ); |
117 | QString ver = Utils::getPackageVersionFromIpkFilename( file ); | 119 | QString ver = Utils::getPackageVersionFromIpkFilename( file ); |
118 | packageList.push_back( Package( packageName ) ); | 120 | Package *package = new Package( packageName ); |
119 | packageList.back().setVersion( ver ); | 121 | package->setVersion( ver ); |
120 | packageList.back().setFilename( file ); | 122 | package->setFilename( file ); |
121 | packageList.back().setPackageStoredLocally( true ); | 123 | package->setPackageStoredLocally( true ); |
122 | 124 | packageList.append( package ); | |
123 | } | 125 | } |
124 | #else | 126 | #else |
@@ -181,8 +183,8 @@ void Server :: readPackageFile( Server *local, bool clearAll, bool installingToR | |||
181 | if ( !currPackage ) | 183 | if ( !currPackage ) |
182 | { | 184 | { |
183 | packageList.push_back( Package( value ) ); | 185 | Package *package = new Package( value ); |
184 | currPackage = &(packageList.back()); | 186 | packageList.append( package ); |
187 | currPackage = package; | ||
185 | currPackage->setInstalledTo( dest ); | 188 | currPackage->setInstalledTo( dest ); |
186 | |||
187 | if ( installingToRoot ) | 189 | if ( installingToRoot ) |
188 | currPackage->setInstalledToRoot( true ); | 190 | currPackage->setInstalledToRoot( true ); |
@@ -240,24 +242,27 @@ void Server :: readPackageFile( Server *local, bool clearAll, bool installingToR | |||
240 | void Server :: buildLocalPackages( Server *local ) | 242 | void Server :: buildLocalPackages( Server *local ) |
241 | { | 243 | { |
242 | for ( unsigned int i = 0 ; i < packageList.size() ; ++i ) | 244 | Package *curr; |
245 | QListIterator<Package> it( packageList ); | ||
246 | for ( ; it.current(); ++it ) | ||
243 | { | 247 | { |
244 | QString name = packageList[i].getPackageName(); | 248 | curr = it.current(); |
249 | QString name = curr->getPackageName(); | ||
245 | 250 | ||
246 | // If the package name is an ipk name, then convert the filename to a package name | 251 | // If the package name is an ipk name, then convert the filename to a package name |
247 | if ( name.find( ".ipk" ) != -1 ) | 252 | if ( name.find( ".ipk" ) != -1 ) |
248 | name = Utils::getPackageNameFromIpkFilename( packageList[i].getFilename() ); | 253 | name = Utils::getPackageNameFromIpkFilename( curr->getFilename() ); |
249 | 254 | ||
250 | if ( local ) | 255 | if ( local ) |
251 | { | 256 | { |
252 | Package *p = local->getPackage( name ); | 257 | Package *p = local->getPackage( name ); |
253 | packageList[i].setLocalPackage( p ); | 258 | curr->setLocalPackage( p ); |
254 | if ( p ) | 259 | if ( p ) |
255 | { | 260 | { |
256 | // Set some default stuff like size and things | 261 | // Set some default stuff like size and things |
257 | if ( p->getInstalledVersion() == packageList[i].getVersion() ) | 262 | if ( p->getInstalledVersion() == curr->getVersion() ) |
258 | { | 263 | { |
259 | p->setPackageSize( packageList[i].getPackageSize() ); | 264 | p->setPackageSize( curr->getPackageSize() ); |
260 | p->setSection( packageList[i].getSection() ); | 265 | p->setSection( curr->getSection() ); |
261 | p->setDescription( packageList[i].getDescription() ); | 266 | p->setDescription( curr->getDescription() ); |
262 | } | 267 | } |
263 | } | 268 | } |
@@ -265,5 +270,5 @@ void Server :: buildLocalPackages( Server *local ) | |||
265 | } | 270 | } |
266 | else | 271 | else |
267 | packageList[i].setLocalPackage( 0 ); | 272 | curr->setLocalPackage( 0 ); |
268 | } | 273 | } |
269 | 274 | ||
@@ -279,8 +284,9 @@ Package *Server :: getPackage( const char *name ) | |||
279 | Package *ret = 0; | 284 | Package *ret = 0; |
280 | 285 | ||
281 | for ( unsigned int i = 0 ; i < packageList.size() && ret == 0; ++i ) | 286 | QListIterator<Package> it( packageList ); |
287 | for ( ; it.current(); ++it ) | ||
282 | { | 288 | { |
283 | if ( packageList[i].getPackageName() == name ) | 289 | if ( it.current()->getPackageName() == name ) |
284 | ret = &packageList[i]; | 290 | ret = it.current(); |
285 | } | 291 | } |
286 | 292 | ||
@@ -290,10 +296,11 @@ Package *Server :: getPackage( const char *name ) | |||
290 | QString Server :: toString() | 296 | QString Server :: toString() |
291 | { | 297 | { |
292 | QString ret = "Server\n name - " + serverName + | 298 | QString ret = QString( "Server\n name - %1\n url - %2\n" ).arg( serverName ).arg( serverUrl ); |
293 | "\n url - " + serverUrl + | ||
294 | "\n"; | ||
295 | 299 | ||
296 | for ( unsigned int i = 0 ; i < packageList.size() ; ++i ) | 300 | QListIterator<Package> it( packageList ); |
297 | ret += "\n " + packageList[i].toString(); | 301 | for ( ; it.current(); ++it ) |
302 | { | ||
303 | ret.append( QString( "\n %1" ).arg( it.current()->toString() ) ); | ||
304 | } | ||
298 | 305 | ||
299 | 306 | ||
@@ -301,5 +308,5 @@ QString Server :: toString() | |||
301 | } | 308 | } |
302 | 309 | ||
303 | vector<Package> &Server::getPackageList() | 310 | QList<Package> &Server::getPackageList() |
304 | { | 311 | { |
305 | return packageList; | 312 | return packageList; |
diff --git a/noncore/settings/aqpkg/server.h b/noncore/settings/aqpkg/server.h index f585b8f..02746e0 100644 --- a/noncore/settings/aqpkg/server.h +++ b/noncore/settings/aqpkg/server.h | |||
@@ -18,7 +18,7 @@ | |||
18 | #define SERVER_H | 18 | #define SERVER_H |
19 | 19 | ||
20 | #include <qlist.h> | ||
20 | #include <qstring.h> | 21 | #include <qstring.h> |
21 | 22 | ||
22 | #include <vector> | ||
23 | using namespace std; | 23 | using namespace std; |
24 | 24 | ||
@@ -36,5 +36,5 @@ public: | |||
36 | void cleanUp(); | 36 | void cleanUp(); |
37 | 37 | ||
38 | void readStatusFile( vector<Destination> &v ); | 38 | void readStatusFile( QList<Destination> &v ); |
39 | void readLocalIpks( Server *local ); | 39 | void readLocalIpks( Server *local ); |
40 | void readPackageFile( Server *local = 0, bool clearAll = true, bool installedToRoot= false, Destination *dest = 0 ); | 40 | void readPackageFile( Server *local = 0, bool clearAll = true, bool installedToRoot= false, Destination *dest = 0 ); |
@@ -43,5 +43,5 @@ public: | |||
43 | Package *getPackage( QString &name ); | 43 | Package *getPackage( QString &name ); |
44 | QString toString(); | 44 | QString toString(); |
45 | vector<Package> &getPackageList(); | 45 | QList<Package> &getPackageList(); |
46 | bool isServerActive() { return active; } | 46 | bool isServerActive() { return active; } |
47 | 47 | ||
@@ -61,5 +61,5 @@ private: | |||
61 | 61 | ||
62 | 62 | ||
63 | vector<Package> packageList; | 63 | QList<Package> packageList; |
64 | }; | 64 | }; |
65 | 65 | ||
diff --git a/noncore/settings/aqpkg/settingsimpl.cpp b/noncore/settings/aqpkg/settingsimpl.cpp index c5a55d2..7541f0b 100644 --- a/noncore/settings/aqpkg/settingsimpl.cpp +++ b/noncore/settings/aqpkg/settingsimpl.cpp | |||
@@ -255,18 +255,20 @@ void SettingsImpl :: setupData() | |||
255 | { | 255 | { |
256 | // add servers | 256 | // add servers |
257 | vector<Server>::iterator it; | 257 | QString serverName; |
258 | for ( it = dataMgr->getServerList().begin() ; it != dataMgr->getServerList().end() ; ++it ) | 258 | QListIterator<Server> it( dataMgr->getServerList() ); |
259 | for ( ; it.current(); ++it ) | ||
259 | { | 260 | { |
260 | if ( it->getServerName() == LOCAL_SERVER || it->getServerName() == LOCAL_IPKGS ) | 261 | serverName = it.current()->getServerName(); |
262 | if ( serverName == LOCAL_SERVER || serverName == LOCAL_IPKGS ) | ||
261 | continue; | 263 | continue; |
262 | 264 | ||
263 | servers->insertItem( it->getServerName() ); | 265 | servers->insertItem( serverName ); |
264 | } | 266 | } |
265 | 267 | ||
266 | 268 | ||
267 | // add destinations | 269 | // add destinations |
268 | vector<Destination>::iterator it2; | 270 | QListIterator<Destination> it2( dataMgr->getDestinationList() ); |
269 | for ( it2 = dataMgr->getDestinationList().begin() ; it2 != dataMgr->getDestinationList().end() ; ++it2 ) | 271 | for ( ; it2.current(); ++it2 ) |
270 | destinations->insertItem( it2->getDestinationName() ); | 272 | destinations->insertItem( it2.current()->getDestinationName() ); |
271 | 273 | ||
272 | // setup proxy tab | 274 | // setup proxy tab |
@@ -284,5 +286,5 @@ void SettingsImpl :: editServer( int sel ) | |||
284 | { | 286 | { |
285 | currentSelectedServer = sel; | 287 | currentSelectedServer = sel; |
286 | vector<Server>::iterator s = dataMgr->getServer( servers->currentText() ); | 288 | Server *s = dataMgr->getServer( servers->currentText() ); |
287 | serverName = s->getServerName(); | 289 | serverName = s->getServerName(); |
288 | servername->setText( s->getServerName() ); | 290 | servername->setText( s->getServerName() ); |
@@ -303,6 +305,6 @@ void SettingsImpl :: removeServer() | |||
303 | { | 305 | { |
304 | changed = true; | 306 | changed = true; |
305 | vector<Server>::iterator s = dataMgr->getServer( servers->currentText() ); | 307 | Server *s = dataMgr->getServer( servers->currentText() ); |
306 | dataMgr->getServerList().erase( s ); | 308 | dataMgr->getServerList().removeRef( s ); |
307 | servers->removeItem( currentSelectedServer ); | 309 | servers->removeItem( currentSelectedServer ); |
308 | } | 310 | } |
@@ -315,5 +317,5 @@ void SettingsImpl :: changeServerDetails() | |||
315 | if ( !newserver ) | 317 | if ( !newserver ) |
316 | { | 318 | { |
317 | vector<Server>::iterator s = dataMgr->getServer( servers->currentText() ); | 319 | Server *s = dataMgr->getServer( servers->currentText() ); |
318 | 320 | ||
319 | // Update url | 321 | // Update url |
@@ -339,6 +341,6 @@ void SettingsImpl :: changeServerDetails() | |||
339 | { | 341 | { |
340 | Server s( newName, serverurl->text() ); | 342 | Server s( newName, serverurl->text() ); |
341 | dataMgr->getServerList().push_back( Server( newName, serverurl->text() ) ); | 343 | dataMgr->getServerList().append( new Server( newName, serverurl->text() ) ); |
342 | dataMgr->getServerList().end()->setActive( active->isChecked() ); | 344 | dataMgr->getServerList().last()->setActive( active->isChecked() ); |
343 | servers->insertItem( newName ); | 345 | servers->insertItem( newName ); |
344 | servers->setCurrentItem( servers->count() ); | 346 | servers->setCurrentItem( servers->count() ); |
@@ -352,5 +354,5 @@ void SettingsImpl :: editDestination( int sel ) | |||
352 | { | 354 | { |
353 | currentSelectedDestination = sel; | 355 | currentSelectedDestination = sel; |
354 | vector<Destination>::iterator d = dataMgr->getDestination( destinations->currentText() ); | 356 | Destination *d = dataMgr->getDestination( destinations->currentText() ); |
355 | destinationName = d->getDestinationName(); | 357 | destinationName = d->getDestinationName(); |
356 | destinationname->setText( d->getDestinationName() ); | 358 | destinationname->setText( d->getDestinationName() ); |
@@ -371,6 +373,6 @@ void SettingsImpl :: removeDestination() | |||
371 | { | 373 | { |
372 | changed = true; | 374 | changed = true; |
373 | vector<Destination>::iterator d = dataMgr->getDestination( destinations->currentText() ); | 375 | Destination *d = dataMgr->getDestination( destinations->currentText() ); |
374 | dataMgr->getDestinationList().erase( d ); | 376 | dataMgr->getDestinationList().removeRef( d ); |
375 | destinations->removeItem( currentSelectedDestination ); | 377 | destinations->removeItem( currentSelectedDestination ); |
376 | } | 378 | } |
@@ -388,5 +390,5 @@ void SettingsImpl :: changeDestinationDetails() | |||
388 | if ( !newdestination ) | 390 | if ( !newdestination ) |
389 | { | 391 | { |
390 | vector<Destination>::iterator d = dataMgr->getDestination( destinations->currentText() ); | 392 | Destination *d = dataMgr->getDestination( destinations->currentText() ); |
391 | 393 | ||
392 | // Update url | 394 | // Update url |
@@ -412,5 +414,5 @@ void SettingsImpl :: changeDestinationDetails() | |||
412 | else | 414 | else |
413 | { | 415 | { |
414 | dataMgr->getDestinationList().push_back( Destination( newName, destinationurl->text() ) ); | 416 | dataMgr->getDestinationList().append( new Destination( newName, destinationurl->text() ) ); |
415 | destinations->insertItem( newName ); | 417 | destinations->insertItem( newName ); |
416 | destinations->setCurrentItem( destinations->count() ); | 418 | destinations->setCurrentItem( destinations->count() ); |