summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/aqpkg.pro2
-rw-r--r--noncore/settings/aqpkg/settingsimpl.cpp5
2 files changed, 1 insertions, 6 deletions
diff --git a/noncore/settings/aqpkg/aqpkg.pro b/noncore/settings/aqpkg/aqpkg.pro
index a74b861..d76ae39 100644
--- a/noncore/settings/aqpkg/aqpkg.pro
+++ b/noncore/settings/aqpkg/aqpkg.pro
@@ -1,40 +1,40 @@
1CONFIG = qt warn_on quick-app 1CONFIG = qt warn_on quick-app
2HEADERS = global.h \ 2HEADERS = global.h \
3 mainwin.h \ 3 mainwin.h \
4 datamgr.h \ 4 datamgr.h \
5 settingsimpl.h \ 5 settingsimpl.h \
6 ipkg.h \ 6 ipkg.h \
7 packagewin.h \ 7 packagewin.h \
8 package.h \ 8 package.h \
9 installdlgimpl.h \ 9 installdlgimpl.h \
10 instoptionsimpl.h \ 10 instoptionsimpl.h \
11 destination.h \ 11 destination.h \
12 utils.h \ 12 utils.h \
13 server.h \ 13 server.h \
14 letterpushbutton.h \ 14 letterpushbutton.h \
15 inputdlg.h \ 15 inputdlg.h \
16 categoryfilterimpl.h 16 categoryfilterimpl.h
17SOURCES = mainwin.cpp \ 17SOURCES = mainwin.cpp \
18 datamgr.cpp \ 18 datamgr.cpp \
19 mem.cpp \ 19 mem.cpp \
20 settingsimpl.cpp \ 20 settingsimpl.cpp \
21 ipkg.cpp \ 21 ipkg.cpp \
22 main.cpp \ 22 main.cpp \
23 packagewin.cpp \ 23 packagewin.cpp \
24 package.cpp \ 24 package.cpp \
25 installdlgimpl.cpp \ 25 installdlgimpl.cpp \
26 instoptionsimpl.cpp \ 26 instoptionsimpl.cpp \
27 destination.cpp \ 27 destination.cpp \
28 utils.cpp \ 28 utils.cpp \
29 server.cpp \ 29 server.cpp \
30 letterpushbutton.cpp \ 30 letterpushbutton.cpp \
31 inputdlg.cpp \ 31 inputdlg.cpp \
32 version.cpp \ 32 version.cpp \
33 categoryfilterimpl.cpp 33 categoryfilterimpl.cpp
34TARGET = aqpkg 34TARGET = aqpkg
35INCLUDEPATH += $(OPIEDIR)/include 35INCLUDEPATH += $(OPIEDIR)/include
36DEPENDPATH += $(OPIEDIR)/include 36DEPENDPATH += $(OPIEDIR)/include
37LIBS += -lqpe -lopiecore2 -lopieui2 -lstdc++ 37LIBS += -lqpe -lopiecore2 -lopieui2
38 38
39include ( $(OPIEDIR)/include.pro ) 39include ( $(OPIEDIR)/include.pro )
40 40
diff --git a/noncore/settings/aqpkg/settingsimpl.cpp b/noncore/settings/aqpkg/settingsimpl.cpp
index 2f35617..9c8ec7a 100644
--- a/noncore/settings/aqpkg/settingsimpl.cpp
+++ b/noncore/settings/aqpkg/settingsimpl.cpp
@@ -1,496 +1,491 @@
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) 2002 Andy Qua <andy.qua@blueyonder.co.uk> 4 =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk>
5             .=l. Dan Williams <drw@handhelds.org> 5             .=l. Dan Williams <drw@handhelds.org>
6           .>+-= 6           .>+-=
7 _;:,     .>    :=|. This file is free software; you can 7 _;:,     .>    :=|. This file is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU General Public 9:`=1 )Y*s>-.--   : the terms of the GNU General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_. 13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This file is distributed in the hope that 14    .i_,=:_.      -<s. This file is distributed in the hope that
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 "settingsimpl.h" 30#include "settingsimpl.h"
31#include "global.h" 31#include "global.h"
32 32
33/* OPIE */ 33/* OPIE */
34#include <opie2/otabwidget.h> 34#include <opie2/otabwidget.h>
35#ifdef QWS 35#ifdef QWS
36#include <qpe/config.h> 36#include <qpe/config.h>
37#include <qpe/resource.h> 37#include <qpe/resource.h>
38#endif 38#endif
39#include <qpe/qpeapplication.h> 39#include <qpe/qpeapplication.h>
40 40
41/* QT */ 41/* QT */
42#include <qcheckbox.h> 42#include <qcheckbox.h>
43#include <qgroupbox.h> 43#include <qgroupbox.h>
44#include <qlabel.h> 44#include <qlabel.h>
45#include <qlayout.h> 45#include <qlayout.h>
46#include <qlineedit.h> 46#include <qlineedit.h>
47#include <qlistbox.h> 47#include <qlistbox.h>
48#include <qpushbutton.h> 48#include <qpushbutton.h>
49 49
50/* STD */
51#include <fstream>
52#include <algorithm>
53using namespace std;
54
55using namespace Opie::Ui; 50using namespace Opie::Ui;
56using namespace Opie::Ui; 51using namespace Opie::Ui;
57SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl ) 52SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl )
58 : QDialog( parent, name, modal, fl ) 53 : QDialog( parent, name, modal, fl )
59{ 54{
60 setCaption( tr( "Configuration" ) ); 55 setCaption( tr( "Configuration" ) );
61 56
62 // Setup layout to make everything pretty 57 // Setup layout to make everything pretty
63 QVBoxLayout *layout = new QVBoxLayout( this ); 58 QVBoxLayout *layout = new QVBoxLayout( this );
64 layout->setMargin( 2 ); 59 layout->setMargin( 2 );
65 layout->setSpacing( 4 ); 60 layout->setSpacing( 4 );
66 61
67 // Setup tabs for all info 62 // Setup tabs for all info
68 OTabWidget *tabwidget = new OTabWidget( this ); 63 OTabWidget *tabwidget = new OTabWidget( this );
69 layout->addWidget( tabwidget ); 64 layout->addWidget( tabwidget );
70 65
71 tabwidget->addTab( initServerTab(), "aqpkg/servertab", tr( "Servers" ) ); 66 tabwidget->addTab( initServerTab(), "aqpkg/servertab", tr( "Servers" ) );
72 tabwidget->addTab( initDestinationTab(), "aqpkg/desttab", tr( "Destinations" ) ); 67 tabwidget->addTab( initDestinationTab(), "aqpkg/desttab", tr( "Destinations" ) );
73 tabwidget->addTab( initProxyTab(), "aqpkg/proxytab", tr( "Proxies" ) ); 68 tabwidget->addTab( initProxyTab(), "aqpkg/proxytab", tr( "Proxies" ) );
74 tabwidget->setCurrentTab( tr( "Servers" ) ); 69 tabwidget->setCurrentTab( tr( "Servers" ) );
75 70
76 dataMgr = dataManager; 71 dataMgr = dataManager;
77 setupData(); 72 setupData();
78 changed = false; 73 changed = false;
79 newserver = false; 74 newserver = false;
80 newdestination = false; 75 newdestination = false;
81} 76}
82 77
83SettingsImpl :: ~SettingsImpl() 78SettingsImpl :: ~SettingsImpl()
84{ 79{
85} 80}
86 81
87bool SettingsImpl :: showDlg() 82bool SettingsImpl :: showDlg()
88{ 83{
89 QPEApplication::execDialog( this ); 84 QPEApplication::execDialog( this );
90 if ( changed ) 85 if ( changed )
91 dataMgr->writeOutIpkgConf(); 86 dataMgr->writeOutIpkgConf();
92 87
93 return changed; 88 return changed;
94} 89}
95 90
96QWidget *SettingsImpl :: initServerTab() 91QWidget *SettingsImpl :: initServerTab()
97{ 92{
98 QWidget *control = new QWidget( this ); 93 QWidget *control = new QWidget( this );
99 94
100 QVBoxLayout *vb = new QVBoxLayout( control ); 95 QVBoxLayout *vb = new QVBoxLayout( control );
101 96
102 QScrollView *sv = new QScrollView( control ); 97 QScrollView *sv = new QScrollView( control );
103 vb->addWidget( sv, 0, 0 ); 98 vb->addWidget( sv, 0, 0 );
104 sv->setResizePolicy( QScrollView::AutoOneFit ); 99 sv->setResizePolicy( QScrollView::AutoOneFit );
105 sv->setFrameStyle( QFrame::NoFrame ); 100 sv->setFrameStyle( QFrame::NoFrame );
106 101
107 QWidget *container = new QWidget( sv->viewport() ); 102 QWidget *container = new QWidget( sv->viewport() );
108 sv->addChild( container ); 103 sv->addChild( container );
109 104
110 QGridLayout *layout = new QGridLayout( container ); 105 QGridLayout *layout = new QGridLayout( container );
111 layout->setSpacing( 2 ); 106 layout->setSpacing( 2 );
112 layout->setMargin( 4 ); 107 layout->setMargin( 4 );
113 108
114 servers = new QListBox( container ); 109 servers = new QListBox( container );
115 servers->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); 110 servers->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) );
116 connect( servers, SIGNAL( highlighted(int) ), this, SLOT( editServer(int) ) ); 111 connect( servers, SIGNAL( highlighted(int) ), this, SLOT( editServer(int) ) );
117 layout->addMultiCellWidget( servers, 0, 0, 0, 1 ); 112 layout->addMultiCellWidget( servers, 0, 0, 0, 1 );
118 113
119 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); 114 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container );
120 connect( btn, SIGNAL( clicked() ), this, SLOT( newServer() ) ); 115 connect( btn, SIGNAL( clicked() ), this, SLOT( newServer() ) );
121 layout->addWidget( btn, 1, 0 ); 116 layout->addWidget( btn, 1, 0 );
122 117
123 btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); 118 btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container );
124 connect( btn, SIGNAL( clicked() ), this, SLOT( removeServer() ) ); 119 connect( btn, SIGNAL( clicked() ), this, SLOT( removeServer() ) );
125 layout->addWidget( btn, 1, 1 ); 120 layout->addWidget( btn, 1, 1 );
126 121
127 QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Server" ), container ); 122 QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Server" ), container );
128 grpbox->layout()->setSpacing( 2 ); 123 grpbox->layout()->setSpacing( 2 );
129 grpbox->layout()->setMargin( 4 ); 124 grpbox->layout()->setMargin( 4 );
130 layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 ); 125 layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 );
131 126
132 QGridLayout *grplayout = new QGridLayout( grpbox->layout() ); 127 QGridLayout *grplayout = new QGridLayout( grpbox->layout() );
133 128
134 QLabel *label = new QLabel( tr( "Name:" ), grpbox ); 129 QLabel *label = new QLabel( tr( "Name:" ), grpbox );
135 grplayout->addWidget( label, 0, 0 ); 130 grplayout->addWidget( label, 0, 0 );
136 servername = new QLineEdit( grpbox ); 131 servername = new QLineEdit( grpbox );
137 grplayout->addWidget( servername, 0, 1 ); 132 grplayout->addWidget( servername, 0, 1 );
138 133
139 label = new QLabel( tr( "Address:" ), grpbox ); 134 label = new QLabel( tr( "Address:" ), grpbox );
140 grplayout->addWidget( label, 1, 0 ); 135 grplayout->addWidget( label, 1, 0 );
141 serverurl = new QLineEdit( grpbox ); 136 serverurl = new QLineEdit( grpbox );
142 grplayout->addWidget( serverurl, 1, 1 ); 137 grplayout->addWidget( serverurl, 1, 1 );
143 138
144 active = new QCheckBox( tr( "Active Server" ), grpbox ); 139 active = new QCheckBox( tr( "Active Server" ), grpbox );
145 grplayout->addMultiCellWidget( active, 2, 2, 0, 1 ); 140 grplayout->addMultiCellWidget( active, 2, 2, 0, 1 );
146 141
147 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox ); 142 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox );
148 connect( btn, SIGNAL( clicked() ), this, SLOT( changeServerDetails() ) ); 143 connect( btn, SIGNAL( clicked() ), this, SLOT( changeServerDetails() ) );
149 grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 ); 144 grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 );
150 145
151 return control; 146 return control;
152} 147}
153 148
154QWidget *SettingsImpl :: initDestinationTab() 149QWidget *SettingsImpl :: initDestinationTab()
155{ 150{
156 QWidget *control = new QWidget( this ); 151 QWidget *control = new QWidget( this );
157 152
158 QVBoxLayout *vb = new QVBoxLayout( control ); 153 QVBoxLayout *vb = new QVBoxLayout( control );
159 154
160 QScrollView *sv = new QScrollView( control ); 155 QScrollView *sv = new QScrollView( control );
161 vb->addWidget( sv, 0, 0 ); 156 vb->addWidget( sv, 0, 0 );
162 sv->setResizePolicy( QScrollView::AutoOneFit ); 157 sv->setResizePolicy( QScrollView::AutoOneFit );
163 sv->setFrameStyle( QFrame::NoFrame ); 158 sv->setFrameStyle( QFrame::NoFrame );
164 159
165 QWidget *container = new QWidget( sv->viewport() ); 160 QWidget *container = new QWidget( sv->viewport() );
166 sv->addChild( container ); 161 sv->addChild( container );
167 162
168 QGridLayout *layout = new QGridLayout( container ); 163 QGridLayout *layout = new QGridLayout( container );
169 layout->setSpacing( 2 ); 164 layout->setSpacing( 2 );
170 layout->setMargin( 4 ); 165 layout->setMargin( 4 );
171 166
172 destinations = new QListBox( container ); 167 destinations = new QListBox( container );
173 destinations->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); 168 destinations->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) );
174 connect( destinations, SIGNAL( highlighted(int) ), this, SLOT( editDestination(int) ) ); 169 connect( destinations, SIGNAL( highlighted(int) ), this, SLOT( editDestination(int) ) );
175 layout->addMultiCellWidget( destinations, 0, 0, 0, 1 ); 170 layout->addMultiCellWidget( destinations, 0, 0, 0, 1 );
176 171
177 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); 172 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container );
178 connect( btn, SIGNAL( clicked() ), this, SLOT( newDestination() ) ); 173 connect( btn, SIGNAL( clicked() ), this, SLOT( newDestination() ) );
179 layout->addWidget( btn, 1, 0 ); 174 layout->addWidget( btn, 1, 0 );
180 175
181 btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); 176 btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container );
182 connect( btn, SIGNAL( clicked() ), this, SLOT( removeDestination() ) ); 177 connect( btn, SIGNAL( clicked() ), this, SLOT( removeDestination() ) );
183 layout->addWidget( btn, 1, 1 ); 178 layout->addWidget( btn, 1, 1 );
184 179
185 QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Destination" ), container ); 180 QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Destination" ), container );
186 grpbox->layout()->setSpacing( 2 ); 181 grpbox->layout()->setSpacing( 2 );
187 grpbox->layout()->setMargin( 4 ); 182 grpbox->layout()->setMargin( 4 );
188 layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 ); 183 layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 );
189 184
190 QGridLayout *grplayout = new QGridLayout( grpbox->layout() ); 185 QGridLayout *grplayout = new QGridLayout( grpbox->layout() );
191 186
192 QLabel *label = new QLabel( tr( "Name:" ), grpbox ); 187 QLabel *label = new QLabel( tr( "Name:" ), grpbox );
193 grplayout->addWidget( label, 0, 0 ); 188 grplayout->addWidget( label, 0, 0 );
194 destinationname = new QLineEdit( grpbox ); 189 destinationname = new QLineEdit( grpbox );
195 grplayout->addWidget( destinationname, 0, 1 ); 190 grplayout->addWidget( destinationname, 0, 1 );
196 191
197 label = new QLabel( tr( "Location:" ), grpbox ); 192 label = new QLabel( tr( "Location:" ), grpbox );
198 grplayout->addWidget( label, 1, 0 ); 193 grplayout->addWidget( label, 1, 0 );
199 destinationurl = new QLineEdit( grpbox ); 194 destinationurl = new QLineEdit( grpbox );
200 grplayout->addWidget( destinationurl, 1, 1 ); 195 grplayout->addWidget( destinationurl, 1, 1 );
201 196
202 linkToRoot = new QCheckBox( tr( "Link to root" ), grpbox ); 197 linkToRoot = new QCheckBox( tr( "Link to root" ), grpbox );
203 grplayout->addMultiCellWidget( linkToRoot, 2, 2, 0, 1 ); 198 grplayout->addMultiCellWidget( linkToRoot, 2, 2, 0, 1 );
204 199
205 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox ); 200 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox );
206 connect( btn, SIGNAL( clicked() ), this, SLOT( changeDestinationDetails() ) ); 201 connect( btn, SIGNAL( clicked() ), this, SLOT( changeDestinationDetails() ) );
207 grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 ); 202 grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 );
208 203
209 return control; 204 return control;
210} 205}
211 206
212QWidget *SettingsImpl :: initProxyTab() 207QWidget *SettingsImpl :: initProxyTab()
213{ 208{
214 QWidget *control = new QWidget( this ); 209 QWidget *control = new QWidget( this );
215 210
216 QVBoxLayout *vb = new QVBoxLayout( control ); 211 QVBoxLayout *vb = new QVBoxLayout( control );
217 212
218 QScrollView *sv = new QScrollView( control ); 213 QScrollView *sv = new QScrollView( control );
219 vb->addWidget( sv, 0, 0 ); 214 vb->addWidget( sv, 0, 0 );
220 sv->setResizePolicy( QScrollView::AutoOneFit ); 215 sv->setResizePolicy( QScrollView::AutoOneFit );
221 sv->setFrameStyle( QFrame::NoFrame ); 216 sv->setFrameStyle( QFrame::NoFrame );
222 217
223 QWidget *container = new QWidget( sv->viewport() ); 218 QWidget *container = new QWidget( sv->viewport() );
224 sv->addChild( container ); 219 sv->addChild( container );
225 220
226 QGridLayout *layout = new QGridLayout( container ); 221 QGridLayout *layout = new QGridLayout( container );
227 layout->setSpacing( 2 ); 222 layout->setSpacing( 2 );
228 layout->setMargin( 4 ); 223 layout->setMargin( 4 );
229 224
230 QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "HTTP Proxy" ), container ); 225 QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "HTTP Proxy" ), container );
231 grpbox->layout()->setSpacing( 2 ); 226 grpbox->layout()->setSpacing( 2 );
232 grpbox->layout()->setMargin( 4 ); 227 grpbox->layout()->setMargin( 4 );
233 layout->addMultiCellWidget( grpbox, 0, 0, 0, 1 ); 228 layout->addMultiCellWidget( grpbox, 0, 0, 0, 1 );
234 QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() ); 229 QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() );
235 txtHttpProxy = new QLineEdit( grpbox ); 230 txtHttpProxy = new QLineEdit( grpbox );
236 grplayout->addWidget( txtHttpProxy ); 231 grplayout->addWidget( txtHttpProxy );
237 chkHttpProxyEnabled = new QCheckBox( tr( "Enabled" ), grpbox ); 232 chkHttpProxyEnabled = new QCheckBox( tr( "Enabled" ), grpbox );
238 grplayout->addWidget( chkHttpProxyEnabled ); 233 grplayout->addWidget( chkHttpProxyEnabled );
239 234
240 grpbox = new QGroupBox( 0, Qt::Vertical, tr( "FTP Proxy" ), container ); 235 grpbox = new QGroupBox( 0, Qt::Vertical, tr( "FTP Proxy" ), container );
241 grpbox->layout()->setSpacing( 2 ); 236 grpbox->layout()->setSpacing( 2 );
242 grpbox->layout()->setMargin( 4 ); 237 grpbox->layout()->setMargin( 4 );
243 layout->addMultiCellWidget( grpbox, 1, 1, 0, 1 ); 238 layout->addMultiCellWidget( grpbox, 1, 1, 0, 1 );
244 grplayout = new QVBoxLayout( grpbox->layout() ); 239 grplayout = new QVBoxLayout( grpbox->layout() );
245 txtFtpProxy = new QLineEdit( grpbox ); 240 txtFtpProxy = new QLineEdit( grpbox );
246 grplayout->addWidget( txtFtpProxy ); 241 grplayout->addWidget( txtFtpProxy );
247 chkFtpProxyEnabled = new QCheckBox( tr( "Enabled" ), grpbox ); 242 chkFtpProxyEnabled = new QCheckBox( tr( "Enabled" ), grpbox );
248 grplayout->addWidget( chkFtpProxyEnabled ); 243 grplayout->addWidget( chkFtpProxyEnabled );
249 244
250 QLabel *label = new QLabel( tr( "Username:" ), container ); 245 QLabel *label = new QLabel( tr( "Username:" ), container );
251 layout->addWidget( label, 2, 0 ); 246 layout->addWidget( label, 2, 0 );
252 txtUsername = new QLineEdit( container ); 247 txtUsername = new QLineEdit( container );
253 layout->addWidget( txtUsername, 2, 1 ); 248 layout->addWidget( txtUsername, 2, 1 );
254 249
255 label = new QLabel( tr( "Password:" ), container ); 250 label = new QLabel( tr( "Password:" ), container );
256 layout->addWidget( label, 3, 0 ); 251 layout->addWidget( label, 3, 0 );
257 txtPassword = new QLineEdit( container ); 252 txtPassword = new QLineEdit( container );
258 layout->addWidget( txtPassword, 3, 1 ); 253 layout->addWidget( txtPassword, 3, 1 );
259 254
260 QPushButton *btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), container ); 255 QPushButton *btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), container );
261 connect( btn, SIGNAL( clicked() ), this, SLOT( proxyApplyChanges() ) ); 256 connect( btn, SIGNAL( clicked() ), this, SLOT( proxyApplyChanges() ) );
262 layout->addMultiCellWidget( btn, 4, 4, 0, 1 ); 257 layout->addMultiCellWidget( btn, 4, 4, 0, 1 );
263 258
264 return control; 259 return control;
265} 260}
266 261
267void SettingsImpl :: setupData() 262void SettingsImpl :: setupData()
268{ 263{
269 // add servers 264 // add servers
270 QString serverName; 265 QString serverName;
271 QListIterator<Server> it( dataMgr->getServerList() ); 266 QListIterator<Server> it( dataMgr->getServerList() );
272 for ( ; it.current(); ++it ) 267 for ( ; it.current(); ++it )
273 { 268 {
274 serverName = it.current()->getServerName(); 269 serverName = it.current()->getServerName();
275 if ( serverName == LOCAL_SERVER || serverName == LOCAL_IPKGS ) 270 if ( serverName == LOCAL_SERVER || serverName == LOCAL_IPKGS )
276 continue; 271 continue;
277 272
278 servers->insertItem( serverName ); 273 servers->insertItem( serverName );
279 } 274 }
280 275
281 276
282 // add destinations 277 // add destinations
283 QListIterator<Destination> it2( dataMgr->getDestinationList() ); 278 QListIterator<Destination> it2( dataMgr->getDestinationList() );
284 for ( ; it2.current(); ++it2 ) 279 for ( ; it2.current(); ++it2 )
285 destinations->insertItem( it2.current()->getDestinationName() ); 280 destinations->insertItem( it2.current()->getDestinationName() );
286 281
287 // setup proxy tab 282 // setup proxy tab
288 txtHttpProxy->setText( dataMgr->getHttpProxy() ); 283 txtHttpProxy->setText( dataMgr->getHttpProxy() );
289 txtFtpProxy->setText( dataMgr->getFtpProxy() ); 284 txtFtpProxy->setText( dataMgr->getFtpProxy() );
290 txtUsername->setText( dataMgr->getProxyUsername() ); 285 txtUsername->setText( dataMgr->getProxyUsername() );
291 txtPassword->setText( dataMgr->getProxyPassword() ); 286 txtPassword->setText( dataMgr->getProxyPassword() );
292 chkHttpProxyEnabled->setChecked( dataMgr->getHttpProxyEnabled() ); 287 chkHttpProxyEnabled->setChecked( dataMgr->getHttpProxyEnabled() );
293 chkFtpProxyEnabled->setChecked( dataMgr->getFtpProxyEnabled() ); 288 chkFtpProxyEnabled->setChecked( dataMgr->getFtpProxyEnabled() );
294} 289}
295 290
296//------------------ Servers tab ---------------------- 291//------------------ Servers tab ----------------------
297 292
298void SettingsImpl :: editServer( int sel ) 293void SettingsImpl :: editServer( int sel )
299{ 294{
300 currentSelectedServer = sel; 295 currentSelectedServer = sel;
301 Server *s = dataMgr->getServer( servers->currentText() ); 296 Server *s = dataMgr->getServer( servers->currentText() );
302 if ( s ) 297 if ( s )
303 { 298 {
304 serverName = s->getServerName(); 299 serverName = s->getServerName();
305 servername->setText( s->getServerName() ); 300 servername->setText( s->getServerName() );
306 serverurl->setText( s->getServerUrl() ); 301 serverurl->setText( s->getServerUrl() );
307 active->setChecked( s->isServerActive() ); 302 active->setChecked( s->isServerActive() );
308 } 303 }
309 else 304 else
310 { 305 {
311 serverName = ""; 306 serverName = "";
312 servername->setText( "" ); 307 servername->setText( "" );
313 serverurl->setText( "" ); 308 serverurl->setText( "" );
314 active->setChecked( false ); 309 active->setChecked( false );
315 } 310 }
316} 311}
317 312
318void SettingsImpl :: newServer() 313void SettingsImpl :: newServer()
319{ 314{
320 newserver = true; 315 newserver = true;
321 servername->setText( "" ); 316 servername->setText( "" );
322 serverurl->setText( "" ); 317 serverurl->setText( "" );
323 servername->setFocus(); 318 servername->setFocus();
324 active->setChecked( true ); 319 active->setChecked( true );
325} 320}
326 321
327void SettingsImpl :: removeServer() 322void SettingsImpl :: removeServer()
328{ 323{
329 changed = true; 324 changed = true;
330 Server *s = dataMgr->getServer( servers->currentText() ); 325 Server *s = dataMgr->getServer( servers->currentText() );
331 if ( s ) 326 if ( s )
332 { 327 {
333 dataMgr->getServerList().removeRef( s ); 328 dataMgr->getServerList().removeRef( s );
334 servers->removeItem( currentSelectedServer ); 329 servers->removeItem( currentSelectedServer );
335 } 330 }
336} 331}
337 332
338void SettingsImpl :: changeServerDetails() 333void SettingsImpl :: changeServerDetails()
339{ 334{
340 changed = true; 335 changed = true;
341 336
342 QString newName = servername->text(); 337 QString newName = servername->text();
343 338
344 // Convert any spaces to underscores 339 // Convert any spaces to underscores
345 char *tmpStr = new char[newName.length() + 1]; 340 char *tmpStr = new char[newName.length() + 1];
346 for ( unsigned int i = 0 ; i < newName.length() ; ++i ) 341 for ( unsigned int i = 0 ; i < newName.length() ; ++i )
347 { 342 {
348 if ( newName[i] == ' ' ) 343 if ( newName[i] == ' ' )
349 tmpStr[i] = '_'; 344 tmpStr[i] = '_';
350 else 345 else
351 tmpStr[i] = newName[i].latin1(); 346 tmpStr[i] = newName[i].latin1();
352 } 347 }
353 tmpStr[newName.length()] = '\0'; 348 tmpStr[newName.length()] = '\0';
354 349
355 newName = tmpStr; 350 newName = tmpStr;
356 delete tmpStr; 351 delete tmpStr;
357 352
358 if ( !newserver ) 353 if ( !newserver )
359 { 354 {
360 Server *s = dataMgr->getServer( servers->currentText() ); 355 Server *s = dataMgr->getServer( servers->currentText() );
361 if ( s ) 356 if ( s )
362 { 357 {
363 // Update url 358 // Update url
364 s->setServerUrl( serverurl->text() ); 359 s->setServerUrl( serverurl->text() );
365 s->setActive( active->isChecked() ); 360 s->setActive( active->isChecked() );
366 361
367 // Check if server name has changed, if it has then we need to replace the key in the map 362 // Check if server name has changed, if it has then we need to replace the key in the map
368 if ( serverName != newName ) 363 if ( serverName != newName )
369 { 364 {
370 // Update server name 365 // Update server name
371 s->setServerName( newName ); 366 s->setServerName( newName );
372 } 367 }
373 368
374 // Update list box 369 // Update list box
375 servers->changeItem( newName, currentSelectedServer ); 370 servers->changeItem( newName, currentSelectedServer );
376 } 371 }
377 } 372 }
378 else 373 else
379 { 374 {
380 Server s( newName, serverurl->text() ); 375 Server s( newName, serverurl->text() );
381 dataMgr->getServerList().append( new Server( newName, serverurl->text() ) ); 376 dataMgr->getServerList().append( new Server( newName, serverurl->text() ) );
382 dataMgr->getServerList().last()->setActive( active->isChecked() ); 377 dataMgr->getServerList().last()->setActive( active->isChecked() );
383 servers->insertItem( newName ); 378 servers->insertItem( newName );
384 servers->setCurrentItem( servers->count() ); 379 servers->setCurrentItem( servers->count() );
385 newserver = false; 380 newserver = false;
386 } 381 }
387} 382}
388 383
389//------------------ Destinations tab ---------------------- 384//------------------ Destinations tab ----------------------
390 385
391void SettingsImpl :: editDestination( int sel ) 386void SettingsImpl :: editDestination( int sel )
392{ 387{
393 currentSelectedDestination = sel; 388 currentSelectedDestination = sel;
394 Destination *d = dataMgr->getDestination( destinations->currentText() ); 389 Destination *d = dataMgr->getDestination( destinations->currentText() );
395 if ( d ) 390 if ( d )
396 { 391 {
397 destinationName = d->getDestinationName(); 392 destinationName = d->getDestinationName();
398 destinationname->setText( d->getDestinationName() ); 393 destinationname->setText( d->getDestinationName() );
399 destinationurl->setText( d->getDestinationPath() ); 394 destinationurl->setText( d->getDestinationPath() );
400 linkToRoot->setChecked( d->linkToRoot() ); 395 linkToRoot->setChecked( d->linkToRoot() );
401 } 396 }
402 else 397 else
403 { 398 {
404 destinationName = ""; 399 destinationName = "";
405 destinationname->setText( "" ); 400 destinationname->setText( "" );
406 destinationurl->setText( "" ); 401 destinationurl->setText( "" );
407 linkToRoot->setChecked( false ); 402 linkToRoot->setChecked( false );
408 } 403 }
409} 404}
410 405
411void SettingsImpl :: newDestination() 406void SettingsImpl :: newDestination()
412{ 407{
413 newdestination = true; 408 newdestination = true;
414 destinationname->setText( "" ); 409 destinationname->setText( "" );
415 destinationurl->setText( "" ); 410 destinationurl->setText( "" );
416 destinationname->setFocus(); 411 destinationname->setFocus();
417 linkToRoot->setChecked( true ); 412 linkToRoot->setChecked( true );
418} 413}
419 414
420void SettingsImpl :: removeDestination() 415void SettingsImpl :: removeDestination()
421{ 416{
422 changed = true; 417 changed = true;
423 Destination *d = dataMgr->getDestination( destinations->currentText() ); 418 Destination *d = dataMgr->getDestination( destinations->currentText() );
424 if ( d ) 419 if ( d )
425 { 420 {
426 dataMgr->getDestinationList().removeRef( d ); 421 dataMgr->getDestinationList().removeRef( d );
427 destinations->removeItem( currentSelectedDestination ); 422 destinations->removeItem( currentSelectedDestination );
428 } 423 }
429} 424}
430 425
431void SettingsImpl :: changeDestinationDetails() 426void SettingsImpl :: changeDestinationDetails()
432{ 427{
433 changed = true; 428 changed = true;
434 429
435#ifdef QWS 430#ifdef QWS
436 Config cfg( "aqpkg" ); 431 Config cfg( "aqpkg" );
437 cfg.setGroup( "destinations" ); 432 cfg.setGroup( "destinations" );
438#endif 433#endif
439 434
440 QString newName = destinationname->text(); 435 QString newName = destinationname->text();
441 if ( !newdestination ) 436 if ( !newdestination )
442 { 437 {
443 Destination *d = dataMgr->getDestination( destinations->currentText() ); 438 Destination *d = dataMgr->getDestination( destinations->currentText() );
444 if ( d ) 439 if ( d )
445 { 440 {
446 // Update url 441 // Update url
447 d->setDestinationPath( destinationurl->text() ); 442 d->setDestinationPath( destinationurl->text() );
448 d->linkToRoot( linkToRoot->isChecked() ); 443 d->linkToRoot( linkToRoot->isChecked() );
449 444
450 // Check if server name has changed, if it has then we need to replace the key in the map 445 // Check if server name has changed, if it has then we need to replace the key in the map
451 if ( destinationName != newName ) 446 if ( destinationName != newName )
452 { 447 {
453 // Update server name 448 // Update server name
454 d->setDestinationName( newName ); 449 d->setDestinationName( newName );
455 450
456 // Update list box 451 // Update list box
457 destinations->changeItem( newName, currentSelectedDestination ); 452 destinations->changeItem( newName, currentSelectedDestination );
458 } 453 }
459 454
460#ifdef QWS 455#ifdef QWS
461 QString key = newName; 456 QString key = newName;
462 key += "_linkToRoot"; 457 key += "_linkToRoot";
463 int val = d->linkToRoot(); 458 int val = d->linkToRoot();
464 cfg.writeEntry( key, val ); 459 cfg.writeEntry( key, val );
465#endif 460#endif
466 461
467 } 462 }
468 } 463 }
469 else 464 else
470 { 465 {
471 dataMgr->getDestinationList().append( new Destination( newName, destinationurl->text() ) ); 466 dataMgr->getDestinationList().append( new Destination( newName, destinationurl->text() ) );
472 destinations->insertItem( newName ); 467 destinations->insertItem( newName );
473 destinations->setCurrentItem( destinations->count() ); 468 destinations->setCurrentItem( destinations->count() );
474 newdestination = false; 469 newdestination = false;
475 470
476#ifdef QWS 471#ifdef QWS
477 QString key = newName; 472 QString key = newName;
478 key += "_linkToRoot"; 473 key += "_linkToRoot";
479 cfg.writeEntry( key, true ); 474 cfg.writeEntry( key, true );
480#endif 475#endif
481 476
482 } 477 }
483} 478}
484 479
485//------------------ Proxy tab ---------------------- 480//------------------ Proxy tab ----------------------
486void SettingsImpl :: proxyApplyChanges() 481void SettingsImpl :: proxyApplyChanges()
487{ 482{
488 changed = true; 483 changed = true;
489 dataMgr->setHttpProxy( txtHttpProxy->text() ); 484 dataMgr->setHttpProxy( txtHttpProxy->text() );
490 dataMgr->setFtpProxy( txtFtpProxy->text() ); 485 dataMgr->setFtpProxy( txtFtpProxy->text() );
491 dataMgr->setProxyUsername( txtUsername->text() ); 486 dataMgr->setProxyUsername( txtUsername->text() );
492 dataMgr->setProxyPassword( txtPassword->text() ); 487 dataMgr->setProxyPassword( txtPassword->text() );
493 488
494 dataMgr->setHttpProxyEnabled( chkHttpProxyEnabled->isChecked() ); 489 dataMgr->setHttpProxyEnabled( chkHttpProxyEnabled->isChecked() );
495 dataMgr->setFtpProxyEnabled( chkFtpProxyEnabled->isChecked() ); 490 dataMgr->setFtpProxyEnabled( chkFtpProxyEnabled->isChecked() );
496} 491}