author | andyq <andyq> | 2002-11-02 13:52:55 (UTC) |
---|---|---|
committer | andyq <andyq> | 2002-11-02 13:52:55 (UTC) |
commit | cf34849ac5c3eb9d16929cc88834973910209f74 (patch) (unidiff) | |
tree | 06e189f927f88baeb16c927317153e1805a5f614 /noncore/settings/aqpkg | |
parent | d21d693d91af8ee8fb54478a6db67f5a0590a767 (diff) | |
download | opie-cf34849ac5c3eb9d16929cc88834973910209f74.zip opie-cf34849ac5c3eb9d16929cc88834973910209f74.tar.gz opie-cf34849ac5c3eb9d16929cc88834973910209f74.tar.bz2 |
Handles upgrading of local ipk files better and the Local-IPKG view displays
the name of the file rather thanthe package name (so version can easily be seen)
-rw-r--r-- | noncore/settings/aqpkg/global.h | 2 | ||||
-rw-r--r-- | noncore/settings/aqpkg/networkpkgmgr.cpp | 20 | ||||
-rw-r--r-- | noncore/settings/aqpkg/server.cpp | 8 |
3 files changed, 23 insertions, 7 deletions
diff --git a/noncore/settings/aqpkg/global.h b/noncore/settings/aqpkg/global.h index 96ab46c..a4363b4 100644 --- a/noncore/settings/aqpkg/global.h +++ b/noncore/settings/aqpkg/global.h | |||
@@ -9,25 +9,25 @@ | |||
9 | /*************************************************************************** | 9 | /*************************************************************************** |
10 | * * | 10 | * * |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | * This program is free software; you can redistribute it and/or modify * |
12 | * it under the terms of the GNU General Public License as published by * | 12 | * it under the terms of the GNU General Public License as published by * |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * (at your option) any later version. * | 14 | * (at your option) any later version. * |
15 | * * | 15 | * * |
16 | ***************************************************************************/ | 16 | ***************************************************************************/ |
17 | 17 | ||
18 | #ifndef __GLOBAL_H | 18 | #ifndef __GLOBAL_H |
19 | #define __GLOBAL_H | 19 | #define __GLOBAL_H |
20 | 20 | ||
21 | #define VERSION_TEXT "AQPkg Version 0.7" | 21 | #define VERSION_TEXT "AQPkg Version 0.8" |
22 | 22 | ||
23 | // Uncomment the below line to run on a Linux box rather than a Zaurus | 23 | // Uncomment the below line to run on a Linux box rather than a Zaurus |
24 | // box this allows you to change where root is, and where to load config files from | 24 | // box this allows you to change where root is, and where to load config files from |
25 | // #define X86 | 25 | // #define X86 |
26 | 26 | ||
27 | // Sets up location of ipkg.conf and root directory | 27 | // Sets up location of ipkg.conf and root directory |
28 | #ifdef QWS | 28 | #ifdef QWS |
29 | 29 | ||
30 | #ifndef X86 | 30 | #ifndef X86 |
31 | 31 | ||
32 | // Running QT/Embedded on an arm processor | 32 | // Running QT/Embedded on an arm processor |
33 | #define IPKG_CONF "/etc/ipkg.conf" | 33 | #define IPKG_CONF "/etc/ipkg.conf" |
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp index 3d06aef..dee834e 100644 --- a/noncore/settings/aqpkg/networkpkgmgr.cpp +++ b/noncore/settings/aqpkg/networkpkgmgr.cpp | |||
@@ -505,54 +505,64 @@ InstallData NetworkPackageManager :: dealWithItem( QCheckListItem *item ) | |||
505 | int pos = name.find( "*" ); | 505 | int pos = name.find( "*" ); |
506 | name.truncate( pos ); | 506 | name.truncate( pos ); |
507 | 507 | ||
508 | // if (there is a (installed), remove it | 508 | // if (there is a (installed), remove it |
509 | pos = name.find( "(installed)" ); | 509 | pos = name.find( "(installed)" ); |
510 | if ( pos > 0 ) | 510 | if ( pos > 0 ) |
511 | name.truncate( pos - 1 ); | 511 | name.truncate( pos - 1 ); |
512 | 512 | ||
513 | // Get package | 513 | // Get package |
514 | Server *s = dataMgr->getServer( serversList->currentText() ); | 514 | Server *s = dataMgr->getServer( serversList->currentText() ); |
515 | Package *p = s->getPackage( name ); | 515 | Package *p = s->getPackage( name ); |
516 | 516 | ||
517 | // If the package has a filename then it is a local file | 517 | // If the package has a filename then it is a local file |
518 | if ( p->isPackageStoredLocally() ) | 518 | if ( p->isPackageStoredLocally() ) |
519 | name = p->getFilename(); | 519 | name = p->getFilename(); |
520 | |||
520 | QString option; | 521 | QString option; |
521 | QString dest = "root"; | 522 | QString dest = "root"; |
522 | if ( !p->isInstalled() ) | 523 | if ( !p->isInstalled() ) |
523 | { | 524 | { |
524 | InstallData item; | 525 | InstallData item; |
525 | item.option = "I"; | 526 | item.option = "I"; |
526 | item.packageName = name; | 527 | item.packageName = name; |
527 | return item; | 528 | return item; |
528 | } | 529 | } |
529 | else | 530 | else |
530 | { | 531 | { |
531 | InstallData item; | 532 | InstallData item; |
532 | item.option = "D"; | 533 | item.option = "D"; |
533 | item.packageName = p->getInstalledPackageName(); | 534 | if ( !p->isPackageStoredLocally() ) |
535 | item.packageName = p->getInstalledPackageName(); | ||
536 | else | ||
537 | item.packageName = name; | ||
538 | |||
534 | if ( p->getInstalledTo() ) | 539 | if ( p->getInstalledTo() ) |
535 | { | 540 | { |
536 | item.destination = p->getInstalledTo(); | 541 | item.destination = p->getInstalledTo(); |
537 | cout << "dest - " << p->getInstalledTo()->getDestinationName() << endl; | 542 | cout << "dest - " << p->getInstalledTo()->getDestinationName() << endl; |
538 | cout << "dest - " << p->getInstalledTo()->getDestinationPath() << endl; | 543 | cout << "dest - " << p->getInstalledTo()->getDestinationPath() << endl; |
539 | } | 544 | } |
540 | else | 545 | else |
541 | { | 546 | { |
542 | item.destination = p->getLocalPackage()->getInstalledTo(); | 547 | item.destination = p->getLocalPackage()->getInstalledTo(); |
543 | } | 548 | } |
544 | 549 | ||
545 | // Now see if version is newer or not | 550 | // Now see if version is newer or not |
546 | int val = compareVersions( p->getInstalledVersion(), p->getVersion() ); | 551 | int val = compareVersions( p->getInstalledVersion(), p->getVersion() ); |
552 | |||
553 | // If the version requested is older and user selected a local ipk file, then reinstall the file | ||
554 | if ( p->isPackageStoredLocally() && val == -1 ) | ||
555 | val = 0; | ||
556 | |||
547 | if ( val == -2 ) | 557 | if ( val == -2 ) |
548 | { | 558 | { |
549 | // Error - should handle | 559 | // Error - should handle |
550 | } | 560 | } |
551 | else if ( val == -1 ) | 561 | else if ( val == -1 ) |
552 | { | 562 | { |
553 | // Version available is older - remove only | 563 | // Version available is older - remove only |
554 | item.option = "D"; | 564 | item.option = "D"; |
555 | } | 565 | } |
556 | else | 566 | else |
557 | { | 567 | { |
558 | QString caption; | 568 | QString caption; |
diff --git a/noncore/settings/aqpkg/server.cpp b/noncore/settings/aqpkg/server.cpp index 8bca892..539ebf0 100644 --- a/noncore/settings/aqpkg/server.cpp +++ b/noncore/settings/aqpkg/server.cpp | |||
@@ -101,25 +101,26 @@ void Server :: readLocalIpks( Server *local ) | |||
101 | DocLnkSet files; | 101 | DocLnkSet files; |
102 | Global::findDocuments( &files, "application/ipkg" ); | 102 | Global::findDocuments( &files, "application/ipkg" ); |
103 | 103 | ||
104 | // Now add the items to the list | 104 | // Now add the items to the list |
105 | QListIterator<DocLnk> it( files.children() ); | 105 | QListIterator<DocLnk> it( files.children() ); |
106 | 106 | ||
107 | for ( ; it.current() ; ++it ) | 107 | for ( ; it.current() ; ++it ) |
108 | { | 108 | { |
109 | // OK, we have a local IPK file, I think the standard naming conventions | 109 | // OK, we have a local IPK file, I think the standard naming conventions |
110 | // for these are packagename_version_arm.ipk | 110 | // for these are packagename_version_arm.ipk |
111 | QString file = (*it)->file(); | 111 | QString file = (*it)->file(); |
112 | 112 | ||
113 | QString packageName = Utils::getPackageNameFromIpkFilename( file ); | 113 | // Changed to display the filename (excluding the path) |
114 | QString packageName = Utils::getFilenameFromIpkFilename( file ); | ||
114 | QString ver = Utils::getPackageVersionFromIpkFilename( file ); | 115 | QString ver = Utils::getPackageVersionFromIpkFilename( file ); |
115 | packageList.push_back( Package( packageName ) ); | 116 | packageList.push_back( Package( packageName ) ); |
116 | packageList.back().setVersion( ver ); | 117 | packageList.back().setVersion( ver ); |
117 | packageList.back().setFilename( file ); | 118 | packageList.back().setFilename( file ); |
118 | packageList.back().setPackageStoredLocally( true ); | 119 | packageList.back().setPackageStoredLocally( true ); |
119 | 120 | ||
120 | } | 121 | } |
121 | #else | 122 | #else |
122 | 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" }; | 123 | 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" }; |
123 | for ( int i = 0 ; i < 4 ; ++i ) | 124 | for ( int i = 0 ; i < 4 ; ++i ) |
124 | { | 125 | { |
125 | // OK, we have a local IPK file, I think the standard naming conventions | 126 | // OK, we have a local IPK file, I think the standard naming conventions |
@@ -218,24 +219,29 @@ void Server :: readPackageFile( Server *local, bool clearAll, bool installingToR | |||
218 | 219 | ||
219 | in.close(); | 220 | in.close(); |
220 | 221 | ||
221 | // build local packages | 222 | // build local packages |
222 | buildLocalPackages( local ); | 223 | buildLocalPackages( local ); |
223 | } | 224 | } |
224 | 225 | ||
225 | void Server :: buildLocalPackages( Server *local ) | 226 | void Server :: buildLocalPackages( Server *local ) |
226 | { | 227 | { |
227 | for ( unsigned int i = 0 ; i < packageList.size() ; ++i ) | 228 | for ( unsigned int i = 0 ; i < packageList.size() ; ++i ) |
228 | { | 229 | { |
229 | QString name = packageList[i].getPackageName(); | 230 | QString name = packageList[i].getPackageName(); |
231 | |||
232 | // If the package name is an ipk name, then convert the filename to a package name | ||
233 | if ( name.find( ".ipk" ) != -1 ) | ||
234 | name = Utils::getPackageNameFromIpkFilename( packageList[i].getFilename() ); | ||
235 | |||
230 | if ( local ) | 236 | if ( local ) |
231 | packageList[i].setLocalPackage( local->getPackage( name ) ); | 237 | packageList[i].setLocalPackage( local->getPackage( name ) ); |
232 | else | 238 | else |
233 | packageList[i].setLocalPackage( 0 ); | 239 | packageList[i].setLocalPackage( 0 ); |
234 | } | 240 | } |
235 | 241 | ||
236 | } | 242 | } |
237 | 243 | ||
238 | Package *Server :: getPackage( QString &name ) | 244 | Package *Server :: getPackage( QString &name ) |
239 | { | 245 | { |
240 | return getPackage( (const char *)name ); | 246 | return getPackage( (const char *)name ); |
241 | } | 247 | } |