author | tille <tille> | 2002-09-03 18:35:54 (UTC) |
---|---|---|
committer | tille <tille> | 2002-09-03 18:35:54 (UTC) |
commit | 6e4c5aebd3d2a7203480e5f408358c677203f9ca (patch) (unidiff) | |
tree | 57df19225fd14d00763669a889d4c816f9f68a38 | |
parent | ed440196145aec276620b45d7a56400f27eabc82 (diff) | |
download | opie-6e4c5aebd3d2a7203480e5f408358c677203f9ca.zip opie-6e4c5aebd3d2a7203480e5f408358c677203f9ca.tar.gz opie-6e4c5aebd3d2a7203480e5f408358c677203f9ca.tar.bz2 |
should fix #180
-rw-r--r-- | noncore/unsupported/oipkg/package.cpp | 2 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pksettings.cpp | 5 |
2 files changed, 3 insertions, 4 deletions
diff --git a/noncore/unsupported/oipkg/package.cpp b/noncore/unsupported/oipkg/package.cpp index 1054a1d..3effb73 100644 --- a/noncore/unsupported/oipkg/package.cpp +++ b/noncore/unsupported/oipkg/package.cpp | |||
@@ -215,265 +215,265 @@ QString Package::shortDesc() | |||
215 | } | 215 | } |
216 | 216 | ||
217 | QString Package::size() | 217 | QString Package::size() |
218 | { | 218 | { |
219 | return _size; | 219 | return _size; |
220 | } | 220 | } |
221 | 221 | ||
222 | 222 | ||
223 | QString Package::version() | 223 | QString Package::version() |
224 | { | 224 | { |
225 | return _version; | 225 | return _version; |
226 | } | 226 | } |
227 | 227 | ||
228 | QString Package::sizeUnits() | 228 | QString Package::sizeUnits() |
229 | { | 229 | { |
230 | int i = _size.toInt(); | 230 | int i = _size.toInt(); |
231 | int c = 0; | 231 | int c = 0; |
232 | QString ret; | 232 | QString ret; |
233 | QStringList unit; | 233 | QStringList unit; |
234 | unit << "B" << "KB" << "MB" << "GB" << "TB"; //prepair for the future ;) | 234 | unit << "B" << "KB" << "MB" << "GB" << "TB"; //prepair for the future ;) |
235 | while (i > 1) | 235 | while (i > 1) |
236 | { | 236 | { |
237 | ret=QString::number(i)+" "+unit[c]; | 237 | ret=QString::number(i)+" "+unit[c]; |
238 | c++; | 238 | c++; |
239 | i /= 1024; | 239 | i /= 1024; |
240 | } | 240 | } |
241 | return ret; | 241 | return ret; |
242 | } | 242 | } |
243 | 243 | ||
244 | bool Package::toProcess() | 244 | bool Package::toProcess() |
245 | { | 245 | { |
246 | return _toProcess; | 246 | return _toProcess; |
247 | } | 247 | } |
248 | 248 | ||
249 | bool Package::toRemove() | 249 | bool Package::toRemove() |
250 | { | 250 | { |
251 | if ( _toProcess && installed() ) return true; | 251 | if ( _toProcess && installed() ) return true; |
252 | else return false; | 252 | else return false; |
253 | } | 253 | } |
254 | 254 | ||
255 | bool Package::toInstall() | 255 | bool Package::toInstall() |
256 | { | 256 | { |
257 | if ( _toProcess && !installed() ) return true; | 257 | if ( _toProcess && !installed() ) return true; |
258 | else return false; | 258 | else return false; |
259 | } | 259 | } |
260 | 260 | ||
261 | void Package::toggleProcess() | 261 | void Package::toggleProcess() |
262 | { | 262 | { |
263 | _toProcess = ! _toProcess; | 263 | _toProcess = ! _toProcess; |
264 | } | 264 | } |
265 | 265 | ||
266 | 266 | ||
267 | 267 | ||
268 | void Package::copyValues( Package* pack ) | 268 | void Package::copyValues( Package* pack ) |
269 | { | 269 | { |
270 | if (_size.isEmpty() && !pack->_size.isEmpty()) _size = QString( pack->_size ); | 270 | if (_size.isEmpty() && !pack->_size.isEmpty()) _size = QString( pack->_size ); |
271 | if (_section.isEmpty() && !pack->_section.isEmpty()) _section = QString( pack->_section ); | 271 | if (_section.isEmpty() && !pack->_section.isEmpty()) _section = QString( pack->_section ); |
272 | if (_subsection.isEmpty()&& !pack->_subsection.isEmpty()) _subsection = QString( pack->_subsection ); | 272 | if (_subsection.isEmpty()&& !pack->_subsection.isEmpty()) _subsection = QString( pack->_subsection ); |
273 | if (_shortDesc.isEmpty() && !pack->_shortDesc.isEmpty()) _shortDesc = QString( pack->_shortDesc ); | 273 | if (_shortDesc.isEmpty() && !pack->_shortDesc.isEmpty()) _shortDesc = QString( pack->_shortDesc ); |
274 | if (_desc.isEmpty() && !pack->_desc.isEmpty()) _desc = QString( pack->_desc ); | 274 | if (_desc.isEmpty() && !pack->_desc.isEmpty()) _desc = QString( pack->_desc ); |
275 | if (_name.isEmpty() && !pack->_name.isEmpty()) _name = QString( pack->_name ); | 275 | if (_name.isEmpty() && !pack->_name.isEmpty()) _name = QString( pack->_name ); |
276 | if (_dest.isEmpty() && !pack->_dest.isEmpty()) _dest= QString( pack->_dest ); | 276 | if (_dest.isEmpty() && !pack->_dest.isEmpty()) _dest= QString( pack->_dest ); |
277 | if (_displayName.isEmpty()&& !pack->_displayName.isEmpty()) _displayName = QString( pack->_displayName ); | 277 | if (_displayName.isEmpty()&& !pack->_displayName.isEmpty()) _displayName = QString( pack->_displayName ); |
278 | if (_fileName.isEmpty() && !pack->_fileName.isEmpty()) _fileName = QString( pack->_fileName ); | 278 | if (_fileName.isEmpty() && !pack->_fileName.isEmpty()) _fileName = QString( pack->_fileName ); |
279 | if (_version.isEmpty() && !pack->_version.isEmpty()) _version = QString( pack->_version ); | 279 | if (_version.isEmpty() && !pack->_version.isEmpty()) _version = QString( pack->_version ); |
280 | if (_values.isEmpty() && !pack->_values.isEmpty())_values = QDict<QString>( pack->_values ); | 280 | if (_values.isEmpty() && !pack->_values.isEmpty())_values = QDict<QString>( pack->_values ); |
281 | if (!installed() && _status.isEmpty() && !pack->_status.isEmpty()) _status = QString( pack->_status ); | 281 | if (!installed() && _status.isEmpty() && !pack->_status.isEmpty()) _status = QString( pack->_status ); |
282 | } | 282 | } |
283 | 283 | ||
284 | QString Package::section() | 284 | QString Package::section() |
285 | { | 285 | { |
286 | return _section; | 286 | return _section; |
287 | } | 287 | } |
288 | 288 | ||
289 | void Package::setSection( QString s) | 289 | void Package::setSection( QString s) |
290 | { | 290 | { |
291 | int i = s.find("/"); | 291 | int i = s.find("/"); |
292 | if ( i > 0 ) | 292 | if ( i > 0 ) |
293 | { | 293 | { |
294 | _section = s.left(i); | 294 | _section = s.left(i); |
295 | _subsection = s.mid(i+1); | 295 | _subsection = s.mid(i+1); |
296 | }else{ | 296 | }else{ |
297 | _section = s; | 297 | _section = s; |
298 | _subsection = ""; | 298 | _subsection = ""; |
299 | } | 299 | } |
300 | } | 300 | } |
301 | 301 | ||
302 | QString Package::subSection() | 302 | QString Package::subSection() |
303 | { | 303 | { |
304 | return _subsection; | 304 | return _subsection; |
305 | } | 305 | } |
306 | 306 | ||
307 | void Package::parsePackage( QStringList pack ) | 307 | void Package::parsePackage( QStringList pack ) |
308 | { | 308 | { |
309 | if ( pack.isEmpty() ) return; | 309 | if ( pack.isEmpty() ) return; |
310 | int count = pack.count(); | 310 | int count = pack.count(); |
311 | for( int i = 0; i < count; i++ ) | 311 | for( int i = 0; i < count; i++ ) |
312 | { | 312 | { |
313 | QString line = pack[i]; | 313 | QString line = pack[i]; |
314 | int sep = line.find( QRegExp(":[\t ]+") ); | 314 | int sep = line.find( QRegExp(":[\t ]+") ); |
315 | if ( sep >= 0 ) | 315 | if ( sep >= 0 ) |
316 | { | 316 | { |
317 | QString tag = line.left(sep); | 317 | QString tag = line.left(sep); |
318 | QString value = line.mid(sep+2).simplifyWhiteSpace(); | 318 | QString value = line.mid(sep+2).simplifyWhiteSpace(); |
319 | setValue( tag, value ); | 319 | setValue( tag, value ); |
320 | }else{ | 320 | }else{ |
321 | } | 321 | } |
322 | } | 322 | } |
323 | return; | 323 | return; |
324 | } | 324 | } |
325 | 325 | ||
326 | QString Package::details() | 326 | QString Package::details() |
327 | { | 327 | { |
328 | QString status; | 328 | QString status; |
329 | Process ipkg_status(QStringList() << "ipkg" << "info" << name() ); | 329 | Process ipkg_status(QStringList() << "ipkg" << "info" << name() ); |
330 | QString description; | 330 | QString description; |
331 | if ( ipkg_status.exec("",status) ) | 331 | if ( ipkg_status.exec("",status) ) |
332 | { | 332 | { |
333 | QStringList lines = QStringList::split('\n',status,TRUE); | 333 | QStringList lines = QStringList::split('\n',status,TRUE); |
334 | for (QStringList::Iterator it = lines.begin(); it!=lines.end(); ++it) { | 334 | for (QStringList::Iterator it = lines.begin(); it!=lines.end(); ++it) { |
335 | QString line = *it; | 335 | QString line = *it; |
336 | if ( line == " ." ) | 336 | if ( line == " ." ) |
337 | { | 337 | { |
338 | description.append("<p>"); | 338 | description.append("<p>"); |
339 | } else | 339 | } else |
340 | if ( line[0] == ' ' || line[0] == '\t' ) | 340 | if ( line[0] == ' ' || line[0] == '\t' ) |
341 | { | 341 | { |
342 | // continuation | 342 | // continuation |
343 | description.append(" "); | 343 | description.append(" "); |
344 | description.append(Qtopia::escapeString(line)); | 344 | description.append(Qtopia::escapeString(line)); |
345 | } else { | 345 | } else { |
346 | int sep = line.find(QRegExp(":[\t ]+")); | 346 | int sep = line.find(QRegExp(":[\t ]+")); |
347 | if ( sep >= 0 ) | 347 | if ( sep >= 0 ) |
348 | { | 348 | { |
349 | QString tag = line.left(sep); | 349 | QString tag = line.left(sep); |
350 | description.append("<br>"); | 350 | description.append("<br>"); |
351 | description.append("<b>"); | 351 | description.append("<b>"); |
352 | description.append(Qtopia::escapeString(tag)); | 352 | description.append(Qtopia::escapeString(tag)); |
353 | description.append(":</b> "); | 353 | description.append(":</b> "); |
354 | description.append(Qtopia::escapeString(line.mid(sep+2))); | 354 | description.append(Qtopia::escapeString(line.mid(sep+2))); |
355 | } else { | 355 | } else { |
356 | description.append(" "); | 356 | description.append(" "); |
357 | description.append(Qtopia::escapeString(line)); | 357 | description.append(Qtopia::escapeString(line)); |
358 | } | 358 | } |
359 | } | 359 | } |
360 | } | 360 | } |
361 | } | 361 | } |
362 | return description; | 362 | return description; |
363 | } | 363 | } |
364 | 364 | ||
365 | void Package::processed() | 365 | void Package::processed() |
366 | { | 366 | { |
367 | _toProcess = false; | 367 | _toProcess = false; |
368 | //hack, but we're not writing status anyway... | 368 | //hack, but we're not writing status anyway... |
369 | if ( installed() ) _status = "install"; | 369 | if ( installed() ) _status = "install"; |
370 | else _status = "installed"; | 370 | else _status = "installed"; |
371 | } | 371 | } |
372 | 372 | ||
373 | QString Package::dest() | 373 | QString Package::dest() |
374 | { | 374 | { |
375 | if ( installed()||(!installed() && _toProcess) ) | 375 | if ( installed()||(!installed() && _toProcess) ) |
376 | return _dest!=""?_dest:settings->getDestinationName(); | 376 | return _dest!=""?_dest:settings->getDestinationName(); |
377 | else return ""; | 377 | else return ""; |
378 | } | 378 | } |
379 | 379 | ||
380 | void Package::setDest( QString d ) | 380 | void Package::setDest( QString d ) |
381 | { | 381 | { |
382 | if ( d == "remote") _useFileName = true; | 382 | if ( d == "remote") _useFileName = true; |
383 | else _dest = d; | 383 | else _dest = d; |
384 | } | 384 | } |
385 | 385 | ||
386 | void Package::setOn() | 386 | void Package::setOn() |
387 | { | 387 | { |
388 | _toProcess = true; | 388 | _toProcess = true; |
389 | } | 389 | } |
390 | 390 | ||
391 | bool Package::link() | 391 | bool Package::link() |
392 | { | 392 | { |
393 | if ( _dest == "root" || (!installed() && !_toProcess) ) return false; | 393 | if ( _dest == "root" || (!installed() && !_toProcess) ) return false; |
394 | return _link; | 394 | return _link; |
395 | } | 395 | } |
396 | 396 | ||
397 | void Package::setLink(bool b) | 397 | void Package::setLink(bool b) |
398 | { | 398 | { |
399 | _link = b; | 399 | _link = b; |
400 | } | 400 | } |
401 | 401 | ||
402 | void Package::parseIpkgFile( QString file) | 402 | void Package::parseIpkgFile( QString file) |
403 | { | 403 | { |
404 | // 20020830 | 404 | // 20020830 |
405 | // a quick hack to make oipkg understand the new ipk format | 405 | // a quick hack to make oipkg understand the new ipk format |
406 | // neu: ar pf PACKAGE control.tar.gz | tar xfOz - ./control > /tmp/control | 406 | // neu: ar pf PACKAGE control.tar.gz | tar xfOz - ./control > /tmp/control |
407 | if (! system("ar pf "+file+" control.tar.gz | tar xfOz - ./control > /tmp/control") ) | 407 | if (system("ar pf "+file+" control.tar.gz | tar xfOz - ./control > /tmp/control") != 0) |
408 | { | 408 | { |
409 | //#old tar ipk format | 409 | //#old tar ipk format |
410 | system("tar xzf "+file+" -C /tmp"); | 410 | system("tar xzf "+file+" -C /tmp"); |
411 | system("tar xzf /tmp/control.tar.gz -C /tmp"); | 411 | system("tar xzf /tmp/control.tar.gz -C /tmp"); |
412 | } | 412 | } |
413 | QFile f("/tmp/control"); | 413 | QFile f("/tmp/control"); |
414 | if ( f.open(IO_ReadOnly) ) | 414 | if ( f.open(IO_ReadOnly) ) |
415 | { | 415 | { |
416 | QTextStream t( &f ); | 416 | QTextStream t( &f ); |
417 | QStringList pack; | 417 | QStringList pack; |
418 | while ( !t.eof() ) | 418 | while ( !t.eof() ) |
419 | { | 419 | { |
420 | pack << t.readLine(); | 420 | pack << t.readLine(); |
421 | } | 421 | } |
422 | f.close(); | 422 | f.close(); |
423 | parsePackage( pack ); | 423 | parsePackage( pack ); |
424 | } | 424 | } |
425 | 425 | ||
426 | } | 426 | } |
427 | 427 | ||
428 | //QString Package::getPackageName() | 428 | //QString Package::getPackageName() |
429 | //{ | 429 | //{ |
430 | //if ( _packageName.isEmpty() ) return _name; | 430 | //if ( _packageName.isEmpty() ) return _name; |
431 | //else return _packageName; | 431 | //else return _packageName; |
432 | //} | 432 | //} |
433 | 433 | ||
434 | void Package::instalFromFile(bool iff) | 434 | void Package::instalFromFile(bool iff) |
435 | { | 435 | { |
436 | _useFileName = iff; | 436 | _useFileName = iff; |
437 | } | 437 | } |
438 | 438 | ||
439 | void Package::setName(QString n) | 439 | void Package::setName(QString n) |
440 | { | 440 | { |
441 | _displayName = n; | 441 | _displayName = n; |
442 | } | 442 | } |
443 | 443 | ||
444 | QDict<QString>* Package::getFields() | 444 | QDict<QString>* Package::getFields() |
445 | { | 445 | { |
446 | return &_values; | 446 | return &_values; |
447 | } | 447 | } |
448 | 448 | ||
449 | QString Package::status() | 449 | QString Package::status() |
450 | { | 450 | { |
451 | return _status; | 451 | return _status; |
452 | } | 452 | } |
453 | 453 | ||
454 | bool Package::isOld() | 454 | bool Package::isOld() |
455 | { | 455 | { |
456 | if (!_versions) return false; | 456 | if (!_versions) return false; |
457 | QDictIterator<Package> other( *_versions ); | 457 | QDictIterator<Package> other( *_versions ); |
458 | while ( other.current() ) { | 458 | while ( other.current() ) { |
459 | if (other.current()->version() > version() ) return true; | 459 | if (other.current()->version() > version() ) return true; |
460 | ++other; | 460 | ++other; |
461 | } | 461 | } |
462 | return false; | 462 | return false; |
463 | } | 463 | } |
464 | 464 | ||
465 | bool Package::hasVersions() | 465 | bool Package::hasVersions() |
466 | { | 466 | { |
467 | if (!_versions) return false; | 467 | if (!_versions) return false; |
468 | else return true; | 468 | else return true; |
469 | } | 469 | } |
470 | 470 | ||
471 | QDict<Package>* Package::getOtherVersions() | 471 | QDict<Package>* Package::getOtherVersions() |
472 | { | 472 | { |
473 | return _versions; | 473 | return _versions; |
474 | } | 474 | } |
475 | 475 | ||
476 | void Package::setOtherVersions(QDict<Package> *v) | 476 | void Package::setOtherVersions(QDict<Package> *v) |
477 | { | 477 | { |
478 | _versions=v; | 478 | _versions=v; |
479 | } | 479 | } |
diff --git a/noncore/unsupported/oipkg/pksettings.cpp b/noncore/unsupported/oipkg/pksettings.cpp index acabaed..063b018 100644 --- a/noncore/unsupported/oipkg/pksettings.cpp +++ b/noncore/unsupported/oipkg/pksettings.cpp | |||
@@ -38,390 +38,389 @@ PackageManagerSettings::PackageManagerSettings( QWidget* parent, const char* na | |||
38 | { | 38 | { |
39 | connect( newserver, SIGNAL(clicked()), this, SLOT(newServer()) ); | 39 | connect( newserver, SIGNAL(clicked()), this, SLOT(newServer()) ); |
40 | connect( removeserver, SIGNAL(clicked()), this, SLOT(removeServer()) ); | 40 | connect( removeserver, SIGNAL(clicked()), this, SLOT(removeServer()) ); |
41 | connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); | 41 | connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); |
42 | connect( newdestination, SIGNAL(clicked()), this, SLOT(newDestination()) ); | 42 | connect( newdestination, SIGNAL(clicked()), this, SLOT(newDestination()) ); |
43 | connect( removedestination, SIGNAL(clicked()), this, SLOT(removeDestination()) ); | 43 | connect( removedestination, SIGNAL(clicked()), this, SLOT(removeDestination()) ); |
44 | connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); | 44 | connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); |
45 | // connect( CheckBoxLink, SIGNAL(toggled(bool)), | 45 | // connect( CheckBoxLink, SIGNAL(toggled(bool)), |
46 | // activeLinkDestination, SLOT(setEnabled(bool)) ); | 46 | // activeLinkDestination, SLOT(setEnabled(bool)) ); |
47 | 47 | ||
48 | // connect( settingName, SIGNAL(activated(int)), this, SLOT(installationSettingChange(int)) ); | 48 | // connect( settingName, SIGNAL(activated(int)), this, SLOT(installationSettingChange(int)) ); |
49 | // connect( settingName, SIGNAL(textChanged(const QString &)), this, SLOT(installationSettingSetName(const QString &)) ); | 49 | // connect( settingName, SIGNAL(textChanged(const QString &)), this, SLOT(installationSettingSetName(const QString &)) ); |
50 | // connect( newsetting, SIGNAL(clicked()), this, SLOT(newInstallationSetting()) ); | 50 | // connect( newsetting, SIGNAL(clicked()), this, SLOT(newInstallationSetting()) ); |
51 | // connect( renamesetting, SIGNAL(clicked()), this, SLOT(renameInstallationSetting()) ); | 51 | // connect( renamesetting, SIGNAL(clicked()), this, SLOT(renameInstallationSetting()) ); |
52 | // connect( removesetting, SIGNAL(clicked()), this, SLOT(removeInstallationSetting()) ); | 52 | // connect( removesetting, SIGNAL(clicked()), this, SLOT(removeInstallationSetting()) ); |
53 | servername->setEnabled(FALSE); | 53 | servername->setEnabled(FALSE); |
54 | serverurl->setEnabled(FALSE); | 54 | serverurl->setEnabled(FALSE); |
55 | serverurlDic.setAutoDelete(TRUE); | 55 | serverurlDic.setAutoDelete(TRUE); |
56 | destinationname->setEnabled(FALSE); | 56 | destinationname->setEnabled(FALSE); |
57 | destinationurl->setEnabled(FALSE); | 57 | destinationurl->setEnabled(FALSE); |
58 | destinationurlDic.setAutoDelete(TRUE); | 58 | destinationurlDic.setAutoDelete(TRUE); |
59 | readSettings(); | 59 | readSettings(); |
60 | activeLinkDestination->hide(); | 60 | activeLinkDestination->hide(); |
61 | serverChanged = false; | 61 | serverChanged = false; |
62 | 62 | ||
63 | // get rid of setups | 63 | // get rid of setups |
64 | // Settings->hide(); | 64 | // Settings->hide(); |
65 | // settingName->hide(); | 65 | // settingName->hide(); |
66 | // newsetting->hide(); | 66 | // newsetting->hide(); |
67 | // renamesetting->hide(); | 67 | // renamesetting->hide(); |
68 | // removesetting->hide(); | 68 | // removesetting->hide(); |
69 | } | 69 | } |
70 | 70 | ||
71 | PackageManagerSettings::~PackageManagerSettings() | 71 | PackageManagerSettings::~PackageManagerSettings() |
72 | { | 72 | { |
73 | } | 73 | } |
74 | 74 | ||
75 | 75 | ||
76 | void PackageManagerSettings::newServer() | 76 | void PackageManagerSettings::newServer() |
77 | { | 77 | { |
78 | int i = servers->count(); | 78 | int i = servers->count(); |
79 | if ( servername->isEnabled() || serverurl->text().isEmpty() ) { | 79 | if ( servername->isEnabled() || serverurl->text().isEmpty() ) { |
80 | serverurlDic.insert(i,new QString("http://")); | 80 | serverurlDic.insert(i,new QString("http://")); |
81 | servers->insertItem(tr("New")); | 81 | servers->insertItem(tr("New")); |
82 | activeServers->insertItem(tr("New")); | 82 | activeServers->insertItem(tr("New")); |
83 | } else { | 83 | } else { |
84 | // allows one-level undo | 84 | // allows one-level undo |
85 | serverurlDic.insert(i,new QString(serverurl->text())); | 85 | serverurlDic.insert(i,new QString(serverurl->text())); |
86 | servers->insertItem(servername->text()); | 86 | servers->insertItem(servername->text()); |
87 | activeServers->insertItem(servername->text()); | 87 | activeServers->insertItem(servername->text()); |
88 | } | 88 | } |
89 | changed = true; | 89 | changed = true; |
90 | servers->setSelected(i,TRUE); | 90 | servers->setSelected(i,TRUE); |
91 | editServer(i); | 91 | editServer(i); |
92 | changed = true; | 92 | changed = true; |
93 | } | 93 | } |
94 | 94 | ||
95 | void PackageManagerSettings::newDestination() | 95 | void PackageManagerSettings::newDestination() |
96 | { | 96 | { |
97 | int i = destinations->count(); | 97 | int i = destinations->count(); |
98 | if ( destinationname->isEnabled() || destinationurl->text().isEmpty() ) { | 98 | if ( destinationname->isEnabled() || destinationurl->text().isEmpty() ) { |
99 | destinationurlDic.insert(i,new QString("/")); | 99 | destinationurlDic.insert(i,new QString("/")); |
100 | destinations->insertItem(tr("New")); | 100 | destinations->insertItem(tr("New")); |
101 | activeDestination->insertItem(tr("New")); | 101 | activeDestination->insertItem(tr("New")); |
102 | activeLinkDestination->insertItem(tr("New")); | 102 | activeLinkDestination->insertItem(tr("New")); |
103 | } else { | 103 | } else { |
104 | // allows one-level undo | 104 | // allows one-level undo |
105 | destinationurlDic.insert(i,new QString(destinationurl->text())); | 105 | destinationurlDic.insert(i,new QString(destinationurl->text())); |
106 | destinations->insertItem(destinationname->text()); | 106 | destinations->insertItem(destinationname->text()); |
107 | activeDestination->insertItem(destinationname->text()); | 107 | activeDestination->insertItem(destinationname->text()); |
108 | activeLinkDestination->insertItem(destinationname->text()); | 108 | activeLinkDestination->insertItem(destinationname->text()); |
109 | } | 109 | } |
110 | destinations->setSelected(i,TRUE); | 110 | destinations->setSelected(i,TRUE); |
111 | editDestination(i); | 111 | editDestination(i); |
112 | changed = true; | 112 | changed = true; |
113 | } | 113 | } |
114 | 114 | ||
115 | 115 | ||
116 | void PackageManagerSettings::editServer(int i) | 116 | void PackageManagerSettings::editServer(int i) |
117 | { | 117 | { |
118 | if ( servername->isEnabled() ) { | 118 | if ( servername->isEnabled() ) { |
119 | disconnect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); | 119 | disconnect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); |
120 | disconnect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); | 120 | disconnect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); |
121 | } else { | 121 | } else { |
122 | servername->setEnabled(TRUE); | 122 | servername->setEnabled(TRUE); |
123 | serverurl->setEnabled(TRUE); | 123 | serverurl->setEnabled(TRUE); |
124 | } | 124 | } |
125 | 125 | ||
126 | servername->setText( servers->text(i) ); | 126 | servername->setText( servers->text(i) ); |
127 | serverurl->setText( *serverurlDic[i] ); | 127 | serverurl->setText( *serverurlDic[i] ); |
128 | 128 | ||
129 | editedserver = i; | 129 | editedserver = i; |
130 | serverChanged = true; | 130 | serverChanged = true; |
131 | connect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); | 131 | connect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); |
132 | connect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); | 132 | connect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); |
133 | changed = true; | 133 | changed = true; |
134 | } | 134 | } |
135 | 135 | ||
136 | 136 | ||
137 | void PackageManagerSettings::editDestination(int i) | 137 | void PackageManagerSettings::editDestination(int i) |
138 | { | 138 | { |
139 | if ( destinationname->isEnabled() ) { | 139 | if ( destinationname->isEnabled() ) { |
140 | disconnect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); | 140 | disconnect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); |
141 | disconnect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); | 141 | disconnect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); |
142 | } else { | 142 | } else { |
143 | destinationname->setEnabled(TRUE); | 143 | destinationname->setEnabled(TRUE); |
144 | destinationurl->setEnabled(TRUE); | 144 | destinationurl->setEnabled(TRUE); |
145 | //since it does not work anyway | 145 | //since it does not work anyway |
146 | // createLinksButton->setEnabled(TRUE); | 146 | // createLinksButton->setEnabled(TRUE); |
147 | // removeLinksButton->setEnabled(TRUE); | 147 | // removeLinksButton->setEnabled(TRUE); |
148 | } | 148 | } |
149 | 149 | ||
150 | destinationname->setText( destinations->text(i) ); | 150 | destinationname->setText( destinations->text(i) ); |
151 | destinationurl->setText( *destinationurlDic[i] ); | 151 | destinationurl->setText( *destinationurlDic[i] ); |
152 | 152 | ||
153 | editeddestination = i; | 153 | editeddestination = i; |
154 | 154 | ||
155 | connect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); | 155 | connect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); |
156 | connect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); | 156 | connect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); |
157 | changed = true; | 157 | changed = true; |
158 | } | 158 | } |
159 | 159 | ||
160 | void PackageManagerSettings::removeServer() | 160 | void PackageManagerSettings::removeServer() |
161 | { | 161 | { |
162 | disconnect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); | 162 | disconnect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); |
163 | disconnect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); | 163 | disconnect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); |
164 | servername->setText(servers->text(editedserver)); | 164 | servername->setText(servers->text(editedserver)); |
165 | serverurl->setText(*serverurlDic[editedserver]); | 165 | serverurl->setText(*serverurlDic[editedserver]); |
166 | disconnect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); | 166 | disconnect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); |
167 | servers->removeItem(editedserver); | 167 | servers->removeItem(editedserver); |
168 | activeServers->removeItem(editedserver); | 168 | activeServers->removeItem(editedserver); |
169 | connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); | 169 | connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); |
170 | servername->setEnabled(FALSE); | 170 | servername->setEnabled(FALSE); |
171 | serverurl->setEnabled(FALSE); | 171 | serverurl->setEnabled(FALSE); |
172 | changed = true; | 172 | changed = true; |
173 | } | 173 | } |
174 | 174 | ||
175 | void PackageManagerSettings::removeDestination() | 175 | void PackageManagerSettings::removeDestination() |
176 | { | 176 | { |
177 | disconnect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); | 177 | disconnect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); |
178 | disconnect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); | 178 | disconnect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); |
179 | destinationname->setText(""); | 179 | destinationname->setText(""); |
180 | destinationurl->setText(""); | 180 | destinationurl->setText(""); |
181 | disconnect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); | 181 | disconnect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); |
182 | destinations->removeItem(editeddestination); | 182 | destinations->removeItem(editeddestination); |
183 | activeDestination->removeItem(editeddestination); | 183 | activeDestination->removeItem(editeddestination); |
184 | activeLinkDestination->removeItem(editeddestination); | 184 | activeLinkDestination->removeItem(editeddestination); |
185 | editeddestination=0; | 185 | editeddestination=0; |
186 | connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); | 186 | connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); |
187 | destinationname->setEnabled(FALSE); | 187 | destinationname->setEnabled(FALSE); |
188 | destinationurl->setEnabled(FALSE); | 188 | destinationurl->setEnabled(FALSE); |
189 | changed = true; | 189 | changed = true; |
190 | } | 190 | } |
191 | 191 | ||
192 | void PackageManagerSettings::serverNameChanged(const QString& t) | 192 | void PackageManagerSettings::serverNameChanged(const QString& t) |
193 | { | 193 | { |
194 | disconnect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); | 194 | disconnect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); |
195 | servers->changeItem( t, editedserver ); | 195 | servers->changeItem( t, editedserver ); |
196 | activeServers->changeItem( t, editedserver ); | 196 | activeServers->changeItem( t, editedserver ); |
197 | connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); | 197 | connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); |
198 | changed = true; | 198 | changed = true; |
199 | serverChanged = true; | 199 | serverChanged = true; |
200 | } | 200 | } |
201 | 201 | ||
202 | void PackageManagerSettings::destNameChanged(const QString& t) | 202 | void PackageManagerSettings::destNameChanged(const QString& t) |
203 | { | 203 | { |
204 | disconnect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); | 204 | disconnect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); |
205 | destinations->changeItem( t, editeddestination ); | 205 | destinations->changeItem( t, editeddestination ); |
206 | activeDestination->changeItem( t, editeddestination ); | 206 | activeDestination->changeItem( t, editeddestination ); |
207 | activeLinkDestination->changeItem( t, editeddestination ); | 207 | activeLinkDestination->changeItem( t, editeddestination ); |
208 | connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); | 208 | connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); |
209 | changed = true; | 209 | changed = true; |
210 | } | 210 | } |
211 | 211 | ||
212 | void PackageManagerSettings::serverUrlChanged(const QString& t) | 212 | void PackageManagerSettings::serverUrlChanged(const QString& t) |
213 | { | 213 | { |
214 | serverurlDic.replace(editedserver, new QString(t)); | 214 | serverurlDic.replace(editedserver, new QString(t)); |
215 | changed = true; | 215 | changed = true; |
216 | serverChanged = true; | 216 | serverChanged = true; |
217 | } | 217 | } |
218 | 218 | ||
219 | void PackageManagerSettings::destUrlChanged(const QString& t) | 219 | void PackageManagerSettings::destUrlChanged(const QString& t) |
220 | { | 220 | { |
221 | destinationurlDic.replace(editeddestination, new QString(t)); | 221 | destinationurlDic.replace(editeddestination, new QString(t)); |
222 | changed = true; | 222 | changed = true; |
223 | } | 223 | } |
224 | 224 | ||
225 | void PackageManagerSettings::writeIpkgConfig(const QString& conffile) | 225 | void PackageManagerSettings::writeIpkgConfig(const QString& conffile) |
226 | { | 226 | { |
227 | QFile conf(conffile); | 227 | QFile conf(conffile); |
228 | if ( ! conf.open(IO_WriteOnly) ) return; | 228 | if ( ! conf.open(IO_WriteOnly) ) return; |
229 | QTextStream s(&conf); | 229 | QTextStream s(&conf); |
230 | s << "# Written by qpie Package Manager\n"; | 230 | s << "# Written by oipkg -- the opie package manager\n"; |
231 | for (int i=0; i<(int)activeServers->count(); i++) | 231 | for (int i=0; i<(int)activeServers->count(); i++) |
232 | { | 232 | { |
233 | QString url = serverurlDic[i] ? *serverurlDic[i] : QString("???"); | 233 | QString url = serverurlDic[i] ? *serverurlDic[i] : QString("???"); |
234 | if ( !activeServers->isSelected(i) ) | 234 | if ( !activeServers->isSelected(i) ) s << "#"; |
235 | s << "#"; | ||
236 | s << "src " << activeServers->text(i) << " " << url << "\n"; | 235 | s << "src " << activeServers->text(i) << " " << url << "\n"; |
237 | } | 236 | } |
238 | for (int i=0; i<(int)destinations->count(); i++) | 237 | for (int i=0; i<(int)destinations->count(); i++) |
239 | { | 238 | { |
240 | QString url = destinationurlDic[i] ? *destinationurlDic[i] : QString("???"); | 239 | QString url = destinationurlDic[i] ? *destinationurlDic[i] : QString("???"); |
241 | s << "dest " << destinations->text(i) << " " << url << "\n"; | 240 | s << "dest " << destinations->text(i) << " " << url << "\n"; |
242 | } | 241 | } |
243 | conf.close(); | 242 | conf.close(); |
244 | } | 243 | } |
245 | 244 | ||
246 | 245 | ||
247 | void PackageManagerSettings::readInstallationSettings() | 246 | void PackageManagerSettings::readInstallationSettings() |
248 | { | 247 | { |
249 | Config cfg( "oipkg", Config::User ); | 248 | Config cfg( "oipkg", Config::User ); |
250 | cfg.setGroup( "Settings" ); | 249 | cfg.setGroup( "Settings" ); |
251 | 250 | ||
252 | installationSettingsCount = cfg.readNumEntry( "count", -1 ); | 251 | installationSettingsCount = cfg.readNumEntry( "count", -1 ); |
253 | currentSetting = cfg.readNumEntry( "current", 0 );// o should be -1 | 252 | currentSetting = cfg.readNumEntry( "current", 0 );// o should be -1 |
254 | 253 | ||
255 | // for (int i = 0; i < installationSettingsCount; i++) | 254 | // for (int i = 0; i < installationSettingsCount; i++) |
256 | // { | 255 | // { |
257 | // cfg.setGroup( "Setting_" + QString::number(i) ); | 256 | // cfg.setGroup( "Setting_" + QString::number(i) ); |
258 | // settingName->insertItem( cfg.readEntry( "name", "???" ), i ); | 257 | // settingName->insertItem( cfg.readEntry( "name", "???" ), i ); |
259 | // }; | 258 | // }; |
260 | readInstallationSetting( currentSetting ); | 259 | readInstallationSetting( currentSetting ); |
261 | } | 260 | } |
262 | 261 | ||
263 | 262 | ||
264 | 263 | ||
265 | ///** | 264 | ///** |
266 | // * remove from conf file | 265 | // * remove from conf file |
267 | // */ | 266 | // */ |
268 | //void PackageManagerSettings::removeInstallationSetting() | 267 | //void PackageManagerSettings::removeInstallationSetting() |
269 | //{ | 268 | //{ |
270 | // settingName->removeItem( settingName->currentItem() ); | 269 | // settingName->removeItem( settingName->currentItem() ); |
271 | // Config cfg( "oipkg", Config::User ); | 270 | // Config cfg( "oipkg", Config::User ); |
272 | // cfg.setGroup( "Setting_" + QString::number( installationSettingsCount ) ); | 271 | // cfg.setGroup( "Setting_" + QString::number( installationSettingsCount ) ); |
273 | // cfg.clearGroup(); | 272 | // cfg.clearGroup(); |
274 | // installationSettingsCount--; | 273 | // installationSettingsCount--; |
275 | // changed = true; | 274 | // changed = true; |
276 | // settingName->setEditable( false ); | 275 | // settingName->setEditable( false ); |
277 | //} | 276 | //} |
278 | 277 | ||
279 | ///** | 278 | ///** |
280 | // * write to confgile | 279 | // * write to confgile |
281 | // */ | 280 | // */ |
282 | //void PackageManagerSettings::newInstallationSetting() | 281 | //void PackageManagerSettings::newInstallationSetting() |
283 | //{ | 282 | //{ |
284 | // installationSettingsCount++; | 283 | // installationSettingsCount++; |
285 | // settingName->insertItem( "New", installationSettingsCount ); | 284 | // settingName->insertItem( "New", installationSettingsCount ); |
286 | // settingName->setCurrentItem( installationSettingsCount ); | 285 | // settingName->setCurrentItem( installationSettingsCount ); |
287 | // settingName->setEditable( true ); | 286 | // settingName->setEditable( true ); |
288 | // changed = true; | 287 | // changed = true; |
289 | //} | 288 | //} |
290 | 289 | ||
291 | //void PackageManagerSettings::installationSettingChange(int cs) | 290 | //void PackageManagerSettings::installationSettingChange(int cs) |
292 | //{ | 291 | //{ |
293 | // writeCurrentInstallationSetting(); | 292 | // writeCurrentInstallationSetting(); |
294 | // currentSetting = cs; | 293 | // currentSetting = cs; |
295 | // readInstallationSetting( cs ); | 294 | // readInstallationSetting( cs ); |
296 | // changed = true; | 295 | // changed = true; |
297 | //} | 296 | //} |
298 | 297 | ||
299 | void PackageManagerSettings::writeInstallationSettings() | 298 | void PackageManagerSettings::writeInstallationSettings() |
300 | { | 299 | { |
301 | { | 300 | { |
302 | Config cfg( "oipkg", Config::User ); | 301 | Config cfg( "oipkg", Config::User ); |
303 | cfg.setGroup( "Settings" ); | 302 | cfg.setGroup( "Settings" ); |
304 | cfg.writeEntry( "count", installationSettingsCount ); | 303 | cfg.writeEntry( "count", installationSettingsCount ); |
305 | cfg.writeEntry( "current", currentSetting ); | 304 | cfg.writeEntry( "current", currentSetting ); |
306 | } | 305 | } |
307 | writeCurrentInstallationSetting(); | 306 | writeCurrentInstallationSetting(); |
308 | } | 307 | } |
309 | 308 | ||
310 | 309 | ||
311 | void PackageManagerSettings::readInstallationSetting(int setting) | 310 | void PackageManagerSettings::readInstallationSetting(int setting) |
312 | { | 311 | { |
313 | if ( setting < 0 ) return; | 312 | if ( setting < 0 ) return; |
314 | Config cfg( "oipkg", Config::User ); | 313 | Config cfg( "oipkg", Config::User ); |
315 | cfg.setGroup( "Setting_" + QString::number( setting ) ); | 314 | cfg.setGroup( "Setting_" + QString::number( setting ) ); |
316 | CheckBoxLink->setChecked( cfg.readBoolEntry( "link", true ) ); | 315 | CheckBoxLink->setChecked( cfg.readBoolEntry( "link", true ) ); |
317 | QString dest = cfg.readEntry( "dest" ); | 316 | QString dest = cfg.readEntry( "dest" ); |
318 | QString linkdest = cfg.readEntry( "linkdest" ); | 317 | QString linkdest = cfg.readEntry( "linkdest" ); |
319 | pvDebug(3, "dest="+dest); | 318 | pvDebug(3, "dest="+dest); |
320 | pvDebug(3, "linkdest="+linkdest); | 319 | pvDebug(3, "linkdest="+linkdest); |
321 | for ( int i = 0; i < activeDestination->count(); i++) | 320 | for ( int i = 0; i < activeDestination->count(); i++) |
322 | { | 321 | { |
323 | if ( activeDestination->text( i ) == dest ) | 322 | if ( activeDestination->text( i ) == dest ) |
324 | activeDestination->setCurrentItem( i ); | 323 | activeDestination->setCurrentItem( i ); |
325 | if ( activeLinkDestination->text( i ) == linkdest ) | 324 | if ( activeLinkDestination->text( i ) == linkdest ) |
326 | activeLinkDestination->setCurrentItem( i ); | 325 | activeLinkDestination->setCurrentItem( i ); |
327 | } | 326 | } |
328 | } | 327 | } |
329 | 328 | ||
330 | void PackageManagerSettings::writeCurrentInstallationSetting() | 329 | void PackageManagerSettings::writeCurrentInstallationSetting() |
331 | { | 330 | { |
332 | Config cfg( "oipkg", Config::User ); | 331 | Config cfg( "oipkg", Config::User ); |
333 | cfg.setGroup( "Setting_" + QString::number(currentSetting) ); | 332 | cfg.setGroup( "Setting_" + QString::number(currentSetting) ); |
334 | cfg.writeEntry( "link", CheckBoxLink->isChecked() ); | 333 | cfg.writeEntry( "link", CheckBoxLink->isChecked() ); |
335 | cfg.writeEntry( "dest", getDestinationName() ); | 334 | cfg.writeEntry( "dest", getDestinationName() ); |
336 | cfg.writeEntry( "linkdest" , getLinkDestinationName() ); | 335 | cfg.writeEntry( "linkdest" , getLinkDestinationName() ); |
337 | QStringList sers = getActiveServers(); | 336 | QStringList sers = getActiveServers(); |
338 | int srvc = 0; | 337 | int srvc = 0; |
339 | for ( QStringList::Iterator it = sers.begin(); it != sers.end(); ++it ) { | 338 | for ( QStringList::Iterator it = sers.begin(); it != sers.end(); ++it ) { |
340 | cfg.writeEntry( "server_" + QString::number(srvc++), *it ); | 339 | cfg.writeEntry( "server_" + QString::number(srvc++), *it ); |
341 | } | 340 | } |
342 | cfg.writeEntry( "server_count", srvc ); | 341 | cfg.writeEntry( "server_count", srvc ); |
343 | } | 342 | } |
344 | 343 | ||
345 | //void PackageManagerSettings::renameInstallationSetting() | 344 | //void PackageManagerSettings::renameInstallationSetting() |
346 | //{ | 345 | //{ |
347 | // settingName->setEditable( true ); | 346 | // settingName->setEditable( true ); |
348 | // changed = true; | 347 | // changed = true; |
349 | //} | 348 | //} |
350 | 349 | ||
351 | //void PackageManagerSettings::installationSettingSetName(const QString &name) | 350 | //void PackageManagerSettings::installationSettingSetName(const QString &name) |
352 | //{ | 351 | //{ |
353 | // settingName->changeItem( name, settingName->currentItem() ); | 352 | // settingName->changeItem( name, settingName->currentItem() ); |
354 | // changed = true; | 353 | // changed = true; |
355 | //} | 354 | //} |
356 | 355 | ||
357 | 356 | ||
358 | bool PackageManagerSettings::readIpkgConfig(const QString& conffile) | 357 | bool PackageManagerSettings::readIpkgConfig(const QString& conffile) |
359 | { | 358 | { |
360 | QFile conf(conffile); | 359 | QFile conf(conffile); |
361 | changed = false; | 360 | changed = false; |
362 | if ( conf.open(IO_ReadOnly) ) { | 361 | if ( conf.open(IO_ReadOnly) ) { |
363 | QTextStream s(&conf); | 362 | QTextStream s(&conf); |
364 | servers->clear(); | 363 | servers->clear(); |
365 | activeServers->clear(); | 364 | activeServers->clear(); |
366 | destinations->clear(); | 365 | destinations->clear(); |
367 | activeDestination->clear(); | 366 | activeDestination->clear(); |
368 | activeLinkDestination->clear(); | 367 | activeLinkDestination->clear(); |
369 | serverurlDic.clear(); | 368 | serverurlDic.clear(); |
370 | destinationurlDic.clear(); | 369 | destinationurlDic.clear(); |
371 | ipkg_old=0; | 370 | ipkg_old=0; |
372 | int currentserver=0; | 371 | int currentserver=0; |
373 | while ( !s.atEnd() ) { | 372 | while ( !s.atEnd() ) { |
374 | QString l = s.readLine(); | 373 | QString l = s.readLine(); |
375 | QStringList token = QStringList::split(' ', l); | 374 | QStringList token = QStringList::split(' ', l); |
376 | if ( token[0] == "src" || token[0] == "#src" ) { | 375 | if ( token[0] == "src" || token[0] == "#src" ) { |
377 | currentserver=servers->count(); | 376 | currentserver=servers->count(); |
378 | serverurlDic.insert(servers->count(),new QString(token[2])); | 377 | serverurlDic.insert(servers->count(),new QString(token[2])); |
379 | int a = token[0] == "src" ? 1 : 0; | 378 | int a = token[0] == "src" ? 1 : 0; |
380 | int i = servers->count(); | 379 | int i = servers->count(); |
381 | servers->insertItem(token[1]); | 380 | servers->insertItem(token[1]); |
382 | activeServers->insertItem( token[1] ); | 381 | activeServers->insertItem( token[1] ); |
383 | activeServers->setSelected(i,a); | 382 | activeServers->setSelected(i,a); |
384 | } else if ( token[0] == "dest" ) { | 383 | } else if ( token[0] == "dest" ) { |
385 | currentserver=destinations->count(); | 384 | currentserver=destinations->count(); |
386 | destinationurlDic.insert(destinations->count(),new QString(token[2])); | 385 | destinationurlDic.insert(destinations->count(),new QString(token[2])); |
387 | destinations->insertItem(token[1]); | 386 | destinations->insertItem(token[1]); |
388 | activeDestination->insertItem( token[1] ); | 387 | activeDestination->insertItem( token[1] ); |
389 | activeLinkDestination->insertItem( token[1] ); | 388 | activeLinkDestination->insertItem( token[1] ); |
390 | 389 | ||
391 | } else if ( token[0] == "option" ) { | 390 | } else if ( token[0] == "option" ) { |
392 | // ### somehow need to use the settings from netsetup | 391 | // ### somehow need to use the settings from netsetup |
393 | // if ( token[1] == "http_proxy" ) | 392 | // if ( token[1] == "http_proxy" ) |
394 | // http->setText(token[2]); | 393 | // http->setText(token[2]); |
395 | // else if ( token[1] == "ftp_proxy" ) | 394 | // else if ( token[1] == "ftp_proxy" ) |
396 | // ftp->setText(token[2]); | 395 | // ftp->setText(token[2]); |
397 | // else if ( token[1] == "proxy_username" ) | 396 | // else if ( token[1] == "proxy_username" ) |
398 | // username->setText(token[2]); | 397 | // username->setText(token[2]); |
399 | // else if ( token[1] == "proxy_password" ) | 398 | // else if ( token[1] == "proxy_password" ) |
400 | // password->setText(token[2]); | 399 | // password->setText(token[2]); |
401 | } else { | 400 | } else { |
402 | // Old style? | 401 | // Old style? |
403 | int eq = l.find('='); | 402 | int eq = l.find('='); |
404 | if ( eq >= 0 ) { | 403 | if ( eq >= 0 ) { |
405 | QString v = l.mid(eq+1).stripWhiteSpace(); | 404 | QString v = l.mid(eq+1).stripWhiteSpace(); |
406 | if ( v[0] == '"' || v[0] == '\'' ) { | 405 | if ( v[0] == '"' || v[0] == '\'' ) { |
407 | int cl=v.find(v[0],1); | 406 | int cl=v.find(v[0],1); |
408 | if ( cl >= 0 ) | 407 | if ( cl >= 0 ) |
409 | v = v.mid(1,cl-1); | 408 | v = v.mid(1,cl-1); |
410 | } | 409 | } |
411 | if ( l.left(12) == "IPKG_SOURCE=" ) { | 410 | if ( l.left(12) == "IPKG_SOURCE=" ) { |
412 | ipkg_old=1; | 411 | ipkg_old=1; |
413 | currentserver=servers->count(); | 412 | currentserver=servers->count(); |
414 | serverurlDic.insert(servers->count(),new QString(v)); | 413 | serverurlDic.insert(servers->count(),new QString(v)); |
415 | servers->insertItem(v); | 414 | servers->insertItem(v); |
416 | } else if ( l.left(13) == "#IPKG_SOURCE=" ) { | 415 | } else if ( l.left(13) == "#IPKG_SOURCE=" ) { |
417 | serverurlDic.insert(servers->count(),new QString(v)); | 416 | serverurlDic.insert(servers->count(),new QString(v)); |
418 | servers->insertItem(v); | 417 | servers->insertItem(v); |
419 | } else if ( l.left(10) == "IPKG_ROOT=" ) { | 418 | } else if ( l.left(10) == "IPKG_ROOT=" ) { |
420 | // ### no UI | 419 | // ### no UI |
421 | // } else if ( l.left(20) == "IPKG_PROXY_USERNAME=" ) { | 420 | // } else if ( l.left(20) == "IPKG_PROXY_USERNAME=" ) { |
422 | // username->setText(v); | 421 | // username->setText(v); |
423 | // } else if ( l.left(20) == "IPKG_PROXY_PASSWORD=" ) { | 422 | // } else if ( l.left(20) == "IPKG_PROXY_PASSWORD=" ) { |
424 | // password->setText(v); | 423 | // password->setText(v); |
425 | // } else if ( l.left(16) == "IPKG_PROXY_HTTP=" ) { | 424 | // } else if ( l.left(16) == "IPKG_PROXY_HTTP=" ) { |
426 | // http->setText(v); | 425 | // http->setText(v); |
427 | // } else if ( l.left(16) == "IPKG_PROXY_FTP=" ) { | 426 | // } else if ( l.left(16) == "IPKG_PROXY_FTP=" ) { |