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.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/noncore/settings/aqpkg/server.cpp b/noncore/settings/aqpkg/server.cpp
index 4693db1..0282236 100644
--- a/noncore/settings/aqpkg/server.cpp
+++ b/noncore/settings/aqpkg/server.cpp
@@ -110,25 +110,25 @@ void Server :: readLocalIpks( Server *local )
110 Global::findDocuments( &files, "application/ipkg" ); 110 Global::findDocuments( &files, "application/ipkg" );
111 111
112 // Now add the items to the list 112 // Now add the items to the list
113 QListIterator<DocLnk> it( files.children() ); 113 QListIterator<DocLnk> it( files.children() );
114 114
115 for ( ; it.current() ; ++it ) 115 for ( ; it.current() ; ++it )
116 { 116 {
117 // OK, we have a local IPK file, I think the standard naming conventions 117 // OK, we have a local IPK file, I think the standard naming conventions
118 // for these are packagename_version_arm.ipk 118 // for these are packagename_version_arm.ipk
119 QString file = (*it)->file(); 119 QString file = (*it)->file();
120 120
121 // Changed to display the filename (excluding the path) 121 // Changed to display the filename (excluding the path)
122 QString packageName = Utils::getFilenameFromIpkFilename( file ); 122 QString packageName = Utils::getPackageNameFromIpkFilename( file );
123 QString ver = Utils::getPackageVersionFromIpkFilename( file ); 123 QString ver = Utils::getPackageVersionFromIpkFilename( file );
124 Package *package = new Package( packageName ); 124 Package *package = new Package( packageName );
125 package->setVersion( ver ); 125 package->setVersion( ver );
126 package->setFilename( file ); 126 package->setFilename( file );
127 package->setPackageStoredLocally( true ); 127 package->setPackageStoredLocally( true );
128 packageList.append( package ); 128 packageList.append( package );
129 } 129 }
130#else 130#else
131 QString names[] = { "advancedfm_0.9.1-20020811_arm.ipk", "libopie_0.9.1-20020811_arm.ipk", "libopieobex_0.9.1-20020811.1_arm.ipk", "opie-addressbook_0.9.1-20020811_arm.ipk" }; 131 QString names[] = { "advancedfm_0.9.1-20020811_arm.ipk", "libopie_0.9.1-20020811_arm.ipk", "libopieobex_0.9.1-20020811.1_arm.ipk", "opie-addressbook_0.9.1-20020811_arm.ipk" };
132 for ( int i = 0 ; i < 4 ; ++i ) 132 for ( int i = 0 ; i < 4 ; ++i )
133 { 133 {
134 // OK, we have a local IPK file, I think the standard naming conventions 134 // OK, we have a local IPK file, I think the standard naming conventions
@@ -235,39 +235,50 @@ void Server :: readPackageFile( Server *local, bool clearAll, bool installingToR
235 } 235 }
236 236
237 f.close(); 237 f.close();
238 238
239 // build local packages 239 // build local packages
240 buildLocalPackages( local ); 240 buildLocalPackages( local );
241} 241}
242 242
243void Server :: buildLocalPackages( Server *local ) 243void Server :: buildLocalPackages( Server *local )
244{ 244{
245 Package *curr; 245 Package *curr;
246 QListIterator<Package> it( packageList ); 246 QListIterator<Package> it( packageList );
247
248 QList<Package> *locallist = &local->getPackageList();
249
247 for ( ; it.current(); ++it ) 250 for ( ; it.current(); ++it )
248 { 251 {
249 curr = it.current(); 252 curr = it.current();
250 QString name = curr->getPackageName(); 253 QString name = curr->getPackageName();
251 254
252 // If the package name is an ipk name, then convert the filename to a package name 255 // If the package name is an ipk name, then convert the filename to a package name
253 if ( name.find( ".ipk" ) != -1 ) 256 if ( name.find( ".ipk" ) != -1 )
254 name = Utils::getPackageNameFromIpkFilename( curr->getFilename() ); 257 name = Utils::getPackageNameFromIpkFilename( curr->getFilename() );
255 258
256 if ( local ) 259 if ( local )
257 { 260 {
258 Package *p = local->getPackage( name ); 261 Package *p = local->getPackage( name );
259 curr->setLocalPackage( p ); 262 curr->setLocalPackage( p );
260 if ( p ) 263 if ( p )
261 { 264 {
265 // Replace local version
266 if ( curr->getVersion() > p->getVersion() )
267 {
268 int pos = locallist->at();
269 locallist->remove( p );
270 locallist->insert( pos, curr );
271 }
272
262 // Set some default stuff like size and things 273 // Set some default stuff like size and things
263 if ( p->getInstalledVersion() == curr->getVersion() ) 274 if ( p->getInstalledVersion() == curr->getVersion() )
264 { 275 {
265 p->setPackageSize( curr->getPackageSize() ); 276 p->setPackageSize( curr->getPackageSize() );
266 p->setSection( curr->getSection() ); 277 p->setSection( curr->getSection() );
267 p->setDescription( curr->getDescription() ); 278 p->setDescription( curr->getDescription() );
268 } 279 }
269 } 280 }
270 281
271 } 282 }
272 else 283 else
273 curr->setLocalPackage( 0 ); 284 curr->setLocalPackage( 0 );