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 | |||
@@ -89,42 +89,42 @@ OIpkgConfigDlg::OIpkgConfigDlg( OIpkg *ipkg, bool installOptions, QWidget *paren | |||
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 | ||
@@ -390,30 +390,12 @@ void OIpkgConfigDlg::initData() | |||
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 ); |
@@ -439,13 +421,13 @@ void OIpkgConfigDlg::slotServerNew() | |||
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 ); |
@@ -458,13 +440,13 @@ void OIpkgConfigDlg::slotServerEdit() | |||
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 ); |
@@ -499,13 +481,13 @@ void OIpkgConfigDlg::slotDestNew() | |||
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 ); |
@@ -518,13 +500,13 @@ void OIpkgConfigDlg::slotDestEdit() | |||
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 ); |