Diffstat (limited to 'noncore/settings/packagemanager/oipkgconfigdlg.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/packagemanager/oipkgconfigdlg.cpp | 138 |
1 files changed, 87 insertions, 51 deletions
diff --git a/noncore/settings/packagemanager/oipkgconfigdlg.cpp b/noncore/settings/packagemanager/oipkgconfigdlg.cpp index e6d6a81..7ee2d74 100644 --- a/noncore/settings/packagemanager/oipkgconfigdlg.cpp +++ b/noncore/settings/packagemanager/oipkgconfigdlg.cpp | |||
@@ -130,2 +130,9 @@ void OIpkgConfigDlg::accept() | |||
130 | 130 | ||
131 | confItem = m_ipkg->findConfItem( OConfItem::Other, "lists_dir" ); | ||
132 | if ( confItem ) | ||
133 | confItem->setValue( m_optSourceLists->text() ); | ||
134 | else | ||
135 | m_configs->append( new OConfItem( OConfItem::Other, "lists_dir", | ||
136 | m_optSourceLists->text(), "name" ) ); | ||
137 | |||
131 | m_ipkg->setConfigItems( m_configs ); | 138 | m_ipkg->setConfigItems( m_configs ); |
@@ -185,3 +192,3 @@ void OIpkgConfigDlg::initServerWidget() | |||
185 | layout->addWidget( m_serverEditBtn, 1, 1 ); | 192 | layout->addWidget( m_serverEditBtn, 1, 1 ); |
186 | 193 | ||
187 | m_serverDeleteBtn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); | 194 | m_serverDeleteBtn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); |
@@ -223,3 +230,3 @@ void OIpkgConfigDlg::initDestinationWidget() | |||
223 | layout->addWidget( m_destEditBtn, 1, 1 ); | 230 | layout->addWidget( m_destEditBtn, 1, 1 ); |
224 | 231 | ||
225 | m_destDeleteBtn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); | 232 | m_destDeleteBtn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); |
@@ -299,3 +306,3 @@ void OIpkgConfigDlg::initOptionsWidget() | |||
299 | sv->addChild( container ); | 306 | sv->addChild( container ); |
300 | QVBoxLayout *layout = new QVBoxLayout( container, 2, 4 ); | 307 | QGridLayout *layout = new QGridLayout( container, 8, 2, 2, 4 ); |
301 | 308 | ||
@@ -303,3 +310,3 @@ void OIpkgConfigDlg::initOptionsWidget() | |||
303 | QWhatsThis::add( m_optForceDepends, tr( "Tap here to enable or disable the '-force-depends' option for Ipkg." ) ); | 310 | QWhatsThis::add( m_optForceDepends, tr( "Tap here to enable or disable the '-force-depends' option for Ipkg." ) ); |
304 | layout->addWidget( m_optForceDepends ); | 311 | layout->addMultiCellWidget( m_optForceDepends, 0, 0, 0, 1 ); |
305 | 312 | ||
@@ -307,3 +314,3 @@ void OIpkgConfigDlg::initOptionsWidget() | |||
307 | QWhatsThis::add( m_optForceReinstall, tr( "Tap here to enable or disable the '-force-reinstall' option for Ipkg." ) ); | 314 | QWhatsThis::add( m_optForceReinstall, tr( "Tap here to enable or disable the '-force-reinstall' option for Ipkg." ) ); |
308 | layout->addWidget( m_optForceReinstall ); | 315 | layout->addMultiCellWidget( m_optForceReinstall, 1, 1, 0, 1 ); |
309 | 316 | ||
@@ -311,3 +318,3 @@ void OIpkgConfigDlg::initOptionsWidget() | |||
311 | QWhatsThis::add( m_optForceRemove, tr( "Tap here to enable or disable the '-force-removal-of-dependent-packages' option for Ipkg." ) ); | 318 | QWhatsThis::add( m_optForceRemove, tr( "Tap here to enable or disable the '-force-removal-of-dependent-packages' option for Ipkg." ) ); |
312 | layout->addWidget( m_optForceRemove ); | 319 | layout->addMultiCellWidget( m_optForceRemove, 2, 2, 0, 1 ); |
313 | 320 | ||
@@ -315,7 +322,7 @@ void OIpkgConfigDlg::initOptionsWidget() | |||
315 | QWhatsThis::add( m_optForceOverwrite, tr( "Tap here to enable or disable the '-force-overwrite' option for Ipkg." ) ); | 322 | QWhatsThis::add( m_optForceOverwrite, tr( "Tap here to enable or disable the '-force-overwrite' option for Ipkg." ) ); |
316 | layout->addWidget( m_optForceOverwrite ); | 323 | layout->addMultiCellWidget( m_optForceOverwrite, 3, 3, 0, 1 ); |
317 | 324 | ||
318 | QLabel *l = new QLabel( tr( "Information Level" ), container ); | 325 | QLabel *l = new QLabel( tr( "Information level:" ), container ); |
319 | QWhatsThis::add( l, tr( "Select information level for Ipkg." ) ); | 326 | QWhatsThis::add( l, tr( "Select information level for Ipkg." ) ); |
320 | layout->addWidget( l ); | 327 | layout->addMultiCellWidget( l, 4, 4, 0, 1 ); |
321 | 328 | ||
@@ -327,3 +334,16 @@ void OIpkgConfigDlg::initOptionsWidget() | |||
327 | m_optVerboseIpkg->insertItem( tr( "Troubleshooting output" ) ); | 334 | m_optVerboseIpkg->insertItem( tr( "Troubleshooting output" ) ); |
328 | layout->addWidget( m_optVerboseIpkg ); | 335 | layout->addMultiCellWidget( m_optVerboseIpkg, 5, 5, 0, 1 ); |
336 | |||
337 | l = new QLabel( tr( "Package source lists directory:" ), container ); | ||
338 | QWhatsThis::add( l, tr( "Enter the directory where package source feed information is stored." ) ); | ||
339 | layout->addMultiCellWidget( l, 6, 6, 0, 1 ); | ||
340 | |||
341 | m_optSourceLists = new QLineEdit( container ); | ||
342 | QWhatsThis::add( m_optSourceLists, tr( "Enter the directory where package source feed information is stored." ) ); | ||
343 | layout->addWidget( m_optSourceLists, 7, 0 ); | ||
344 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "folder" ), QString::null, container ); | ||
345 | btn->setMaximumWidth( btn->height() ); | ||
346 | QWhatsThis::add( btn, tr( "Tap here to select the directory where package source feed information is stored." ) ); | ||
347 | connect( btn, SIGNAL(clicked()), this, SLOT(slotOptSelectSourceListsPath()) ); | ||
348 | layout->addWidget( btn, 7, 1 ); | ||
329 | 349 | ||
@@ -347,31 +367,38 @@ void OIpkgConfigDlg::initData() | |||
347 | { | 367 | { |
348 | if ( config->type() == OConfItem::Source ) | 368 | switch ( config->type() ) |
349 | { | 369 | { |
350 | m_serverList->insertItem( config->name() ); | 370 | case OConfItem::Source : m_serverList->insertItem( config->name() ); break; |
351 | } | 371 | case OConfItem::Destination : m_destList->insertItem( config->name() ); break; |
352 | else if ( config->type() == OConfItem::Destination ) | 372 | case OConfItem::Option : |
353 | { | 373 | { |
354 | m_destList->insertItem( config->name() ); | 374 | if ( config->name() == "http_proxy" ) |
355 | } | 375 | { |
356 | else if ( config->type() == OConfItem::Option ) | 376 | m_proxyHttpServer->setText( config->value() ); |
357 | { | 377 | m_proxyHttpActive->setChecked( config->active() ); |
358 | if ( config->name() == "http_proxy" ) | 378 | } |
359 | { | 379 | else if ( config->name() == "ftp_proxy" ) |
360 | m_proxyHttpServer->setText( config->value() ); | 380 | { |
361 | m_proxyHttpActive->setChecked( config->active() ); | 381 | m_proxyFtpServer->setText( config->value() ); |
362 | } | 382 | m_proxyFtpActive->setChecked( config->active() ); |
363 | else if ( config->name() == "ftp_proxy" ) | 383 | } |
364 | { | 384 | else if ( config->name() == "proxy_username" ) |
365 | m_proxyFtpServer->setText( config->value() ); | 385 | { |
366 | m_proxyFtpActive->setChecked( config->active() ); | 386 | m_proxyUsername->setText( config->value() ); |
367 | } | 387 | } |
368 | else if ( config->name() == "proxy_username" ) | 388 | else if ( config->name() == "proxy_password" ) |
369 | { | 389 | { |
370 | m_proxyUsername->setText( config->value() ); | 390 | m_proxyPassword->setText( config->value() ); |
371 | } | 391 | } |
372 | else if ( config->name() == "proxy_password" ) | 392 | } |
373 | { | 393 | break; |
374 | m_proxyPassword->setText( config->value() ); | 394 | case OConfItem::Other : |
375 | } | 395 | { |
376 | } | 396 | if ( config->name() == "lists_dir" ) |
397 | m_optSourceLists->setText( config->value() ); | ||
398 | else // TODO - use proper libipkg define | ||
399 | m_optSourceLists->setText( "/usr/lib/ipkg/lists" ); | ||
400 | } | ||
401 | break; | ||
402 | default : break; | ||
403 | }; | ||
377 | } | 404 | } |
@@ -398,3 +425,3 @@ void OIpkgConfigDlg::slotServerSelected( int index ) | |||
398 | m_serverCurrent = index; | 425 | m_serverCurrent = index; |
399 | 426 | ||
400 | // Enable Edit and Delete buttons | 427 | // Enable Edit and Delete buttons |
@@ -407,3 +434,3 @@ void OIpkgConfigDlg::slotServerNew() | |||
407 | OConfItem *server = new OConfItem( OConfItem::Source ); | 434 | OConfItem *server = new OConfItem( OConfItem::Source ); |
408 | 435 | ||
409 | OIpkgServerDlg dlg( server, this ); | 436 | OIpkgServerDlg dlg( server, this ); |
@@ -458,3 +485,3 @@ void OIpkgConfigDlg::slotDestSelected( int index ) | |||
458 | m_destCurrent = index; | 485 | m_destCurrent = index; |
459 | 486 | ||
460 | // Enable Edit and Delete buttons | 487 | // Enable Edit and Delete buttons |
@@ -467,3 +494,3 @@ void OIpkgConfigDlg::slotDestNew() | |||
467 | OConfItem *dest = new OConfItem( OConfItem::Destination ); | 494 | OConfItem *dest = new OConfItem( OConfItem::Destination ); |
468 | 495 | ||
469 | OIpkgDestDlg dlg( dest, this ); | 496 | OIpkgDestDlg dlg( dest, this ); |
@@ -515,2 +542,11 @@ void OIpkgConfigDlg::slotDestDelete() | |||
515 | 542 | ||
543 | void OIpkgConfigDlg::slotOptSelectSourceListsPath() | ||
544 | { | ||
545 | QString path = Opie::Ui::OFileDialog::getDirectory( 0, m_optSourceLists->text() ); | ||
546 | if ( path.at( path.length() - 1 ) == '/' ) | ||
547 | path.truncate( path.length() - 1 ); | ||
548 | if ( !path.isNull() ) | ||
549 | m_optSourceLists->setText( path ); | ||
550 | } | ||
551 | |||
516 | OIpkgServerDlg::OIpkgServerDlg( OConfItem *server, QWidget *parent ) | 552 | OIpkgServerDlg::OIpkgServerDlg( OConfItem *server, QWidget *parent ) |
@@ -521,3 +557,3 @@ OIpkgServerDlg::OIpkgServerDlg( OConfItem *server, QWidget *parent ) | |||
521 | 557 | ||
522 | // Initialize UI | 558 | // Initialize UI |
523 | QVBoxLayout *layout = new QVBoxLayout( this, 2, 4 ); | 559 | QVBoxLayout *layout = new QVBoxLayout( this, 2, 4 ); |
@@ -529,3 +565,3 @@ OIpkgServerDlg::OIpkgServerDlg( OConfItem *server, QWidget *parent ) | |||
529 | layout->addStretch(); | 565 | layout->addStretch(); |
530 | 566 | ||
531 | QLabel *label = new QLabel( tr( "Name:" ), this ); | 567 | QLabel *label = new QLabel( tr( "Name:" ), this ); |
@@ -538,3 +574,3 @@ OIpkgServerDlg::OIpkgServerDlg( OConfItem *server, QWidget *parent ) | |||
538 | layout->addStretch(); | 574 | layout->addStretch(); |
539 | 575 | ||
540 | label = new QLabel( tr( "Address:" ), this ); | 576 | label = new QLabel( tr( "Address:" ), this ); |
@@ -551,3 +587,3 @@ OIpkgServerDlg::OIpkgServerDlg( OConfItem *server, QWidget *parent ) | |||
551 | layout->addWidget( m_compressed ); | 587 | layout->addWidget( m_compressed ); |
552 | 588 | ||
553 | // Populate initial information | 589 | // Populate initial information |
@@ -582,3 +618,3 @@ OIpkgDestDlg::OIpkgDestDlg( OConfItem *dest, QWidget *parent ) | |||
582 | 618 | ||
583 | // Initialize UI | 619 | // Initialize UI |
584 | QVBoxLayout *layout = new QVBoxLayout( this, 2, 4 ); | 620 | QVBoxLayout *layout = new QVBoxLayout( this, 2, 4 ); |
@@ -590,3 +626,3 @@ OIpkgDestDlg::OIpkgDestDlg( OConfItem *dest, QWidget *parent ) | |||
590 | layout->addStretch(); | 626 | layout->addStretch(); |
591 | 627 | ||
592 | QLabel *label = new QLabel( tr( "Name:" ), this ); | 628 | QLabel *label = new QLabel( tr( "Name:" ), this ); |
@@ -599,3 +635,3 @@ OIpkgDestDlg::OIpkgDestDlg( OConfItem *dest, QWidget *parent ) | |||
599 | layout->addStretch(); | 635 | layout->addStretch(); |
600 | 636 | ||
601 | label = new QLabel( tr( "Location:" ), this ); | 637 | label = new QLabel( tr( "Location:" ), this ); |
@@ -606,3 +642,3 @@ OIpkgDestDlg::OIpkgDestDlg( OConfItem *dest, QWidget *parent ) | |||
606 | layout->addLayout( layout2 ); | 642 | layout->addLayout( layout2 ); |
607 | 643 | ||
608 | m_location = new QLineEdit( this ); | 644 | m_location = new QLineEdit( this ); |
@@ -615,3 +651,3 @@ OIpkgDestDlg::OIpkgDestDlg( OConfItem *dest, QWidget *parent ) | |||
615 | layout2->addWidget( btn ); | 651 | layout2->addWidget( btn ); |
616 | 652 | ||
617 | // Populate initial information | 653 | // Populate initial information |