-rw-r--r-- | noncore/settings/packagemanager/oipkgconfigdlg.cpp | 23 | ||||
-rw-r--r-- | noncore/settings/packagemanager/oipkgconfigdlg.h | 43 |
2 files changed, 40 insertions, 26 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 | |||
@@ -2,118 +2,118 @@ | |||
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2003 Dan Williams <drw@handhelds.org> | 4 | Copyright (c) 2003 Dan Williams <drw@handhelds.org> |
5 | =. | 5 | =. |
6 | .=l. | 6 | .=l. |
7 | .>+-= | 7 | .>+-= |
8 | _;:, .> :=|. This program is free software; you can | 8 | _;:, .> :=|. This program is free software; you can |
9 | .> <`_, > . <= redistribute it and/or modify it under | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | .="- .-=="i, .._ License as published by the Free Software | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | - . .-<_> .<> Foundation; either version 2 of the License, | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ._= =} : or (at your option) any later version. | 13 | ._= =} : or (at your option) any later version. |
14 | .%`+i> _;_. | 14 | .%`+i> _;_. |
15 | .i_,=:_. -<s. This program is distributed in the hope that | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. .:, . . . without even the implied warranty of | 17 | : .. .:, . . . without even the implied warranty of |
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
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> | ||
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 | ||
46 | OIpkgConfigDlg::OIpkgConfigDlg( OIpkg *ipkg, bool installOptions, QWidget *parent ) | 48 | OIpkgConfigDlg::OIpkgConfigDlg( OIpkg *ipkg, bool installOptions, QWidget *parent ) |
47 | : QDialog( parent, QString::null, true, WStyle_ContextHelp ) | 49 | : QDialog( parent, QString::null, true, WStyle_ContextHelp ) |
48 | , m_ipkg( ipkg ) | 50 | , m_ipkg( ipkg ) |
49 | , m_configs( 0x0 ) | 51 | , m_configs( 0x0 ) |
50 | , m_installOptions( installOptions ) | 52 | , m_installOptions( installOptions ) |
51 | , m_serverNew( false ) | 53 | , m_serverNew( false ) |
52 | , m_serverCurrent( -1 ) | 54 | , m_serverCurrent( -1 ) |
53 | , m_destNew( false ) | 55 | , m_destNew( false ) |
54 | , m_destCurrent( -1 ) | 56 | , m_destCurrent( -1 ) |
55 | , m_layout( this, 2, 4 ) | 57 | , m_layout( this, 2, 4 ) |
56 | , m_tabWidget( this ) | 58 | , m_tabWidget( this ) |
57 | { | 59 | { |
58 | setCaption( tr( "Configuration" ) ); | 60 | setCaption( tr( "Configuration" ) ); |
59 | 61 | ||
60 | // Initialize configuration widgets | 62 | // Initialize configuration widgets |
61 | if ( !installOptions ) | 63 | if ( !installOptions ) |
62 | { | 64 | { |
63 | initServerWidget(); | 65 | initServerWidget(); |
64 | initDestinationWidget(); | 66 | initDestinationWidget(); |
65 | initProxyWidget(); | 67 | initProxyWidget(); |
66 | } | 68 | } |
67 | initOptionsWidget(); | 69 | initOptionsWidget(); |
68 | 70 | ||
69 | // Load configuration information | 71 | // Load configuration information |
70 | initData(); | 72 | initData(); |
71 | 73 | ||
72 | // Setup tabs for all info | 74 | // Setup tabs for all info |
73 | m_layout.addWidget( &m_tabWidget ); | 75 | m_layout.addWidget( &m_tabWidget ); |
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() ); |
100 | confItem->setActive( m_proxyHttpActive->isChecked() ); | 100 | confItem->setActive( m_proxyHttpActive->isChecked() ); |
101 | } | 101 | } |
102 | else | 102 | else |
103 | m_configs->append( new OConfItem( OConfItem::Option, "http_proxy", | 103 | m_configs->append( new OConfItem( OConfItem::Option, "http_proxy", |
104 | m_proxyHttpServer->text(), m_proxyHttpActive->isChecked() ) ); | 104 | m_proxyHttpServer->text(), m_proxyHttpActive->isChecked() ) ); |
105 | 105 | ||
106 | confItem = findConfItem( OConfItem::Option, "ftp_proxy" ); | 106 | confItem = findConfItem( OConfItem::Option, "ftp_proxy" ); |
107 | if ( confItem ) | 107 | if ( confItem ) |
108 | { | 108 | { |
109 | confItem->setValue( m_proxyFtpServer->text() ); | 109 | confItem->setValue( m_proxyFtpServer->text() ); |
110 | confItem->setActive( m_proxyFtpActive->isChecked() ); | 110 | confItem->setActive( m_proxyFtpActive->isChecked() ); |
111 | } | 111 | } |
112 | else | 112 | else |
113 | m_configs->append( new OConfItem( OConfItem::Option, "ftp_proxy", | 113 | m_configs->append( new OConfItem( OConfItem::Option, "ftp_proxy", |
114 | m_proxyFtpServer->text(), m_proxyFtpActive->isChecked() ) ); | 114 | m_proxyFtpServer->text(), m_proxyFtpActive->isChecked() ) ); |
115 | 115 | ||
116 | confItem = findConfItem( OConfItem::Option, "proxy_username" ); | 116 | confItem = findConfItem( OConfItem::Option, "proxy_username" ); |
117 | if ( confItem ) | 117 | if ( confItem ) |
118 | confItem->setValue( m_proxyUsername->text() ); | 118 | confItem->setValue( m_proxyUsername->text() ); |
119 | else | 119 | else |
@@ -226,81 +226,86 @@ void OIpkgConfigDlg::initDestinationWidget() | |||
226 | QWidget *container = new QWidget( sv->viewport() ); | 226 | QWidget *container = new QWidget( sv->viewport() ); |
227 | sv->addChild( container ); | 227 | sv->addChild( container ); |
228 | QGridLayout *layout = new QGridLayout( container, 3, 2, 2, 4 ); | 228 | QGridLayout *layout = new QGridLayout( container, 3, 2, 2, 4 ); |
229 | 229 | ||
230 | m_destList = new QListBox( container ); | 230 | m_destList = new QListBox( container ); |
231 | 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." ) ); | 231 | 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." ) ); |
232 | m_destList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); | 232 | m_destList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); |
233 | connect( m_destList, SIGNAL(highlighted(int)), this, SLOT(slotDestEdit(int)) ); | 233 | connect( m_destList, SIGNAL(highlighted(int)), this, SLOT(slotDestEdit(int)) ); |
234 | layout->addMultiCellWidget( m_destList, 0, 0, 0, 1 ); | 234 | layout->addMultiCellWidget( m_destList, 0, 0, 0, 1 ); |
235 | 235 | ||
236 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); | 236 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); |
237 | QWhatsThis::add( btn, tr( "Tap here to create a new entry. Fill in the fields below and then tap on Update." ) ); | 237 | QWhatsThis::add( btn, tr( "Tap here to create a new entry. Fill in the fields below and then tap on Update." ) ); |
238 | connect( btn, SIGNAL(clicked()), this, SLOT(slotDestNew()) ); | 238 | connect( btn, SIGNAL(clicked()), this, SLOT(slotDestNew()) ); |
239 | layout->addWidget( btn, 1, 0 ); | 239 | layout->addWidget( btn, 1, 0 ); |
240 | 240 | ||
241 | btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); | 241 | btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); |
242 | QWhatsThis::add( btn, tr( "Tap here to delete the entry selected above." ) ); | 242 | QWhatsThis::add( btn, tr( "Tap here to delete the entry selected above." ) ); |
243 | connect( btn, SIGNAL(clicked()), this, SLOT(slotDestDelete()) ); | 243 | connect( btn, SIGNAL(clicked()), this, SLOT(slotDestDelete()) ); |
244 | layout->addWidget( btn, 1, 1 ); | 244 | layout->addWidget( btn, 1, 1 ); |
245 | 245 | ||
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 ); |
287 | QWidget *container = new QWidget( sv->viewport() ); | 292 | QWidget *container = new QWidget( sv->viewport() ); |
288 | sv->addChild( container ); | 293 | sv->addChild( container ); |
289 | QGridLayout *layout = new QGridLayout( container, 4, 2, 2, 4 ); | 294 | QGridLayout *layout = new QGridLayout( container, 4, 2, 2, 4 ); |
290 | 295 | ||
291 | // HTTP proxy server configuration | 296 | // HTTP proxy server configuration |
292 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "HTTP Proxy" ), container ); | 297 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "HTTP Proxy" ), container ); |
293 | grpbox->layout()->setSpacing( 2 ); | 298 | grpbox->layout()->setSpacing( 2 ); |
294 | grpbox->layout()->setMargin( 4 ); | 299 | grpbox->layout()->setMargin( 4 ); |
295 | layout->addMultiCellWidget( grpbox, 0, 0, 0, 1 ); | 300 | layout->addMultiCellWidget( grpbox, 0, 0, 0, 1 ); |
296 | QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() ); | 301 | QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() ); |
297 | m_proxyHttpServer = new QLineEdit( grpbox ); | 302 | m_proxyHttpServer = new QLineEdit( grpbox ); |
298 | QWhatsThis::add( m_proxyHttpServer, tr( "Enter the URL address of the HTTP proxy server here." ) ); | 303 | QWhatsThis::add( m_proxyHttpServer, tr( "Enter the URL address of the HTTP proxy server here." ) ); |
299 | grplayout->addWidget( m_proxyHttpServer ); | 304 | grplayout->addWidget( m_proxyHttpServer ); |
300 | m_proxyHttpActive = new QCheckBox( tr( "Enabled" ), grpbox ); | 305 | m_proxyHttpActive = new QCheckBox( tr( "Enabled" ), grpbox ); |
301 | QWhatsThis::add( m_proxyHttpActive, tr( "Tap here to enable or disable the HTTP proxy server." ) ); | 306 | QWhatsThis::add( m_proxyHttpActive, tr( "Tap here to enable or disable the HTTP proxy server." ) ); |
302 | grplayout->addWidget( m_proxyHttpActive ); | 307 | grplayout->addWidget( m_proxyHttpActive ); |
303 | 308 | ||
304 | // FTP proxy server configuration | 309 | // FTP proxy server configuration |
305 | grpbox = new QGroupBox( 0, Qt::Vertical, tr( "FTP Proxy" ), container ); | 310 | grpbox = new QGroupBox( 0, Qt::Vertical, tr( "FTP Proxy" ), container ); |
306 | grpbox->layout()->setSpacing( 2 ); | 311 | grpbox->layout()->setSpacing( 2 ); |
@@ -555,64 +560,72 @@ void OIpkgConfigDlg::slotDestEdit( int index ) | |||
555 | { | 560 | { |
556 | m_destCurrName = destination->name(); | 561 | m_destCurrName = destination->name(); |
557 | m_destName->setText( destination->name() ); | 562 | m_destName->setText( destination->name() ); |
558 | m_destLocation->setText( destination->value() ); | 563 | m_destLocation->setText( destination->value() ); |
559 | m_destActive->setChecked( destination->active() ); | 564 | m_destActive->setChecked( destination->active() ); |
560 | m_destName->setFocus(); | 565 | m_destName->setFocus(); |
561 | } | 566 | } |
562 | } | 567 | } |
563 | 568 | ||
564 | void OIpkgConfigDlg::slotDestNew() | 569 | void OIpkgConfigDlg::slotDestNew() |
565 | { | 570 | { |
566 | m_destNew = true; | 571 | m_destNew = true; |
567 | 572 | ||
568 | m_destName->setText( QString::null ); | 573 | m_destName->setText( QString::null ); |
569 | m_destLocation->setText( QString::null ); | 574 | m_destLocation->setText( QString::null ); |
570 | m_destActive->setChecked( true ); | 575 | m_destActive->setChecked( true ); |
571 | m_destName->setFocus(); | 576 | m_destName->setFocus(); |
572 | } | 577 | } |
573 | 578 | ||
574 | void OIpkgConfigDlg::slotDestDelete() | 579 | 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 | ||
599 | // Display destination details | 612 | // Display destination details |
600 | if ( destination ) | 613 | if ( destination ) |
601 | { | 614 | { |
602 | // Update url | 615 | // Update url |
603 | destination->setValue( m_destLocation->text() ); | 616 | destination->setValue( m_destLocation->text() ); |
604 | destination->setActive( m_destActive->isChecked() ); | 617 | destination->setActive( m_destActive->isChecked() ); |
605 | 618 | ||
606 | // Check if destination name has changed, if it has then we need to replace the key in the map | 619 | // Check if destination name has changed, if it has then we need to replace the key in the map |
607 | if ( m_destCurrName != newName ) | 620 | if ( m_destCurrName != newName ) |
608 | { | 621 | { |
609 | // Update destination name | 622 | // Update destination name |
610 | destination->setName( newName ); | 623 | destination->setName( newName ); |
611 | 624 | ||
612 | // Update list box | 625 | // Update list box |
613 | m_destList->changeItem( newName, m_destCurrent ); | 626 | m_destList->changeItem( newName, m_destCurrent ); |
614 | } | 627 | } |
615 | } | 628 | } |
616 | } | 629 | } |
617 | else | 630 | else |
618 | { | 631 | { |
diff --git a/noncore/settings/packagemanager/oipkgconfigdlg.h b/noncore/settings/packagemanager/oipkgconfigdlg.h index 800d94a..a4e4f82 100644 --- a/noncore/settings/packagemanager/oipkgconfigdlg.h +++ b/noncore/settings/packagemanager/oipkgconfigdlg.h | |||
@@ -1,57 +1,57 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2003 Dan Williams <drw@handhelds.org> | 4 | Copyright (c) 2003 Dan Williams <drw@handhelds.org> |
5 | =. | 5 | =. |
6 | .=l. | 6 | .=l. |
7 | .>+-= | 7 | .>+-= |
8 | _;:, .> :=|. This program is free software; you can | 8 | _;:, .> :=|. This program is free software; you can |
9 | .> <`_, > . <= redistribute it and/or modify it under | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | .="- .-=="i, .._ License as published by the Free Software | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | - . .-<_> .<> Foundation; either version 2 of the License, | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ._= =} : or (at your option) any later version. | 13 | ._= =} : or (at your option) any later version. |
14 | .%`+i> _;_. | 14 | .%`+i> _;_. |
15 | .i_,=:_. -<s. This program is distributed in the hope that | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. .:, . . . without even the implied warranty of | 17 | : .. .:, . . . without even the implied warranty of |
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
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 | 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 | 47 | ||
48 | class OIpkgConfigDlg : public QDialog | 48 | class OIpkgConfigDlg : public QDialog |
49 | { | 49 | { |
50 | Q_OBJECT | 50 | Q_OBJECT |
51 | 51 | ||
52 | public: | 52 | public: |
53 | OIpkgConfigDlg( OIpkg *ipkg = 0x0, bool installOptions = false, QWidget *parent = 0x0 ); | 53 | OIpkgConfigDlg( OIpkg *ipkg = 0x0, bool installOptions = false, QWidget *parent = 0x0 ); |
54 | 54 | ||
55 | protected slots: | 55 | protected slots: |
56 | void accept(); | 56 | void accept(); |
57 | void reject(); | 57 | void reject(); |
@@ -96,36 +96,37 @@ private: | |||
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, const QString &name = 0x0 ); |
118 | 118 | ||
119 | private slots: | 119 | private slots: |
120 | void slotServerEdit( int index ); | 120 | void slotServerEdit( int index ); |
121 | void slotServerNew(); | 121 | void slotServerNew(); |
122 | void slotServerDelete(); | 122 | void slotServerDelete(); |
123 | void slotServerUpdate(); | 123 | void slotServerUpdate(); |
124 | 124 | ||
125 | void slotDestEdit( int index ); | 125 | void slotDestEdit( int index ); |
126 | void slotDestNew(); | 126 | void slotDestNew(); |
127 | void slotDestDelete(); | 127 | void slotDestDelete(); |
128 | void slotDestSelectPath(); | ||
128 | void slotDestUpdate(); | 129 | void slotDestUpdate(); |
129 | }; | 130 | }; |
130 | 131 | ||
131 | #endif | 132 | #endif |