author | drw <drw> | 2003-03-27 02:13:19 (UTC) |
---|---|---|
committer | drw <drw> | 2003-03-27 02:13:19 (UTC) |
commit | 72673ba6769cef021f23002cb0a8e1545ee43632 (patch) (unidiff) | |
tree | ce11217c6ad7c55c0b9f2a443bd49586636b8640 | |
parent | 0fc0190f424cf7e05f82a5c506db74c1e7f98e3b (diff) | |
download | opie-72673ba6769cef021f23002cb0a8e1545ee43632.zip opie-72673ba6769cef021f23002cb0a8e1545ee43632.tar.gz opie-72673ba6769cef021f23002cb0a8e1545ee43632.tar.bz2 |
Fix bug #780 - correctly identify whether a package is really installed or not
-rw-r--r-- | noncore/settings/aqpkg/package.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/settings/aqpkg/package.cpp b/noncore/settings/aqpkg/package.cpp index db3e927..99187ac 100644 --- a/noncore/settings/aqpkg/package.cpp +++ b/noncore/settings/aqpkg/package.cpp | |||
@@ -1,136 +1,136 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
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 | 24 | ||
25 | version = "N/A"; | 25 | version = "N/A"; |
26 | description = "N/A"; | 26 | description = "N/A"; |
27 | packageSize = "N/A"; | 27 | packageSize = "N/A"; |
28 | section = "N/A"; | 28 | section = "N/A"; |
29 | 29 | ||
30 | localPackage = 0; | 30 | localPackage = 0; |
31 | installed = false; | 31 | installed = false; |
32 | packageStoredLocally = false; | 32 | packageStoredLocally = false; |
33 | installedToRoot = false; | 33 | installedToRoot = false; |
34 | installed = false; | 34 | installed = false; |
35 | installedTo = 0; | 35 | installedTo = 0; |
36 | } | 36 | } |
37 | 37 | ||
38 | Package::Package( char *name ) | 38 | Package::Package( char *name ) |
39 | { | 39 | { |
40 | packageName = name; | 40 | packageName = 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 | status = s; |
74 | 74 | ||
75 | if ( status.find( "installed" ) != -1 ) | 75 | if ( status.find( "ok installed" ) != -1 ) |
76 | installed = true; | 76 | installed = true; |
77 | } | 77 | } |
78 | 78 | ||
79 | void Package :: setLocalPackage( Package *p ) | 79 | void Package :: setLocalPackage( Package *p ) |
80 | { | 80 | { |
81 | localPackage = p; | 81 | localPackage = p; |
82 | 82 | ||
83 | if ( localPackage ) | 83 | if ( localPackage ) |
84 | if ( localPackage->getVersion() != getVersion() ) | 84 | if ( localPackage->getVersion() != getVersion() ) |
85 | differentVersionAvailable = true; | 85 | differentVersionAvailable = true; |
86 | else | 86 | else |
87 | differentVersionAvailable = false; | 87 | differentVersionAvailable = false; |
88 | } | 88 | } |
89 | 89 | ||
90 | void Package :: setVersion( const QString &v ) | 90 | void Package :: setVersion( const QString &v ) |
91 | { | 91 | { |
92 | version = v; | 92 | version = v; |
93 | 93 | ||
94 | if ( localPackage ) | 94 | if ( localPackage ) |
95 | if ( localPackage->getVersion() != getVersion() ) | 95 | if ( localPackage->getVersion() != getVersion() ) |
96 | differentVersionAvailable = true; | 96 | differentVersionAvailable = true; |
97 | else | 97 | else |
98 | differentVersionAvailable = false; | 98 | differentVersionAvailable = false; |
99 | } | 99 | } |
100 | 100 | ||
101 | void Package :: setPackageName( const QString &name ) | 101 | void Package :: setPackageName( const QString &name ) |
102 | { | 102 | { |
103 | packageName = name; | 103 | packageName = name; |
104 | } | 104 | } |
105 | 105 | ||
106 | void Package :: setDescription( const QString &d ) | 106 | void Package :: setDescription( const QString &d ) |
107 | { | 107 | { |
108 | description = d; | 108 | description = d; |
109 | } | 109 | } |
110 | 110 | ||
111 | void Package :: setFilename( const QString &f ) | 111 | void Package :: setFilename( const QString &f ) |
112 | { | 112 | { |
113 | filename = f; | 113 | filename = f; |
114 | } | 114 | } |
115 | 115 | ||
116 | 116 | ||
117 | QString Package :: getInstalledVersion() | 117 | QString Package :: getInstalledVersion() |
118 | { | 118 | { |
119 | if ( localPackage ) | 119 | if ( localPackage ) |
120 | return localPackage->getVersion(); | 120 | return localPackage->getVersion(); |
121 | else | 121 | else |
122 | return getVersion(); | 122 | return getVersion(); |
123 | } | 123 | } |
124 | 124 | ||
125 | QString Package :: getInstalledPackageName() | 125 | QString Package :: getInstalledPackageName() |
126 | { | 126 | { |
127 | if ( localPackage ) | 127 | if ( localPackage ) |
128 | return localPackage->getPackageName(); | 128 | return localPackage->getPackageName(); |
129 | else | 129 | else |
130 | return getPackageName(); | 130 | return getPackageName(); |
131 | } | 131 | } |
132 | 132 | ||
133 | bool Package :: isInstalled() | 133 | bool Package :: isInstalled() |
134 | { | 134 | { |
135 | return installed || ( localPackage && localPackage->isInstalled() ); | 135 | return installed || ( localPackage && localPackage->isInstalled() ); |
136 | } | 136 | } |