author | kergoth <kergoth> | 2003-03-27 18:41:00 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2003-03-27 18:41:00 (UTC) |
commit | bff145f5cced95c742deefcd607932a9f3728dd3 (patch) (unidiff) | |
tree | c1d533d21e78fb0d45e94490f055651c9e5e3156 | |
parent | 390a5a0c332c8c6fb380c1ed4cd6adae3e544a08 (diff) | |
download | opie-bff145f5cced95c742deefcd607932a9f3728dd3.zip opie-bff145f5cced95c742deefcd607932a9f3728dd3.tar.gz opie-bff145f5cced95c742deefcd607932a9f3728dd3.tar.bz2 |
Slower, but more appropriate status parser. Now identifies the state_status column and compares against installed.. This fixes the bug introduced where it hit 'ok installed' but not 'prefer installed', both of which are valid entries.
-rw-r--r-- | noncore/settings/aqpkg/package.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/noncore/settings/aqpkg/package.cpp b/noncore/settings/aqpkg/package.cpp index 99187ac..83e0706 100644 --- a/noncore/settings/aqpkg/package.cpp +++ b/noncore/settings/aqpkg/package.cpp | |||
@@ -41,67 +41,75 @@ Package::Package( char *name ) | |||
41 | 41 | ||
42 | version = "N/A"; | 42 | version = "N/A"; |
43 | description = "N/A"; | 43 | description = "N/A"; |
44 | packageSize = "N/A"; | 44 | packageSize = "N/A"; |
45 | section = "N/A"; | 45 | section = "N/A"; |
46 | 46 | ||
47 | localPackage = 0; | 47 | localPackage = 0; |
48 | installed = false; | 48 | installed = false; |
49 | packageStoredLocally = false; | 49 | packageStoredLocally = false; |
50 | installedToRoot = false; | 50 | installedToRoot = false; |
51 | installed = false; | 51 | installed = false; |
52 | installedTo = 0; | 52 | installedTo = 0; |
53 | } | 53 | } |
54 | 54 | ||
55 | Package::~Package() | 55 | Package::~Package() |
56 | { | 56 | { |
57 | } | 57 | } |
58 | 58 | ||
59 | QString Package :: toString() | 59 | QString Package :: toString() |
60 | { | 60 | { |
61 | QString ret = "Package - " + getPackageName() + | 61 | QString ret = "Package - " + getPackageName() + |
62 | "\n version - " + getVersion(); | 62 | "\n version - " + getVersion(); |
63 | 63 | ||
64 | if ( localPackage ) | 64 | if ( localPackage ) |
65 | ret += "\n inst version - " + localPackage->getVersion(); | 65 | ret += "\n inst version - " + localPackage->getVersion(); |
66 | 66 | ||
67 | 67 | ||
68 | return ret; | 68 | return ret; |
69 | } | 69 | } |
70 | 70 | ||
71 | void Package :: setStatus( const QString &s ) | 71 | void Package :: setStatus( const QString &s ) |
72 | { | 72 | { |
73 | status = s; | 73 | QString state_status; |
74 | int two, three; | ||
74 | 75 | ||
75 | if ( status.find( "ok installed" ) != -1 ) | 76 | status = s.simplifyWhiteSpace( ); |
77 | |||
78 | two = status.find( " " ); // find second column | ||
79 | three = status.find( " ", two + 1 ); // find third column | ||
80 | |||
81 | state_status = status.mid( three ).stripWhiteSpace( ); | ||
82 | |||
83 | if ( state_status == "installed" ) | ||
76 | installed = true; | 84 | installed = true; |
77 | } | 85 | } |
78 | 86 | ||
79 | void Package :: setLocalPackage( Package *p ) | 87 | void Package :: setLocalPackage( Package *p ) |
80 | { | 88 | { |
81 | localPackage = p; | 89 | localPackage = p; |
82 | 90 | ||
83 | if ( localPackage ) | 91 | if ( localPackage ) |
84 | if ( localPackage->getVersion() != getVersion() ) | 92 | if ( localPackage->getVersion() != getVersion() ) |
85 | differentVersionAvailable = true; | 93 | differentVersionAvailable = true; |
86 | else | 94 | else |
87 | differentVersionAvailable = false; | 95 | differentVersionAvailable = false; |
88 | } | 96 | } |
89 | 97 | ||
90 | void Package :: setVersion( const QString &v ) | 98 | void Package :: setVersion( const QString &v ) |
91 | { | 99 | { |
92 | version = v; | 100 | version = v; |
93 | 101 | ||
94 | if ( localPackage ) | 102 | if ( localPackage ) |
95 | if ( localPackage->getVersion() != getVersion() ) | 103 | if ( localPackage->getVersion() != getVersion() ) |
96 | differentVersionAvailable = true; | 104 | differentVersionAvailable = true; |
97 | else | 105 | else |
98 | differentVersionAvailable = false; | 106 | differentVersionAvailable = false; |
99 | } | 107 | } |
100 | 108 | ||
101 | void Package :: setPackageName( const QString &name ) | 109 | void Package :: setPackageName( const QString &name ) |
102 | { | 110 | { |
103 | packageName = name; | 111 | packageName = name; |
104 | } | 112 | } |
105 | 113 | ||
106 | void Package :: setDescription( const QString &d ) | 114 | void Package :: setDescription( const QString &d ) |
107 | { | 115 | { |