summaryrefslogtreecommitdiff
path: root/noncore/settings/packagemanager/oipkgconfigdlg.cpp
Unidiff
Diffstat (limited to 'noncore/settings/packagemanager/oipkgconfigdlg.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/packagemanager/oipkgconfigdlg.cpp68
1 files changed, 52 insertions, 16 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
@@ -119,24 +119,31 @@ void OIpkgConfigDlg::accept()
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 = m_ipkg->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 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 );
132 } 139 }
133 140
134 // Save options configuration 141 // Save options configuration
135 int options = 0; 142 int options = 0;
136 if ( m_optForceDepends->isChecked() ) 143 if ( m_optForceDepends->isChecked() )
137 options |= FORCE_DEPENDS; 144 options |= FORCE_DEPENDS;
138 if ( m_optForceReinstall->isChecked() ) 145 if ( m_optForceReinstall->isChecked() )
139 options |= FORCE_REINSTALL; 146 options |= FORCE_REINSTALL;
140 if ( m_optForceRemove->isChecked() ) 147 if ( m_optForceRemove->isChecked() )
141 options |= FORCE_REMOVE; 148 options |= FORCE_REMOVE;
142 if ( m_optForceOverwrite->isChecked() ) 149 if ( m_optForceOverwrite->isChecked() )
@@ -288,101 +295,121 @@ void OIpkgConfigDlg::initProxyWidget()
288void OIpkgConfigDlg::initOptionsWidget() 295void OIpkgConfigDlg::initOptionsWidget()
289{ 296{
290 m_optionsWidget = new QWidget( this ); 297 m_optionsWidget = new QWidget( this );
291 298
292 // Initialize UI 299 // Initialize UI
293 QVBoxLayout *vb = new QVBoxLayout( m_optionsWidget ); 300 QVBoxLayout *vb = new QVBoxLayout( m_optionsWidget );
294 QScrollView *sv = new QScrollView( m_optionsWidget ); 301 QScrollView *sv = new QScrollView( m_optionsWidget );
295 vb->addWidget( sv, 0, 0 ); 302 vb->addWidget( sv, 0, 0 );
296 sv->setResizePolicy( QScrollView::AutoOneFit ); 303 sv->setResizePolicy( QScrollView::AutoOneFit );
297 sv->setFrameStyle( QFrame::NoFrame ); 304 sv->setFrameStyle( QFrame::NoFrame );
298 QWidget *container = new QWidget( sv->viewport() ); 305 QWidget *container = new QWidget( sv->viewport() );
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
302 m_optForceDepends = new QCheckBox( tr( "Force Depends" ), container ); 309 m_optForceDepends = new QCheckBox( tr( "Force Depends" ), container );
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
306 m_optForceReinstall = new QCheckBox( tr( "Force Reinstall" ), container ); 313 m_optForceReinstall = new QCheckBox( tr( "Force Reinstall" ), container );
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
310 m_optForceRemove = new QCheckBox( tr( "Force Remove" ), container ); 317 m_optForceRemove = new QCheckBox( tr( "Force Remove" ), container );
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
314 m_optForceOverwrite = new QCheckBox( tr( "Force Overwrite" ), container ); 321 m_optForceOverwrite = new QCheckBox( tr( "Force Overwrite" ), container );
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
322 m_optVerboseIpkg = new QComboBox( container ); 329 m_optVerboseIpkg = new QComboBox( container );
323 QWhatsThis::add( m_optVerboseIpkg, tr( "Select information level for Ipkg." ) ); 330 QWhatsThis::add( m_optVerboseIpkg, tr( "Select information level for Ipkg." ) );
324 m_optVerboseIpkg->insertItem( tr( "Errors only" ) ); 331 m_optVerboseIpkg->insertItem( tr( "Errors only" ) );
325 m_optVerboseIpkg->insertItem( tr( "Normal messages" ) ); 332 m_optVerboseIpkg->insertItem( tr( "Normal messages" ) );
326 m_optVerboseIpkg->insertItem( tr( "Informative messages" ) ); 333 m_optVerboseIpkg->insertItem( tr( "Informative messages" ) );
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
330 layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); 350 layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ) );
331} 351}
332 352
333void OIpkgConfigDlg::initData() 353void OIpkgConfigDlg::initData()
334{ 354{
335 // Read ipkg configuration (server/destination/proxy) information 355 // Read ipkg configuration (server/destination/proxy) information
336 if ( m_ipkg && !m_installOptions ) 356 if ( m_ipkg && !m_installOptions )
337 { 357 {
338 m_configs = m_ipkg->configItems(); 358 m_configs = m_ipkg->configItems();
339 if ( m_configs ) 359 if ( m_configs )
340 { 360 {
341 for ( OConfItemListIterator configIt( *m_configs ); configIt.current(); ++configIt ) 361 for ( OConfItemListIterator configIt( *m_configs ); configIt.current(); ++configIt )
342 { 362 {
343 OConfItem *config = configIt.current(); 363 OConfItem *config = configIt.current();
344 364
345 // Add configuration item to the appropriate dialog controls 365 // Add configuration item to the appropriate dialog controls
346 if ( config ) 366 if ( config )
347 { 367 {
348 if ( config->type() == OConfItem::Source ) 368 switch ( config->type() )
349 {
350 m_serverList->insertItem( config->name() );
351 }
352 else if ( config->type() == OConfItem::Destination )
353 { 369 {
354 m_destList->insertItem( config->name() ); 370 case OConfItem::Source : m_serverList->insertItem( config->name() ); break;
355 } 371 case OConfItem::Destination : m_destList->insertItem( config->name() ); break;
356 else if ( config->type() == OConfItem::Option ) 372 case OConfItem::Option :
357 { 373 {
358 if ( config->name() == "http_proxy" ) 374 if ( config->name() == "http_proxy" )
359 { 375 {
360 m_proxyHttpServer->setText( config->value() ); 376 m_proxyHttpServer->setText( config->value() );
361 m_proxyHttpActive->setChecked( config->active() ); 377 m_proxyHttpActive->setChecked( config->active() );
362 } 378 }
363 else if ( config->name() == "ftp_proxy" ) 379 else if ( config->name() == "ftp_proxy" )
364 { 380 {
365 m_proxyFtpServer->setText( config->value() ); 381 m_proxyFtpServer->setText( config->value() );
366 m_proxyFtpActive->setChecked( config->active() ); 382 m_proxyFtpActive->setChecked( config->active() );
367 } 383 }
368 else if ( config->name() == "proxy_username" ) 384 else if ( config->name() == "proxy_username" )
369 { 385 {
370 m_proxyUsername->setText( config->value() ); 386 m_proxyUsername->setText( config->value() );
371 } 387 }
372 else if ( config->name() == "proxy_password" ) 388 else if ( config->name() == "proxy_password" )
373 { 389 {
374 m_proxyPassword->setText( config->value() ); 390 m_proxyPassword->setText( config->value() );
375 } 391 }
376 } 392 }
393 break;
394 case OConfItem::Other :
395 {
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 }
378 } 405 }
379 } 406 }
380 } 407 }
381 408
382 // Get Ipkg execution options 409 // Get Ipkg execution options
383 int options = m_ipkg->ipkgExecOptions(); 410 int options = m_ipkg->ipkgExecOptions();
384 if ( options & FORCE_DEPENDS ) 411 if ( options & FORCE_DEPENDS )
385 m_optForceDepends->setChecked( true ); 412 m_optForceDepends->setChecked( true );
386 if ( options & FORCE_REINSTALL ) 413 if ( options & FORCE_REINSTALL )
387 m_optForceReinstall->setChecked( true ); 414 m_optForceReinstall->setChecked( true );
388 if ( options & FORCE_REMOVE ) 415 if ( options & FORCE_REMOVE )
@@ -504,24 +531,33 @@ void OIpkgConfigDlg::slotDestDelete()
504{ 531{
505 // Find selected destination in list 532 // Find selected destination in list
506 OConfItem *destination = m_ipkg->findConfItem( OConfItem::Destination, m_destList->currentText() ); 533 OConfItem *destination = m_ipkg->findConfItem( OConfItem::Destination, m_destList->currentText() );
507 534
508 // Delete destination 535 // Delete destination
509 if ( destination ) 536 if ( destination )
510 { 537 {
511 m_configs->removeRef( destination ); 538 m_configs->removeRef( destination );
512 m_destList->removeItem( m_destCurrent ); 539 m_destList->removeItem( m_destCurrent );
513 } 540 }
514} 541}
515 542
543void 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
516OIpkgServerDlg::OIpkgServerDlg( OConfItem *server, QWidget *parent ) 552OIpkgServerDlg::OIpkgServerDlg( OConfItem *server, QWidget *parent )
517 : QDialog( parent, QString::null, true, WStyle_ContextHelp ) 553 : QDialog( parent, QString::null, true, WStyle_ContextHelp )
518 , m_server( server ) 554 , m_server( server )
519{ 555{
520 setCaption( tr( "Edit Server" ) ); 556 setCaption( tr( "Edit Server" ) );
521 557
522 // Initialize UI 558 // Initialize UI
523 QVBoxLayout *layout = new QVBoxLayout( this, 2, 4 ); 559 QVBoxLayout *layout = new QVBoxLayout( this, 2, 4 );
524 560
525 m_active = new QCheckBox( tr( "Active" ), this ); 561 m_active = new QCheckBox( tr( "Active" ), this );
526 QWhatsThis::add( m_active, tr( "Tap here to indicate whether this entry is active or not." ) ); 562 QWhatsThis::add( m_active, tr( "Tap here to indicate whether this entry is active or not." ) );
527 layout->addWidget( m_active ); 563 layout->addWidget( m_active );