author | drw <drw> | 2004-12-21 17:56:04 (UTC) |
---|---|---|
committer | drw <drw> | 2004-12-21 17:56:04 (UTC) |
commit | 23fa4508dabaf07a67e1e9bd9e66a7088a014ad0 (patch) (unidiff) | |
tree | 37c602b938dff7be3e2e76658497507fbf53d3eb | |
parent | 769f2a09ccfcc639a87600ecb046e9140fe2f691 (diff) | |
download | opie-23fa4508dabaf07a67e1e9bd9e66a7088a014ad0.zip opie-23fa4508dabaf07a67e1e9bd9e66a7088a014ad0.tar.gz opie-23fa4508dabaf07a67e1e9bd9e66a7088a014ad0.tar.bz2 |
Reworked server config tab UI and included option to support src/gz feeds
-rw-r--r-- | noncore/settings/packagemanager/oipkgconfigdlg.cpp | 211 | ||||
-rw-r--r-- | noncore/settings/packagemanager/oipkgconfigdlg.h | 38 |
2 files changed, 141 insertions, 108 deletions
diff --git a/noncore/settings/packagemanager/oipkgconfigdlg.cpp b/noncore/settings/packagemanager/oipkgconfigdlg.cpp index d9a67f3..6805863 100644 --- a/noncore/settings/packagemanager/oipkgconfigdlg.cpp +++ b/noncore/settings/packagemanager/oipkgconfigdlg.cpp | |||
@@ -20,48 +20,49 @@ _;:, .> :=|. This program is free software; you can | |||
20 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= = ; Library General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | 29 | ||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include "oipkgconfigdlg.h" | 32 | #include "oipkgconfigdlg.h" |
33 | 33 | ||
34 | #include <opie2/ofiledialog.h> | 34 | #include <opie2/ofiledialog.h> |
35 | 35 | ||
36 | #include <qpe/qpeapplication.h> | ||
36 | #include <qpe/resource.h> | 37 | #include <qpe/resource.h> |
37 | 38 | ||
38 | #include <qcheckbox.h> | 39 | #include <qcheckbox.h> |
39 | #include <qcombobox.h> | 40 | #include <qcombobox.h> |
40 | #include <qgroupbox.h> | 41 | #include <qgroupbox.h> |
41 | #include <qlabel.h> | 42 | #include <qlabel.h> |
42 | #include <qlineedit.h> | 43 | #include <qlineedit.h> |
43 | #include <qlistbox.h> | 44 | #include <qlistbox.h> |
44 | #include <qpushbutton.h> | 45 | #include <qpushbutton.h> |
45 | #include <qscrollview.h> | 46 | #include <qscrollview.h> |
46 | #include <qwhatsthis.h> | 47 | #include <qwhatsthis.h> |
47 | 48 | ||
48 | OIpkgConfigDlg::OIpkgConfigDlg( OIpkg *ipkg, bool installOptions, QWidget *parent ) | 49 | OIpkgConfigDlg::OIpkgConfigDlg( OIpkg *ipkg, bool installOptions, QWidget *parent ) |
49 | : QDialog( parent, QString::null, true, WStyle_ContextHelp ) | 50 | : QDialog( parent, QString::null, true, WStyle_ContextHelp ) |
50 | , m_ipkg( ipkg ) | 51 | , m_ipkg( ipkg ) |
51 | , m_configs( 0x0 ) | 52 | , m_configs( 0l ) |
52 | , m_installOptions( installOptions ) | 53 | , m_installOptions( installOptions ) |
53 | , m_serverNew( false ) | 54 | , m_serverNew( false ) |
54 | , m_serverCurrent( -1 ) | 55 | , m_serverCurrent( -1 ) |
55 | , m_destNew( false ) | 56 | , m_destNew( false ) |
56 | , m_destCurrent( -1 ) | 57 | , m_destCurrent( -1 ) |
57 | , m_layout( this, 2, 4 ) | 58 | , m_layout( this, 2, 4 ) |
58 | , m_tabWidget( this ) | 59 | , m_tabWidget( this ) |
59 | { | 60 | { |
60 | setCaption( tr( "Configuration" ) ); | 61 | setCaption( tr( "Configuration" ) ); |
61 | 62 | ||
62 | // Initialize configuration widgets | 63 | // Initialize configuration widgets |
63 | if ( !installOptions ) | 64 | if ( !installOptions ) |
64 | { | 65 | { |
65 | initServerWidget(); | 66 | initServerWidget(); |
66 | initDestinationWidget(); | 67 | initDestinationWidget(); |
67 | initProxyWidget(); | 68 | initProxyWidget(); |
@@ -153,79 +154,56 @@ void OIpkgConfigDlg::reject() | |||
153 | if ( m_configs ) | 154 | if ( m_configs ) |
154 | delete m_configs; | 155 | delete m_configs; |
155 | } | 156 | } |
156 | 157 | ||
157 | void OIpkgConfigDlg::initServerWidget() | 158 | void OIpkgConfigDlg::initServerWidget() |
158 | { | 159 | { |
159 | m_serverWidget = new QWidget( this ); | 160 | m_serverWidget = new QWidget( this ); |
160 | 161 | ||
161 | // Initialize UI | 162 | // Initialize UI |
162 | QVBoxLayout *vb = new QVBoxLayout( m_serverWidget ); | 163 | QVBoxLayout *vb = new QVBoxLayout( m_serverWidget ); |
163 | QScrollView *sv = new QScrollView( m_serverWidget ); | 164 | QScrollView *sv = new QScrollView( m_serverWidget ); |
164 | vb->addWidget( sv, 0, 0 ); | 165 | vb->addWidget( sv, 0, 0 ); |
165 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 166 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
166 | sv->setFrameStyle( QFrame::NoFrame ); | 167 | sv->setFrameStyle( QFrame::NoFrame ); |
167 | QWidget *container = new QWidget( sv->viewport() ); | 168 | QWidget *container = new QWidget( sv->viewport() ); |
168 | sv->addChild( container ); | 169 | sv->addChild( container ); |
169 | QGridLayout *layout = new QGridLayout( container, 3, 2, 2, 4 ); | 170 | QGridLayout *layout = new QGridLayout( container, 2, 3, 2, 4 ); |
170 | 171 | ||
171 | m_serverList = new QListBox( container ); | 172 | m_serverList = new QListBox( container ); |
172 | 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." ) ); | 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." ) ); |
173 | m_serverList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); | 174 | m_serverList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); |
174 | connect( m_serverList, SIGNAL(highlighted(int)), this, SLOT(slotServerEdit(int)) ); | 175 | connect( m_serverList, SIGNAL(highlighted(int)), this, SLOT(slotServerSelected(int)) ); |
175 | layout->addMultiCellWidget( m_serverList, 0, 0, 0, 1 ); | 176 | layout->addMultiCellWidget( m_serverList, 0, 0, 0, 1 ); |
176 | 177 | ||
177 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); | 178 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); |
178 | QWhatsThis::add( btn, tr( "Tap here to create a new entry. Fill in the fields below and then tap on Update." ) ); | 179 | QWhatsThis::add( btn, tr( "Tap here to create a new entry. Fill in the fields below and then tap on Update." ) ); |
179 | connect( btn, SIGNAL(clicked()), this, SLOT(slotServerNew()) ); | 180 | connect( btn, SIGNAL(clicked()), this, SLOT(slotServerNew()) ); |
180 | layout->addWidget( btn, 1, 0 ); | 181 | layout->addWidget( btn, 1, 0 ); |
181 | 182 | ||
182 | btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); | 183 | m_serverEditBtn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), container ); |
183 | QWhatsThis::add( btn, tr( "Tap here to delete the entry selected above." ) ); | 184 | m_serverEditBtn->setEnabled( false ); |
184 | connect( btn, SIGNAL(clicked()), this, SLOT(slotServerDelete()) ); | 185 | QWhatsThis::add( m_serverEditBtn, tr( "Tap here to edit the entry selected above." ) ); |
185 | layout->addWidget( btn, 1, 1 ); | 186 | connect( m_serverEditBtn, SIGNAL(clicked()), this, SLOT(slotServerEdit()) ); |
186 | 187 | layout->addWidget( m_serverEditBtn, 1, 1 ); | |
187 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Server" ), container ); | 188 | |
188 | grpbox->layout()->setSpacing( 2 ); | 189 | m_serverDeleteBtn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); |
189 | grpbox->layout()->setMargin( 4 ); | 190 | m_serverDeleteBtn->setEnabled( false ); |
190 | layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 ); | 191 | QWhatsThis::add( m_serverDeleteBtn, tr( "Tap here to delete the entry selected above." ) ); |
191 | 192 | connect( m_serverDeleteBtn, SIGNAL(clicked()), this, SLOT(slotServerDelete()) ); | |
192 | QGridLayout *grplayout = new QGridLayout( grpbox->layout() ); | 193 | layout->addWidget( m_serverDeleteBtn, 1, 2 ); |
193 | |||
194 | QLabel *label = new QLabel( tr( "Name:" ), grpbox ); | ||
195 | QWhatsThis::add( label, tr( "Enter the name of this entry here." ) ); | ||
196 | grplayout->addWidget( label, 0, 0 ); | ||
197 | m_serverName = new QLineEdit( grpbox ); | ||
198 | QWhatsThis::add( m_serverName, tr( "Enter the name of this entry here." ) ); | ||
199 | grplayout->addWidget( m_serverName, 0, 1 ); | ||
200 | |||
201 | label = new QLabel( tr( "Address:" ), grpbox ); | ||
202 | QWhatsThis::add( label, tr( "Enter the URL address of this entry here." ) ); | ||
203 | grplayout->addWidget( label, 1, 0 ); | ||
204 | m_serverLocation = new QLineEdit( grpbox ); | ||
205 | QWhatsThis::add( m_serverLocation, tr( "Enter the URL address of this entry here." ) ); | ||
206 | grplayout->addWidget( m_serverLocation, 1, 1 ); | ||
207 | |||
208 | m_serverActive = new QCheckBox( tr( "Active" ), grpbox ); | ||
209 | QWhatsThis::add( m_serverActive, tr( "Tap here to indicate whether this entry is active or not." ) ); | ||
210 | grplayout->addMultiCellWidget( m_serverActive, 2, 2, 0, 1 ); | ||
211 | |||
212 | btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox ); | ||
213 | QWhatsThis::add( btn, tr( "Tap here to update the entry's information." ) ); | ||
214 | connect( btn, SIGNAL(clicked()), this, SLOT(slotServerUpdate()) ); | ||
215 | grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 ); | ||
216 | } | 194 | } |
217 | 195 | ||
218 | void OIpkgConfigDlg::initDestinationWidget() | 196 | void OIpkgConfigDlg::initDestinationWidget() |
219 | { | 197 | { |
220 | m_destWidget = new QWidget( this ); | 198 | m_destWidget = new QWidget( this ); |
221 | 199 | ||
222 | // Initialize UI | 200 | // Initialize UI |
223 | QVBoxLayout *vb = new QVBoxLayout( m_destWidget ); | 201 | QVBoxLayout *vb = new QVBoxLayout( m_destWidget ); |
224 | QScrollView *sv = new QScrollView( m_destWidget ); | 202 | QScrollView *sv = new QScrollView( m_destWidget ); |
225 | vb->addWidget( sv, 0, 0 ); | 203 | vb->addWidget( sv, 0, 0 ); |
226 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 204 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
227 | sv->setFrameStyle( QFrame::NoFrame ); | 205 | sv->setFrameStyle( QFrame::NoFrame ); |
228 | QWidget *container = new QWidget( sv->viewport() ); | 206 | QWidget *container = new QWidget( sv->viewport() ); |
229 | sv->addChild( container ); | 207 | sv->addChild( container ); |
230 | QGridLayout *layout = new QGridLayout( container, 3, 2, 2, 4 ); | 208 | QGridLayout *layout = new QGridLayout( container, 3, 2, 2, 4 ); |
231 | 209 | ||
@@ -436,129 +414,103 @@ void OIpkgConfigDlg::initData() | |||
436 | if ( options & FORCE_DEPENDS ) | 414 | if ( options & FORCE_DEPENDS ) |
437 | m_optForceDepends->setChecked( true ); | 415 | m_optForceDepends->setChecked( true ); |
438 | if ( options & FORCE_REINSTALL ) | 416 | if ( options & FORCE_REINSTALL ) |
439 | m_optForceReinstall->setChecked( true ); | 417 | m_optForceReinstall->setChecked( true ); |
440 | if ( options & FORCE_REMOVE ) | 418 | if ( options & FORCE_REMOVE ) |
441 | m_optForceRemove->setChecked( true ); | 419 | m_optForceRemove->setChecked( true ); |
442 | if ( options & FORCE_OVERWRITE ) | 420 | if ( options & FORCE_OVERWRITE ) |
443 | m_optForceOverwrite->setChecked( true ); | 421 | m_optForceOverwrite->setChecked( true ); |
444 | 422 | ||
445 | m_optVerboseIpkg->setCurrentItem( m_ipkg->ipkgExecVerbosity() ); | 423 | m_optVerboseIpkg->setCurrentItem( m_ipkg->ipkgExecVerbosity() ); |
446 | } | 424 | } |
447 | 425 | ||
448 | OConfItem *OIpkgConfigDlg::findConfItem( OConfItem::Type type, const QString &name ) | 426 | OConfItem *OIpkgConfigDlg::findConfItem( OConfItem::Type type, const QString &name ) |
449 | { | 427 | { |
450 | // Find selected server in list | 428 | // Find selected server in list |
451 | OConfItemListIterator configIt( *m_configs ); | 429 | OConfItemListIterator configIt( *m_configs ); |
452 | OConfItem *config = 0x0; | 430 | OConfItem *config = 0l; |
453 | for ( ; configIt.current(); ++configIt ) | 431 | for ( ; configIt.current(); ++configIt ) |
454 | { | 432 | { |
455 | config = configIt.current(); | 433 | config = configIt.current(); |
456 | if ( config->type() == type && config->name() == name ) | 434 | if ( config->type() == type && config->name() == name ) |
457 | break; | 435 | break; |
458 | } | 436 | } |
459 | 437 | ||
460 | if ( config && config->type() == type && config->name() == name ) | 438 | if ( config && config->type() == type && config->name() == name ) |
461 | return config; | 439 | return config; |
462 | 440 | ||
463 | return 0x0; | 441 | return 0l; |
464 | } | 442 | } |
465 | 443 | ||
466 | void OIpkgConfigDlg::slotServerEdit( int index ) | 444 | void OIpkgConfigDlg::slotServerSelected( int index ) |
467 | { | 445 | { |
468 | m_serverNew = false; | ||
469 | m_serverCurrent = index; | 446 | m_serverCurrent = index; |
470 | 447 | ||
471 | // Find selected server in list | 448 | // Enable Edit and Delete buttons |
472 | OConfItem *server = findConfItem( OConfItem::Source, m_serverList->currentText() ); | 449 | m_serverEditBtn->setEnabled( true ); |
473 | 450 | m_serverDeleteBtn->setEnabled( true ); | |
474 | // Display server details | ||
475 | if ( server ) | ||
476 | { | ||
477 | m_serverCurrName = server->name(); | ||
478 | m_serverName->setText( server->name() ); | ||
479 | m_serverLocation->setText( server->value() ); | ||
480 | m_serverActive->setChecked( server->active() ); | ||
481 | m_serverName->setFocus(); | ||
482 | } | ||
483 | } | 451 | } |
484 | 452 | ||
485 | void OIpkgConfigDlg::slotServerNew() | 453 | void OIpkgConfigDlg::slotServerNew() |
486 | { | 454 | { |
487 | m_serverNew = true; | 455 | OConfItem *server = new OConfItem( OConfItem::Source ); |
456 | |||
457 | OIpkgServerDlg dlg( server, this ); | ||
458 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) | ||
459 | { | ||
460 | // Add to configuration option list | ||
461 | m_configs->append( server ); | ||
462 | m_configs->sort(); | ||
488 | 463 | ||
489 | m_serverName->setText( QString::null ); | 464 | // Add to server list |
490 | m_serverLocation->setText( QString::null ); | 465 | m_serverList->insertItem( server->name() ); |
491 | m_serverActive->setChecked( true ); | 466 | m_serverList->setCurrentItem( m_serverList->count() ); |
492 | m_serverName->setFocus(); | 467 | } |
468 | else | ||
469 | delete server; | ||
493 | } | 470 | } |
494 | 471 | ||
495 | void OIpkgConfigDlg::slotServerDelete() | 472 | void OIpkgConfigDlg::slotServerEdit() |
496 | { | 473 | { |
497 | // Find selected server in list | 474 | // Find selected server in list |
498 | OConfItem *server = findConfItem( OConfItem::Source, m_serverList->currentText() ); | 475 | OConfItem *server = findConfItem( OConfItem::Source, m_serverList->currentText() ); |
499 | 476 | ||
500 | // Delete server | 477 | // Delete server |
501 | if ( server ) | 478 | if ( server ) |
502 | { | 479 | { |
503 | m_configs->removeRef( server ); | 480 | QString origName = server->name(); |
504 | m_serverList->removeItem( m_serverCurrent ); | 481 | OIpkgServerDlg dlg( server, this ); |
482 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) | ||
483 | { | ||
484 | // Check to see if name has changed, if so update the server list | ||
485 | if ( server->name() != origName ) | ||
486 | m_serverList->changeItem( server->name(), m_serverCurrent ); | ||
487 | } | ||
505 | } | 488 | } |
506 | } | 489 | } |
507 | 490 | ||
508 | void OIpkgConfigDlg::slotServerUpdate() | 491 | void OIpkgConfigDlg::slotServerDelete() |
509 | { | 492 | { |
510 | QString newName = m_serverName->text(); | 493 | // Find selected server in list |
511 | 494 | OConfItem *server = findConfItem( OConfItem::Source, m_serverList->currentText() ); | |
512 | // Convert any spaces to underscores | ||
513 | newName.replace( QRegExp( " " ), "_" ); | ||
514 | |||
515 | if ( !m_serverNew ) | ||
516 | { | ||
517 | // Find selected server in list | ||
518 | OConfItem *server = findConfItem( OConfItem::Source, m_serverCurrName ); | ||
519 | |||
520 | // Delete server | ||
521 | if ( server ) | ||
522 | { | ||
523 | // Update url | ||
524 | server->setValue( m_serverLocation->text() ); | ||
525 | server->setActive( m_serverActive->isChecked() ); | ||
526 | |||
527 | // Check if server name has changed, if it has then we need to replace the key in the map | ||
528 | if ( m_serverCurrName != newName ) | ||
529 | { | ||
530 | // Update server name | ||
531 | server->setName( newName ); | ||
532 | 495 | ||
533 | // Update list box | 496 | // Delete server |
534 | m_serverList->changeItem( newName, m_serverCurrent ); | 497 | if ( server ) |
535 | } | ||
536 | } | ||
537 | } | ||
538 | else | ||
539 | { | 498 | { |
540 | // Add new server to configuration list | 499 | m_configs->removeRef( server ); |
541 | // TODO - support src/gz | 500 | m_serverList->removeItem( m_serverCurrent ); |
542 | m_configs->append( new OConfItem( OConfItem::Source, newName, m_serverLocation->text(), | ||
543 | QString::null, m_serverActive->isChecked() ) ); | ||
544 | m_configs->sort(); | ||
545 | |||
546 | m_serverList->insertItem( newName ); | ||
547 | m_serverList->setCurrentItem( m_serverList->count() ); | ||
548 | m_serverNew = false; | ||
549 | } | 501 | } |
550 | } | 502 | } |
551 | 503 | ||
552 | void OIpkgConfigDlg::slotDestEdit( int index ) | 504 | void OIpkgConfigDlg::slotDestEdit( int index ) |
553 | { | 505 | { |
554 | m_destNew = false; | 506 | m_destNew = false; |
555 | m_destCurrent = index; | 507 | m_destCurrent = index; |
556 | 508 | ||
557 | // Find selected destination in list | 509 | // Find selected destination in list |
558 | OConfItem *destination = findConfItem( OConfItem::Destination, m_destList->currentText() ); | 510 | OConfItem *destination = findConfItem( OConfItem::Destination, m_destList->currentText() ); |
559 | 511 | ||
560 | // Display destination details | 512 | // Display destination details |
561 | if ( destination ) | 513 | if ( destination ) |
562 | { | 514 | { |
563 | m_destCurrName = destination->name(); | 515 | m_destCurrName = destination->name(); |
564 | m_destName->setText( destination->name() ); | 516 | m_destName->setText( destination->name() ); |
@@ -628,16 +580,75 @@ void OIpkgConfigDlg::slotDestUpdate() | |||
628 | m_destList->changeItem( newName, m_destCurrent ); | 580 | m_destList->changeItem( newName, m_destCurrent ); |
629 | } | 581 | } |
630 | } | 582 | } |
631 | } | 583 | } |
632 | else | 584 | else |
633 | { | 585 | { |
634 | // Add new destination to configuration list | 586 | // Add new destination to configuration list |
635 | m_configs->append( new OConfItem( OConfItem::Destination, newName, | 587 | m_configs->append( new OConfItem( OConfItem::Destination, newName, |
636 | m_destLocation->text(), QString::null, m_destActive->isChecked() ) ); | 588 | m_destLocation->text(), QString::null, m_destActive->isChecked() ) ); |
637 | m_configs->sort(); | 589 | m_configs->sort(); |
638 | 590 | ||
639 | m_destList->insertItem( newName ); | 591 | m_destList->insertItem( newName ); |
640 | m_destList->setCurrentItem( m_destList->count() ); | 592 | m_destList->setCurrentItem( m_destList->count() ); |
641 | m_destNew = false; | 593 | m_destNew = false; |
642 | } | 594 | } |
643 | } | 595 | } |
596 | |||
597 | OIpkgServerDlg::OIpkgServerDlg( OConfItem *server, QWidget *parent ) | ||
598 | : QDialog( parent, QString::null, true, WStyle_ContextHelp ) | ||
599 | , m_server( server ) | ||
600 | { | ||
601 | setCaption( tr( "Edit server" ) ); | ||
602 | |||
603 | // Initialize UI | ||
604 | QVBoxLayout *layout = new QVBoxLayout( this, 2, 4 ); | ||
605 | |||
606 | m_active = new QCheckBox( tr( "Active" ), this ); | ||
607 | QWhatsThis::add( m_active, tr( "Tap here to indicate whether this entry is active or not." ) ); | ||
608 | layout->addWidget( m_active ); | ||
609 | |||
610 | layout->addStretch(); | ||
611 | |||
612 | QLabel *label = new QLabel( tr( "Name:" ), this ); | ||
613 | QWhatsThis::add( label, tr( "Enter the name of this entry here." ) ); | ||
614 | layout->addWidget( label ); | ||
615 | m_name = new QLineEdit( this ); | ||
616 | QWhatsThis::add( m_name, tr( "Enter the name of this entry here." ) ); | ||
617 | layout->addWidget( m_name ); | ||
618 | |||
619 | layout->addStretch(); | ||
620 | |||
621 | label = new QLabel( tr( "Address:" ), this ); | ||
622 | QWhatsThis::add( label, tr( "Enter the URL address of this entry here." ) ); | ||
623 | layout->addWidget( label ); | ||
624 | m_location = new QLineEdit( this ); | ||
625 | QWhatsThis::add( m_location, tr( "Enter the URL address of this entry here." ) ); | ||
626 | layout->addWidget( m_location ); | ||
627 | |||
628 | layout->addStretch(); | ||
629 | |||
630 | m_compressed = new QCheckBox( tr( "Compressed server feed" ), this ); | ||
631 | QWhatsThis::add( m_compressed, tr( "Tap here to indicate whether the server support compressed archives or not." ) ); | ||
632 | layout->addWidget( m_compressed ); | ||
633 | |||
634 | // Populate initial information | ||
635 | if ( m_server ) | ||
636 | { | ||
637 | m_name->setText( m_server->name() ); | ||
638 | m_location->setText( m_server->value() ); | ||
639 | m_compressed->setChecked( m_server->features().contains( "Compressed" ) ); | ||
640 | m_active->setChecked( m_server->active() ); | ||
641 | } | ||
642 | } | ||
643 | |||
644 | void OIpkgServerDlg::accept() | ||
645 | { | ||
646 | // Save information entered | ||
647 | m_server->setName( m_name->text() ); | ||
648 | m_server->setValue( m_location->text() ); | ||
649 | m_compressed->isChecked() ? m_server->setFeatures( "Compressed" ) | ||
650 | : m_server->setFeatures( QString::null ); | ||
651 | m_server->setActive( m_active->isChecked() ); | ||
652 | |||
653 | QDialog::accept(); | ||
654 | } | ||
diff --git a/noncore/settings/packagemanager/oipkgconfigdlg.h b/noncore/settings/packagemanager/oipkgconfigdlg.h index a4e4f82..076a181 100644 --- a/noncore/settings/packagemanager/oipkgconfigdlg.h +++ b/noncore/settings/packagemanager/oipkgconfigdlg.h | |||
@@ -31,102 +31,124 @@ _;:, .> :=|. This program is free software; you can | |||
31 | 31 | ||
32 | 32 | ||
33 | #ifndef OIPKGCONFIGDLG_H | 33 | #ifndef OIPKGCONFIGDLG_H |
34 | #define OIPKGCONFIGDLG_H | 34 | #define OIPKGCONFIGDLG_H |
35 | 35 | ||
36 | #include <opie2/otabwidget.h> | 36 | #include <opie2/otabwidget.h> |
37 | 37 | ||
38 | #include <qdialog.h> | 38 | #include <qdialog.h> |
39 | #include <qlayout.h> | 39 | #include <qlayout.h> |
40 | 40 | ||
41 | #include "oipkg.h" | 41 | #include "oipkg.h" |
42 | 42 | ||
43 | class QCheckBox; | 43 | class QCheckBox; |
44 | class QComboBox; | 44 | class QComboBox; |
45 | class QLineEdit; | 45 | class QLineEdit; |
46 | class QListBox; | 46 | class QListBox; |
47 | class QPushButton; | ||
47 | 48 | ||
48 | class OIpkgConfigDlg : public QDialog | 49 | class OIpkgConfigDlg : public QDialog |
49 | { | 50 | { |
50 | Q_OBJECT | 51 | Q_OBJECT |
51 | 52 | ||
52 | public: | 53 | public: |
53 | OIpkgConfigDlg( OIpkg *ipkg = 0x0, bool installOptions = false, QWidget *parent = 0x0 ); | 54 | OIpkgConfigDlg( OIpkg *ipkg = 0l, bool installOptions = false, QWidget *parent = 0l ); |
54 | 55 | ||
55 | protected slots: | 56 | protected slots: |
56 | void accept(); | 57 | void accept(); |
57 | void reject(); | 58 | void reject(); |
58 | 59 | ||
59 | private: | 60 | private: |
60 | 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 |
61 | OConfItemList *m_configs; // Local list of configuration items | 62 | OConfItemList *m_configs; // Local list of configuration items |
62 | 63 | ||
63 | bool m_installOptions; // If true, will only display the Options tab | 64 | bool m_installOptions; // If true, will only display the Options tab |
64 | 65 | ||
65 | // Server cached information | 66 | // Server cached information |
66 | bool m_serverNew; // Indicates if server information is for a new server | 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 | QString m_serverCurrName; // Name of currently selected server in m_serverList | 69 | QString m_serverCurrName; // Name of currently selected server in m_serverList |
69 | 70 | ||
70 | // Destination cached information | 71 | // Destination cached information |
71 | bool m_destNew; // Indicates if destination information is for a new destination | 72 | bool m_destNew; // Indicates if destination information is for a new destination |
72 | int m_destCurrent; // Index of currently selected destination in m_destList | 73 | int m_destCurrent; // Index of currently selected destination in m_destList |
73 | QString m_destCurrName; // Name of currently selected destination in m_destList | 74 | QString m_destCurrName; // Name of currently selected destination in m_destList |
74 | 75 | ||
75 | // UI controls | 76 | // UI controls |
76 | QVBoxLayout m_layout; // Main dialog layout control | 77 | QVBoxLayout m_layout; // Main dialog layout control |
77 | Opie::Ui::OTabWidget m_tabWidget; // Main tab widget control | 78 | Opie::Ui::OTabWidget m_tabWidget; // Main tab widget control |
78 | QWidget *m_serverWidget; // Widget containing server configuration controls | 79 | QWidget *m_serverWidget; // Widget containing server configuration controls |
79 | QWidget *m_destWidget; // Widget containing destination configuration controls | 80 | QWidget *m_destWidget; // Widget containing destination configuration controls |
80 | QWidget *m_proxyWidget; // Widget containing proxy configuration controls | 81 | QWidget *m_proxyWidget; // Widget containing proxy configuration controls |
81 | QWidget *m_optionsWidget; // Widget containing ipkg execution configuration controls | 82 | QWidget *m_optionsWidget; // Widget containing ipkg execution configuration controls |
82 | 83 | ||
83 | // Server configuration UI controls | 84 | // Server configuration UI controls |
84 | QListBox *m_serverList; // Server list selection | 85 | QListBox *m_serverList; // Server list selection |
85 | QLineEdit *m_serverName; // Server name edit box | 86 | QPushButton *m_serverEditBtn; // Server edit button |
86 | QLineEdit *m_serverLocation; // Server location URL edit box | 87 | QPushButton *m_serverDeleteBtn; // Server edit button |
87 | QCheckBox *m_serverActive; // Activate server check box | ||
88 | 88 | ||
89 | // Destination configuration UI controls | 89 | // Destination configuration UI controls |
90 | QListBox *m_destList; // Destination list selection | 90 | QListBox *m_destList; // Destination list selection |
91 | QLineEdit *m_destName; // Destination name edit box | 91 | QLineEdit *m_destName; // Destination name edit box |
92 | QLineEdit *m_destLocation; // Destination location URL edit box | 92 | QLineEdit *m_destLocation; // Destination location URL edit box |
93 | QCheckBox *m_destActive; // Activate destination check box | 93 | QCheckBox *m_destActive; // Activate destination check box |
94 | 94 | ||
95 | // Proxy server configuration UI controls | 95 | // Proxy server configuration UI controls |
96 | QLineEdit *m_proxyHttpServer; // HTTP proxy server URL edit box | 96 | QLineEdit *m_proxyHttpServer; // HTTP proxy server URL edit box |
97 | QCheckBox *m_proxyHttpActive; // Activate HTTP proxy check box | 97 | QCheckBox *m_proxyHttpActive; // Activate HTTP proxy check box |
98 | QLineEdit *m_proxyFtpServer; // FTP proxy server edit box | 98 | QLineEdit *m_proxyFtpServer; // FTP proxy server edit box |
99 | QCheckBox *m_proxyFtpActive; // Activate FTP proxy check box | 99 | QCheckBox *m_proxyFtpActive; // Activate FTP proxy check box |
100 | QLineEdit *m_proxyUsername; // Proxy server username edit box | 100 | QLineEdit *m_proxyUsername; // Proxy server username edit box |
101 | QLineEdit *m_proxyPassword; // Proxy server password edit box | 101 | QLineEdit *m_proxyPassword; // Proxy server password edit box |
102 | 102 | ||
103 | // Options configuration UI controls | 103 | // Options configuration UI controls |
104 | QCheckBox *m_optForceDepends; // Force depends ipkg option checkbox | 104 | QCheckBox *m_optForceDepends; // Force depends ipkg option checkbox |
105 | QCheckBox *m_optForceReinstall; // Force reinstall ipkg option checkbox | 105 | QCheckBox *m_optForceReinstall; // Force reinstall ipkg option checkbox |
106 | QCheckBox *m_optForceRemove; // Force remove ipkg option checkbox | 106 | QCheckBox *m_optForceRemove; // Force remove ipkg option checkbox |
107 | QCheckBox *m_optForceOverwrite; // Force overwrite ipkg option checkbox | 107 | QCheckBox *m_optForceOverwrite; // Force overwrite ipkg option checkbox |
108 | QComboBox *m_optVerboseIpkg; // Ipkg verbosity option selection | 108 | QComboBox *m_optVerboseIpkg; // Ipkg verbosity option selection |
109 | 109 | ||
110 | void initServerWidget(); | 110 | void initServerWidget(); |
111 | void initDestinationWidget(); | 111 | void initDestinationWidget(); |
112 | void initProxyWidget(); | 112 | void initProxyWidget(); |
113 | void initOptionsWidget(); | 113 | void initOptionsWidget(); |
114 | 114 | ||
115 | void initData(); | 115 | void initData(); |
116 | 116 | ||
117 | OConfItem *findConfItem( OConfItem::Type type = OConfItem::NotDefined, const QString &name = 0x0 ); | 117 | OConfItem *findConfItem( OConfItem::Type type = OConfItem::NotDefined, |
118 | const QString &name = QString::null ); | ||
118 | 119 | ||
119 | private slots: | 120 | private slots: |
120 | void slotServerEdit( int index ); | 121 | void slotServerSelected( int index ); |
121 | void slotServerNew(); | 122 | void slotServerNew(); |
123 | void slotServerEdit(); | ||
122 | void slotServerDelete(); | 124 | void slotServerDelete(); |
123 | void slotServerUpdate(); | 125 | // void slotServerUpdate(); |
124 | 126 | ||
125 | void slotDestEdit( int index ); | 127 | void slotDestEdit( int index ); |
126 | void slotDestNew(); | 128 | void slotDestNew(); |
127 | void slotDestDelete(); | 129 | void slotDestDelete(); |
128 | void slotDestSelectPath(); | 130 | void slotDestSelectPath(); |
129 | void slotDestUpdate(); | 131 | void slotDestUpdate(); |
130 | }; | 132 | }; |
131 | 133 | ||
134 | class OIpkgServerDlg : public QDialog | ||
135 | { | ||
136 | Q_OBJECT | ||
137 | |||
138 | public: | ||
139 | OIpkgServerDlg( OConfItem *server = 0l, QWidget *parent = 0l ); | ||
140 | |||
141 | protected slots: | ||
142 | void accept(); | ||
143 | |||
144 | private: | ||
145 | OConfItem *m_server; | ||
146 | |||
147 | // UI controls | ||
148 | QLineEdit *m_name; // Server name edit box | ||
149 | QLineEdit *m_location; // Server location URL edit box | ||
150 | QCheckBox *m_compressed; // Indicates whether the server is a 'src/gz' feed | ||
151 | QCheckBox *m_active; // Indicates whether the server is activated | ||
152 | }; | ||
153 | |||
132 | #endif | 154 | #endif |