-rw-r--r-- | noncore/settings/aqpkg/package.cpp | 10 | ||||
-rw-r--r-- | noncore/settings/aqpkg/package.h | 14 | ||||
-rw-r--r-- | noncore/settings/aqpkg/server.cpp | 22 |
3 files changed, 27 insertions, 19 deletions
diff --git a/noncore/settings/aqpkg/package.cpp b/noncore/settings/aqpkg/package.cpp index fd75450..526de5e 100644 --- a/noncore/settings/aqpkg/package.cpp +++ b/noncore/settings/aqpkg/package.cpp @@ -53,13 +53,13 @@ QString Package :: toString() ret += "\n inst version - " + localPackage->getVersion(); return ret; } -void Package :: setStatus( QString &s ) +void Package :: setStatus( const QString &s ) { status = s; if ( status.find( "installed" ) != -1 ) installed = true; } @@ -72,34 +72,34 @@ void Package :: setLocalPackage( Package *p ) if ( localPackage->getVersion() != getVersion() ) differentVersionAvailable = true; else differentVersionAvailable = false; } -void Package :: setVersion( QString &v ) +void Package :: setVersion( const QString &v ) { version = v; if ( localPackage ) if ( localPackage->getVersion() != getVersion() ) differentVersionAvailable = true; else differentVersionAvailable = false; } -void Package :: setPackageName( QString &name ) +void Package :: setPackageName( const QString &name ) { packageName = name; } -void Package :: setDescription( QString &d ) +void Package :: setDescription( const QString &d ) { description = d; } -void Package :: setFilename( QString &f ) +void Package :: setFilename( const QString &f ) { filename = f; } QString Package :: getInstalledVersion() diff --git a/noncore/settings/aqpkg/package.h b/noncore/settings/aqpkg/package.h index 7545818..f5a132f 100644 --- a/noncore/settings/aqpkg/package.h +++ b/noncore/settings/aqpkg/package.h @@ -32,23 +32,23 @@ class Package public: Package( QString &name ); Package( char *name ); ~Package(); void setLocalPackage( Package *p ); - void setPackageName( QString &name ); - void setVersion( QString &v ); - void setStatus( QString &s ); - void setDescription( QString &d ); - void setFilename( QString &f ); + void setPackageName( const QString &name ); + void setVersion( const QString &v ); + void setStatus( const QString &s ); + void setDescription( const QString &d ); + void setFilename( const QString &f ); void setPackageStoredLocally( bool local ) { packageStoredLocally = local; } void setInstalledToRoot( bool root ) { installedToRoot = root; } void setInstalledTo( Destination *d ) { installedTo = d; } void setDependancies( QString &deps ) { dependancies = deps; } - void setPackageSize( QString size ) { packageSize = size; } - void setSection( QString sect) { section = sect; } + void setPackageSize( const QString &size ) { packageSize = size; } + void setSection( const QString §) { section = sect; } Package *getLocalPackage() { return localPackage; } QString getPackageName() { return packageName; } QString getVersion() { return version; } QString getStatus() { return status; } QString getDescription() { return description; } diff --git a/noncore/settings/aqpkg/server.cpp b/noncore/settings/aqpkg/server.cpp index 7c3257b..726cf00 100644 --- a/noncore/settings/aqpkg/server.cpp +++ b/noncore/settings/aqpkg/server.cpp @@ -244,13 +244,27 @@ void Server :: buildLocalPackages( Server *local ) // If the package name is an ipk name, then convert the filename to a package name if ( name.find( ".ipk" ) != -1 ) name = Utils::getPackageNameFromIpkFilename( packageList[i].getFilename() ); if ( local ) - packageList[i].setLocalPackage( local->getPackage( name ) ); + { + Package *p = local->getPackage( name ); + packageList[i].setLocalPackage( p ); + if ( p ) + { + // Set some default stuff like size and things + if ( p->getInstalledVersion() == packageList[i].getVersion() ) + { + p->setPackageSize( packageList[i].getPackageSize() ); + p->setSection( packageList[i].getSection() ); + p->setDescription( packageList[i].getDescription() ); + } + } + + } else packageList[i].setLocalPackage( 0 ); } } @@ -280,19 +294,13 @@ QString Server :: toString() for ( unsigned int i = 0 ; i < packageList.size() ; ++i ) ret += "\n " + packageList[i].toString(); return ret; -} /* -void addAvailableSection( QString section ) -{ - if ( DataManager::availableCategories.find( value ) == -1 ) -// DataManager::availableCategories += "#" + value; } -*/ vector<Package> &Server::getPackageList() { return packageList; } |