summaryrefslogtreecommitdiff
path: root/noncore/settings/aqpkg/settingsimpl.cpp
Unidiff
Diffstat (limited to 'noncore/settings/aqpkg/settingsimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/settingsimpl.cpp243
1 files changed, 122 insertions, 121 deletions
diff --git a/noncore/settings/aqpkg/settingsimpl.cpp b/noncore/settings/aqpkg/settingsimpl.cpp
index 4887ceb..9fdf31e 100644
--- a/noncore/settings/aqpkg/settingsimpl.cpp
+++ b/noncore/settings/aqpkg/settingsimpl.cpp
@@ -15,90 +15,89 @@
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
19..}^=.=       =       ; Public License for more details. 19..}^=.=       =       ; Public License for more details.
20++=   -.     .`     .: 20++=   -.     .`     .:
21 :     =  ...= . :.=- You should have received a copy of the GNU 21 :     =  ...= . :.=- You should have received a copy of the GNU
22 -.   .:....=;==+<; General Public License along with this file; 22 -.   .:....=;==+<; General Public License along with this file;
23  -_. . .   )=.  = see the file COPYING. If not, write to the 23  -_. . .   )=.  = see the file COPYING. If not, write to the
24    --        :-=` Free Software Foundation, Inc., 24    --        :-=` Free Software Foundation, Inc.,
25 59 Temple Place - Suite 330, 25 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 26 Boston, MA 02111-1307, USA.
27 27
28*/ 28*/
29 29
30#include <fstream> 30#include "settingsimpl.h"
31#include <algorithm> 31#include "global.h"
32using namespace std;
33 32
33/* OPIE */
34#include <opie/otabwidget.h>
35#ifdef QWS
36#include <qpe/config.h>
37#include <qpe/resource.h>
38#endif
39#include <qpe/qpeapplication.h>
40
41/* QT */
34#include <qcheckbox.h> 42#include <qcheckbox.h>
35#include <qgroupbox.h> 43#include <qgroupbox.h>
36#include <qlabel.h> 44#include <qlabel.h>
37#include <qlayout.h> 45#include <qlayout.h>
38#include <qlineedit.h> 46#include <qlineedit.h>
39#include <qlistbox.h> 47#include <qlistbox.h>
40#include <qpushbutton.h> 48#include <qpushbutton.h>
41 49
42#include <opie/otabwidget.h> 50/* STD */
43 51#include <fstream>
44#ifdef QWS 52#include <algorithm>
45#include <qpe/config.h> 53using namespace std;
46#include <qpe/resource.h>
47#endif
48
49#include "settingsimpl.h"
50
51#include "global.h"
52 54
53SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl ) 55SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl )
54 : QDialog( parent, name, modal, fl ) 56 : QDialog( parent, name, modal, fl )
55{ 57{
56 setCaption( tr( "Configuration" ) ); 58 setCaption( tr( "Configuration" ) );
57 59
58 // Setup layout to make everything pretty 60 // Setup layout to make everything pretty
59 QVBoxLayout *layout = new QVBoxLayout( this ); 61 QVBoxLayout *layout = new QVBoxLayout( this );
60 layout->setMargin( 2 ); 62 layout->setMargin( 2 );
61 layout->setSpacing( 4 ); 63 layout->setSpacing( 4 );
62 64
63 // Setup tabs for all info 65 // Setup tabs for all info
64 OTabWidget *tabwidget = new OTabWidget( this ); 66 OTabWidget *tabwidget = new OTabWidget( this );
65 layout->addWidget( tabwidget ); 67 layout->addWidget( tabwidget );
66 68
67 tabwidget->addTab( initServerTab(), "aqpkg/servertab", tr( "Servers" ) ); 69 tabwidget->addTab( initServerTab(), "aqpkg/servertab", tr( "Servers" ) );
68 tabwidget->addTab( initDestinationTab(), "aqpkg/desttab", tr( "Destinations" ) ); 70 tabwidget->addTab( initDestinationTab(), "aqpkg/desttab", tr( "Destinations" ) );
69 tabwidget->addTab( initProxyTab(), "aqpkg/proxytab", tr( "Proxies" ) ); 71 tabwidget->addTab( initProxyTab(), "aqpkg/proxytab", tr( "Proxies" ) );
70 tabwidget->setCurrentTab( tr( "Servers" ) ); 72 tabwidget->setCurrentTab( tr( "Servers" ) );
71 73
72 dataMgr = dataManager; 74 dataMgr = dataManager;
73 setupData(); 75 setupData();
74 changed = false; 76 changed = false;
75 newserver = false; 77 newserver = false;
76 newdestination = false; 78 newdestination = false;
77} 79}
78 80
79SettingsImpl :: ~SettingsImpl() 81SettingsImpl :: ~SettingsImpl()
80{ 82{
81
82} 83}
83 84
84bool SettingsImpl :: showDlg() 85bool SettingsImpl :: showDlg()
85{ 86{
86 showMaximized(); 87 QPEApplication::execDialog( this );
87 exec(); 88 if ( changed )
88 89 dataMgr->writeOutIpkgConf();
89 if ( changed )
90 dataMgr->writeOutIpkgConf();
91 90
92 return changed; 91 return changed;
93} 92}
94 93
95QWidget *SettingsImpl :: initServerTab() 94QWidget *SettingsImpl :: initServerTab()
96{ 95{
97 QWidget *control = new QWidget( this ); 96 QWidget *control = new QWidget( this );
98 97
99 QVBoxLayout *vb = new QVBoxLayout( control ); 98 QVBoxLayout *vb = new QVBoxLayout( control );
100 99
101 QScrollView *sv = new QScrollView( control ); 100 QScrollView *sv = new QScrollView( control );
102 vb->addWidget( sv, 0, 0 ); 101 vb->addWidget( sv, 0, 0 );
103 sv->setResizePolicy( QScrollView::AutoOneFit ); 102 sv->setResizePolicy( QScrollView::AutoOneFit );
104 sv->setFrameStyle( QFrame::NoFrame ); 103 sv->setFrameStyle( QFrame::NoFrame );
@@ -109,53 +108,53 @@ QWidget *SettingsImpl :: initServerTab()
109 QGridLayout *layout = new QGridLayout( container ); 108 QGridLayout *layout = new QGridLayout( container );
110 layout->setSpacing( 2 ); 109 layout->setSpacing( 2 );
111 layout->setMargin( 4 ); 110 layout->setMargin( 4 );
112 111
113 servers = new QListBox( container ); 112 servers = new QListBox( container );
114 servers->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); 113 servers->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) );
115 connect( servers, SIGNAL( highlighted( int ) ), this, SLOT( editServer( int ) ) ); 114 connect( servers, SIGNAL( highlighted( int ) ), this, SLOT( editServer( int ) ) );
116 layout->addMultiCellWidget( servers, 0, 0, 0, 1 ); 115 layout->addMultiCellWidget( servers, 0, 0, 0, 1 );
117 116
118 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); 117 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container );
119 connect( btn, SIGNAL( clicked() ), this, SLOT( newServer() ) ); 118 connect( btn, SIGNAL( clicked() ), this, SLOT( newServer() ) );
120 layout->addWidget( btn, 1, 0 ); 119 layout->addWidget( btn, 1, 0 );
121 120
122 btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); 121 btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container );
123 connect( btn, SIGNAL( clicked() ), this, SLOT( removeServer() ) ); 122 connect( btn, SIGNAL( clicked() ), this, SLOT( removeServer() ) );
124 layout->addWidget( btn, 1, 1 ); 123 layout->addWidget( btn, 1, 1 );
125 124
126 QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Server" ), container ); 125 QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Server" ), container );
127 grpbox->layout()->setSpacing( 2 ); 126 grpbox->layout()->setSpacing( 2 );
128 grpbox->layout()->setMargin( 4 ); 127 grpbox->layout()->setMargin( 4 );
129 layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 ); 128 layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 );
130 129
131 QGridLayout *grplayout = new QGridLayout( grpbox->layout() ); 130 QGridLayout *grplayout = new QGridLayout( grpbox->layout() );
132 131
133 QLabel *label = new QLabel( tr( "Name:" ), grpbox ); 132 QLabel *label = new QLabel( tr( "Name:" ), grpbox );
134 grplayout->addWidget( label, 0, 0 ); 133 grplayout->addWidget( label, 0, 0 );
135 servername = new QLineEdit( grpbox ); 134 servername = new QLineEdit( grpbox );
136 grplayout->addWidget( servername, 0, 1 ); 135 grplayout->addWidget( servername, 0, 1 );
137 136
138 label = new QLabel( tr( "Address:" ), grpbox ); 137 label = new QLabel( tr( "Address:" ), grpbox );
139 grplayout->addWidget( label, 1, 0 ); 138 grplayout->addWidget( label, 1, 0 );
140 serverurl = new QLineEdit( grpbox ); 139 serverurl = new QLineEdit( grpbox );
141 grplayout->addWidget( serverurl, 1, 1 ); 140 grplayout->addWidget( serverurl, 1, 1 );
142 141
143 active = new QCheckBox( tr( "Active Server" ), grpbox ); 142 active = new QCheckBox( tr( "Active Server" ), grpbox );
144 grplayout->addMultiCellWidget( active, 2, 2, 0, 1 ); 143 grplayout->addMultiCellWidget( active, 2, 2, 0, 1 );
145 144
146 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox ); 145 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox );
147 connect( btn, SIGNAL( clicked() ), this, SLOT( changeServerDetails() ) ); 146 connect( btn, SIGNAL( clicked() ), this, SLOT( changeServerDetails() ) );
148 grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 ); 147 grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 );
149 148
150 return control; 149 return control;
151} 150}
152 151
153QWidget *SettingsImpl :: initDestinationTab() 152QWidget *SettingsImpl :: initDestinationTab()
154{ 153{
155 QWidget *control = new QWidget( this ); 154 QWidget *control = new QWidget( this );
156 155
157 QVBoxLayout *vb = new QVBoxLayout( control ); 156 QVBoxLayout *vb = new QVBoxLayout( control );
158 157
159 QScrollView *sv = new QScrollView( control ); 158 QScrollView *sv = new QScrollView( control );
160 vb->addWidget( sv, 0, 0 ); 159 vb->addWidget( sv, 0, 0 );
161 sv->setResizePolicy( QScrollView::AutoOneFit ); 160 sv->setResizePolicy( QScrollView::AutoOneFit );
@@ -167,53 +166,53 @@ QWidget *SettingsImpl :: initDestinationTab()
167 QGridLayout *layout = new QGridLayout( container ); 166 QGridLayout *layout = new QGridLayout( container );
168 layout->setSpacing( 2 ); 167 layout->setSpacing( 2 );
169 layout->setMargin( 4 ); 168 layout->setMargin( 4 );
170 169
171 destinations = new QListBox( container ); 170 destinations = new QListBox( container );
172 destinations->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); 171 destinations->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) );
173 connect( destinations, SIGNAL( highlighted( int ) ), this, SLOT( editDestination( int ) ) ); 172 connect( destinations, SIGNAL( highlighted( int ) ), this, SLOT( editDestination( int ) ) );
174 layout->addMultiCellWidget( destinations, 0, 0, 0, 1 ); 173 layout->addMultiCellWidget( destinations, 0, 0, 0, 1 );
175 174
176 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); 175 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container );
177 connect( btn, SIGNAL( clicked() ), this, SLOT( newDestination() ) ); 176 connect( btn, SIGNAL( clicked() ), this, SLOT( newDestination() ) );
178 layout->addWidget( btn, 1, 0 ); 177 layout->addWidget( btn, 1, 0 );
179 178
180 btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); 179 btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container );
181 connect( btn, SIGNAL( clicked() ), this, SLOT( removeDestination() ) ); 180 connect( btn, SIGNAL( clicked() ), this, SLOT( removeDestination() ) );
182 layout->addWidget( btn, 1, 1 ); 181 layout->addWidget( btn, 1, 1 );
183 182
184 QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Destination" ), container ); 183 QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Destination" ), container );
185 grpbox->layout()->setSpacing( 2 ); 184 grpbox->layout()->setSpacing( 2 );
186 grpbox->layout()->setMargin( 4 ); 185 grpbox->layout()->setMargin( 4 );
187 layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 ); 186 layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 );
188 187
189 QGridLayout *grplayout = new QGridLayout( grpbox->layout() ); 188 QGridLayout *grplayout = new QGridLayout( grpbox->layout() );
190 189
191 QLabel *label = new QLabel( tr( "Name:" ), grpbox ); 190 QLabel *label = new QLabel( tr( "Name:" ), grpbox );
192 grplayout->addWidget( label, 0, 0 ); 191 grplayout->addWidget( label, 0, 0 );
193 destinationname = new QLineEdit( grpbox ); 192 destinationname = new QLineEdit( grpbox );
194 grplayout->addWidget( destinationname, 0, 1 ); 193 grplayout->addWidget( destinationname, 0, 1 );
195 194
196 label = new QLabel( tr( "Location:" ), grpbox ); 195 label = new QLabel( tr( "Location:" ), grpbox );
197 grplayout->addWidget( label, 1, 0 ); 196 grplayout->addWidget( label, 1, 0 );
198 destinationurl = new QLineEdit( grpbox ); 197 destinationurl = new QLineEdit( grpbox );
199 grplayout->addWidget( destinationurl, 1, 1 ); 198 grplayout->addWidget( destinationurl, 1, 1 );
200 199
201 linkToRoot = new QCheckBox( tr( "Link to root" ), grpbox ); 200 linkToRoot = new QCheckBox( tr( "Link to root" ), grpbox );
202 grplayout->addMultiCellWidget( linkToRoot, 2, 2, 0, 1 ); 201 grplayout->addMultiCellWidget( linkToRoot, 2, 2, 0, 1 );
203 202
204 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox ); 203 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox );
205 connect( btn, SIGNAL( clicked() ), this, SLOT( changeDestinationDetails() ) ); 204 connect( btn, SIGNAL( clicked() ), this, SLOT( changeDestinationDetails() ) );
206 grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 ); 205 grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 );
207 206
208 return control; 207 return control;
209} 208}
210 209
211QWidget *SettingsImpl :: initProxyTab() 210QWidget *SettingsImpl :: initProxyTab()
212{ 211{
213 QWidget *control = new QWidget( this ); 212 QWidget *control = new QWidget( this );
214 213
215 QVBoxLayout *vb = new QVBoxLayout( control ); 214 QVBoxLayout *vb = new QVBoxLayout( control );
216 215
217 QScrollView *sv = new QScrollView( control ); 216 QScrollView *sv = new QScrollView( control );
218 vb->addWidget( sv, 0, 0 ); 217 vb->addWidget( sv, 0, 0 );
219 sv->setResizePolicy( QScrollView::AutoOneFit ); 218 sv->setResizePolicy( QScrollView::AutoOneFit );
@@ -226,72 +225,72 @@ QWidget *SettingsImpl :: initProxyTab()
226 layout->setSpacing( 2 ); 225 layout->setSpacing( 2 );
227 layout->setMargin( 4 ); 226 layout->setMargin( 4 );
228 227
229 QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "HTTP Proxy" ), container ); 228 QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "HTTP Proxy" ), container );
230 grpbox->layout()->setSpacing( 2 ); 229 grpbox->layout()->setSpacing( 2 );
231 grpbox->layout()->setMargin( 4 ); 230 grpbox->layout()->setMargin( 4 );
232 layout->addMultiCellWidget( grpbox, 0, 0, 0, 1 ); 231 layout->addMultiCellWidget( grpbox, 0, 0, 0, 1 );
233 QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() ); 232 QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() );
234 txtHttpProxy = new QLineEdit( grpbox ); 233 txtHttpProxy = new QLineEdit( grpbox );
235 grplayout->addWidget( txtHttpProxy ); 234 grplayout->addWidget( txtHttpProxy );
236 chkHttpProxyEnabled = new QCheckBox( tr( "Enabled" ), grpbox ); 235 chkHttpProxyEnabled = new QCheckBox( tr( "Enabled" ), grpbox );
237 grplayout->addWidget( chkHttpProxyEnabled ); 236 grplayout->addWidget( chkHttpProxyEnabled );
238 237
239 grpbox = new QGroupBox( 0, Qt::Vertical, tr( "FTP Proxy" ), container ); 238 grpbox = new QGroupBox( 0, Qt::Vertical, tr( "FTP Proxy" ), container );
240 grpbox->layout()->setSpacing( 2 ); 239 grpbox->layout()->setSpacing( 2 );
241 grpbox->layout()->setMargin( 4 ); 240 grpbox->layout()->setMargin( 4 );
242 layout->addMultiCellWidget( grpbox, 1, 1, 0, 1 ); 241 layout->addMultiCellWidget( grpbox, 1, 1, 0, 1 );
243 grplayout = new QVBoxLayout( grpbox->layout() ); 242 grplayout = new QVBoxLayout( grpbox->layout() );
244 txtFtpProxy = new QLineEdit( grpbox ); 243 txtFtpProxy = new QLineEdit( grpbox );
245 grplayout->addWidget( txtFtpProxy ); 244 grplayout->addWidget( txtFtpProxy );
246 chkFtpProxyEnabled = new QCheckBox( tr( "Enabled" ), grpbox ); 245 chkFtpProxyEnabled = new QCheckBox( tr( "Enabled" ), grpbox );
247 grplayout->addWidget( chkFtpProxyEnabled ); 246 grplayout->addWidget( chkFtpProxyEnabled );
248 247
249 QLabel *label = new QLabel( tr( "Username:" ), container ); 248 QLabel *label = new QLabel( tr( "Username:" ), container );
250 layout->addWidget( label, 2, 0 ); 249 layout->addWidget( label, 2, 0 );
251 txtUsername = new QLineEdit( container ); 250 txtUsername = new QLineEdit( container );
252 layout->addWidget( txtUsername, 2, 1 ); 251 layout->addWidget( txtUsername, 2, 1 );
253 252
254 label = new QLabel( tr( "Password:" ), container ); 253 label = new QLabel( tr( "Password:" ), container );
255 layout->addWidget( label, 3, 0 ); 254 layout->addWidget( label, 3, 0 );
256 txtPassword = new QLineEdit( container ); 255 txtPassword = new QLineEdit( container );
257 layout->addWidget( txtPassword, 3, 1 ); 256 layout->addWidget( txtPassword, 3, 1 );
258 257
259 QPushButton *btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), container ); 258 QPushButton *btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), container );
260 connect( btn, SIGNAL( clicked() ), this, SLOT( proxyApplyChanges() ) ); 259 connect( btn, SIGNAL( clicked() ), this, SLOT( proxyApplyChanges() ) );
261 layout->addMultiCellWidget( btn, 4, 4, 0, 1 ); 260 layout->addMultiCellWidget( btn, 4, 4, 0, 1 );
262 261
263 return control; 262 return control;
264} 263}
265 264
266void SettingsImpl :: setupData() 265void SettingsImpl :: setupData()
267{ 266{
268 // add servers 267 // add servers
269 QString serverName; 268 QString serverName;
270 QListIterator<Server> it( dataMgr->getServerList() ); 269 QListIterator<Server> it( dataMgr->getServerList() );
271 for ( ; it.current(); ++it ) 270 for ( ; it.current(); ++it )
272 { 271 {
273 serverName = it.current()->getServerName(); 272 serverName = it.current()->getServerName();
274 if ( serverName == LOCAL_SERVER || serverName == LOCAL_IPKGS ) 273 if ( serverName == LOCAL_SERVER || serverName == LOCAL_IPKGS )
275 continue; 274 continue;
276 275
277 servers->insertItem( serverName ); 276 servers->insertItem( serverName );
278 } 277 }
279 278
280 279
281 // add destinations 280 // add destinations
282 QListIterator<Destination> it2( dataMgr->getDestinationList() ); 281 QListIterator<Destination> it2( dataMgr->getDestinationList() );
283 for ( ; it2.current(); ++it2 ) 282 for ( ; it2.current(); ++it2 )
284 destinations->insertItem( it2.current()->getDestinationName() ); 283 destinations->insertItem( it2.current()->getDestinationName() );
285 284
286 // setup proxy tab 285 // setup proxy tab
287 txtHttpProxy->setText( dataMgr->getHttpProxy() ); 286 txtHttpProxy->setText( dataMgr->getHttpProxy() );
288 txtFtpProxy->setText( dataMgr->getFtpProxy() ); 287 txtFtpProxy->setText( dataMgr->getFtpProxy() );
289 txtUsername->setText( dataMgr->getProxyUsername() ); 288 txtUsername->setText( dataMgr->getProxyUsername() );
290 txtPassword->setText( dataMgr->getProxyPassword() ); 289 txtPassword->setText( dataMgr->getProxyPassword() );
291 chkHttpProxyEnabled->setChecked( dataMgr->getHttpProxyEnabled() ); 290 chkHttpProxyEnabled->setChecked( dataMgr->getHttpProxyEnabled() );
292 chkFtpProxyEnabled->setChecked( dataMgr->getFtpProxyEnabled() ); 291 chkFtpProxyEnabled->setChecked( dataMgr->getFtpProxyEnabled() );
293} 292}
294 293
295//------------------ Servers tab ---------------------- 294//------------------ Servers tab ----------------------
296 295
297void SettingsImpl :: editServer( int sel ) 296void SettingsImpl :: editServer( int sel )
@@ -327,71 +326,71 @@ void SettingsImpl :: removeServer()
327{ 326{
328 changed = true; 327 changed = true;
329 Server *s = dataMgr->getServer( servers->currentText() ); 328 Server *s = dataMgr->getServer( servers->currentText() );
330 if ( s ) 329 if ( s )
331 { 330 {
332 dataMgr->getServerList().removeRef( s ); 331 dataMgr->getServerList().removeRef( s );
333 servers->removeItem( currentSelectedServer ); 332 servers->removeItem( currentSelectedServer );
334 } 333 }
335} 334}
336 335
337void SettingsImpl :: changeServerDetails() 336void SettingsImpl :: changeServerDetails()
338{ 337{
339 changed = true; 338 changed = true;
340 339
341 QString newName = servername->text(); 340 QString newName = servername->text();
342 341
343 // Convert any spaces to underscores 342 // Convert any spaces to underscores
344 char *tmpStr = new char[newName.length() + 1]; 343 char *tmpStr = new char[newName.length() + 1];
345 for ( unsigned int i = 0 ; i < newName.length() ; ++i ) 344 for ( unsigned int i = 0 ; i < newName.length() ; ++i )
346 { 345 {
347 if ( newName[i] == ' ' ) 346 if ( newName[i] == ' ' )
348 tmpStr[i] = '_'; 347 tmpStr[i] = '_';
349 else 348 else
350 tmpStr[i] = newName[i].latin1(); 349 tmpStr[i] = newName[i].latin1();
351 } 350 }
352 tmpStr[newName.length()] = '\0'; 351 tmpStr[newName.length()] = '\0';
353 352
354 newName = tmpStr; 353 newName = tmpStr;
355 delete tmpStr; 354 delete tmpStr;
356 355
357 if ( !newserver ) 356 if ( !newserver )
358 { 357 {
359 Server *s = dataMgr->getServer( servers->currentText() ); 358 Server *s = dataMgr->getServer( servers->currentText() );
360 if ( s ) 359 if ( s )
361 { 360 {
362 // Update url 361 // Update url
363 s->setServerUrl( serverurl->text() ); 362 s->setServerUrl( serverurl->text() );
364 s->setActive( active->isChecked() ); 363 s->setActive( active->isChecked() );
365 364
366 // Check if server name has changed, if it has then we need to replace the key in the map 365 // Check if server name has changed, if it has then we need to replace the key in the map
367 if ( serverName != newName ) 366 if ( serverName != newName )
368 { 367 {
369 // Update server name 368 // Update server name
370 s->setServerName( newName ); 369 s->setServerName( newName );
371 } 370 }
372 371
373 // Update list box 372 // Update list box
374 servers->changeItem( newName, currentSelectedServer ); 373 servers->changeItem( newName, currentSelectedServer );
375 } 374 }
376 } 375 }
377 else 376 else
378 { 377 {
379 Server s( newName, serverurl->text() ); 378 Server s( newName, serverurl->text() );
380 dataMgr->getServerList().append( new Server( newName, serverurl->text() ) ); 379 dataMgr->getServerList().append( new Server( newName, serverurl->text() ) );
381 dataMgr->getServerList().last()->setActive( active->isChecked() ); 380 dataMgr->getServerList().last()->setActive( active->isChecked() );
382 servers->insertItem( newName ); 381 servers->insertItem( newName );
383 servers->setCurrentItem( servers->count() ); 382 servers->setCurrentItem( servers->count() );
384 newserver = false; 383 newserver = false;
385 } 384 }
386} 385}
387 386
388//------------------ Destinations tab ---------------------- 387//------------------ Destinations tab ----------------------
389 388
390void SettingsImpl :: editDestination( int sel ) 389void SettingsImpl :: editDestination( int sel )
391{ 390{
392 currentSelectedDestination = sel; 391 currentSelectedDestination = sel;
393 Destination *d = dataMgr->getDestination( destinations->currentText() ); 392 Destination *d = dataMgr->getDestination( destinations->currentText() );
394 if ( d ) 393 if ( d )
395 { 394 {
396 destinationName = d->getDestinationName(); 395 destinationName = d->getDestinationName();
397 destinationname->setText( d->getDestinationName() ); 396 destinationname->setText( d->getDestinationName() );
@@ -400,92 +399,94 @@ void SettingsImpl :: editDestination( int sel )
400 } 399 }
401 else 400 else
402 { 401 {
403 destinationName = ""; 402 destinationName = "";
404 destinationname->setText( "" ); 403 destinationname->setText( "" );
405 destinationurl->setText( "" ); 404 destinationurl->setText( "" );
406 linkToRoot->setChecked( false ); 405 linkToRoot->setChecked( false );
407 } 406 }
408} 407}
409 408
410void SettingsImpl :: newDestination() 409void SettingsImpl :: newDestination()
411{ 410{
412 newdestination = true; 411 newdestination = true;
413 destinationname->setText( "" ); 412 destinationname->setText( "" );
414 destinationurl->setText( "" ); 413 destinationurl->setText( "" );
415 destinationname->setFocus(); 414 destinationname->setFocus();
416 linkToRoot->setChecked( true ); 415 linkToRoot->setChecked( true );
417} 416}
418 417
419void SettingsImpl :: removeDestination() 418void SettingsImpl :: removeDestination()
420{ 419{
421 changed = true; 420 changed = true;
422 Destination *d = dataMgr->getDestination( destinations->currentText() ); 421 Destination *d = dataMgr->getDestination( destinations->currentText() );
423 if ( d ) 422 if ( d )
424 { 423 {
425 dataMgr->getDestinationList().removeRef( d ); 424 dataMgr->getDestinationList().removeRef( d );
426 destinations->removeItem( currentSelectedDestination ); 425 destinations->removeItem( currentSelectedDestination );
427 } 426 }
428} 427}
429 428
430void SettingsImpl :: changeDestinationDetails() 429void SettingsImpl :: changeDestinationDetails()
431{ 430{
432 changed = true; 431 changed = true;
433 432
434#ifdef QWS 433#ifdef QWS
435 Config cfg( "aqpkg" ); 434 Config cfg( "aqpkg" );
436 cfg.setGroup( "destinations" ); 435 cfg.setGroup( "destinations" );
437#endif 436#endif
438 437
439 QString newName = destinationname->text(); 438 QString newName = destinationname->text();
440 if ( !newdestination ) 439 if ( !newdestination )
441 { 440 {
442 Destination *d = dataMgr->getDestination( destinations->currentText() ); 441 Destination *d = dataMgr->getDestination( destinations->currentText() );
443 if ( d ) 442 if ( d )
444 { 443 {
445 // Update url 444 // Update url
446 d->setDestinationPath( destinationurl->text() ); 445 d->setDestinationPath( destinationurl->text() );
447 d->linkToRoot( linkToRoot->isChecked() ); 446 d->linkToRoot( linkToRoot->isChecked() );
448 447
449 // Check if server name has changed, if it has then we need to replace the key in the map 448 // Check if server name has changed, if it has then we need to replace the key in the map
450 if ( destinationName != newName ) 449 if ( destinationName != newName )
451 { 450 {
452 // Update server name 451 // Update server name
453 d->setDestinationName( newName ); 452 d->setDestinationName( newName );
454 453
455 // Update list box 454 // Update list box
456 destinations->changeItem( newName, currentSelectedDestination ); 455 destinations->changeItem( newName, currentSelectedDestination );
457 } 456 }
458 457
459#ifdef QWS 458#ifdef QWS
460 QString key = newName; 459 QString key = newName;
461 key += "_linkToRoot"; 460 key += "_linkToRoot";
462 int val = d->linkToRoot(); 461 int val = d->linkToRoot();
463 cfg.writeEntry( key, val ); 462 cfg.writeEntry( key, val );
464#endif 463#endif
465 } 464
466 } 465 }
467 else 466 }
468 { 467 else
469 dataMgr->getDestinationList().append( new Destination( newName, destinationurl->text() ) ); 468 {
470 destinations->insertItem( newName ); 469 dataMgr->getDestinationList().append( new Destination( newName, destinationurl->text() ) );
471 destinations->setCurrentItem( destinations->count() ); 470 destinations->insertItem( newName );
472 newdestination = false; 471 destinations->setCurrentItem( destinations->count() );
472 newdestination = false;
473 473
474#ifdef QWS 474#ifdef QWS
475 QString key = newName; 475 QString key = newName;
476 key += "_linkToRoot"; 476 key += "_linkToRoot";
477 cfg.writeEntry( key, true ); 477 cfg.writeEntry( key, true );
478#endif 478#endif
479 } 479
480 }
480} 481}
481 482
482//------------------ Proxy tab ---------------------- 483//------------------ Proxy tab ----------------------
483void SettingsImpl :: proxyApplyChanges() 484void SettingsImpl :: proxyApplyChanges()
484{ 485{
485 changed = true; 486 changed = true;
486 dataMgr->setHttpProxy( txtHttpProxy->text() ); 487 dataMgr->setHttpProxy( txtHttpProxy->text() );
487 dataMgr->setFtpProxy( txtFtpProxy->text() ); 488 dataMgr->setFtpProxy( txtFtpProxy->text() );
488 dataMgr->setProxyUsername( txtUsername->text() ); 489 dataMgr->setProxyUsername( txtUsername->text() );
489 dataMgr->setProxyPassword( txtPassword->text() ); 490 dataMgr->setProxyPassword( txtPassword->text() );
490 491
491 dataMgr->setHttpProxyEnabled( chkHttpProxyEnabled->isChecked() ); 492 dataMgr->setHttpProxyEnabled( chkHttpProxyEnabled->isChecked() );