author | drw <drw> | 2003-03-29 01:13:02 (UTC) |
---|---|---|
committer | drw <drw> | 2003-03-29 01:13:02 (UTC) |
commit | 22e941e4cbc9e8906287d1e352b66092c6a84c0d (patch) (unidiff) | |
tree | 2704ea40f9ee926c2734eb25c7165852c024c136 | |
parent | f42edeac768082ec8d7716a17c82507496dd7b47 (diff) | |
download | opie-22e941e4cbc9e8906287d1e352b66092c6a84c0d.zip opie-22e941e4cbc9e8906287d1e352b66092c6a84c0d.tar.gz opie-22e941e4cbc9e8906287d1e352b66092c6a84c0d.tar.bz2 |
Fix for reading feed's Package file works this time. However, this is temporary until I re-do this part of the code this weekend (don't like the way it works).
-rw-r--r-- | noncore/settings/aqpkg/server.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/noncore/settings/aqpkg/server.cpp b/noncore/settings/aqpkg/server.cpp index d4fa439..64a9c26 100644 --- a/noncore/settings/aqpkg/server.cpp +++ b/noncore/settings/aqpkg/server.cpp | |||
@@ -105,110 +105,110 @@ void Server :: readLocalIpks( Server *local ) | |||
105 | DocLnkSet files; | 105 | DocLnkSet files; |
106 | Global::findDocuments( &files, "application/ipkg" ); | 106 | Global::findDocuments( &files, "application/ipkg" ); |
107 | 107 | ||
108 | // Now add the items to the list | 108 | // Now add the items to the list |
109 | QListIterator<DocLnk> it( files.children() ); | 109 | QListIterator<DocLnk> it( files.children() ); |
110 | 110 | ||
111 | for ( ; it.current() ; ++it ) | 111 | for ( ; it.current() ; ++it ) |
112 | { | 112 | { |
113 | // OK, we have a local IPK file, I think the standard naming conventions | 113 | // OK, we have a local IPK file, I think the standard naming conventions |
114 | // for these are packagename_version_arm.ipk | 114 | // for these are packagename_version_arm.ipk |
115 | QString file = (*it)->file(); | 115 | QString file = (*it)->file(); |
116 | 116 | ||
117 | // Changed to display the filename (excluding the path) | 117 | // Changed to display the filename (excluding the path) |
118 | QString packageName = Utils::getFilenameFromIpkFilename( file ); | 118 | QString packageName = Utils::getFilenameFromIpkFilename( file ); |
119 | QString ver = Utils::getPackageVersionFromIpkFilename( file ); | 119 | QString ver = Utils::getPackageVersionFromIpkFilename( file ); |
120 | Package *package = new Package( packageName ); | 120 | Package *package = new Package( packageName ); |
121 | package->setVersion( ver ); | 121 | package->setVersion( ver ); |
122 | package->setFilename( file ); | 122 | package->setFilename( file ); |
123 | package->setPackageStoredLocally( true ); | 123 | package->setPackageStoredLocally( true ); |
124 | packageList.append( package ); | 124 | packageList.append( package ); |
125 | } | 125 | } |
126 | #else | 126 | #else |
127 | 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" }; | 127 | 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" }; |
128 | for ( int i = 0 ; i < 4 ; ++i ) | 128 | for ( int i = 0 ; i < 4 ; ++i ) |
129 | { | 129 | { |
130 | // OK, we have a local IPK file, I think the standard naming conventions | 130 | // OK, we have a local IPK file, I think the standard naming conventions |
131 | // for these are packagename_version_arm.ipk | 131 | // for these are packagename_version_arm.ipk |
132 | QString file = names[i]; | 132 | QString file = names[i]; |
133 | int p = file.find( "_" ); | 133 | int p = file.find( "_" ); |
134 | QString tmp = file.mid( 0, p ); | 134 | QString tmp = file.mid( 0, p ); |
135 | packageList.push_back( Package( tmp ) ); | 135 | packageList.push_back( Package( tmp ) ); |
136 | int p2 = file.find( "_", p+1 ); | 136 | int p2 = file.find( "_", p+1 ); |
137 | tmp = file.mid( p+1, p2-(p+1) ); | 137 | tmp = file.mid( p+1, p2-(p+1) ); |
138 | packageList.back().setVersion( tmp ); | 138 | packageList.back().setVersion( tmp ); |
139 | packageList.back().setPackageStoredLocally( true ); | 139 | packageList.back().setPackageStoredLocally( true ); |
140 | } | 140 | } |
141 | #endif | 141 | #endif |
142 | 142 | ||
143 | // build local packages | 143 | // build local packages |
144 | buildLocalPackages( local ); | 144 | buildLocalPackages( local ); |
145 | } | 145 | } |
146 | 146 | ||
147 | void Server :: readPackageFile( Server *local, bool clearAll, bool installingToRoot, Destination *dest ) | 147 | void Server :: readPackageFile( Server *local, bool clearAll, bool installingToRoot, Destination *dest ) |
148 | { | 148 | { |
149 | ifstream in( packageFile ); | 149 | ifstream in( packageFile ); |
150 | if ( !in.is_open() ) | 150 | if ( !in.is_open() ) |
151 | return; | 151 | return; |
152 | 152 | ||
153 | char line[1001]; | 153 | char line[5001]; |
154 | char k[21]; | 154 | char k[21]; |
155 | char v[1001]; | 155 | char v[5001]; |
156 | QString key; | 156 | QString key; |
157 | QString value; | 157 | QString value; |
158 | 158 | ||
159 | if ( clearAll ) | 159 | if ( clearAll ) |
160 | cleanUp(); | 160 | cleanUp(); |
161 | Package *currPackage = 0; | 161 | Package *currPackage = 0; |
162 | 162 | ||
163 | bool newPackage = true; | 163 | bool newPackage = true; |
164 | do | 164 | do |
165 | { | 165 | { |
166 | in.getline( line, 1000 ); | 166 | in.getline( line, 5000 ); |
167 | if ( in.eof() ) | 167 | if ( in.eof() ) |
168 | continue; | 168 | continue; |
169 | 169 | ||
170 | k[0] = '\0'; | 170 | k[0] = '\0'; |
171 | v[0] = '\0'; | 171 | v[0] = '\0'; |
172 | 172 | ||
173 | sscanf( line, "%[^:]: %[^\n]", k, v ); | 173 | sscanf( line, "%[^:]: %[^\n]", k, v ); |
174 | 174 | ||
175 | key = k; | 175 | key = k; |
176 | value = v; | 176 | value = v; |
177 | key = key.stripWhiteSpace(); | 177 | key = key.stripWhiteSpace(); |
178 | value = value.stripWhiteSpace(); | 178 | value = value.stripWhiteSpace(); |
179 | if ( key == "Package" && newPackage ) | 179 | if ( key == "Package" && newPackage ) |
180 | { | 180 | { |
181 | newPackage = false; | 181 | newPackage = false; |
182 | 182 | ||
183 | currPackage = getPackage( value ); | 183 | currPackage = getPackage( value ); |
184 | if ( !currPackage ) | 184 | if ( !currPackage ) |
185 | { | 185 | { |
186 | Package *package = new Package( value ); | 186 | Package *package = new Package( value ); |
187 | packageList.append( package ); | 187 | packageList.append( package ); |
188 | currPackage = package; | 188 | currPackage = package; |
189 | currPackage->setInstalledTo( dest ); | 189 | currPackage->setInstalledTo( dest ); |
190 | if ( installingToRoot ) | 190 | if ( installingToRoot ) |
191 | currPackage->setInstalledToRoot( true ); | 191 | currPackage->setInstalledToRoot( true ); |
192 | } | 192 | } |
193 | else | 193 | else |
194 | { | 194 | { |
195 | if (currPackage->getStatus().find( "deinstall" ) != -1 ) | 195 | if (currPackage->getStatus().find( "deinstall" ) != -1 ) |
196 | currPackage->setInstalledTo( dest ); | 196 | currPackage->setInstalledTo( dest ); |
197 | } | 197 | } |
198 | } | 198 | } |
199 | else if ( key == "Version" ) | 199 | else if ( key == "Version" ) |
200 | { | 200 | { |
201 | if ( currPackage ) | 201 | if ( currPackage ) |
202 | currPackage->setVersion( value ); | 202 | currPackage->setVersion( value ); |
203 | } | 203 | } |
204 | else if ( key == "Status" ) | 204 | else if ( key == "Status" ) |
205 | { | 205 | { |
206 | if ( currPackage ) | 206 | if ( currPackage ) |
207 | currPackage->setStatus( value ); | 207 | currPackage->setStatus( value ); |
208 | } | 208 | } |
209 | else if ( key == "Description" ) | 209 | else if ( key == "Description" ) |
210 | { | 210 | { |
211 | if ( currPackage ) | 211 | if ( currPackage ) |
212 | currPackage->setDescription( value ); | 212 | currPackage->setDescription( value ); |
213 | } | 213 | } |
214 | else if ( key == "Filename" ) | 214 | else if ( key == "Filename" ) |