summaryrefslogtreecommitdiff
path: root/noncore/settings/aqpkg/server.cpp
Side-by-side diff
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 )
Global::findDocuments( &files, "application/ipkg" );
// Now add the items to the list
QListIterator<DocLnk> it( files.children() );
for ( ; it.current() ; ++it )
{
// OK, we have a local IPK file, I think the standard naming conventions
// for these are packagename_version_arm.ipk
QString file = (*it)->file();
// Changed to display the filename (excluding the path)
- QString packageName = Utils::getFilenameFromIpkFilename( file );
+ QString packageName = Utils::getPackageNameFromIpkFilename( file );
QString ver = Utils::getPackageVersionFromIpkFilename( file );
Package *package = new Package( packageName );
package->setVersion( ver );
package->setFilename( file );
package->setPackageStoredLocally( true );
packageList.append( package );
}
#else
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" };
for ( int i = 0 ; i < 4 ; ++i )
{
// 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
}
f.close();
// build local packages
buildLocalPackages( local );
}
void Server :: buildLocalPackages( Server *local )
{
Package *curr;
QListIterator<Package> it( packageList );
+
+ QList<Package> *locallist = &local->getPackageList();
+
for ( ; it.current(); ++it )
{
curr = it.current();
QString name = curr->getPackageName();
// If the package name is an ipk name, then convert the filename to a package name
if ( name.find( ".ipk" ) != -1 )
name = Utils::getPackageNameFromIpkFilename( curr->getFilename() );
if ( local )
{
Package *p = local->getPackage( name );
curr->setLocalPackage( p );
if ( p )
{
+ // Replace local version
+ if ( curr->getVersion() > p->getVersion() )
+ {
+ int pos = locallist->at();
+ locallist->remove( p );
+ locallist->insert( pos, curr );
+ }
+
// Set some default stuff like size and things
if ( p->getInstalledVersion() == curr->getVersion() )
{
p->setPackageSize( curr->getPackageSize() );
p->setSection( curr->getSection() );
p->setDescription( curr->getDescription() );
}
}
}
else
curr->setLocalPackage( 0 );