summaryrefslogtreecommitdiff
path: root/noncore/settings/aqpkg
Side-by-side diff
Diffstat (limited to 'noncore/settings/aqpkg') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/aqpkg/mainwin.cpp12
-rw-r--r--noncore/settings/aqpkg/opie-aqpkg.control2
-rw-r--r--noncore/settings/aqpkg/package.cpp1
-rw-r--r--noncore/settings/aqpkg/packagewin.cpp7
-rw-r--r--noncore/settings/aqpkg/server.cpp13
5 files changed, 30 insertions, 5 deletions
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp
index 45a6663..42093cf 100644
--- a/noncore/settings/aqpkg/mainwin.cpp
+++ b/noncore/settings/aqpkg/mainwin.cpp
@@ -1003,24 +1003,29 @@ InstallData *MainWindow :: dealWithItem( QCheckListItem *item )
QString dest = "root";
if ( !p->isInstalled() )
{
InstallData *newitem = new InstallData();
newitem->option = "I";
newitem->packageName = name;
return newitem;
}
else
{
InstallData *newitem = new InstallData();
newitem->option = "D";
+
+ // If local file, remove using package name, not filename
+ if ( p->isPackageStoredLocally() )
+ name = item->text();
+
if ( !p->isPackageStoredLocally() )
newitem->packageName = p->getInstalledPackageName();
else
newitem->packageName = name;
if ( p->getInstalledTo() )
{
newitem->destination = p->getInstalledTo();
}
else
{
newitem->destination = p->getLocalPackage()->getInstalledTo();
@@ -1032,24 +1037,28 @@ InstallData *MainWindow :: dealWithItem( QCheckListItem *item )
// If the version requested is older and user selected a local ipk file, then reinstall the file
if ( p->isPackageStoredLocally() && val == -1 )
val = 0;
if ( val == -2 )
{
// Error - should handle
}
else if ( val == -1 )
{
// Version available is older - remove only
newitem->option = "D";
+
+ // If local file, remove using package name, not filename
+ if ( p->isPackageStoredLocally() )
+ name = item->text();
}
else
{
QString caption;
QString text;
QString secondButton;
QString secondOption;
if ( val == 0 )
{
// Version available is the same - option to remove or reinstall
caption = tr( "Do you wish to remove or reinstall\n%1?" );
text = tr( "Remove or ReInstall" );
@@ -1071,24 +1080,27 @@ InstallData *MainWindow :: dealWithItem( QCheckListItem *item )
{
QString msgtext;
msgtext = caption.arg( ( const char * )name );
QuestionDlg dlg( text, msgtext, secondButton );
switch( dlg.exec() )
{
case 0: // Cancel
delete newitem;
return 0x0;
break;
case 1: // Remove
newitem->option = "D";
+ // If local file, remove using package name, not filename
+ if ( p->isPackageStoredLocally() )
+ name = item->text();
break;
case 2: // Reinstall or Upgrade
newitem->option = secondOption;
break;
}
}
else
{
// newitem->option = stickyOption;
}
}
diff --git a/noncore/settings/aqpkg/opie-aqpkg.control b/noncore/settings/aqpkg/opie-aqpkg.control
index b8ad1e8..46bffdd 100644
--- a/noncore/settings/aqpkg/opie-aqpkg.control
+++ b/noncore/settings/aqpkg/opie-aqpkg.control
@@ -1,11 +1,11 @@
Package: opie-aqpkg
Files: bin/aqpkg pics/aqpkg apps/Settings/aqpkg.desktop
Priority: optional
Section: Settings
-Version: $QPE_VERSION-$SUB_VERSION
Depends: task-opie-minimal
Replaces: aqpkg
Architecture: arm
Maintainer: Andy Qua (andy.qua@blueyonder.co.uk)
Description: A Package Manager
+Version: $QPE_VERSION$EXTRAVERSION
diff --git a/noncore/settings/aqpkg/package.cpp b/noncore/settings/aqpkg/package.cpp
index adda832..5a521d3 100644
--- a/noncore/settings/aqpkg/package.cpp
+++ b/noncore/settings/aqpkg/package.cpp
@@ -107,24 +107,25 @@ void Package :: setLocalPackage( Package *p )
localPackage = p;
if ( localPackage )
if ( localPackage->getVersion() < getVersion() && !installed )
differentVersionAvailable = true;
else
differentVersionAvailable = false;
}
void Package :: setVersion( const QString &v )
{
version = v;
+ differentVersionAvailable = false;
if ( localPackage )
if ( localPackage->getVersion() < getVersion() && !installed )
differentVersionAvailable = true;
else
differentVersionAvailable = false;
}
void Package :: setPackageName( const QString &name )
{
packageName = name;
}
diff --git a/noncore/settings/aqpkg/packagewin.cpp b/noncore/settings/aqpkg/packagewin.cpp
index 9553cd1..499d647 100644
--- a/noncore/settings/aqpkg/packagewin.cpp
+++ b/noncore/settings/aqpkg/packagewin.cpp
@@ -35,29 +35,30 @@
#include <qlayout.h>
#include <qpushbutton.h>
#include <qstring.h>
#include <qtextview.h>
PackageWindow::PackageWindow( Package *package, const QString &server )
: QWidget( 0, 0, 0 )
{
QString str;
if ( package )
{
+ Package *local = package->getLocalPackage();
setCaption( package->getPackageName() );
QString destName;
- if ( package->getLocalPackage() )
+ if ( local )
{
- if ( package->getLocalPackage()->getInstalledTo() )
+ if ( local->getInstalledTo() )
destName = package->getLocalPackage()->getInstalledTo()->getDestinationName();
}
else
{
if ( package->getInstalledTo() )
destName = package->getInstalledTo()->getDestinationName();
}
if ( !package->isPackageStoredLocally() )
{
str.append( tr( "<b>Description</b> - " ) );
str.append( package->getDescription() );
@@ -77,25 +78,25 @@ PackageWindow::PackageWindow( Package *package, const QString &server )
str.append( package->getFilename() );
}
if ( server == LOCAL_SERVER )
{
str.append( tr( "<p><b>Version Installed</b> - " ) );
str.append( package->getVersion() );
}
else
{
str.append( tr( "<p><b>Version Available</b> - " ) );
str.append( package->getVersion() );
- if ( package->getLocalPackage() )
+ if ( local )
{
if ( package->isInstalled() )
{
str.append( tr( "<p><b>Version Installed</b> - " ) );
str.append( package->getInstalledVersion() );
}
}
}
}
else
{
setCaption( tr( "Package Information" ) );
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 );