summaryrefslogtreecommitdiff
authordrw <drw>2004-08-16 18:11:27 (UTC)
committer drw <drw>2004-08-16 18:11:27 (UTC)
commitcbb2e3969b0a6bb36aca6bc608a77dcaeb5bbac2 (patch) (unidiff)
tree58d91571a252bc8519d94ff32832c9b3a7a16089
parentf8f568aaddc63d39b50aa8357326a64c036f5847 (diff)
downloadopie-cbb2e3969b0a6bb36aca6bc608a77dcaeb5bbac2.zip
opie-cbb2e3969b0a6bb36aca6bc608a77dcaeb5bbac2.tar.gz
opie-cbb2e3969b0a6bb36aca6bc608a77dcaeb5bbac2.tar.bz2
Use OFileDialog::getDirectory to select destination path
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/packagemanager/oipkgconfigdlg.cpp23
-rw-r--r--noncore/settings/packagemanager/oipkgconfigdlg.h43
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
@@ -1,628 +1,641 @@
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#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
46OIpkgConfigDlg::OIpkgConfigDlg( OIpkg *ipkg, bool installOptions, QWidget *parent ) 48OIpkgConfigDlg::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
90void OIpkgConfigDlg::accept() 90void 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
120 m_configs->append( new OConfItem( OConfItem::Option, "proxy_username", 120 m_configs->append( new OConfItem( OConfItem::Option, "proxy_username",
121 m_proxyUsername->text() ) ); 121 m_proxyUsername->text() ) );
122 122
123 confItem = findConfItem( OConfItem::Option, "proxy_password" ); 123 confItem = findConfItem( OConfItem::Option, "proxy_password" );
124 if ( confItem ) 124 if ( confItem )
125 confItem->setValue( m_proxyPassword->text() ); 125 confItem->setValue( m_proxyPassword->text() );
126 else 126 else
127 m_configs->append( new OConfItem( OConfItem::Option, "proxy_password", 127 m_configs->append( new OConfItem( OConfItem::Option, "proxy_password",
128 m_proxyPassword->text() ) ); 128 m_proxyPassword->text() ) );
129 129
130 m_ipkg->setConfigItems( m_configs ); 130 m_ipkg->setConfigItems( m_configs );
131 } 131 }
132 132
133 // Save options configuration 133 // Save options configuration
134 int options = 0; 134 int options = 0;
135 if ( m_optForceDepends->isChecked() ) 135 if ( m_optForceDepends->isChecked() )
136 options |= FORCE_DEPENDS; 136 options |= FORCE_DEPENDS;
137 if ( m_optForceReinstall->isChecked() ) 137 if ( m_optForceReinstall->isChecked() )
138 options |= FORCE_REINSTALL; 138 options |= FORCE_REINSTALL;
139 if ( m_optForceRemove->isChecked() ) 139 if ( m_optForceRemove->isChecked() )
140 options |= FORCE_REMOVE; 140 options |= FORCE_REMOVE;
141 if ( m_optForceOverwrite->isChecked() ) 141 if ( m_optForceOverwrite->isChecked() )
142 options |= FORCE_OVERWRITE; 142 options |= FORCE_OVERWRITE;
143 m_ipkg->setIpkgExecOptions( options ); 143 m_ipkg->setIpkgExecOptions( options );
144 m_ipkg->setIpkgExecVerbosity( m_optVerboseIpkg->currentItem() ); 144 m_ipkg->setIpkgExecVerbosity( m_optVerboseIpkg->currentItem() );
145 145
146 QDialog::accept(); 146 QDialog::accept();
147} 147}
148 148
149void OIpkgConfigDlg::reject() 149void OIpkgConfigDlg::reject()
150{ 150{
151 if ( m_configs ) 151 if ( m_configs )
152 delete m_configs; 152 delete m_configs;
153} 153}
154 154
155void OIpkgConfigDlg::initServerWidget() 155void OIpkgConfigDlg::initServerWidget()
156{ 156{
157 m_serverWidget = new QWidget( this ); 157 m_serverWidget = new QWidget( this );
158 158
159 // Initialize UI 159 // Initialize UI
160 QVBoxLayout *vb = new QVBoxLayout( m_serverWidget ); 160 QVBoxLayout *vb = new QVBoxLayout( m_serverWidget );
161 QScrollView *sv = new QScrollView( m_serverWidget ); 161 QScrollView *sv = new QScrollView( m_serverWidget );
162 vb->addWidget( sv, 0, 0 ); 162 vb->addWidget( sv, 0, 0 );
163 sv->setResizePolicy( QScrollView::AutoOneFit ); 163 sv->setResizePolicy( QScrollView::AutoOneFit );
164 sv->setFrameStyle( QFrame::NoFrame ); 164 sv->setFrameStyle( QFrame::NoFrame );
165 QWidget *container = new QWidget( sv->viewport() ); 165 QWidget *container = new QWidget( sv->viewport() );
166 sv->addChild( container ); 166 sv->addChild( container );
167 QGridLayout *layout = new QGridLayout( container, 3, 2, 2, 4 ); 167 QGridLayout *layout = new QGridLayout( container, 3, 2, 2, 4 );
168 168
169 m_serverList = new QListBox( container ); 169 m_serverList = new QListBox( container );
170 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." ) ); 170 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 m_serverList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); 171 m_serverList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) );
172 connect( m_serverList, SIGNAL(highlighted(int)), this, SLOT(slotServerEdit(int)) ); 172 connect( m_serverList, SIGNAL(highlighted(int)), this, SLOT(slotServerEdit(int)) );
173 layout->addMultiCellWidget( m_serverList, 0, 0, 0, 1 ); 173 layout->addMultiCellWidget( m_serverList, 0, 0, 0, 1 );
174 174
175 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); 175 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container );
176 QWhatsThis::add( btn, tr( "Tap here to create a new entry. Fill in the fields below and then tap on Update." ) ); 176 QWhatsThis::add( btn, tr( "Tap here to create a new entry. Fill in the fields below and then tap on Update." ) );
177 connect( btn, SIGNAL(clicked()), this, SLOT(slotServerNew()) ); 177 connect( btn, SIGNAL(clicked()), this, SLOT(slotServerNew()) );
178 layout->addWidget( btn, 1, 0 ); 178 layout->addWidget( btn, 1, 0 );
179 179
180 btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); 180 btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container );
181 QWhatsThis::add( btn, tr( "Tap here to delete the entry selected above." ) ); 181 QWhatsThis::add( btn, tr( "Tap here to delete the entry selected above." ) );
182 connect( btn, SIGNAL(clicked()), this, SLOT(slotServerDelete()) ); 182 connect( btn, SIGNAL(clicked()), this, SLOT(slotServerDelete()) );
183 layout->addWidget( btn, 1, 1 ); 183 layout->addWidget( btn, 1, 1 );
184 184
185 QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Server" ), container ); 185 QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Server" ), container );
186 grpbox->layout()->setSpacing( 2 ); 186 grpbox->layout()->setSpacing( 2 );
187 grpbox->layout()->setMargin( 4 ); 187 grpbox->layout()->setMargin( 4 );
188 layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 ); 188 layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 );
189 189
190 QGridLayout *grplayout = new QGridLayout( grpbox->layout() ); 190 QGridLayout *grplayout = new QGridLayout( grpbox->layout() );
191 191
192 QLabel *label = new QLabel( tr( "Name:" ), grpbox ); 192 QLabel *label = new QLabel( tr( "Name:" ), grpbox );
193 QWhatsThis::add( label, tr( "Enter the name of this entry here." ) ); 193 QWhatsThis::add( label, tr( "Enter the name of this entry here." ) );
194 grplayout->addWidget( label, 0, 0 ); 194 grplayout->addWidget( label, 0, 0 );
195 m_serverName = new QLineEdit( grpbox ); 195 m_serverName = new QLineEdit( grpbox );
196 QWhatsThis::add( m_serverName, tr( "Enter the name of this entry here." ) ); 196 QWhatsThis::add( m_serverName, tr( "Enter the name of this entry here." ) );
197 grplayout->addWidget( m_serverName, 0, 1 ); 197 grplayout->addWidget( m_serverName, 0, 1 );
198 198
199 label = new QLabel( tr( "Address:" ), grpbox ); 199 label = new QLabel( tr( "Address:" ), grpbox );
200 QWhatsThis::add( label, tr( "Enter the URL address of this entry here." ) ); 200 QWhatsThis::add( label, tr( "Enter the URL address of this entry here." ) );
201 grplayout->addWidget( label, 1, 0 ); 201 grplayout->addWidget( label, 1, 0 );
202 m_serverLocation = new QLineEdit( grpbox ); 202 m_serverLocation = new QLineEdit( grpbox );
203 QWhatsThis::add( m_serverLocation, tr( "Enter the URL address of this entry here." ) ); 203 QWhatsThis::add( m_serverLocation, tr( "Enter the URL address of this entry here." ) );
204 grplayout->addWidget( m_serverLocation, 1, 1 ); 204 grplayout->addWidget( m_serverLocation, 1, 1 );
205 205
206 m_serverActive = new QCheckBox( tr( "Active" ), grpbox ); 206 m_serverActive = new QCheckBox( tr( "Active" ), grpbox );
207 QWhatsThis::add( m_serverActive, tr( "Tap here to indicate whether this entry is active or not." ) ); 207 QWhatsThis::add( m_serverActive, tr( "Tap here to indicate whether this entry is active or not." ) );
208 grplayout->addMultiCellWidget( m_serverActive, 2, 2, 0, 1 ); 208 grplayout->addMultiCellWidget( m_serverActive, 2, 2, 0, 1 );
209 209
210 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox ); 210 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox );
211 QWhatsThis::add( btn, tr( "Tap here to update the entry's information." ) ); 211 QWhatsThis::add( btn, tr( "Tap here to update the entry's information." ) );
212 connect( btn, SIGNAL(clicked()), this, SLOT(slotServerUpdate()) ); 212 connect( btn, SIGNAL(clicked()), this, SLOT(slotServerUpdate()) );
213 grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 ); 213 grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 );
214} 214}
215 215
216void OIpkgConfigDlg::initDestinationWidget() 216void OIpkgConfigDlg::initDestinationWidget()
217{ 217{
218 m_destWidget = new QWidget( this ); 218 m_destWidget = new QWidget( this );
219 219
220 // Initialize UI 220 // Initialize UI
221 QVBoxLayout *vb = new QVBoxLayout( m_destWidget ); 221 QVBoxLayout *vb = new QVBoxLayout( m_destWidget );
222 QScrollView *sv = new QScrollView( m_destWidget ); 222 QScrollView *sv = new QScrollView( m_destWidget );
223 vb->addWidget( sv, 0, 0 ); 223 vb->addWidget( sv, 0, 0 );
224 sv->setResizePolicy( QScrollView::AutoOneFit ); 224 sv->setResizePolicy( QScrollView::AutoOneFit );
225 sv->setFrameStyle( QFrame::NoFrame ); 225 sv->setFrameStyle( QFrame::NoFrame );
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
277void OIpkgConfigDlg::initProxyWidget() 282void 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 );
307 grpbox->layout()->setMargin( 4 ); 312 grpbox->layout()->setMargin( 4 );
308 layout->addMultiCellWidget( grpbox, 1, 1, 0, 1 ); 313 layout->addMultiCellWidget( grpbox, 1, 1, 0, 1 );
309 grplayout = new QVBoxLayout( grpbox->layout() ); 314 grplayout = new QVBoxLayout( grpbox->layout() );
310 m_proxyFtpServer = new QLineEdit( grpbox ); 315 m_proxyFtpServer = new QLineEdit( grpbox );
311 QWhatsThis::add( m_proxyFtpServer, tr( "Enter the URL address of the FTP proxy server here." ) ); 316 QWhatsThis::add( m_proxyFtpServer, tr( "Enter the URL address of the FTP proxy server here." ) );
312 grplayout->addWidget( m_proxyFtpServer ); 317 grplayout->addWidget( m_proxyFtpServer );
313 m_proxyFtpActive = new QCheckBox( tr( "Enabled" ), grpbox ); 318 m_proxyFtpActive = new QCheckBox( tr( "Enabled" ), grpbox );
314 QWhatsThis::add( m_proxyFtpActive, tr( "Tap here to enable or disable the FTP proxy server." ) ); 319 QWhatsThis::add( m_proxyFtpActive, tr( "Tap here to enable or disable the FTP proxy server." ) );
315 grplayout->addWidget( m_proxyFtpActive ); 320 grplayout->addWidget( m_proxyFtpActive );
316 321
317 // Proxy server username and password configuration 322 // Proxy server username and password configuration
318 QLabel *label = new QLabel( tr( "Username:" ), container ); 323 QLabel *label = new QLabel( tr( "Username:" ), container );
319 QWhatsThis::add( label, tr( "Enter the username for the proxy servers here." ) ); 324 QWhatsThis::add( label, tr( "Enter the username for the proxy servers here." ) );
320 layout->addWidget( label, 2, 0 ); 325 layout->addWidget( label, 2, 0 );
321 m_proxyUsername = new QLineEdit( container ); 326 m_proxyUsername = new QLineEdit( container );
322 QWhatsThis::add( m_proxyUsername, tr( "Enter the username for the proxy servers here." ) ); 327 QWhatsThis::add( m_proxyUsername, tr( "Enter the username for the proxy servers here." ) );
323 layout->addWidget( m_proxyUsername, 2, 1 ); 328 layout->addWidget( m_proxyUsername, 2, 1 );
324 329
325 label = new QLabel( tr( "Password:" ), container ); 330 label = new QLabel( tr( "Password:" ), container );
326 QWhatsThis::add( label, tr( "Enter the password for the proxy servers here." ) ); 331 QWhatsThis::add( label, tr( "Enter the password for the proxy servers here." ) );
327 layout->addWidget( label, 3, 0 ); 332 layout->addWidget( label, 3, 0 );
328 m_proxyPassword = new QLineEdit( container ); 333 m_proxyPassword = new QLineEdit( container );
329 QWhatsThis::add( m_proxyPassword, tr( "Enter the password for the proxy servers here." ) ); 334 QWhatsThis::add( m_proxyPassword, tr( "Enter the password for the proxy servers here." ) );
330 layout->addWidget( m_proxyPassword, 3, 1 ); 335 layout->addWidget( m_proxyPassword, 3, 1 );
331} 336}
332 337
333void OIpkgConfigDlg::initOptionsWidget() 338void OIpkgConfigDlg::initOptionsWidget()
334{ 339{
335 m_optionsWidget = new QWidget( this ); 340 m_optionsWidget = new QWidget( this );
336 341
337 // Initialize UI 342 // Initialize UI
338 QVBoxLayout *vb = new QVBoxLayout( m_optionsWidget ); 343 QVBoxLayout *vb = new QVBoxLayout( m_optionsWidget );
339 QScrollView *sv = new QScrollView( m_optionsWidget ); 344 QScrollView *sv = new QScrollView( m_optionsWidget );
340 vb->addWidget( sv, 0, 0 ); 345 vb->addWidget( sv, 0, 0 );
341 sv->setResizePolicy( QScrollView::AutoOneFit ); 346 sv->setResizePolicy( QScrollView::AutoOneFit );
342 sv->setFrameStyle( QFrame::NoFrame ); 347 sv->setFrameStyle( QFrame::NoFrame );
343 QWidget *container = new QWidget( sv->viewport() ); 348 QWidget *container = new QWidget( sv->viewport() );
344 sv->addChild( container ); 349 sv->addChild( container );
345 QVBoxLayout *layout = new QVBoxLayout( container, 2, 4 ); 350 QVBoxLayout *layout = new QVBoxLayout( container, 2, 4 );
346 351
347 m_optForceDepends = new QCheckBox( tr( "Force Depends" ), container ); 352 m_optForceDepends = new QCheckBox( tr( "Force Depends" ), container );
348 QWhatsThis::add( m_optForceDepends, tr( "Tap here to enable or disable the '-force-depends' option for Ipkg." ) ); 353 QWhatsThis::add( m_optForceDepends, tr( "Tap here to enable or disable the '-force-depends' option for Ipkg." ) );
349 layout->addWidget( m_optForceDepends ); 354 layout->addWidget( m_optForceDepends );
350 355
351 m_optForceReinstall = new QCheckBox( tr( "Force Reinstall" ), container ); 356 m_optForceReinstall = new QCheckBox( tr( "Force Reinstall" ), container );
352 QWhatsThis::add( m_optForceReinstall, tr( "Tap here to enable or disable the '-force-reinstall' option for Ipkg." ) ); 357 QWhatsThis::add( m_optForceReinstall, tr( "Tap here to enable or disable the '-force-reinstall' option for Ipkg." ) );
353 layout->addWidget( m_optForceReinstall ); 358 layout->addWidget( m_optForceReinstall );
354 359
355 m_optForceRemove = new QCheckBox( tr( "Force Remove" ), container ); 360 m_optForceRemove = new QCheckBox( tr( "Force Remove" ), container );
356 QWhatsThis::add( m_optForceRemove, tr( "Tap here to enable or disable the '-force-removal-of-dependent-packages' option for Ipkg." ) ); 361 QWhatsThis::add( m_optForceRemove, tr( "Tap here to enable or disable the '-force-removal-of-dependent-packages' option for Ipkg." ) );
357 layout->addWidget( m_optForceRemove ); 362 layout->addWidget( m_optForceRemove );
358 363
359 m_optForceOverwrite = new QCheckBox( tr( "Force Overwrite" ), container ); 364 m_optForceOverwrite = new QCheckBox( tr( "Force Overwrite" ), container );
360 QWhatsThis::add( m_optForceOverwrite, tr( "Tap here to enable or disable the '-force-overwrite' option for Ipkg." ) ); 365 QWhatsThis::add( m_optForceOverwrite, tr( "Tap here to enable or disable the '-force-overwrite' option for Ipkg." ) );
361 layout->addWidget( m_optForceOverwrite ); 366 layout->addWidget( m_optForceOverwrite );
362 367
363 QLabel *l = new QLabel( tr( "Information Level" ), container ); 368 QLabel *l = new QLabel( tr( "Information Level" ), container );
364 QWhatsThis::add( l, tr( "Select information level for Ipkg." ) ); 369 QWhatsThis::add( l, tr( "Select information level for Ipkg." ) );
365 layout->addWidget( l ); 370 layout->addWidget( l );
366 371
367 m_optVerboseIpkg = new QComboBox( container ); 372 m_optVerboseIpkg = new QComboBox( container );
368 QWhatsThis::add( m_optVerboseIpkg, tr( "Select information level for Ipkg." ) ); 373 QWhatsThis::add( m_optVerboseIpkg, tr( "Select information level for Ipkg." ) );
369 m_optVerboseIpkg->insertItem( tr( "Errors only" ) ); 374 m_optVerboseIpkg->insertItem( tr( "Errors only" ) );
370 m_optVerboseIpkg->insertItem( tr( "Normal messages" ) ); 375 m_optVerboseIpkg->insertItem( tr( "Normal messages" ) );
371 m_optVerboseIpkg->insertItem( tr( "Informative messages" ) ); 376 m_optVerboseIpkg->insertItem( tr( "Informative messages" ) );
372 m_optVerboseIpkg->insertItem( tr( "Troubleshooting output" ) ); 377 m_optVerboseIpkg->insertItem( tr( "Troubleshooting output" ) );
373 layout->addWidget( m_optVerboseIpkg ); 378 layout->addWidget( m_optVerboseIpkg );
374 379
375 layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); 380 layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ) );
376} 381}
377 382
378void OIpkgConfigDlg::initData() 383void OIpkgConfigDlg::initData()
379{ 384{
380 // Read ipkg configuration (server/destination/proxy) information 385 // Read ipkg configuration (server/destination/proxy) information
381 if ( m_ipkg && !m_installOptions ) 386 if ( m_ipkg && !m_installOptions )
382 { 387 {
383 m_configs = m_ipkg->configItems(); 388 m_configs = m_ipkg->configItems();
384 if ( m_configs ) 389 if ( m_configs )
385 { 390 {
386 for ( OConfItemListIterator configIt( *m_configs ); configIt.current(); ++configIt ) 391 for ( OConfItemListIterator configIt( *m_configs ); configIt.current(); ++configIt )
387 { 392 {
388 OConfItem *config = configIt.current(); 393 OConfItem *config = configIt.current();
389 394
390 // Add configuration item to the appropriate dialog controls 395 // Add configuration item to the appropriate dialog controls
391 if ( config ) 396 if ( config )
392 { 397 {
393 if ( config->type() == OConfItem::Source ) 398 if ( config->type() == OConfItem::Source )
394 { 399 {
395 m_serverList->insertItem( config->name() ); 400 m_serverList->insertItem( config->name() );
396 } 401 }
397 else if ( config->type() == OConfItem::Destination ) 402 else if ( config->type() == OConfItem::Destination )
398 { 403 {
399 m_destList->insertItem( config->name() ); 404 m_destList->insertItem( config->name() );
400 } 405 }
401 else if ( config->type() == OConfItem::Option ) 406 else if ( config->type() == OConfItem::Option )
402 { 407 {
403 if ( config->name() == "http_proxy" ) 408 if ( config->name() == "http_proxy" )
404 { 409 {
405 m_proxyHttpServer->setText( config->value() ); 410 m_proxyHttpServer->setText( config->value() );
406 m_proxyHttpActive->setChecked( config->active() ); 411 m_proxyHttpActive->setChecked( config->active() );
407 } 412 }
408 else if ( config->name() == "ftp_proxy" ) 413 else if ( config->name() == "ftp_proxy" )
409 { 414 {
410 m_proxyFtpServer->setText( config->value() ); 415 m_proxyFtpServer->setText( config->value() );
411 m_proxyFtpActive->setChecked( config->active() ); 416 m_proxyFtpActive->setChecked( config->active() );
412 } 417 }
413 else if ( config->name() == "proxy_username" ) 418 else if ( config->name() == "proxy_username" )
414 { 419 {
415 m_proxyUsername->setText( config->value() ); 420 m_proxyUsername->setText( config->value() );
416 } 421 }
417 else if ( config->name() == "proxy_password" ) 422 else if ( config->name() == "proxy_password" )
418 { 423 {
419 m_proxyPassword->setText( config->value() ); 424 m_proxyPassword->setText( config->value() );
420 } 425 }
421 } 426 }
422 } 427 }
423 } 428 }
424 } 429 }
425 } 430 }
426 431
427 // Get Ipkg execution options 432 // Get Ipkg execution options
428 int options = m_ipkg->ipkgExecOptions(); 433 int options = m_ipkg->ipkgExecOptions();
429 if ( options & FORCE_DEPENDS ) 434 if ( options & FORCE_DEPENDS )
430 m_optForceDepends->setChecked( true ); 435 m_optForceDepends->setChecked( true );
431 if ( options & FORCE_REINSTALL ) 436 if ( options & FORCE_REINSTALL )
432 m_optForceReinstall->setChecked( true ); 437 m_optForceReinstall->setChecked( true );
433 if ( options & FORCE_REMOVE ) 438 if ( options & FORCE_REMOVE )
434 m_optForceRemove->setChecked( true ); 439 m_optForceRemove->setChecked( true );
435 if ( options & FORCE_OVERWRITE ) 440 if ( options & FORCE_OVERWRITE )
436 m_optForceOverwrite->setChecked( true ); 441 m_optForceOverwrite->setChecked( true );
437 442
438 m_optVerboseIpkg->setCurrentItem( m_ipkg->ipkgExecVerbosity() ); 443 m_optVerboseIpkg->setCurrentItem( m_ipkg->ipkgExecVerbosity() );
439} 444}
440 445
441OConfItem *OIpkgConfigDlg::findConfItem( OConfItem::Type type, const QString &name ) 446OConfItem *OIpkgConfigDlg::findConfItem( OConfItem::Type type, const QString &name )
442{ 447{
443 // Find selected server in list 448 // Find selected server in list
444 OConfItemListIterator configIt( *m_configs ); 449 OConfItemListIterator configIt( *m_configs );
445 OConfItem *config = 0x0; 450 OConfItem *config = 0x0;
446 for ( ; configIt.current(); ++configIt ) 451 for ( ; configIt.current(); ++configIt )
447 { 452 {
448 config = configIt.current(); 453 config = configIt.current();
449 if ( config->type() == type && config->name() == name ) 454 if ( config->type() == type && config->name() == name )
450 break; 455 break;
451 } 456 }
452 457
453 if ( config && config->type() == type && config->name() == name ) 458 if ( config && config->type() == type && config->name() == name )
454 return config; 459 return config;
455 460
456 return 0x0; 461 return 0x0;
457} 462}
458 463
459void OIpkgConfigDlg::slotServerEdit( int index ) 464void OIpkgConfigDlg::slotServerEdit( int index )
460{ 465{
461 m_serverNew = false; 466 m_serverNew = false;
462 m_serverCurrent = index; 467 m_serverCurrent = index;
463 468
464 // Find selected server in list 469 // Find selected server in list
465 OConfItem *server = findConfItem( OConfItem::Source, m_serverList->currentText() ); 470 OConfItem *server = findConfItem( OConfItem::Source, m_serverList->currentText() );
466 471
467 // Display server details 472 // Display server details
468 if ( server ) 473 if ( server )
469 { 474 {
470 m_serverCurrName = server->name(); 475 m_serverCurrName = server->name();
471 m_serverName->setText( server->name() ); 476 m_serverName->setText( server->name() );
472 m_serverLocation->setText( server->value() ); 477 m_serverLocation->setText( server->value() );
473 m_serverActive->setChecked( server->active() ); 478 m_serverActive->setChecked( server->active() );
474 m_serverName->setFocus(); 479 m_serverName->setFocus();
475 } 480 }
476} 481}
477 482
478void OIpkgConfigDlg::slotServerNew() 483void OIpkgConfigDlg::slotServerNew()
479{ 484{
480 m_serverNew = true; 485 m_serverNew = true;
481 486
482 m_serverName->setText( QString::null ); 487 m_serverName->setText( QString::null );
483 m_serverLocation->setText( QString::null ); 488 m_serverLocation->setText( QString::null );
484 m_serverActive->setChecked( true ); 489 m_serverActive->setChecked( true );
485 m_serverName->setFocus(); 490 m_serverName->setFocus();
486} 491}
487 492
488void OIpkgConfigDlg::slotServerDelete() 493void OIpkgConfigDlg::slotServerDelete()
489{ 494{
490 // Find selected server in list 495 // Find selected server in list
491 OConfItem *server = findConfItem( OConfItem::Source, m_serverList->currentText() ); 496 OConfItem *server = findConfItem( OConfItem::Source, m_serverList->currentText() );
492 497
493 // Delete server 498 // Delete server
494 if ( server ) 499 if ( server )
495 { 500 {
496 m_configs->removeRef( server ); 501 m_configs->removeRef( server );
497 m_serverList->removeItem( m_serverCurrent ); 502 m_serverList->removeItem( m_serverCurrent );
498 } 503 }
499} 504}
500 505
501void OIpkgConfigDlg::slotServerUpdate() 506void OIpkgConfigDlg::slotServerUpdate()
502{ 507{
503 QString newName = m_serverName->text(); 508 QString newName = m_serverName->text();
504 509
505 // Convert any spaces to underscores 510 // Convert any spaces to underscores
506 newName.replace( QRegExp( " " ), "_" ); 511 newName.replace( QRegExp( " " ), "_" );
507 512
508 if ( !m_serverNew ) 513 if ( !m_serverNew )
509 { 514 {
510 // Find selected server in list 515 // Find selected server in list
511 OConfItem *server = findConfItem( OConfItem::Source, m_serverCurrName ); 516 OConfItem *server = findConfItem( OConfItem::Source, m_serverCurrName );
512 517
513 // Delete server 518 // Delete server
514 if ( server ) 519 if ( server )
515 { 520 {
516 // Update url 521 // Update url
517 server->setValue( m_serverLocation->text() ); 522 server->setValue( m_serverLocation->text() );
518 server->setActive( m_serverActive->isChecked() ); 523 server->setActive( m_serverActive->isChecked() );
519 524
520 // Check if server name has changed, if it has then we need to replace the key in the map 525 // Check if server name has changed, if it has then we need to replace the key in the map
521 if ( m_serverCurrName != newName ) 526 if ( m_serverCurrName != newName )
522 { 527 {
523 // Update server name 528 // Update server name
524 server->setName( newName ); 529 server->setName( newName );
525 530
526 // Update list box 531 // Update list box
527 m_serverList->changeItem( newName, m_serverCurrent ); 532 m_serverList->changeItem( newName, m_serverCurrent );
528 } 533 }
529 } 534 }
530 } 535 }
531 else 536 else
532 { 537 {
533 // Add new destination to configuration list 538 // Add new destination to configuration list
534 m_configs->append( new OConfItem( OConfItem::Source, newName, 539 m_configs->append( new OConfItem( OConfItem::Source, newName,
535 m_serverLocation->text(), m_serverActive->isChecked() ) ); 540 m_serverLocation->text(), m_serverActive->isChecked() ) );
536 m_configs->sort(); 541 m_configs->sort();
537 542
538 m_serverList->insertItem( newName ); 543 m_serverList->insertItem( newName );
539 m_serverList->setCurrentItem( m_serverList->count() ); 544 m_serverList->setCurrentItem( m_serverList->count() );
540 m_serverNew = false; 545 m_serverNew = false;
541 m_serverList->insertItem( newName ); 546 m_serverList->insertItem( newName );
542 } 547 }
543} 548}
544 549
545void OIpkgConfigDlg::slotDestEdit( int index ) 550void OIpkgConfigDlg::slotDestEdit( int index )
546{ 551{
547 m_destNew = false; 552 m_destNew = false;
548 m_destCurrent = index; 553 m_destCurrent = index;
549 554
550 // Find selected destination in list 555 // Find selected destination in list
551 OConfItem *destination = findConfItem( OConfItem::Destination, m_destList->currentText() ); 556 OConfItem *destination = findConfItem( OConfItem::Destination, m_destList->currentText() );
552 557
553 // Display destination details 558 // Display destination details
554 if ( destination ) 559 if ( destination )
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
564void OIpkgConfigDlg::slotDestNew() 569void 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
574void OIpkgConfigDlg::slotDestDelete() 579void 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
592void 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
587void OIpkgConfigDlg::slotDestUpdate() 600void 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 {
619 // Add new destination to configuration list 632 // Add new destination to configuration list
620 m_configs->append( new OConfItem( OConfItem::Destination, newName, 633 m_configs->append( new OConfItem( OConfItem::Destination, newName,
621 m_destLocation->text(), m_destActive->isChecked() ) ); 634 m_destLocation->text(), m_destActive->isChecked() ) );
622 m_configs->sort(); 635 m_configs->sort();
623 636
624 m_destList->insertItem( newName ); 637 m_destList->insertItem( newName );
625 m_destList->setCurrentItem( m_destList->count() ); 638 m_destList->setCurrentItem( m_destList->count() );
626 m_destNew = false; 639 m_destNew = false;
627 } 640 }
628} 641}
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,131 +1,132 @@
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
43class QCheckBox; 43class QCheckBox;
44class QComboBox; 44class QComboBox;
45class QLineEdit; 45class QLineEdit;
46class QListBox; 46class QListBox;
47 47
48class OIpkgConfigDlg : public QDialog 48class OIpkgConfigDlg : public QDialog
49{ 49{
50 Q_OBJECT 50 Q_OBJECT
51 51
52public: 52public:
53 OIpkgConfigDlg( OIpkg *ipkg = 0x0, bool installOptions = false, QWidget *parent = 0x0 ); 53 OIpkgConfigDlg( OIpkg *ipkg = 0x0, bool installOptions = false, QWidget *parent = 0x0 );
54 54
55protected slots: 55protected slots:
56 void accept(); 56 void accept();
57 void reject(); 57 void reject();
58 58
59private: 59private:
60 OIpkg *m_ipkg; // Pointer to Ipkg class for retrieving/saving configuration options 60 OIpkg *m_ipkg; // Pointer to Ipkg class for retrieving/saving configuration options
61 OConfItemList *m_configs; // Local list of configuration items 61 OConfItemList *m_configs; // Local list of configuration items
62 62
63 bool m_installOptions; // If true, will only display the Options tab 63 bool m_installOptions; // If true, will only display the Options tab
64 64
65 // Server cached information 65 // Server cached information
66 bool m_serverNew; // Indicates if server information is for a new server 66 bool m_serverNew; // Indicates if server information is for a new server
67 int m_serverCurrent; // Index of currently selected server in m_serverList 67 int m_serverCurrent; // Index of currently selected server in m_serverList
68 QString m_serverCurrName; // Name of currently selected server in m_serverList 68 QString m_serverCurrName; // Name of currently selected server in m_serverList
69 69
70 // Destination cached information 70 // Destination cached information
71 bool m_destNew; // Indicates if destination information is for a new destination 71 bool m_destNew; // Indicates if destination information is for a new destination
72 int m_destCurrent; // Index of currently selected destination in m_destList 72 int m_destCurrent; // Index of currently selected destination in m_destList
73 QString m_destCurrName; // Name of currently selected destination in m_destList 73 QString m_destCurrName; // Name of currently selected destination in m_destList
74 74
75 // UI controls 75 // UI controls
76 QVBoxLayout m_layout; // Main dialog layout control 76 QVBoxLayout m_layout; // Main dialog layout control
77 Opie::Ui::OTabWidget m_tabWidget; // Main tab widget control 77 Opie::Ui::OTabWidget m_tabWidget; // Main tab widget control
78 QWidget *m_serverWidget; // Widget containing server configuration controls 78 QWidget *m_serverWidget; // Widget containing server configuration controls
79 QWidget *m_destWidget; // Widget containing destination configuration controls 79 QWidget *m_destWidget; // Widget containing destination configuration controls
80 QWidget *m_proxyWidget; // Widget containing proxy configuration controls 80 QWidget *m_proxyWidget; // Widget containing proxy configuration controls
81 QWidget *m_optionsWidget; // Widget containing ipkg execution configuration controls 81 QWidget *m_optionsWidget; // Widget containing ipkg execution configuration controls
82 82
83 // Server configuration UI controls 83 // Server configuration UI controls
84 QListBox *m_serverList; // Server list selection 84 QListBox *m_serverList; // Server list selection
85 QLineEdit *m_serverName; // Server name edit box 85 QLineEdit *m_serverName; // Server name edit box
86 QLineEdit *m_serverLocation; // Server location URL edit box 86 QLineEdit *m_serverLocation; // Server location URL edit box
87 QCheckBox *m_serverActive; // Activate server check box 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, const QString &name = 0x0 );
118 118
119private slots: 119private 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