summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/mainwin.cpp6
-rw-r--r--noncore/settings/aqpkg/package.cpp5
-rw-r--r--noncore/settings/aqpkg/package.h19
-rw-r--r--noncore/settings/aqpkg/server.cpp2
4 files changed, 16 insertions, 16 deletions
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp
index 6ea619c..fb40d52 100644
--- a/noncore/settings/aqpkg/mainwin.cpp
+++ b/noncore/settings/aqpkg/mainwin.cpp
@@ -610,90 +610,88 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
#endif
int i = 0;
Package *package;
for ( ; it.current(); ++it )
{
// Update progress after every 100th package (arbitrary value, seems to give good balance)
i++;
if ( ( i % 100 ) == 0 )
{
if ( doProgress )
{
m_progress->setProgress( i );
}
qApp->processEvents();
}
QString text = "";
package = it.current();
// Apply show only uninstalled packages filter
if ( showUninstalledPkgs && package->isInstalled() )
continue;
// Apply show only installed packages filter
if ( showInstalledPkgs && !package->isInstalled() )
continue;
// Apply show only new installed packages filter
if ( showUpgradedPkgs )
{
- if ( !package->isInstalled() ||
- compareVersions( package->getInstalledVersion(), package->getVersion() ) != 1 )
+ if ( !package->isInstalled() || !package->getNewVersionAvailable() )
continue;
}
// Apply the section filter
if ( categoryFilterEnabled && categoryFilter != "" )
{
if ( package->getSection() == "" || categoryFilter.find( package->getSection().lower() ) == -1 )
continue;
}
// If the local server, only display installed packages
if ( serverName == LOCAL_SERVER && !package->isInstalled() )
continue;
QCheckListItem *item = new QCheckListItem( packagesList, package->getPackageName(),
QCheckListItem::CheckBox );
if ( package->isInstalled() )
{
// If a different version of package is available, show update available icon
// Otherwise, show installed icon
- if ( package->getVersion() != package->getInstalledVersion() &&
- compareVersions( package->getInstalledVersion(), package->getVersion() ) == 1)
+ if ( package->getNewVersionAvailable())
{
item->setPixmap( 0, updatedIcon );
}
else
{
item->setPixmap( 0, installedIcon );
}
QString destName = "";
if ( package->getLocalPackage() )
{
if ( package->getLocalPackage()->getInstalledTo() )
destName = package->getLocalPackage()->getInstalledTo()->getDestinationName();
}
else
{
if ( package->getInstalledTo() )
destName = package->getInstalledTo()->getDestinationName();
}
if ( destName != "" )
new QCheckListItem( item, QString( tr( "Installed To - %1" ).arg( destName ) ) );
}
else
{
item->setPixmap( 0, nullIcon );
}
if ( !package->isPackageStoredLocally() )
{
new QCheckListItem( item, QString( tr( "Description - %1" ).arg( package->getDescription() ) ) );
new QCheckListItem( item, QString( tr( "Size - %1" ).arg( package->getPackageSize() ) ) );
diff --git a/noncore/settings/aqpkg/package.cpp b/noncore/settings/aqpkg/package.cpp
index 83e0706..3395870 100644
--- a/noncore/settings/aqpkg/package.cpp
+++ b/noncore/settings/aqpkg/package.cpp
@@ -21,115 +21,116 @@
Package::Package( QString &name )
{
packageName = name;
version = "N/A";
description = "N/A";
packageSize = "N/A";
section = "N/A";
localPackage = 0;
installed = false;
packageStoredLocally = false;
installedToRoot = false;
installed = false;
installedTo = 0;
}
Package::Package( char *name )
{
packageName = name;
version = "N/A";
description = "N/A";
packageSize = "N/A";
section = "N/A";
localPackage = 0;
installed = false;
packageStoredLocally = false;
installedToRoot = false;
installed = false;
installedTo = 0;
+ differentVersionAvailable = false;
}
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( const QString &s )
{
QString state_status;
int two, three;
status = s.simplifyWhiteSpace( );
two = status.find( " " ); // find second column
three = status.find( " ", two + 1 ); // find third column
state_status = status.mid( three ).stripWhiteSpace( );
if ( state_status == "installed" )
installed = true;
}
void Package :: setLocalPackage( Package *p )
{
localPackage = p;
if ( localPackage )
- if ( localPackage->getVersion() != getVersion() )
+ if ( localPackage->getVersion() < getVersion() && !installed )
differentVersionAvailable = true;
else
differentVersionAvailable = false;
}
void Package :: setVersion( const QString &v )
{
version = v;
if ( localPackage )
- if ( localPackage->getVersion() != getVersion() )
+ if ( localPackage->getVersion() < getVersion() && !installed )
differentVersionAvailable = true;
else
differentVersionAvailable = false;
}
void Package :: setPackageName( const QString &name )
{
packageName = name;
}
void Package :: setDescription( const QString &d )
{
description = d;
}
void Package :: setFilename( const QString &f )
{
filename = f;
}
QString Package :: getInstalledVersion()
{
if ( localPackage )
return localPackage->getVersion();
else
return getVersion();
}
QString Package :: getInstalledPackageName()
{
if ( localPackage )
diff --git a/noncore/settings/aqpkg/package.h b/noncore/settings/aqpkg/package.h
index f5a132f..110ae91 100644
--- a/noncore/settings/aqpkg/package.h
+++ b/noncore/settings/aqpkg/package.h
@@ -18,72 +18,73 @@
#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( 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( 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; }
+ 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 getNewVersionAvailable() { return differentVersionAvailable; }
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 9a239a5..e2b8096 100644
--- a/noncore/settings/aqpkg/server.cpp
+++ b/noncore/settings/aqpkg/server.cpp
@@ -155,65 +155,65 @@ void Server :: readPackageFile( Server *local, bool clearAll, bool installingToR
if ( clearAll )
cleanUp();
Package *currPackage = 0;
bool newPackage = true;
while ( !t.eof() )
{
line = t.readLine();
pos = line.find( ':', 0 );
if ( pos > -1 )
key = line.mid( 0, pos ).stripWhiteSpace();
else
key = QString::null;
value = line.mid( pos+1, line.length()-pos ).stripWhiteSpace();
if ( key == "Package" && newPackage )
{
newPackage = false;
currPackage = getPackage( value );
if ( !currPackage )
{
Package *package = new Package( value );
packageList.append( package );
currPackage = package;
currPackage->setInstalledTo( dest );
if ( installingToRoot )
currPackage->setInstalledToRoot( true );
}
else
{
- if (currPackage->getStatus().find( "deinstall" ) != -1 )
+ if ( currPackage->isInstalled() )
currPackage->setInstalledTo( dest );
}
}
else if ( key == "Version" )
{
if ( currPackage )
currPackage->setVersion( value );
}
else if ( key == "Status" )
{
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 );