summaryrefslogtreecommitdiff
path: root/noncore/settings/aqpkg/server.cpp
Unidiff
Diffstat (limited to 'noncore/settings/aqpkg/server.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/aqpkg/server.cpp69
1 files changed, 38 insertions, 31 deletions
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
@@ -61,3 +61,3 @@ void Server :: cleanUp()
61 61
62void Server :: readStatusFile( vector<Destination> &destList ) 62void Server :: readStatusFile( QList<Destination> &destList )
63{ 63{
@@ -65,9 +65,11 @@ void Server :: readStatusFile( vector<Destination> &destList )
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 ) != "/" )
@@ -82,3 +84,3 @@ void Server :: readStatusFile( vector<Destination> &destList )
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 }
@@ -117,7 +119,7 @@ void Server :: readLocalIpks( Server *local )
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 }
@@ -182,6 +184,6 @@ void Server :: readPackageFile( Server *local, bool clearAll, bool installingToR
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 )
@@ -241,5 +243,8 @@ 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
@@ -247,3 +252,3 @@ void Server :: buildLocalPackages( Server *local )
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
@@ -252,3 +257,3 @@ void Server :: buildLocalPackages( Server *local )
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 )
@@ -256,7 +261,7 @@ void Server :: buildLocalPackages( Server *local )
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 }
@@ -266,3 +271,3 @@ void Server :: buildLocalPackages( Server *local )
266 else 271 else
267 packageList[i].setLocalPackage( 0 ); 272 curr->setLocalPackage( 0 );
268 } 273 }
@@ -280,6 +285,7 @@ Package *Server :: getPackage( const char *name )
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 }
@@ -291,8 +297,9 @@ 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
@@ -302,3 +309,3 @@ QString Server :: toString()
302 309
303vector<Package> &Server::getPackageList() 310QList<Package> &Server::getPackageList()
304{ 311{