-rw-r--r-- | noncore/settings/packagemanager/oipkgconfigdlg.cpp | 244 | ||||
-rw-r--r-- | noncore/settings/packagemanager/oipkgconfigdlg.h | 47 |
2 files changed, 157 insertions, 134 deletions
diff --git a/noncore/settings/packagemanager/oipkgconfigdlg.cpp b/noncore/settings/packagemanager/oipkgconfigdlg.cpp index 6805863..77ad220 100644 --- a/noncore/settings/packagemanager/oipkgconfigdlg.cpp +++ b/noncore/settings/packagemanager/oipkgconfigdlg.cpp | |||
@@ -46,19 +46,17 @@ _;:, .> :=|. This program is free software; you can | |||
46 | #include <qscrollview.h> | 46 | #include <qscrollview.h> |
47 | #include <qwhatsthis.h> | 47 | #include <qwhatsthis.h> |
48 | 48 | ||
49 | OIpkgConfigDlg::OIpkgConfigDlg( OIpkg *ipkg, bool installOptions, QWidget *parent ) | 49 | OIpkgConfigDlg::OIpkgConfigDlg( OIpkg *ipkg, bool installOptions, QWidget *parent ) |
50 | : QDialog( parent, QString::null, true, WStyle_ContextHelp ) | 50 | : QDialog( parent, QString::null, true, WStyle_ContextHelp ) |
51 | , m_ipkg( ipkg ) | 51 | , m_ipkg( ipkg ) |
52 | , m_configs( 0l ) | 52 | , m_configs( 0l ) |
53 | , m_installOptions( installOptions ) | 53 | , m_installOptions( installOptions ) |
54 | , m_serverNew( false ) | ||
55 | , m_serverCurrent( -1 ) | 54 | , m_serverCurrent( -1 ) |
56 | , m_destNew( false ) | ||
57 | , m_destCurrent( -1 ) | 55 | , m_destCurrent( -1 ) |
58 | , m_layout( this, 2, 4 ) | 56 | , m_layout( this, 2, 4 ) |
59 | , m_tabWidget( this ) | 57 | , m_tabWidget( this ) |
60 | { | 58 | { |
61 | setCaption( tr( "Configuration" ) ); | 59 | setCaption( tr( "Configuration" ) ); |
62 | 60 | ||
63 | // Initialize configuration widgets | 61 | // Initialize configuration widgets |
64 | if ( !installOptions ) | 62 | if ( !installOptions ) |
@@ -168,17 +166,17 @@ void OIpkgConfigDlg::initServerWidget() | |||
168 | QWidget *container = new QWidget( sv->viewport() ); | 166 | QWidget *container = new QWidget( sv->viewport() ); |
169 | sv->addChild( container ); | 167 | sv->addChild( container ); |
170 | QGridLayout *layout = new QGridLayout( container, 2, 3, 2, 4 ); | 168 | QGridLayout *layout = new QGridLayout( container, 2, 3, 2, 4 ); |
171 | 169 | ||
172 | m_serverList = new QListBox( container ); | 170 | m_serverList = new QListBox( container ); |
173 | QWhatsThis::add( m_serverList, tr( "This is a list of all servers configured. Select one here to edit or delete, or add a new one below." ) ); | 171 | QWhatsThis::add( m_serverList, tr( "This is a list of all servers configured. Select one here to edit or delete, or add a new one below." ) ); |
174 | m_serverList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); | 172 | m_serverList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); |
175 | connect( m_serverList, SIGNAL(highlighted(int)), this, SLOT(slotServerSelected(int)) ); | 173 | connect( m_serverList, SIGNAL(highlighted(int)), this, SLOT(slotServerSelected(int)) ); |
176 | layout->addMultiCellWidget( m_serverList, 0, 0, 0, 1 ); | 174 | layout->addMultiCellWidget( m_serverList, 0, 0, 0, 2 ); |
177 | 175 | ||
178 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); | 176 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); |
179 | QWhatsThis::add( btn, tr( "Tap here to create a new entry. Fill in the fields below and then tap on Update." ) ); | 177 | QWhatsThis::add( btn, tr( "Tap here to create a new entry. Fill in the fields below and then tap on Update." ) ); |
180 | connect( btn, SIGNAL(clicked()), this, SLOT(slotServerNew()) ); | 178 | connect( btn, SIGNAL(clicked()), this, SLOT(slotServerNew()) ); |
181 | layout->addWidget( btn, 1, 0 ); | 179 | layout->addWidget( btn, 1, 0 ); |
182 | 180 | ||
183 | m_serverEditBtn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), container ); | 181 | m_serverEditBtn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), container ); |
184 | m_serverEditBtn->setEnabled( false ); | 182 | m_serverEditBtn->setEnabled( false ); |
@@ -200,68 +198,40 @@ void OIpkgConfigDlg::initDestinationWidget() | |||
200 | // Initialize UI | 198 | // Initialize UI |
201 | QVBoxLayout *vb = new QVBoxLayout( m_destWidget ); | 199 | QVBoxLayout *vb = new QVBoxLayout( m_destWidget ); |
202 | QScrollView *sv = new QScrollView( m_destWidget ); | 200 | QScrollView *sv = new QScrollView( m_destWidget ); |
203 | vb->addWidget( sv, 0, 0 ); | 201 | vb->addWidget( sv, 0, 0 ); |
204 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 202 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
205 | sv->setFrameStyle( QFrame::NoFrame ); | 203 | sv->setFrameStyle( QFrame::NoFrame ); |
206 | QWidget *container = new QWidget( sv->viewport() ); | 204 | QWidget *container = new QWidget( sv->viewport() ); |
207 | sv->addChild( container ); | 205 | sv->addChild( container ); |
208 | QGridLayout *layout = new QGridLayout( container, 3, 2, 2, 4 ); | 206 | QGridLayout *layout = new QGridLayout( container, 2, 3, 2, 4 ); |
209 | 207 | ||
210 | m_destList = new QListBox( container ); | 208 | m_destList = new QListBox( container ); |
211 | QWhatsThis::add( m_destList, tr( "This is a list of all destinations configured for this device. Select one here to edit or delete, or add a new one below." ) ); | 209 | QWhatsThis::add( m_destList, tr( "This is a list of all destinations configured for this device. Select one here to edit or delete, or add a new one below." ) ); |
212 | m_destList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); | 210 | m_destList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); |
213 | connect( m_destList, SIGNAL(highlighted(int)), this, SLOT(slotDestEdit(int)) ); | 211 | connect( m_destList, SIGNAL(highlighted(int)), this, SLOT(slotDestSelected(int)) ); |
214 | layout->addMultiCellWidget( m_destList, 0, 0, 0, 1 ); | 212 | layout->addMultiCellWidget( m_destList, 0, 0, 0, 2 ); |
215 | 213 | ||
216 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); | 214 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); |
217 | QWhatsThis::add( btn, tr( "Tap here to create a new entry. Fill in the fields below and then tap on Update." ) ); | 215 | QWhatsThis::add( btn, tr( "Tap here to create a new entry. Fill in the fields below and then tap on Update." ) ); |
218 | connect( btn, SIGNAL(clicked()), this, SLOT(slotDestNew()) ); | 216 | connect( btn, SIGNAL(clicked()), this, SLOT(slotDestNew()) ); |
219 | layout->addWidget( btn, 1, 0 ); | 217 | layout->addWidget( btn, 1, 0 ); |
220 | 218 | ||
221 | btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); | 219 | m_destEditBtn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), container ); |
222 | QWhatsThis::add( btn, tr( "Tap here to delete the entry selected above." ) ); | 220 | m_destEditBtn->setEnabled( false ); |
223 | connect( btn, SIGNAL(clicked()), this, SLOT(slotDestDelete()) ); | 221 | QWhatsThis::add( m_destEditBtn, tr( "Tap here to edit the entry selected above." ) ); |
224 | layout->addWidget( btn, 1, 1 ); | 222 | connect( m_destEditBtn, SIGNAL(clicked()), this, SLOT(slotDestEdit()) ); |
225 | 223 | layout->addWidget( m_destEditBtn, 1, 1 ); | |
226 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Destination" ), container ); | 224 | |
227 | grpbox->layout()->setSpacing( 2 ); | 225 | m_destDeleteBtn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); |
228 | grpbox->layout()->setMargin( 4 ); | 226 | m_destDeleteBtn->setEnabled( false ); |
229 | layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 ); | 227 | QWhatsThis::add( m_destDeleteBtn, tr( "Tap here to delete the entry selected above." ) ); |
230 | 228 | connect( m_destDeleteBtn, SIGNAL(clicked()), this, SLOT(slotDestDelete()) ); | |
231 | QGridLayout *grplayout = new QGridLayout( grpbox->layout() ); | 229 | layout->addWidget( m_destDeleteBtn, 1, 2 ); |
232 | |||
233 | QLabel *label = new QLabel( tr( "Name:" ), grpbox ); | ||
234 | QWhatsThis::add( label, tr( "Enter the name of this entry here." ) ); | ||
235 | grplayout->addWidget( label, 0, 0 ); | ||
236 | m_destName = new QLineEdit( grpbox ); | ||
237 | QWhatsThis::add( m_destName, tr( "Enter the name of this entry here." ) ); | ||
238 | grplayout->addMultiCellWidget( m_destName, 0, 0, 1, 2 ); | ||
239 | |||
240 | label = new QLabel( tr( "Location:" ), grpbox ); | ||
241 | QWhatsThis::add( label, tr( "Enter the absolute directory path of this entry here." ) ); | ||
242 | grplayout->addWidget( label, 1, 0 ); | ||
243 | m_destLocation = new QLineEdit( grpbox ); | ||
244 | QWhatsThis::add( m_destLocation, tr( "Enter the absolute directory path of this entry here." ) ); | ||
245 | grplayout->addWidget( m_destLocation, 1, 1 ); | ||
246 | btn = new QPushButton( Resource::loadPixmap( "folder" ), QString::null, grpbox ); | ||
247 | btn->setMaximumWidth( btn->height() ); | ||
248 | QWhatsThis::add( btn, tr( "Tap here to select the desired location." ) ); | ||
249 | connect( btn, SIGNAL(clicked()), this, SLOT(slotDestSelectPath()) ); | ||
250 | grplayout->addWidget( btn, 1, 2 ); | ||
251 | |||
252 | m_destActive = new QCheckBox( tr( "Active" ), grpbox ); | ||
253 | QWhatsThis::add( m_destActive, tr( "Tap here to indicate whether this entry is active or not." ) ); | ||
254 | grplayout->addMultiCellWidget( m_destActive, 2, 2, 0, 2 ); | ||
255 | |||
256 | btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox ); | ||
257 | QWhatsThis::add( btn, tr( "Tap here to update the entry's information." ) ); | ||
258 | connect( btn, SIGNAL(clicked()), this, SLOT(slotDestUpdate()) ); | ||
259 | grplayout->addMultiCellWidget( btn, 3, 3, 0, 2 ); | ||
260 | } | 230 | } |
261 | 231 | ||
262 | void OIpkgConfigDlg::initProxyWidget() | 232 | void OIpkgConfigDlg::initProxyWidget() |
263 | { | 233 | { |
264 | m_proxyWidget = new QWidget( this ); | 234 | m_proxyWidget = new QWidget( this ); |
265 | 235 | ||
266 | // Initialize UI | 236 | // Initialize UI |
267 | QVBoxLayout *vb = new QVBoxLayout( m_proxyWidget ); | 237 | QVBoxLayout *vb = new QVBoxLayout( m_proxyWidget ); |
@@ -469,17 +439,17 @@ void OIpkgConfigDlg::slotServerNew() | |||
469 | delete server; | 439 | delete server; |
470 | } | 440 | } |
471 | 441 | ||
472 | void OIpkgConfigDlg::slotServerEdit() | 442 | void OIpkgConfigDlg::slotServerEdit() |
473 | { | 443 | { |
474 | // Find selected server in list | 444 | // Find selected server in list |
475 | OConfItem *server = findConfItem( OConfItem::Source, m_serverList->currentText() ); | 445 | OConfItem *server = findConfItem( OConfItem::Source, m_serverList->currentText() ); |
476 | 446 | ||
477 | // Delete server | 447 | // Edit server |
478 | if ( server ) | 448 | if ( server ) |
479 | { | 449 | { |
480 | QString origName = server->name(); | 450 | QString origName = server->name(); |
481 | OIpkgServerDlg dlg( server, this ); | 451 | OIpkgServerDlg dlg( server, this ); |
482 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) | 452 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) |
483 | { | 453 | { |
484 | // Check to see if name has changed, if so update the server list | 454 | // Check to see if name has changed, if so update the server list |
485 | if ( server->name() != origName ) | 455 | if ( server->name() != origName ) |
@@ -496,114 +466,81 @@ void OIpkgConfigDlg::slotServerDelete() | |||
496 | // Delete server | 466 | // Delete server |
497 | if ( server ) | 467 | if ( server ) |
498 | { | 468 | { |
499 | m_configs->removeRef( server ); | 469 | m_configs->removeRef( server ); |
500 | m_serverList->removeItem( m_serverCurrent ); | 470 | m_serverList->removeItem( m_serverCurrent ); |
501 | } | 471 | } |
502 | } | 472 | } |
503 | 473 | ||
504 | void OIpkgConfigDlg::slotDestEdit( int index ) | 474 | void OIpkgConfigDlg::slotDestSelected( int index ) |
505 | { | 475 | { |
506 | m_destNew = false; | ||
507 | m_destCurrent = index; | 476 | m_destCurrent = index; |
477 | |||
478 | // Enable Edit and Delete buttons | ||
479 | m_destEditBtn->setEnabled( true ); | ||
480 | m_destDeleteBtn->setEnabled( true ); | ||
481 | } | ||
508 | 482 | ||
509 | // Find selected destination in list | 483 | void OIpkgConfigDlg::slotDestNew() |
510 | OConfItem *destination = findConfItem( OConfItem::Destination, m_destList->currentText() ); | 484 | { |
511 | 485 | OConfItem *dest = new OConfItem( OConfItem::Destination ); | |
512 | // Display destination details | 486 | |
513 | if ( destination ) | 487 | OIpkgDestDlg dlg( dest, this ); |
488 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) | ||
514 | { | 489 | { |
515 | m_destCurrName = destination->name(); | 490 | // Add to configuration option list |
516 | m_destName->setText( destination->name() ); | 491 | m_configs->append( dest ); |
517 | m_destLocation->setText( destination->value() ); | 492 | m_configs->sort(); |
518 | m_destActive->setChecked( destination->active() ); | 493 | |
519 | m_destName->setFocus(); | 494 | // Add to destination list |
495 | m_destList->insertItem( dest->name() ); | ||
496 | m_destList->setCurrentItem( m_destList->count() ); | ||
520 | } | 497 | } |
498 | else | ||
499 | delete dest; | ||
521 | } | 500 | } |
522 | 501 | ||
523 | void OIpkgConfigDlg::slotDestNew() | 502 | void OIpkgConfigDlg::slotDestEdit() |
524 | { | 503 | { |
525 | m_destNew = true; | 504 | // Find selected destination in list |
505 | OConfItem *dest = findConfItem( OConfItem::Destination, m_destList->currentText() ); | ||
526 | 506 | ||
527 | m_destName->setText( QString::null ); | 507 | // Edit destination |
528 | m_destLocation->setText( QString::null ); | 508 | if ( dest ) |
529 | m_destActive->setChecked( true ); | 509 | { |
530 | m_destName->setFocus(); | 510 | QString origName = dest->name(); |
511 | OIpkgDestDlg dlg( dest, this ); | ||
512 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) | ||
513 | { | ||
514 | // Check to see if name has changed, if so update the dest list | ||
515 | if ( dest->name() != origName ) | ||
516 | m_destList->changeItem( dest->name(), m_destCurrent ); | ||
517 | } | ||
518 | } | ||
531 | } | 519 | } |
532 | 520 | ||
533 | void OIpkgConfigDlg::slotDestDelete() | 521 | void OIpkgConfigDlg::slotDestDelete() |
534 | { | 522 | { |
535 | // Find selected destination in list | 523 | // Find selected destination in list |
536 | OConfItem *destination = findConfItem( OConfItem::Destination, m_destList->currentText() ); | 524 | OConfItem *destination = findConfItem( OConfItem::Destination, m_destList->currentText() ); |
537 | 525 | ||
538 | // Delete destination | 526 | // Delete destination |
539 | if ( destination ) | 527 | if ( destination ) |
540 | { | 528 | { |
541 | m_configs->removeRef( destination ); | 529 | m_configs->removeRef( destination ); |
542 | m_destList->removeItem( m_destCurrent ); | 530 | m_destList->removeItem( m_destCurrent ); |
543 | } | 531 | } |
544 | } | 532 | } |
545 | 533 | ||
546 | void OIpkgConfigDlg::slotDestSelectPath() | ||
547 | { | ||
548 | QString path = Opie::Ui::OFileDialog::getDirectory( 0, m_destLocation->text() ); | ||
549 | if ( path.at( path.length() - 1 ) == '/' ) | ||
550 | path.truncate( path.length() - 1 ); | ||
551 | m_destLocation->setText( path ); | ||
552 | } | ||
553 | |||
554 | void OIpkgConfigDlg::slotDestUpdate() | ||
555 | { | ||
556 | QString newName = m_destName->text(); | ||
557 | |||
558 | // Convert any spaces to underscores | ||
559 | newName.replace( QRegExp( " " ), "_" ); | ||
560 | |||
561 | if ( !m_destNew ) | ||
562 | { | ||
563 | // Find selected destination in list | ||
564 | OConfItem *destination = findConfItem( OConfItem::Destination, m_destCurrName ); | ||
565 | |||
566 | // Display destination details | ||
567 | if ( destination ) | ||
568 | { | ||
569 | // Update url | ||
570 | destination->setValue( m_destLocation->text() ); | ||
571 | destination->setActive( m_destActive->isChecked() ); | ||
572 | |||
573 | // Check if destination name has changed, if it has then we need to replace the key in the map | ||
574 | if ( m_destCurrName != newName ) | ||
575 | { | ||
576 | // Update destination name | ||
577 | destination->setName( newName ); | ||
578 | |||
579 | // Update list box | ||
580 | m_destList->changeItem( newName, m_destCurrent ); | ||
581 | } | ||
582 | } | ||
583 | } | ||
584 | else | ||
585 | { | ||
586 | // Add new destination to configuration list | ||
587 | m_configs->append( new OConfItem( OConfItem::Destination, newName, | ||
588 | m_destLocation->text(), QString::null, m_destActive->isChecked() ) ); | ||
589 | m_configs->sort(); | ||
590 | |||
591 | m_destList->insertItem( newName ); | ||
592 | m_destList->setCurrentItem( m_destList->count() ); | ||
593 | m_destNew = false; | ||
594 | } | ||
595 | } | ||
596 | |||
597 | OIpkgServerDlg::OIpkgServerDlg( OConfItem *server, QWidget *parent ) | 534 | OIpkgServerDlg::OIpkgServerDlg( OConfItem *server, QWidget *parent ) |
598 | : QDialog( parent, QString::null, true, WStyle_ContextHelp ) | 535 | : QDialog( parent, QString::null, true, WStyle_ContextHelp ) |
599 | , m_server( server ) | 536 | , m_server( server ) |
600 | { | 537 | { |
601 | setCaption( tr( "Edit server" ) ); | 538 | setCaption( tr( "Edit Server" ) ); |
602 | 539 | ||
603 | // Initialize UI | 540 | // Initialize UI |
604 | QVBoxLayout *layout = new QVBoxLayout( this, 2, 4 ); | 541 | QVBoxLayout *layout = new QVBoxLayout( this, 2, 4 ); |
605 | 542 | ||
606 | m_active = new QCheckBox( tr( "Active" ), this ); | 543 | m_active = new QCheckBox( tr( "Active" ), this ); |
607 | QWhatsThis::add( m_active, tr( "Tap here to indicate whether this entry is active or not." ) ); | 544 | QWhatsThis::add( m_active, tr( "Tap here to indicate whether this entry is active or not." ) ); |
608 | layout->addWidget( m_active ); | 545 | layout->addWidget( m_active ); |
609 | 546 | ||
@@ -639,16 +576,89 @@ OIpkgServerDlg::OIpkgServerDlg( OConfItem *server, QWidget *parent ) | |||
639 | m_compressed->setChecked( m_server->features().contains( "Compressed" ) ); | 576 | m_compressed->setChecked( m_server->features().contains( "Compressed" ) ); |
640 | m_active->setChecked( m_server->active() ); | 577 | m_active->setChecked( m_server->active() ); |
641 | } | 578 | } |
642 | } | 579 | } |
643 | 580 | ||
644 | void OIpkgServerDlg::accept() | 581 | void OIpkgServerDlg::accept() |
645 | { | 582 | { |
646 | // Save information entered | 583 | // Save information entered |
647 | m_server->setName( m_name->text() ); | 584 | QString name = m_name->text(); |
585 | name.replace( QRegExp( " " ), "_" ); | ||
586 | m_server->setName( name ); | ||
648 | m_server->setValue( m_location->text() ); | 587 | m_server->setValue( m_location->text() ); |
649 | m_compressed->isChecked() ? m_server->setFeatures( "Compressed" ) | 588 | m_compressed->isChecked() ? m_server->setFeatures( "Compressed" ) |
650 | : m_server->setFeatures( QString::null ); | 589 | : m_server->setFeatures( QString::null ); |
651 | m_server->setActive( m_active->isChecked() ); | 590 | m_server->setActive( m_active->isChecked() ); |
652 | 591 | ||
653 | QDialog::accept(); | 592 | QDialog::accept(); |
654 | } | 593 | } |
594 | |||
595 | OIpkgDestDlg::OIpkgDestDlg( OConfItem *dest, QWidget *parent ) | ||
596 | : QDialog( parent, QString::null, true, WStyle_ContextHelp ) | ||
597 | , m_dest( dest ) | ||
598 | { | ||
599 | setCaption( tr( "Edit Destination" ) ); | ||
600 | |||
601 | // Initialize UI | ||
602 | QVBoxLayout *layout = new QVBoxLayout( this, 2, 4 ); | ||
603 | |||
604 | m_active = new QCheckBox( tr( "Active" ), this ); | ||
605 | QWhatsThis::add( m_active, tr( "Tap here to indicate whether this entry is active or not." ) ); | ||
606 | layout->addWidget( m_active ); | ||
607 | |||
608 | layout->addStretch(); | ||
609 | |||
610 | QLabel *label = new QLabel( tr( "Name:" ), this ); | ||
611 | QWhatsThis::add( label, tr( "Enter the name of this entry here." ) ); | ||
612 | layout->addWidget( label ); | ||
613 | m_name = new QLineEdit( this ); | ||
614 | QWhatsThis::add( m_name, tr( "Enter the name of this entry here." ) ); | ||
615 | layout->addWidget( m_name ); | ||
616 | |||
617 | layout->addStretch(); | ||
618 | |||
619 | label = new QLabel( tr( "Location:" ), this ); | ||
620 | QWhatsThis::add( label, tr( "Enter the absolute directory path of this entry here." ) ); | ||
621 | layout->addWidget( label ); | ||
622 | |||
623 | QHBoxLayout *layout2 = new QHBoxLayout( this, 2, 4 ); | ||
624 | layout->addLayout( layout2 ); | ||
625 | |||
626 | m_location = new QLineEdit( this ); | ||
627 | QWhatsThis::add( m_location, tr( "Enter the absolute directory path of this entry here." ) ); | ||
628 | layout2->addWidget( m_location ); | ||
629 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "folder" ), QString::null, this ); | ||
630 | btn->setMaximumWidth( btn->height() ); | ||
631 | QWhatsThis::add( btn, tr( "Tap here to select the desired location." ) ); | ||
632 | connect( btn, SIGNAL(clicked()), this, SLOT(slotSelectPath()) ); | ||
633 | layout2->addWidget( btn ); | ||
634 | |||
635 | // Populate initial information | ||
636 | if ( m_dest ) | ||
637 | { | ||
638 | m_name->setText( m_dest->name() ); | ||
639 | m_location->setText( m_dest->value() ); | ||
640 | m_active->setChecked( m_dest->active() ); | ||
641 | } | ||
642 | } | ||
643 | |||
644 | void OIpkgDestDlg::accept() | ||
645 | { | ||
646 | // Save information entered | ||
647 | QString name = m_name->text(); | ||
648 | name.replace( QRegExp( " " ), "_" ); | ||
649 | m_dest->setName( name ); | ||
650 | m_dest->setValue( m_location->text() ); | ||
651 | m_dest->setActive( m_active->isChecked() ); | ||
652 | |||
653 | QDialog::accept(); | ||
654 | } | ||
655 | |||
656 | void OIpkgDestDlg::slotSelectPath() | ||
657 | { | ||
658 | QString path = Opie::Ui::OFileDialog::getDirectory( 0, m_location->text() ); | ||
659 | if ( path.at( path.length() - 1 ) == '/' ) | ||
660 | path.truncate( path.length() - 1 ); | ||
661 | if ( !path.isNull() ) | ||
662 | m_location->setText( path ); | ||
663 | } | ||
664 | |||
diff --git a/noncore/settings/packagemanager/oipkgconfigdlg.h b/noncore/settings/packagemanager/oipkgconfigdlg.h index 076a181..5b7e91d 100644 --- a/noncore/settings/packagemanager/oipkgconfigdlg.h +++ b/noncore/settings/packagemanager/oipkgconfigdlg.h | |||
@@ -58,44 +58,37 @@ protected slots: | |||
58 | void reject(); | 58 | void reject(); |
59 | 59 | ||
60 | private: | 60 | private: |
61 | OIpkg *m_ipkg; // Pointer to Ipkg class for retrieving/saving configuration options | 61 | OIpkg *m_ipkg; // Pointer to Ipkg class for retrieving/saving configuration options |
62 | OConfItemList *m_configs; // Local list of configuration items | 62 | OConfItemList *m_configs; // Local list of configuration items |
63 | 63 | ||
64 | bool m_installOptions; // If true, will only display the Options tab | 64 | bool m_installOptions; // If true, will only display the Options tab |
65 | 65 | ||
66 | // Server cached information | 66 | // Server/Destination cached information |
67 | bool m_serverNew; // Indicates if server information is for a new server | 67 | int m_serverCurrent; // Index of currently selected server in m_serverList |
68 | int m_serverCurrent; // Index of currently selected server in m_serverList | 68 | int m_destCurrent; // Index of currently selected destination in m_destList |
69 | QString m_serverCurrName; // Name of currently selected server in m_serverList | ||
70 | |||
71 | // Destination cached information | ||
72 | bool m_destNew; // Indicates if destination information is for a new destination | ||
73 | int m_destCurrent; // Index of currently selected destination in m_destList | ||
74 | QString m_destCurrName; // Name of currently selected destination in m_destList | ||
75 | 69 | ||
76 | // UI controls | 70 | // UI controls |
77 | QVBoxLayout m_layout; // Main dialog layout control | 71 | QVBoxLayout m_layout; // Main dialog layout control |
78 | Opie::Ui::OTabWidget m_tabWidget; // Main tab widget control | 72 | Opie::Ui::OTabWidget m_tabWidget; // Main tab widget control |
79 | QWidget *m_serverWidget; // Widget containing server configuration controls | 73 | QWidget *m_serverWidget; // Widget containing server configuration controls |
80 | QWidget *m_destWidget; // Widget containing destination configuration controls | 74 | QWidget *m_destWidget; // Widget containing destination configuration controls |
81 | QWidget *m_proxyWidget; // Widget containing proxy configuration controls | 75 | QWidget *m_proxyWidget; // Widget containing proxy configuration controls |
82 | QWidget *m_optionsWidget; // Widget containing ipkg execution configuration controls | 76 | QWidget *m_optionsWidget; // Widget containing ipkg execution configuration controls |
83 | 77 | ||
84 | // Server configuration UI controls | 78 | // Server configuration UI controls |
85 | QListBox *m_serverList; // Server list selection | 79 | QListBox *m_serverList; // Server list selection |
86 | QPushButton *m_serverEditBtn; // Server edit button | 80 | QPushButton *m_serverEditBtn; // Server edit button |
87 | QPushButton *m_serverDeleteBtn; // Server edit button | 81 | QPushButton *m_serverDeleteBtn; // Server edit button |
88 | 82 | ||
89 | // Destination configuration UI controls | 83 | // Destination configuration UI controls |
90 | QListBox *m_destList; // Destination list selection | 84 | QListBox *m_destList; // Destination list selection |
91 | QLineEdit *m_destName; // Destination name edit box | 85 | QPushButton *m_destEditBtn; // Destination edit button |
92 | QLineEdit *m_destLocation; // Destination location URL edit box | 86 | QPushButton *m_destDeleteBtn; // Destination edit button |
93 | QCheckBox *m_destActive; // Activate destination check box | ||
94 | 87 | ||
95 | // Proxy server configuration UI controls | 88 | // Proxy server configuration UI controls |
96 | QLineEdit *m_proxyHttpServer; // HTTP proxy server URL edit box | 89 | QLineEdit *m_proxyHttpServer; // HTTP proxy server URL edit box |
97 | QCheckBox *m_proxyHttpActive; // Activate HTTP proxy check box | 90 | QCheckBox *m_proxyHttpActive; // Activate HTTP proxy check box |
98 | QLineEdit *m_proxyFtpServer; // FTP proxy server edit box | 91 | QLineEdit *m_proxyFtpServer; // FTP proxy server edit box |
99 | QCheckBox *m_proxyFtpActive; // Activate FTP proxy check box | 92 | QCheckBox *m_proxyFtpActive; // Activate FTP proxy check box |
100 | QLineEdit *m_proxyUsername; // Proxy server username edit box | 93 | QLineEdit *m_proxyUsername; // Proxy server username edit box |
101 | QLineEdit *m_proxyPassword; // Proxy server password edit box | 94 | QLineEdit *m_proxyPassword; // Proxy server password edit box |
@@ -117,23 +110,21 @@ private: | |||
117 | OConfItem *findConfItem( OConfItem::Type type = OConfItem::NotDefined, | 110 | OConfItem *findConfItem( OConfItem::Type type = OConfItem::NotDefined, |
118 | const QString &name = QString::null ); | 111 | const QString &name = QString::null ); |
119 | 112 | ||
120 | private slots: | 113 | private slots: |
121 | void slotServerSelected( int index ); | 114 | void slotServerSelected( int index ); |
122 | void slotServerNew(); | 115 | void slotServerNew(); |
123 | void slotServerEdit(); | 116 | void slotServerEdit(); |
124 | void slotServerDelete(); | 117 | void slotServerDelete(); |
125 | // void slotServerUpdate(); | ||
126 | 118 | ||
127 | void slotDestEdit( int index ); | 119 | void slotDestSelected( int index ); |
128 | void slotDestNew(); | 120 | void slotDestNew(); |
121 | void slotDestEdit(); | ||
129 | void slotDestDelete(); | 122 | void slotDestDelete(); |
130 | void slotDestSelectPath(); | ||
131 | void slotDestUpdate(); | ||
132 | }; | 123 | }; |
133 | 124 | ||
134 | class OIpkgServerDlg : public QDialog | 125 | class OIpkgServerDlg : public QDialog |
135 | { | 126 | { |
136 | Q_OBJECT | 127 | Q_OBJECT |
137 | 128 | ||
138 | public: | 129 | public: |
139 | OIpkgServerDlg( OConfItem *server = 0l, QWidget *parent = 0l ); | 130 | OIpkgServerDlg( OConfItem *server = 0l, QWidget *parent = 0l ); |
@@ -146,9 +137,31 @@ private: | |||
146 | 137 | ||
147 | // UI controls | 138 | // UI controls |
148 | QLineEdit *m_name; // Server name edit box | 139 | QLineEdit *m_name; // Server name edit box |
149 | QLineEdit *m_location; // Server location URL edit box | 140 | QLineEdit *m_location; // Server location URL edit box |
150 | QCheckBox *m_compressed; // Indicates whether the server is a 'src/gz' feed | 141 | QCheckBox *m_compressed; // Indicates whether the server is a 'src/gz' feed |
151 | QCheckBox *m_active; // Indicates whether the server is activated | 142 | QCheckBox *m_active; // Indicates whether the server is activated |
152 | }; | 143 | }; |
153 | 144 | ||
145 | class OIpkgDestDlg : public QDialog | ||
146 | { | ||
147 | Q_OBJECT | ||
148 | |||
149 | public: | ||
150 | OIpkgDestDlg( OConfItem *dest = 0l, QWidget *parent = 0l ); | ||
151 | |||
152 | protected slots: | ||
153 | void accept(); | ||
154 | |||
155 | private: | ||
156 | OConfItem *m_dest; | ||
157 | |||
158 | // UI controls | ||
159 | QLineEdit *m_name; // Destination name edit box | ||
160 | QLineEdit *m_location; // Destination location URL edit box | ||
161 | QCheckBox *m_active; // Indicates whether the destination is activated | ||
162 | |||
163 | private slots: | ||
164 | void slotSelectPath(); | ||
165 | }; | ||
166 | |||
154 | #endif | 167 | #endif |