Diffstat (limited to 'noncore/settings/packagemanager/oipkgconfigdlg.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/packagemanager/oipkgconfigdlg.cpp | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/noncore/settings/packagemanager/oipkgconfigdlg.cpp b/noncore/settings/packagemanager/oipkgconfigdlg.cpp index 1561470..ea0aef0 100644 --- a/noncore/settings/packagemanager/oipkgconfigdlg.cpp +++ b/noncore/settings/packagemanager/oipkgconfigdlg.cpp | |||
@@ -22,24 +22,26 @@ _;:, .> :=|. This program is free software; you can | |||
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> | ||
35 | |||
34 | #include <qpe/resource.h> | 36 | #include <qpe/resource.h> |
35 | 37 | ||
36 | #include <qcheckbox.h> | 38 | #include <qcheckbox.h> |
37 | #include <qcombobox.h> | 39 | #include <qcombobox.h> |
38 | #include <qgroupbox.h> | 40 | #include <qgroupbox.h> |
39 | #include <qlabel.h> | 41 | #include <qlabel.h> |
40 | #include <qlineedit.h> | 42 | #include <qlineedit.h> |
41 | #include <qlistbox.h> | 43 | #include <qlistbox.h> |
42 | #include <qpushbutton.h> | 44 | #include <qpushbutton.h> |
43 | #include <qscrollview.h> | 45 | #include <qscrollview.h> |
44 | #include <qwhatsthis.h> | 46 | #include <qwhatsthis.h> |
45 | 47 | ||
@@ -74,26 +76,24 @@ OIpkgConfigDlg::OIpkgConfigDlg( OIpkg *ipkg, bool installOptions, QWidget *paren | |||
74 | if ( !m_installOptions ) | 76 | if ( !m_installOptions ) |
75 | { | 77 | { |
76 | m_tabWidget.addTab( m_serverWidget, "packagemanager/servertab", tr( "Servers" ) ); | 78 | m_tabWidget.addTab( m_serverWidget, "packagemanager/servertab", tr( "Servers" ) ); |
77 | m_tabWidget.addTab( m_destWidget, "packagemanager/desttab", tr( "Destinations" ) ); | 79 | m_tabWidget.addTab( m_destWidget, "packagemanager/desttab", tr( "Destinations" ) ); |
78 | m_tabWidget.addTab( m_proxyWidget, "packagemanager/proxytab", tr( "Proxies" ) ); | 80 | m_tabWidget.addTab( m_proxyWidget, "packagemanager/proxytab", tr( "Proxies" ) ); |
79 | m_tabWidget.addTab( m_optionsWidget, "exec", tr( "Options" ) ); | 81 | m_tabWidget.addTab( m_optionsWidget, "exec", tr( "Options" ) ); |
80 | m_tabWidget.setCurrentTab( tr( "Servers" ) ); | 82 | m_tabWidget.setCurrentTab( tr( "Servers" ) ); |
81 | } | 83 | } |
82 | else | 84 | else |
83 | { | 85 | { |
84 | m_tabWidget.addTab( m_optionsWidget, "exec", tr( "Options" ) ); | 86 | m_tabWidget.addTab( m_optionsWidget, "exec", tr( "Options" ) ); |
85 | } | 87 | } |
86 | |||
87 | //showMaximized(); | ||
88 | } | 88 | } |
89 | 89 | ||
90 | void OIpkgConfigDlg::accept() | 90 | void OIpkgConfigDlg::accept() |
91 | { | 91 | { |
92 | // Save server, destination and proxy configuration | 92 | // Save server, destination and proxy configuration |
93 | if ( !m_installOptions ) | 93 | if ( !m_installOptions ) |
94 | { | 94 | { |
95 | // Update proxy information before saving settings | 95 | // Update proxy information before saving settings |
96 | OConfItem *confItem = findConfItem( OConfItem::Option, "http_proxy" ); | 96 | OConfItem *confItem = findConfItem( OConfItem::Option, "http_proxy" ); |
97 | if ( confItem ) | 97 | if ( confItem ) |
98 | { | 98 | { |
99 | confItem->setValue( m_proxyHttpServer->text() ); | 99 | confItem->setValue( m_proxyHttpServer->text() ); |
@@ -246,41 +246,46 @@ void OIpkgConfigDlg::initDestinationWidget() | |||
246 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Destination" ), container ); | 246 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Destination" ), container ); |
247 | grpbox->layout()->setSpacing( 2 ); | 247 | grpbox->layout()->setSpacing( 2 ); |
248 | grpbox->layout()->setMargin( 4 ); | 248 | grpbox->layout()->setMargin( 4 ); |
249 | layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 ); | 249 | layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 ); |
250 | 250 | ||
251 | QGridLayout *grplayout = new QGridLayout( grpbox->layout() ); | 251 | QGridLayout *grplayout = new QGridLayout( grpbox->layout() ); |
252 | 252 | ||
253 | QLabel *label = new QLabel( tr( "Name:" ), grpbox ); | 253 | QLabel *label = new QLabel( tr( "Name:" ), grpbox ); |
254 | QWhatsThis::add( label, tr( "Enter the name of this entry here." ) ); | 254 | QWhatsThis::add( label, tr( "Enter the name of this entry here." ) ); |
255 | grplayout->addWidget( label, 0, 0 ); | 255 | grplayout->addWidget( label, 0, 0 ); |
256 | m_destName = new QLineEdit( grpbox ); | 256 | m_destName = new QLineEdit( grpbox ); |
257 | QWhatsThis::add( m_destName, tr( "Enter the name of this entry here." ) ); | 257 | QWhatsThis::add( m_destName, tr( "Enter the name of this entry here." ) ); |
258 | grplayout->addWidget( m_destName, 0, 1 ); | 258 | grplayout->addMultiCellWidget( m_destName, 0, 0, 1, 2 ); |
259 | 259 | ||
260 | label = new QLabel( tr( "Location:" ), grpbox ); | 260 | label = new QLabel( tr( "Location:" ), grpbox ); |
261 | QWhatsThis::add( label, tr( "Enter the absolute directory path of this entry here." ) ); | 261 | QWhatsThis::add( label, tr( "Enter the absolute directory path of this entry here." ) ); |
262 | grplayout->addWidget( label, 1, 0 ); | 262 | grplayout->addWidget( label, 1, 0 ); |
263 | m_destLocation = new QLineEdit( grpbox ); | 263 | m_destLocation = new QLineEdit( grpbox ); |
264 | QWhatsThis::add( m_destLocation, tr( "Enter the absolute directory path of this entry here." ) ); | 264 | QWhatsThis::add( m_destLocation, tr( "Enter the absolute directory path of this entry here." ) ); |
265 | grplayout->addWidget( m_destLocation, 1, 1 ); | 265 | grplayout->addWidget( m_destLocation, 1, 1 ); |
266 | btn = new QPushButton( Resource::loadPixmap( "folder" ), QString::null, grpbox ); | ||
267 | btn->setMaximumWidth( btn->height() ); | ||
268 | QWhatsThis::add( btn, tr( "Tap here to select the desired location." ) ); | ||
269 | connect( btn, SIGNAL(clicked()), this, SLOT(slotDestSelectPath()) ); | ||
270 | grplayout->addWidget( btn, 1, 2 ); | ||
266 | 271 | ||
267 | m_destActive = new QCheckBox( tr( "Active" ), grpbox ); | 272 | m_destActive = new QCheckBox( tr( "Active" ), grpbox ); |
268 | QWhatsThis::add( m_destActive, tr( "Tap here to indicate whether this entry is active or not." ) ); | 273 | QWhatsThis::add( m_destActive, tr( "Tap here to indicate whether this entry is active or not." ) ); |
269 | grplayout->addMultiCellWidget( m_destActive, 2, 2, 0, 1 ); | 274 | grplayout->addMultiCellWidget( m_destActive, 2, 2, 0, 2 ); |
270 | 275 | ||
271 | btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox ); | 276 | btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox ); |
272 | QWhatsThis::add( btn, tr( "Tap here to update the entry's information." ) ); | 277 | QWhatsThis::add( btn, tr( "Tap here to update the entry's information." ) ); |
273 | connect( btn, SIGNAL(clicked()), this, SLOT(slotDestUpdate()) ); | 278 | connect( btn, SIGNAL(clicked()), this, SLOT(slotDestUpdate()) ); |
274 | grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 ); | 279 | grplayout->addMultiCellWidget( btn, 3, 3, 0, 2 ); |
275 | } | 280 | } |
276 | 281 | ||
277 | void OIpkgConfigDlg::initProxyWidget() | 282 | void OIpkgConfigDlg::initProxyWidget() |
278 | { | 283 | { |
279 | m_proxyWidget = new QWidget( this ); | 284 | m_proxyWidget = new QWidget( this ); |
280 | 285 | ||
281 | // Initialize UI | 286 | // Initialize UI |
282 | QVBoxLayout *vb = new QVBoxLayout( m_proxyWidget ); | 287 | QVBoxLayout *vb = new QVBoxLayout( m_proxyWidget ); |
283 | QScrollView *sv = new QScrollView( m_proxyWidget ); | 288 | QScrollView *sv = new QScrollView( m_proxyWidget ); |
284 | vb->addWidget( sv, 0, 0 ); | 289 | vb->addWidget( sv, 0, 0 ); |
285 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 290 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
286 | sv->setFrameStyle( QFrame::NoFrame ); | 291 | sv->setFrameStyle( QFrame::NoFrame ); |
@@ -575,24 +580,32 @@ void OIpkgConfigDlg::slotDestDelete() | |||
575 | { | 580 | { |
576 | // Find selected destination in list | 581 | // Find selected destination in list |
577 | OConfItem *destination = findConfItem( OConfItem::Destination, m_destList->currentText() ); | 582 | OConfItem *destination = findConfItem( OConfItem::Destination, m_destList->currentText() ); |
578 | 583 | ||
579 | // Delete destination | 584 | // Delete destination |
580 | if ( destination ) | 585 | if ( destination ) |
581 | { | 586 | { |
582 | m_configs->removeRef( destination ); | 587 | m_configs->removeRef( destination ); |
583 | m_destList->removeItem( m_destCurrent ); | 588 | m_destList->removeItem( m_destCurrent ); |
584 | } | 589 | } |
585 | } | 590 | } |
586 | 591 | ||
592 | void OIpkgConfigDlg::slotDestSelectPath() | ||
593 | { | ||
594 | QString path = Opie::Ui::OFileDialog::getDirectory( 0, m_destLocation->text() ); | ||
595 | if ( path.at( path.length() - 1 ) == '/' ) | ||
596 | path.truncate( path.length() - 1 ); | ||
597 | m_destLocation->setText( path ); | ||
598 | } | ||
599 | |||
587 | void OIpkgConfigDlg::slotDestUpdate() | 600 | void OIpkgConfigDlg::slotDestUpdate() |
588 | { | 601 | { |
589 | QString newName = m_destName->text(); | 602 | QString newName = m_destName->text(); |
590 | 603 | ||
591 | // Convert any spaces to underscores | 604 | // Convert any spaces to underscores |
592 | newName.replace( QRegExp( " " ), "_" ); | 605 | newName.replace( QRegExp( " " ), "_" ); |
593 | 606 | ||
594 | if ( !m_destNew ) | 607 | if ( !m_destNew ) |
595 | { | 608 | { |
596 | // Find selected destination in list | 609 | // Find selected destination in list |
597 | OConfItem *destination = findConfItem( OConfItem::Destination, m_destCurrName ); | 610 | OConfItem *destination = findConfItem( OConfItem::Destination, m_destCurrName ); |
598 | 611 | ||