summaryrefslogtreecommitdiff
authorandyq <andyq>2002-11-19 17:31:00 (UTC)
committer andyq <andyq>2002-11-19 17:31:00 (UTC)
commitabeb38c25d2cfe90d1a17912a63c9518e602766c (patch) (side-by-side diff)
tree79df89e95a7dafc4a3bf9a7e377b41467396f20d
parent638b671dce5eff05a2ec666492c060fa2fd021a2 (diff)
downloadopie-abeb38c25d2cfe90d1a17912a63c9518e602766c.zip
opie-abeb38c25d2cfe90d1a17912a63c9518e602766c.tar.gz
opie-abeb38c25d2cfe90d1a17912a63c9518e602766c.tar.bz2
Changed so that the size of a package is passed down into the local package
(as long as the package installed is the same version as the package available in the feed)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/package.cpp10
-rw-r--r--noncore/settings/aqpkg/package.h14
-rw-r--r--noncore/settings/aqpkg/server.cpp22
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
@@ -11,114 +11,114 @@
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "package.h"
#include "global.h"
Package::Package( QString &name )
{
packageName = name;
localPackage = 0;
installed = false;
packageStoredLocally = false;
installedToRoot = false;
installed = false;
installedTo = 0;
}
Package::Package( char *name )
{
packageName = name;
localPackage = 0;
installed = false;
packageStoredLocally = false;
installedToRoot = false;
installed = false;
installedTo = 0;
}
Package::~Package()
{
}
QString Package :: toString()
{
QString ret = "Package - " + getPackageName() +
"\n version - " + getVersion();
if ( localPackage )
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;
}
void Package :: setLocalPackage( Package *p )
{
localPackage = p;
if ( localPackage )
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()
{
if ( localPackage )
return localPackage->getVersion();
else
return getVersion();
}
QString Package :: getInstalledPackageName()
{
if ( localPackage )
return localPackage->getPackageName();
else
return getPackageName();
}
bool Package :: isInstalled()
{
return installed || ( localPackage && localPackage->isInstalled() );
}
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
@@ -1,89 +1,89 @@
/***************************************************************************
package.h - description
-------------------
begin : Mon Aug 26 2002
copyright : (C) 2002 by Andy Qua
email : andy.qua@blueyonder.co.uk
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef PACKAGE_H
#define PACKAGE_H
#include <stdlib.h>
/**
*@author Andy Qua
*/
#include <qstring.h>
#include "destination.h"
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 &sect) { section = sect; }
Package *getLocalPackage() { return localPackage; }
QString getPackageName() { return packageName; }
QString getVersion() { return version; }
QString getStatus() { return status; }
QString getDescription() { return description; }
QString getFilename() { return filename; }
QString getDependancies() { return dependancies; }
QString getPackageSize() { return packageSize; }
QString getSection() { return section; }
bool isInstalled();
bool isPackageStoredLocally() { return packageStoredLocally; }
bool isInstalledToRoot() { return installedToRoot; }
QString getInstalledVersion();
QString getInstalledPackageName();
Destination *getInstalledTo() { return installedTo; }
QString toString();
private:
Package *localPackage;
QString packageName;
QString version;
QString status;
QString description;
QString filename;
bool packageStoredLocally;
bool installedToRoot;
bool installed;
bool differentVersionAvailable;
QString dependancies;
QString packageSize;
QString section;
Destination *installedTo;
};
#endif
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
@@ -202,97 +202,105 @@ void Server :: readPackageFile( Server *local, bool clearAll, bool installingToR
if ( currPackage )
currPackage->setStatus( value );
}
else if ( key == "Description" )
{
if ( currPackage )
currPackage->setDescription( value );
}
else if ( key == "Filename" )
{
if ( currPackage )
currPackage->setFilename( value );
}
else if ( key == "Size" )
{
if ( currPackage )
currPackage->setPackageSize( value );
}
else if ( key == "Section" )
{
if ( currPackage )
currPackage->setSection( value );
DataManager::setAvailableCategories( value );
}
else if ( key == "" )
{
newPackage = true;
}
} while ( !in.eof() );
in.close();
// build local packages
buildLocalPackages( local );
}
void Server :: buildLocalPackages( Server *local )
{
for ( unsigned int i = 0 ; i < packageList.size() ; ++i )
{
QString name = packageList[i].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( 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 );
}
}
Package *Server :: getPackage( QString &name )
{
return getPackage( (const char *)name );
}
Package *Server :: getPackage( const char *name )
{
Package *ret = 0;
for ( unsigned int i = 0 ; i < packageList.size() && ret == 0; ++i )
{
if ( packageList[i].getPackageName() == name )
ret = &packageList[i];
}
return ret;
}
QString Server :: toString()
{
QString ret = "Server\n name - " + serverName +
"\n url - " + serverUrl +
"\n";
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;
}