author | andyq <andyq> | 2002-12-13 13:49:02 (UTC) |
---|---|---|
committer | andyq <andyq> | 2002-12-13 13:49:02 (UTC) |
commit | 8b1c25e608e7255199dc97ad8269ac66d40beede (patch) (unidiff) | |
tree | f17e7e897e1f872e035c004af8479430c45bc640 | |
parent | 9b65e55ce70837695b319ef7049674e9c3daba98 (diff) | |
download | opie-8b1c25e608e7255199dc97ad8269ac66d40beede.zip opie-8b1c25e608e7255199dc97ad8269ac66d40beede.tar.gz opie-8b1c25e608e7255199dc97ad8269ac66d40beede.tar.bz2 |
Only enable the username and password if one of the proxies is enabled
-rw-r--r-- | noncore/settings/aqpkg/datamgr.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/settings/aqpkg/datamgr.cpp b/noncore/settings/aqpkg/datamgr.cpp index 3933a22..0159a79 100644 --- a/noncore/settings/aqpkg/datamgr.cpp +++ b/noncore/settings/aqpkg/datamgr.cpp | |||
@@ -157,119 +157,119 @@ void DataManager :: loadServers() | |||
157 | proxyPassword = val; | 157 | proxyPassword = val; |
158 | } | 158 | } |
159 | } | 159 | } |
160 | } | 160 | } |
161 | fclose( fp ); | 161 | fclose( fp ); |
162 | 162 | ||
163 | reloadServerData( ); | 163 | reloadServerData( ); |
164 | } | 164 | } |
165 | 165 | ||
166 | void DataManager :: reloadServerData( ) | 166 | void DataManager :: reloadServerData( ) |
167 | { | 167 | { |
168 | vector<Server>::iterator it = serverList.begin(); | 168 | vector<Server>::iterator it = serverList.begin(); |
169 | for ( it = serverList.begin() ; it != serverList.end() ; ++it ) | 169 | for ( it = serverList.begin() ; it != serverList.end() ; ++it ) |
170 | { | 170 | { |
171 | // Now we've read the config file in we need to read the servers | 171 | // Now we've read the config file in we need to read the servers |
172 | // The local server is a special case. This holds the contents of the | 172 | // The local server is a special case. This holds the contents of the |
173 | // status files the number of which depends on how many destinations | 173 | // status files the number of which depends on how many destinations |
174 | // we've set up | 174 | // we've set up |
175 | // The other servers files hold the contents of the server package list | 175 | // The other servers files hold the contents of the server package list |
176 | if ( it->getServerName() == LOCAL_SERVER ) | 176 | if ( it->getServerName() == LOCAL_SERVER ) |
177 | it->readStatusFile( destList ); | 177 | it->readStatusFile( destList ); |
178 | else if ( it->getServerName() == LOCAL_IPKGS ) | 178 | else if ( it->getServerName() == LOCAL_IPKGS ) |
179 | it->readLocalIpks( &( *getServer( LOCAL_SERVER ) ) ); | 179 | it->readLocalIpks( &( *getServer( LOCAL_SERVER ) ) ); |
180 | else | 180 | else |
181 | it->readPackageFile( &( *getServer( LOCAL_SERVER ) ) ); | 181 | it->readPackageFile( &( *getServer( LOCAL_SERVER ) ) ); |
182 | } | 182 | } |
183 | } | 183 | } |
184 | 184 | ||
185 | void DataManager :: writeOutIpkgConf() | 185 | void DataManager :: writeOutIpkgConf() |
186 | { | 186 | { |
187 | QString ipkg_conf = IPKG_CONF; | 187 | QString ipkg_conf = IPKG_CONF; |
188 | ofstream out( ipkg_conf ); | 188 | ofstream out( ipkg_conf ); |
189 | 189 | ||
190 | out << "# Written by AQPkg" << endl; | 190 | out << "# Written by AQPkg" << endl; |
191 | out << "# Must have one or more source entries of the form:" << endl; | 191 | out << "# Must have one or more source entries of the form:" << endl; |
192 | out << "#" << endl; | 192 | out << "#" << endl; |
193 | out << "# src <src-name> <source-url>" << endl; | 193 | out << "# src <src-name> <source-url>" << endl; |
194 | out << "#" << endl; | 194 | out << "#" << endl; |
195 | out << "# and one or more destination entries of the form:" << endl; | 195 | out << "# and one or more destination entries of the form:" << endl; |
196 | out << "#" << endl; | 196 | out << "#" << endl; |
197 | out << "# dest <dest-name> <target-path>" << endl; | 197 | out << "# dest <dest-name> <target-path>" << endl; |
198 | out << "#" << endl; | 198 | out << "#" << endl; |
199 | out << "# where <src-name> and <dest-names> are identifiers that" << endl; | 199 | out << "# where <src-name> and <dest-names> are identifiers that" << endl; |
200 | out << "# should match [a-zA-Z0-9._-]+, <source-url> should be a" << endl; | 200 | out << "# should match [a-zA-Z0-9._-]+, <source-url> should be a" << endl; |
201 | out << "# URL that points to a directory containing a Familiar" << endl; | 201 | out << "# URL that points to a directory containing a Familiar" << endl; |
202 | out << "# Packages file, and <target-path> should be a directory" << endl; | 202 | out << "# Packages file, and <target-path> should be a directory" << endl; |
203 | out << "# that exists on the target system." << endl << endl; | 203 | out << "# that exists on the target system." << endl << endl; |
204 | 204 | ||
205 | // Write out servers | 205 | // Write out servers |
206 | vector<Server>::iterator it = serverList.begin(); | 206 | vector<Server>::iterator it = serverList.begin(); |
207 | while ( it != serverList.end() ) | 207 | while ( it != serverList.end() ) |
208 | { | 208 | { |
209 | QString alias = it->getServerName(); | 209 | QString alias = it->getServerName(); |
210 | // Don't write out local as its a dummy | 210 | // Don't write out local as its a dummy |
211 | if ( alias != LOCAL_SERVER && alias != LOCAL_IPKGS ) | 211 | if ( alias != LOCAL_SERVER && alias != LOCAL_IPKGS ) |
212 | { | 212 | { |
213 | QString url = it->getServerUrl();; | 213 | QString url = it->getServerUrl();; |
214 | 214 | ||
215 | if ( !it->isServerActive() ) | 215 | if ( !it->isServerActive() ) |
216 | out << "#"; | 216 | out << "#"; |
217 | out << "src " << alias << " " << url << endl; | 217 | out << "src " << alias << " " << url << endl; |
218 | } | 218 | } |
219 | 219 | ||
220 | it++; | 220 | it++; |
221 | } | 221 | } |
222 | 222 | ||
223 | out << endl; | 223 | out << endl; |
224 | 224 | ||
225 | // Write out destinations | 225 | // Write out destinations |
226 | vector<Destination>::iterator it2 = destList.begin(); | 226 | vector<Destination>::iterator it2 = destList.begin(); |
227 | while ( it2 != destList.end() ) | 227 | while ( it2 != destList.end() ) |
228 | { | 228 | { |
229 | out << "dest " << it2->getDestinationName() << " " << it2->getDestinationPath() << endl; | 229 | out << "dest " << it2->getDestinationName() << " " << it2->getDestinationPath() << endl; |
230 | it2++; | 230 | it2++; |
231 | } | 231 | } |
232 | 232 | ||
233 | out << endl; | 233 | out << endl; |
234 | out << "# Proxy Support" << endl; | 234 | out << "# Proxy Support" << endl; |
235 | 235 | ||
236 | if ( !httpProxyEnabled && httpProxy == "" ) | 236 | if ( !httpProxyEnabled && httpProxy == "" ) |
237 | out << "#option http_proxy http://proxy.tld:3128" << endl; | 237 | out << "#option http_proxy http://proxy.tld:3128" << endl; |
238 | else | 238 | else |
239 | { | 239 | { |
240 | if ( !httpProxyEnabled ) | 240 | if ( !httpProxyEnabled ) |
241 | out << "#"; | 241 | out << "#"; |
242 | out << "option http_proxy " << httpProxy << endl; | 242 | out << "option http_proxy " << httpProxy << endl; |
243 | } | 243 | } |
244 | 244 | ||
245 | if ( !ftpProxyEnabled && ftpProxy == "" ) | 245 | if ( !ftpProxyEnabled && ftpProxy == "" ) |
246 | out << "#option ftp_proxy http://proxy.tld:3128" << endl; | 246 | out << "#option ftp_proxy http://proxy.tld:3128" << endl; |
247 | else | 247 | else |
248 | { | 248 | { |
249 | if ( !ftpProxyEnabled ) | 249 | if ( !ftpProxyEnabled ) |
250 | out << "#"; | 250 | out << "#"; |
251 | out << "option ftp_proxy " << ftpProxy << endl; | 251 | out << "option ftp_proxy " << ftpProxy << endl; |
252 | } | 252 | } |
253 | if ( proxyUsername == "" ) | 253 | if ( proxyUsername == "" || (!httpProxyEnabled && !ftpProxyEnabled) ) |
254 | out << "#option proxy_username <username>" << endl; | 254 | out << "#option proxy_username <username>" << endl; |
255 | else | 255 | else |
256 | out << "option proxy_username " << proxyUsername << endl; | 256 | out << "option proxy_username " << proxyUsername << endl; |
257 | if ( proxyPassword == "" ) | 257 | if ( proxyPassword == "" || (!httpProxyEnabled && !ftpProxyEnabled) ) |
258 | out << "#option proxy_password <password>" << endl << endl; | 258 | out << "#option proxy_password <password>" << endl << endl; |
259 | else | 259 | else |
260 | out << "option proxy_password " << proxyPassword << endl<< endl; | 260 | out << "option proxy_password " << proxyPassword << endl<< endl; |
261 | 261 | ||
262 | out << "# Offline mode (for use in constructing flash images offline)" << endl; | 262 | out << "# Offline mode (for use in constructing flash images offline)" << endl; |
263 | out << "#option offline_root target" << endl; | 263 | out << "#option offline_root target" << endl; |
264 | 264 | ||
265 | 265 | ||
266 | out.close(); | 266 | out.close(); |
267 | } | 267 | } |
268 | 268 | ||
269 | 269 | ||
270 | void DataManager :: setAvailableCategories( QString section ) | 270 | void DataManager :: setAvailableCategories( QString section ) |
271 | { | 271 | { |
272 | section = section.lower(); | 272 | section = section.lower(); |
273 | if ( availableCategories.find( "#" + section + "#" ) == -1 ) | 273 | if ( availableCategories.find( "#" + section + "#" ) == -1 ) |
274 | availableCategories += section + "#"; | 274 | availableCategories += section + "#"; |
275 | } | 275 | } |