Diffstat (limited to 'noncore/settings/packagemanager/oipkgconfigdlg.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/packagemanager/oipkgconfigdlg.cpp | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/noncore/settings/packagemanager/oipkgconfigdlg.cpp b/noncore/settings/packagemanager/oipkgconfigdlg.cpp index 58c572b..d014378 100644 --- a/noncore/settings/packagemanager/oipkgconfigdlg.cpp +++ b/noncore/settings/packagemanager/oipkgconfigdlg.cpp | |||
@@ -129,48 +129,52 @@ void OIpkgConfigDlg::accept() | |||
129 | 129 | ||
130 | QString listsDir = m_optSourceLists->text(); | 130 | QString listsDir = m_optSourceLists->text(); |
131 | if ( listsDir == QString::null || listsDir == "" ) | 131 | if ( listsDir == QString::null || listsDir == "" ) |
132 | listsDir = "/usr/lib/ipkg/lists"; // TODO - use proper libipkg define | 132 | listsDir = "/usr/lib/ipkg/lists"; // TODO - use proper libipkg define |
133 | confItem = m_ipkg->findConfItem( OConfItem::Other, "lists_dir" ); | 133 | confItem = m_ipkg->findConfItem( OConfItem::Other, "lists_dir" ); |
134 | if ( confItem ) | 134 | if ( confItem ) |
135 | confItem->setValue( listsDir ); | 135 | confItem->setValue( listsDir ); |
136 | else | 136 | else |
137 | m_configs->append( new OConfItem( OConfItem::Other, "lists_dir", | 137 | m_configs->append( new OConfItem( OConfItem::Other, "lists_dir", |
138 | listsDir, "name" ) ); | 138 | listsDir, "name" ) ); |
139 | 139 | ||
140 | m_ipkg->setConfigItems( m_configs ); | 140 | m_ipkg->setConfigItems( m_configs ); |
141 | } | 141 | } |
142 | 142 | ||
143 | // Save options configuration | 143 | // Save options configuration |
144 | int options = 0; | 144 | int options = 0; |
145 | if ( m_optForceDepends->isChecked() ) | 145 | if ( m_optForceDepends->isChecked() ) |
146 | options |= FORCE_DEPENDS; | 146 | options |= FORCE_DEPENDS; |
147 | if ( m_optForceReinstall->isChecked() ) | 147 | if ( m_optForceReinstall->isChecked() ) |
148 | options |= FORCE_REINSTALL; | 148 | options |= FORCE_REINSTALL; |
149 | if ( m_optForceRemove->isChecked() ) | 149 | if ( m_optForceRemove->isChecked() ) |
150 | options |= FORCE_REMOVE; | 150 | options |= FORCE_REMOVE; |
151 | if ( m_optForceOverwrite->isChecked() ) | 151 | if ( m_optForceOverwrite->isChecked() ) |
152 | options |= FORCE_OVERWRITE; | 152 | options |= FORCE_OVERWRITE; |
153 | if ( m_optForceRecursive->isChecked() ) | ||
154 | options |= FORCE_RECURSIVE; | ||
155 | if ( m_optVerboseWget->isChecked() ) | ||
156 | options |= FORCE_VERBOSE_WGET; | ||
153 | m_ipkg->setIpkgExecOptions( options ); | 157 | m_ipkg->setIpkgExecOptions( options ); |
154 | m_ipkg->setIpkgExecVerbosity( m_optVerboseIpkg->currentItem() ); | 158 | m_ipkg->setIpkgExecVerbosity( m_optVerboseIpkg->currentItem() ); |
155 | 159 | ||
156 | QDialog::accept(); | 160 | QDialog::accept(); |
157 | } | 161 | } |
158 | 162 | ||
159 | void OIpkgConfigDlg::reject() | 163 | void OIpkgConfigDlg::reject() |
160 | { | 164 | { |
161 | if ( m_configs ) | 165 | if ( m_configs ) |
162 | delete m_configs; | 166 | delete m_configs; |
163 | } | 167 | } |
164 | 168 | ||
165 | void OIpkgConfigDlg::initServerWidget() | 169 | void OIpkgConfigDlg::initServerWidget() |
166 | { | 170 | { |
167 | m_serverWidget = new QWidget( this ); | 171 | m_serverWidget = new QWidget( this ); |
168 | 172 | ||
169 | // Initialize UI | 173 | // Initialize UI |
170 | QVBoxLayout *vb = new QVBoxLayout( m_serverWidget ); | 174 | QVBoxLayout *vb = new QVBoxLayout( m_serverWidget ); |
171 | QScrollView *sv = new QScrollView( m_serverWidget ); | 175 | QScrollView *sv = new QScrollView( m_serverWidget ); |
172 | vb->addWidget( sv, 0, 0 ); | 176 | vb->addWidget( sv, 0, 0 ); |
173 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 177 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
174 | sv->setFrameStyle( QFrame::NoFrame ); | 178 | sv->setFrameStyle( QFrame::NoFrame ); |
175 | QWidget *container = new QWidget( sv->viewport() ); | 179 | QWidget *container = new QWidget( sv->viewport() ); |
176 | sv->addChild( container ); | 180 | sv->addChild( container ); |
@@ -315,75 +319,83 @@ void OIpkgConfigDlg::initOptionsWidget() | |||
315 | QScrollView *sv = new QScrollView( m_optionsWidget ); | 319 | QScrollView *sv = new QScrollView( m_optionsWidget ); |
316 | vb->addWidget( sv, 0, 0 ); | 320 | vb->addWidget( sv, 0, 0 ); |
317 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 321 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
318 | sv->setFrameStyle( QFrame::NoFrame ); | 322 | sv->setFrameStyle( QFrame::NoFrame ); |
319 | QWidget *container = new QWidget( sv->viewport() ); | 323 | QWidget *container = new QWidget( sv->viewport() ); |
320 | sv->addChild( container ); | 324 | sv->addChild( container ); |
321 | QGridLayout *layout = new QGridLayout( container, 8, 2, 2, 4 ); | 325 | QGridLayout *layout = new QGridLayout( container, 8, 2, 2, 4 ); |
322 | 326 | ||
323 | m_optForceDepends = new QCheckBox( tr( "Force Depends" ), container ); | 327 | m_optForceDepends = new QCheckBox( tr( "Force Depends" ), container ); |
324 | QWhatsThis::add( m_optForceDepends, tr( "Tap here to enable or disable the '-force-depends' option for Ipkg." ) ); | 328 | QWhatsThis::add( m_optForceDepends, tr( "Tap here to enable or disable the '-force-depends' option for Ipkg." ) ); |
325 | layout->addMultiCellWidget( m_optForceDepends, 0, 0, 0, 1 ); | 329 | layout->addMultiCellWidget( m_optForceDepends, 0, 0, 0, 1 ); |
326 | 330 | ||
327 | m_optForceReinstall = new QCheckBox( tr( "Force Reinstall" ), container ); | 331 | m_optForceReinstall = new QCheckBox( tr( "Force Reinstall" ), container ); |
328 | QWhatsThis::add( m_optForceReinstall, tr( "Tap here to enable or disable the '-force-reinstall' option for Ipkg." ) ); | 332 | QWhatsThis::add( m_optForceReinstall, tr( "Tap here to enable or disable the '-force-reinstall' option for Ipkg." ) ); |
329 | layout->addMultiCellWidget( m_optForceReinstall, 1, 1, 0, 1 ); | 333 | layout->addMultiCellWidget( m_optForceReinstall, 1, 1, 0, 1 ); |
330 | 334 | ||
331 | m_optForceRemove = new QCheckBox( tr( "Force Remove" ), container ); | 335 | m_optForceRemove = new QCheckBox( tr( "Force Remove" ), container ); |
332 | QWhatsThis::add( m_optForceRemove, tr( "Tap here to enable or disable the '-force-removal-of-dependent-packages' option for Ipkg." ) ); | 336 | QWhatsThis::add( m_optForceRemove, tr( "Tap here to enable or disable the '-force-removal-of-dependent-packages' option for Ipkg." ) ); |
333 | layout->addMultiCellWidget( m_optForceRemove, 2, 2, 0, 1 ); | 337 | layout->addMultiCellWidget( m_optForceRemove, 2, 2, 0, 1 ); |
334 | 338 | ||
335 | m_optForceOverwrite = new QCheckBox( tr( "Force Overwrite" ), container ); | 339 | m_optForceOverwrite = new QCheckBox( tr( "Force Overwrite" ), container ); |
336 | QWhatsThis::add( m_optForceOverwrite, tr( "Tap here to enable or disable the '-force-overwrite' option for Ipkg." ) ); | 340 | QWhatsThis::add( m_optForceOverwrite, tr( "Tap here to enable or disable the '-force-overwrite' option for Ipkg." ) ); |
337 | layout->addMultiCellWidget( m_optForceOverwrite, 3, 3, 0, 1 ); | 341 | layout->addMultiCellWidget( m_optForceOverwrite, 3, 3, 0, 1 ); |
338 | 342 | ||
343 | m_optForceRecursive = new QCheckBox( tr( "Force Recursive" ), container ); | ||
344 | QWhatsThis::add( m_optForceRecursive, tr( "Tap here to enable or disable the '-recursive' option for Ipkg." ) ); | ||
345 | layout->addMultiCellWidget( m_optForceRecursive, 4, 4, 0, 1 ); | ||
346 | |||
347 | m_optVerboseWget = new QCheckBox( tr( "Verbose fetch" ), container ); | ||
348 | QWhatsThis::add( m_optVerboseWget, tr( "Tap here to enable or disable the '-verbose_wget' option for Ipkg." ) ); | ||
349 | layout->addMultiCellWidget( m_optVerboseWget, 5, 5, 0, 1 ); | ||
350 | |||
339 | QLabel *l = new QLabel( tr( "Information level:" ), container ); | 351 | QLabel *l = new QLabel( tr( "Information level:" ), container ); |
340 | QWhatsThis::add( l, tr( "Select information level for Ipkg." ) ); | 352 | QWhatsThis::add( l, tr( "Select information level for Ipkg." ) ); |
341 | layout->addMultiCellWidget( l, 4, 4, 0, 1 ); | 353 | layout->addMultiCellWidget( l, 6, 6, 0, 1 ); |
342 | 354 | ||
343 | m_optVerboseIpkg = new QComboBox( container ); | 355 | m_optVerboseIpkg = new QComboBox( container ); |
344 | QWhatsThis::add( m_optVerboseIpkg, tr( "Select information level for Ipkg." ) ); | 356 | QWhatsThis::add( m_optVerboseIpkg, tr( "Select information level for Ipkg." ) ); |
345 | m_optVerboseIpkg->insertItem( tr( "Errors only" ) ); | 357 | m_optVerboseIpkg->insertItem( tr( "Errors only" ) ); |
346 | m_optVerboseIpkg->insertItem( tr( "Normal messages" ) ); | 358 | m_optVerboseIpkg->insertItem( tr( "Normal messages" ) ); |
347 | m_optVerboseIpkg->insertItem( tr( "Informative messages" ) ); | 359 | m_optVerboseIpkg->insertItem( tr( "Informative messages" ) ); |
348 | m_optVerboseIpkg->insertItem( tr( "Troubleshooting output" ) ); | 360 | m_optVerboseIpkg->insertItem( tr( "Troubleshooting output" ) ); |
349 | layout->addMultiCellWidget( m_optVerboseIpkg, 5, 5, 0, 1 ); | 361 | layout->addMultiCellWidget( m_optVerboseIpkg, 7, 7, 0, 1 ); |
350 | 362 | ||
351 | l = new QLabel( tr( "Package source lists directory:" ), container ); | 363 | l = new QLabel( tr( "Package source lists directory:" ), container ); |
352 | QWhatsThis::add( l, tr( "Enter the directory where package source feed information is stored." ) ); | 364 | QWhatsThis::add( l, tr( "Enter the directory where package source feed information is stored." ) ); |
353 | layout->addMultiCellWidget( l, 6, 6, 0, 1 ); | 365 | layout->addMultiCellWidget( l, 8, 8, 0, 1 ); |
354 | 366 | ||
355 | m_optSourceLists = new QLineEdit( container ); | 367 | m_optSourceLists = new QLineEdit( container ); |
356 | QWhatsThis::add( m_optSourceLists, tr( "Enter the directory where package source feed information is stored." ) ); | 368 | QWhatsThis::add( m_optSourceLists, tr( "Enter the directory where package source feed information is stored." ) ); |
357 | layout->addWidget( m_optSourceLists, 7, 0 ); | 369 | layout->addWidget( m_optSourceLists, 9, 0 ); |
358 | 370 | ||
359 | QPushButton *btn = new QPushButton( Opie::Core::OResource::loadPixmap( "folder", Opie::Core::OResource::SmallIcon ), | 371 | QPushButton *btn = new QPushButton( Opie::Core::OResource::loadPixmap( "folder", Opie::Core::OResource::SmallIcon ), |
360 | QString::null, container ); | 372 | QString::null, container ); |
361 | btn->setMinimumHeight( AppLnk::smallIconSize()+4 ); | 373 | btn->setMinimumHeight( AppLnk::smallIconSize()+4 ); |
362 | btn->setMaximumWidth( btn->height() ); | 374 | btn->setMaximumWidth( btn->height() ); |
363 | QWhatsThis::add( btn, tr( "Tap here to select the directory where package source feed information is stored." ) ); | 375 | QWhatsThis::add( btn, tr( "Tap here to select the directory where package source feed information is stored." ) ); |
364 | connect( btn, SIGNAL(clicked()), this, SLOT(slotOptSelectSourceListsPath()) ); | 376 | connect( btn, SIGNAL(clicked()), this, SLOT(slotOptSelectSourceListsPath()) ); |
365 | layout->addWidget( btn, 7, 1 ); | 377 | layout->addWidget( btn, 9, 1 ); |
366 | 378 | ||
367 | layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); | 379 | layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); |
368 | } | 380 | } |
369 | 381 | ||
370 | void OIpkgConfigDlg::initData() | 382 | void OIpkgConfigDlg::initData() |
371 | { | 383 | { |
372 | // Read ipkg configuration (server/destination/proxy) information | 384 | // Read ipkg configuration (server/destination/proxy) information |
373 | if ( m_ipkg && !m_installOptions ) | 385 | if ( m_ipkg && !m_installOptions ) |
374 | { | 386 | { |
375 | m_configs = m_ipkg->configItems(); | 387 | m_configs = m_ipkg->configItems(); |
376 | if ( m_configs ) | 388 | if ( m_configs ) |
377 | { | 389 | { |
378 | for ( OConfItemListIterator configIt( *m_configs ); configIt.current(); ++configIt ) | 390 | for ( OConfItemListIterator configIt( *m_configs ); configIt.current(); ++configIt ) |
379 | { | 391 | { |
380 | OConfItem *config = configIt.current(); | 392 | OConfItem *config = configIt.current(); |
381 | 393 | ||
382 | // Add configuration item to the appropriate dialog controls | 394 | // Add configuration item to the appropriate dialog controls |
383 | if ( config ) | 395 | if ( config ) |
384 | { | 396 | { |
385 | switch ( config->type() ) | 397 | switch ( config->type() ) |
386 | { | 398 | { |
387 | case OConfItem::Source : m_serverList->insertItem( config->name() ); break; | 399 | case OConfItem::Source : m_serverList->insertItem( config->name() ); break; |
388 | case OConfItem::Destination : m_destList->insertItem( config->name() ); break; | 400 | case OConfItem::Destination : m_destList->insertItem( config->name() ); break; |
389 | case OConfItem::Option : | 401 | case OConfItem::Option : |
@@ -412,48 +424,52 @@ void OIpkgConfigDlg::initData() | |||
412 | { | 424 | { |
413 | if ( config->name() == "lists_dir" ) | 425 | if ( config->name() == "lists_dir" ) |
414 | m_optSourceLists->setText( config->value() ); | 426 | m_optSourceLists->setText( config->value() ); |
415 | else // TODO - use proper libipkg define | 427 | else // TODO - use proper libipkg define |
416 | m_optSourceLists->setText( "/usr/lib/ipkg/lists" ); | 428 | m_optSourceLists->setText( "/usr/lib/ipkg/lists" ); |
417 | } | 429 | } |
418 | break; | 430 | break; |
419 | default : break; | 431 | default : break; |
420 | }; | 432 | }; |
421 | } | 433 | } |
422 | } | 434 | } |
423 | } | 435 | } |
424 | } | 436 | } |
425 | 437 | ||
426 | // Get Ipkg execution options | 438 | // Get Ipkg execution options |
427 | int options = m_ipkg->ipkgExecOptions(); | 439 | int options = m_ipkg->ipkgExecOptions(); |
428 | if ( options & FORCE_DEPENDS ) | 440 | if ( options & FORCE_DEPENDS ) |
429 | m_optForceDepends->setChecked( true ); | 441 | m_optForceDepends->setChecked( true ); |
430 | if ( options & FORCE_REINSTALL ) | 442 | if ( options & FORCE_REINSTALL ) |
431 | m_optForceReinstall->setChecked( true ); | 443 | m_optForceReinstall->setChecked( true ); |
432 | if ( options & FORCE_REMOVE ) | 444 | if ( options & FORCE_REMOVE ) |
433 | m_optForceRemove->setChecked( true ); | 445 | m_optForceRemove->setChecked( true ); |
434 | if ( options & FORCE_OVERWRITE ) | 446 | if ( options & FORCE_OVERWRITE ) |
435 | m_optForceOverwrite->setChecked( true ); | 447 | m_optForceOverwrite->setChecked( true ); |
448 | if ( options & FORCE_RECURSIVE ) | ||
449 | m_optForceRecursive->setChecked( true ); | ||
450 | if ( options & FORCE_VERBOSE_WGET ) | ||
451 | m_optVerboseWget->setChecked( true ); | ||
436 | 452 | ||
437 | m_optVerboseIpkg->setCurrentItem( m_ipkg->ipkgExecVerbosity() ); | 453 | m_optVerboseIpkg->setCurrentItem( m_ipkg->ipkgExecVerbosity() ); |
438 | } | 454 | } |
439 | 455 | ||
440 | void OIpkgConfigDlg::slotServerSelected( int index ) | 456 | void OIpkgConfigDlg::slotServerSelected( int index ) |
441 | { | 457 | { |
442 | m_serverCurrent = index; | 458 | m_serverCurrent = index; |
443 | 459 | ||
444 | // Enable Edit and Delete buttons | 460 | // Enable Edit and Delete buttons |
445 | m_serverEditBtn->setEnabled( true ); | 461 | m_serverEditBtn->setEnabled( true ); |
446 | m_serverDeleteBtn->setEnabled( true ); | 462 | m_serverDeleteBtn->setEnabled( true ); |
447 | } | 463 | } |
448 | 464 | ||
449 | void OIpkgConfigDlg::slotServerNew() | 465 | void OIpkgConfigDlg::slotServerNew() |
450 | { | 466 | { |
451 | OConfItem *server = new OConfItem( OConfItem::Source ); | 467 | OConfItem *server = new OConfItem( OConfItem::Source ); |
452 | 468 | ||
453 | OIpkgServerDlg dlg( server, this ); | 469 | OIpkgServerDlg dlg( server, this ); |
454 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) | 470 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) |
455 | { | 471 | { |
456 | // Add to configuration option list | 472 | // Add to configuration option list |
457 | m_configs->append( server ); | 473 | m_configs->append( server ); |
458 | m_configs->sort(); | 474 | m_configs->sort(); |
459 | 475 | ||