-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 | |||
@@ -25,99 +25,107 @@ Package::Package( QString &name ) | |||
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 | 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 | { |
108 | description = d; | 116 | description = d; |
109 | } | 117 | } |
110 | 118 | ||
111 | void Package :: setFilename( const QString &f ) | 119 | void Package :: setFilename( const QString &f ) |
112 | { | 120 | { |
113 | filename = f; | 121 | filename = f; |
114 | } | 122 | } |
115 | 123 | ||
116 | 124 | ||
117 | QString Package :: getInstalledVersion() | 125 | QString Package :: getInstalledVersion() |
118 | { | 126 | { |
119 | if ( localPackage ) | 127 | if ( localPackage ) |
120 | return localPackage->getVersion(); | 128 | return localPackage->getVersion(); |
121 | else | 129 | else |
122 | return getVersion(); | 130 | return getVersion(); |
123 | } | 131 | } |