author | andyq <andyq> | 2002-10-20 16:48:26 (UTC) |
---|---|---|
committer | andyq <andyq> | 2002-10-20 16:48:26 (UTC) |
commit | a24218529668ca387827ed520cea6d1890df7a88 (patch) (unidiff) | |
tree | 0d9b03c671b57e636fe003dbd185922297396b5a | |
parent | 1f106a8b44ae659f30361588f53354e8f1985974 (diff) | |
download | opie-a24218529668ca387827ed520cea6d1890df7a88.zip opie-a24218529668ca387827ed520cea6d1890df7a88.tar.gz opie-a24218529668ca387827ed520cea6d1890df7a88.tar.bz2 |
fixed bug with removing from local IPKGS folder
-rw-r--r-- | noncore/settings/aqpkg/networkpkgmgr.cpp | 8 | ||||
-rw-r--r-- | noncore/settings/aqpkg/package.cpp | 17 | ||||
-rw-r--r-- | noncore/settings/aqpkg/package.h | 3 | ||||
-rw-r--r-- | noncore/settings/aqpkg/server.cpp | 12 |
4 files changed, 31 insertions, 9 deletions
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp index 3aee7bd..d84fb4b 100644 --- a/noncore/settings/aqpkg/networkpkgmgr.cpp +++ b/noncore/settings/aqpkg/networkpkgmgr.cpp | |||
@@ -463,53 +463,59 @@ InstallData NetworkPackageManager :: dealWithItem( QCheckListItem *item ) | |||
463 | pos = name.find( "(installed)" ); | 463 | pos = name.find( "(installed)" ); |
464 | if ( pos > 0 ) | 464 | if ( pos > 0 ) |
465 | name.truncate( pos - 1 ); | 465 | name.truncate( pos - 1 ); |
466 | 466 | ||
467 | // Get package | 467 | // Get package |
468 | Server *s = dataMgr->getServer( serversList->currentText() ); | 468 | Server *s = dataMgr->getServer( serversList->currentText() ); |
469 | Package *p = s->getPackage( name ); | 469 | Package *p = s->getPackage( name ); |
470 | 470 | ||
471 | // If the package has a filename then it is a local file | 471 | // If the package has a filename then it is a local file |
472 | if ( p->isPackageStoredLocally() ) | 472 | if ( p->isPackageStoredLocally() ) |
473 | name = p->getFilename(); | 473 | name = p->getFilename(); |
474 | QString option; | 474 | QString option; |
475 | QString dest = "root"; | 475 | QString dest = "root"; |
476 | if ( !p->isInstalled() ) | 476 | if ( !p->isInstalled() ) |
477 | { | 477 | { |
478 | InstallData item; | 478 | InstallData item; |
479 | item.option = "I"; | 479 | item.option = "I"; |
480 | item.packageName = name; | 480 | item.packageName = name; |
481 | return item; | 481 | return item; |
482 | } | 482 | } |
483 | else | 483 | else |
484 | { | 484 | { |
485 | InstallData item; | 485 | InstallData item; |
486 | item.option = "D"; | 486 | item.option = "D"; |
487 | item.packageName = name; | 487 | item.packageName = p->getInstalledPackageName(); |
488 | if ( p->getInstalledTo() ) | 488 | if ( p->getInstalledTo() ) |
489 | { | ||
489 | item.destination = p->getInstalledTo(); | 490 | item.destination = p->getInstalledTo(); |
491 | cout << "dest - " << p->getInstalledTo()->getDestinationName() << endl; | ||
492 | cout << "dest - " << p->getInstalledTo()->getDestinationPath() << endl; | ||
493 | } | ||
490 | else | 494 | else |
495 | { | ||
491 | item.destination = p->getLocalPackage()->getInstalledTo(); | 496 | item.destination = p->getLocalPackage()->getInstalledTo(); |
497 | } | ||
492 | 498 | ||
493 | // Sticky option not implemented yet, but will eventually allow | 499 | // Sticky option not implemented yet, but will eventually allow |
494 | // the user to say something like 'remove all' | 500 | // the user to say something like 'remove all' |
495 | if ( stickyOption == "" ) | 501 | if ( stickyOption == "" ) |
496 | { | 502 | { |
497 | QString msgtext; | 503 | QString msgtext; |
498 | msgtext.sprintf( "Do you wish to remove or reinstall\n%s?", (const char *)name ); | 504 | msgtext.sprintf( "Do you wish to remove or reinstall\n%s?", (const char *)name ); |
499 | switch( QMessageBox::information( this, "Remove or ReInstall", | 505 | switch( QMessageBox::information( this, "Remove or ReInstall", |
500 | msgtext, "Remove", "ReInstall" ) ) | 506 | msgtext, "Remove", "ReInstall" ) ) |
501 | { | 507 | { |
502 | case 0: // Try again or Enter | 508 | case 0: // Try again or Enter |
503 | item.option = "D"; | 509 | item.option = "D"; |
504 | break; | 510 | break; |
505 | case 1: // Quit or Escape | 511 | case 1: // Quit or Escape |
506 | item.option = "U"; | 512 | item.option = "U"; |
507 | break; | 513 | break; |
508 | } | 514 | } |
509 | } | 515 | } |
510 | else | 516 | else |
511 | { | 517 | { |
512 | // item.option = stickyOption; | 518 | // item.option = stickyOption; |
513 | } | 519 | } |
514 | 520 | ||
515 | // Check if we are reinstalling the same version | 521 | // Check if we are reinstalling the same version |
diff --git a/noncore/settings/aqpkg/package.cpp b/noncore/settings/aqpkg/package.cpp index 48b6934..fd75450 100644 --- a/noncore/settings/aqpkg/package.cpp +++ b/noncore/settings/aqpkg/package.cpp | |||
@@ -2,56 +2,63 @@ | |||
2 | package.cpp - description | 2 | package.cpp - description |
3 | ------------------- | 3 | ------------------- |
4 | begin : Mon Aug 26 2002 | 4 | begin : Mon Aug 26 2002 |
5 | copyright : (C) 2002 by Andy Qua | 5 | copyright : (C) 2002 by Andy Qua |
6 | email : andy.qua@blueyonder.co.uk | 6 | email : andy.qua@blueyonder.co.uk |
7 | ***************************************************************************/ | 7 | ***************************************************************************/ |
8 | 8 | ||
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 | #include "package.h" | 18 | #include "package.h" |
19 | #include "global.h" | 19 | #include "global.h" |
20 | 20 | ||
21 | Package::Package( QString &name ) | 21 | Package::Package( QString &name ) |
22 | { | 22 | { |
23 | packageName = name; | 23 | packageName = name; |
24 | localPackage = 0; | 24 | localPackage = 0; |
25 | installed = false; | 25 | installed = false; |
26 | packageStoredLocally = false; | 26 | packageStoredLocally = false; |
27 | installedToRoot = false; | 27 | installedToRoot = false; |
28 | installed = false; | ||
29 | installedTo = 0; | ||
28 | } | 30 | } |
29 | 31 | ||
30 | Package::Package( char *name ) | 32 | Package::Package( char *name ) |
31 | { | 33 | { |
32 | packageName = name; | 34 | packageName = name; |
33 | localPackage = 0; | 35 | localPackage = 0; |
36 | installed = false; | ||
37 | packageStoredLocally = false; | ||
38 | installedToRoot = false; | ||
39 | installed = false; | ||
40 | installedTo = 0; | ||
34 | } | 41 | } |
35 | 42 | ||
36 | Package::~Package() | 43 | Package::~Package() |
37 | { | 44 | { |
38 | } | 45 | } |
39 | 46 | ||
40 | QString Package :: toString() | 47 | QString Package :: toString() |
41 | { | 48 | { |
42 | QString ret = "Package - " + getPackageName() + | 49 | QString ret = "Package - " + getPackageName() + |
43 | "\n version - " + getVersion(); | 50 | "\n version - " + getVersion(); |
44 | 51 | ||
45 | if ( localPackage ) | 52 | if ( localPackage ) |
46 | ret += "\n inst version - " + localPackage->getVersion(); | 53 | ret += "\n inst version - " + localPackage->getVersion(); |
47 | 54 | ||
48 | 55 | ||
49 | return ret; | 56 | return ret; |
50 | } | 57 | } |
51 | 58 | ||
52 | void Package :: setStatus( QString &s ) | 59 | void Package :: setStatus( QString &s ) |
53 | { | 60 | { |
54 | status = s; | 61 | status = s; |
55 | 62 | ||
56 | if ( status.find( "installed" ) != -1 ) | 63 | if ( status.find( "installed" ) != -1 ) |
57 | installed = true; | 64 | installed = true; |
@@ -82,28 +89,36 @@ void Package :: setVersion( QString &v ) | |||
82 | void Package :: setPackageName( QString &name ) | 89 | void Package :: setPackageName( QString &name ) |
83 | { | 90 | { |
84 | packageName = name; | 91 | packageName = name; |
85 | } | 92 | } |
86 | 93 | ||
87 | void Package :: setDescription( QString &d ) | 94 | void Package :: setDescription( QString &d ) |
88 | { | 95 | { |
89 | description = d; | 96 | description = d; |
90 | } | 97 | } |
91 | 98 | ||
92 | void Package :: setFilename( QString &f ) | 99 | void Package :: setFilename( QString &f ) |
93 | { | 100 | { |
94 | filename = f; | 101 | filename = f; |
95 | } | 102 | } |
96 | 103 | ||
97 | 104 | ||
98 | QString Package :: getInstalledVersion() | 105 | QString Package :: getInstalledVersion() |
99 | { | 106 | { |
100 | if ( localPackage ) | 107 | if ( localPackage ) |
101 | return localPackage->getVersion(); | 108 | return localPackage->getVersion(); |
102 | else | 109 | else |
103 | return getVersion(); | 110 | return getVersion(); |
104 | } | 111 | } |
105 | 112 | ||
113 | QString Package :: getInstalledPackageName() | ||
114 | { | ||
115 | if ( localPackage ) | ||
116 | return localPackage->getPackageName(); | ||
117 | else | ||
118 | return getPackageName(); | ||
119 | } | ||
120 | |||
106 | bool Package :: isInstalled() | 121 | bool Package :: isInstalled() |
107 | { | 122 | { |
108 | return installed || ( localPackage && localPackage->isInstalled() ); | 123 | return installed || ( localPackage && localPackage->isInstalled() ); |
109 | } | 124 | } |
diff --git a/noncore/settings/aqpkg/package.h b/noncore/settings/aqpkg/package.h index 8ba5a6a..2f2a165 100644 --- a/noncore/settings/aqpkg/package.h +++ b/noncore/settings/aqpkg/package.h | |||
@@ -34,46 +34,47 @@ public: | |||
34 | Package( char *name ); | 34 | Package( char *name ); |
35 | ~Package(); | 35 | ~Package(); |
36 | 36 | ||
37 | void setLocalPackage( Package *p ); | 37 | void setLocalPackage( Package *p ); |
38 | void setPackageName( QString &name ); | 38 | void setPackageName( QString &name ); |
39 | void setVersion( QString &v ); | 39 | void setVersion( QString &v ); |
40 | void setStatus( QString &s ); | 40 | void setStatus( QString &s ); |
41 | void setDescription( QString &d ); | 41 | void setDescription( QString &d ); |
42 | void setFilename( QString &f ); | 42 | void setFilename( QString &f ); |
43 | void setPackageStoredLocally( bool local ){ packageStoredLocally = local; } | 43 | void setPackageStoredLocally( bool local ){ packageStoredLocally = local; } |
44 | void setInstalledToRoot( bool root ) { installedToRoot = root; } | 44 | void setInstalledToRoot( bool root ) { installedToRoot = root; } |
45 | void setInstalledTo( Destination *d ) { installedTo = d; } | 45 | void setInstalledTo( Destination *d ) { installedTo = d; } |
46 | 46 | ||
47 | Package *getLocalPackage() { return localPackage; } | 47 | Package *getLocalPackage() { return localPackage; } |
48 | QString getPackageName() { return packageName; } | 48 | QString getPackageName() { return packageName; } |
49 | QString getVersion() { return version; } | 49 | QString getVersion() { return version; } |
50 | QString getStatus() { return status; } | 50 | QString getStatus() { return status; } |
51 | QString getDescription() { return description; } | 51 | QString getDescription() { return description; } |
52 | QString getFilename() { return filename; } | 52 | QString getFilename() { return filename; } |
53 | 53 | ||
54 | bool isInstalled(); | 54 | bool isInstalled(); |
55 | bool isPackageStoredLocally(){ return packageStoredLocally; } | 55 | bool isPackageStoredLocally(){ return packageStoredLocally; } |
56 | bool isInstalledToRoot() { return installedToRoot; } | 56 | bool isInstalledToRoot() { return installedToRoot; } |
57 | QString getInstalledVersion(); | 57 | QString getInstalledVersion(); |
58 | QString getInstalledPackageName(); | ||
58 | Destination *getInstalledTo() { return installedTo; } | 59 | Destination *getInstalledTo() { return installedTo; } |
59 | 60 | ||
60 | QString toString(); | 61 | QString toString(); |
61 | 62 | ||
62 | 63 | ||
63 | private: | 64 | private: |
64 | Package *localPackage; | 65 | Package *localPackage; |
65 | 66 | ||
66 | QString packageName; | 67 | QString packageName; |
67 | QString version; | 68 | QString version; |
68 | QString status; | 69 | QString status; |
69 | QString description; | 70 | QString description; |
70 | QString filename; | 71 | QString filename; |
71 | bool packageStoredLocally; | 72 | bool packageStoredLocally; |
72 | bool installedToRoot; | 73 | bool installedToRoot; |
73 | bool installed; | 74 | bool installed; |
74 | bool differentVersionAvailable; | 75 | bool differentVersionAvailable; |
75 | 76 | ||
76 | Destination *installedTo; | 77 | Destination *installedTo; |
77 | }; | 78 | }; |
78 | 79 | ||
79 | #endif | 80 | #endif |
diff --git a/noncore/settings/aqpkg/server.cpp b/noncore/settings/aqpkg/server.cpp index 7d103a2..8bca892 100644 --- a/noncore/settings/aqpkg/server.cpp +++ b/noncore/settings/aqpkg/server.cpp | |||
@@ -85,58 +85,58 @@ void Server :: readStatusFile( vector<Destination> &destList ) | |||
85 | if ( !rootRead ) | 85 | if ( !rootRead ) |
86 | { | 86 | { |
87 | cout << "Reading status file " << "/usr/lib/ipkg/status" << endl; | 87 | cout << "Reading status file " << "/usr/lib/ipkg/status" << endl; |
88 | packageFile = "/usr/lib/ipkg/status"; | 88 | packageFile = "/usr/lib/ipkg/status"; |
89 | readPackageFile( 0, false, true ); | 89 | readPackageFile( 0, false, true ); |
90 | } | 90 | } |
91 | } | 91 | } |
92 | 92 | ||
93 | void Server :: readLocalIpks( Server *local ) | 93 | void Server :: readLocalIpks( Server *local ) |
94 | { | 94 | { |
95 | cleanUp(); | 95 | cleanUp(); |
96 | 96 | ||
97 | #ifdef QWS | 97 | #ifdef QWS |
98 | // First, get any local IPKGs in the documents area | 98 | // First, get any local IPKGs in the documents area |
99 | // Only applicable to Qtopie/Opie | 99 | // Only applicable to Qtopie/Opie |
100 | 100 | ||
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 | QString packageName = Utils::getPackageNameFromIpkFilename( file ); |
114 | QString ver = Utils::getPackageVersionFromIpkFilename( file ); | 114 | QString ver = Utils::getPackageVersionFromIpkFilename( file ); |
115 | packageList.push_back( Package( packageName ) ); | 115 | packageList.push_back( Package( packageName ) ); |
116 | packageList.back().setVersion( ver ); | 116 | packageList.back().setVersion( ver ); |
117 | packageList.back().setFilename( file ); | 117 | packageList.back().setFilename( file ); |
118 | packageList.back().setPackageStoredLocally( true ); | 118 | packageList.back().setPackageStoredLocally( true ); |
119 | 119 | ||
120 | } | 120 | } |
121 | #else | 121 | #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" }; | 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 | for ( int i = 0 ; i < 4 ; ++i ) | 123 | for ( int i = 0 ; i < 4 ; ++i ) |
124 | { | 124 | { |
125 | // OK, we have a local IPK file, I think the standard naming conventions | 125 | // OK, we have a local IPK file, I think the standard naming conventions |
126 | // for these are packagename_version_arm.ipk | 126 | // for these are packagename_version_arm.ipk |
127 | QString file = names[i]; | 127 | QString file = names[i]; |
128 | int p = file.find( "_" ); | 128 | int p = file.find( "_" ); |
129 | QString tmp = file.mid( 0, p ); | 129 | QString tmp = file.mid( 0, p ); |
130 | packageList.push_back( Package( tmp ) ); | 130 | packageList.push_back( Package( tmp ) ); |
131 | int p2 = file.find( "_", p+1 ); | 131 | int p2 = file.find( "_", p+1 ); |
132 | tmp = file.mid( p+1, p2-(p+1) ); | 132 | tmp = file.mid( p+1, p2-(p+1) ); |
133 | packageList.back().setVersion( tmp ); | 133 | packageList.back().setVersion( tmp ); |
134 | packageList.back().setPackageStoredLocally( true ); | 134 | packageList.back().setPackageStoredLocally( true ); |
135 | } | 135 | } |
136 | #endif | 136 | #endif |
137 | 137 | ||
138 | // build local packages | 138 | // build local packages |
139 | buildLocalPackages( local ); | 139 | buildLocalPackages( local ); |
140 | } | 140 | } |
141 | 141 | ||
142 | void Server :: readPackageFile( Server *local, bool clearAll, bool installingToRoot, Destination *dest ) | 142 | void Server :: readPackageFile( Server *local, bool clearAll, bool installingToRoot, Destination *dest ) |