author | drw <drw> | 2005-01-02 20:26:01 (UTC) |
---|---|---|
committer | drw <drw> | 2005-01-02 20:26:01 (UTC) |
commit | e763e0cea060ae3a2dfb1c411f56354e27ac12a9 (patch) (unidiff) | |
tree | 37896734be7d2679c3f19635fe9fe3b52a549332 /noncore/settings/packagemanager/oipkgconfigdlg.cpp | |
parent | 020ea2d54bcd0fc4420cb433b3e657cd13ae07e2 (diff) | |
download | opie-e763e0cea060ae3a2dfb1c411f56354e27ac12a9.zip opie-e763e0cea060ae3a2dfb1c411f56354e27ac12a9.tar.gz opie-e763e0cea060ae3a2dfb1c411f56354e27ac12a9.tar.bz2 |
Implement native package linking code (removing need for ipkg-link and its shortcomings), move package linking code to OIpkg (proper place for ipkg specific code), many small code tweaks and bump version up to 0.6.1
Diffstat (limited to 'noncore/settings/packagemanager/oipkgconfigdlg.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/packagemanager/oipkgconfigdlg.cpp | 34 |
1 files changed, 8 insertions, 26 deletions
diff --git a/noncore/settings/packagemanager/oipkgconfigdlg.cpp b/noncore/settings/packagemanager/oipkgconfigdlg.cpp index 77ad220..e6d6a81 100644 --- a/noncore/settings/packagemanager/oipkgconfigdlg.cpp +++ b/noncore/settings/packagemanager/oipkgconfigdlg.cpp | |||
@@ -71,78 +71,78 @@ OIpkgConfigDlg::OIpkgConfigDlg( OIpkg *ipkg, bool installOptions, QWidget *paren | |||
71 | initData(); | 71 | initData(); |
72 | 72 | ||
73 | // Setup tabs for all info | 73 | // Setup tabs for all info |
74 | m_layout.addWidget( &m_tabWidget ); | 74 | m_layout.addWidget( &m_tabWidget ); |
75 | if ( !m_installOptions ) | 75 | if ( !m_installOptions ) |
76 | { | 76 | { |
77 | m_tabWidget.addTab( m_serverWidget, "packagemanager/servertab", tr( "Servers" ) ); | 77 | m_tabWidget.addTab( m_serverWidget, "packagemanager/servertab", tr( "Servers" ) ); |
78 | m_tabWidget.addTab( m_destWidget, "packagemanager/desttab", tr( "Destinations" ) ); | 78 | m_tabWidget.addTab( m_destWidget, "packagemanager/desttab", tr( "Destinations" ) ); |
79 | m_tabWidget.addTab( m_proxyWidget, "packagemanager/proxytab", tr( "Proxies" ) ); | 79 | m_tabWidget.addTab( m_proxyWidget, "packagemanager/proxytab", tr( "Proxies" ) ); |
80 | m_tabWidget.addTab( m_optionsWidget, "exec", tr( "Options" ) ); | 80 | m_tabWidget.addTab( m_optionsWidget, "exec", tr( "Options" ) ); |
81 | m_tabWidget.setCurrentTab( tr( "Servers" ) ); | 81 | m_tabWidget.setCurrentTab( tr( "Servers" ) ); |
82 | } | 82 | } |
83 | else | 83 | else |
84 | { | 84 | { |
85 | m_tabWidget.addTab( m_optionsWidget, "exec", tr( "Options" ) ); | 85 | m_tabWidget.addTab( m_optionsWidget, "exec", tr( "Options" ) ); |
86 | } | 86 | } |
87 | } | 87 | } |
88 | 88 | ||
89 | void OIpkgConfigDlg::accept() | 89 | void OIpkgConfigDlg::accept() |
90 | { | 90 | { |
91 | // Save server, destination and proxy configuration | 91 | // Save server, destination and proxy configuration |
92 | if ( !m_installOptions ) | 92 | if ( !m_installOptions ) |
93 | { | 93 | { |
94 | // Update proxy information before saving settings | 94 | // Update proxy information before saving settings |
95 | OConfItem *confItem = findConfItem( OConfItem::Option, "http_proxy" ); | 95 | OConfItem *confItem = m_ipkg->findConfItem( OConfItem::Option, "http_proxy" ); |
96 | if ( confItem ) | 96 | if ( confItem ) |
97 | { | 97 | { |
98 | confItem->setValue( m_proxyHttpServer->text() ); | 98 | confItem->setValue( m_proxyHttpServer->text() ); |
99 | confItem->setActive( m_proxyHttpActive->isChecked() ); | 99 | confItem->setActive( m_proxyHttpActive->isChecked() ); |
100 | } | 100 | } |
101 | else | 101 | else |
102 | m_configs->append( new OConfItem( OConfItem::Option, "http_proxy", | 102 | m_configs->append( new OConfItem( OConfItem::Option, "http_proxy", |
103 | m_proxyHttpServer->text(), QString::null, | 103 | m_proxyHttpServer->text(), QString::null, |
104 | m_proxyHttpActive->isChecked() ) ); | 104 | m_proxyHttpActive->isChecked() ) ); |
105 | 105 | ||
106 | confItem = findConfItem( OConfItem::Option, "ftp_proxy" ); | 106 | confItem = m_ipkg->findConfItem( OConfItem::Option, "ftp_proxy" ); |
107 | if ( confItem ) | 107 | if ( confItem ) |
108 | { | 108 | { |
109 | confItem->setValue( m_proxyFtpServer->text() ); | 109 | confItem->setValue( m_proxyFtpServer->text() ); |
110 | confItem->setActive( m_proxyFtpActive->isChecked() ); | 110 | confItem->setActive( m_proxyFtpActive->isChecked() ); |
111 | } | 111 | } |
112 | else | 112 | else |
113 | m_configs->append( new OConfItem( OConfItem::Option, "ftp_proxy", | 113 | m_configs->append( new OConfItem( OConfItem::Option, "ftp_proxy", |
114 | m_proxyFtpServer->text(), QString::null, | 114 | m_proxyFtpServer->text(), QString::null, |
115 | m_proxyFtpActive->isChecked() ) ); | 115 | m_proxyFtpActive->isChecked() ) ); |
116 | 116 | ||
117 | confItem = findConfItem( OConfItem::Option, "proxy_username" ); | 117 | confItem = m_ipkg->findConfItem( OConfItem::Option, "proxy_username" ); |
118 | if ( confItem ) | 118 | if ( confItem ) |
119 | confItem->setValue( m_proxyUsername->text() ); | 119 | confItem->setValue( m_proxyUsername->text() ); |
120 | else | 120 | else |
121 | m_configs->append( new OConfItem( OConfItem::Option, "proxy_username", | 121 | m_configs->append( new OConfItem( OConfItem::Option, "proxy_username", |
122 | m_proxyUsername->text() ) ); | 122 | m_proxyUsername->text() ) ); |
123 | 123 | ||
124 | confItem = findConfItem( OConfItem::Option, "proxy_password" ); | 124 | confItem = m_ipkg->findConfItem( OConfItem::Option, "proxy_password" ); |
125 | if ( confItem ) | 125 | if ( confItem ) |
126 | confItem->setValue( m_proxyPassword->text() ); | 126 | confItem->setValue( m_proxyPassword->text() ); |
127 | else | 127 | else |
128 | m_configs->append( new OConfItem( OConfItem::Option, "proxy_password", | 128 | m_configs->append( new OConfItem( OConfItem::Option, "proxy_password", |
129 | m_proxyPassword->text() ) ); | 129 | m_proxyPassword->text() ) ); |
130 | 130 | ||
131 | m_ipkg->setConfigItems( m_configs ); | 131 | m_ipkg->setConfigItems( m_configs ); |
132 | } | 132 | } |
133 | 133 | ||
134 | // Save options configuration | 134 | // Save options configuration |
135 | int options = 0; | 135 | int options = 0; |
136 | if ( m_optForceDepends->isChecked() ) | 136 | if ( m_optForceDepends->isChecked() ) |
137 | options |= FORCE_DEPENDS; | 137 | options |= FORCE_DEPENDS; |
138 | if ( m_optForceReinstall->isChecked() ) | 138 | if ( m_optForceReinstall->isChecked() ) |
139 | options |= FORCE_REINSTALL; | 139 | options |= FORCE_REINSTALL; |
140 | if ( m_optForceRemove->isChecked() ) | 140 | if ( m_optForceRemove->isChecked() ) |
141 | options |= FORCE_REMOVE; | 141 | options |= FORCE_REMOVE; |
142 | if ( m_optForceOverwrite->isChecked() ) | 142 | if ( m_optForceOverwrite->isChecked() ) |
143 | options |= FORCE_OVERWRITE; | 143 | options |= FORCE_OVERWRITE; |
144 | m_ipkg->setIpkgExecOptions( options ); | 144 | m_ipkg->setIpkgExecOptions( options ); |
145 | m_ipkg->setIpkgExecVerbosity( m_optVerboseIpkg->currentItem() ); | 145 | m_ipkg->setIpkgExecVerbosity( m_optVerboseIpkg->currentItem() ); |
146 | 146 | ||
147 | QDialog::accept(); | 147 | QDialog::accept(); |
148 | } | 148 | } |
@@ -372,177 +372,159 @@ void OIpkgConfigDlg::initData() | |||
372 | else if ( config->name() == "proxy_password" ) | 372 | else if ( config->name() == "proxy_password" ) |
373 | { | 373 | { |
374 | m_proxyPassword->setText( config->value() ); | 374 | m_proxyPassword->setText( config->value() ); |
375 | } | 375 | } |
376 | } | 376 | } |
377 | } | 377 | } |
378 | } | 378 | } |
379 | } | 379 | } |
380 | } | 380 | } |
381 | 381 | ||
382 | // Get Ipkg execution options | 382 | // Get Ipkg execution options |
383 | int options = m_ipkg->ipkgExecOptions(); | 383 | int options = m_ipkg->ipkgExecOptions(); |
384 | if ( options & FORCE_DEPENDS ) | 384 | if ( options & FORCE_DEPENDS ) |
385 | m_optForceDepends->setChecked( true ); | 385 | m_optForceDepends->setChecked( true ); |
386 | if ( options & FORCE_REINSTALL ) | 386 | if ( options & FORCE_REINSTALL ) |
387 | m_optForceReinstall->setChecked( true ); | 387 | m_optForceReinstall->setChecked( true ); |
388 | if ( options & FORCE_REMOVE ) | 388 | if ( options & FORCE_REMOVE ) |
389 | m_optForceRemove->setChecked( true ); | 389 | m_optForceRemove->setChecked( true ); |
390 | if ( options & FORCE_OVERWRITE ) | 390 | if ( options & FORCE_OVERWRITE ) |
391 | m_optForceOverwrite->setChecked( true ); | 391 | m_optForceOverwrite->setChecked( true ); |
392 | 392 | ||
393 | m_optVerboseIpkg->setCurrentItem( m_ipkg->ipkgExecVerbosity() ); | 393 | m_optVerboseIpkg->setCurrentItem( m_ipkg->ipkgExecVerbosity() ); |
394 | } | 394 | } |
395 | 395 | ||
396 | OConfItem *OIpkgConfigDlg::findConfItem( OConfItem::Type type, const QString &name ) | ||
397 | { | ||
398 | // Find selected server in list | ||
399 | OConfItemListIterator configIt( *m_configs ); | ||
400 | OConfItem *config = 0l; | ||
401 | for ( ; configIt.current(); ++configIt ) | ||
402 | { | ||
403 | config = configIt.current(); | ||
404 | if ( config->type() == type && config->name() == name ) | ||
405 | break; | ||
406 | } | ||
407 | |||
408 | if ( config && config->type() == type && config->name() == name ) | ||
409 | return config; | ||
410 | |||
411 | return 0l; | ||
412 | } | ||
413 | |||
414 | void OIpkgConfigDlg::slotServerSelected( int index ) | 396 | void OIpkgConfigDlg::slotServerSelected( int index ) |
415 | { | 397 | { |
416 | m_serverCurrent = index; | 398 | m_serverCurrent = index; |
417 | 399 | ||
418 | // Enable Edit and Delete buttons | 400 | // Enable Edit and Delete buttons |
419 | m_serverEditBtn->setEnabled( true ); | 401 | m_serverEditBtn->setEnabled( true ); |
420 | m_serverDeleteBtn->setEnabled( true ); | 402 | m_serverDeleteBtn->setEnabled( true ); |
421 | } | 403 | } |
422 | 404 | ||
423 | void OIpkgConfigDlg::slotServerNew() | 405 | void OIpkgConfigDlg::slotServerNew() |
424 | { | 406 | { |
425 | OConfItem *server = new OConfItem( OConfItem::Source ); | 407 | OConfItem *server = new OConfItem( OConfItem::Source ); |
426 | 408 | ||
427 | OIpkgServerDlg dlg( server, this ); | 409 | OIpkgServerDlg dlg( server, this ); |
428 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) | 410 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) |
429 | { | 411 | { |
430 | // Add to configuration option list | 412 | // Add to configuration option list |
431 | m_configs->append( server ); | 413 | m_configs->append( server ); |
432 | m_configs->sort(); | 414 | m_configs->sort(); |
433 | 415 | ||
434 | // Add to server list | 416 | // Add to server list |
435 | m_serverList->insertItem( server->name() ); | 417 | m_serverList->insertItem( server->name() ); |
436 | m_serverList->setCurrentItem( m_serverList->count() ); | 418 | m_serverList->setCurrentItem( m_serverList->count() ); |
437 | } | 419 | } |
438 | else | 420 | else |
439 | delete server; | 421 | delete server; |
440 | } | 422 | } |
441 | 423 | ||
442 | void OIpkgConfigDlg::slotServerEdit() | 424 | void OIpkgConfigDlg::slotServerEdit() |
443 | { | 425 | { |
444 | // Find selected server in list | 426 | // Find selected server in list |
445 | OConfItem *server = findConfItem( OConfItem::Source, m_serverList->currentText() ); | 427 | OConfItem *server = m_ipkg->findConfItem( OConfItem::Source, m_serverList->currentText() ); |
446 | 428 | ||
447 | // Edit server | 429 | // Edit server |
448 | if ( server ) | 430 | if ( server ) |
449 | { | 431 | { |
450 | QString origName = server->name(); | 432 | QString origName = server->name(); |
451 | OIpkgServerDlg dlg( server, this ); | 433 | OIpkgServerDlg dlg( server, this ); |
452 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) | 434 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) |
453 | { | 435 | { |
454 | // Check to see if name has changed, if so update the server list | 436 | // Check to see if name has changed, if so update the server list |
455 | if ( server->name() != origName ) | 437 | if ( server->name() != origName ) |
456 | m_serverList->changeItem( server->name(), m_serverCurrent ); | 438 | m_serverList->changeItem( server->name(), m_serverCurrent ); |
457 | } | 439 | } |
458 | } | 440 | } |
459 | } | 441 | } |
460 | 442 | ||
461 | void OIpkgConfigDlg::slotServerDelete() | 443 | void OIpkgConfigDlg::slotServerDelete() |
462 | { | 444 | { |
463 | // Find selected server in list | 445 | // Find selected server in list |
464 | OConfItem *server = findConfItem( OConfItem::Source, m_serverList->currentText() ); | 446 | OConfItem *server = m_ipkg->findConfItem( OConfItem::Source, m_serverList->currentText() ); |
465 | 447 | ||
466 | // Delete server | 448 | // Delete server |
467 | if ( server ) | 449 | if ( server ) |
468 | { | 450 | { |
469 | m_configs->removeRef( server ); | 451 | m_configs->removeRef( server ); |
470 | m_serverList->removeItem( m_serverCurrent ); | 452 | m_serverList->removeItem( m_serverCurrent ); |
471 | } | 453 | } |
472 | } | 454 | } |
473 | 455 | ||
474 | void OIpkgConfigDlg::slotDestSelected( int index ) | 456 | void OIpkgConfigDlg::slotDestSelected( int index ) |
475 | { | 457 | { |
476 | m_destCurrent = index; | 458 | m_destCurrent = index; |
477 | 459 | ||
478 | // Enable Edit and Delete buttons | 460 | // Enable Edit and Delete buttons |
479 | m_destEditBtn->setEnabled( true ); | 461 | m_destEditBtn->setEnabled( true ); |
480 | m_destDeleteBtn->setEnabled( true ); | 462 | m_destDeleteBtn->setEnabled( true ); |
481 | } | 463 | } |
482 | 464 | ||
483 | void OIpkgConfigDlg::slotDestNew() | 465 | void OIpkgConfigDlg::slotDestNew() |
484 | { | 466 | { |
485 | OConfItem *dest = new OConfItem( OConfItem::Destination ); | 467 | OConfItem *dest = new OConfItem( OConfItem::Destination ); |
486 | 468 | ||
487 | OIpkgDestDlg dlg( dest, this ); | 469 | OIpkgDestDlg dlg( dest, this ); |
488 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) | 470 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) |
489 | { | 471 | { |
490 | // Add to configuration option list | 472 | // Add to configuration option list |
491 | m_configs->append( dest ); | 473 | m_configs->append( dest ); |
492 | m_configs->sort(); | 474 | m_configs->sort(); |
493 | 475 | ||
494 | // Add to destination list | 476 | // Add to destination list |
495 | m_destList->insertItem( dest->name() ); | 477 | m_destList->insertItem( dest->name() ); |
496 | m_destList->setCurrentItem( m_destList->count() ); | 478 | m_destList->setCurrentItem( m_destList->count() ); |
497 | } | 479 | } |
498 | else | 480 | else |
499 | delete dest; | 481 | delete dest; |
500 | } | 482 | } |
501 | 483 | ||
502 | void OIpkgConfigDlg::slotDestEdit() | 484 | void OIpkgConfigDlg::slotDestEdit() |
503 | { | 485 | { |
504 | // Find selected destination in list | 486 | // Find selected destination in list |
505 | OConfItem *dest = findConfItem( OConfItem::Destination, m_destList->currentText() ); | 487 | OConfItem *dest = m_ipkg->findConfItem( OConfItem::Destination, m_destList->currentText() ); |
506 | 488 | ||
507 | // Edit destination | 489 | // Edit destination |
508 | if ( dest ) | 490 | if ( dest ) |
509 | { | 491 | { |
510 | QString origName = dest->name(); | 492 | QString origName = dest->name(); |
511 | OIpkgDestDlg dlg( dest, this ); | 493 | OIpkgDestDlg dlg( dest, this ); |
512 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) | 494 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) |
513 | { | 495 | { |
514 | // Check to see if name has changed, if so update the dest list | 496 | // Check to see if name has changed, if so update the dest list |
515 | if ( dest->name() != origName ) | 497 | if ( dest->name() != origName ) |
516 | m_destList->changeItem( dest->name(), m_destCurrent ); | 498 | m_destList->changeItem( dest->name(), m_destCurrent ); |
517 | } | 499 | } |
518 | } | 500 | } |
519 | } | 501 | } |
520 | 502 | ||
521 | void OIpkgConfigDlg::slotDestDelete() | 503 | void OIpkgConfigDlg::slotDestDelete() |
522 | { | 504 | { |
523 | // Find selected destination in list | 505 | // Find selected destination in list |
524 | OConfItem *destination = findConfItem( OConfItem::Destination, m_destList->currentText() ); | 506 | OConfItem *destination = m_ipkg->findConfItem( OConfItem::Destination, m_destList->currentText() ); |
525 | 507 | ||
526 | // Delete destination | 508 | // Delete destination |
527 | if ( destination ) | 509 | if ( destination ) |
528 | { | 510 | { |
529 | m_configs->removeRef( destination ); | 511 | m_configs->removeRef( destination ); |
530 | m_destList->removeItem( m_destCurrent ); | 512 | m_destList->removeItem( m_destCurrent ); |
531 | } | 513 | } |
532 | } | 514 | } |
533 | 515 | ||
534 | OIpkgServerDlg::OIpkgServerDlg( OConfItem *server, QWidget *parent ) | 516 | OIpkgServerDlg::OIpkgServerDlg( OConfItem *server, QWidget *parent ) |
535 | : QDialog( parent, QString::null, true, WStyle_ContextHelp ) | 517 | : QDialog( parent, QString::null, true, WStyle_ContextHelp ) |
536 | , m_server( server ) | 518 | , m_server( server ) |
537 | { | 519 | { |
538 | setCaption( tr( "Edit Server" ) ); | 520 | setCaption( tr( "Edit Server" ) ); |
539 | 521 | ||
540 | // Initialize UI | 522 | // Initialize UI |
541 | QVBoxLayout *layout = new QVBoxLayout( this, 2, 4 ); | 523 | QVBoxLayout *layout = new QVBoxLayout( this, 2, 4 ); |
542 | 524 | ||
543 | m_active = new QCheckBox( tr( "Active" ), this ); | 525 | m_active = new QCheckBox( tr( "Active" ), this ); |
544 | QWhatsThis::add( m_active, tr( "Tap here to indicate whether this entry is active or not." ) ); | 526 | QWhatsThis::add( m_active, tr( "Tap here to indicate whether this entry is active or not." ) ); |
545 | layout->addWidget( m_active ); | 527 | layout->addWidget( m_active ); |
546 | 528 | ||
547 | layout->addStretch(); | 529 | layout->addStretch(); |
548 | 530 | ||