summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/config.in22
-rw-r--r--noncore/settings/networksettings2/editconnection.cpp582
-rw-r--r--noncore/settings/networksettings2/editconnection.h49
-rw-r--r--noncore/settings/networksettings2/editconnectionGUI.ui406
-rw-r--r--noncore/settings/networksettings2/main.cpp96
-rw-r--r--noncore/settings/networksettings2/network/config.in4
-rw-r--r--noncore/settings/networksettings2/network/network.pro18
-rw-r--r--noncore/settings/networksettings2/network/networkGUI.ui1071
-rw-r--r--noncore/settings/networksettings2/network/network_NN.cpp64
-rw-r--r--noncore/settings/networksettings2/network/network_NN.h44
-rw-r--r--noncore/settings/networksettings2/network/network_NNI.cpp170
-rw-r--r--noncore/settings/networksettings2/network/network_NNI.h45
-rw-r--r--noncore/settings/networksettings2/network/networkdata.h22
-rw-r--r--noncore/settings/networksettings2/network/networkedit.cpp160
-rw-r--r--noncore/settings/networksettings2/network/networkedit.h21
-rw-r--r--noncore/settings/networksettings2/network/networkrun.cpp63
-rw-r--r--noncore/settings/networksettings2/network/networkrun.h20
-rw-r--r--noncore/settings/networksettings2/networksettings.cpp820
-rw-r--r--noncore/settings/networksettings2/networksettings.h77
-rw-r--r--noncore/settings/networksettings2/networksettings.pro16
-rw-r--r--noncore/settings/networksettings2/networksettings2/GUIUtils.cpp27
-rw-r--r--noncore/settings/networksettings2/networksettings2/GUIUtils.h36
-rw-r--r--noncore/settings/networksettings2/networksettings2/asconnection.h18
-rw-r--r--noncore/settings/networksettings2/networksettings2/asdevice.h37
-rw-r--r--noncore/settings/networksettings2/networksettings2/asfullsetup.h20
-rw-r--r--noncore/settings/networksettings2/networksettings2/asline.h18
-rw-r--r--noncore/settings/networksettings2/networksettings2/config.in4
-rw-r--r--noncore/settings/networksettings2/networksettings2/netnode.cpp278
-rw-r--r--noncore/settings/networksettings2/networksettings2/netnode.h361
-rw-r--r--noncore/settings/networksettings2/networksettings2/networksettings2.pro26
-rw-r--r--noncore/settings/networksettings2/networksettings2/resources.cpp236
-rw-r--r--noncore/settings/networksettings2/networksettings2/resources.h105
-rw-r--r--noncore/settings/networksettings2/networksettings2/system.cpp318
-rw-r--r--noncore/settings/networksettings2/networksettings2/system.h76
-rw-r--r--noncore/settings/networksettings2/networksettings2/systemfile.cpp144
-rw-r--r--noncore/settings/networksettings2/networksettings2/systemfile.h39
-rw-r--r--noncore/settings/networksettings2/networksettingsGUI.ui598
-rw-r--r--noncore/settings/networksettings2/networktemplates/interfaces/presection5
-rw-r--r--noncore/settings/networksettings2/opie-networksettings.control10
-rw-r--r--noncore/settings/networksettings2/ppp/PPPAuthGUI.ui432
-rw-r--r--noncore/settings/networksettings2/ppp/PPPAuthedit.cpp85
-rw-r--r--noncore/settings/networksettings2/ppp/PPPAuthedit.h15
-rw-r--r--noncore/settings/networksettings2/ppp/PPPDNSGUI.ui340
-rw-r--r--noncore/settings/networksettings2/ppp/PPPDNSedit.cpp108
-rw-r--r--noncore/settings/networksettings2/ppp/PPPDNSedit.h20
-rw-r--r--noncore/settings/networksettings2/ppp/PPPGUI.ui103
-rw-r--r--noncore/settings/networksettings2/ppp/PPPIPGUI.ui444
-rw-r--r--noncore/settings/networksettings2/ppp/PPPIPedit.cpp57
-rw-r--r--noncore/settings/networksettings2/ppp/PPPIPedit.h15
-rw-r--r--noncore/settings/networksettings2/ppp/PPPedit.cpp48
-rw-r--r--noncore/settings/networksettings2/ppp/PPPedit.h27
-rw-r--r--noncore/settings/networksettings2/ppp/config.in4
-rw-r--r--noncore/settings/networksettings2/ppp/ppp.pro24
-rw-r--r--noncore/settings/networksettings2/ppp/ppp_NN.cpp62
-rw-r--r--noncore/settings/networksettings2/ppp/ppp_NN.h44
-rw-r--r--noncore/settings/networksettings2/ppp/ppp_NNI.cpp115
-rw-r--r--noncore/settings/networksettings2/ppp/ppp_NNI.h43
-rw-r--r--noncore/settings/networksettings2/ppp/pppdata.h38
-rw-r--r--noncore/settings/networksettings2/ppp/ppprun.cpp77
-rw-r--r--noncore/settings/networksettings2/profile/config.in4
-rw-r--r--noncore/settings/networksettings2/profile/profile.pro18
-rw-r--r--noncore/settings/networksettings2/profile/profileGUI.ui1715
-rw-r--r--noncore/settings/networksettings2/profile/profile_NN.cpp61
-rw-r--r--noncore/settings/networksettings2/profile/profile_NN.h44
-rw-r--r--noncore/settings/networksettings2/profile/profile_NNI.cpp48
-rw-r--r--noncore/settings/networksettings2/profile/profile_NNI.h45
-rw-r--r--noncore/settings/networksettings2/profile/profiledata.h15
-rw-r--r--noncore/settings/networksettings2/profile/profileedit.cpp93
-rw-r--r--noncore/settings/networksettings2/profile/profileedit.h29
-rw-r--r--noncore/settings/networksettings2/profile/profilerun.cpp67
-rw-r--r--noncore/settings/networksettings2/profile/profilerun.h28
-rwxr-xr-xnoncore/settings/networksettings2/setmacaddress.sh4
-rw-r--r--noncore/settings/networksettings2/usb/config.in4
-rw-r--r--noncore/settings/networksettings2/usb/usb.pro18
-rw-r--r--noncore/settings/networksettings2/usb/usbGUI.ui57
-rw-r--r--noncore/settings/networksettings2/usb/usb_NN.cpp60
-rw-r--r--noncore/settings/networksettings2/usb/usb_NN.h44
-rw-r--r--noncore/settings/networksettings2/usb/usb_NNI.cpp46
-rw-r--r--noncore/settings/networksettings2/usb/usb_NNI.h44
-rw-r--r--noncore/settings/networksettings2/usb/usbdata.h8
-rw-r--r--noncore/settings/networksettings2/usb/usbedit.cpp17
-rw-r--r--noncore/settings/networksettings2/usb/usbedit.h12
-rw-r--r--noncore/settings/networksettings2/usb/usbrun.cpp171
-rw-r--r--noncore/settings/networksettings2/usb/usbrun.h38
-rw-r--r--noncore/settings/networksettings2/vpn/config.in4
-rw-r--r--noncore/settings/networksettings2/vpn/vpn.pro18
-rw-r--r--noncore/settings/networksettings2/vpn/vpnGUI.cpp76
-rw-r--r--noncore/settings/networksettings2/vpn/vpnGUI.h43
-rw-r--r--noncore/settings/networksettings2/vpn/vpn_NN.cpp61
-rw-r--r--noncore/settings/networksettings2/vpn/vpn_NN.h44
-rw-r--r--noncore/settings/networksettings2/vpn/vpn_NNI.cpp30
-rw-r--r--noncore/settings/networksettings2/vpn/vpn_NNI.h43
-rw-r--r--noncore/settings/networksettings2/vpn/vpndata.h16
-rw-r--r--noncore/settings/networksettings2/vpn/vpnedit.cpp18
-rw-r--r--noncore/settings/networksettings2/vpn/vpnedit.h12
-rw-r--r--noncore/settings/networksettings2/vpn/vpnrun.cpp6
-rw-r--r--noncore/settings/networksettings2/vpn/vpnrun.h30
-rw-r--r--noncore/settings/networksettings2/wlan/wlan.pro18
-rw-r--r--noncore/settings/networksettings2/wlan/wlanGUI.cpp360
-rw-r--r--noncore/settings/networksettings2/wlan/wlanGUI.h96
-rw-r--r--noncore/settings/networksettings2/wlan/wlan_NN.cpp60
-rw-r--r--noncore/settings/networksettings2/wlan/wlan_NN.h44
-rw-r--r--noncore/settings/networksettings2/wlan/wlan_NNI.cpp30
-rw-r--r--noncore/settings/networksettings2/wlan/wlan_NNI.h43
-rw-r--r--noncore/settings/networksettings2/wlan/wlandata.h17
-rw-r--r--noncore/settings/networksettings2/wlan/wlanedit.cpp16
-rw-r--r--noncore/settings/networksettings2/wlan/wlanedit.h12
-rw-r--r--noncore/settings/networksettings2/wlan/wlanrun.cpp5
-rw-r--r--noncore/settings/networksettings2/wlan/wlanrun.h42
109 files changed, 12061 insertions, 0 deletions
diff --git a/noncore/settings/networksettings2/config.in b/noncore/settings/networksettings2/config.in
new file mode 100644
index 0000000..37ce9cf
--- a/dev/null
+++ b/noncore/settings/networksettings2/config.in
@@ -0,0 +1,22 @@
1config NS2
2 boolean "opie-networksettings-2 (TCP/IP network settings)"
3 default "y"
4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE
5
6config NS2CORE
7 boolean
8 default "y" if NS2
9 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && NS2
10
11 source noncore/settings/networksettings2/profile/config.in
12 source noncore/settings/networksettings2/network/config.in
13 source noncore/settings/networksettings2/lancard/config.in
14 source noncore/settings/networksettings2/ppp/config.in
15 source noncore/settings/networksettings2/wlan/config.in
16 source noncore/settings/networksettings2/usb/config.in
17 source noncore/settings/networksettings2/irda/config.in
18 source noncore/settings/networksettings2/vpn/config.in
19 source noncore/settings/networksettings2/bluetooth/config.in
20 source noncore/settings/networksettings2/cable/config.in
21 source noncore/settings/networksettings2/modem/config.in
22 source noncore/settings/networksettings2/networksettings2/config.in
diff --git a/noncore/settings/networksettings2/editconnection.cpp b/noncore/settings/networksettings2/editconnection.cpp
new file mode 100644
index 0000000..d4b2bb3
--- a/dev/null
+++ b/noncore/settings/networksettings2/editconnection.cpp
@@ -0,0 +1,582 @@
1#include <qlistview.h>
2#include <qwidgetstack.h>
3#include <qframe.h>
4#include <qcombobox.h>
5#include <qtabwidget.h>
6#include <qmessagebox.h>
7#include <qpushbutton.h>
8#include <qlineedit.h>
9#include <qheader.h>
10#include <qpainter.h>
11#include <qcheckbox.h>
12#include <qlabel.h>
13
14#include "editconnection.h"
15#include "resources.h"
16#include "netnode.h"
17
18//
19//
20// THESE TO GIVE BETTER FEEDBACK ABOUT DISABLED ITEMS
21//
22//
23
24class MyQCheckListItem : public QCheckListItem
25{
26public:
27 MyQCheckListItem( QListView *parent, const QString & S, Type T ) :
28 QCheckListItem( parent, S, T ) { }
29 MyQCheckListItem( QCheckListItem *parent, const QString & S, Type T ) :
30 QCheckListItem( parent, S, T ) { }
31 MyQCheckListItem( QListViewItem *parent, const QString & S, Type T ) :
32 QCheckListItem( parent, S, T ) { }
33
34 virtual void paintCell( QPainter *p, const QColorGroup &cg,
35 int column, int width, int alignment );
36
37};
38
39void MyQCheckListItem::paintCell( QPainter *p, const QColorGroup &cg,
40 int column, int width, int alignment )
41{
42 QColorGroup _cg( cg );
43 QColor c = _cg.text();
44 if ( ! isSelectable() )
45 _cg.setColor( QColorGroup::Text, Qt::lightGray );
46 QCheckListItem::paintCell( p, _cg, column, width, alignment );
47 _cg.setColor( QColorGroup::Text, c );
48}
49
50class MyQListViewItem : public QListViewItem
51{
52public:
53 MyQListViewItem( QListView *parent, const QString & S ) :
54 QListViewItem( parent, S ) { }
55 MyQListViewItem( QListViewItem *parent, const QString & S ) :
56 QListViewItem( parent, S ) { }
57
58 virtual void paintCell( QPainter *p, const QColorGroup &cg,
59 int column, int width, int alignment );
60
61};
62
63void MyQListViewItem::paintCell( QPainter *p, const QColorGroup &cg,
64 int column, int width, int alignment )
65{
66 QColorGroup _cg( cg );
67 QColor c = _cg.text();
68 if ( ! isSelectable() )
69 _cg.setColor( QColorGroup::Text, Qt::lightGray );
70 QListViewItem::paintCell( p, _cg, column, width, alignment );
71 _cg.setColor( QColorGroup::Text, c );
72}
73
74//
75//
76// REAL GUI
77//
78//
79
80bool EditConnection::AutoCollapse = 1;
81
82EditConnection::EditConnection( QWidget* parent ) :
83 EditConnectionGUI( parent, 0, TRUE ), TmpCollection() {
84
85 Tab_TB->setTabEnabled( Setup_FRM, FALSE );
86 Setup_FRM->setEnabled( FALSE );
87
88 TmpIsValid = 0;
89 SelectedNodes = 0;
90
91 AutoCollapse_CB->setChecked( AutoCollapse );
92
93 Mapping = new QPtrDict<ANetNode>;
94 Mapping->setAutoDelete( FALSE );
95 Nodes_LV->header()->hide();
96 // popluate tree with all NetNodes
97 buildFullTree();
98}
99
100NodeCollection * EditConnection::getTmpCollection( void ) {
101
102 if( TmpIsValid )
103 // content is stil OK
104 return &(TmpCollection);
105
106 // reset collection -> delete all NEW NetNodes
107 { ANetNodeInstance * NNI;
108 for( QListIterator<ANetNodeInstance> it(TmpCollection);
109 it.current();
110 ++it ) {
111 if( it.current()->isNew() ) {
112 delete it.current();
113 }
114 }
115 TmpCollection.clear();
116 }
117
118 // update content
119 QListViewItem * it = Nodes_LV->firstChild();
120 ANetNode * NN;
121 // start iter
122 ANetNodeInstance * NNI =
123 (SelectedNodes) ? SelectedNodes->first() : 0 ;
124
125 TmpCollection.setModified( 0 );
126
127 while ( it ) {
128 NN = (*Mapping)[it];
129 if( NN == 0 ) {
130 // child is controller -> has sub radio
131 // check if one radio is selected
132 it = it->firstChild();
133 while( it ) {
134 if( ((QCheckListItem *)it)->isOn() ) {
135 // this radio is selected -> go deeper
136 if( SelectedNodes == 0 ||
137 NNI == 0 ||
138 NNI->netNode()->nodeName() != it->text(0) ) {
139 // new item not in previous collection
140 ANetNodeInstance * NNI = (*Mapping)[it]->createInstance();
141 NNI->initialize();
142 // this node type not in collection
143 TmpCollection.append( NNI );
144 // master collection changed because new item in it
145 TmpCollection.setModified( 1 );
146 // no more valid items in old list
147 NNI = 0;
148 } else {
149 // already in list -> copy pointer
150 TmpCollection.append( NNI );
151 NNI = SelectedNodes->next();
152 }
153 it = it->firstChild();
154 // do not bother to check other items
155 break;
156 }
157 it = it->nextSibling();
158 }
159 } else {
160 // check children
161 it = it->firstChild();
162 }
163 }
164
165 TmpIsValid = 1;
166 return &(TmpCollection);
167}
168
169// pass a connection NodeCollection to be edited
170void EditConnection::setConnection( NodeCollection * NC ) {
171 ANetNodeInstance * NNI;
172 ANetNode * NN;
173
174 SelectedNodes = NC;
175 Name_LE->setText( NC->name() );
176 NNI = NC->first();
177
178 // show configure tabl
179 Tab_TB->setCurrentPage( 1 );
180
181 // valid colledction
182 Tab_TB->setTabEnabled( Setup_FRM, FALSE );
183 Setup_FRM->setEnabled( FALSE );
184
185 // select items in collection
186 QListViewItem * it = Nodes_LV->firstChild();
187 bool Found;
188
189 TmpIsValid = 0;
190
191 while ( it ) {
192 // listitem corresponds to netnode
193 NN = (*Mapping)[it];
194 if( NN == 0 ) {
195 // child is controller -> has sub radio
196 QString Ctr = it->text(0);
197 // check if one radio is selected
198 it = it->firstChild();
199 Found = 0;
200 while( it ) {
201 if( NNI && NNI->netNode()->nodeName() == it->text(0) ) {
202 // this radio is part of the collection
203 ((QCheckListItem *)it)->setOn( 1 );
204 updateGUI( it, NNI->netNode() );
205 // check its children
206 Found = 1;
207 it = it->firstChild();
208 NNI = SelectedNodes->next();
209 // do not bother to check other items
210 break;
211 }
212 it = it->nextSibling();
213 }
214 if( ! Found ) {
215 // this means that this level is NOT present in collection
216 // probably INCOMPATIBEL collection OR Missing plugin
217 QMessageBox::warning(
218 0,
219 tr( "Error presentig Connection" ),
220 tr( "<p>Old connection or missing plugin \"<i>%1</i>\"</p>" ).
221 arg(Ctr) );
222 return;
223 }
224 } else {
225 // automatic item -> check children
226 it = it->firstChild();
227 }
228 }
229}
230
231// get result of editing (either new OR updated collection
232NodeCollection * EditConnection::connection( void ) {
233
234 if( SelectedNodes == 0 ) {
235 // new collection
236 SelectedNodes = new NodeCollection;
237 }
238
239 // clean out old entries
240 SelectedNodes->clear();
241
242 // transfer
243 { ANetNodeInstance * NNI;
244
245 for( QListIterator<ANetNodeInstance> it(TmpCollection);
246 it.current();
247 ++it ) {
248 SelectedNodes->append( it.current() );
249 }
250 }
251
252 if( TmpCollection.isModified() )
253 SelectedNodes->setModified( 1 );
254
255 if( SelectedNodes->name() != Name_LE->text() ) {
256 SelectedNodes->setName( Name_LE->text() );
257 SelectedNodes->setModified( 1 );
258 }
259
260 return SelectedNodes;
261}
262
263// Build device tree -> start
264void EditConnection::buildFullTree( void ) {
265 ANetNode * NN;
266
267 // toplevel item
268 MyQCheckListItem * TheTop = new MyQCheckListItem(
269 Nodes_LV,
270 NSResources->netNode2Name("fullsetup"),
271 QCheckListItem::Controller );
272 TheTop->setOpen( TRUE );
273 Description_LBL->setText(
274 NSResources->netNode2Description( "fullsetup" ) );
275 Nodes_LV->setSelected( TheTop, TRUE );
276
277 // find all Nodes that care toplevel nodes -> ie provide
278 // TCP/IP Connection
279 for( QDictIterator<NetNode_t> Iter(NSResources->netNodes());
280 Iter.current();
281 ++Iter ) {
282
283 NN = Iter.current()->NetNode;
284
285 if( ! NN->isToplevel() ) {
286 continue;
287 }
288
289 MyQCheckListItem * it = new MyQCheckListItem( TheTop,
290 NN->nodeName(),
291 QCheckListItem::RadioButton );
292 it->setPixmap( 0, NSResources->getPixmap( "commprofile" ) );
293 // remember that this node maps to this listitem
294 Mapping->insert( it, NN );
295 buildSubTree( it, NN );
296 }
297}
298
299// Build device tree -> help function
300void EditConnection::buildSubTree( QListViewItem * it, ANetNode *NN ) {
301 ANetNode::NetNodeList & NNL = NN->alternatives();
302
303 if( NNL.size() > 1 ) {
304 // this node has alternatives -> needs radio buttons
305 it = new MyQCheckListItem(
306 it,
307 NSResources->netNode2Name(NNL[0]->provides()),
308 QCheckListItem::Controller );
309 it->setSelectable( FALSE );
310 }
311
312 for ( unsigned int i=0; i < NNL.size(); i++ ) {
313 QListViewItem * CI;
314 if( NNL.size() > 1 ) {
315 // generate radio buttons
316 CI = new MyQCheckListItem(
317 (QCheckListItem *)it,
318 NNL[i]->nodeName(), QCheckListItem::RadioButton );
319 // remember that this node maps to this listitem
320 CI->setPixmap( 0, NSResources->getPixmap( NNL[i]->pixmapName() ) );
321 Mapping->insert( CI, NNL[i] );
322 CI->setSelectable( FALSE );
323 } else {
324 // Single item
325 CI = new MyQListViewItem( it, NNL[i]->nodeName() );
326 // remember that this node maps to this listitem
327 Mapping->insert( CI, NNL[i] );
328 CI->setSelectable( FALSE );
329 CI->setPixmap( 0, NSResources->getPixmap( NNL[i]->pixmapName() ) );
330 }
331 buildSubTree( CI, NNL[i] );
332 }
333}
334
335// Clicked ok OK button
336void EditConnection::accept( void ) {
337 if( ! haveCompleteConfig( 0 ) || Name_LE->text().isEmpty() ) {
338 QMessageBox::warning(
339 0,
340 tr( "Closing Connection Setup" ),
341 tr( "Definition not complete or no name" ) );
342 return;
343 }
344
345 // check if all devices have acceptable input
346 getTmpCollection();
347 { ANetNodeInstance * NNI;
348 QString S;
349
350 for( QListIterator<ANetNodeInstance> it(TmpCollection);
351 it.current();
352 ++it ) {
353 NNI = it.current();
354 // widget must show its own problems
355 S = NNI->acceptable();
356 if( ! S.isEmpty() ) {
357 QMessageBox::warning(
358 0,
359 tr( "Cannot save" ),
360 S );
361 return;
362 }
363 NNI->commit();
364
365 if( NNI->isModified() ) {
366 TmpCollection.setModified( 1 );
367 // commit the data
368 }
369 }
370 }
371
372 QDialog::accept();
373}
374
375// triggered by CB
376void EditConnection::SLOT_AutoCollapse( bool b ) {
377 AutoCollapse = b;
378}
379
380// clicked on node in tree -> update GUI
381void EditConnection::SLOT_SelectNode( QListViewItem * it ) {
382 ANetNode * NN;
383 if( it == 0 || it->depth() == 0 ) {
384 Description_LBL->setText(
385 NSResources->netNode2Description( "fullsetup" ) );
386 // topevel or no selection
387 return;
388 }
389
390 // store conversion from lvitem to node
391 NN = (*Mapping)[ it ];
392
393 if( ! NN ) {
394 // intermediate node
395 NN = (*Mapping)[ it->firstChild() ];
396 if( NN ) {
397 // figure out type of this node -> produce mesage
398 Description_LBL->setText( NSResources->netNode2Description(NN->provides()) );
399 } else {
400 Description_LBL->setText( "" );
401 }
402 return;
403 }
404
405 Description_LBL->setText( NN->nodeDescription() );
406
407 if( ! it->isSelectable() ) {
408 return;
409 }
410
411 if( ! ((QCheckListItem *)it)->isOn() ) {
412 // clicked on line but NOT on Check or Radio item
413 return;
414 }
415
416 // item has really changed -> update
417 TmpIsValid = 0;
418 updateGUI( it, NN );
419}
420
421// cliecked on TAB to go to setup
422void EditConnection::SLOT_AlterTab( const QString & S ) {
423 if( S == tr( "Setup" ) && Setup_FRM->isEnabled() ) {
424 // switched to setup -> update CB and populate ws with
425 // forms for devices
426
427 if( ! TmpIsValid ) {
428 getTmpCollection();
429
430 // clear CB and Ws
431 { QWidget * W;
432 int i = 0;
433
434 Devices_CB->clear();
435 while( ( W = Setup_WS->widget( i ) ) ) {
436 Setup_WS->removeWidget( W );
437 i ++;
438 }
439 }
440
441 // update CB
442 // and populate WidgetStack
443 { ANetNodeInstance * NNI;
444 QListIterator<ANetNodeInstance> it(TmpCollection);
445 int i = 0;
446 QWidget * W;
447
448 for ( ; it.current(); ++it ) {
449 NNI = it.current();
450 Devices_CB->insertItem(
451 NSResources->getPixmap( NNI->netNode()->pixmapName() ),
452 NNI->netNode()->nodeName()
453 );
454
455 // add edit widget
456 W = NNI->edit( Setup_WS );
457 if( ! W) {
458 W = new QLabel( Setup_WS,
459 tr("No configuration required"));
460 }
461 Setup_WS->addWidget( W , i );
462 i ++;
463 }
464 }
465 Setup_WS->raiseWidget( 0 );
466 } // still valid
467 }
468}
469
470// update visual feedback of selection state
471void EditConnection::updateGUI( QListViewItem * it, ANetNode * NN ) {
472
473 bool HCC = haveCompleteConfig( it );
474 Tab_TB->setTabEnabled( Setup_FRM, HCC );
475 Setup_FRM->setEnabled( HCC );
476
477 // disable children of all siblings at same level
478 QListViewItem * Sbl = it->parent()->firstChild();
479 while( Sbl ) {
480 if ( Sbl != it ) {
481 disableTree( Sbl->firstChild(), FALSE );
482 Sbl->setSelectable( TRUE );
483 if( AutoCollapse )
484 Sbl->setOpen( FALSE );
485 }
486 Sbl = Sbl->nextSibling();
487 }
488
489 // enable selected path (as deep as it goes
490 it->setOpen( TRUE );
491 enablePath( it->firstChild(),
492 (it->depth()==1) ?
493 1 : // toplevel always alternatives
494 (NN->alternatives().size() > 1) );
495}
496
497void EditConnection::disableTree( QListViewItem * it, bool Mode ) {
498 while( it ) {
499 // disable sbl's chidren
500 it->setSelectable( Mode );
501 if( AutoCollapse )
502 it->setOpen( Mode );
503 disableTree( it->firstChild(), Mode );
504 it = it->nextSibling();
505 }
506}
507
508// pah : ParentHasAlternatives
509void EditConnection::enablePath( QListViewItem * it, bool pha ) {
510 while( it ) {
511 ANetNode * NN;
512 NN = (*Mapping)[it];
513 if( NN ) {
514 if( pha ) {
515 bool doOn = ((QCheckListItem *)it)->isOn();
516 // we are a checklistitem for sure
517 it->setSelectable( TRUE );
518 if( AutoCollapse && ! doOn )
519 it->setOpen( doOn );
520 if( doOn ) {
521 // selected alternative
522 enablePath( it->firstChild(),
523 NN->alternatives().size() > 1);
524 } else {
525 // non-selected alternative
526 disableTree( it->firstChild(), FALSE);
527 }
528 } else {
529 // we are single subitem
530 it->setSelectable( TRUE );
531 it->setOpen( TRUE );
532 enablePath( it->firstChild(),
533 NN->alternatives().size() > 1);
534 }
535 } else {
536 // controller node
537 it->setSelectable( TRUE );
538 it->setOpen( TRUE );
539 enablePath( it->firstChild(), pha );
540 }
541 it = it->nextSibling();
542 }
543}
544
545// do we have a complete configuration (all needs are provided for ?)
546bool EditConnection::haveCompleteConfig( QListViewItem * it ) {
547 if( it == 0 || ((QCheckListItem *)it)->isOn() ) {
548 // check children
549 it = (it) ? it->firstChild() : Nodes_LV->firstChild() ;
550 while ( it ) {
551 if( ((QCheckListItem *)it)->type() ==
552 QCheckListItem::Controller ) {
553 // child is controller -> has sub radio
554 // check if one radio is selected
555 it = it->firstChild();
556 while( it ) {
557 if( ((QCheckListItem *)it)->isOn() ) {
558 // this radio is selected -> go deeper
559 it = it->firstChild();
560 if( ! it ) {
561 // was deepest level
562 return 1;
563 }
564 // do not bother to check other items
565 break;
566 }
567 it = it->nextSibling();
568 }
569 if( ! it ) {
570 // no radio selected
571 return 0;
572 }
573 } else {
574 // check children
575 it = it->firstChild();
576 }
577 }
578 // deepest level -> all is still OK
579 return 1;
580 } // was not ON
581 return 0;
582}
diff --git a/noncore/settings/networksettings2/editconnection.h b/noncore/settings/networksettings2/editconnection.h
new file mode 100644
index 0000000..e8d7a2c
--- a/dev/null
+++ b/noncore/settings/networksettings2/editconnection.h
@@ -0,0 +1,49 @@
1#include "editconnectionGUI.h"
2
3#include <qptrdict.h>
4#include <qvector.h>
5#include "netnode.h"
6
7class ANetNodeInstance;
8class ANetNode;
9class QListViewItem;
10class NetNodeLVI;
11class QCloseEvent;
12
13class EditConnection : public EditConnectionGUI {
14
15 Q_OBJECT
16
17public :
18
19 EditConnection( QWidget * P );
20
21 ANetNodeInstance * netNodeInstance( void );
22 void setConnection( NodeCollection * NC );
23 NodeCollection * connection( void );
24
25public slots :
26
27 void SLOT_AutoCollapse( bool );
28 void SLOT_SelectNode( QListViewItem * it );
29 void SLOT_AlterTab( const QString & S );
30 virtual void accept( void );
31
32private :
33
34 NodeCollection * getTmpCollection( void );
35 void updateGUI( QListViewItem * it, ANetNode * NN );
36 void buildFullTree( void );
37 void buildSubTree( QListViewItem * Parent, ANetNode * NN );
38 void disableTree( QListViewItem * it, bool Mode);
39 void enablePath( QListViewItem * it, bool pha);
40
41 bool haveCompleteConfig( QListViewItem * it );
42 QPtrDict<ANetNode> * Mapping;
43 NodeCollection * SelectedNodes;
44 bool TmpIsValid;
45 NodeCollection TmpCollection;
46
47 static bool AutoCollapse;
48
49};
diff --git a/noncore/settings/networksettings2/editconnectionGUI.ui b/noncore/settings/networksettings2/editconnectionGUI.ui
new file mode 100644
index 0000000..dfb2596
--- a/dev/null
+++ b/noncore/settings/networksettings2/editconnectionGUI.ui
@@ -0,0 +1,406 @@
1<!DOCTYPE UI><UI>
2<class>EditConnectionGUI</class>
3<widget>
4 <class>QDialog</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>EditConnectionGUI</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>427</width>
15 <height>523</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>sizePolicy</name>
20 <sizepolicy>
21 <hsizetype>7</hsizetype>
22 <vsizetype>7</vsizetype>
23 </sizepolicy>
24 </property>
25 <property stdset="1">
26 <name>minimumSize</name>
27 <size>
28 <width>0</width>
29 <height>70</height>
30 </size>
31 </property>
32 <property stdset="1">
33 <name>caption</name>
34 <string>Edit profile</string>
35 </property>
36 <property>
37 <name>layoutMargin</name>
38 </property>
39 <property>
40 <name>layoutSpacing</name>
41 </property>
42 <vbox>
43 <property stdset="1">
44 <name>margin</name>
45 <number>2</number>
46 </property>
47 <property stdset="1">
48 <name>spacing</name>
49 <number>2</number>
50 </property>
51 <widget>
52 <class>QTabWidget</class>
53 <property stdset="1">
54 <name>name</name>
55 <cstring>Tab_TB</cstring>
56 </property>
57 <property>
58 <name>layoutMargin</name>
59 </property>
60 <property>
61 <name>layoutSpacing</name>
62 </property>
63 <widget>
64 <class>QWidget</class>
65 <property stdset="1">
66 <name>name</name>
67 <cstring>tab</cstring>
68 </property>
69 <attribute>
70 <name>title</name>
71 <string>Device Tree</string>
72 </attribute>
73 <vbox>
74 <property stdset="1">
75 <name>margin</name>
76 <number>0</number>
77 </property>
78 <property stdset="1">
79 <name>spacing</name>
80 <number>2</number>
81 </property>
82 <widget>
83 <class>QLayoutWidget</class>
84 <property stdset="1">
85 <name>name</name>
86 <cstring>Layout2</cstring>
87 </property>
88 <hbox>
89 <property stdset="1">
90 <name>margin</name>
91 <number>0</number>
92 </property>
93 <property stdset="1">
94 <name>spacing</name>
95 <number>6</number>
96 </property>
97 <widget>
98 <class>QLabel</class>
99 <property stdset="1">
100 <name>name</name>
101 <cstring>Header_LBL</cstring>
102 </property>
103 <property stdset="1">
104 <name>sizePolicy</name>
105 <sizepolicy>
106 <hsizetype>1</hsizetype>
107 <vsizetype>1</vsizetype>
108 </sizepolicy>
109 </property>
110 <property stdset="1">
111 <name>frameShape</name>
112 <enum>MShape</enum>
113 </property>
114 <property stdset="1">
115 <name>frameShadow</name>
116 <enum>MShadow</enum>
117 </property>
118 <property stdset="1">
119 <name>text</name>
120 <string>Connection profile</string>
121 </property>
122 <property stdset="1">
123 <name>alignment</name>
124 <set>AlignVCenter|AlignLeft</set>
125 </property>
126 <property>
127 <name>vAlign</name>
128 </property>
129 </widget>
130 <widget>
131 <class>QLineEdit</class>
132 <property stdset="1">
133 <name>name</name>
134 <cstring>Name_LE</cstring>
135 </property>
136 </widget>
137 </hbox>
138 </widget>
139 <widget>
140 <class>QListView</class>
141 <column>
142 <property>
143 <name>text</name>
144 <string>Column 1</string>
145 </property>
146 <property>
147 <name>clickable</name>
148 <bool>true</bool>
149 </property>
150 <property>
151 <name>resizeable</name>
152 <bool>true</bool>
153 </property>
154 </column>
155 <property stdset="1">
156 <name>name</name>
157 <cstring>Nodes_LV</cstring>
158 </property>
159 <property stdset="1">
160 <name>sizePolicy</name>
161 <sizepolicy>
162 <hsizetype>7</hsizetype>
163 <vsizetype>7</vsizetype>
164 </sizepolicy>
165 </property>
166 <property stdset="1">
167 <name>minimumSize</name>
168 <size>
169 <width>0</width>
170 <height>0</height>
171 </size>
172 </property>
173 <property stdset="1">
174 <name>maximumSize</name>
175 <size>
176 <width>32767</width>
177 <height>32767</height>
178 </size>
179 </property>
180 <property stdset="1">
181 <name>rootIsDecorated</name>
182 <bool>true</bool>
183 </property>
184 </widget>
185 <widget>
186 <class>QLayoutWidget</class>
187 <property stdset="1">
188 <name>name</name>
189 <cstring>Layout4</cstring>
190 </property>
191 <hbox>
192 <property stdset="1">
193 <name>margin</name>
194 <number>0</number>
195 </property>
196 <property stdset="1">
197 <name>spacing</name>
198 <number>6</number>
199 </property>
200 <spacer>
201 <property>
202 <name>name</name>
203 <cstring>Spacer1</cstring>
204 </property>
205 <property stdset="1">
206 <name>orientation</name>
207 <enum>Horizontal</enum>
208 </property>
209 <property stdset="1">
210 <name>sizeType</name>
211 <enum>Expanding</enum>
212 </property>
213 <property>
214 <name>sizeHint</name>
215 <size>
216 <width>20</width>
217 <height>20</height>
218 </size>
219 </property>
220 </spacer>
221 <widget>
222 <class>QCheckBox</class>
223 <property stdset="1">
224 <name>name</name>
225 <cstring>AutoCollapse_CB</cstring>
226 </property>
227 <property stdset="1">
228 <name>text</name>
229 <string>Auto collapse</string>
230 </property>
231 <property stdset="1">
232 <name>checked</name>
233 <bool>true</bool>
234 </property>
235 </widget>
236 </hbox>
237 </widget>
238 <widget>
239 <class>QLabel</class>
240 <property stdset="1">
241 <name>name</name>
242 <cstring>Description_LBL</cstring>
243 </property>
244 <property stdset="1">
245 <name>sizePolicy</name>
246 <sizepolicy>
247 <hsizetype>7</hsizetype>
248 <vsizetype>5</vsizetype>
249 </sizepolicy>
250 </property>
251 <property stdset="1">
252 <name>frameShape</name>
253 <enum>Box</enum>
254 </property>
255 <property stdset="1">
256 <name>frameShadow</name>
257 <enum>Raised</enum>
258 </property>
259 <property stdset="1">
260 <name>text</name>
261 <string></string>
262 </property>
263 <property stdset="1">
264 <name>alignment</name>
265 <set>AlignTop|AlignLeft</set>
266 </property>
267 <property>
268 <name>vAlign</name>
269 </property>
270 </widget>
271 </vbox>
272 </widget>
273 <widget>
274 <class>QWidget</class>
275 <property stdset="1">
276 <name>name</name>
277 <cstring>tab</cstring>
278 </property>
279 <attribute>
280 <name>title</name>
281 <string>Setup</string>
282 </attribute>
283 <vbox>
284 <property stdset="1">
285 <name>margin</name>
286 <number>0</number>
287 </property>
288 <property stdset="1">
289 <name>spacing</name>
290 <number>0</number>
291 </property>
292 <widget>
293 <class>QFrame</class>
294 <property stdset="1">
295 <name>name</name>
296 <cstring>Setup_FRM</cstring>
297 </property>
298 <property stdset="1">
299 <name>frameShape</name>
300 <enum>NoFrame</enum>
301 </property>
302 <property stdset="1">
303 <name>frameShadow</name>
304 <enum>Plain</enum>
305 </property>
306 <property stdset="1">
307 <name>lineWidth</name>
308 <number>0</number>
309 </property>
310 <property stdset="1">
311 <name>margin</name>
312 <number>0</number>
313 </property>
314 <property stdset="1">
315 <name>midLineWidth</name>
316 <number>0</number>
317 </property>
318 <property>
319 <name>layoutMargin</name>
320 </property>
321 <property>
322 <name>layoutSpacing</name>
323 </property>
324 <vbox>
325 <property stdset="1">
326 <name>margin</name>
327 <number>2</number>
328 </property>
329 <property stdset="1">
330 <name>spacing</name>
331 <number>4</number>
332 </property>
333 <widget>
334 <class>QComboBox</class>
335 <property stdset="1">
336 <name>name</name>
337 <cstring>Devices_CB</cstring>
338 </property>
339 </widget>
340 <widget>
341 <class>QWidgetStack</class>
342 <property stdset="1">
343 <name>name</name>
344 <cstring>Setup_WS</cstring>
345 </property>
346 </widget>
347 </vbox>
348 </widget>
349 </vbox>
350 </widget>
351 </widget>
352 </vbox>
353</widget>
354<customwidgets>
355 <customwidget>
356 <class>QWidgetStack</class>
357 <header location="global">qwidgetstack.h</header>
358 <sizehint>
359 <width>-1</width>
360 <height>-1</height>
361 </sizehint>
362 <container>0</container>
363 <sizepolicy>
364 <hordata>7</hordata>
365 <verdata>7</verdata>
366 </sizepolicy>
367 <pixmap>image0</pixmap>
368 <slot access="public">raiseWidget( int )</slot>
369 </customwidget>
370</customwidgets>
371<images>
372 <image>
373 <name>image0</name>
374 <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1ddec44f503c0ae2a154410f53d0ed20e2bf6bdb656dd6861dd23d9a66591b0587fd1654235ebded6f0edcd53e419d87ae7b1f4f9b8f906d0bfe012317426a70b07bdc2f3ec77f8ed6b89559061a0343d06a124cc105596482585094bc0ae599b04646c9018926491b2205e140c485cace25755c175d0a967b622ff900b8cc9c7d29af594ea722d589167f813aa852ba07d94b9dce296e883fe7bb163f23896753</data>
375 </image>
376</images>
377<connections>
378 <connection>
379 <sender>Nodes_LV</sender>
380 <signal>clicked(QListViewItem*)</signal>
381 <receiver>EditConnectionGUI</receiver>
382 <slot>SLOT_SelectNode( QListViewItem *)</slot>
383 </connection>
384 <connection>
385 <sender>AutoCollapse_CB</sender>
386 <signal>toggled(bool)</signal>
387 <receiver>EditConnectionGUI</receiver>
388 <slot>SLOT_AutoCollapse( bool)</slot>
389 </connection>
390 <connection>
391 <sender>Devices_CB</sender>
392 <signal>activated(int)</signal>
393 <receiver>Setup_WS</receiver>
394 <slot>raiseWidget( int )</slot>
395 </connection>
396 <connection>
397 <sender>Tab_TB</sender>
398 <signal>selected(const QString&amp;)</signal>
399 <receiver>EditConnectionGUI</receiver>
400 <slot>SLOT_AlterTab( const QString &amp; )</slot>
401 </connection>
402 <slot access="public">SLOT_AlterTab( const QString &amp; )</slot>
403 <slot access="public">SLOT_AutoCollapse( bool)</slot>
404 <slot access="public">SLOT_SelectNode( QListViewItem *)</slot>
405</connections>
406</UI>
diff --git a/noncore/settings/networksettings2/main.cpp b/noncore/settings/networksettings2/main.cpp
new file mode 100644
index 0000000..bcef631
--- a/dev/null
+++ b/noncore/settings/networksettings2/main.cpp
@@ -0,0 +1,96 @@
1#include "networksettings.h"
2#include <qpe/qpeapplication.h>
3
4#include <opie/oapplicationfactory.h>
5
6#ifdef GONE
7
8OPIE_EXPORT_APP( OApplicationFactory<NetworkSettings> )
9
10#else
11
12#define ACT_GUI 0
13#define ACT_REQUEST 1
14#define ACT_REGEN 2
15
16int main( int argc, char * argv[] ) {
17 int rv = 0;
18 int Action = ACT_GUI;
19 // could be overruled by -qws
20 QApplication::Type GuiType = QApplication::GuiClient;
21
22#ifdef _WS_QWS_
23 QPEApplication * TheApp;
24#else
25 QApplication * TheApp;
26#endif
27
28 for ( int i = 1; i < argc; i ++ ) {
29 int rmv;
30 rmv = 0;
31 if( strcmp( argv[i], "--regen" ) == 0 ) {
32 Action = ACT_REGEN;
33 GuiType = QApplication::Tty;
34 rmv = 1;
35 }
36 if( rmv ) {
37 memmove( argv+i, argv+i+rmv,
38 sizeof( char * ) * (argc-i-rmv) );
39 i --;
40 argc -= rmv;
41 }
42 }
43
44 if( strstr( argv[0], "-request" ) ) {
45 // called from system to request something
46 GuiType = QApplication::Tty;
47 Action = ACT_REQUEST;
48 }
49
50 // Start Qt
51#ifdef _WS_QWS_
52 // because QPEApplication does not handle GuiType well
53 if( GuiType == QApplication::Tty ) {
54 // this cast is NOT correct but we do not use
55 // TheApp anymore ...
56 TheApp = (QPEApplication *)new QApplication( argc, argv, GuiType );
57 } else {
58 TheApp = new QPEApplication( argc, argv, GuiType );
59 }
60#else
61 TheApp = new QApplication( argc, argv, GuiType );
62#endif
63
64 // init qt with app widget
65 if( GuiType != QApplication::Tty ) {
66 QWidget * W = 0;
67 W = new NetworkSettings(0);
68 TheApp->setMainWidget( W );
69 W->show();
70#ifdef _WS_QWS_
71 W->showMaximized();
72#else
73 W->resize( W->sizeHint() );
74#endif
75 rv = TheApp->exec();
76 delete W;
77 } else {
78 switch( Action ) {
79 case ACT_REQUEST :
80 NetworkSettings::canStart( argv[1] );
81 break;
82 case ACT_REGEN :
83 // regen returns 0 if OK
84 rv = (NetworkSettings::regenerate()) ? 1 : 0;
85 break;
86 }
87 }
88
89 return rv;
90}
91
92#endif
93
94
95// main.cpp
96
diff --git a/noncore/settings/networksettings2/network/config.in b/noncore/settings/networksettings2/network/config.in
new file mode 100644
index 0000000..9dab059
--- a/dev/null
+++ b/noncore/settings/networksettings2/network/config.in
@@ -0,0 +1,4 @@
1 config NS2NS2WORK
2 boolean "opie-networksettings2plugin-ipsetup (set up TCP/IP)"
3 default "n" if NS2
4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && NS2 && NS2CORE
diff --git a/noncore/settings/networksettings2/network/network.pro b/noncore/settings/networksettings2/network/network.pro
new file mode 100644
index 0000000..f9b2b7f
--- a/dev/null
+++ b/noncore/settings/networksettings2/network/network.pro
@@ -0,0 +1,18 @@
1TEMPLATE = lib
2CONFIG += qt warn_on release
3DESTDIR = $(OPIEDIR)/plugins/networksettings2
4 HEADERS = network_NN.h \
5 network_NNI.h \
6 networkedit.h
7 SOURCES = network_NN.cpp \
8 network_NNI.cpp \
9 networkedit.cpp \
10 networkrun.cpp
11 INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2
12 DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2
13LIBS += -lqpe
14 INTERFACES= networkGUI.ui
15 TARGET = network
16 VERSION = 1.0.0
17
18include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/networksettings2/network/networkGUI.ui b/noncore/settings/networksettings2/network/networkGUI.ui
new file mode 100644
index 0000000..9115ec0
--- a/dev/null
+++ b/noncore/settings/networksettings2/network/networkGUI.ui
@@ -0,0 +1,1071 @@
1<!DOCTYPE UI><UI>
2<class>NetworkGUI</class>
3<widget>
4 <class>QWidget</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>NetworkGUI</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>293</width>
15 <height>254</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>Interface Configuration</string>
21 </property>
22 <property>
23 <name>layoutMargin</name>
24 </property>
25 <property>
26 <name>layoutSpacing</name>
27 </property>
28 <vbox>
29 <property stdset="1">
30 <name>margin</name>
31 <number>0</number>
32 </property>
33 <property stdset="1">
34 <name>spacing</name>
35 <number>0</number>
36 </property>
37 <widget>
38 <class>QTabWidget</class>
39 <property stdset="1">
40 <name>name</name>
41 <cstring>TabWidget11</cstring>
42 </property>
43 <property>
44 <name>layoutMargin</name>
45 </property>
46 <property>
47 <name>layoutSpacing</name>
48 </property>
49 <widget>
50 <class>QWidget</class>
51 <property stdset="1">
52 <name>name</name>
53 <cstring>tab</cstring>
54 </property>
55 <attribute>
56 <name>title</name>
57 <string>Setup</string>
58 </attribute>
59 <vbox>
60 <property stdset="1">
61 <name>margin</name>
62 <number>0</number>
63 </property>
64 <property stdset="1">
65 <name>spacing</name>
66 <number>0</number>
67 </property>
68 <widget>
69 <class>QCheckBox</class>
70 <property stdset="1">
71 <name>name</name>
72 <cstring>DHCP_CB</cstring>
73 </property>
74 <property stdset="1">
75 <name>text</name>
76 <string>Address from server</string>
77 </property>
78 <property stdset="1">
79 <name>checked</name>
80 <bool>true</bool>
81 </property>
82 </widget>
83 <widget>
84 <class>QLayoutWidget</class>
85 <property stdset="1">
86 <name>name</name>
87 <cstring>Layout3</cstring>
88 </property>
89 <hbox>
90 <property stdset="1">
91 <name>margin</name>
92 <number>0</number>
93 </property>
94 <property stdset="1">
95 <name>spacing</name>
96 <number>6</number>
97 </property>
98 <spacer>
99 <property>
100 <name>name</name>
101 <cstring>Spacer6</cstring>
102 </property>
103 <property stdset="1">
104 <name>orientation</name>
105 <enum>Horizontal</enum>
106 </property>
107 <property stdset="1">
108 <name>sizeType</name>
109 <enum>Fixed</enum>
110 </property>
111 <property>
112 <name>sizeHint</name>
113 <size>
114 <width>20</width>
115 <height>20</height>
116 </size>
117 </property>
118 </spacer>
119 <widget>
120 <class>QFrame</class>
121 <property stdset="1">
122 <name>name</name>
123 <cstring>StaticIP_GB</cstring>
124 </property>
125 <property stdset="1">
126 <name>enabled</name>
127 <bool>false</bool>
128 </property>
129 <property stdset="1">
130 <name>sizePolicy</name>
131 <sizepolicy>
132 <hsizetype>7</hsizetype>
133 <vsizetype>5</vsizetype>
134 </sizepolicy>
135 </property>
136 <property stdset="1">
137 <name>frameShape</name>
138 <enum>NoFrame</enum>
139 </property>
140 <property stdset="1">
141 <name>frameShadow</name>
142 <enum>Raised</enum>
143 </property>
144 <property>
145 <name>layoutMargin</name>
146 </property>
147 <property>
148 <name>layoutSpacing</name>
149 </property>
150 <grid>
151 <property stdset="1">
152 <name>margin</name>
153 <number>0</number>
154 </property>
155 <property stdset="1">
156 <name>spacing</name>
157 <number>1</number>
158 </property>
159 <widget row="0" column="0" >
160 <class>QLabel</class>
161 <property stdset="1">
162 <name>name</name>
163 <cstring>TextLabel4</cstring>
164 </property>
165 <property stdset="1">
166 <name>text</name>
167 <string>IP Address</string>
168 </property>
169 <property stdset="1">
170 <name>alignment</name>
171 <set>AlignCenter</set>
172 </property>
173 <property>
174 <name>hAlign</name>
175 </property>
176 </widget>
177 <widget row="1" column="0" >
178 <class>QLabel</class>
179 <property stdset="1">
180 <name>name</name>
181 <cstring>TextLabel5</cstring>
182 </property>
183 <property stdset="1">
184 <name>text</name>
185 <string>Subnet Mask</string>
186 </property>
187 <property stdset="1">
188 <name>alignment</name>
189 <set>AlignCenter</set>
190 </property>
191 <property>
192 <name>hAlign</name>
193 </property>
194 </widget>
195 <widget row="4" column="0" >
196 <class>QLabel</class>
197 <property stdset="1">
198 <name>name</name>
199 <cstring>TextLabel2</cstring>
200 </property>
201 <property stdset="1">
202 <name>text</name>
203 <string>First DNS</string>
204 </property>
205 <property stdset="1">
206 <name>alignment</name>
207 <set>AlignCenter</set>
208 </property>
209 <property>
210 <name>hAlign</name>
211 </property>
212 </widget>
213 <widget row="3" column="0" >
214 <class>QLabel</class>
215 <property stdset="1">
216 <name>name</name>
217 <cstring>TextLabel1_2</cstring>
218 </property>
219 <property stdset="1">
220 <name>text</name>
221 <string>Gateway</string>
222 </property>
223 <property stdset="1">
224 <name>alignment</name>
225 <set>AlignCenter</set>
226 </property>
227 <property>
228 <name>hAlign</name>
229 </property>
230 </widget>
231 <widget row="2" column="0" >
232 <class>QLabel</class>
233 <property stdset="1">
234 <name>name</name>
235 <cstring>TextLabel1</cstring>
236 </property>
237 <property stdset="1">
238 <name>text</name>
239 <string>Broadcast</string>
240 </property>
241 <property stdset="1">
242 <name>alignment</name>
243 <set>AlignCenter</set>
244 </property>
245 <property>
246 <name>hAlign</name>
247 </property>
248 </widget>
249 <widget row="5" column="0" >
250 <class>QLabel</class>
251 <property stdset="1">
252 <name>name</name>
253 <cstring>TextLabel3</cstring>
254 </property>
255 <property stdset="1">
256 <name>text</name>
257 <string>Second DNS</string>
258 </property>
259 <property stdset="1">
260 <name>alignment</name>
261 <set>AlignCenter</set>
262 </property>
263 <property>
264 <name>hAlign</name>
265 </property>
266 </widget>
267 <widget row="0" column="1" >
268 <class>QLineEdit</class>
269 <property stdset="1">
270 <name>name</name>
271 <cstring>IPAddress_LE</cstring>
272 </property>
273 </widget>
274 <widget row="1" column="1" >
275 <class>QLineEdit</class>
276 <property stdset="1">
277 <name>name</name>
278 <cstring>SubnetMask_LE</cstring>
279 </property>
280 <property stdset="1">
281 <name>text</name>
282 <string>255.255.255.0</string>
283 </property>
284 </widget>
285 <widget row="2" column="1" >
286 <class>QLineEdit</class>
287 <property stdset="1">
288 <name>name</name>
289 <cstring>Broadcast_LE</cstring>
290 </property>
291 </widget>
292 <widget row="3" column="1" >
293 <class>QLineEdit</class>
294 <property stdset="1">
295 <name>name</name>
296 <cstring>Gateway_LE</cstring>
297 </property>
298 </widget>
299 <widget row="4" column="1" >
300 <class>QLineEdit</class>
301 <property stdset="1">
302 <name>name</name>
303 <cstring>DNS1_LE</cstring>
304 </property>
305 </widget>
306 <widget row="5" column="1" >
307 <class>QLineEdit</class>
308 <property stdset="1">
309 <name>name</name>
310 <cstring>DNS2_LE</cstring>
311 </property>
312 </widget>
313 </grid>
314 </widget>
315 </hbox>
316 </widget>
317 <widget>
318 <class>QLabel</class>
319 <property stdset="1">
320 <name>name</name>
321 <cstring>TextLabel2_2</cstring>
322 </property>
323 <property stdset="1">
324 <name>text</name>
325 <string>DHCP Settings</string>
326 </property>
327 </widget>
328 <widget>
329 <class>QLayoutWidget</class>
330 <property stdset="1">
331 <name>name</name>
332 <cstring>Layout5</cstring>
333 </property>
334 <hbox>
335 <property stdset="1">
336 <name>margin</name>
337 <number>0</number>
338 </property>
339 <property stdset="1">
340 <name>spacing</name>
341 <number>6</number>
342 </property>
343 <spacer>
344 <property>
345 <name>name</name>
346 <cstring>Spacer26</cstring>
347 </property>
348 <property stdset="1">
349 <name>orientation</name>
350 <enum>Horizontal</enum>
351 </property>
352 <property stdset="1">
353 <name>sizeType</name>
354 <enum>Fixed</enum>
355 </property>
356 <property>
357 <name>sizeHint</name>
358 <size>
359 <width>20</width>
360 <height>20</height>
361 </size>
362 </property>
363 </spacer>
364 <widget>
365 <class>QFrame</class>
366 <property stdset="1">
367 <name>name</name>
368 <cstring>Frame27</cstring>
369 </property>
370 <property stdset="1">
371 <name>sizePolicy</name>
372 <sizepolicy>
373 <hsizetype>7</hsizetype>
374 <vsizetype>5</vsizetype>
375 </sizepolicy>
376 </property>
377 <property stdset="1">
378 <name>frameShape</name>
379 <enum>NoFrame</enum>
380 </property>
381 <property stdset="1">
382 <name>frameShadow</name>
383 <enum>Raised</enum>
384 </property>
385 <property>
386 <name>layoutMargin</name>
387 </property>
388 <property>
389 <name>layoutSpacing</name>
390 </property>
391 <hbox>
392 <property stdset="1">
393 <name>margin</name>
394 <number>0</number>
395 </property>
396 <property stdset="1">
397 <name>spacing</name>
398 <number>2</number>
399 </property>
400 <widget>
401 <class>QCheckBox</class>
402 <property stdset="1">
403 <name>name</name>
404 <cstring>SendHostname_CB</cstring>
405 </property>
406 <property stdset="1">
407 <name>text</name>
408 <string>Send hostname</string>
409 </property>
410 </widget>
411 <widget>
412 <class>QLineEdit</class>
413 <property stdset="1">
414 <name>name</name>
415 <cstring>Hostname_LE</cstring>
416 </property>
417 <property stdset="1">
418 <name>enabled</name>
419 <bool>false</bool>
420 </property>
421 <property stdset="1">
422 <name>sizePolicy</name>
423 <sizepolicy>
424 <hsizetype>7</hsizetype>
425 <vsizetype>0</vsizetype>
426 </sizepolicy>
427 </property>
428 </widget>
429 </hbox>
430 </widget>
431 </hbox>
432 </widget>
433 <spacer>
434 <property>
435 <name>name</name>
436 <cstring>Spacer38</cstring>
437 </property>
438 <property stdset="1">
439 <name>orientation</name>
440 <enum>Vertical</enum>
441 </property>
442 <property stdset="1">
443 <name>sizeType</name>
444 <enum>Expanding</enum>
445 </property>
446 <property>
447 <name>sizeHint</name>
448 <size>
449 <width>20</width>
450 <height>20</height>
451 </size>
452 </property>
453 </spacer>
454 </vbox>
455 </widget>
456 <widget>
457 <class>QWidget</class>
458 <property stdset="1">
459 <name>name</name>
460 <cstring>tab</cstring>
461 </property>
462 <attribute>
463 <name>title</name>
464 <string>Extra commands</string>
465 </attribute>
466 <vbox>
467 <property stdset="1">
468 <name>margin</name>
469 <number>0</number>
470 </property>
471 <property stdset="1">
472 <name>spacing</name>
473 <number>2</number>
474 </property>
475 <widget>
476 <class>QLineEdit</class>
477 <property stdset="1">
478 <name>name</name>
479 <cstring>Command_LE</cstring>
480 </property>
481 </widget>
482 <widget>
483 <class>QTabWidget</class>
484 <property stdset="1">
485 <name>name</name>
486 <cstring>Tab_TB</cstring>
487 </property>
488 <property>
489 <name>layoutMargin</name>
490 </property>
491 <property>
492 <name>layoutSpacing</name>
493 </property>
494 <widget>
495 <class>QWidget</class>
496 <property stdset="1">
497 <name>name</name>
498 <cstring>tab</cstring>
499 </property>
500 <attribute>
501 <name>title</name>
502 <string>Pre-Up</string>
503 </attribute>
504 <hbox>
505 <property stdset="1">
506 <name>margin</name>
507 <number>0</number>
508 </property>
509 <property stdset="1">
510 <name>spacing</name>
511 <number>2</number>
512 </property>
513 <widget>
514 <class>QListBox</class>
515 <property stdset="1">
516 <name>name</name>
517 <cstring>PreUp_LB</cstring>
518 </property>
519 </widget>
520 <widget>
521 <class>QFrame</class>
522 <property stdset="1">
523 <name>name</name>
524 <cstring>Frame5_2</cstring>
525 </property>
526 <property stdset="1">
527 <name>sizePolicy</name>
528 <sizepolicy>
529 <hsizetype>0</hsizetype>
530 <vsizetype>7</vsizetype>
531 </sizepolicy>
532 </property>
533 <property stdset="1">
534 <name>frameShape</name>
535 <enum>StyledPanel</enum>
536 </property>
537 <property stdset="1">
538 <name>frameShadow</name>
539 <enum>Raised</enum>
540 </property>
541 <property>
542 <name>layoutMargin</name>
543 </property>
544 <property>
545 <name>layoutSpacing</name>
546 </property>
547 <vbox>
548 <property stdset="1">
549 <name>margin</name>
550 <number>0</number>
551 </property>
552 <property stdset="1">
553 <name>spacing</name>
554 <number>1</number>
555 </property>
556 <widget>
557 <class>QToolButton</class>
558 <property stdset="1">
559 <name>name</name>
560 <cstring>AddPreUp_TB</cstring>
561 </property>
562 <property stdset="1">
563 <name>text</name>
564 <string>...</string>
565 </property>
566 </widget>
567 <widget>
568 <class>QToolButton</class>
569 <property stdset="1">
570 <name>name</name>
571 <cstring>DeletePreUp_TB</cstring>
572 </property>
573 <property stdset="1">
574 <name>text</name>
575 <string>...</string>
576 </property>
577 </widget>
578 <widget>
579 <class>QToolButton</class>
580 <property stdset="1">
581 <name>name</name>
582 <cstring>UpPreUp_TB</cstring>
583 </property>
584 <property stdset="1">
585 <name>text</name>
586 <string>...</string>
587 </property>
588 </widget>
589 <widget>
590 <class>QToolButton</class>
591 <property stdset="1">
592 <name>name</name>
593 <cstring>DownPreUp_TB</cstring>
594 </property>
595 <property stdset="1">
596 <name>text</name>
597 <string>...</string>
598 </property>
599 </widget>
600 <spacer>
601 <property>
602 <name>name</name>
603 <cstring>Spacer5_2_2</cstring>
604 </property>
605 <property stdset="1">
606 <name>orientation</name>
607 <enum>Vertical</enum>
608 </property>
609 <property stdset="1">
610 <name>sizeType</name>
611 <enum>Expanding</enum>
612 </property>
613 <property>
614 <name>sizeHint</name>
615 <size>
616 <width>20</width>
617 <height>20</height>
618 </size>
619 </property>
620 </spacer>
621 </vbox>
622 </widget>
623 </hbox>
624 </widget>
625 <widget>
626 <class>QWidget</class>
627 <property stdset="1">
628 <name>name</name>
629 <cstring>tab</cstring>
630 </property>
631 <attribute>
632 <name>title</name>
633 <string>Post-Up</string>
634 </attribute>
635 <hbox>
636 <property stdset="1">
637 <name>margin</name>
638 <number>0</number>
639 </property>
640 <property stdset="1">
641 <name>spacing</name>
642 <number>2</number>
643 </property>
644 <widget>
645 <class>QListBox</class>
646 <property stdset="1">
647 <name>name</name>
648 <cstring>PostUp_LB</cstring>
649 </property>
650 </widget>
651 <widget>
652 <class>QFrame</class>
653 <property stdset="1">
654 <name>name</name>
655 <cstring>Frame5</cstring>
656 </property>
657 <property stdset="1">
658 <name>sizePolicy</name>
659 <sizepolicy>
660 <hsizetype>0</hsizetype>
661 <vsizetype>7</vsizetype>
662 </sizepolicy>
663 </property>
664 <property stdset="1">
665 <name>frameShape</name>
666 <enum>StyledPanel</enum>
667 </property>
668 <property stdset="1">
669 <name>frameShadow</name>
670 <enum>Raised</enum>
671 </property>
672 <property>
673 <name>layoutMargin</name>
674 </property>
675 <property>
676 <name>layoutSpacing</name>
677 </property>
678 <vbox>
679 <property stdset="1">
680 <name>margin</name>
681 <number>0</number>
682 </property>
683 <property stdset="1">
684 <name>spacing</name>
685 <number>1</number>
686 </property>
687 <widget>
688 <class>QToolButton</class>
689 <property stdset="1">
690 <name>name</name>
691 <cstring>AddPostUp_TB</cstring>
692 </property>
693 <property stdset="1">
694 <name>text</name>
695 <string>...</string>
696 </property>
697 </widget>
698 <widget>
699 <class>QToolButton</class>
700 <property stdset="1">
701 <name>name</name>
702 <cstring>DeletePostUp_TB</cstring>
703 </property>
704 <property stdset="1">
705 <name>text</name>
706 <string>...</string>
707 </property>
708 </widget>
709 <widget>
710 <class>QToolButton</class>
711 <property stdset="1">
712 <name>name</name>
713 <cstring>UpPostUp_TB</cstring>
714 </property>
715 <property stdset="1">
716 <name>text</name>
717 <string>...</string>
718 </property>
719 </widget>
720 <widget>
721 <class>QToolButton</class>
722 <property stdset="1">
723 <name>name</name>
724 <cstring>DownPostUp_TB</cstring>
725 </property>
726 <property stdset="1">
727 <name>text</name>
728 <string>...</string>
729 </property>
730 </widget>
731 <spacer>
732 <property>
733 <name>name</name>
734 <cstring>Spacer5_5</cstring>
735 </property>
736 <property stdset="1">
737 <name>orientation</name>
738 <enum>Vertical</enum>
739 </property>
740 <property stdset="1">
741 <name>sizeType</name>
742 <enum>Expanding</enum>
743 </property>
744 <property>
745 <name>sizeHint</name>
746 <size>
747 <width>20</width>
748 <height>20</height>
749 </size>
750 </property>
751 </spacer>
752 </vbox>
753 </widget>
754 </hbox>
755 </widget>
756 <widget>
757 <class>QWidget</class>
758 <property stdset="1">
759 <name>name</name>
760 <cstring>tab</cstring>
761 </property>
762 <attribute>
763 <name>title</name>
764 <string>Pre-Down</string>
765 </attribute>
766 <hbox>
767 <property stdset="1">
768 <name>margin</name>
769 <number>0</number>
770 </property>
771 <property stdset="1">
772 <name>spacing</name>
773 <number>2</number>
774 </property>
775 <widget>
776 <class>QListBox</class>
777 <property stdset="1">
778 <name>name</name>
779 <cstring>PreDown_LB</cstring>
780 </property>
781 </widget>
782 <widget>
783 <class>QFrame</class>
784 <property stdset="1">
785 <name>name</name>
786 <cstring>Frame5_3</cstring>
787 </property>
788 <property stdset="1">
789 <name>sizePolicy</name>
790 <sizepolicy>
791 <hsizetype>0</hsizetype>
792 <vsizetype>3</vsizetype>
793 </sizepolicy>
794 </property>
795 <property stdset="1">
796 <name>frameShape</name>
797 <enum>StyledPanel</enum>
798 </property>
799 <property stdset="1">
800 <name>frameShadow</name>
801 <enum>Raised</enum>
802 </property>
803 <property>
804 <name>layoutMargin</name>
805 </property>
806 <property>
807 <name>layoutSpacing</name>
808 </property>
809 <vbox>
810 <property stdset="1">
811 <name>margin</name>
812 <number>0</number>
813 </property>
814 <property stdset="1">
815 <name>spacing</name>
816 <number>1</number>
817 </property>
818 <widget>
819 <class>QToolButton</class>
820 <property stdset="1">
821 <name>name</name>
822 <cstring>AddPreDown_TB</cstring>
823 </property>
824 <property stdset="1">
825 <name>text</name>
826 <string>...</string>
827 </property>
828 </widget>
829 <widget>
830 <class>QToolButton</class>
831 <property stdset="1">
832 <name>name</name>
833 <cstring>DeletePreDown_TB</cstring>
834 </property>
835 <property stdset="1">
836 <name>text</name>
837 <string>...</string>
838 </property>
839 </widget>
840 <widget>
841 <class>QToolButton</class>
842 <property stdset="1">
843 <name>name</name>
844 <cstring>UpPreDown_TB</cstring>
845 </property>
846 <property stdset="1">
847 <name>text</name>
848 <string>...</string>
849 </property>
850 </widget>
851 <widget>
852 <class>QToolButton</class>
853 <property stdset="1">
854 <name>name</name>
855 <cstring>DownPreDown_TB</cstring>
856 </property>
857 <property stdset="1">
858 <name>text</name>
859 <string>...</string>
860 </property>
861 </widget>
862 <spacer>
863 <property>
864 <name>name</name>
865 <cstring>Spacer5_3_2</cstring>
866 </property>
867 <property stdset="1">
868 <name>orientation</name>
869 <enum>Vertical</enum>
870 </property>
871 <property stdset="1">
872 <name>sizeType</name>
873 <enum>Expanding</enum>
874 </property>
875 <property>
876 <name>sizeHint</name>
877 <size>
878 <width>20</width>
879 <height>20</height>
880 </size>
881 </property>
882 </spacer>
883 </vbox>
884 </widget>
885 </hbox>
886 </widget>
887 <widget>
888 <class>QWidget</class>
889 <property stdset="1">
890 <name>name</name>
891 <cstring>tab</cstring>
892 </property>
893 <attribute>
894 <name>title</name>
895 <string>Post-Down</string>
896 </attribute>
897 <hbox>
898 <property stdset="1">
899 <name>margin</name>
900 <number>0</number>
901 </property>
902 <property stdset="1">
903 <name>spacing</name>
904 <number>2</number>
905 </property>
906 <widget>
907 <class>QListBox</class>
908 <property stdset="1">
909 <name>name</name>
910 <cstring>PostDown_LB</cstring>
911 </property>
912 </widget>
913 <widget>
914 <class>QFrame</class>
915 <property stdset="1">
916 <name>name</name>
917 <cstring>Frame5_4</cstring>
918 </property>
919 <property stdset="1">
920 <name>sizePolicy</name>
921 <sizepolicy>
922 <hsizetype>0</hsizetype>
923 <vsizetype>7</vsizetype>
924 </sizepolicy>
925 </property>
926 <property stdset="1">
927 <name>frameShape</name>
928 <enum>StyledPanel</enum>
929 </property>
930 <property stdset="1">
931 <name>frameShadow</name>
932 <enum>Raised</enum>
933 </property>
934 <property>
935 <name>layoutMargin</name>
936 </property>
937 <property>
938 <name>layoutSpacing</name>
939 </property>
940 <vbox>
941 <property stdset="1">
942 <name>margin</name>
943 <number>0</number>
944 </property>
945 <property stdset="1">
946 <name>spacing</name>
947 <number>1</number>
948 </property>
949 <widget>
950 <class>QToolButton</class>
951 <property stdset="1">
952 <name>name</name>
953 <cstring>AddPostDown_TB</cstring>
954 </property>
955 <property stdset="1">
956 <name>text</name>
957 <string>...</string>
958 </property>
959 </widget>
960 <widget>
961 <class>QToolButton</class>
962 <property stdset="1">
963 <name>name</name>
964 <cstring>DeletePostDown_TB</cstring>
965 </property>
966 <property stdset="1">
967 <name>text</name>
968 <string>...</string>
969 </property>
970 </widget>
971 <widget>
972 <class>QToolButton</class>
973 <property stdset="1">
974 <name>name</name>
975 <cstring>UpPostDown_TB</cstring>
976 </property>
977 <property stdset="1">
978 <name>text</name>
979 <string>...</string>
980 </property>
981 </widget>
982 <widget>
983 <class>QToolButton</class>
984 <property stdset="1">
985 <name>name</name>
986 <cstring>DownPostDown_TB</cstring>
987 </property>
988 <property stdset="1">
989 <name>text</name>
990 <string>...</string>
991 </property>
992 </widget>
993 <spacer>
994 <property>
995 <name>name</name>
996 <cstring>Spacer5_4</cstring>
997 </property>
998 <property stdset="1">
999 <name>orientation</name>
1000 <enum>Vertical</enum>
1001 </property>
1002 <property stdset="1">
1003 <name>sizeType</name>
1004 <enum>Expanding</enum>
1005 </property>
1006 <property>
1007 <name>sizeHint</name>
1008 <size>
1009 <width>20</width>
1010 <height>20</height>
1011 </size>
1012 </property>
1013 </spacer>
1014 </vbox>
1015 </widget>
1016 </hbox>
1017 </widget>
1018 </widget>
1019 </vbox>
1020 </widget>
1021 </widget>
1022 </vbox>
1023</widget>
1024<connections>
1025 <connection>
1026 <sender>DHCP_CB</sender>
1027 <signal>toggled(bool)</signal>
1028 <receiver>StaticIP_GB</receiver>
1029 <slot>setDisabled(bool)</slot>
1030 </connection>
1031 <connection>
1032 <sender>SubnetMask_LE</sender>
1033 <signal>textChanged(const QString&amp;)</signal>
1034 <receiver>NetworkGUI</receiver>
1035 <slot>SLOT_NetmaskModified( const QString &amp; )</slot>
1036 </connection>
1037 <connection>
1038 <sender>IPAddress_LE</sender>
1039 <signal>textChanged(const QString&amp;)</signal>
1040 <receiver>NetworkGUI</receiver>
1041 <slot>SLOT_NetmaskModified( const QString &amp; )</slot>
1042 </connection>
1043 <connection>
1044 <sender>DHCP_CB</sender>
1045 <signal>toggled(bool)</signal>
1046 <receiver>Frame27</receiver>
1047 <slot>setEnabled(bool)</slot>
1048 </connection>
1049 <connection>
1050 <sender>DHCP_CB</sender>
1051 <signal>toggled(bool)</signal>
1052 <receiver>TextLabel2_2</receiver>
1053 <slot>setEnabled(bool)</slot>
1054 </connection>
1055 <connection>
1056 <sender>SendHostname_CB</sender>
1057 <signal>toggled(bool)</signal>
1058 <receiver>Hostname_LE</receiver>
1059 <slot>setEnabled(bool)</slot>
1060 </connection>
1061 <slot access="public">SLOT_NetmaskModified( const QString &amp; )</slot>
1062</connections>
1063<tabstops>
1064 <tabstop>DHCP_CB</tabstop>
1065 <tabstop>IPAddress_LE</tabstop>
1066 <tabstop>SubnetMask_LE</tabstop>
1067 <tabstop>Gateway_LE</tabstop>
1068 <tabstop>DNS1_LE</tabstop>
1069 <tabstop>DNS2_LE</tabstop>
1070</tabstops>
1071</UI>
diff --git a/noncore/settings/networksettings2/network/network_NN.cpp b/noncore/settings/networksettings2/network/network_NN.cpp
new file mode 100644
index 0000000..bb371ad
--- a/dev/null
+++ b/noncore/settings/networksettings2/network/network_NN.cpp
@@ -0,0 +1,64 @@
1#include "network_NN.h"
2#include "network_NNI.h"
3
4static const char * NetworkNeeds[] =
5 { "device",
6 0
7 };
8
9/**
10 * Constructor, find all of the possible interfaces
11 */
12NetworkNetNode::NetworkNetNode() : ANetNode() {
13}
14
15/**
16 * Delete any interfaces that we own.
17 */
18NetworkNetNode::~NetworkNetNode(){
19}
20
21const QString NetworkNetNode::nodeDescription(){
22 return tr("\
23<p>Sets up TCP/IP options.</p>\
24<p>Use this to configure the TCP/IP protocol</p>\
25"
26);
27}
28
29ANetNodeInstance * NetworkNetNode::createInstance( void ) {
30 return new ANetwork( this );
31}
32
33const char ** NetworkNetNode::needs( void ) {
34 return NetworkNeeds;
35}
36
37const char * NetworkNetNode::provides( void ) {
38 return "connection";
39}
40
41bool NetworkNetNode::generateProperFilesFor(
42 ANetNodeInstance * ) {
43 return 1;
44}
45
46bool NetworkNetNode::hasDataFor( const QString & S ) {
47 if( S == "interfaces" ) {
48 return 1;
49 }
50 return 0;
51}
52
53bool NetworkNetNode::generateDataForCommonFile(
54 SystemFile & S,
55 long DevNr,
56 ANetNodeInstance * NNI ) {
57 return ((ANetwork *)NNI)->generateDataForCommonFile(S, DevNr);
58}
59
60extern "C" {
61void create_plugin( QList<ANetNode> & PNN ) {
62 PNN.append( new NetworkNetNode() );
63}
64}
diff --git a/noncore/settings/networksettings2/network/network_NN.h b/noncore/settings/networksettings2/network/network_NN.h
new file mode 100644
index 0000000..3b0cd64
--- a/dev/null
+++ b/noncore/settings/networksettings2/network/network_NN.h
@@ -0,0 +1,44 @@
1#ifndef NETWORK_NETNODE_H
2#define NETWORK_NETNODE_H
3
4#include "netnode.h"
5
6class ANetwork;
7
8class NetworkNetNode : public ANetNode{
9
10 Q_OBJECT
11
12public:
13
14 NetworkNetNode();
15 virtual ~NetworkNetNode();
16
17 virtual const QString pixmapName()
18 { return "tcpip"; }
19
20 virtual const QString nodeName()
21 { return tr("IP Configuration"); }
22
23 virtual const QString nodeDescription() ;
24
25 virtual ANetNodeInstance * createInstance( void );
26
27 virtual const char ** needs( void );
28 virtual const char * provides( void );
29
30 virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
31 virtual bool hasDataFor( const QString & S );
32 virtual bool generateDataForCommonFile(
33 SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
34
35private:
36
37};
38
39extern "C"
40{
41 void create_plugin( QList<ANetNode> & PNN );
42};
43
44#endif
diff --git a/noncore/settings/networksettings2/network/network_NNI.cpp b/noncore/settings/networksettings2/network/network_NNI.cpp
new file mode 100644
index 0000000..7130764
--- a/dev/null
+++ b/noncore/settings/networksettings2/network/network_NNI.cpp
@@ -0,0 +1,170 @@
1#include <system.h>
2#include <asdevice.h>
3#include "networkedit.h"
4#include "network_NNI.h"
5#include "network_NN.h"
6
7ANetwork::ANetwork( NetworkNetNode * PNN ) : ANetNodeInstance( PNN ) {
8 Data.UseDHCP = 1;
9 Data.IPAddress = "";
10 Data.NetMask = "";
11 Data.Broadcast = "";
12 Data.Gateway = "";
13 Data.DNS1 = "";
14 Data.DNS2 = "";
15 Data.SendHostname = 0;
16 Data.Hostname = "";
17 Data.PreUp_SL.clear();
18 Data.PreDown_SL.clear();
19 Data.PostUp_SL.clear();
20 Data.PostDown_SL.clear();
21 GUI = 0;
22 RT = 0;
23}
24
25void ANetwork::setSpecificAttribute( QString & A, QString & V ) {
26 if( A == "usedhcp" ) {
27 Data.UseDHCP = (V == "yes");
28 } else if( A == "sendhostname" ) {
29 Data.SendHostname = (V=="yes");
30 } else if( A == "hostname" ) {
31 Data.Hostname = V;
32 } else if( A == "ipaddress" ) {
33 Data.IPAddress = V;
34 } else if( A == "netmask" ) {
35 Data.NetMask = V;
36 } else if( A == "broadcast" ) {
37 Data.Broadcast = V;
38 } else if( A == "gateway" ) {
39 Data.Gateway = V;
40 } else if( A == "dns1" ) {
41 Data.DNS1 = V;
42 } else if( A == "dns2" ) {
43 Data.DNS2 = V;
44 } else if( A == "preup" ) {
45 Data.PreUp_SL.append( V );
46 } else if( A == "predown" ) {
47 Data.PreDown_SL.append( V );
48 } else if( A == "postup" ) {
49 Data.PostUp_SL.append( V );
50 } else if( A == "postdown" ) {
51 Data.PostDown_SL.append( V );
52 }
53}
54
55void ANetwork::saveSpecificAttribute( QTextStream & TS ) {
56 TS << "usedhcp=" << ((Data.UseDHCP) ? "yes" : "no") << endl;
57 TS << "sendhostname=" << ((Data.SendHostname) ? "yes" : "no") << endl;
58 TS << "hostname=" << Data.Hostname << endl;
59 TS << "ipaddress=" << Data.IPAddress << endl;
60 TS << "netmask=" << Data.NetMask << endl;
61 TS << "broadcast=" << Data.Broadcast << endl;
62 TS << "gateway=" << Data.Gateway << endl;
63 TS << "dns1=" << Data.DNS1 << endl;
64 TS << "dns2=" << Data.DNS2 << endl;
65 for ( QStringList::Iterator it = Data.PreUp_SL.begin();
66 it != Data.PreUp_SL.end();
67 ++it ) {
68 TS << "preup=" << quote(*it) << endl;
69 }
70 for ( QStringList::Iterator it = Data.PreDown_SL.begin();
71 it != Data.PreDown_SL.end();
72 ++it ) {
73 TS << "predown=" << quote(*it) << endl;
74 }
75 for ( QStringList::Iterator it = Data.PostUp_SL.begin();
76 it != Data.PostUp_SL.end();
77 ++it ) {
78 TS << "postup=" << quote(*it) << endl;
79 }
80 for ( QStringList::Iterator it = Data.PostDown_SL.begin();
81 it != Data.PostDown_SL.end();
82 ++it ) {
83 TS << "postdown=" << quote(*it) << endl;
84 }
85}
86
87QWidget * ANetwork::edit( QWidget * parent ) {
88 GUI = new NetworkEdit( parent );
89 GUI->showData( Data );
90 return GUI;
91}
92
93QString ANetwork::acceptable( void ) {
94 return ( GUI ) ? GUI->acceptable( ) : QString();
95}
96
97void ANetwork::commit( void ) {
98 if( GUI && GUI->commit( Data ) )
99 setModified( 1 );
100}
101
102bool ANetwork::generateDataForCommonFile( SystemFile & S, long DevNr ) {
103 AsDevice * Dev = runtime()->device();
104 QString NIC = Dev->genNic( DevNr );
105
106 if( S.name() == "interfaces" ) {
107 // generate mapping stanza for this interface
108 S << "# check if " << NIC << " can be brought UP" << endl;
109 S << "mapping " << NIC << endl;
110 S << " script networksettings2-request" << endl << endl;
111
112 // we can safely call from here since device item is deeper
113 if( Data.UseDHCP ) {
114 S << "iface " << NIC << "-c" << connection()->number() <<
115 "-allowed inet dhcp" << endl;
116 S << " up echo \"" << NIC << "\" > /tmp/profile-" << connection()->number() <<
117 ".up" << Data.IPAddress << endl;
118 if( Data.SendHostname ) {
119 S << " hostname "<< Data.Hostname << endl;
120 }
121
122 S << " down rm -f /tmp/profile-" << connection()->number() <<
123 ".up" << Data.IPAddress << endl;
124 } else {
125 S << "iface " << NIC << "-c" << connection()->number() <<
126 "-allowed inet static" << endl;
127 S << " up echo \"" << NIC << "\" > /tmp/profile-" << connection()->number() <<
128 ".up" << Data.IPAddress << endl;
129 S << " down rm -f /tmp/profile-" << connection()->number() <<
130 ".up" << Data.IPAddress << endl;
131 S << " address " << Data.IPAddress << endl;
132 S << " broadcast " << Data.Broadcast << endl;
133 S << " netmask " << Data.NetMask << endl;
134
135 // derive network address = IPAddress & netmask
136 { QString NW;
137 QStringList ipal = QStringList::split( '.', Data.IPAddress );
138 QStringList nmal = QStringList::split( '.', Data.NetMask );
139
140 NW = QString( "%1.%2.%3.%4" ).
141 arg( ipal[0].toShort() & nmal[0].toShort() ).
142 arg( ipal[1].toShort() & nmal[1].toShort() ).
143 arg( ipal[2].toShort() & nmal[2].toShort() ).
144 arg( ipal[3].toShort() & nmal[3].toShort() );
145 S << " network " << NW << endl;
146 }
147 }
148 for ( QStringList::Iterator it = Data.PreUp_SL.begin();
149 it != Data.PreUp_SL.end();
150 ++it ) {
151 S << " pre-up " << (*it) << endl;
152 }
153 for ( QStringList::Iterator it = Data.PostUp_SL.begin();
154 it != Data.PostUp_SL.end();
155 ++it ) {
156 S << " up " << (*it) << endl;
157 }
158 for ( QStringList::Iterator it = Data.PreDown_SL.begin();
159 it != Data.PreDown_SL.end();
160 ++it ) {
161 S << " down " << (*it) << endl;
162 }
163 for ( QStringList::Iterator it = Data.PostDown_SL.begin();
164 it != Data.PostDown_SL.end();
165 ++it ) {
166 S << " post-down " << (*it) << endl;
167 }
168 }
169 return 0;
170}
diff --git a/noncore/settings/networksettings2/network/network_NNI.h b/noncore/settings/networksettings2/network/network_NNI.h
new file mode 100644
index 0000000..b98ff6e
--- a/dev/null
+++ b/noncore/settings/networksettings2/network/network_NNI.h
@@ -0,0 +1,45 @@
1#ifndef NETWORK_H
2#define NETWORK_H
3
4#include <netnode.h>
5#include "networkdata.h"
6#include "networkrun.h"
7
8class NetworkNetNode;
9class NetworkEdit;
10class SystemFile;
11
12class ANetwork : public ANetNodeInstance{
13
14public :
15
16 ANetwork( NetworkNetNode * PNN );
17
18 QWidget * edit( QWidget * parent );
19 QString acceptable( void );
20 void commit( void );
21
22 RuntimeInfo * runtime( void )
23 { if( RT == 0 )
24 RT = new NetworkRun( this, Data );
25 return RT;
26 }
27
28 virtual void * data( void )
29 { return (void *)&Data; }
30
31 bool generateDataForCommonFile( SystemFile & S, long DevNr );
32
33protected :
34
35 virtual void setSpecificAttribute( QString & Attr, QString & Value );
36 virtual void saveSpecificAttribute( QTextStream & TS );
37
38private :
39
40 NetworkEdit * GUI;
41 NetworkData_t Data;
42 NetworkRun * RT;
43};
44
45#endif
diff --git a/noncore/settings/networksettings2/network/networkdata.h b/noncore/settings/networksettings2/network/networkdata.h
new file mode 100644
index 0000000..2c5da37
--- a/dev/null
+++ b/noncore/settings/networksettings2/network/networkdata.h
@@ -0,0 +1,22 @@
1#ifndef NETWORK_DATA_H
2#define NETWORK_DATA_H
3
4#include <qstring.h>
5#include <qstringlist.h>
6typedef struct NetworkData {
7 bool UseDHCP;
8 QString Hostname;
9 bool SendHostname;
10 QString IPAddress;
11 QString NetMask;
12 QString Gateway;
13 QString Broadcast;
14 QString DNS1;
15 QString DNS2;
16 QStringList PreUp_SL;
17 QStringList PostUp_SL;
18 QStringList PreDown_SL;
19 QStringList PostDown_SL;
20} NetworkData_t;
21
22#endif
diff --git a/noncore/settings/networksettings2/network/networkedit.cpp b/noncore/settings/networksettings2/network/networkedit.cpp
new file mode 100644
index 0000000..b17d745
--- a/dev/null
+++ b/noncore/settings/networksettings2/network/networkedit.cpp
@@ -0,0 +1,160 @@
1#include <qtoolbutton.h>
2#include <qcheckbox.h>
3#include <qlineedit.h>
4#include <qlistbox.h>
5#include <GUIUtils.h>
6#include <resources.h>
7#include "networkedit.h"
8
9NetworkEdit::NetworkEdit( QWidget * Parent ) : NetworkGUI( Parent ){
10
11 AddPreDown_TB->setPixmap( NSResources->getPixmap( "add" ) );
12 AddPreUp_TB->setPixmap( NSResources->getPixmap( "add" ) );
13 AddPostDown_TB->setPixmap( NSResources->getPixmap( "add" ) );
14 AddPostUp_TB->setPixmap( NSResources->getPixmap( "add" ) );
15
16 DeletePreDown_TB->setPixmap( NSResources->getPixmap( "remove" ) );
17 DeletePreUp_TB->setPixmap( NSResources->getPixmap( "remove" ) );
18 DeletePostDown_TB->setPixmap( NSResources->getPixmap( "remove" ) );
19 DeletePostUp_TB->setPixmap( NSResources->getPixmap( "remove" ) );
20
21 UpPreDown_TB->setPixmap( NSResources->getPixmap( "up" ) );
22 UpPreUp_TB->setPixmap( NSResources->getPixmap( "up" ) );
23 UpPostDown_TB->setPixmap( NSResources->getPixmap( "up" ) );
24 UpPostUp_TB->setPixmap( NSResources->getPixmap( "up" ) );
25
26 DownPreDown_TB->setPixmap( NSResources->getPixmap( "down" ) );
27 DownPreUp_TB->setPixmap( NSResources->getPixmap( "down" ) );
28 DownPostDown_TB->setPixmap( NSResources->getPixmap( "down" ) );
29 DownPostUp_TB->setPixmap( NSResources->getPixmap( "down" ) );
30
31}
32
33QString NetworkEdit::acceptable( void ) {
34 if( DHCP_CB->isChecked() ) {
35 if( SendHostname_CB->isChecked() )
36 if( Hostname_LE->text().isEmpty() )
37 return tr("Hostname needed");
38 return QString();
39 }
40
41 if( IPAddress_LE->text().isEmpty() )
42 return tr("IPAddress needed");
43 if( Broadcast_LE->text().isEmpty() )
44 return tr("Broadcast needed");
45 if( SubnetMask_LE->text().isEmpty() )
46 return tr("Subnet mask needed");
47
48 // valid IP ?
49 if( ! validIP( IPAddress_LE->text() ) )
50 return tr("IPAddress not valid");
51 if( ! validIP( SubnetMask_LE->text() ) )
52 return tr("Subnet mask not valid");
53 if( ! validIP( Broadcast_LE->text() ) )
54 return tr("Broadcast address not valid");
55 if( Gateway_LE->text().isEmpty() &&
56 ! validIP( Gateway_LE->text() ) )
57 return tr("Gateway address not valid");
58 if( DNS1_LE->text().isEmpty() &&
59 ! validIP( DNS1_LE->text() ) )
60 return tr("DNS1 address not valid");
61 if( DNS2_LE->text().isEmpty() &&
62 ! validIP( DNS2_LE->text() ) )
63 return tr("DNS2 address not valid");
64 return QString();
65}
66
67bool NetworkEdit::commit( NetworkData_t & Data ) {
68 bool SM = 0;
69 CBM( Data.UseDHCP, DHCP_CB, SM );
70 TXTM( Data.IPAddress, IPAddress_LE, SM );
71 CBM( Data.SendHostname, SendHostname_CB, SM );
72 TXTM( Data.Hostname, Hostname_LE, SM );
73 TXTM( Data.Gateway, Gateway_LE, SM );
74 TXTM( Data.Broadcast, Broadcast_LE, SM );
75 TXTM( Data.NetMask, SubnetMask_LE, SM );
76 TXTM( Data.DNS1, DNS1_LE, SM );
77 TXTM( Data.DNS2, DNS2_LE, SM );
78
79 SM |= updateList( Data.PreUp_SL, PreUp_LB );
80 SM |= updateList( Data.PostUp_SL, PostUp_LB );
81 SM |= updateList( Data.PreDown_SL, PreDown_LB );
82 SM |= updateList( Data.PostDown_SL, PostDown_LB );
83
84 return SM;
85}
86
87void NetworkEdit::showData( NetworkData_t & Data ) {
88 DHCP_CB->setChecked( Data.UseDHCP );
89 SendHostname_CB->setChecked( Data.SendHostname );
90 Hostname_LE->setText( Data.Hostname );
91 IPAddress_LE->setText( Data.IPAddress );
92 Gateway_LE->setText( Data.Gateway );
93 SubnetMask_LE->setText( Data.NetMask );
94 Broadcast_LE->setText( Data.Broadcast );
95 DNS1_LE->setText( Data.DNS1 );
96 DNS2_LE->setText( Data.DNS2 );
97
98 populateList( Data.PreUp_SL, PreUp_LB );
99 populateList( Data.PostUp_SL, PostUp_LB );
100 populateList( Data.PreDown_SL, PreDown_LB );
101 populateList( Data.PostDown_SL, PostDown_LB );
102}
103
104bool NetworkEdit::updateList( QStringList & SL, QListBox * LB ) {
105 bool Changed;
106 QStringList NewSL;
107
108 // collect new list
109 for( unsigned int i = 0; i < LB->count() ; i ++ ) {
110 NewSL.append( LB->text(i) );
111 }
112
113 // check if at least ONE item in new list is NEW
114 Changed = 0;
115 for ( QStringList::Iterator it = NewSL.begin();
116 it != NewSL.end();
117 ++it ) {
118 if( SL.findIndex( (*it) ) < 0 ) {
119 // new or modified item
120 Changed = 1;
121 SL = NewSL;
122 break;
123 }
124 }
125 return Changed;
126}
127
128void NetworkEdit::populateList( QStringList & SL, QListBox * LB ) {
129 LB->clear();
130 for ( QStringList::Iterator it = SL.begin();
131 it != SL.end();
132 ++it ) {
133 LB->insertItem( (*it) );
134 }
135}
136
137void NetworkEdit::SLOT_NetmaskModified( const QString & ) {
138 QString IP, SN;
139 IP = IPAddress_LE->text();
140 SN = SubnetMask_LE->text();
141 if( IP.isEmpty() || SN.isEmpty() )
142 return;
143
144 if( ! validIP(IP) || ! validIP( SN ) )
145 return;
146
147 // if all ones
148 // broadcast = (IPAddress | ~netmask )
149 { QString NW;
150 QStringList ipal = QStringList::split( '.', IP );
151 QStringList nmal = QStringList::split( '.', SN );
152
153 NW = QString( "%1.%2.%3.%4" ).
154 arg( ipal[0].toShort() | ( ~ nmal[0].toShort() & 0x00ff) ).
155 arg( ipal[1].toShort() | ( ~ nmal[1].toShort() & 0x00ff) ).
156 arg( ipal[2].toShort() | ( ~ nmal[2].toShort() & 0x00ff) ).
157 arg( ipal[3].toShort() | ( ~ nmal[3].toShort() & 0x00ff) );
158 Broadcast_LE->setText( NW );
159 }
160}
diff --git a/noncore/settings/networksettings2/network/networkedit.h b/noncore/settings/networksettings2/network/networkedit.h
new file mode 100644
index 0000000..9ed4e84
--- a/dev/null
+++ b/noncore/settings/networksettings2/network/networkedit.h
@@ -0,0 +1,21 @@
1#include "networkdata.h"
2#include "networkGUI.h"
3
4class NetworkEdit : public NetworkGUI {
5
6public :
7
8 NetworkEdit( QWidget * parent );
9 QString acceptable( void );
10 bool commit( NetworkData_t & Data );
11 void showData( NetworkData_t & Data );
12
13public slots :
14
15 void SLOT_NetmaskModified( const QString & S );
16
17private :
18
19 bool updateList( QStringList &SL, QListBox * LB );
20 void populateList( QStringList &SL, QListBox * LB );
21};
diff --git a/noncore/settings/networksettings2/network/networkrun.cpp b/noncore/settings/networksettings2/network/networkrun.cpp
new file mode 100644
index 0000000..e732bfa
--- a/dev/null
+++ b/noncore/settings/networksettings2/network/networkrun.cpp
@@ -0,0 +1,63 @@
1#include <system.h>
2#include <asdevice.h>
3#include "networkrun.h"
4
5void NetworkRun::detectState( NodeCollection * NC ) {
6 RuntimeInfo * RI = netNode()->nextNode()->runtime();
7 AsDevice * Next = RI->asDevice();
8 InterfaceInfo * II = Next->assignedInterface();
9
10 if( II ) {
11 // device has assigned interface
12 NC->setCurrentState( (( II->IsUp ) ? IsUp : Available) );
13 }
14
15 // has no interface -> delegate
16 RI->detectState( NC );
17}
18
19bool NetworkRun::setState( NodeCollection * NC, Action_t A ) {
20 // we handle UP and DOWN
21 RuntimeInfo * RI = netNode()->nextNode()->runtime();
22 AsDevice * Next = RI->asDevice();
23 InterfaceInfo * II = Next->assignedInterface();
24
25 if( A == Up ) {
26 // we can bring UP if lower level is available
27 if( NC->currentState() == Available ) {
28 QString S;
29 S.sprintf( "ifup %s=manual", II->Name.latin1() );
30 NSResources->system().execute( S );
31 NC->setCurrentState( IsUp );
32 }
33 return 1;
34 } else if( A == Down ) {
35 if( NC->currentState() == IsUp ) {
36 QString S;
37 S.sprintf( "ifdown %s", II->Name.latin1() );
38 NSResources->system().execute( S );
39 NC->setCurrentState( Available );
40 }
41 return 1;
42 }
43 // delegate
44 return RI->setState( NC, A );
45}
46
47bool NetworkRun::canSetState( State_t Curr, Action_t A ) {
48 // we handle UP and DOWN
49 RuntimeInfo * RI = netNode()->nextNode()->runtime();
50
51 if( A == Up ) {
52 return ( Curr == Available );
53 } else if( A == Down ) {
54 return ( Curr == IsUp );
55 }
56 // delegate
57 return RI->canSetState( Curr, A );
58}
59
60bool NetworkRun::handlesInterface( const QString & S ) {
61 // donno -> pass deeper
62 return netNode()->nextNode()->runtime()->handlesInterface(S);
63}
diff --git a/noncore/settings/networksettings2/network/networkrun.h b/noncore/settings/networksettings2/network/networkrun.h
new file mode 100644
index 0000000..f3d840e
--- a/dev/null
+++ b/noncore/settings/networksettings2/network/networkrun.h
@@ -0,0 +1,20 @@
1#include <asconnection.h>
2#include "networkdata.h"
3
4class NetworkRun : public AsConnection {
5
6public :
7
8 NetworkRun( ANetNodeInstance * NNI,
9 NetworkData & Data ) : AsConnection( NNI )
10 { }
11
12protected :
13
14 void detectState( NodeCollection * );
15 bool setState( NodeCollection * ,Action_t A );
16 bool canSetState( State_t , Action_t A );
17
18 bool handlesInterface( const QString & I );
19
20};
diff --git a/noncore/settings/networksettings2/networksettings.cpp b/noncore/settings/networksettings2/networksettings.cpp
new file mode 100644
index 0000000..ffe130c
--- a/dev/null
+++ b/noncore/settings/networksettings2/networksettings.cpp
@@ -0,0 +1,820 @@
1#include <stdio.h>
2
3#include <qpe/qpeapplication.h>
4#include <qiconset.h>
5#include <qgroupbox.h>
6#include <qtimer.h>
7#include <qlistbox.h>
8#include <qmessagebox.h>
9#include <qlabel.h>
10#include <qiconview.h>
11#include <qtextstream.h>
12#include <qdir.h>
13#include <qfile.h>
14#include <qfileinfo.h>
15#include <qtimer.h>
16#include <qpe/qpeapplication.h>
17#include <qtoolbutton.h>
18
19#include <asdevice.h>
20#include "networksettings.h"
21#include "netnode.h"
22#include "editconnection.h"
23
24static QString CfgFile;
25
26NetworkSettingsData::NetworkSettingsData( void ) {
27 // init global resources structure
28 new TheNSResources();
29
30 CfgFile.sprintf( "%s/NETCONFIG", getenv("HOME") );
31
32 // load settings
33 Force = 0;
34 loadSettings();
35}
36
37// saving is done by caller
38NetworkSettingsData::~NetworkSettingsData( void ) {
39 delete NSResources;
40}
41
42void NetworkSettingsData::loadSettings( void ) {
43 QString S;
44 ANetNodeInstance* NNI;
45 QString Attr, Value;
46 long idx;
47
48 QFile F( CfgFile );
49 QTextStream TS( &F );
50
51 do {
52
53 if( ! F.open(IO_ReadOnly) )
54 break;
55
56 /* load the file ->
57
58 FORMAT :
59
60 [NETNODETYPE]
61 Entries ...
62 <EMPTYLINE>
63 [connection]
64 Name=Name
65 Node=Name
66 <EMPTYLINE>
67 */
68 while( ! TS.atEnd() ) {
69 S = TS.readLine();
70
71 if ( S.isEmpty() || S[0] != '[' )
72 continue;
73
74 S = S.mid( 1, S.length()-2 );
75
76 if( ! NSResources ) {
77 continue;
78 }
79
80 if( S == "connection" ) {
81 // load connections -> collections of nodes
82 NodeCollection * NC = new NodeCollection( TS );
83 if ( NC->count() == 0 ) {
84 if( QMessageBox::warning(
85 0,
86 qApp->translate( "NetworkSettings2", "Invalid connection" ),
87 qApp->translate( "NetworkSettings2",
88 "<p>Connection %1 contains unrecognized nodes and cannot be loaded</p>" ).arg(NC->name()),
89 qApp->translate( "NetworkSettings2",
90 "Remove node"),
91 qApp->translate( "NetworkSettings2",
92 "Exit program") ) == 1 ) {
93 exit( 0 );
94 }
95 delete NC;
96 } else
97 NSResources->addConnection( NC );
98 } else {
99 // load nodes
100 NNI = NSResources->createNodeInstance( S );
101 if( ! NNI ) {
102 printf( "SKIPPING %s\n", S.latin1() );
103 }
104
105 do {
106 S = TS.readLine();
107 if( S.isEmpty() ) {
108 // empty line
109 break;
110 }
111 // node found ?
112 if( NNI ) {
113 idx = S.find( '=' );
114 if( idx > 0 ) {
115 Attr = S.left( idx );
116 Value = S.mid( idx+1, S.length() );
117 } else {
118 Value="";
119 Attr = S;
120 }
121
122 Value.stripWhiteSpace();
123 Attr.stripWhiteSpace();
124 Attr.lower();
125 // dequote Attr
126 Value = deQuote(Value);
127
128 // set the attribute
129 NNI->setAttribute( Attr, Value );
130 }
131
132 } while( 1 );
133 if( NNI ) {
134 // loading from file -> exists
135 NNI->setNew( FALSE );
136 NSResources->addNodeInstance( NNI );
137 }
138 }
139 }
140
141 } while( 0 );
142
143}
144
145QString NetworkSettingsData::saveSettings( void ) {
146 QString ErrS = "";
147
148 if( ! isModified() )
149 return ErrS;
150
151 QString S;
152 QFile F( CfgFile + ".bup" );
153
154 printf( "Saving settings to %s\n", CfgFile.latin1() );
155 if( ! F.open( IO_WriteOnly | IO_Truncate ) ) {
156 ErrS = qApp->translate( "NetworkSettings",
157 "<p>Could not save setup to %1 !</p>" ).
158 arg(CfgFile);
159 // problem
160 return ErrS;
161 }
162
163 QTextStream TS( &F );
164 { Name2Connection_t & M = NSResources->connections();
165 ANetNodeInstance * NNI;
166
167 // for all connections
168 for( QDictIterator<NodeCollection> it(M);
169 it.current();
170 ++it ) {
171 // all nodes in those connections
172 for( QListIterator<ANetNodeInstance> nit(*(it.current()));
173 nit.current();
174 ++nit ) {
175 // header
176 NNI = nit.current();
177 TS << '[' <<NNI->netNode()->nodeName() << ']' << endl;
178 NNI->saveAttributes( TS );
179 TS << endl;
180 }
181
182 TS << "[connection]" << endl;
183 it.current()->save(TS);
184 }
185 }
186
187 QDir D(".");
188 D.rename( CfgFile + ".bup", CfgFile );
189
190 //
191 // proper files AND system files regenerated
192 //
193
194 setModified( 0 );
195 return ErrS;
196}
197
198QString NetworkSettingsData::generateSettings( bool ForceReq ) {
199 bool ForceIt;
200 QString S = "";
201
202 // include own force flag
203 ForceIt = (Force) ? 1 : ForceReq;
204
205 if( ! ForceIt && ! isModified() )
206 return S;
207
208 // regenerate system files
209 printf( "Generating settings from %s\n", CfgFile.latin1() );
210
211 { Name2SystemFile_t & SFM = NSResources->systemFiles();
212 Name2Connection_t & M = NSResources->connections();
213 NodeCollection * NC;
214 ANetNodeInstance * NNI;
215 SystemFile * SF;
216 bool needToRegenerate = ForceIt;
217
218 //
219 // check if we need to generate at least one of the system files
220 //
221 if( ! ForceIt ) {
222 for( QDictIterator<SystemFile> sfit(SFM);
223 sfit.current();
224 ++sfit ) {
225 SF = sfit.current();
226
227 // check if there are nodes that are modified and require
228 // data for this system file
229
230 // for all connections
231 for( QDictIterator<NodeCollection> ncit(M);
232 ncit.current();
233 ++ncit ) {
234 NC = ncit.current();
235
236 if( NC->isModified() ) {
237 // does this connection 'touch' this system file ?
238 for( QListIterator<ANetNodeInstance> cncit(*NC);
239 cncit.current();
240 ++cncit ) {
241 NNI = cncit.current();
242 if( NNI->netNode()->hasDataFor( SF->name() ) &&
243 NNI->isModified() ) {
244 needToRegenerate = 1;
245 break;
246 }
247 }
248 }
249 if( needToRegenerate )
250 break;
251 }
252 if( needToRegenerate )
253 break;
254 }
255 }
256
257 // we cannot renumber with a FORCE request since
258 // we probably are NOT going to save the config
259 // e.g. when using --regen option
260 if( ! ForceReq && needToRegenerate ) {
261 NSResources->renumberConnections();
262 setModified(1);
263 }
264
265 //
266 // generate files proper to each netnodeinstance
267 //
268 { Name2Instance_t & NNIs = NSResources->netNodeInstances();
269 ANetNodeInstance * NNI;
270
271 for( QDictIterator<ANetNodeInstance> NNIIt(NNIs);
272 NNIIt.current();
273 ++NNIIt
274 ){
275 // for all nodes find those that are modified
276 NNI = NNIIt.current();
277
278 if( ForceIt || NNI->isModified() ) {
279 if( ! NNI->netNode()->generateProperFilesFor( NNI ) ) {
280 // problem generating
281 S = qApp->translate( "NetworkSettings",
282 "<p>Cannot generate files proper to %1</p>" ).
283 arg(NNI->netNode()->nodeName()) ;
284 return S;
285 }
286 }
287 }
288 }
289
290 //
291 // generate system files
292 //
293 for( QDictIterator<SystemFile> sfit(SFM);
294 sfit.current();
295 ++sfit ) {
296 SF = sfit.current();
297
298 //
299 // regenerate current file
300 //
301 printf( "Generating %s\n", SF->name().latin1() );
302 SF->open();
303
304 do { // so we can break;
305
306 if( SF->preSection() ) {
307 S = qApp->translate( "NetworkSettings",
308 "<p>Error in preSection for file %1</p>" ).
309 arg( SF->name() );
310 return S;
311 }
312
313 for( QDictIterator<NodeCollection> ncit(M);
314 ncit.current();
315 ++ncit ) {
316 NC = ncit.current();
317
318 // get the netnode that serves as the device for this
319 // connection
320 AsDevice * Dev = NC->device();
321
322 // generate 'entry' for every possible device this profile handles
323
324 for( QListIterator<ANetNodeInstance> cncit(*NC);
325 cncit.current();
326 ++cncit ) {
327 NNI = cncit.current();
328 for( int i = 0; i < Dev->count(); i ++ ) {
329 if( NNI->netNode()->hasDataFor( SF->name() ) ) {
330 if( SF->preNodeSection( NNI, i ) ) {
331 S = qApp->translate( "NetworkSettings",
332 "<p>Error in preNodeSection for file %1 and node %2</p>" ).
333 arg( SF->name() ).
334 arg( NNI->netNode()->nodeName() );
335 return S;
336 }
337
338 if( NNI->netNode()->generateDataForCommonFile(*SF,i,NNI) ) {
339 S = qApp->translate( "NetworkSettings",
340 "<p>Error in node part for file %1 and node %2</p>" ).
341 arg( SF->name() ).
342 arg( NNI->netNode()->nodeName() );
343 return S;
344 }
345
346 if( SF->postNodeSection( NNI, i ) ) {
347 S = qApp->translate( "NetworkSettings",
348 "<p>Error in postNodeSection for file %1 and node %2</p>" ).
349 arg( SF->name() ).
350 arg( NNI->netNode()->nodeName() );
351 return S;
352 }
353 }
354 }
355 }
356 *SF << endl;
357 }
358
359 if( SF->postSection() ) {
360 S = qApp->translate( "NetworkSettings",
361 "<p>Error in postSection for file %1</p>" ).
362 arg( SF->name() );
363 return S;
364 }
365 } while( 0 );
366 SF->close();
367 }
368 }
369 Force = 0;
370 return S;
371}
372
373//
374// GUI part
375//
376
377NetworkSettings::NetworkSettings( QWidget *parent,
378 const char *name,
379 WFlags fl ) : NetworkSettingsGUI(parent,name,fl),
380 NSD() {
381
382 UpdateTimer = new QTimer( this );
383 // set pixmaps
384 Add_TB->setPixmap( NSResources->getPixmap( "add" ) );
385 Delete_TB->setPixmap( NSResources->getPixmap( "remove" ) );
386 CheckState_TB->setPixmap( NSResources->getPixmap( "check" ) );
387 Enable_TB->setPixmap( NSResources->getPixmap( "disabled" ) );
388 GenConfig_TB->setPixmap( NSResources->getPixmap( "configure" ) );
389
390 Connect_TB->setPixmap( NSResources->getPixmap( "connected" ) );
391
392 On_TB->setPixmap( NSResources->getPixmap( "off" ) );
393
394 // populate main Listbox
395 Profiles_IV->clear();
396 { Name2Connection_t & M = NSResources->connections();
397 NodeCollection * NC;
398 QIconViewItem * IVI;
399
400 // for all connections
401 for( QDictIterator<NodeCollection> it(M);
402 it.current();
403 ++it ) {
404 NC = it.current();
405 IVI = new QIconViewItem( Profiles_IV,
406 NC->name(),
407 NC->devicePixmap() );
408 }
409 }
410
411 if( Profiles_IV->count() ) {
412 Profiles_IV->setSelected( Profiles_IV->firstItem(), TRUE );
413 }
414
415 // if no profiles -> auto popup editing
416 if( NSResources->connections().count() == 0 ) {
417 QTimer::singleShot( 100, this, SLOT(SLOT_AddNode() ) );
418 }
419
420 UpdateTimer->start( 5000 );
421 connect( UpdateTimer, SIGNAL( timeout() ),
422 this, SLOT( SLOT_RefreshStates() ) );
423}
424
425NetworkSettings::~NetworkSettings() {
426 QString S;
427
428 S = NSD.generateSettings();
429 if( ! S.isEmpty() ) {
430 QMessageBox::warning(
431 0,
432 tr( "Generating system configuration" ),
433 S
434 );
435 }
436
437 S = NSD.saveSettings();
438 if( ! S.isEmpty() ) {
439 // problem saving
440 QMessageBox::warning(
441 0,
442 tr( "Saving setup" ), S );
443 }
444}
445
446void NetworkSettings::SLOT_RefreshStates( void ) {
447 QIconViewItem * IVI = Profiles_IV->currentItem(); // remeber
448
449 if( IVI ) {
450 NodeCollection * NC;
451 NSResources->system().probeInterfaces();
452 // update current selection only
453 NC = NSResources->findConnection( IVI->text() );
454 if( NC ) {
455 State_t OldS = NC->state();
456 State_t NewS = NC->state(1);
457 if( OldS != NewS ) {
458 updateProfileState( IVI );
459 }
460 }
461 }
462
463
464 /* -> LATER !!
465 bool is;
466 NodeCollection * NC;
467
468 for( unsigned int i = 0; i < Profiles_LB->count() ; i ++ ) {
469 NC = NSResources->findConnection( Profiles_LB->text(i) );
470 if( NC ) {
471 State_t OldS = NC->state();
472 State_t NewS = NC->state(1);
473 if( OldS != NewS ) {
474 is = Profiles_LB->isSelected(i);
475 Profiles_LB->changeItem( NC->statePixmap(NewS),
476 NC->name(),
477 i );
478 if( is ) {
479 Profiles_LB->setSelected( i, TRUE );
480 }
481 }
482 }
483 }
484 if( ci >= 0 )
485 Profiles_LB->setCurrentItem( ci );
486 */
487}
488
489void NetworkSettings::SLOT_AddNode( void ) {
490 SLOT_EditNode( 0 );
491}
492
493void NetworkSettings::SLOT_DeleteNode( void ) {
494 QIconViewItem * IVI = Profiles_IV->currentItem();
495
496 if ( ! IVI )
497 return;
498
499 if( QMessageBox::warning(
500 0,
501 tr( "Removing profile" ),
502 tr( "Remove selected profile ?" ),
503 1, 0 ) == 1 ) {
504 NSResources->removeConnection( IVI->text() );
505 delete IVI;
506 setModified( 1 );
507 NSD.forceGeneration(1);
508 }
509}
510
511void NetworkSettings::SLOT_EditNode( QIconViewItem * IVI ) {
512 QString OldName = "";
513 EditConnection EC( this );
514
515 if( IVI ) {
516 NodeCollection * NC = NSResources->findConnection( IVI->text() );
517 if( ! NC ) {
518 return;
519 }
520 OldName = NC->name();
521 EC.setConnection( NC );
522 }
523
524 EC.showMaximized();
525 // disable refresh timer
526 UpdateTimer->stop();
527 if( EC.exec() == QDialog::Accepted ) {
528 // toplevel item -> store
529 NodeCollection * NC = EC.connection();
530 if( NC->isModified() ) {
531 setModified( 1 );
532 if( IVI ) {
533 // new name -> remove item
534 NSResources->removeConnection( OldName );
535 // must add it here since change will trigger event
536 NSResources->addConnection( NC );
537 IVI->setText( NC->name() );
538 IVI->setPixmap( NC->devicePixmap() );
539 } else {
540 // new item
541 NSResources->addConnection( NC );
542 NC->setNumber( NC->maxConnectionNumber()+1 );
543 IVI = new QIconViewItem( Profiles_IV,
544 NC->name(),
545 NC->devicePixmap()
546 );
547 Profiles_IV->setSelected( IVI, TRUE );
548 }
549 updateProfileState( IVI );
550 }
551 } else {
552 // cancelled : reset connection
553 if( IVI ) {
554 NodeCollection * NC = NSResources->findConnection( IVI->text() );
555 NC->reassign();
556 }
557 }
558 // reenable
559 UpdateTimer->start( 5000 );
560}
561
562void NetworkSettings::SLOT_ShowNode( QIconViewItem * IVI ) {
563 if( IVI == 0 )
564 return;
565
566 NodeCollection * NC = NSResources->findConnection( IVI->text() );
567
568 // is button possible
569 bool EnabledPossible, OnPossible, ConnectPossible;
570 // is button On or Off
571 bool DisabledOn, OnOn, ConnectOn;
572
573 EnabledPossible = OnPossible = ConnectPossible = 1;
574 DisabledOn = 1;
575 OnOn = ConnectOn = 0;
576
577 switch( NC->state() ) {
578 case Unknown :
579 // cannot occur here
580 break;
581 case Unchecked :
582 case Unavailable :
583 // cannot do anything but recheck
584 EnabledPossible = OnPossible = ConnectPossible = 0;
585 break;
586 case Disabled :
587 OnPossible = ConnectPossible = 0;
588 break;
589 case Off :
590 DisabledOn = 0;
591 break;
592 case Available :
593 OnOn = 1;
594 DisabledOn = 0;
595 break;
596 case IsUp :
597 OnOn = ConnectOn = 1;
598 DisabledOn = 0;
599 break;
600 }
601
602 // set button state
603 Enable_TB->setEnabled( EnabledPossible );
604 On_TB->setEnabled( OnPossible );
605 Connect_TB->setEnabled( ConnectPossible );
606
607 Enable_TB->setOn( DisabledOn );
608 On_TB->setOn( OnOn );
609 Connect_TB->setOn( ConnectOn );
610
611 if( NC->description().isEmpty() ) {
612 Description_LBL->setText( tr( "No description" ) );
613 } else {
614 Description_LBL->setText( NC->description() );
615 }
616
617 CurProfile_GB->setTitle( IVI->text() );
618 State_LBL->setText( NC->stateName() );
619}
620
621void NetworkSettings::SLOT_CheckState( void ) {
622 QIconViewItem * IVI = Profiles_IV->currentItem();
623 if ( ! IVI )
624 return;
625 updateProfileState( IVI );
626}
627
628void NetworkSettings::updateProfileState( QIconViewItem * IVI ) {
629 if( IVI == Profiles_IV->currentItem() ) {
630 SLOT_ShowNode( IVI );
631 }
632}
633
634void NetworkSettings::SLOT_GenerateConfig( void ) {
635 QString S = NSD.generateSettings( TRUE );
636
637 if( ! S.isEmpty() ) {
638 QMessageBox::warning(
639 0,
640 tr( "Generating system configuration" ),
641 S
642 );
643 }
644}
645
646void NetworkSettings::SLOT_Enable( void ) {
647 QIconViewItem * IVI = Profiles_IV->currentItem();
648 QString Msg;
649 if ( ! IVI )
650 return;
651
652 NodeCollection * NC =
653 NSResources->findConnection( IVI->text() );
654
655 bool rv;
656 switch( NC->state() ) {
657 case Disabled :
658 Msg = tr( "Cannot enable profile" );
659 rv = NC->setState( Enable );
660 break;
661 default :
662 Msg = tr( "Cannot disable profile" );
663 rv = NC->setState( Disable );
664 break;
665 }
666
667 if( ! rv ) {
668 QMessageBox::warning(
669 0,
670 tr( "Activating profile" ),
671 Msg );
672 return;
673 }
674 updateProfileState( IVI );
675}
676
677void NetworkSettings::SLOT_On( void ) {
678 QIconViewItem * IVI = Profiles_IV->currentItem();
679
680 if ( ! IVI )
681 return;
682
683 NodeCollection * NC =
684 NSResources->findConnection( IVI->text() );
685
686 bool rv;
687 switch( NC->state() ) {
688 case Off :
689 // activate interface
690 rv = NC->setState( Activate );
691 break;
692 case Available :
693 // deactivate
694 rv = NC->setState( Deactivate );
695 break;
696 case IsUp :
697 // bring down and deactivate
698 rv = ( NC->setState( Down ) &&
699 NC->setState( Deactivate ) );
700 break;
701 default :
702 // others no change
703 return;
704 }
705
706 if( ! rv ) {
707 QMessageBox::warning(
708 0,
709 tr( "Activating profile" ),
710 tr( "Cannot enable profile" ) );
711 return;
712 }
713 updateProfileState( IVI );
714}
715
716void NetworkSettings::SLOT_Connect( void ) {
717 QIconViewItem * IVI = Profiles_IV->currentItem();
718
719 if ( ! IVI )
720 return;
721
722 NodeCollection * NC =
723 NSResources->findConnection( IVI->text() );
724
725 bool rv;
726 switch( NC->state() ) {
727 case IsUp :
728 // down interface
729 rv = NC->setState( Down );
730 break;
731 case Available :
732 // up interface
733 rv = NC->setState( Up );
734 break;
735 case Off :
736 // activate and bring up
737 rv = ( NC->setState( Activate ) &&
738 NC->setState( Up ) );
739 break;
740 default :
741 // others no change
742 return;
743 }
744
745 if( ! rv ) {
746 QMessageBox::warning(
747 0,
748 tr( "Activating profile" ),
749 tr( "Cannot enable profile" ) );
750 return;
751 }
752
753 // we do not update the GUI but wait for the REAL upping of the device
754}
755
756/*
757 Called by the system to see if interface can be brought UP
758
759 if allowed, echo Interface-allowed else Interface-disallowed
760*/
761
762void NetworkSettings::canStart( const char * Interface ) {
763 // load situation
764 NetworkSettingsData NSD;
765
766 { Name2Connection_t & M = NSResources->connections();
767 NodeCollection * NC;
768
769 // for all connections
770 for( QDictIterator<NodeCollection> it(M);
771 it.current();
772 ++it ) {
773 NC = it.current();
774 // check if this profile handles the requested interface
775 if( NC->handlesInterface( Interface ) ) {
776 switch( NC->state() ) {
777 case Unchecked :
778 case Unknown :
779 case Unavailable :
780 case Disabled :
781 // this profile does not allow interface to be UP
782 // -> try others
783 break;
784 case Off :
785 // try to UP the device
786 if( ! NC->setState( Activate ) ) {
787 // cannot bring device Online -> try other alters
788 break;
789 }
790 // FT
791 case Available :
792 case IsUp : // also called for 'down'
793 // device is ready -> done
794 printf( "%s-c%d-allowed\n",
795 Interface, NC->number() );
796 return;
797 }
798 }
799 }
800 }
801 // if we come here no alternatives are possible
802 printf( "%s-cnn-disallowed\n", Interface );
803}
804
805/*
806 Called by the system to regenerate config files
807*/
808
809bool NetworkSettings::regenerate( void ) {
810 QString S;
811 // load situation
812 NetworkSettingsData NSD;
813
814 S = NSD.generateSettings( TRUE );
815 if( ! S.isEmpty() ) {
816 fprintf( stdout, "%s\n", S.latin1() );
817 return 1;
818 }
819 return 0;
820}
diff --git a/noncore/settings/networksettings2/networksettings.h b/noncore/settings/networksettings2/networksettings.h
new file mode 100644
index 0000000..eb475a3
--- a/dev/null
+++ b/noncore/settings/networksettings2/networksettings.h
@@ -0,0 +1,77 @@
1#include "networksettingsGUI.h"
2#include "resources.h"
3
4class ANetNode;
5class ANetNodeInstance;
6class QTimer;
7class QIconViewItem;
8
9class NetworkSettingsData {
10
11public :
12
13 NetworkSettingsData( void );
14 ~NetworkSettingsData( void );
15
16 void loadSettings( void );
17 QString saveSettings( void );
18
19 QString generateSettings( bool Force = FALSE );
20
21 bool isModified( void )
22 { return IsModified; }
23 void setModified( bool m )
24 { IsModified = m; }
25
26 void forceGeneration( bool m )
27 { Force = m; }
28
29private :
30
31 bool IsModified;
32 bool Force;
33
34};
35
36class NetworkSettings : public NetworkSettingsGUI {
37
38 Q_OBJECT
39
40public :
41
42 NetworkSettings( QWidget *parent=0,
43 const char *name=0,
44 WFlags fl = 0 );
45 ~NetworkSettings( void );
46
47 static QString appName( void )
48 { return QString::fromLatin1("networksettings"); }
49
50 static void canStart( const char * Interface );
51 static bool regenerate( void );
52
53 bool isModified( void )
54 { return NSD.isModified(); }
55 void setModified( bool m )
56 { NSD.setModified( m ); }
57
58public slots :
59
60 void SLOT_AddNode( void );
61 void SLOT_DeleteNode( void );
62 void SLOT_ShowNode( QIconViewItem * );
63 void SLOT_EditNode( QIconViewItem * );
64 void SLOT_CheckState( void );
65 void SLOT_Enable( void );
66 void SLOT_On( void );
67 void SLOT_Connect( void );
68 void SLOT_GenerateConfig( void );
69 void SLOT_RefreshStates( void );
70
71private :
72
73 void updateProfileState( QIconViewItem * it );
74 QTimer * UpdateTimer;
75 NetworkSettingsData NSD;
76
77};
diff --git a/noncore/settings/networksettings2/networksettings.pro b/noncore/settings/networksettings2/networksettings.pro
new file mode 100644
index 0000000..fb1f2cf
--- a/dev/null
+++ b/noncore/settings/networksettings2/networksettings.pro
@@ -0,0 +1,16 @@
1#
2CONFIG = qt warn_on debug quick-app
3#CONFIG = qt warn_on release
4HEADERS = networksettings.h \
5 editconnection.h
6SOURCES = main.cpp \
7 networksettings.cpp \
8 editconnection.cpp
9INCLUDEPATH += $(OPIEDIR)/include networksettings2/
10DEPENDPATH += $(OPIEDIR)/include networksettings2/
11LIBS += -lqpe -L$(OPIEDIR)/plugins/networksettings2 -lnetworksettings2 -lopie
12INTERFACES = networksettingsGUI.ui editconnectionGUI.ui
13TARGET = networksettings2
14
15
16include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/networksettings2/networksettings2/GUIUtils.cpp b/noncore/settings/networksettings2/networksettings2/GUIUtils.cpp
new file mode 100644
index 0000000..a98c303
--- a/dev/null
+++ b/noncore/settings/networksettings2/networksettings2/GUIUtils.cpp
@@ -0,0 +1,27 @@
1#include <qstringlist.h>
2#include "GUIUtils.h"
3
4bool validIP( const QString & S ) {
5
6 QStringList SL = QStringList::split( '.', S, TRUE );
7 if( SL.count() != 4 )
8 return 0;
9
10 for( int i = 0; i < 4 ; i ++ ) {
11 if( SL[i].isEmpty() )
12 return 0;
13 }
14
15 short x = SL[0].toShort();
16
17 if( x < 1 || x > 255 )
18 return 0;
19
20 for( int i = 1; i < 4 ; i ++ ) {
21 x = SL[i].toShort();
22 if( x < 0 || x > 255 )
23 return 0;
24 }
25 return 1;
26
27}
diff --git a/noncore/settings/networksettings2/networksettings2/GUIUtils.h b/noncore/settings/networksettings2/networksettings2/GUIUtils.h
new file mode 100644
index 0000000..23290a9
--- a/dev/null
+++ b/noncore/settings/networksettings2/networksettings2/GUIUtils.h
@@ -0,0 +1,36 @@
1#ifndef __GUIUTILS_H
2#define __GUIUTILS_H
3
4#include <qstring.h>
5
6// if TEXT capable widget has changed
7#define TXTM( Data, Wdg, FL ) \
8 if( Wdg->text() != Data ) { \
9 FL = 1; \
10 Data = Wdg->text(); \
11 }
12
13// if IsChecked capable widget has changed
14#define CBM(Data,Wdg,FL) \
15 if( Wdg->isChecked() != Data) { \
16 FL = 1; \
17 Data = Wdg->isChecked(); \
18 }
19
20// if Value capable widget has changed
21#define SBM(Data,Wdg,FL) \
22 if( Wdg->value() != Data) { \
23 FL = 1; \
24 Data = Wdg->value(); \
25 }
26
27// if currentItem capable widget has changed
28#define CIM(Data,Wdg,FL) \
29 if( Wdg->currentItem() != Data) { \
30 FL = 1; \
31 Data = Wdg->currentItem(); \
32 }
33
34extern bool validIP( const QString & S );
35
36#endif
diff --git a/noncore/settings/networksettings2/networksettings2/asconnection.h b/noncore/settings/networksettings2/networksettings2/asconnection.h
new file mode 100644
index 0000000..1ed7e74
--- a/dev/null
+++ b/noncore/settings/networksettings2/networksettings2/asconnection.h
@@ -0,0 +1,18 @@
1#ifndef ASCONNECTION_H
2#define ASCONNECTION_H
3
4#include <resources.h>
5
6// pure virtual (component oriented) interface of any
7// plugin that offers a connection
8class AsConnection : public RuntimeInfo {
9
10public :
11
12 AsConnection( ANetNodeInstance * NNI ) :
13 RuntimeInfo( NNI ) {
14 }
15
16};
17
18#endif
diff --git a/noncore/settings/networksettings2/networksettings2/asdevice.h b/noncore/settings/networksettings2/networksettings2/asdevice.h
new file mode 100644
index 0000000..058fc4c
--- a/dev/null
+++ b/noncore/settings/networksettings2/networksettings2/asdevice.h
@@ -0,0 +1,37 @@
1#ifndef ASDEVICE_H
2#define ASDEVICE_H
3
4#include "system.h"
5#include "netnode.h"
6
7// pure virtual (component oriented) interface of any
8// plugin that offers a device
9class AsDevice : public RuntimeInfo {
10
11public :
12
13 AsDevice( ANetNodeInstance * NNI ) :
14 RuntimeInfo( NNI ) {
15 AssignedInterface = 0;
16 }
17
18 // return the interface assigned to this device
19 // e.g eth0, wlan, ...
20 InterfaceInfo * assignedInterface( void )
21 { return AssignedInterface; }
22 virtual void assignInterface( InterfaceInfo * NI )
23 { AssignedInterface = NI; }
24
25 // number of device to configure for this Device type
26 virtual long count( void )
27 { return 1; }
28 // generate NIC name of device number ...
29 virtual QString genNic( long NicNr ) = 0;
30
31private :
32
33 InterfaceInfo * AssignedInterface;
34
35};
36
37#endif
diff --git a/noncore/settings/networksettings2/networksettings2/asfullsetup.h b/noncore/settings/networksettings2/networksettings2/asfullsetup.h
new file mode 100644
index 0000000..e358a83
--- a/dev/null
+++ b/noncore/settings/networksettings2/networksettings2/asfullsetup.h
@@ -0,0 +1,20 @@
1#ifndef ASFULLSETUP_H
2#define ASFULLSETUP_H
3
4#include <netnode.h>
5
6// pure virtual (component oriented) interface of any
7// plugin that offers a full setup
8class AsFullSetup : public RuntimeInfo {
9
10public :
11
12 AsFullSetup( ANetNodeInstance * NNI ) :
13 RuntimeInfo( NNI ) {
14 }
15
16 virtual const QString & description( void ) = 0;
17
18};
19
20#endif
diff --git a/noncore/settings/networksettings2/networksettings2/asline.h b/noncore/settings/networksettings2/networksettings2/asline.h
new file mode 100644
index 0000000..6bd93ec
--- a/dev/null
+++ b/noncore/settings/networksettings2/networksettings2/asline.h
@@ -0,0 +1,18 @@
1#ifndef ASLINE_H
2#define ASLINE_H
3
4#include <netnode.h>
5
6// pure virtual (component oriented) interface of any
7// plugin that offers a line
8class AsLine : public RuntimeInfo {
9
10public :
11
12 AsLine( ANetNodeInstance * NNI ) :
13 RuntimeInfo( NNI ) {
14 }
15
16};
17
18#endif
diff --git a/noncore/settings/networksettings2/networksettings2/config.in b/noncore/settings/networksettings2/networksettings2/config.in
new file mode 100644
index 0000000..4f1dd5b
--- a/dev/null
+++ b/noncore/settings/networksettings2/networksettings2/config.in
@@ -0,0 +1,4 @@
1 config NS2MAIN
2 boolean
3 default "y" if NS2
4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && NS2
diff --git a/noncore/settings/networksettings2/networksettings2/netnode.cpp b/noncore/settings/networksettings2/networksettings2/netnode.cpp
new file mode 100644
index 0000000..a5b572b
--- a/dev/null
+++ b/noncore/settings/networksettings2/networksettings2/netnode.cpp
@@ -0,0 +1,278 @@
1#include <qpe/qpeapplication.h>
2#include <time.h>
3#include <qtextstream.h>
4#include <qpixmap.h>
5
6#include "resources.h"
7#include "netnode.h"
8
9#include "asdevice.h"
10#include "asline.h"
11#include "asconnection.h"
12#include "asfullsetup.h"
13
14QString & deQuote( QString & X ) {
15 if( X[0] == '"' ) {
16 // remove end and trailing "" and \x -> x
17 QChar R;
18 long idx;
19 idx = X.length()-1;
20 X = X.mid( 1, idx );
21
22 idx = 0;
23 while( ( idx = X.find( '\\', idx ) ) >= 0 ) {
24 R = X[idx+1];
25 X.replace( idx, 2, &R, 1 );
26 }
27 X = X.left( X.length()-1 );
28 }
29 return X;
30}
31
32QString quote( QString X ) {
33 if( X.find( QRegExp( "[ \n\"\\\t]" ) ) >= 0 ) {
34 // need to quote this
35 QString OutString = "\"";
36
37 X.replace( QRegExp("\""), "\\\"" );
38 X.replace( QRegExp("\\"), "\\\\" );
39 X.replace( QRegExp(" "), "\\ " );
40
41 OutString += X;
42 OutString += "\"";
43 X = OutString;
44 }
45 return X;
46}
47
48//
49//
50//
51//
52//
53
54long ANetNodeInstance::InstanceCounter = -1;
55
56void ANetNodeInstance::initialize( void ) {
57 if( InstanceCounter == -1 )
58 InstanceCounter = time(0);
59 // set name
60 QString N;
61 N.sprintf( "-%ld", InstanceCounter++ );
62 N.prepend( NodeType->nodeName() );
63 setNodeName( N );
64}
65
66void ANetNodeInstance::setAttribute( QString & Attr, QString & Value ){
67 if( Attr == "name" ) {
68 NodeName = Value;
69 } else {
70 setSpecificAttribute( Attr, Value );
71 }
72}
73
74void ANetNodeInstance::saveAttributes( QTextStream & TS ) {
75 TS << "name=" << quote( NodeName ) << endl;
76 saveSpecificAttribute( TS );
77}
78
79ANetNodeInstance * ANetNodeInstance::nextNode( void ) {
80 return connection()->findNext( this );
81}
82
83//
84//
85//
86//
87//
88
89long NodeCollection::MaxNr = -1;
90
91NodeCollection::NodeCollection( void ) : QList<ANetNodeInstance>() {
92 IsModified = 0;
93 Index = -1;
94 Name="";
95 IsNew = 1;
96 CurrentState = Unchecked;
97}
98
99NodeCollection::NodeCollection( QTextStream & TS ) :
100 QList<ANetNodeInstance>() {
101 long idx;
102 bool InError = 0;
103 QString S, A, N;
104 IsModified = 0;
105 Index = -1;
106 Name="";
107 IsNew = 0;
108 CurrentState = Unchecked;
109
110 do {
111 S = TS.readLine();
112 if( S.isEmpty() ) {
113 if( InError ) {
114 // remove all nodes
115 clear();
116 }
117 // empty line
118 break;
119 }
120
121 idx = S.find('=');
122 S.stripWhiteSpace();
123 A = S.left( idx );
124 A.lower();
125 N = S.mid( idx+1, S.length() );
126 N.stripWhiteSpace();
127 N = deQuote( N );
128
129 if( A == "name" ) {
130 Name = N;
131 } else if( A == "number" ) {
132 setNumber( N.toLong() );
133 } else if( A == "node" ) {
134 ANetNodeInstance * NNI = NSResources->findNodeInstance( N );
135 if( NNI && ! InError ) {
136 append( NSResources->findNodeInstance( N ) );
137 } else {
138 // could not find a node type -> collection invalid
139 InError = 1;
140 }
141 }
142 } while( 1 );
143}
144
145
146NodeCollection::~NodeCollection( void ) {
147}
148
149const QString & NodeCollection::description( void ) {
150 ANetNodeInstance * NNI = getToplevel();
151 return (NNI) ? NNI->runtime()->asFullSetup()->description() : Name;
152}
153
154void NodeCollection::append( ANetNodeInstance * NNI ) {
155 NNI->setConnection( this );
156 QList<ANetNodeInstance>::append( NNI );
157}
158
159void NodeCollection::save( QTextStream & TS ) {
160
161 TS << "name=" << quote( Name ) << endl;
162 TS << "number=" << number() << endl;
163 ANetNodeInstance * NNI;
164 for( QListIterator<ANetNodeInstance> it(*this);
165 it.current();
166 ++it ) {
167 NNI = it.current();
168 TS << "node=" << quote( NNI->nodeName() ) << endl;
169 }
170 TS << endl;
171 IsNew = 0;
172}
173
174ANetNodeInstance * NodeCollection::getToplevel( void ) {
175 ANetNodeInstance * NNI = 0;
176 for( QListIterator<ANetNodeInstance> it(*this);
177 it.current();
178 ++it ) {
179 NNI = it.current();
180 if( NNI->netNode()->isToplevel() )
181 break;
182 }
183 return NNI;
184}
185
186ANetNodeInstance * NodeCollection::findByName( const QString & S ) {
187 ANetNodeInstance * NNI = 0;
188 for( QListIterator<ANetNodeInstance> it(*this);
189 it.current();
190 ++it ) {
191 NNI = it.current();
192 if( NNI->name() == S )
193 break;
194 }
195 return NNI;
196}
197
198ANetNodeInstance * NodeCollection::findNext( ANetNodeInstance * NNI ) {
199 ANetNodeInstance * NNNI;
200
201 if( ! NNI )
202 getToplevel();
203
204 for( QListIterator<ANetNodeInstance> it(*this);
205 it.current();
206 ++it ) {
207 NNNI = it.current();
208 if( NNNI == NNI ) {
209 ++it;
210 return it.current();
211 }
212 }
213 return 0; // no more next
214}
215
216int NodeCollection::compareItems( QCollection::Item I1,
217 QCollection::Item I2 ) {
218 ANetNodeInstance * NNI1, * NNI2;
219 NNI1 = (ANetNodeInstance *)I1;
220 NNI2 = (ANetNodeInstance *)I2;
221 return NNI1->nodeName().compare( NNI2->nodeName() );
222}
223
224static char * State2PixmapTbl[] = {
225 "NULL", // Unchecked : no pixmap
226 "check", // Unknown
227 "delete", // unavailable
228 "disabled", // disabled
229 "off", // off
230 "disconnected", // available
231 "connected" // up
232};
233
234QPixmap NodeCollection::devicePixmap( void ) {
235 return NSResources->getPixmap(
236 device()->netNode()->pixmapName()+"-large" );
237}
238
239QPixmap NodeCollection::statePixmap( State_t S) {
240 return NSResources->getPixmap( State2PixmapTbl[S] );
241}
242
243QString NodeCollection::stateName( State_t S) {
244 switch( S ) {
245 case Unknown :
246 return qApp->translate( "networksettings2", "Unknown");
247 case Unavailable :
248 return qApp->translate( "networksettings2", "Unavailable");
249 case Disabled :
250 return qApp->translate( "networksettings2", "Disabled");
251 case Off :
252 return qApp->translate( "networksettings2", "Off");
253 case Available :
254 return qApp->translate( "networksettings2", "Available");
255 case IsUp :
256 return qApp->translate( "networksettings2", "IsUp");
257 case Unchecked : /* FT */
258 default :
259 break;
260 }
261 return QString("");
262}
263
264void NodeCollection::reassign( void ) {
265 for( QListIterator<ANetNodeInstance> it(*this);
266 it.current();
267 ++it ) {
268 it.current()->setConnection( this );
269 }
270}
271
272InterfaceInfo * RuntimeInfo::assignedInterface( void ) {
273 return netNode()->nextNode()->runtime()->assignedInterface();
274}
275
276AsDevice * RuntimeInfo::device( void ) {
277 return netNode()->nextNode()->runtime()->device();
278}
diff --git a/noncore/settings/networksettings2/networksettings2/netnode.h b/noncore/settings/networksettings2/networksettings2/netnode.h
new file mode 100644
index 0000000..0ecd64e
--- a/dev/null
+++ b/noncore/settings/networksettings2/networksettings2/netnode.h
@@ -0,0 +1,361 @@
1#ifndef NETNODE_H
2#define NETNODE_H
3
4#include <qtextstream.h>
5#include <qlist.h>
6#include <qpixmap.h>
7#include <qobject.h>
8#include <time.h>
9
10// difference feature interfaces
11class AsDevice;
12class AsLine;
13class AsConnection;
14class AsFullSetup;
15
16// needed for plugin creation function
17#include <qlist.h>
18
19class ANetNode;
20class ANetNodeInstance;
21class NodeCollection;
22class QTextStream;
23class RuntimeInfo;
24class InterfaceInfo;
25
26extern QString & deQuote( QString & X );
27extern QString quote( QString X );
28
29#include "systemfile.h"
30
31typedef enum State {
32 // if we have not yet detected the state of the device
33 Unchecked = 0,
34 // if we cannot determine the state
35 Unknown = 1,
36 // if connection cannot be established e.g. because
37 // the hardware is not available
38 Unavailable = 2,
39 // if the connection cannot be establishec but NOT
40 // because it is physically impossible but because
41 // it has been disabled for FUNCTIONAL reasons
42 Disabled = 3,
43 // if connection is available to is currently down
44 // i.e. the corresponding hardware is not activated
45 Off = 4,
46 // if connection is available to be used (i.e. the
47 // devices if fully ready to be used
48 Available = 5,
49 // if connection is being used
50 IsUp = 6
51} State_t;
52
53typedef enum Action {
54 // to make the device unavailable functionally
55 Disable = 0,
56 // to make the device available functionally
57 Enable = 1,
58 // bring the hardware up
59 Activate = 2,
60 // bring the hardware down
61 Deactivate = 3,
62 // bring the connection up
63 Up = 4,
64 // bring the connection down
65 Down = 5
66} Action_t;
67
68class ANetNode : public QObject{
69
70public:
71
72 typedef QArray<ANetNode *> NetNodeList;
73
74 ANetNode(){};
75 virtual ~ANetNode(){};
76
77 // pixmap needed for this NetNode
78 virtual const QString pixmapName() = 0;
79
80 // name of this NetNode
81 virtual const QString nodeName() = 0;
82
83 // description for this NetNode
84 virtual const QString nodeDescription() = 0;
85
86 // create a blank instance of a net node
87 virtual ANetNodeInstance * createInstance( void ) = 0;
88
89 // return feature this NetNode provides
90 virtual const char * provides( void ) = 0;
91 virtual const char ** needs( void ) = 0;
92
93 // generate files specific for this node (if any)
94 virtual bool generateProperFilesFor( ANetNodeInstance * NNI ) = 0;
95 // return TRUE if this node has data to be inserted in systemfile
96 // with name S
97 virtual bool hasDataFor( const QString & S ) = 0;
98 // generate data specific for the system file S
99 // called only IF data was needed
100 virtual bool generateDataForCommonFile(
101 SystemFile & SF, long DevNr, ANetNodeInstance * NNI ) = 0;
102
103 // does this Node provide a Connection
104 bool isToplevel( void )
105 { return strcmp( provides(), "fullsetup") == 0 ; }
106
107 // compiled references to 'needed' NetNodes -> needs list
108 void setAlternatives( NetNodeList * Alt )
109 { Alternatives = Alt; }
110 NetNodeList & alternatives( void )
111 { return *Alternatives; }
112
113protected :
114
115 NetNodeList * Alternatives;
116
117private :
118};
119
120class ANetNodeInstance : public QObject {
121
122public:
123
124 ANetNodeInstance( ANetNode * NN ) : QObject()
125 { IsModified=0; NodeType = NN; IsNew = TRUE; }
126 virtual ~ANetNodeInstance( void ) { }
127
128 virtual RuntimeInfo * runtime( void ) = 0;
129
130 void setConnection( NodeCollection * NC )
131 { Connection = NC; }
132 NodeCollection * connection( void )
133 { return Connection; }
134
135 // create edit widget under parent
136 virtual QWidget * edit( QWidget * parent ) = 0;
137 // is given data acceptable
138 virtual QString acceptable( void ) = 0;
139
140 // return data was modified
141 void setModified( bool M )
142 { IsModified = M; }
143 bool isModified( void )
144 { return IsModified; }
145
146 // get data from GUI and store in node
147 virtual void commit( void ) = 0;
148
149 // get next node
150 ANetNodeInstance * nextNode();
151 // return NetNode this is an instance of
152 ANetNode * netNode( void )
153 { return NodeType; }
154
155 // intialize am instance of a net node
156 void initialize( void );
157
158 // set the value of an attribute
159 void setAttribute( QString & Attr, QString & Value ) ;
160 void saveAttributes( QTextStream & TS ) ;
161
162 // return true if node isntance is NEW and not loaded
163 void setNew( bool IsN )
164 { IsNew = IsN; }
165 bool isNew( void )
166 { return IsNew; }
167
168 // return logical name of this instance
169 QString & nodeName( void )
170 { return NodeName; }
171 void setNodeName( const QString & S )
172 { NodeName = S; }
173 // return description for this instance
174 QString & description( void )
175 { return Description; }
176 void setDescription( const QString & S )
177 { Description = S; }
178
179 // pixmap for this instance -> from NetNode
180 const QString pixmapName( void )
181 { return NodeType->pixmapName(); }
182
183 const char * provides( void )
184 { return NodeType->provides(); }
185
186 const char ** needs( void )
187 { return NodeType->needs(); }
188
189 // returns node specific data -> only useful for 'buddy'
190 virtual void * data( void ) = 0;
191
192protected :
193
194 virtual void setSpecificAttribute( QString & , QString & ) = 0;
195 virtual void saveSpecificAttribute( QTextStream & ) = 0;
196
197 ANetNode * NodeType;
198 // connection to which this node belongs to
199 NodeCollection * Connection;
200 QString NodeName;
201 QString Description;
202 bool IsModified;
203 bool IsNew;
204
205 static long InstanceCounter;
206};
207
208class RuntimeInfo : public QObject {
209
210 Q_OBJECT
211
212public :
213
214 RuntimeInfo( ANetNodeInstance * TheNNI )
215 { NNI = TheNNI; }
216
217 // downcast
218 AsDevice * asDevice( void )
219 { return (AsDevice *)this; }
220 AsConnection * asConnection( void )
221 { return (AsConnection *)this; }
222 AsLine * asLine( void )
223 { return (AsLine *)this; }
224 AsFullSetup * asFullSetup( void )
225 { return (AsFullSetup *)this; }
226
227 // does this node handles this interface e.g.eth0
228 // recurse deeper if this node cannot answer that question
229 virtual bool handlesInterface( const QString & )
230 { return 0; }
231 virtual InterfaceInfo * assignedInterface( void );
232 virtual AsDevice * device( void );
233
234 ANetNodeInstance * netNode()
235 { return NNI; }
236 NodeCollection * connection()
237 { return NNI->connection(); }
238
239 virtual void detectState( NodeCollection * NC ) = 0;
240 virtual bool setState( NodeCollection * NC, Action_t A ) = 0;
241 virtual bool canSetState( State_t Curr, Action_t A ) = 0;
242
243signals :
244
245 // sent by device if state changes
246 void stateChanged( State_t S, ANetNodeInstance * NNI );
247
248protected :
249
250 // connection this runtime info belongs to
251 ANetNodeInstance * NNI;
252};
253
254class NodeCollection : public QList<ANetNodeInstance> {
255
256public :
257
258 NodeCollection( void );
259 NodeCollection( QTextStream & TS );
260 ~NodeCollection( void );
261
262 int number( void )
263 { return Number; }
264 void setNumber( int i )
265 { Number = i; if( MaxNr < i ) MaxNr = i; }
266 bool isNew( void )
267 { return IsNew; }
268 void setNew( bool N )
269 { IsNew = N ; }
270 bool isModified( void )
271 { return IsModified; }
272 void setModified( bool N )
273 { IsModified = N ; }
274
275 bool handlesInterface( const QString & S ) {
276 return getToplevel()->runtime()->handlesInterface( S );
277 }
278
279 InterfaceInfo * assignedInterface( void ) {
280 return getToplevel()->runtime()->assignedInterface();
281 }
282
283 AsDevice * device() {
284 return getToplevel()->runtime()->device();
285 }
286
287 State_t state( bool Update = 0 )
288 { if( CurrentState == Unchecked || Update ) {
289 // need to get current state
290 getToplevel()->runtime()->detectState( this );
291 }
292 return CurrentState;
293 }
294
295 // get the ixmap for this device
296 QPixmap devicePixmap( void );
297 QPixmap statePixmap( State_t S );
298 QPixmap statePixmap( bool Update = 0 )
299 { return statePixmap( state(Update) ); }
300 QString stateName( State_t );
301 QString stateName( bool Update = 0 )
302 { return stateName( state(Update) ); }
303
304 bool setState( Action_t A )
305 { return getToplevel()->runtime()->setState( this, A ); }
306 bool canSetState( Action_t A )
307 { return getToplevel()->runtime()->canSetState( CurrentState, A ); }
308
309 void save( QTextStream & TS );
310
311 void append( ANetNodeInstance * NNI );
312
313 // makes sure that all items in the connection point to
314 // that connectoin
315 void reassign( void );
316
317 ANetNodeInstance * getToplevel( void );
318 ANetNodeInstance * findNext( ANetNodeInstance * NNI );
319 ANetNodeInstance * findByName( const QString & S );
320
321 const QString & name()
322 { return Name; }
323
324 const QString & description( void );
325
326 void setName( const QString & N)
327 { Name = N; }
328
329 State_t currentState( void )
330 { return CurrentState; }
331 void setCurrentState( State_t S )
332 { CurrentState = S; }
333
334 long maxConnectionNumber( void )
335 { return MaxNr; }
336
337 static void resetMaxNr( void )
338 { MaxNr = -1; }
339
340private :
341
342 int compareItems ( QCollection::Item item1,
343 QCollection::Item item2 );
344
345 static long MaxNr;
346 long Number;
347
348 // state of this connection
349 State_t CurrentState;
350
351 QString Name;
352 // true if this collection was just created (and not
353 // loaded from file
354 bool IsNew;
355 // index in listbox
356 int Index;
357 bool IsModified;
358
359};
360
361#endif
diff --git a/noncore/settings/networksettings2/networksettings2/networksettings2.pro b/noncore/settings/networksettings2/networksettings2/networksettings2.pro
new file mode 100644
index 0000000..c9945ff
--- a/dev/null
+++ b/noncore/settings/networksettings2/networksettings2/networksettings2.pro
@@ -0,0 +1,26 @@
1TEMPLATE = lib
2CONFIG += qt warn_on release
3 #CONFIG += qt warn_on debug
4 DESTDIR = $(OPIEDIR)/lib$(PROJMAK)
5 HEADERS = netnode.h \
6 resources.h \
7 system.h \
8 asline.h \
9 GUIUtils.h \
10 asconnection.h \
11 asfullsetup.h \
12 systemfile.h \
13 asdevice.h
14 SOURCES = netnode.cpp \
15 GUIUtils.cpp \
16 system.cpp \
17 systemfile.cpp \
18 resources.cpp
19 INCLUDEPATH+= $(OPIEDIR)/include ../networksettings2
20 DEPENDPATH+= $(OPIEDIR)/include
21LIBS += -lqpe -lopie
22 INTERFACES=
23 TARGET = networksettings2
24 VERSION = 1.0.0
25
26include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/networksettings2/networksettings2/resources.cpp b/noncore/settings/networksettings2/networksettings2/resources.cpp
new file mode 100644
index 0000000..ff6e457
--- a/dev/null
+++ b/noncore/settings/networksettings2/networksettings2/resources.cpp
@@ -0,0 +1,236 @@
1#include <qpixmap.h>
2#include <qpe/qlibrary.h>
3#include <qpe/qpeapplication.h>
4#include <qdir.h>
5#include <qtopia/resource.h>
6
7#include "netnode.h"
8#include "resources.h"
9
10#define PLUGINDIR "plugins/networksettings2"
11#define ICONDIR "/pics/networksettings2/"
12
13// single resources instance
14TheNSResources * _NSResources = 0;
15
16TheNSResources::TheNSResources( void ) : NodeTypeNameMap(),
17 ConnectionsMap() {
18
19 _NSResources = this;
20
21 // load available netnodes
22 findAvailableNetNodes(QPEApplication::qpeDir() + PLUGINDIR );
23
24 // compile provides and needs lists
25 { const char ** NeedsRun;
26 QDictIterator<NetNode_t> OuterIt( AllNodeTypes );
27 bool Done;
28
29 for ( ; OuterIt.current(); ++OuterIt ) {
30 // find needs list
31 ANetNode::NetNodeList * NNLP = new ANetNode::NetNodeList;
32 ANetNode::NetNodeList & NNL = *(NNLP);
33
34 // must iterate this way to avoid duplication pointers
35 for ( QDictIterator<NetNode_t> InnerIt( AllNodeTypes );
36 InnerIt.current(); ++InnerIt ) {
37 if( InnerIt.current() == OuterIt.current() )
38 // avoid recursive
39 continue;
40
41 const char * Provides = InnerIt.current()->NetNode->provides();
42 NeedsRun = OuterIt.current()->NetNode->needs();
43 for( ; *NeedsRun; NeedsRun ++ ) {
44 if( strcmp( Provides, *NeedsRun ) == 0 ) {
45 // inner provides what outer needs
46 NNL.resize( NNL.size() + 1 );
47 NNL[NNL.size()-1] = InnerIt.current()->NetNode;
48 Done = 1; // break from 2 loops
49 break;
50 }
51 }
52 }
53 OuterIt.current()->NetNode->setAlternatives( NNLP );
54 }
55 }
56
57 // define Node types to Description map
58 NodeTypeNameMap.insert( "device", tr( "Network Device" ) );
59 NodeTypeNameMap.insert( "line", tr( "Character device" ) );
60 NodeTypeNameMap.insert( "connection", tr( "IP Connection" ) );
61 NodeTypeNameMap.insert( "fullsetup", tr( "Connection Profile" ) );
62
63 NodeTypeDescriptionMap.insert( "device",
64 tr( "<p>Devices that can handle IP packets</p>" ) );
65 NodeTypeDescriptionMap.insert( "line",
66 tr( "<p>Devices that can handle single bytes</p>" ) );
67 NodeTypeDescriptionMap.insert( "connection",
68 tr( "<p>Nodes that provide working IP connections</p>" ) );
69 NodeTypeDescriptionMap.insert( "fullsetup",
70 tr( "<p>Fully configured connection profile</p>" ) );
71
72 // define system files
73 addSystemFile( new SystemFile( "interfaces", "./interfaces" ) );
74
75 // get access to the system
76 TheSystem = new System();
77}
78
79TheNSResources::~TheNSResources( void ) {
80 delete TheSystem;
81}
82
83/**
84 * Load all modules that are found in the path
85 * @param path a directory that is scaned for any plugins that can be loaded
86 * and attempts to load them
87 */
88void TheNSResources::findAvailableNetNodes(const QString &path){
89
90 QDir d(path);
91 if(!d.exists())
92 return;
93
94 QString lang = ::getenv("LANG");
95
96 // Don't want sym links
97 d.setFilter( QDir::Files | QDir::NoSymLinks );
98 const QFileInfoList *list = d.entryInfoList();
99 QFileInfoListIterator it( *list );
100 QFileInfo *fi;
101
102 while ( (fi=it.current()) ) {
103
104 if( fi->fileName().contains(".so")){
105 /* if loaded install translation */
106 if( loadNetNode(path + "/" + fi->fileName()) ) {
107 QTranslator *trans = new QTranslator(qApp);
108 QString fn = QPEApplication::qpeDir()+
109 "/i18n/"+lang+"/"+
110 fi->fileName().left( fi->fileName().find(".") )+
111 ".qm";
112
113 if( trans->load( fn ) )
114 qApp->installTranslator( trans );
115 else
116 delete trans;
117 }
118 }
119 ++it;
120 }
121}
122
123/**
124 * Attempt to load a function and resolve a function.
125 * @param pluginFileName - the name of the file in which to attempt to load
126 * @param resolveString - function pointer to resolve
127 * @return true of loading is successful
128 */
129bool TheNSResources::loadNetNode(
130 const QString &pluginFileName, const QString &resolveString){
131
132 QLibrary *lib = new QLibrary(pluginFileName);
133 void * res = lib->resolve(resolveString);
134 if( ! res ){
135#ifdef DEBUG
136 qDebug("loadNetNode: Warning: %s is not a plugin", pluginFileName.latin1());
137#endif
138 delete lib;
139 return 0;
140 }
141
142 GetNetNodeListFt_t getNetNodeList = (GetNetNodeListFt_t)res;
143
144 // Try to get an object.
145 QList<ANetNode> PNN;
146
147 getNetNodeList( PNN );
148 if( PNN.isEmpty() ) {
149#ifdef DEBUG
150 qDebug("loadNetNode: Couldn't get node list, but did load library!");
151#endif
152 delete lib;
153 return 0;
154 }
155
156 ANetNode * NNP;
157 for( QListIterator<ANetNode> it(PNN);
158 it.current();
159 ++it ) {
160 NetNode_t * NN;
161
162 NNP = it.current();
163 NN = new NetNode_t;
164 NN->NetNode = NNP;
165 NN->TheLibrary = lib;
166 NN->NodeCountInLib = PNN.count();
167
168 // store mapping
169 AllNodeTypes.insert( NN->NetNode->nodeName(), NN );
170 }
171
172 return 1;
173}
174
175QPixmap TheNSResources::getPixmap( const QString & QS ) {
176 return Resource::loadPixmap( QString("networksettings2")+QS );
177}
178
179QString TheNSResources::tr( const char * s ) {
180 return qApp->translate( "resource", s );
181}
182
183const QString & TheNSResources::netNode2Name( const char * s ) {
184 return NodeTypeNameMap[s];
185}
186
187const QString & TheNSResources::netNode2Description( const char * s ) {
188 return NodeTypeDescriptionMap[s];
189}
190
191void TheNSResources::addConnection( NodeCollection * NC ) {
192 ANetNodeInstance * NNI;
193 ConnectionsMap.insert( NC->name(), NC );
194 // add (new) nodes to NodeList
195 for( QListIterator<ANetNodeInstance> it(*NC);
196 it.current();
197 ++it ) {
198 NNI = it.current();
199 if( findNodeInstance( NNI->nodeName() ) == 0 ) {
200 // new item
201 addNodeInstance( NNI );
202 }
203 }
204}
205
206void TheNSResources::removeConnection( const QString & N ) {
207 NodeCollection * NC = findConnection( N );
208 if( ! NC )
209 return;
210
211 // delete netnodes in this connection
212 ANetNodeInstance * NNI;
213 for( NNI = NC->first(); NNI != 0; NNI = NC->next() ) {
214 removeNodeInstance( NNI->nodeName() );
215 }
216 ConnectionsMap.remove( N );
217}
218
219NodeCollection * TheNSResources::findConnection( const QString & S ) {
220 return ConnectionsMap[ S ];
221}
222
223void TheNSResources::renumberConnections( void ) {
224 Name2Connection_t & M = NSResources->connections();
225 NodeCollection * NC;
226
227 // for all connections
228 NodeCollection::resetMaxNr();
229 for( QDictIterator<NodeCollection> it(M);
230 it.current();
231 ++it ) {
232 NC = it.current();
233 NC->setNumber( NC->maxConnectionNumber()+1 );
234 NC->setModified( 1 );
235 }
236}
diff --git a/noncore/settings/networksettings2/networksettings2/resources.h b/noncore/settings/networksettings2/networksettings2/resources.h
new file mode 100644
index 0000000..cfa0b7a
--- a/dev/null
+++ b/noncore/settings/networksettings2/networksettings2/resources.h
@@ -0,0 +1,105 @@
1#ifndef __RESOURCES__H
2#define __RESOURCES__H
3
4#include <qstring.h>
5#include <qdict.h>
6#include <qmap.h>
7#include <qlist.h>
8#include "netnode.h"
9#include "systemfile.h"
10#include "system.h"
11
12class QLibrary;
13class QPixmap;
14class ANetNode;
15class ANetNodeInstance;
16
17typedef void (*GetNetNodeListFt_t)(QList<ANetNode>& PNN );
18
19typedef struct NetNode_S {
20 ANetNode * NetNode;
21 QLibrary * TheLibrary;
22 long NodeCountInLib;
23} NetNode_t;
24
25typedef QDict<NetNode_t> Name2NetNode_t;
26typedef QDict<ANetNodeInstance > Name2Instance_t;
27typedef QDict<NodeCollection> Name2Connection_t;
28typedef QDict<SystemFile> Name2SystemFile_t;
29
30class TheNSResources {
31
32public :
33
34 TheNSResources( void );
35 ~TheNSResources( );
36
37 System & system()
38 { return *TheSystem; }
39
40 QPixmap getPixmap( const QString & Name );
41
42 Name2NetNode_t & netNodes( void )
43 { return AllNodeTypes; }
44 bool netNodeExists( const QString & X )
45 { return AllNodeTypes.find(X)!=0; }
46
47 Name2SystemFile_t & systemFiles( void )
48 { return SystemFiles; }
49 void addSystemFile( SystemFile * SF )
50 { SystemFiles.insert( SF->name(), SF ); }
51
52 ANetNodeInstance * createNodeInstance( const QString & S )
53 { ANetNodeInstance * NNI = 0;
54 NetNode_t * NNT = AllNodeTypes[S];
55 if( NNT ) {
56 NNI = NNT->NetNode->createInstance();
57 NNI->initialize();
58 }
59 return NNI;
60 }
61
62 Name2Instance_t & netNodeInstances( void )
63 { return AllNodes; }
64 void addNodeInstance( ANetNodeInstance * I )
65 { AllNodes.insert( I->nodeName(), I ); }
66 void removeNodeInstance( const QString & N )
67 { AllNodes.remove( N );}
68 ANetNodeInstance * findNodeInstance( const QString & S )
69 { return (AllNodes.find(S)!=0) ? AllNodes[S] : 0; }
70
71 const QString & netNode2Name( const char * Type );
72 const QString & netNode2Description( const char * Type );
73
74 void renumberConnections( void );
75 void addConnection( NodeCollection * NC );
76 void removeConnection( const QString & N );
77 NodeCollection * findConnection( const QString & N );
78 Name2Connection_t & connections( void )
79 { return ConnectionsMap; }
80
81private :
82
83 QString tr( const char * path );
84 void findAvailableNetNodes( const QString &path );
85 bool loadNetNode(
86 const QString &pluginFileName,
87 const QString &resolveString = "create_plugin");
88
89 QMap< QString, QString> NodeTypeNameMap;
90 QMap< QString, QString> NodeTypeDescriptionMap;
91 Name2Connection_t ConnectionsMap;
92 System * TheSystem;
93 Name2SystemFile_t SystemFiles;
94
95 // all node type classes
96 Name2NetNode_t AllNodeTypes;
97
98 // all nodes
99 Name2Instance_t AllNodes;
100};
101
102extern TheNSResources * _NSResources;
103#define NSResources _NSResources
104
105#endif
diff --git a/noncore/settings/networksettings2/networksettings2/system.cpp b/noncore/settings/networksettings2/networksettings2/system.cpp
new file mode 100644
index 0000000..99f642e
--- a/dev/null
+++ b/noncore/settings/networksettings2/networksettings2/system.cpp
@@ -0,0 +1,318 @@
1#include <stdlib.h>
2#include <sys/types.h>
3#include <sys/wait.h>
4#include <qfile.h>
5#include <qtextstream.h>
6#include <net/if.h>
7#include <net/if_arp.h>
8#include <netinet/in.h>
9#include <arpa/inet.h>
10#include <sys/ioctl.h>
11#include <sys/socket.h>
12
13#include "resources.h"
14#include "system.h"
15
16#define PROCNETDEV "/proc/net/dev"
17
18static char Dig2Hex[] = {
19 '0', '1', '2', '3',
20 '4', '5', '6', '7',
21 '8', '9', 'A', 'B',
22 'C', 'D', 'E', 'F'
23};
24
25// get HIGH nibble of byte
26#define HN(x) Dig2Hex[(((x)&0xf0)>>4)]
27// get LOW nibble of byte
28#define LN(x) Dig2Hex[((x)&0x0f)]
29
30System::System( void ) : ProbedInterfaces() {
31 probeInterfaces();
32}
33
34System::~System( void ) {
35 if( ProcDevNet )
36 delete ProcDevNet;
37}
38
39int System::execute( const QString & S ) {
40 QString MyS = S;
41 int rv;
42
43 if( S.isEmpty() ) {
44 // loophole to start shell
45 return 8888;
46 }
47 if( getenv("USER") != "root" ) {
48 // use SUDO
49 MyS.prepend( "sudo " );
50 }
51
52 fprintf( stderr, "Executing %s\n", MyS.latin1() );
53
54 rv = system( MyS.latin1() ) ;
55 switch( rv ) {
56 case -1 :
57 // cannot fork
58 return 1;
59 case 127 :
60 // cannot start shell
61 return 2;
62 default :
63 if( WEXITSTATUS(rv) != 0 ) {
64 // error in command
65 return 3;
66 }
67 }
68 // all is fine
69 return 0;
70}
71
72void System::refreshStatistics( InterfaceInfo & I ) {
73 if( ! ProcDevNet ) {
74 return;
75 }
76 // cannot seek on dev
77 ProcDevNet->close();
78 ProcDevNet->open( IO_ReadOnly );
79
80 QString line;
81 QTextStream procTs(ProcDevNet);
82 QStringList SL;
83 int loc = -1;
84 int version;
85
86 procTs.readLine();
87 line = procTs.readLine();
88 // get version
89 if( line.find("compressed") )
90 version = 3;
91 else if( line.find( "bytes" ) )
92 version = 2;
93 else
94 version = 1;
95 while((line = procTs.readLine().simplifyWhiteSpace()) != QString::null) {
96 if( (loc = line.find(":") ) == -1) {
97 continue;
98 }
99
100 if( I.Name != line.left(loc) )
101 continue;
102
103 // tokenize
104 SL = QStringList::split( ' ', line, FALSE );
105
106 // update data
107 switch( version ) {
108 case 1 :
109 I.RcvBytes = SL[1];
110 I.RcvErrors = SL[3];
111 I.RcvDropped = SL[4];
112 I.SndBytes = SL[6];
113 I.SndErrors = SL[8];
114 I.SndDropped = SL[9];
115 I.Collisions = SL[11];
116 break;
117 case 2 :
118 I.RcvBytes = SL[1];
119 I.RcvErrors = SL[3];
120 I.RcvDropped = SL[4];
121 I.SndBytes = SL[7];
122 I.SndErrors = SL[9];
123 I.SndDropped = SL[10];
124 I.Collisions = SL[12];
125 break;
126 case 3 :
127 I.RcvBytes = SL[1];
128 I.RcvErrors = SL[3];
129 I.RcvDropped = SL[4];
130 I.SndBytes = SL[9];
131 I.SndErrors = SL[11];
132 I.SndDropped = SL[12];
133 I.Collisions = SL[14];
134 break;
135 }
136 break;
137 }
138}
139
140//
141// THIS UPDATES THE LIST -> INTERFACES ARE NOT DELETED BUT
142// FLAGGED AS ! 'IsUp' IF NO LONGER PRESENT
143//
144
145void System::probeInterfaces( void ) {
146
147 // probe interfaces
148 int sockfd;
149 // get list of all interfaces
150 struct ifreq ifrs;
151 InterfaceInfo * IFI;
152
153 // flag all as 'down'
154 for( QDictIterator<InterfaceInfo> it( ProbedInterfaces );
155 it.current();
156 ++it ) {
157 it.current()->IsUp = 0;
158 }
159
160 sockfd = socket(PF_INET, SOCK_DGRAM, 0);
161 if(sockfd == -1)
162 return;
163
164 // read interfaces from /proc/dev/net
165 // SIOCGIFCONF does not return ALL interfaces ???!?
166 ProcDevNet = new QFile(PROCNETDEV);
167 if( ! ProcDevNet->open(IO_ReadOnly) ) {
168 delete ProcDevNet;
169 ProcDevNet =0;
170 return;
171 }
172
173 QString line;
174 QString NicName;
175 QTextStream procTs(ProcDevNet);
176 int loc = -1;
177
178 procTs.readLine(); // eat a line
179 procTs.readLine(); // eat a line
180 while((line = procTs.readLine().simplifyWhiteSpace()) != QString::null) {
181 if((loc = line.find(":")) == -1) {
182 continue;
183 }
184
185 NicName = line.left(loc);
186
187 // set name for ioctl
188 strcpy( ifrs.ifr_name, NicName.latin1() );
189
190 if ( ! ( IFI = ProbedInterfaces.find( NicName ) ) ) {
191 // new nic
192 fprintf( stderr, "NEWNIC %s\n", NicName.latin1());
193 IFI = new InterfaceInfo;
194 IFI->Name = line.left(loc);
195 IFI->NetNode = 0;
196 ProbedInterfaces.insert( IFI->Name, IFI );
197
198 // get dynamic info
199 if( ioctl(sockfd, SIOCGIFFLAGS, &ifrs) >= 0 ) {
200 IFI->IsPointToPoint = ((ifrs.ifr_flags & IFF_POINTOPOINT) == IFF_POINTOPOINT);
201 } else {
202 IFI->IsPointToPoint = 0;
203 }
204
205 // settings that never change
206 IFI->DstAddress = "";
207
208 if( IFI->IsPointToPoint ) {
209 if( ioctl(sockfd, SIOCGIFDSTADDR, &ifrs) >= 0 ) {
210 IFI->DstAddress =
211 inet_ntoa(((struct sockaddr_in*)&ifrs.ifr_dstaddr)->sin_addr);
212 }
213 }
214
215 IFI->CardType = 999999;
216 IFI->MACAddress = "";
217
218 if( ioctl(sockfd, SIOCGIFHWADDR, &ifrs) >= 0 ) {
219 fprintf( stderr, "%s = %d\n", IFI->Name.latin1(),
220 ifrs.ifr_hwaddr.sa_family );
221
222 IFI->CardType = ifrs.ifr_hwaddr.sa_family;
223 switch( ifrs.ifr_hwaddr.sa_family ) {
224 case ARPHRD_ETHER : // regular MAC address
225 // valid address -> convert to regular ::: format
226 // length = 6 bytes = 12 DIGITS -> 6 :
227 IFI->MACAddress.sprintf(
228 "%c%c:%c%c:%c%c:%c%c:%c%c:%c%c",
229 HN( ifrs.ifr_hwaddr.sa_data[0] ),
230 LN( ifrs.ifr_hwaddr.sa_data[0] ),
231 HN( ifrs.ifr_hwaddr.sa_data[1] ),
232 LN( ifrs.ifr_hwaddr.sa_data[1] ),
233 HN( ifrs.ifr_hwaddr.sa_data[2] ),
234 LN( ifrs.ifr_hwaddr.sa_data[2] ),
235 HN( ifrs.ifr_hwaddr.sa_data[3] ),
236 LN( ifrs.ifr_hwaddr.sa_data[3] ),
237 HN( ifrs.ifr_hwaddr.sa_data[4] ),
238 LN( ifrs.ifr_hwaddr.sa_data[4] ),
239 HN( ifrs.ifr_hwaddr.sa_data[5] ),
240 LN( ifrs.ifr_hwaddr.sa_data[5] )
241 );
242 break;
243#ifdef ARPHRD_IEEE1394
244 case ARPHRD_IEEE1394 : // Firewire Eth address
245 IFI->MACAddress.sprintf(
246 "%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-00-00",
247 HN( ifrs.ifr_hwaddr.sa_data[0] ),
248 LN( ifrs.ifr_hwaddr.sa_data[0] ),
249 HN( ifrs.ifr_hwaddr.sa_data[1] ),
250 LN( ifrs.ifr_hwaddr.sa_data[1] ),
251 HN( ifrs.ifr_hwaddr.sa_data[2] ),
252 LN( ifrs.ifr_hwaddr.sa_data[2] ),
253 HN( ifrs.ifr_hwaddr.sa_data[3] ),
254 LN( ifrs.ifr_hwaddr.sa_data[3] ),
255 HN( ifrs.ifr_hwaddr.sa_data[4] ),
256 LN( ifrs.ifr_hwaddr.sa_data[4] ),
257 HN( ifrs.ifr_hwaddr.sa_data[5] ),
258 LN( ifrs.ifr_hwaddr.sa_data[5] ),
259 HN( ifrs.ifr_hwaddr.sa_data[6] ),
260 LN( ifrs.ifr_hwaddr.sa_data[6] ),
261 HN( ifrs.ifr_hwaddr.sa_data[7] ),
262 LN( ifrs.ifr_hwaddr.sa_data[7] ),
263 HN( ifrs.ifr_hwaddr.sa_data[8] ),
264 LN( ifrs.ifr_hwaddr.sa_data[8] ),
265 HN( ifrs.ifr_hwaddr.sa_data[9] ),
266 LN( ifrs.ifr_hwaddr.sa_data[9] ),
267 HN( ifrs.ifr_hwaddr.sa_data[10] ),
268 LN( ifrs.ifr_hwaddr.sa_data[10] ),
269 HN( ifrs.ifr_hwaddr.sa_data[11] ),
270 LN( ifrs.ifr_hwaddr.sa_data[11] ),
271 HN( ifrs.ifr_hwaddr.sa_data[12] ),
272 LN( ifrs.ifr_hwaddr.sa_data[12] ),
273 HN( ifrs.ifr_hwaddr.sa_data[13] ),
274 LN( ifrs.ifr_hwaddr.sa_data[13] )
275 );
276 break;
277#endif
278 case ARPHRD_PPP : // PPP
279 break;
280 case ARPHRD_IEEE80211 : // WLAN
281 break;
282 case ARPHRD_IRDA : // IRDA
283 break;
284 }
285 }
286 } else // else already probed before -> just update
287 fprintf( stderr, "OLDNIC %s\n", NicName.latin1());
288
289 // get dynamic info
290 if( ioctl(sockfd, SIOCGIFFLAGS, &ifrs) >= 0 ) {
291 IFI->IsUp = ((ifrs.ifr_flags & IFF_UP) == IFF_UP);
292 IFI->HasMulticast = ((ifrs.ifr_flags & IFF_MULTICAST) == IFF_MULTICAST);
293 } else {
294 IFI->IsUp = 0;
295 IFI->HasMulticast = 0;
296 }
297
298 if( ioctl(sockfd, SIOCGIFADDR, &ifrs) >= 0 ) {
299 IFI->Address =
300 inet_ntoa(((struct sockaddr_in*)&ifrs.ifr_addr)->sin_addr);
301 } else {
302 IFI->Address = "";
303 IFI->IsUp = 0;
304 }
305 if( ioctl(sockfd, SIOCGIFBRDADDR, &ifrs) >= 0 ) {
306 IFI->BCastAddress =
307 inet_ntoa(((struct sockaddr_in*)&ifrs.ifr_broadaddr)->sin_addr);
308 } else {
309 IFI->BCastAddress = "";
310 }
311 if( ioctl(sockfd, SIOCGIFNETMASK, &ifrs) >= 0 ) {
312 IFI->Netmask =
313 inet_ntoa(((struct sockaddr_in*)&ifrs.ifr_netmask)->sin_addr);
314 } else {
315 IFI->Netmask = "";
316 }
317 }
318}
diff --git a/noncore/settings/networksettings2/networksettings2/system.h b/noncore/settings/networksettings2/networksettings2/system.h
new file mode 100644
index 0000000..f89fe5d
--- a/dev/null
+++ b/noncore/settings/networksettings2/networksettings2/system.h
@@ -0,0 +1,76 @@
1#ifndef __SYSTEM__H
2#define __SYSTEM__H
3
4// for hardware types
5#include <net/if_arp.h>
6#include <qdict.h>
7
8class ANetNodeInstance;
9class QFile;
10
11class InterfaceInfo {
12
13public :
14
15 InterfaceInfo() :
16 Name(),
17 MACAddress(),
18 BCastAddress(),
19 Netmask(),
20 DstAddress() {
21 }
22
23 ANetNodeInstance * assignedNode()
24 { return NetNode; }
25
26 void assignNode( ANetNodeInstance * NNI )
27 { NetNode = NNI; }
28
29 ANetNodeInstance * NetNode; // netnode taking care of me
30 QString Name; // name of interface
31 int CardType; // type of card
32 QString MACAddress; // MAC address
33 QString Address; // IP Address
34 QString BCastAddress; // Broadcast Address
35 QString Netmask; // Netmask
36 QString DstAddress; // Peer address (if P-t-P)
37 bool IsUp; // interface is UP
38 bool HasMulticast; // Supports Multicast
39 bool IsPointToPoint; // IsPointToPoint card
40
41 QString RcvBytes;
42 QString SndBytes;
43 QString RcvErrors;
44 QString SndErrors;
45 QString RcvDropped;
46 QString SndDropped;
47 QString Collisions;
48};
49
50class System {
51
52public :
53
54 System( void );
55 ~System( void );
56
57 QDict<InterfaceInfo> & interfaces( void )
58 { return ProbedInterfaces; }
59 InterfaceInfo * interface( const QString& N )
60 { return ProbedInterfaces[N]; }
61
62 int execute( const QString & S );
63 // refresh stats for this interface
64 void refreshStatistics( InterfaceInfo & );
65
66 // reloads interfaces
67 void probeInterfaces( void );
68
69private :
70
71 QDict<InterfaceInfo> ProbedInterfaces;
72 QFile * ProcDevNet;
73
74};
75
76#endif
diff --git a/noncore/settings/networksettings2/networksettings2/systemfile.cpp b/noncore/settings/networksettings2/networksettings2/systemfile.cpp
new file mode 100644
index 0000000..7249976
--- a/dev/null
+++ b/noncore/settings/networksettings2/networksettings2/systemfile.cpp
@@ -0,0 +1,144 @@
1#include <stdio.h>
2#include <qpe/qpeapplication.h>
3#include <qfileinfo.h>
4#include <qmessagebox.h>
5#include <qfile.h>
6#include <qtextstream.h>
7
8#include "resources.h"
9#include "systemfile.h"
10
11#define TEMPLATEDIR "networktemplates/"
12QString TemplDir;
13
14SystemFile::SystemFile( const QString & N, const QString & P ){
15 Name = N;
16 Path = P;
17 F = 0;
18 // get template info
19 { QString S;
20 QFileInfo FI;
21
22 // find location of templates
23 TemplDir = QPEApplication::qpeDir() + "etc/" + TEMPLATEDIR;
24 FI.setFile( TemplDir );
25 if( ! FI.isDir() ) {
26 // try current dir
27 TemplDir = "./" TEMPLATEDIR;
28 FI.setFile( TemplDir );
29 if( ! FI.isDir() ) {
30 hasPreSection =
31 hasPostSection =
32 hasPreNodeSection =
33 hasPostNodeSection = 0;
34 return;
35 }
36 }
37
38 // have found location
39 S = TemplDir + Name + "/presection";
40 FI.setFile( S );
41 hasPreSection = ( FI.exists() && FI.isReadable() );
42 S = TemplDir + Name + "/postsection";
43 FI.setFile( S );
44 hasPostSection = ( FI.exists() && FI.isReadable() );
45 S = TemplDir + Name + "/prenodesection";
46 FI.setFile( S );
47 hasPreNodeSection = ( FI.exists() && FI.isReadable() );
48 S = TemplDir + Name + "/postnodesection";
49 FI.setFile( S );
50 hasPostNodeSection = ( FI.exists() && FI.isReadable() );
51 }
52}
53
54SystemFile::~SystemFile( void ) {
55 if( F )
56 delete F;
57}
58
59bool SystemFile::open( void ) {
60 if( F ) {
61 F->close();
62 delete F;
63 }
64
65 F = new QFile( Path + "bup" );
66 if( ! F->open( IO_WriteOnly ) ) {
67 return 0;
68 }
69 setDevice( F );
70 return 1;
71}
72
73bool SystemFile::close( void ) {
74 if( ! F ) {
75 return 1 ;
76 }
77
78 QString OldP = Path + "bup";
79
80 F->close();
81 delete F;
82 F = 0;
83
84 return ( rename( OldP.latin1(), Path.latin1() ) >= 0 );
85}
86
87bool SystemFile::preSection( void ) {
88 if( hasPreSection ) {
89 QFile Fl( TemplDir + Name + "/presection" );
90 if( ! Fl.open( IO_ReadOnly ) )
91 return 1; // error
92 // copy file to this file
93 F->writeBlock( Fl.readAll() );
94 }
95 return 0;
96}
97
98bool SystemFile::postSection( void ) {
99 if( hasPostSection ) {
100 QFile Fl( TemplDir + Name + "/postsection" );
101 if( ! Fl.open( IO_ReadOnly ) )
102 return 1; // error
103 // copy file to this file
104 F->writeBlock( Fl.readAll() );
105 }
106 return 0;
107}
108
109bool SystemFile::preNodeSection( ANetNodeInstance * NNI, long ) {
110 if( hasPreNodeSection ) {
111 QFile Fl( TemplDir + Name + "/prenodesectoin" );
112 if( ! Fl.open( IO_ReadOnly ) )
113 return 1; // error
114 QTextStream TX( &Fl );
115 QString Out;
116 QString S = TX.readLine();
117 while( ! TX.eof() ) {
118 Out = S.
119 arg(NNI->netNode()->nodeName());
120 (*this) << Out << endl;
121 S = TX.readLine();
122 }
123 }
124 return 0;
125}
126
127bool SystemFile::postNodeSection( ANetNodeInstance * NNI, long DevNr ) {
128 if( hasPostNodeSection ) {
129 QFile Fl( TemplDir + Name + "/postnodesectoin" );
130 if( ! Fl.open( IO_ReadOnly ) )
131 return 1; // error
132 QTextStream TX( &Fl );
133 QString Out;
134 QString S = TX.readLine();
135 while( ! TX.eof() ) {
136 Out = S.
137 arg(NNI->nodeName());
138 (*this) << Out << endl;
139 S = TX.readLine();
140 }
141 }
142 return 0;
143}
144
diff --git a/noncore/settings/networksettings2/networksettings2/systemfile.h b/noncore/settings/networksettings2/networksettings2/systemfile.h
new file mode 100644
index 0000000..8b6bcb9
--- a/dev/null
+++ b/noncore/settings/networksettings2/networksettings2/systemfile.h
@@ -0,0 +1,39 @@
1#ifndef __SYSTEMFILE__H
2#define __SYSTEMFILE__H
3
4#include <qstring.h>
5#include <qtextstream.h>
6
7class QFile;
8class ANetNodeInstance;
9
10class SystemFile : public QTextStream {
11
12public :
13
14 SystemFile( const QString & Name, const QString & Path );
15 ~SystemFile( void );
16
17 const QString & name( void )
18 { return Name; }
19
20 bool open( void );
21 bool close( void );
22
23 bool preSection( void );
24 bool postSection( void );
25 bool preNodeSection( ANetNodeInstance * NNI, long DevNr );
26 bool postNodeSection( ANetNodeInstance * NNI, long DevNr );
27
28private :
29
30 QString Name;
31 QString Path;
32 QFile * F;
33 bool hasPreSection;
34 bool hasPreNodeSection;
35 bool hasPostSection;
36 bool hasPostNodeSection;
37
38};
39#endif
diff --git a/noncore/settings/networksettings2/networksettingsGUI.ui b/noncore/settings/networksettings2/networksettingsGUI.ui
new file mode 100644
index 0000000..d457c35
--- a/dev/null
+++ b/noncore/settings/networksettings2/networksettingsGUI.ui
@@ -0,0 +1,598 @@
1<!DOCTYPE UI><UI>
2<class>NetworkSettingsGUI</class>
3<widget>
4 <class>QWidget</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>NetworkSettingsGUI</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>403</width>
15 <height>502</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>Network Settings</string>
21 </property>
22 <property>
23 <name>layoutMargin</name>
24 </property>
25 <property>
26 <name>layoutSpacing</name>
27 </property>
28 <vbox>
29 <property stdset="1">
30 <name>margin</name>
31 <number>0</number>
32 </property>
33 <property stdset="1">
34 <name>spacing</name>
35 <number>2</number>
36 </property>
37 <widget>
38 <class>QFrame</class>
39 <property stdset="1">
40 <name>name</name>
41 <cstring>Frame4</cstring>
42 </property>
43 <property stdset="1">
44 <name>sizePolicy</name>
45 <sizepolicy>
46 <hsizetype>7</hsizetype>
47 <vsizetype>0</vsizetype>
48 </sizepolicy>
49 </property>
50 <property stdset="1">
51 <name>frameShape</name>
52 <enum>NoFrame</enum>
53 </property>
54 <property stdset="1">
55 <name>frameShadow</name>
56 <enum>Raised</enum>
57 </property>
58 <property>
59 <name>layoutMargin</name>
60 </property>
61 <property>
62 <name>layoutSpacing</name>
63 </property>
64 <hbox>
65 <property stdset="1">
66 <name>margin</name>
67 <number>0</number>
68 </property>
69 <property stdset="1">
70 <name>spacing</name>
71 <number>1</number>
72 </property>
73 <widget>
74 <class>QToolButton</class>
75 <property stdset="1">
76 <name>name</name>
77 <cstring>Add_TB</cstring>
78 </property>
79 <property stdset="1">
80 <name>sizePolicy</name>
81 <sizepolicy>
82 <hsizetype>0</hsizetype>
83 <vsizetype>0</vsizetype>
84 </sizepolicy>
85 </property>
86 <property stdset="1">
87 <name>text</name>
88 <string>...</string>
89 </property>
90 </widget>
91 <widget>
92 <class>QToolButton</class>
93 <property stdset="1">
94 <name>name</name>
95 <cstring>Delete_TB</cstring>
96 </property>
97 <property stdset="1">
98 <name>sizePolicy</name>
99 <sizepolicy>
100 <hsizetype>0</hsizetype>
101 <vsizetype>0</vsizetype>
102 </sizepolicy>
103 </property>
104 <property stdset="1">
105 <name>text</name>
106 <string>...</string>
107 </property>
108 </widget>
109 <widget>
110 <class>QToolButton</class>
111 <property stdset="1">
112 <name>name</name>
113 <cstring>CheckState_TB</cstring>
114 </property>
115 <property stdset="1">
116 <name>sizePolicy</name>
117 <sizepolicy>
118 <hsizetype>0</hsizetype>
119 <vsizetype>0</vsizetype>
120 </sizepolicy>
121 </property>
122 <property stdset="1">
123 <name>text</name>
124 <string>...</string>
125 </property>
126 </widget>
127 <widget>
128 <class>QToolButton</class>
129 <property stdset="1">
130 <name>name</name>
131 <cstring>GenConfig_TB</cstring>
132 </property>
133 <property stdset="1">
134 <name>sizePolicy</name>
135 <sizepolicy>
136 <hsizetype>0</hsizetype>
137 <vsizetype>0</vsizetype>
138 </sizepolicy>
139 </property>
140 <property stdset="1">
141 <name>text</name>
142 <string>...</string>
143 </property>
144 </widget>
145 <spacer>
146 <property>
147 <name>name</name>
148 <cstring>Spacer1</cstring>
149 </property>
150 <property stdset="1">
151 <name>orientation</name>
152 <enum>Horizontal</enum>
153 </property>
154 <property stdset="1">
155 <name>sizeType</name>
156 <enum>Expanding</enum>
157 </property>
158 <property>
159 <name>sizeHint</name>
160 <size>
161 <width>20</width>
162 <height>20</height>
163 </size>
164 </property>
165 </spacer>
166 <widget>
167 <class>QToolButton</class>
168 <property stdset="1">
169 <name>name</name>
170 <cstring>On_TB</cstring>
171 </property>
172 <property stdset="1">
173 <name>sizePolicy</name>
174 <sizepolicy>
175 <hsizetype>0</hsizetype>
176 <vsizetype>0</vsizetype>
177 </sizepolicy>
178 </property>
179 <property stdset="1">
180 <name>text</name>
181 <string>...</string>
182 </property>
183 <property stdset="1">
184 <name>toggleButton</name>
185 <bool>true</bool>
186 </property>
187 <property stdset="1">
188 <name>toggleButton</name>
189 <bool>true</bool>
190 </property>
191 </widget>
192 <widget>
193 <class>QToolButton</class>
194 <property stdset="1">
195 <name>name</name>
196 <cstring>Enable_TB</cstring>
197 </property>
198 <property stdset="1">
199 <name>sizePolicy</name>
200 <sizepolicy>
201 <hsizetype>0</hsizetype>
202 <vsizetype>0</vsizetype>
203 </sizepolicy>
204 </property>
205 <property stdset="1">
206 <name>text</name>
207 <string>...</string>
208 </property>
209 <property stdset="1">
210 <name>toggleButton</name>
211 <bool>true</bool>
212 </property>
213 <property stdset="1">
214 <name>toggleButton</name>
215 <bool>true</bool>
216 </property>
217 </widget>
218 <widget>
219 <class>QToolButton</class>
220 <property stdset="1">
221 <name>name</name>
222 <cstring>Connect_TB</cstring>
223 </property>
224 <property stdset="1">
225 <name>sizePolicy</name>
226 <sizepolicy>
227 <hsizetype>0</hsizetype>
228 <vsizetype>0</vsizetype>
229 </sizepolicy>
230 </property>
231 <property stdset="1">
232 <name>text</name>
233 <string>...</string>
234 </property>
235 <property stdset="1">
236 <name>toggleButton</name>
237 <bool>true</bool>
238 </property>
239 <property stdset="1">
240 <name>toggleButton</name>
241 <bool>true</bool>
242 </property>
243 </widget>
244 </hbox>
245 </widget>
246 <widget>
247 <class>QIconView</class>
248 <item>
249 <property>
250 <name>text</name>
251 <string>New Item</string>
252 </property>
253 <property>
254 <name>pixmap</name>
255 <pixmap>image0</pixmap>
256 </property>
257 </item>
258 <item>
259 <property>
260 <name>text</name>
261 <string>New Item</string>
262 </property>
263 <property>
264 <name>pixmap</name>
265 <pixmap>image0</pixmap>
266 </property>
267 </item>
268 <item>
269 <property>
270 <name>text</name>
271 <string>New Item</string>
272 </property>
273 <property>
274 <name>pixmap</name>
275 <pixmap>image0</pixmap>
276 </property>
277 </item>
278 <item>
279 <property>
280 <name>text</name>
281 <string>New Item</string>
282 </property>
283 <property>
284 <name>pixmap</name>
285 <pixmap>image0</pixmap>
286 </property>
287 </item>
288 <item>
289 <property>
290 <name>text</name>
291 <string>New Item</string>
292 </property>
293 <property>
294 <name>pixmap</name>
295 <pixmap>image0</pixmap>
296 </property>
297 </item>
298 <item>
299 <property>
300 <name>text</name>
301 <string>New Item</string>
302 </property>
303 <property>
304 <name>pixmap</name>
305 <pixmap>image0</pixmap>
306 </property>
307 </item>
308 <item>
309 <property>
310 <name>text</name>
311 <string>New Item</string>
312 </property>
313 <property>
314 <name>pixmap</name>
315 <pixmap>image0</pixmap>
316 </property>
317 </item>
318 <item>
319 <property>
320 <name>text</name>
321 <string>New Item</string>
322 </property>
323 <property>
324 <name>pixmap</name>
325 <pixmap>image0</pixmap>
326 </property>
327 </item>
328 <item>
329 <property>
330 <name>text</name>
331 <string>New Item</string>
332 </property>
333 <property>
334 <name>pixmap</name>
335 <pixmap>image0</pixmap>
336 </property>
337 </item>
338 <item>
339 <property>
340 <name>text</name>
341 <string>New Item</string>
342 </property>
343 <property>
344 <name>pixmap</name>
345 <pixmap>image0</pixmap>
346 </property>
347 </item>
348 <item>
349 <property>
350 <name>text</name>
351 <string>New Item</string>
352 </property>
353 <property>
354 <name>pixmap</name>
355 <pixmap>image0</pixmap>
356 </property>
357 </item>
358 <item>
359 <property>
360 <name>text</name>
361 <string>New Item</string>
362 </property>
363 <property>
364 <name>pixmap</name>
365 <pixmap>image0</pixmap>
366 </property>
367 </item>
368 <item>
369 <property>
370 <name>text</name>
371 <string>New Item</string>
372 </property>
373 <property>
374 <name>pixmap</name>
375 <pixmap>image0</pixmap>
376 </property>
377 </item>
378 <property stdset="1">
379 <name>name</name>
380 <cstring>Profiles_IV</cstring>
381 </property>
382 <property stdset="1">
383 <name>spacing</name>
384 <number>5</number>
385 </property>
386 <property stdset="1">
387 <name>itemsMovable</name>
388 <bool>false</bool>
389 </property>
390 <property stdset="1">
391 <name>showToolTips</name>
392 <bool>false</bool>
393 </property>
394 </widget>
395 <widget>
396 <class>QGroupBox</class>
397 <property stdset="1">
398 <name>name</name>
399 <cstring>CurProfile_GB</cstring>
400 </property>
401 <property stdset="1">
402 <name>title</name>
403 <string></string>
404 </property>
405 <property>
406 <name>layoutMargin</name>
407 </property>
408 <property>
409 <name>layoutSpacing</name>
410 </property>
411 <vbox>
412 <property stdset="1">
413 <name>margin</name>
414 <number>4</number>
415 </property>
416 <property stdset="1">
417 <name>spacing</name>
418 <number>1</number>
419 </property>
420 <widget>
421 <class>QLayoutWidget</class>
422 <property stdset="1">
423 <name>name</name>
424 <cstring>Layout3</cstring>
425 </property>
426 <hbox>
427 <property stdset="1">
428 <name>margin</name>
429 <number>0</number>
430 </property>
431 <property stdset="1">
432 <name>spacing</name>
433 <number>6</number>
434 </property>
435 <widget>
436 <class>QLabel</class>
437 <property stdset="1">
438 <name>name</name>
439 <cstring>TextLabel2</cstring>
440 </property>
441 <property stdset="1">
442 <name>text</name>
443 <string>State</string>
444 </property>
445 </widget>
446 <widget>
447 <class>QLabel</class>
448 <property stdset="1">
449 <name>name</name>
450 <cstring>State_LBL</cstring>
451 </property>
452 <property stdset="1">
453 <name>text</name>
454 <string>State</string>
455 </property>
456 <property stdset="1">
457 <name>indent</name>
458 <number>0</number>
459 </property>
460 </widget>
461 <spacer>
462 <property>
463 <name>name</name>
464 <cstring>Spacer6</cstring>
465 </property>
466 <property stdset="1">
467 <name>orientation</name>
468 <enum>Horizontal</enum>
469 </property>
470 <property stdset="1">
471 <name>sizeType</name>
472 <enum>Expanding</enum>
473 </property>
474 <property>
475 <name>sizeHint</name>
476 <size>
477 <width>20</width>
478 <height>20</height>
479 </size>
480 </property>
481 </spacer>
482 </hbox>
483 </widget>
484 <widget>
485 <class>QLabel</class>
486 <property stdset="1">
487 <name>name</name>
488 <cstring>Description_LBL</cstring>
489 </property>
490 <property stdset="1">
491 <name>sizePolicy</name>
492 <sizepolicy>
493 <hsizetype>5</hsizetype>
494 <vsizetype>7</vsizetype>
495 </sizepolicy>
496 </property>
497 <property stdset="1">
498 <name>frameShape</name>
499 <enum>NoFrame</enum>
500 </property>
501 <property stdset="1">
502 <name>frameShadow</name>
503 <enum>Raised</enum>
504 </property>
505 <property stdset="1">
506 <name>text</name>
507 <string></string>
508 </property>
509 <property stdset="1">
510 <name>alignment</name>
511 <set>AlignTop|AlignLeft</set>
512 </property>
513 <property>
514 <name>vAlign</name>
515 </property>
516 </widget>
517 </vbox>
518 </widget>
519 </vbox>
520</widget>
521<images>
522 <image>
523 <name>image0</name>
524 <data format="XPM.GZ" length="1347">789c7dd3c14ac4301405d07dbf22f4ed8a743ace0882f8098a4b415ca4c92475310a3a2e44fc777393a64df2dabed7452e1c6eb368778d787e7a10cdaefabac8cb9b126a909fa2d1dfe7f3cfcbebfd6f551fae857bf69dd8d75755dd0a251e3fde4f38933b53e707b10f518df18478e8b08803e271c21af1e6168b681165e7f688681055874594211a13a242347efc95da9688dad58946ca75e58d6be9e5ba0a46e92d351a952aa2d3b2495459989849f949546632b5688c32c65aeadde428ed0132da23306e4c5863f1ba017042738f6fc138a5fdbd0a135b2203ec7bca7b723022e23d19628601cb0d6f59e8612dce0c2b2641658fb5650b375a0795a2c2b8afcaaba4859ba852c4cda4364da9964daed64caa60c2475d9a590503c54d54d1d0a2096abb67541bf79955fc0debbfbbea1f81b84f0e</data>
525 </image>
526</images>
527<connections>
528 <connection>
529 <sender>Add_TB</sender>
530 <signal>clicked()</signal>
531 <receiver>NetworkSettingsGUI</receiver>
532 <slot>SLOT_AddNode()</slot>
533 </connection>
534 <connection>
535 <sender>Delete_TB</sender>
536 <signal>clicked()</signal>
537 <receiver>NetworkSettingsGUI</receiver>
538 <slot>SLOT_DeleteNode()</slot>
539 </connection>
540 <connection>
541 <sender>CheckState_TB</sender>
542 <signal>clicked()</signal>
543 <receiver>NetworkSettingsGUI</receiver>
544 <slot>SLOT_CheckState()</slot>
545 </connection>
546 <connection>
547 <sender>Enable_TB</sender>
548 <signal>clicked()</signal>
549 <receiver>NetworkSettingsGUI</receiver>
550 <slot>SLOT_Enable()</slot>
551 </connection>
552 <connection>
553 <sender>Connect_TB</sender>
554 <signal>clicked()</signal>
555 <receiver>NetworkSettingsGUI</receiver>
556 <slot>SLOT_Connect()</slot>
557 </connection>
558 <connection>
559 <sender>On_TB</sender>
560 <signal>clicked()</signal>
561 <receiver>NetworkSettingsGUI</receiver>
562 <slot>SLOT_On()</slot>
563 </connection>
564 <connection>
565 <sender>GenConfig_TB</sender>
566 <signal>clicked()</signal>
567 <receiver>NetworkSettingsGUI</receiver>
568 <slot>SLOT_GenerateConfig()</slot>
569 </connection>
570 <connection>
571 <sender>Profiles_IV</sender>
572 <signal>selectionChanged(QIconViewItem*)</signal>
573 <receiver>NetworkSettingsGUI</receiver>
574 <slot>SLOT_ShowNode( QIconViewItem*)</slot>
575 </connection>
576 <connection>
577 <sender>Profiles_IV</sender>
578 <signal>doubleClicked(QIconViewItem*)</signal>
579 <receiver>NetworkSettingsGUI</receiver>
580 <slot>SLOT_EditNode( QIconViewItem*)</slot>
581 </connection>
582 <connection>
583 <sender>Profiles_IV</sender>
584 <signal>currentChanged(QIconViewItem*)</signal>
585 <receiver>NetworkSettingsGUI</receiver>
586 <slot>SLOT_ShowNode( QIconViewItem*)</slot>
587 </connection>
588 <slot access="public">SLOT_AddNode()</slot>
589 <slot access="public">SLOT_CheckState()</slot>
590 <slot access="public">SLOT_Connect()</slot>
591 <slot access="public">SLOT_DeleteNode()</slot>
592 <slot access="public">SLOT_EditNode( QIconViewItem*)</slot>
593 <slot access="public">SLOT_Enable()</slot>
594 <slot access="public">SLOT_GenerateConfig()</slot>
595 <slot access="public">SLOT_On()</slot>
596 <slot access="public">SLOT_ShowNode( QIconViewItem*)</slot>
597</connections>
598</UI>
diff --git a/noncore/settings/networksettings2/networktemplates/interfaces/presection b/noncore/settings/networksettings2/networktemplates/interfaces/presection
new file mode 100644
index 0000000..1fe8396
--- a/dev/null
+++ b/noncore/settings/networksettings2/networktemplates/interfaces/presection
@@ -0,0 +1,5 @@
1auto lo
2
3# The loopback interface
4iface lo inet loopback
5
diff --git a/noncore/settings/networksettings2/opie-networksettings.control b/noncore/settings/networksettings2/opie-networksettings.control
new file mode 100644
index 0000000..82aac2a
--- a/dev/null
+++ b/noncore/settings/networksettings2/opie-networksettings.control
@@ -0,0 +1,10 @@
1Package: opie-networksettings
2Files: plugins/application/libnetworksettings.so* bin/networksettings apps/Settings/networksettings.desktop pics/networksettings/* pics/Network/PPPConnect.png $OPIEDIR/lib/libinterfaces.so* root/usr/bin/changedns bin/getprofile
3Priority: optional
4Section: opie/settings
5Maintainer: Patrick S. Vogt <tille@handhelds.org>
6Architecture: arm
7Depends: task-opie-minimal
8Description: Network settings.
9Replaces: opie-networksetup
10Version: $QPE_VERSION$EXTRAVERSION
diff --git a/noncore/settings/networksettings2/ppp/PPPAuthGUI.ui b/noncore/settings/networksettings2/ppp/PPPAuthGUI.ui
new file mode 100644
index 0000000..826843a
--- a/dev/null
+++ b/noncore/settings/networksettings2/ppp/PPPAuthGUI.ui
@@ -0,0 +1,432 @@
1<!DOCTYPE UI><UI>
2<class>PPPAuthGUI</class>
3<widget>
4 <class>QWidget</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>PPPAuthGUI</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>249</width>
15 <height>209</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>PPPAuth</string>
21 </property>
22 <property>
23 <name>layoutMargin</name>
24 </property>
25 <property>
26 <name>layoutSpacing</name>
27 </property>
28 <vbox>
29 <property stdset="1">
30 <name>margin</name>
31 <number>0</number>
32 </property>
33 <property stdset="1">
34 <name>spacing</name>
35 <number>0</number>
36 </property>
37 <widget>
38 <class>QButtonGroup</class>
39 <property stdset="1">
40 <name>name</name>
41 <cstring>ButtonGroup1</cstring>
42 </property>
43 <property stdset="1">
44 <name>frameShape</name>
45 <enum>NoFrame</enum>
46 </property>
47 <property stdset="1">
48 <name>title</name>
49 <string></string>
50 </property>
51 <property>
52 <name>layoutMargin</name>
53 </property>
54 <property>
55 <name>layoutSpacing</name>
56 </property>
57 <vbox>
58 <property stdset="1">
59 <name>margin</name>
60 <number>0</number>
61 </property>
62 <property stdset="1">
63 <name>spacing</name>
64 <number>0</number>
65 </property>
66 <widget>
67 <class>QRadioButton</class>
68 <property stdset="1">
69 <name>name</name>
70 <cstring>Login_RB</cstring>
71 </property>
72 <property stdset="1">
73 <name>text</name>
74 <string>Login</string>
75 </property>
76 <property stdset="1">
77 <name>checked</name>
78 <bool>true</bool>
79 </property>
80 </widget>
81 <widget>
82 <class>QLayoutWidget</class>
83 <property stdset="1">
84 <name>name</name>
85 <cstring>Layout3</cstring>
86 </property>
87 <hbox>
88 <property stdset="1">
89 <name>margin</name>
90 <number>0</number>
91 </property>
92 <property stdset="1">
93 <name>spacing</name>
94 <number>6</number>
95 </property>
96 <spacer>
97 <property>
98 <name>name</name>
99 <cstring>Spacer3</cstring>
100 </property>
101 <property stdset="1">
102 <name>orientation</name>
103 <enum>Horizontal</enum>
104 </property>
105 <property stdset="1">
106 <name>sizeType</name>
107 <enum>Fixed</enum>
108 </property>
109 <property>
110 <name>sizeHint</name>
111 <size>
112 <width>16</width>
113 <height>20</height>
114 </size>
115 </property>
116 </spacer>
117 <widget>
118 <class>QGroupBox</class>
119 <property stdset="1">
120 <name>name</name>
121 <cstring>GroupBox1</cstring>
122 </property>
123 <property stdset="1">
124 <name>sizePolicy</name>
125 <sizepolicy>
126 <hsizetype>7</hsizetype>
127 <vsizetype>5</vsizetype>
128 </sizepolicy>
129 </property>
130 <property stdset="1">
131 <name>frameShape</name>
132 <enum>NoFrame</enum>
133 </property>
134 <property stdset="1">
135 <name>title</name>
136 <string></string>
137 </property>
138 <property>
139 <name>layoutMargin</name>
140 </property>
141 <property>
142 <name>layoutSpacing</name>
143 </property>
144 <grid>
145 <property stdset="1">
146 <name>margin</name>
147 <number>2</number>
148 </property>
149 <property stdset="1">
150 <name>spacing</name>
151 <number>1</number>
152 </property>
153 <widget row="0" column="0" >
154 <class>QLineEdit</class>
155 <property stdset="1">
156 <name>name</name>
157 <cstring>LoginExpect_LE</cstring>
158 </property>
159 <property stdset="1">
160 <name>text</name>
161 <string>ogin:</string>
162 </property>
163 </widget>
164 <widget row="0" column="1" >
165 <class>QLineEdit</class>
166 <property stdset="1">
167 <name>name</name>
168 <cstring>LoginSend_LE</cstring>
169 </property>
170 </widget>
171 <widget row="1" column="0" >
172 <class>QLineEdit</class>
173 <property stdset="1">
174 <name>name</name>
175 <cstring>PasswordExpect_LE</cstring>
176 </property>
177 <property stdset="1">
178 <name>text</name>
179 <string>assword:</string>
180 </property>
181 </widget>
182 <widget row="1" column="1" >
183 <class>QLineEdit</class>
184 <property stdset="1">
185 <name>name</name>
186 <cstring>PasswordSend_LE</cstring>
187 </property>
188 </widget>
189 </grid>
190 </widget>
191 </hbox>
192 </widget>
193 <widget>
194 <class>QRadioButton</class>
195 <property stdset="1">
196 <name>name</name>
197 <cstring>PapChap_RB</cstring>
198 </property>
199 <property stdset="1">
200 <name>text</name>
201 <string>Pap/Chap/EAP</string>
202 </property>
203 </widget>
204 <widget>
205 <class>QLayoutWidget</class>
206 <property stdset="1">
207 <name>name</name>
208 <cstring>Layout5</cstring>
209 </property>
210 <hbox>
211 <property stdset="1">
212 <name>margin</name>
213 <number>0</number>
214 </property>
215 <property stdset="1">
216 <name>spacing</name>
217 <number>6</number>
218 </property>
219 <spacer>
220 <property>
221 <name>name</name>
222 <cstring>Spacer3_2</cstring>
223 </property>
224 <property stdset="1">
225 <name>orientation</name>
226 <enum>Horizontal</enum>
227 </property>
228 <property stdset="1">
229 <name>sizeType</name>
230 <enum>Fixed</enum>
231 </property>
232 <property>
233 <name>sizeHint</name>
234 <size>
235 <width>16</width>
236 <height>20</height>
237 </size>
238 </property>
239 </spacer>
240 <widget>
241 <class>QGroupBox</class>
242 <property stdset="1">
243 <name>name</name>
244 <cstring>GroupBox3</cstring>
245 </property>
246 <property stdset="1">
247 <name>enabled</name>
248 <bool>false</bool>
249 </property>
250 <property stdset="1">
251 <name>sizePolicy</name>
252 <sizepolicy>
253 <hsizetype>7</hsizetype>
254 <vsizetype>5</vsizetype>
255 </sizepolicy>
256 </property>
257 <property stdset="1">
258 <name>frameShape</name>
259 <enum>NoFrame</enum>
260 </property>
261 <property stdset="1">
262 <name>title</name>
263 <string></string>
264 </property>
265 <property>
266 <name>layoutMargin</name>
267 </property>
268 <property>
269 <name>layoutSpacing</name>
270 </property>
271 <grid>
272 <property stdset="1">
273 <name>margin</name>
274 <number>2</number>
275 </property>
276 <property stdset="1">
277 <name>spacing</name>
278 <number>1</number>
279 </property>
280 <widget row="2" column="0" >
281 <class>QLabel</class>
282 <property stdset="1">
283 <name>name</name>
284 <cstring>TextLabel1_2</cstring>
285 </property>
286 <property stdset="1">
287 <name>text</name>
288 <string>Server</string>
289 </property>
290 </widget>
291 <widget row="3" column="0" >
292 <class>QLabel</class>
293 <property stdset="1">
294 <name>name</name>
295 <cstring>TextLabel1_3</cstring>
296 </property>
297 <property stdset="1">
298 <name>text</name>
299 <string>Secret</string>
300 </property>
301 </widget>
302 <widget row="0" column="1" >
303 <class>QComboBox</class>
304 <item>
305 <property>
306 <name>text</name>
307 <string>PAP</string>
308 </property>
309 </item>
310 <item>
311 <property>
312 <name>text</name>
313 <string>CHAP</string>
314 </property>
315 </item>
316 <item>
317 <property>
318 <name>text</name>
319 <string>EAP</string>
320 </property>
321 </item>
322 <property stdset="1">
323 <name>name</name>
324 <cstring>AuthMethod_CB</cstring>
325 </property>
326 </widget>
327 <widget row="1" column="0" >
328 <class>QLabel</class>
329 <property stdset="1">
330 <name>name</name>
331 <cstring>TextLabel1</cstring>
332 </property>
333 <property stdset="1">
334 <name>text</name>
335 <string>Client</string>
336 </property>
337 </widget>
338 <widget row="0" column="0" >
339 <class>QLabel</class>
340 <property stdset="1">
341 <name>name</name>
342 <cstring>TextLabel1_4</cstring>
343 </property>
344 <property stdset="1">
345 <name>text</name>
346 <string>Method</string>
347 </property>
348 </widget>
349 <widget row="1" column="1" rowspan="1" colspan="2" >
350 <class>QLineEdit</class>
351 <property stdset="1">
352 <name>name</name>
353 <cstring>Client_LE</cstring>
354 </property>
355 <property stdset="1">
356 <name>text</name>
357 <string>*</string>
358 </property>
359 </widget>
360 <widget row="2" column="1" rowspan="1" colspan="2" >
361 <class>QLineEdit</class>
362 <property stdset="1">
363 <name>name</name>
364 <cstring>Server_LE</cstring>
365 </property>
366 <property stdset="1">
367 <name>text</name>
368 <string>*</string>
369 </property>
370 </widget>
371 <widget row="3" column="1" rowspan="1" colspan="2" >
372 <class>QLineEdit</class>
373 <property stdset="1">
374 <name>name</name>
375 <cstring>Secret_LE</cstring>
376 </property>
377 </widget>
378 <spacer row="0" column="2" >
379 <property>
380 <name>name</name>
381 <cstring>Spacer7</cstring>
382 </property>
383 <property stdset="1">
384 <name>orientation</name>
385 <enum>Horizontal</enum>
386 </property>
387 <property stdset="1">
388 <name>sizeType</name>
389 <enum>Expanding</enum>
390 </property>
391 <property>
392 <name>sizeHint</name>
393 <size>
394 <width>20</width>
395 <height>20</height>
396 </size>
397 </property>
398 </spacer>
399 </grid>
400 </widget>
401 </hbox>
402 </widget>
403 <widget>
404 <class>QRadioButton</class>
405 <property stdset="1">
406 <name>name</name>
407 <cstring>Terminal_RB</cstring>
408 </property>
409 <property stdset="1">
410 <name>text</name>
411 <string>Terminal</string>
412 </property>
413 </widget>
414 </vbox>
415 </widget>
416 </vbox>
417</widget>
418<connections>
419 <connection>
420 <sender>PapChap_RB</sender>
421 <signal>toggled(bool)</signal>
422 <receiver>GroupBox3</receiver>
423 <slot>setEnabled(bool)</slot>
424 </connection>
425 <connection>
426 <sender>Login_RB</sender>
427 <signal>toggled(bool)</signal>
428 <receiver>GroupBox1</receiver>
429 <slot>setEnabled(bool)</slot>
430 </connection>
431</connections>
432</UI>
diff --git a/noncore/settings/networksettings2/ppp/PPPAuthedit.cpp b/noncore/settings/networksettings2/ppp/PPPAuthedit.cpp
new file mode 100644
index 0000000..f305cc4
--- a/dev/null
+++ b/noncore/settings/networksettings2/ppp/PPPAuthedit.cpp
@@ -0,0 +1,85 @@
1#include <stdio.h>
2#include <qcombobox.h>
3#include <qmessagebox.h>
4#include <qradiobutton.h>
5#include <qlineedit.h>
6#include <GUIUtils.h>
7#include "PPPAuthedit.h"
8
9PPPAuthEdit::PPPAuthEdit( QWidget * Parent ) : PPPAuthGUI( Parent ){
10}
11
12QString PPPAuthEdit::acceptable( void ) {
13 if( Login_RB->isChecked() ) {
14 if( LoginSend_LE->text().isEmpty() )
15 return tr("Login send missing");
16 if( LoginExpect_LE->text().isEmpty() )
17 return tr("Login expect missing");
18 if( PasswordSend_LE->text().isEmpty() )
19 return tr("Password send missing");
20 if( PasswordExpect_LE->text().isEmpty() )
21 return tr("Password expect missing");
22 } else if( PapChap_RB->isChecked() ) {
23 if( Client_LE->text().isEmpty() )
24 return tr("Pap/Chap/EAP client id missing");
25 if( Server_LE->text().isEmpty() )
26 return tr("Pap/Chap/EAP server id missing");
27 if( Secret_LE->text().isEmpty() )
28 return tr("Pap/Chap/EAP secret id missing");
29 }
30 return QString();
31}
32
33bool PPPAuthEdit::commit( PPPData_t & D ) {
34 bool SM = 0;
35
36 if( ( D.Auth.Mode == 0 && ! Login_RB->isChecked() ) ||
37 ( D.Auth.Mode == 1 && ! PapChap_RB->isChecked() ) ||
38 ( D.Auth.Mode == 2 && ! Terminal_RB->isChecked() ) ) {
39 // mode modifed
40 SM = 1;
41 D.Auth.Mode = ( Login_RB->isChecked() ) ?
42 0 :
43 ( ( PapChap_RB->isChecked() ) ?
44 1 : 2 );
45 }
46
47 if( Login_RB->isChecked() ) {
48 TXTM( D.Auth.Login.Expect, LoginExpect_LE, SM );
49 TXTM( D.Auth.Login.Send, LoginSend_LE, SM );
50 TXTM( D.Auth.Password.Expect, PasswordExpect_LE, SM );
51 TXTM( D.Auth.Password.Send, PasswordSend_LE, SM );
52 } else if( PapChap_RB->isChecked() ) {
53 TXTM( D.Auth.Client, Client_LE, SM );
54 TXTM( D.Auth.Server, Server_LE, SM );
55 TXTM( D.Auth.Secret, Secret_LE, SM );
56 CIM( D.Auth.PCEMode, AuthMethod_CB, SM );
57 }
58 return SM;
59}
60
61void PPPAuthEdit::showData( PPPData_t & D ) {
62
63 switch( D.Auth.Mode ) {
64 case 0 :
65 Login_RB->isChecked();
66 break;
67 case 1 :
68 PapChap_RB->isChecked();
69 break;
70 case 2 :
71 Terminal_RB->isChecked();
72 break;
73 }
74
75 LoginExpect_LE->setText( D.Auth.Login.Expect );
76 PasswordExpect_LE->setText( D.Auth.Password.Expect );
77 LoginSend_LE->setText( D.Auth.Login.Send );
78 PasswordSend_LE->setText( D.Auth.Password.Send );
79
80 Client_LE->setText( D.Auth.Client );
81 Server_LE->setText( D.Auth.Server );
82 Secret_LE->setText( D.Auth.Secret );
83
84 AuthMethod_CB->setCurrentItem( D.Auth.PCEMode );
85}
diff --git a/noncore/settings/networksettings2/ppp/PPPAuthedit.h b/noncore/settings/networksettings2/ppp/PPPAuthedit.h
new file mode 100644
index 0000000..cbd540e
--- a/dev/null
+++ b/noncore/settings/networksettings2/ppp/PPPAuthedit.h
@@ -0,0 +1,15 @@
1#include "pppdata.h"
2#include "PPPAuthGUI.h"
3
4class PPPAuthEdit : public PPPAuthGUI {
5
6public :
7
8 PPPAuthEdit( QWidget * parent );
9 QString acceptable( void );
10 bool commit( PPPData_t & Data );
11 void showData( PPPData_t & Data );
12
13private :
14
15};
diff --git a/noncore/settings/networksettings2/ppp/PPPDNSGUI.ui b/noncore/settings/networksettings2/ppp/PPPDNSGUI.ui
new file mode 100644
index 0000000..0ed136f
--- a/dev/null
+++ b/noncore/settings/networksettings2/ppp/PPPDNSGUI.ui
@@ -0,0 +1,340 @@
1<!DOCTYPE UI><UI>
2<class>PPPDNSGUI</class>
3<widget>
4 <class>QWidget</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>PPPDNSGUI</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>228</width>
15 <height>169</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>PPPDNS</string>
21 </property>
22 <property>
23 <name>layoutMargin</name>
24 </property>
25 <property>
26 <name>layoutSpacing</name>
27 </property>
28 <vbox>
29 <property stdset="1">
30 <name>margin</name>
31 <number>2</number>
32 </property>
33 <property stdset="1">
34 <name>spacing</name>
35 <number>2</number>
36 </property>
37 <widget>
38 <class>QButtonGroup</class>
39 <property stdset="1">
40 <name>name</name>
41 <cstring>ButtonGroup18</cstring>
42 </property>
43 <property stdset="1">
44 <name>frameShape</name>
45 <enum>NoFrame</enum>
46 </property>
47 <property stdset="1">
48 <name>title</name>
49 <string></string>
50 </property>
51 <property>
52 <name>layoutMargin</name>
53 </property>
54 <property>
55 <name>layoutSpacing</name>
56 </property>
57 <vbox>
58 <property stdset="1">
59 <name>margin</name>
60 <number>2</number>
61 </property>
62 <property stdset="1">
63 <name>spacing</name>
64 <number>2</number>
65 </property>
66 <widget>
67 <class>QRadioButton</class>
68 <property stdset="1">
69 <name>name</name>
70 <cstring>DNSServerAssigned_RB</cstring>
71 </property>
72 <property stdset="1">
73 <name>text</name>
74 <string>Server assigned</string>
75 </property>
76 <property stdset="1">
77 <name>checked</name>
78 <bool>true</bool>
79 </property>
80 </widget>
81 <widget>
82 <class>QRadioButton</class>
83 <property stdset="1">
84 <name>name</name>
85 <cstring>DNSFixed_RB</cstring>
86 </property>
87 <property stdset="1">
88 <name>text</name>
89 <string>Fixed</string>
90 </property>
91 </widget>
92 <widget>
93 <class>QLayoutWidget</class>
94 <property stdset="1">
95 <name>name</name>
96 <cstring>Layout13</cstring>
97 </property>
98 <hbox>
99 <property stdset="1">
100 <name>margin</name>
101 <number>0</number>
102 </property>
103 <property stdset="1">
104 <name>spacing</name>
105 <number>6</number>
106 </property>
107 <spacer>
108 <property>
109 <name>name</name>
110 <cstring>Spacer29</cstring>
111 </property>
112 <property stdset="1">
113 <name>orientation</name>
114 <enum>Horizontal</enum>
115 </property>
116 <property stdset="1">
117 <name>sizeType</name>
118 <enum>Fixed</enum>
119 </property>
120 <property>
121 <name>sizeHint</name>
122 <size>
123 <width>20</width>
124 <height>20</height>
125 </size>
126 </property>
127 </spacer>
128 <widget>
129 <class>QFrame</class>
130 <property stdset="1">
131 <name>name</name>
132 <cstring>Frame21</cstring>
133 </property>
134 <property stdset="1">
135 <name>enabled</name>
136 <bool>false</bool>
137 </property>
138 <property stdset="1">
139 <name>sizePolicy</name>
140 <sizepolicy>
141 <hsizetype>7</hsizetype>
142 <vsizetype>5</vsizetype>
143 </sizepolicy>
144 </property>
145 <property stdset="1">
146 <name>frameShape</name>
147 <enum>NoFrame</enum>
148 </property>
149 <property stdset="1">
150 <name>frameShadow</name>
151 <enum>Raised</enum>
152 </property>
153 <property>
154 <name>layoutMargin</name>
155 </property>
156 <property>
157 <name>layoutSpacing</name>
158 </property>
159 <grid>
160 <property stdset="1">
161 <name>margin</name>
162 <number>2</number>
163 </property>
164 <property stdset="1">
165 <name>spacing</name>
166 <number>2</number>
167 </property>
168 <widget row="0" column="0" >
169 <class>QLabel</class>
170 <property stdset="1">
171 <name>name</name>
172 <cstring>TextLabel5</cstring>
173 </property>
174 <property stdset="1">
175 <name>text</name>
176 <string>DomainName</string>
177 </property>
178 </widget>
179 <widget row="1" column="0" >
180 <class>QLabel</class>
181 <property stdset="1">
182 <name>name</name>
183 <cstring>TextLabel6</cstring>
184 </property>
185 <property stdset="1">
186 <name>text</name>
187 <string>Address</string>
188 </property>
189 </widget>
190 <widget row="0" column="1" >
191 <class>QLineEdit</class>
192 <property stdset="1">
193 <name>name</name>
194 <cstring>DomainName_LE</cstring>
195 </property>
196 </widget>
197 <widget row="1" column="1" >
198 <class>QLineEdit</class>
199 <property stdset="1">
200 <name>name</name>
201 <cstring>ServerAddress_LE</cstring>
202 </property>
203 </widget>
204 <widget row="3" column="1" >
205 <class>QListBox</class>
206 <property stdset="1">
207 <name>name</name>
208 <cstring>Servers_LB</cstring>
209 </property>
210 </widget>
211 <widget row="2" column="1" >
212 <class>QFrame</class>
213 <property stdset="1">
214 <name>name</name>
215 <cstring>Frame22</cstring>
216 </property>
217 <property stdset="1">
218 <name>sizePolicy</name>
219 <sizepolicy>
220 <hsizetype>7</hsizetype>
221 <vsizetype>0</vsizetype>
222 </sizepolicy>
223 </property>
224 <property stdset="1">
225 <name>frameShape</name>
226 <enum>NoFrame</enum>
227 </property>
228 <property stdset="1">
229 <name>frameShadow</name>
230 <enum>Raised</enum>
231 </property>
232 <property>
233 <name>layoutMargin</name>
234 </property>
235 <property>
236 <name>layoutSpacing</name>
237 </property>
238 <hbox>
239 <property stdset="1">
240 <name>margin</name>
241 <number>0</number>
242 </property>
243 <property stdset="1">
244 <name>spacing</name>
245 <number>0</number>
246 </property>
247 <widget>
248 <class>QToolButton</class>
249 <property stdset="1">
250 <name>name</name>
251 <cstring>Add_TB</cstring>
252 </property>
253 <property stdset="1">
254 <name>text</name>
255 <string>...</string>
256 </property>
257 </widget>
258 <spacer>
259 <property>
260 <name>name</name>
261 <cstring>Spacer2</cstring>
262 </property>
263 <property stdset="1">
264 <name>orientation</name>
265 <enum>Horizontal</enum>
266 </property>
267 <property stdset="1">
268 <name>sizeType</name>
269 <enum>Expanding</enum>
270 </property>
271 <property>
272 <name>sizeHint</name>
273 <size>
274 <width>20</width>
275 <height>20</height>
276 </size>
277 </property>
278 </spacer>
279 <widget>
280 <class>QToolButton</class>
281 <property stdset="1">
282 <name>name</name>
283 <cstring>Remove_TB</cstring>
284 </property>
285 <property stdset="1">
286 <name>text</name>
287 <string>...</string>
288 </property>
289 </widget>
290 </hbox>
291 </widget>
292 <widget row="3" column="0" >
293 <class>QLabel</class>
294 <property stdset="1">
295 <name>name</name>
296 <cstring>TextLabel7</cstring>
297 </property>
298 <property stdset="1">
299 <name>text</name>
300 <string>List</string>
301 </property>
302 <property stdset="1">
303 <name>alignment</name>
304 <set>AlignTop|AlignLeft</set>
305 </property>
306 <property>
307 <name>vAlign</name>
308 </property>
309 </widget>
310 </grid>
311 </widget>
312 </hbox>
313 </widget>
314 </vbox>
315 </widget>
316 </vbox>
317</widget>
318<connections>
319 <connection>
320 <sender>DNSFixed_RB</sender>
321 <signal>toggled(bool)</signal>
322 <receiver>Frame21</receiver>
323 <slot>setEnabled(bool)</slot>
324 </connection>
325 <connection>
326 <sender>Add_TB</sender>
327 <signal>clicked()</signal>
328 <receiver>PPPDNSGUI</receiver>
329 <slot>SLOT_AddServer()</slot>
330 </connection>
331 <connection>
332 <sender>Remove_TB</sender>
333 <signal>clicked()</signal>
334 <receiver>PPPDNSGUI</receiver>
335 <slot>SLOT_RemoveServer()</slot>
336 </connection>
337 <slot access="public">SLOT_AddServer()</slot>
338 <slot access="public">SLOT_RemoveServer()</slot>
339</connections>
340</UI>
diff --git a/noncore/settings/networksettings2/ppp/PPPDNSedit.cpp b/noncore/settings/networksettings2/ppp/PPPDNSedit.cpp
new file mode 100644
index 0000000..22f8e59
--- a/dev/null
+++ b/noncore/settings/networksettings2/ppp/PPPDNSedit.cpp
@@ -0,0 +1,108 @@
1#include <qtoolbutton.h>
2#include <qmessagebox.h>
3#include <qlistbox.h>
4#include <qlineedit.h>
5#include <qradiobutton.h>
6#include <resources.h>
7#include <GUIUtils.h>
8#include "PPPDNSedit.h"
9
10PPPDNSEdit::PPPDNSEdit( QWidget * Parent ) : PPPDNSGUI( Parent ){
11
12 Add_TB->setPixmap( NSResources->getPixmap( "add" ) );
13 Remove_TB->setPixmap( NSResources->getPixmap( "remove" ) );
14}
15
16QString PPPDNSEdit::acceptable( void ) {
17 if( DNSFixed_RB->isChecked() ) {
18 if( DomainName_LE->text().isEmpty() )
19 tr("Domainname needed");
20 if( Servers_LB->count() == 0 )
21 tr("DNS Servers needed");
22 }
23 return QString();
24}
25
26bool PPPDNSEdit::commit( PPPData_t & D ) {
27 bool SM = 0;
28
29 CBM( D.DNS.ServerAssigned, DNSServerAssigned_RB, SM );
30 TXTM( D.DNS.DomainName, DomainName_LE, SM );
31
32 // new items in old ?
33 for ( unsigned i = 0; i < Servers_LB->count(); i++ ) {
34 QString S;
35 bool Found;
36 Found = 0;
37 S = Servers_LB->text(i);
38 for ( unsigned j = 0; j < D.DNS.Servers.size(); j++ ) {
39 if( *(D.DNS.Servers[i]) == S ) {
40 // still in list
41 Found = 1;
42 break;
43 }
44 }
45 if( ! Found ) {
46 SM = 1;
47 D.DNS.Servers.resize( D.DNS.Servers.size()+1 );
48 D.DNS.Servers[D.DNS.Servers.size()] = new QString( S );
49 }
50 }
51
52 // old in new ?
53 for ( unsigned j = 0; j < D.DNS.Servers.size(); j++ ) {
54 bool Found;
55 Found = 0;
56 for ( unsigned i = 0; i < Servers_LB->count(); i++ ) {
57 if( *(D.DNS.Servers[j]) == Servers_LB->text(i) ) {
58 // still in list
59 Found = 1;
60 break;
61 }
62 }
63 if( ! Found ) {
64 // old obsolete
65 SM = 1;
66 delete D.DNS.Servers[j];
67 for( unsigned i = j+1; i < D.DNS.Servers.size(); i ++ ) {
68 // compress array
69 D.DNS.Servers[i-1] = D.DNS.Servers[i];
70 }
71 // shrink
72 D.DNS.Servers.resize( D.DNS.Servers.size()-1 );
73 }
74 }
75 return SM;
76}
77
78void PPPDNSEdit::showData( PPPData_t & D) {
79
80 DNSServerAssigned_RB->setChecked( D.DNS.ServerAssigned );
81
82 DomainName_LE->setText( D.DNS.DomainName );
83 for( unsigned i = 0; i < D.DNS.Servers.size(); i ++ ) {
84 Servers_LB->insertItem( *(D.DNS.Servers[i]) );
85 }
86}
87
88void PPPDNSEdit::SLOT_AddServer( void ) {
89 if( ServerAddress_LE->text().isEmpty() )
90 return;
91
92 Servers_LB->insertItem( ServerAddress_LE->text() );
93 ServerAddress_LE->setText( "" );
94}
95
96void PPPDNSEdit::SLOT_RemoveServer( void ) {
97 long i = Servers_LB->currentItem();
98 if( i < 0 )
99 return;
100 Servers_LB->removeItem( i );
101 if( (unsigned) i >= Servers_LB->count() ) {
102 i --;
103 }
104 if( i >= 0 ) {
105 Servers_LB->setCurrentItem( i );
106 }
107
108}
diff --git a/noncore/settings/networksettings2/ppp/PPPDNSedit.h b/noncore/settings/networksettings2/ppp/PPPDNSedit.h
new file mode 100644
index 0000000..43e0067
--- a/dev/null
+++ b/noncore/settings/networksettings2/ppp/PPPDNSedit.h
@@ -0,0 +1,20 @@
1#include "pppdata.h"
2#include "PPPDNSGUI.h"
3
4class PPPDNSEdit : public PPPDNSGUI {
5
6public :
7
8 PPPDNSEdit( QWidget * parent );
9 QString acceptable( void );
10 bool commit( PPPData_t & Data );
11 void showData( PPPData_t & Data );
12
13public slots :
14
15 void SLOT_AddServer( void );
16 void SLOT_RemoveServer( void );
17
18private :
19
20};
diff --git a/noncore/settings/networksettings2/ppp/PPPGUI.ui b/noncore/settings/networksettings2/ppp/PPPGUI.ui
new file mode 100644
index 0000000..777e4a9
--- a/dev/null
+++ b/noncore/settings/networksettings2/ppp/PPPGUI.ui
@@ -0,0 +1,103 @@
1<!DOCTYPE UI><UI>
2<class>PPPGUI</class>
3<widget>
4 <class>QWidget</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>PPPGUI</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>124</width>
15 <height>29</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>PPP</string>
21 </property>
22 <property>
23 <name>layoutMargin</name>
24 </property>
25 <property>
26 <name>layoutSpacing</name>
27 </property>
28 <vbox>
29 <property stdset="1">
30 <name>margin</name>
31 <number>2</number>
32 </property>
33 <property stdset="1">
34 <name>spacing</name>
35 <number>2</number>
36 </property>
37 <widget>
38 <class>QComboBox</class>
39 <item>
40 <property>
41 <name>text</name>
42 <string>Authentication</string>
43 </property>
44 </item>
45 <item>
46 <property>
47 <name>text</name>
48 <string>IP settings</string>
49 </property>
50 </item>
51 <item>
52 <property>
53 <name>text</name>
54 <string>DNS Settings</string>
55 </property>
56 </item>
57 <property stdset="1">
58 <name>name</name>
59 <cstring>PPPOptions_CB</cstring>
60 </property>
61 </widget>
62 <widget>
63 <class>QWidgetStack</class>
64 <property stdset="1">
65 <name>name</name>
66 <cstring>Options_WS</cstring>
67 </property>
68 </widget>
69 </vbox>
70</widget>
71<customwidgets>
72 <customwidget>
73 <class>QWidgetStack</class>
74 <header location="global">qwidgetstack.h</header>
75 <sizehint>
76 <width>-1</width>
77 <height>-1</height>
78 </sizehint>
79 <container>0</container>
80 <sizepolicy>
81 <hordata>7</hordata>
82 <verdata>7</verdata>
83 </sizepolicy>
84 <pixmap>image0</pixmap>
85 <slot access="public">raiseWidget( int )</slot>
86 </customwidget>
87</customwidgets>
88<images>
89 <image>
90 <name>image0</name>
91 <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1ddec44f503c0ae2a154410f53d0ed20e2bf6bdb656dd6861dd23d9a66591b0587fd1654235ebded6f0edcd53e419d87ae7b1f4f9b8f906d0bfe012317426a70b07bdc2f3ec77f8ed6b89559061a0343d06a124cc105596482585094bc0ae599b04646c9018926491b2205e140c485cace25755c175d0a967b622ff900b8cc9c7d29af594ea722d589167f813aa852ba07d94b9dce296e883fe7bb163f23896753</data>
92 </image>
93</images>
94<connections>
95 <connection>
96 <sender>PPPOptions_CB</sender>
97 <signal>activated(int)</signal>
98 <receiver>PPPGUI</receiver>
99 <slot>SLOT_SelectTopic( int )</slot>
100 </connection>
101 <slot access="public">SLOT_SelectTopic( int )</slot>
102</connections>
103</UI>
diff --git a/noncore/settings/networksettings2/ppp/PPPIPGUI.ui b/noncore/settings/networksettings2/ppp/PPPIPGUI.ui
new file mode 100644
index 0000000..f3d5019
--- a/dev/null
+++ b/noncore/settings/networksettings2/ppp/PPPIPGUI.ui
@@ -0,0 +1,444 @@
1<!DOCTYPE UI><UI>
2<class>PPPIPGUI</class>
3<widget>
4 <class>QWidget</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>PPPIPGUI</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>133</width>
15 <height>235</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>PPPIP</string>
21 </property>
22 <property>
23 <name>layoutMargin</name>
24 </property>
25 <property>
26 <name>layoutSpacing</name>
27 </property>
28 <vbox>
29 <property stdset="1">
30 <name>margin</name>
31 <number>3</number>
32 </property>
33 <property stdset="1">
34 <name>spacing</name>
35 <number>2</number>
36 </property>
37 <widget>
38 <class>QButtonGroup</class>
39 <property stdset="1">
40 <name>name</name>
41 <cstring>ButtonGroup4</cstring>
42 </property>
43 <property stdset="1">
44 <name>frameShape</name>
45 <enum>Box</enum>
46 </property>
47 <property stdset="1">
48 <name>title</name>
49 <string>IP</string>
50 </property>
51 <property>
52 <name>layoutMargin</name>
53 </property>
54 <property>
55 <name>layoutSpacing</name>
56 </property>
57 <vbox>
58 <property stdset="1">
59 <name>margin</name>
60 <number>2</number>
61 </property>
62 <property stdset="1">
63 <name>spacing</name>
64 <number>2</number>
65 </property>
66 <widget>
67 <class>QRadioButton</class>
68 <property stdset="1">
69 <name>name</name>
70 <cstring>IPServerAssigned_RB</cstring>
71 </property>
72 <property stdset="1">
73 <name>text</name>
74 <string>Server assigned</string>
75 </property>
76 <property stdset="1">
77 <name>checked</name>
78 <bool>true</bool>
79 </property>
80 </widget>
81 <widget>
82 <class>QRadioButton</class>
83 <property stdset="1">
84 <name>name</name>
85 <cstring>IPFixed_RB</cstring>
86 </property>
87 <property stdset="1">
88 <name>text</name>
89 <string>Fixed</string>
90 </property>
91 </widget>
92 <widget>
93 <class>QLayoutWidget</class>
94 <property stdset="1">
95 <name>name</name>
96 <cstring>Layout11</cstring>
97 </property>
98 <hbox>
99 <property stdset="1">
100 <name>margin</name>
101 <number>0</number>
102 </property>
103 <property stdset="1">
104 <name>spacing</name>
105 <number>6</number>
106 </property>
107 <spacer>
108 <property>
109 <name>name</name>
110 <cstring>Spacer8</cstring>
111 </property>
112 <property stdset="1">
113 <name>orientation</name>
114 <enum>Horizontal</enum>
115 </property>
116 <property stdset="1">
117 <name>sizeType</name>
118 <enum>Fixed</enum>
119 </property>
120 <property>
121 <name>sizeHint</name>
122 <size>
123 <width>20</width>
124 <height>20</height>
125 </size>
126 </property>
127 <property>
128 <name>layoutMargin</name>
129 </property>
130 <property>
131 <name>layoutSpacing</name>
132 </property>
133 </spacer>
134 <widget>
135 <class>QFrame</class>
136 <property stdset="1">
137 <name>name</name>
138 <cstring>Frame8</cstring>
139 </property>
140 <property stdset="1">
141 <name>enabled</name>
142 <bool>false</bool>
143 </property>
144 <property stdset="1">
145 <name>sizePolicy</name>
146 <sizepolicy>
147 <hsizetype>7</hsizetype>
148 <vsizetype>5</vsizetype>
149 </sizepolicy>
150 </property>
151 <property stdset="1">
152 <name>frameShape</name>
153 <enum>NoFrame</enum>
154 </property>
155 <property stdset="1">
156 <name>frameShadow</name>
157 <enum>Raised</enum>
158 </property>
159 <property>
160 <name>layoutMargin</name>
161 </property>
162 <property>
163 <name>layoutSpacing</name>
164 </property>
165 <grid>
166 <property stdset="1">
167 <name>margin</name>
168 <number>2</number>
169 </property>
170 <property stdset="1">
171 <name>spacing</name>
172 <number>2</number>
173 </property>
174 <widget row="0" column="1" >
175 <class>QLineEdit</class>
176 <property stdset="1">
177 <name>name</name>
178 <cstring>IPAddress_LE</cstring>
179 </property>
180 </widget>
181 <widget row="1" column="0" >
182 <class>QLabel</class>
183 <property stdset="1">
184 <name>name</name>
185 <cstring>TextLabel3</cstring>
186 </property>
187 <property stdset="1">
188 <name>text</name>
189 <string>Subnetmask</string>
190 </property>
191 </widget>
192 <widget row="0" column="0" >
193 <class>QLabel</class>
194 <property stdset="1">
195 <name>name</name>
196 <cstring>TextLabel2</cstring>
197 </property>
198 <property stdset="1">
199 <name>text</name>
200 <string>Address</string>
201 </property>
202 </widget>
203 <widget row="1" column="1" >
204 <class>QLineEdit</class>
205 <property stdset="1">
206 <name>name</name>
207 <cstring>IPSubMask_LE</cstring>
208 </property>
209 </widget>
210 </grid>
211 </widget>
212 </hbox>
213 </widget>
214 </vbox>
215 </widget>
216 <widget>
217 <class>QButtonGroup</class>
218 <property stdset="1">
219 <name>name</name>
220 <cstring>ButtonGroup5</cstring>
221 </property>
222 <property stdset="1">
223 <name>title</name>
224 <string>Gateway</string>
225 </property>
226 <property>
227 <name>layoutMargin</name>
228 </property>
229 <property>
230 <name>layoutSpacing</name>
231 </property>
232 <vbox>
233 <property stdset="1">
234 <name>margin</name>
235 <number>2</number>
236 </property>
237 <property stdset="1">
238 <name>spacing</name>
239 <number>2</number>
240 </property>
241 <widget>
242 <class>QRadioButton</class>
243 <property stdset="1">
244 <name>name</name>
245 <cstring>GWServerAssigned_RB</cstring>
246 </property>
247 <property stdset="1">
248 <name>text</name>
249 <string>Server assigned</string>
250 </property>
251 <property stdset="1">
252 <name>checked</name>
253 <bool>true</bool>
254 </property>
255 <property>
256 <name>layoutMargin</name>
257 </property>
258 <property>
259 <name>layoutSpacing</name>
260 </property>
261 </widget>
262 <widget>
263 <class>QRadioButton</class>
264 <property stdset="1">
265 <name>name</name>
266 <cstring>GWFixed_RB</cstring>
267 </property>
268 <property stdset="1">
269 <name>text</name>
270 <string>Fixed</string>
271 </property>
272 </widget>
273 <widget>
274 <class>QLayoutWidget</class>
275 <property stdset="1">
276 <name>name</name>
277 <cstring>Layout12</cstring>
278 </property>
279 <property>
280 <name>layoutMargin</name>
281 </property>
282 <property>
283 <name>layoutSpacing</name>
284 </property>
285 <hbox>
286 <property stdset="1">
287 <name>margin</name>
288 <number>0</number>
289 </property>
290 <property stdset="1">
291 <name>spacing</name>
292 <number>6</number>
293 </property>
294 <spacer>
295 <property>
296 <name>name</name>
297 <cstring>Spacer9</cstring>
298 </property>
299 <property stdset="1">
300 <name>orientation</name>
301 <enum>Horizontal</enum>
302 </property>
303 <property stdset="1">
304 <name>sizeType</name>
305 <enum>Fixed</enum>
306 </property>
307 <property>
308 <name>sizeHint</name>
309 <size>
310 <width>20</width>
311 <height>20</height>
312 </size>
313 </property>
314 </spacer>
315 <widget>
316 <class>QFrame</class>
317 <property stdset="1">
318 <name>name</name>
319 <cstring>Frame9</cstring>
320 </property>
321 <property stdset="1">
322 <name>enabled</name>
323 <bool>false</bool>
324 </property>
325 <property stdset="1">
326 <name>sizePolicy</name>
327 <sizepolicy>
328 <hsizetype>7</hsizetype>
329 <vsizetype>5</vsizetype>
330 </sizepolicy>
331 </property>
332 <property stdset="1">
333 <name>frameShape</name>
334 <enum>NoFrame</enum>
335 </property>
336 <property stdset="1">
337 <name>frameShadow</name>
338 <enum>Raised</enum>
339 </property>
340 <property>
341 <name>layoutMargin</name>
342 </property>
343 <property>
344 <name>layoutSpacing</name>
345 </property>
346 <grid>
347 <property stdset="1">
348 <name>margin</name>
349 <number>2</number>
350 </property>
351 <property stdset="1">
352 <name>spacing</name>
353 <number>2</number>
354 </property>
355 <widget row="0" column="0" >
356 <class>QLabel</class>
357 <property stdset="1">
358 <name>name</name>
359 <cstring>TextLabel4</cstring>
360 </property>
361 <property stdset="1">
362 <name>text</name>
363 <string>Address</string>
364 </property>
365 </widget>
366 <widget row="0" column="1" >
367 <class>QLineEdit</class>
368 <property stdset="1">
369 <name>name</name>
370 <cstring>GWAddress_LE</cstring>
371 </property>
372 </widget>
373 </grid>
374 </widget>
375 </hbox>
376 </widget>
377 <widget>
378 <class>QLayoutWidget</class>
379 <property stdset="1">
380 <name>name</name>
381 <cstring>Layout3</cstring>
382 </property>
383 <hbox>
384 <property stdset="1">
385 <name>margin</name>
386 <number>0</number>
387 </property>
388 <property stdset="1">
389 <name>spacing</name>
390 <number>6</number>
391 </property>
392 <spacer>
393 <property>
394 <name>name</name>
395 <cstring>Spacer3</cstring>
396 </property>
397 <property stdset="1">
398 <name>orientation</name>
399 <enum>Horizontal</enum>
400 </property>
401 <property stdset="1">
402 <name>sizeType</name>
403 <enum>Expanding</enum>
404 </property>
405 <property>
406 <name>sizeHint</name>
407 <size>
408 <width>20</width>
409 <height>20</height>
410 </size>
411 </property>
412 </spacer>
413 <widget>
414 <class>QCheckBox</class>
415 <property stdset="1">
416 <name>name</name>
417 <cstring>GWIsDefault_CB</cstring>
418 </property>
419 <property stdset="1">
420 <name>text</name>
421 <string>Set as default</string>
422 </property>
423 </widget>
424 </hbox>
425 </widget>
426 </vbox>
427 </widget>
428 </vbox>
429</widget>
430<connections>
431 <connection>
432 <sender>GWFixed_RB</sender>
433 <signal>toggled(bool)</signal>
434 <receiver>Frame9</receiver>
435 <slot>setEnabled(bool)</slot>
436 </connection>
437 <connection>
438 <sender>IPFixed_RB</sender>
439 <signal>toggled(bool)</signal>
440 <receiver>Frame8</receiver>
441 <slot>setEnabled(bool)</slot>
442 </connection>
443</connections>
444</UI>
diff --git a/noncore/settings/networksettings2/ppp/PPPIPedit.cpp b/noncore/settings/networksettings2/ppp/PPPIPedit.cpp
new file mode 100644
index 0000000..6965e5a
--- a/dev/null
+++ b/noncore/settings/networksettings2/ppp/PPPIPedit.cpp
@@ -0,0 +1,57 @@
1#include <qmessagebox.h>
2#include <qcheckbox.h>
3#include <qradiobutton.h>
4#include <qlineedit.h>
5#include <GUIUtils.h>
6#include "PPPIPedit.h"
7
8PPPIPEdit::PPPIPEdit( QWidget * Parent ) : PPPIPGUI( Parent ){
9}
10
11QString PPPIPEdit::acceptable( void ) {
12 if( IPFixed_RB->isChecked() ) {
13 if( IPAddress_LE->text().isEmpty() )
14 return tr("IPAddress needed" );
15 if( ! validIP( IPAddress_LE->text() ) )
16 return tr("IPAddress not valid" );
17 if( IPSubMask_LE->text().isEmpty() )
18 return tr("Subnet mask needed" );
19 if( ! validIP( IPSubMask_LE->text() ) )
20 return tr("Subnet mask not valid" );
21 } else if( GWFixed_RB->isChecked() ) {
22 if( GWAddress_LE->text().isEmpty() )
23 return tr("Gateway address needed" );
24 if( ! validIP( GWAddress_LE->text() ) )
25 return tr("Gateway address not valid" );
26 };
27
28 return QString();
29}
30
31bool PPPIPEdit::commit( PPPData_t & D ) {
32
33 bool SM = 0;
34
35 CBM( D.IP.IPAutomatic, IPServerAssigned_RB, SM );
36 if( ! D.IP.IPAutomatic ) {
37 TXTM( D.IP.IPAddress, IPAddress_LE, SM );
38 TXTM( D.IP.IPSubMask, IPSubMask_LE, SM );
39 }
40
41 CBM( D.IP.GWAutomatic, GWServerAssigned_RB, SM );
42 if( ! D.IP.GWAutomatic ) {
43 TXTM( D.IP.GWAddress, GWAddress_LE, SM );
44 }
45
46 CBM( D.IP.GWIsDefault, GWIsDefault_CB, SM );
47 return SM;
48}
49
50void PPPIPEdit::showData( PPPData_t & D ) {
51 IPServerAssigned_RB->setChecked( D.IP.IPAutomatic );
52 IPAddress_LE->setText( D.IP.IPAddress );
53 IPSubMask_LE->setText( D.IP.IPSubMask );
54 GWServerAssigned_RB->setChecked( D.IP.GWAutomatic );
55 GWAddress_LE->setText( D.IP.GWAddress );
56 GWIsDefault_CB->setChecked( D.IP.GWIsDefault );
57}
diff --git a/noncore/settings/networksettings2/ppp/PPPIPedit.h b/noncore/settings/networksettings2/ppp/PPPIPedit.h
new file mode 100644
index 0000000..153ee68
--- a/dev/null
+++ b/noncore/settings/networksettings2/ppp/PPPIPedit.h
@@ -0,0 +1,15 @@
1#include "pppdata.h"
2#include "PPPIPGUI.h"
3
4class PPPIPEdit : public PPPIPGUI {
5
6public :
7
8 PPPIPEdit( QWidget * parent );
9 QString acceptable( void );
10 bool commit( PPPData_t & Data );
11 void showData( PPPData_t & Data );
12
13private :
14
15};
diff --git a/noncore/settings/networksettings2/ppp/PPPedit.cpp b/noncore/settings/networksettings2/ppp/PPPedit.cpp
new file mode 100644
index 0000000..eb4fdbf
--- a/dev/null
+++ b/noncore/settings/networksettings2/ppp/PPPedit.cpp
@@ -0,0 +1,48 @@
1#include <qwidgetstack.h>
2
3#include "PPPIPedit.h"
4#include "PPPDNSedit.h"
5#include "PPPAuthedit.h"
6#include "PPPedit.h"
7
8PPPEdit::PPPEdit( QWidget * Parent ) : PPPGUI( Parent ){
9
10 Auth = new PPPAuthEdit( Options_WS );
11 IP = new PPPIPEdit( Options_WS );
12 DNS = new PPPDNSEdit( Options_WS );
13 Options_WS->addWidget( Auth, 0 );
14 Options_WS->addWidget( IP, 1 );
15 Options_WS->addWidget( DNS, 2 );
16
17 Options_WS->raiseWidget( 0 );
18}
19
20QString PPPEdit::acceptable( void ) {
21 QString S;
22 S = Auth->acceptable();
23 if( S.isEmpty() ) {
24 S = IP->acceptable();
25 if( S.isEmpty() ) {
26 S = DNS->acceptable();
27 }
28 }
29 return S;
30}
31
32bool PPPEdit::commit( PPPData_t & Data ) {
33 bool SM ;
34 SM = Auth->commit( Data );
35 SM |= IP->commit( Data );
36 SM |= DNS->commit( Data );
37 return SM;
38}
39
40void PPPEdit::showData( PPPData_t & Data ) {
41 Auth->showData( Data ) ;
42 IP->showData( Data );
43 DNS->showData( Data );
44}
45
46void PPPEdit::SLOT_SelectTopic( int v ) {
47 Options_WS->raiseWidget( v );
48}
diff --git a/noncore/settings/networksettings2/ppp/PPPedit.h b/noncore/settings/networksettings2/ppp/PPPedit.h
new file mode 100644
index 0000000..57d38ee
--- a/dev/null
+++ b/noncore/settings/networksettings2/ppp/PPPedit.h
@@ -0,0 +1,27 @@
1#include "pppdata.h"
2#include "PPPGUI.h"
3
4class PPPAuthEdit;
5class PPPIPEdit;
6class PPPDNSEdit;
7
8class PPPEdit : public PPPGUI {
9
10public :
11
12 PPPEdit( QWidget * parent );
13 QString acceptable( void );
14 bool commit( PPPData_t & Data );
15 void showData( PPPData_t & Data );
16
17public slots :
18
19 void SLOT_SelectTopic( int );
20
21private :
22
23 PPPAuthEdit * Auth;
24 PPPDNSEdit * DNS;
25 PPPIPEdit * IP;
26
27};
diff --git a/noncore/settings/networksettings2/ppp/config.in b/noncore/settings/networksettings2/ppp/config.in
new file mode 100644
index 0000000..dc3abd0
--- a/dev/null
+++ b/noncore/settings/networksettings2/ppp/config.in
@@ -0,0 +1,4 @@
1 config NS2PPP
2 boolean "opie-networksettings2plugin-ppp (set up PPP)"
3 default "n" if NS2
4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && NS2 && NS2CORE
diff --git a/noncore/settings/networksettings2/ppp/ppp.pro b/noncore/settings/networksettings2/ppp/ppp.pro
new file mode 100644
index 0000000..f8712cd
--- a/dev/null
+++ b/noncore/settings/networksettings2/ppp/ppp.pro
@@ -0,0 +1,24 @@
1TEMPLATE = lib
2CONFIG += qt warn_on release
3DESTDIR = $(OPIEDIR)/plugins/networksettings2
4 HEADERS = ppp_NN.h \
5 ppp_NNI.h \
6 PPPedit.h \
7 PPPAuthedit.h \
8 PPPDNSedit.h \
9 PPPIPedit.h
10 SOURCES = ppp_NN.cpp \
11 ppp_NNI.cpp \
12 PPPedit.cpp \
13 PPPDNSedit.cpp \
14 PPPAuthedit.cpp \
15 ppprun.cpp \
16 PPPIPedit.cpp
17 INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2
18 DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2
19LIBS += -lqpe
20 INTERFACES= PPPGUI.ui PPPAuthGUI.ui PPPIPGUI.ui PPPDNSGUI.ui
21 TARGET = ppp
22 VERSION = 1.0.0
23
24include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/networksettings2/ppp/ppp_NN.cpp b/noncore/settings/networksettings2/ppp/ppp_NN.cpp
new file mode 100644
index 0000000..309c9a1
--- a/dev/null
+++ b/noncore/settings/networksettings2/ppp/ppp_NN.cpp
@@ -0,0 +1,62 @@
1#include "ppp_NN.h"
2#include "ppp_NNI.h"
3
4static const char * PPPNeeds[] =
5 { "line",
6 "modem",
7 0
8 };
9
10/**
11 * Constructor, find all of the possible interfaces
12 */
13PPPNetNode::PPPNetNode() : ANetNode() {
14}
15
16/**
17 * Delete any interfaces that we own.
18 */
19PPPNetNode::~PPPNetNode(){
20}
21
22const QString PPPNetNode::nodeDescription(){
23 return tr("\
24<p>Sets up IP using PPP.</p>\
25<p>Use this for dialup devices or serial setups</p>\
26"
27);
28}
29
30ANetNodeInstance * PPPNetNode::createInstance( void ) {
31 return new APPP( this );
32}
33
34const char ** PPPNetNode::needs( void ) {
35 return PPPNeeds;
36}
37
38const char * PPPNetNode::provides( void ) {
39 return "connection";
40}
41
42bool PPPNetNode::generateProperFilesFor(
43 ANetNodeInstance * ) {
44 return 1;
45}
46
47bool PPPNetNode::hasDataFor( const QString & ) {
48 return 0;
49}
50
51bool PPPNetNode::generateDataForCommonFile(
52 SystemFile & ,
53 long,
54 ANetNodeInstance * ) {
55 return 1;
56}
57
58extern "C" {
59void create_plugin( QList<ANetNode> & PNN ) {
60 PNN.append( new PPPNetNode() );
61}
62}
diff --git a/noncore/settings/networksettings2/ppp/ppp_NN.h b/noncore/settings/networksettings2/ppp/ppp_NN.h
new file mode 100644
index 0000000..a933523
--- a/dev/null
+++ b/noncore/settings/networksettings2/ppp/ppp_NN.h
@@ -0,0 +1,44 @@
1#ifndef PPP_NETNODE_H
2#define PPP_NETNODE_H
3
4#include "netnode.h"
5
6class APPP;
7
8class PPPNetNode : public ANetNode{
9
10 Q_OBJECT
11
12public:
13
14 PPPNetNode();
15 virtual ~PPPNetNode();
16
17 virtual const QString pixmapName()
18 { return "ppp"; }
19
20 virtual const QString nodeName()
21 { return tr("PPP Connection"); }
22
23 virtual const QString nodeDescription() ;
24
25 virtual ANetNodeInstance * createInstance( void );
26
27 virtual const char ** needs( void );
28 virtual const char * provides( void );
29
30 virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
31 virtual bool hasDataFor( const QString & S );
32 virtual bool generateDataForCommonFile(
33 SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
34
35private:
36
37};
38
39extern "C"
40{
41 void create_plugin( QList<ANetNode> & PNN );
42};
43
44#endif
diff --git a/noncore/settings/networksettings2/ppp/ppp_NNI.cpp b/noncore/settings/networksettings2/ppp/ppp_NNI.cpp
new file mode 100644
index 0000000..d09ecf9
--- a/dev/null
+++ b/noncore/settings/networksettings2/ppp/ppp_NNI.cpp
@@ -0,0 +1,115 @@
1#include "PPPedit.h"
2#include "ppp_NNI.h"
3#include "ppp_NN.h"
4
5APPP::APPP( PPPNetNode * PNN ) : ANetNodeInstance( PNN ) {
6 Data.DNS.ServerAssigned = 1;
7 Data.DNS.DomainName = "";
8
9 Data.Auth.Mode = 0;
10 Data.Auth.Login.Expect = "ogin:";
11 Data.Auth.Password.Expect = "assword:";
12 Data.Auth.PCEMode = 0;
13 Data.Auth.Client = "*";
14 Data.Auth.Server = "*";
15 Data.Auth.Secret = "";
16
17 Data.IP.IPAutomatic = 1;
18 Data.IP.IPAddress = "";
19 Data.IP.IPSubMask = "";
20 Data.IP.GWAutomatic = 1;
21 Data.IP.GWAddress = "";
22 Data.IP.GWIsDefault = 1;
23 GUI = 0;
24 RT = 0;
25
26}
27
28void APPP::setSpecificAttribute( QString & A, QString & V ) {
29 if( A.startsWith( "dns" ) ) {
30 if( A == "dnsserverassigned" ) {
31 Data.DNS.ServerAssigned = (V == "yes");
32 } else if( A == "dnsdomainname" ) {
33 Data.DNS.DomainName = V;
34 } else if( A == "dnsserver" ) {
35 Data.DNS.Servers.resize( Data.DNS.Servers.size()+1 );
36 Data.DNS.Servers[Data.DNS.Servers.size()-1] =
37 new QString( V );
38 }
39 } else if( A.startsWith( "auth" ) ) {
40 if( A == "authmode" ) {
41 Data.Auth.Mode = V.toShort();
42 } else if( A == "authloginexpect" ) {
43 Data.Auth.Login.Expect = V;
44 } else if( A == "authloginsend" ) {
45 Data.Auth.Login.Send = V;
46 } else if( A == "authpasswordexpect" ) {
47 Data.Auth.Password.Expect = V;
48 } else if( A == "authpasswordsend" ) {
49 Data.Auth.Password.Send = V;
50 } else if( A == "authpcemode" ) {
51 Data.Auth.PCEMode = V.toShort();
52 } else if( A == "authclient" ) {
53 Data.Auth.Client = V;
54 } else if( A == "authserver" ) {
55 Data.Auth.Server = V;
56 } else if( A == "authsecret" ) {
57 Data.Auth.Secret = V;
58 }
59 } else if( A.startsWith( "ip" ) ) {
60 if( A == "ipautomatic" ) {
61 Data.IP.IPAutomatic = (V == "yes");
62 } else if( A == "gwautomatic" ) {
63 Data.IP.GWAutomatic = (V == "yes");
64 } else if( A == "gwisdefault" ) {
65 Data.IP.GWIsDefault = (V == "yes");
66 } else if( A == "ipaddress" ) {
67 Data.IP.IPAddress = V;
68 } else if( A == "ipsubmask" ) {
69 Data.IP.IPSubMask = V;
70 } else if( A == "gwaddress" ) {
71 Data.IP.GWAddress = V;
72 }
73 }
74}
75
76void APPP::saveSpecificAttribute( QTextStream & TS ) {
77 TS << "dnsserverassigned=" <<
78 ( ( Data.DNS.ServerAssigned ) ? "yes" : "no" ) << endl;
79 TS << "dnsdomainname=" << Data.DNS.DomainName << endl;
80 for( unsigned int i = 0; i < Data.DNS.Servers.size(); i ++ ) {
81 TS << "dnsserver=" << *(Data.DNS.Servers[i]) << endl;
82 }
83 TS << "authmode=" << Data.Auth.Mode << endl;
84 TS << "authloginexpect=" << quote( Data.Auth.Login.Expect ) << endl;
85 TS << "authloginsend=" << quote( Data.Auth.Login.Send ) << endl;
86 TS << "authpasswordexpect=" << quote( Data.Auth.Password.Expect ) << endl;
87 TS << "authpasswordsend=" << quote( Data.Auth.Password.Send ) << endl;
88 TS << "authpcemode=" << Data.Auth.PCEMode << endl;
89 TS << "authclient=" << Data.Auth.Client << endl;
90 TS << "authserver=" << Data.Auth.Server << endl;
91 TS << "authsecret=" << quote( Data.Auth.Secret ) << endl;
92 TS << "ipautomatic=" << ( ( Data.IP.IPAutomatic ) ? "yes" : "no" ) << endl;
93 TS << "gwautomatic=" << ( ( Data.IP.GWAutomatic ) ? "yes" : "no" ) << endl;
94 TS << "gwisdefault=" << ( ( Data.IP.GWIsDefault ) ? "yes" : "no" ) << endl;
95 TS << "ipaddress=" << Data.IP.IPAddress << endl;
96 TS << "ipsubmask=" << Data.IP.IPSubMask << endl;
97 TS << "gwaddress=" << Data.IP.GWAddress << endl;
98}
99
100QWidget * APPP::edit( QWidget * parent ) {
101 GUI = new PPPEdit( parent );
102 GUI->showData( Data );
103 return GUI;
104}
105
106QString APPP::acceptable( void ) {
107 return ( GUI ) ? GUI->acceptable( ) : QString();
108}
109
110void APPP::commit( void ) {
111 if( GUI && GUI->commit( Data ) ) {
112 setModified( 1 );
113 }
114}
115
diff --git a/noncore/settings/networksettings2/ppp/ppp_NNI.h b/noncore/settings/networksettings2/ppp/ppp_NNI.h
new file mode 100644
index 0000000..08dca1d
--- a/dev/null
+++ b/noncore/settings/networksettings2/ppp/ppp_NNI.h
@@ -0,0 +1,43 @@
1#ifndef PPP_H
2#define PPP_H
3
4#include <netnode.h>
5#include "pppdata.h"
6#include "ppprun.h"
7
8class PPPNetNode;
9class PPPEdit;
10
11class APPP : public ANetNodeInstance {
12
13public :
14
15 APPP( PPPNetNode * PNN );
16
17 QWidget * edit( QWidget * parent );
18 QString acceptable( void );
19 void commit( void );
20
21 RuntimeInfo * runtime( void )
22 { if( RT == 0 )
23 RT = new PPPRun( this, Data );
24 return RT;
25 }
26
27 virtual void * data( void )
28 { return (void *)&Data; }
29
30protected :
31
32 virtual void setSpecificAttribute( QString & Attr, QString & Value );
33 virtual void saveSpecificAttribute( QTextStream & TS );
34
35private :
36
37 PPPEdit * GUI;
38 PPPData Data;
39 PPPRun * RT;
40
41};
42
43#endif
diff --git a/noncore/settings/networksettings2/ppp/pppdata.h b/noncore/settings/networksettings2/ppp/pppdata.h
new file mode 100644
index 0000000..9e8543c
--- a/dev/null
+++ b/noncore/settings/networksettings2/ppp/pppdata.h
@@ -0,0 +1,38 @@
1#ifndef PPP_DATA_H
2#define PPP_DATA_H
3
4#include <qstring.h>
5#include <qarray.h>
6
7typedef struct PPPData {
8 struct {
9 bool IPAutomatic;
10 QString IPAddress;
11 QString IPSubMask;
12 bool GWAutomatic;
13 QString GWAddress;
14 bool GWIsDefault;
15 } IP;
16 struct {
17 short Mode; // 0 login, 1 chap/pap, 2 Terminal
18 struct {
19 QString Expect;
20 QString Send;
21 } Login;
22 struct {
23 QString Expect;
24 QString Send;
25 } Password;
26 short PCEMode; // 0 pap, 1, chap 2, EAP
27 QString Server;
28 QString Client;
29 QString Secret;
30 } Auth;
31 struct {
32 bool ServerAssigned;
33 QString DomainName;
34 QArray<QString *> Servers;
35 } DNS;
36} PPPData_t;
37
38#endif
diff --git a/noncore/settings/networksettings2/ppp/ppprun.cpp b/noncore/settings/networksettings2/ppp/ppprun.cpp
new file mode 100644
index 0000000..8933f85
--- a/dev/null
+++ b/noncore/settings/networksettings2/ppp/ppprun.cpp
@@ -0,0 +1,77 @@
1#include <resources.h>
2#include "ppprun.h"
3
4void PPPRun::detectState( NodeCollection * NC ) {
5 if( isMyPPPDRunning( ) ) {
6 if( isMyPPPUp() ) {
7 NC->setCurrentState( IsUp );
8 } else {
9 NC->setCurrentState( Available );
10 }
11 } else {
12 NC->setCurrentState( Off ); // at least this
13 // but could also be unavailable
14 netNode()->nextNode()->runtime()->detectState( NC );
15 }
16}
17
18bool PPPRun::setState( NodeCollection * NC, Action_t A ) {
19 switch( A ) {
20 case Activate :
21 NC->setCurrentState( Available );
22 // no
23 break;
24 case Deactivate :
25 if( NC->currentState() == IsUp ) {
26 NC->state( Down );
27 }
28 // cannot really disable
29 NC->setCurrentState( Available );
30 break;
31 case Up :
32 if( NC->currentState() != IsUp ) {
33 // start my PPPD
34 NC->setCurrentState( IsUp );
35 }
36 break;
37 case Down :
38 if( NC->currentState() == IsUp ) {
39 // stop my PPPD
40 NC->setCurrentState( Available );
41 }
42 break;
43 default : // FT
44 break;
45 }
46 return 1;
47}
48
49bool PPPRun::isMyPPPDRunning( void ) {
50 return 0;
51}
52
53bool PPPRun::isMyPPPUp( void ) {
54 System & S = NSResources->system();
55 InterfaceInfo * best = 0, * Run;
56 QRegExp R( "ppp[0-9]" );
57
58 for( QDictIterator<InterfaceInfo> It(S.interfaces());
59 It.current();
60 ++It ) {
61 Run = It.current();
62 if( R.match( Run->Name ) >= 0 &&
63 Run->IsPointToPoint
64 ) {
65 // this is a LAN card
66 if( Run->assignedNode() == netNode() ) {
67 // assigned to us
68 return 1;
69 }
70 }
71 }
72 return 0;
73}
74
75bool PPPRun::handlesInterface( const QString & S ) {
76 return Pat.match( S ) >= 0;
77}
diff --git a/noncore/settings/networksettings2/profile/config.in b/noncore/settings/networksettings2/profile/config.in
new file mode 100644
index 0000000..0efa6a2
--- a/dev/null
+++ b/noncore/settings/networksettings2/profile/config.in
@@ -0,0 +1,4 @@
1 config NS2PROFILE
2 boolean "opie-networksettings2plugin-profiles (User profiles)"
3 default "n" if NS2
4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && NS2 && NS2CORE
diff --git a/noncore/settings/networksettings2/profile/profile.pro b/noncore/settings/networksettings2/profile/profile.pro
new file mode 100644
index 0000000..36a9012
--- a/dev/null
+++ b/noncore/settings/networksettings2/profile/profile.pro
@@ -0,0 +1,18 @@
1TEMPLATE = lib
2CONFIG += qt warn_on release
3DESTDIR = $(OPIEDIR)/plugins/networksettings2
4 HEADERS = profile_NN.h \
5 profile_NNI.h \
6 profileedit.h
7 SOURCES = profile_NN.cpp \
8 profile_NNI.cpp \
9 profileedit.cpp \
10 profilerun.cpp
11 INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2
12 DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2
13LIBS += -lqpe
14 INTERFACES= profileGUI.ui
15 TARGET = profile
16 VERSION = 1.0.0
17
18include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/networksettings2/profile/profileGUI.ui b/noncore/settings/networksettings2/profile/profileGUI.ui
new file mode 100644
index 0000000..365704b
--- a/dev/null
+++ b/noncore/settings/networksettings2/profile/profileGUI.ui
@@ -0,0 +1,1715 @@
1<!DOCTYPE UI><UI>
2<class>ProfileGUI</class>
3<widget>
4 <class>QWidget</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>Profile_FRM</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>225</width>
15 <height>301</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>Profile</string>
21 </property>
22 <property>
23 <name>layoutMargin</name>
24 </property>
25 <property>
26 <name>layoutSpacing</name>
27 </property>
28 <vbox>
29 <property stdset="1">
30 <name>margin</name>
31 <number>0</number>
32 </property>
33 <property stdset="1">
34 <name>spacing</name>
35 <number>0</number>
36 </property>
37 <widget>
38 <class>QTabWidget</class>
39 <property stdset="1">
40 <name>name</name>
41 <cstring>TabWidget6</cstring>
42 </property>
43 <property>
44 <name>layoutMargin</name>
45 </property>
46 <property>
47 <name>layoutSpacing</name>
48 </property>
49 <widget>
50 <class>QWidget</class>
51 <property stdset="1">
52 <name>name</name>
53 <cstring>tab</cstring>
54 </property>
55 <attribute>
56 <name>title</name>
57 <string>Setup</string>
58 </attribute>
59 <vbox>
60 <property stdset="1">
61 <name>margin</name>
62 <number>2</number>
63 </property>
64 <property stdset="1">
65 <name>spacing</name>
66 <number>0</number>
67 </property>
68 <widget>
69 <class>QCheckBox</class>
70 <property stdset="1">
71 <name>name</name>
72 <cstring>Automatic_CB</cstring>
73 </property>
74 <property stdset="1">
75 <name>text</name>
76 <string>Start automatically</string>
77 </property>
78 </widget>
79 <widget>
80 <class>QCheckBox</class>
81 <property stdset="1">
82 <name>name</name>
83 <cstring>Confirm_CB</cstring>
84 </property>
85 <property stdset="1">
86 <name>enabled</name>
87 <bool>true</bool>
88 </property>
89 <property stdset="1">
90 <name>text</name>
91 <string>Confirm before start</string>
92 </property>
93 <property>
94 <name>layoutMargin</name>
95 </property>
96 </widget>
97 <widget>
98 <class>QCheckBox</class>
99 <property stdset="1">
100 <name>name</name>
101 <cstring>Disabled_CB</cstring>
102 </property>
103 <property stdset="1">
104 <name>enabled</name>
105 <bool>true</bool>
106 </property>
107 <property stdset="1">
108 <name>text</name>
109 <string>Disabled</string>
110 </property>
111 <property>
112 <name>layoutMargin</name>
113 </property>
114 </widget>
115 <widget>
116 <class>QLabel</class>
117 <property stdset="1">
118 <name>name</name>
119 <cstring>TextLabel3</cstring>
120 </property>
121 <property stdset="1">
122 <name>text</name>
123 <string>Description</string>
124 </property>
125 </widget>
126 <widget>
127 <class>QMultiLineEdit</class>
128 <property stdset="1">
129 <name>name</name>
130 <cstring>Description_LE</cstring>
131 </property>
132 </widget>
133 </vbox>
134 </widget>
135 <widget>
136 <class>QWidget</class>
137 <property stdset="1">
138 <name>name</name>
139 <cstring>tab</cstring>
140 </property>
141 <attribute>
142 <name>title</name>
143 <string>State</string>
144 </attribute>
145 <vbox>
146 <property stdset="1">
147 <name>margin</name>
148 <number>0</number>
149 </property>
150 <property stdset="1">
151 <name>spacing</name>
152 <number>2</number>
153 </property>
154 <widget>
155 <class>QFrame</class>
156 <property stdset="1">
157 <name>name</name>
158 <cstring>Frame73</cstring>
159 </property>
160 <property stdset="1">
161 <name>sizePolicy</name>
162 <sizepolicy>
163 <hsizetype>7</hsizetype>
164 <vsizetype>5</vsizetype>
165 </sizepolicy>
166 </property>
167 <property stdset="1">
168 <name>frameShape</name>
169 <enum>NoFrame</enum>
170 </property>
171 <property stdset="1">
172 <name>frameShadow</name>
173 <enum>Plain</enum>
174 </property>
175 <property>
176 <name>layoutMargin</name>
177 </property>
178 <property>
179 <name>layoutSpacing</name>
180 </property>
181 <hbox>
182 <property stdset="1">
183 <name>margin</name>
184 <number>2</number>
185 </property>
186 <property stdset="1">
187 <name>spacing</name>
188 <number>0</number>
189 </property>
190 <widget>
191 <class>QLabel</class>
192 <property stdset="1">
193 <name>name</name>
194 <cstring>InterfaceName_LBL</cstring>
195 </property>
196 <property stdset="1">
197 <name>font</name>
198 <font>
199 <underline>1</underline>
200 </font>
201 </property>
202 <property stdset="1">
203 <name>text</name>
204 <string>eth0</string>
205 </property>
206 </widget>
207 <widget>
208 <class>QLabel</class>
209 <property stdset="1">
210 <name>name</name>
211 <cstring>InterfaceOptions_LBL</cstring>
212 </property>
213 <property stdset="1">
214 <name>sizePolicy</name>
215 <sizepolicy>
216 <hsizetype>7</hsizetype>
217 <vsizetype>1</vsizetype>
218 </sizepolicy>
219 </property>
220 <property stdset="1">
221 <name>font</name>
222 <font>
223 <underline>1</underline>
224 </font>
225 </property>
226 <property stdset="1">
227 <name>text</name>
228 <string>(Multicast, Up)</string>
229 </property>
230 <property stdset="1">
231 <name>indent</name>
232 <number>0</number>
233 </property>
234 </widget>
235 </hbox>
236 </widget>
237 <widget>
238 <class>QFrame</class>
239 <property stdset="1">
240 <name>name</name>
241 <cstring>Interface_GB</cstring>
242 </property>
243 <property stdset="1">
244 <name>enabled</name>
245 <bool>true</bool>
246 </property>
247 <property stdset="1">
248 <name>sizePolicy</name>
249 <sizepolicy>
250 <hsizetype>7</hsizetype>
251 <vsizetype>5</vsizetype>
252 </sizepolicy>
253 </property>
254 <property stdset="1">
255 <name>frameShape</name>
256 <enum>NoFrame</enum>
257 </property>
258 <property stdset="1">
259 <name>frameShadow</name>
260 <enum>Raised</enum>
261 </property>
262 <property>
263 <name>layoutMargin</name>
264 </property>
265 <property>
266 <name>layoutSpacing</name>
267 </property>
268 <grid>
269 <property stdset="1">
270 <name>margin</name>
271 <number>2</number>
272 </property>
273 <property stdset="1">
274 <name>spacing</name>
275 <number>1</number>
276 </property>
277 <widget row="0" column="2" >
278 <class>QLabel</class>
279 <property stdset="1">
280 <name>name</name>
281 <cstring>TextLabel4_2_3</cstring>
282 </property>
283 <property stdset="1">
284 <name>enabled</name>
285 <bool>true</bool>
286 </property>
287 <property stdset="1">
288 <name>sizePolicy</name>
289 <sizepolicy>
290 <hsizetype>0</hsizetype>
291 <vsizetype>1</vsizetype>
292 </sizepolicy>
293 </property>
294 <property stdset="1">
295 <name>frameShape</name>
296 <enum>NoFrame</enum>
297 </property>
298 <property stdset="1">
299 <name>frameShadow</name>
300 <enum>Raised</enum>
301 </property>
302 <property stdset="1">
303 <name>text</name>
304 <string>Subnet Mask</string>
305 </property>
306 </widget>
307 <widget row="0" column="3" >
308 <class>QLabel</class>
309 <property stdset="1">
310 <name>name</name>
311 <cstring>TextLabel1_3_3</cstring>
312 </property>
313 <property stdset="1">
314 <name>enabled</name>
315 <bool>true</bool>
316 </property>
317 <property stdset="1">
318 <name>sizePolicy</name>
319 <sizepolicy>
320 <hsizetype>0</hsizetype>
321 <vsizetype>1</vsizetype>
322 </sizepolicy>
323 </property>
324 <property stdset="1">
325 <name>frameShape</name>
326 <enum>NoFrame</enum>
327 </property>
328 <property stdset="1">
329 <name>frameShadow</name>
330 <enum>Raised</enum>
331 </property>
332 <property stdset="1">
333 <name>text</name>
334 <string>Broadcast</string>
335 </property>
336 </widget>
337 <widget row="3" column="0" >
338 <class>QLabel</class>
339 <property stdset="1">
340 <name>name</name>
341 <cstring>TextLabel1_5</cstring>
342 </property>
343 <property stdset="1">
344 <name>enabled</name>
345 <bool>true</bool>
346 </property>
347 <property stdset="1">
348 <name>sizePolicy</name>
349 <sizepolicy>
350 <hsizetype>1</hsizetype>
351 <vsizetype>1</vsizetype>
352 </sizepolicy>
353 </property>
354 <property stdset="1">
355 <name>text</name>
356 <string>MAC</string>
357 </property>
358 <property stdset="1">
359 <name>indent</name>
360 <number>0</number>
361 </property>
362 </widget>
363 <widget row="2" column="0" >
364 <class>QLabel</class>
365 <property stdset="1">
366 <name>name</name>
367 <cstring>TextLabel1_5_2</cstring>
368 </property>
369 <property stdset="1">
370 <name>enabled</name>
371 <bool>true</bool>
372 </property>
373 <property stdset="1">
374 <name>sizePolicy</name>
375 <sizepolicy>
376 <hsizetype>1</hsizetype>
377 <vsizetype>1</vsizetype>
378 </sizepolicy>
379 </property>
380 <property stdset="1">
381 <name>text</name>
382 <string>P-t-P</string>
383 </property>
384 <property stdset="1">
385 <name>indent</name>
386 <number>0</number>
387 </property>
388 </widget>
389 <widget row="0" column="0" rowspan="1" colspan="2" >
390 <class>QLabel</class>
391 <property stdset="1">
392 <name>name</name>
393 <cstring>TextLabel3_2_3</cstring>
394 </property>
395 <property stdset="1">
396 <name>enabled</name>
397 <bool>true</bool>
398 </property>
399 <property stdset="1">
400 <name>sizePolicy</name>
401 <sizepolicy>
402 <hsizetype>0</hsizetype>
403 <vsizetype>1</vsizetype>
404 </sizepolicy>
405 </property>
406 <property stdset="1">
407 <name>text</name>
408 <string>IP Address</string>
409 </property>
410 </widget>
411 <widget row="1" column="0" rowspan="1" colspan="2" >
412 <class>QLabel</class>
413 <property stdset="1">
414 <name>name</name>
415 <cstring>IPAddress_LBL</cstring>
416 </property>
417 <property stdset="1">
418 <name>enabled</name>
419 <bool>true</bool>
420 </property>
421 <property stdset="1">
422 <name>sizePolicy</name>
423 <sizepolicy>
424 <hsizetype>7</hsizetype>
425 <vsizetype>1</vsizetype>
426 </sizepolicy>
427 </property>
428 <property stdset="1">
429 <name>frameShape</name>
430 <enum>Panel</enum>
431 </property>
432 <property stdset="1">
433 <name>frameShadow</name>
434 <enum>Sunken</enum>
435 </property>
436 <property stdset="1">
437 <name>text</name>
438 <string>0.0.0.0</string>
439 </property>
440 <property stdset="1">
441 <name>alignment</name>
442 <set>AlignCenter</set>
443 </property>
444 <property stdset="1">
445 <name>indent</name>
446 <number>0</number>
447 </property>
448 <property>
449 <name>hAlign</name>
450 </property>
451 </widget>
452 <widget row="1" column="2" >
453 <class>QLabel</class>
454 <property stdset="1">
455 <name>name</name>
456 <cstring>SubnetMask_LBL</cstring>
457 </property>
458 <property stdset="1">
459 <name>enabled</name>
460 <bool>true</bool>
461 </property>
462 <property stdset="1">
463 <name>sizePolicy</name>
464 <sizepolicy>
465 <hsizetype>7</hsizetype>
466 <vsizetype>1</vsizetype>
467 </sizepolicy>
468 </property>
469 <property stdset="1">
470 <name>frameShape</name>
471 <enum>Panel</enum>
472 </property>
473 <property stdset="1">
474 <name>frameShadow</name>
475 <enum>Sunken</enum>
476 </property>
477 <property stdset="1">
478 <name>text</name>
479 <string>0.0.0.0</string>
480 </property>
481 <property stdset="1">
482 <name>alignment</name>
483 <set>AlignCenter</set>
484 </property>
485 <property stdset="1">
486 <name>indent</name>
487 <number>0</number>
488 </property>
489 <property>
490 <name>hAlign</name>
491 </property>
492 </widget>
493 <widget row="1" column="3" >
494 <class>QLabel</class>
495 <property stdset="1">
496 <name>name</name>
497 <cstring>Broadcast_LBL</cstring>
498 </property>
499 <property stdset="1">
500 <name>enabled</name>
501 <bool>true</bool>
502 </property>
503 <property stdset="1">
504 <name>sizePolicy</name>
505 <sizepolicy>
506 <hsizetype>7</hsizetype>
507 <vsizetype>1</vsizetype>
508 </sizepolicy>
509 </property>
510 <property stdset="1">
511 <name>frameShape</name>
512 <enum>StyledPanel</enum>
513 </property>
514 <property stdset="1">
515 <name>frameShadow</name>
516 <enum>Sunken</enum>
517 </property>
518 <property stdset="1">
519 <name>alignment</name>
520 <set>AlignCenter</set>
521 </property>
522 <property stdset="1">
523 <name>indent</name>
524 <number>0</number>
525 </property>
526 <property>
527 <name>hAlign</name>
528 </property>
529 </widget>
530 <widget row="2" column="1" rowspan="1" colspan="3" >
531 <class>QLabel</class>
532 <property stdset="1">
533 <name>name</name>
534 <cstring>PointToPoint_LBL</cstring>
535 </property>
536 <property stdset="1">
537 <name>enabled</name>
538 <bool>true</bool>
539 </property>
540 <property stdset="1">
541 <name>sizePolicy</name>
542 <sizepolicy>
543 <hsizetype>5</hsizetype>
544 <vsizetype>0</vsizetype>
545 </sizepolicy>
546 </property>
547 <property stdset="1">
548 <name>frameShape</name>
549 <enum>Panel</enum>
550 </property>
551 <property stdset="1">
552 <name>frameShadow</name>
553 <enum>Sunken</enum>
554 </property>
555 <property stdset="1">
556 <name>indent</name>
557 <number>0</number>
558 </property>
559 </widget>
560 <widget row="3" column="1" rowspan="1" colspan="3" >
561 <class>QLabel</class>
562 <property stdset="1">
563 <name>name</name>
564 <cstring>MACAddress_LBL</cstring>
565 </property>
566 <property stdset="1">
567 <name>enabled</name>
568 <bool>true</bool>
569 </property>
570 <property stdset="1">
571 <name>sizePolicy</name>
572 <sizepolicy>
573 <hsizetype>5</hsizetype>
574 <vsizetype>0</vsizetype>
575 </sizepolicy>
576 </property>
577 <property stdset="1">
578 <name>frameShape</name>
579 <enum>Panel</enum>
580 </property>
581 <property stdset="1">
582 <name>frameShadow</name>
583 <enum>Sunken</enum>
584 </property>
585 <property stdset="1">
586 <name>text</name>
587 <string>00:00:00:00:00:00</string>
588 </property>
589 <property stdset="1">
590 <name>indent</name>
591 <number>0</number>
592 </property>
593 </widget>
594 </grid>
595 </widget>
596 <widget>
597 <class>QLabel</class>
598 <property stdset="1">
599 <name>name</name>
600 <cstring>TextLabel2_2</cstring>
601 </property>
602 <property stdset="1">
603 <name>font</name>
604 <font>
605 <underline>1</underline>
606 </font>
607 </property>
608 <property stdset="1">
609 <name>frameShape</name>
610 <enum>NoFrame</enum>
611 </property>
612 <property stdset="1">
613 <name>margin</name>
614 <number>1</number>
615 </property>
616 <property stdset="1">
617 <name>text</name>
618 <string>DHCP</string>
619 </property>
620 <property stdset="1">
621 <name>indent</name>
622 <number>0</number>
623 </property>
624 </widget>
625 <widget>
626 <class>QFrame</class>
627 <property stdset="1">
628 <name>name</name>
629 <cstring>DHCP_GB</cstring>
630 </property>
631 <property stdset="1">
632 <name>sizePolicy</name>
633 <sizepolicy>
634 <hsizetype>7</hsizetype>
635 <vsizetype>5</vsizetype>
636 </sizepolicy>
637 </property>
638 <property stdset="1">
639 <name>frameShape</name>
640 <enum>NoFrame</enum>
641 </property>
642 <property stdset="1">
643 <name>frameShadow</name>
644 <enum>Raised</enum>
645 </property>
646 <property>
647 <name>layoutMargin</name>
648 </property>
649 <property>
650 <name>layoutSpacing</name>
651 </property>
652 <grid>
653 <property stdset="1">
654 <name>margin</name>
655 <number>2</number>
656 </property>
657 <property stdset="1">
658 <name>spacing</name>
659 <number>1</number>
660 </property>
661 <widget row="2" column="0" >
662 <class>QLabel</class>
663 <property stdset="1">
664 <name>name</name>
665 <cstring>TextLabel9_3</cstring>
666 </property>
667 <property stdset="1">
668 <name>enabled</name>
669 <bool>true</bool>
670 </property>
671 <property stdset="1">
672 <name>sizePolicy</name>
673 <sizepolicy>
674 <hsizetype>1</hsizetype>
675 <vsizetype>1</vsizetype>
676 </sizepolicy>
677 </property>
678 <property stdset="1">
679 <name>text</name>
680 <string>Lease Expires</string>
681 </property>
682 </widget>
683 <widget row="1" column="0" >
684 <class>QLabel</class>
685 <property stdset="1">
686 <name>name</name>
687 <cstring>TextLabel8_3</cstring>
688 </property>
689 <property stdset="1">
690 <name>enabled</name>
691 <bool>true</bool>
692 </property>
693 <property stdset="1">
694 <name>sizePolicy</name>
695 <sizepolicy>
696 <hsizetype>0</hsizetype>
697 <vsizetype>1</vsizetype>
698 </sizepolicy>
699 </property>
700 <property stdset="1">
701 <name>text</name>
702 <string>Lease Obtained</string>
703 </property>
704 </widget>
705 <widget row="0" column="1" >
706 <class>QLabel</class>
707 <property stdset="1">
708 <name>name</name>
709 <cstring>DHCPServer_LBL</cstring>
710 </property>
711 <property stdset="1">
712 <name>enabled</name>
713 <bool>true</bool>
714 </property>
715 <property stdset="1">
716 <name>sizePolicy</name>
717 <sizepolicy>
718 <hsizetype>5</hsizetype>
719 <vsizetype>1</vsizetype>
720 </sizepolicy>
721 </property>
722 <property stdset="1">
723 <name>frameShape</name>
724 <enum>Panel</enum>
725 </property>
726 <property stdset="1">
727 <name>frameShadow</name>
728 <enum>Sunken</enum>
729 </property>
730 <property stdset="1">
731 <name>text</name>
732 <string></string>
733 </property>
734 <property stdset="1">
735 <name>indent</name>
736 <number>0</number>
737 </property>
738 </widget>
739 <widget row="1" column="1" >
740 <class>QLabel</class>
741 <property stdset="1">
742 <name>name</name>
743 <cstring>LeaseObtained_LBL</cstring>
744 </property>
745 <property stdset="1">
746 <name>enabled</name>
747 <bool>true</bool>
748 </property>
749 <property stdset="1">
750 <name>sizePolicy</name>
751 <sizepolicy>
752 <hsizetype>5</hsizetype>
753 <vsizetype>1</vsizetype>
754 </sizepolicy>
755 </property>
756 <property stdset="1">
757 <name>minimumSize</name>
758 <size>
759 <width>94</width>
760 <height>0</height>
761 </size>
762 </property>
763 <property stdset="1">
764 <name>frameShape</name>
765 <enum>Panel</enum>
766 </property>
767 <property stdset="1">
768 <name>frameShadow</name>
769 <enum>Sunken</enum>
770 </property>
771 <property stdset="1">
772 <name>text</name>
773 <string></string>
774 </property>
775 <property stdset="1">
776 <name>indent</name>
777 <number>0</number>
778 </property>
779 </widget>
780 <widget row="2" column="1" >
781 <class>QLabel</class>
782 <property stdset="1">
783 <name>name</name>
784 <cstring>LeaseExpires_LBL</cstring>
785 </property>
786 <property stdset="1">
787 <name>enabled</name>
788 <bool>true</bool>
789 </property>
790 <property stdset="1">
791 <name>sizePolicy</name>
792 <sizepolicy>
793 <hsizetype>5</hsizetype>
794 <vsizetype>1</vsizetype>
795 </sizepolicy>
796 </property>
797 <property stdset="1">
798 <name>frameShape</name>
799 <enum>Panel</enum>
800 </property>
801 <property stdset="1">
802 <name>frameShadow</name>
803 <enum>Sunken</enum>
804 </property>
805 <property stdset="1">
806 <name>text</name>
807 <string></string>
808 </property>
809 <property stdset="1">
810 <name>indent</name>
811 <number>0</number>
812 </property>
813 </widget>
814 <widget row="0" column="0" >
815 <class>QLabel</class>
816 <property stdset="1">
817 <name>name</name>
818 <cstring>TextLabel6_3</cstring>
819 </property>
820 <property stdset="1">
821 <name>enabled</name>
822 <bool>true</bool>
823 </property>
824 <property stdset="1">
825 <name>sizePolicy</name>
826 <sizepolicy>
827 <hsizetype>1</hsizetype>
828 <vsizetype>1</vsizetype>
829 </sizepolicy>
830 </property>
831 <property stdset="1">
832 <name>text</name>
833 <string>DHCP Server</string>
834 </property>
835 </widget>
836 </grid>
837 </widget>
838 <spacer>
839 <property>
840 <name>name</name>
841 <cstring>Spacer16</cstring>
842 </property>
843 <property stdset="1">
844 <name>orientation</name>
845 <enum>Vertical</enum>
846 </property>
847 <property stdset="1">
848 <name>sizeType</name>
849 <enum>Expanding</enum>
850 </property>
851 <property>
852 <name>sizeHint</name>
853 <size>
854 <width>20</width>
855 <height>20</height>
856 </size>
857 </property>
858 </spacer>
859 </vbox>
860 </widget>
861 <widget>
862 <class>QWidget</class>
863 <property stdset="1">
864 <name>name</name>
865 <cstring>tab</cstring>
866 </property>
867 <attribute>
868 <name>title</name>
869 <string>Traffic</string>
870 </attribute>
871 <vbox>
872 <property stdset="1">
873 <name>margin</name>
874 <number>0</number>
875 </property>
876 <property stdset="1">
877 <name>spacing</name>
878 <number>0</number>
879 </property>
880 <widget>
881 <class>QLayoutWidget</class>
882 <property stdset="1">
883 <name>name</name>
884 <cstring>Layout5</cstring>
885 </property>
886 <hbox>
887 <property stdset="1">
888 <name>margin</name>
889 <number>0</number>
890 </property>
891 <property stdset="1">
892 <name>spacing</name>
893 <number>6</number>
894 </property>
895 <widget>
896 <class>QLabel</class>
897 <property stdset="1">
898 <name>name</name>
899 <cstring>TextLabel1_2</cstring>
900 </property>
901 <property stdset="1">
902 <name>sizePolicy</name>
903 <sizepolicy>
904 <hsizetype>0</hsizetype>
905 <vsizetype>1</vsizetype>
906 </sizepolicy>
907 </property>
908 <property stdset="1">
909 <name>text</name>
910 <string>Receiving</string>
911 </property>
912 </widget>
913 <spacer>
914 <property>
915 <name>name</name>
916 <cstring>Spacer17_2</cstring>
917 </property>
918 <property stdset="1">
919 <name>orientation</name>
920 <enum>Horizontal</enum>
921 </property>
922 <property stdset="1">
923 <name>sizeType</name>
924 <enum>Expanding</enum>
925 </property>
926 <property>
927 <name>sizeHint</name>
928 <size>
929 <width>20</width>
930 <height>20</height>
931 </size>
932 </property>
933 </spacer>
934 </hbox>
935 </widget>
936 <widget>
937 <class>QLayoutWidget</class>
938 <property stdset="1">
939 <name>name</name>
940 <cstring>Layout43</cstring>
941 </property>
942 <property>
943 <name>layoutMargin</name>
944 </property>
945 <property>
946 <name>layoutSpacing</name>
947 </property>
948 <hbox>
949 <property stdset="1">
950 <name>margin</name>
951 <number>2</number>
952 </property>
953 <property stdset="1">
954 <name>spacing</name>
955 <number>0</number>
956 </property>
957 <widget>
958 <class>QFrame</class>
959 <property stdset="1">
960 <name>name</name>
961 <cstring>Frame114</cstring>
962 </property>
963 <property stdset="1">
964 <name>sizePolicy</name>
965 <sizepolicy>
966 <hsizetype>0</hsizetype>
967 <vsizetype>5</vsizetype>
968 </sizepolicy>
969 </property>
970 <property stdset="1">
971 <name>minimumSize</name>
972 <size>
973 <width>5</width>
974 <height>0</height>
975 </size>
976 </property>
977 <property stdset="1">
978 <name>maximumSize</name>
979 <size>
980 <width>5</width>
981 <height>32767</height>
982 </size>
983 </property>
984 <property stdset="1">
985 <name>frameShape</name>
986 <enum>NoFrame</enum>
987 </property>
988 <property stdset="1">
989 <name>frameShadow</name>
990 <enum>Raised</enum>
991 </property>
992 </widget>
993 <widget>
994 <class>QFrame</class>
995 <property stdset="1">
996 <name>name</name>
997 <cstring>Rcv_GB</cstring>
998 </property>
999 <property stdset="1">
1000 <name>enabled</name>
1001 <bool>false</bool>
1002 </property>
1003 <property stdset="1">
1004 <name>sizePolicy</name>
1005 <sizepolicy>
1006 <hsizetype>7</hsizetype>
1007 <vsizetype>5</vsizetype>
1008 </sizepolicy>
1009 </property>
1010 <property stdset="1">
1011 <name>frameShape</name>
1012 <enum>NoFrame</enum>
1013 </property>
1014 <property stdset="1">
1015 <name>frameShadow</name>
1016 <enum>Raised</enum>
1017 </property>
1018 <property>
1019 <name>layoutMargin</name>
1020 </property>
1021 <property>
1022 <name>layoutSpacing</name>
1023 </property>
1024 <grid>
1025 <property stdset="1">
1026 <name>margin</name>
1027 <number>0</number>
1028 </property>
1029 <property stdset="1">
1030 <name>spacing</name>
1031 <number>1</number>
1032 </property>
1033 <widget row="1" column="0" >
1034 <class>QLabel</class>
1035 <property stdset="1">
1036 <name>name</name>
1037 <cstring>TextLabel1_5_9</cstring>
1038 </property>
1039 <property stdset="1">
1040 <name>text</name>
1041 <string>Errors</string>
1042 </property>
1043 </widget>
1044 <widget row="0" column="1" rowspan="1" colspan="3" >
1045 <class>QLabel</class>
1046 <property stdset="1">
1047 <name>name</name>
1048 <cstring>RcvBytes_LBL</cstring>
1049 </property>
1050 <property stdset="1">
1051 <name>sizePolicy</name>
1052 <sizepolicy>
1053 <hsizetype>7</hsizetype>
1054 <vsizetype>1</vsizetype>
1055 </sizepolicy>
1056 </property>
1057 <property stdset="1">
1058 <name>frameShape</name>
1059 <enum>Panel</enum>
1060 </property>
1061 <property stdset="1">
1062 <name>frameShadow</name>
1063 <enum>Sunken</enum>
1064 </property>
1065 <property stdset="1">
1066 <name>indent</name>
1067 <number>0</number>
1068 </property>
1069 </widget>
1070 <widget row="1" column="3" >
1071 <class>QLabel</class>
1072 <property stdset="1">
1073 <name>name</name>
1074 <cstring>RcvDropped_LBL</cstring>
1075 </property>
1076 <property stdset="1">
1077 <name>sizePolicy</name>
1078 <sizepolicy>
1079 <hsizetype>7</hsizetype>
1080 <vsizetype>1</vsizetype>
1081 </sizepolicy>
1082 </property>
1083 <property stdset="1">
1084 <name>frameShape</name>
1085 <enum>Panel</enum>
1086 </property>
1087 <property stdset="1">
1088 <name>frameShadow</name>
1089 <enum>Sunken</enum>
1090 </property>
1091 <property stdset="1">
1092 <name>indent</name>
1093 <number>0</number>
1094 </property>
1095 </widget>
1096 <widget row="1" column="1" >
1097 <class>QLabel</class>
1098 <property stdset="1">
1099 <name>name</name>
1100 <cstring>RcvErrors_LBL</cstring>
1101 </property>
1102 <property stdset="1">
1103 <name>sizePolicy</name>
1104 <sizepolicy>
1105 <hsizetype>7</hsizetype>
1106 <vsizetype>1</vsizetype>
1107 </sizepolicy>
1108 </property>
1109 <property stdset="1">
1110 <name>frameShape</name>
1111 <enum>Panel</enum>
1112 </property>
1113 <property stdset="1">
1114 <name>frameShadow</name>
1115 <enum>Sunken</enum>
1116 </property>
1117 <property stdset="1">
1118 <name>indent</name>
1119 <number>0</number>
1120 </property>
1121 </widget>
1122 <widget row="1" column="2" >
1123 <class>QLabel</class>
1124 <property stdset="1">
1125 <name>name</name>
1126 <cstring>TextLabel1_5_4</cstring>
1127 </property>
1128 <property stdset="1">
1129 <name>text</name>
1130 <string>Dropped</string>
1131 </property>
1132 </widget>
1133 <widget row="0" column="0" >
1134 <class>QLabel</class>
1135 <property stdset="1">
1136 <name>name</name>
1137 <cstring>TextLabel1_5_3</cstring>
1138 </property>
1139 <property stdset="1">
1140 <name>text</name>
1141 <string>Bytes</string>
1142 </property>
1143 </widget>
1144 </grid>
1145 </widget>
1146 </hbox>
1147 </widget>
1148 <widget>
1149 <class>QLayoutWidget</class>
1150 <property stdset="1">
1151 <name>name</name>
1152 <cstring>Layout6</cstring>
1153 </property>
1154 <hbox>
1155 <property stdset="1">
1156 <name>margin</name>
1157 <number>0</number>
1158 </property>
1159 <property stdset="1">
1160 <name>spacing</name>
1161 <number>6</number>
1162 </property>
1163 <widget>
1164 <class>QLabel</class>
1165 <property stdset="1">
1166 <name>name</name>
1167 <cstring>TextLabel1</cstring>
1168 </property>
1169 <property stdset="1">
1170 <name>sizePolicy</name>
1171 <sizepolicy>
1172 <hsizetype>0</hsizetype>
1173 <vsizetype>1</vsizetype>
1174 </sizepolicy>
1175 </property>
1176 <property stdset="1">
1177 <name>text</name>
1178 <string>Transmitting</string>
1179 </property>
1180 </widget>
1181 <spacer>
1182 <property>
1183 <name>name</name>
1184 <cstring>Spacer18_2</cstring>
1185 </property>
1186 <property stdset="1">
1187 <name>orientation</name>
1188 <enum>Horizontal</enum>
1189 </property>
1190 <property stdset="1">
1191 <name>sizeType</name>
1192 <enum>Expanding</enum>
1193 </property>
1194 <property>
1195 <name>sizeHint</name>
1196 <size>
1197 <width>20</width>
1198 <height>20</height>
1199 </size>
1200 </property>
1201 </spacer>
1202 </hbox>
1203 </widget>
1204 <widget>
1205 <class>QLayoutWidget</class>
1206 <property stdset="1">
1207 <name>name</name>
1208 <cstring>Layout44</cstring>
1209 </property>
1210 <property>
1211 <name>layoutMargin</name>
1212 </property>
1213 <property>
1214 <name>layoutSpacing</name>
1215 </property>
1216 <hbox>
1217 <property stdset="1">
1218 <name>margin</name>
1219 <number>2</number>
1220 </property>
1221 <property stdset="1">
1222 <name>spacing</name>
1223 <number>0</number>
1224 </property>
1225 <widget>
1226 <class>QFrame</class>
1227 <property stdset="1">
1228 <name>name</name>
1229 <cstring>Frame115</cstring>
1230 </property>
1231 <property stdset="1">
1232 <name>sizePolicy</name>
1233 <sizepolicy>
1234 <hsizetype>0</hsizetype>
1235 <vsizetype>5</vsizetype>
1236 </sizepolicy>
1237 </property>
1238 <property stdset="1">
1239 <name>minimumSize</name>
1240 <size>
1241 <width>5</width>
1242 <height>0</height>
1243 </size>
1244 </property>
1245 <property stdset="1">
1246 <name>maximumSize</name>
1247 <size>
1248 <width>5</width>
1249 <height>32767</height>
1250 </size>
1251 </property>
1252 <property stdset="1">
1253 <name>frameShape</name>
1254 <enum>NoFrame</enum>
1255 </property>
1256 <property stdset="1">
1257 <name>frameShadow</name>
1258 <enum>Plain</enum>
1259 </property>
1260 </widget>
1261 <widget>
1262 <class>QFrame</class>
1263 <property stdset="1">
1264 <name>name</name>
1265 <cstring>Snd_GB</cstring>
1266 </property>
1267 <property stdset="1">
1268 <name>enabled</name>
1269 <bool>false</bool>
1270 </property>
1271 <property stdset="1">
1272 <name>sizePolicy</name>
1273 <sizepolicy>
1274 <hsizetype>7</hsizetype>
1275 <vsizetype>5</vsizetype>
1276 </sizepolicy>
1277 </property>
1278 <property stdset="1">
1279 <name>frameShape</name>
1280 <enum>NoFrame</enum>
1281 </property>
1282 <property stdset="1">
1283 <name>frameShadow</name>
1284 <enum>Raised</enum>
1285 </property>
1286 <property>
1287 <name>layoutMargin</name>
1288 </property>
1289 <property>
1290 <name>layoutSpacing</name>
1291 </property>
1292 <grid>
1293 <property stdset="1">
1294 <name>margin</name>
1295 <number>0</number>
1296 </property>
1297 <property stdset="1">
1298 <name>spacing</name>
1299 <number>1</number>
1300 </property>
1301 <widget row="1" column="0" >
1302 <class>QLabel</class>
1303 <property stdset="1">
1304 <name>name</name>
1305 <cstring>TextLabel1_5_9_2</cstring>
1306 </property>
1307 <property stdset="1">
1308 <name>text</name>
1309 <string>Errors</string>
1310 </property>
1311 </widget>
1312 <widget row="1" column="2" >
1313 <class>QLabel</class>
1314 <property stdset="1">
1315 <name>name</name>
1316 <cstring>TextLabel1_5_4_2</cstring>
1317 </property>
1318 <property stdset="1">
1319 <name>text</name>
1320 <string>Dropped</string>
1321 </property>
1322 </widget>
1323 <widget row="0" column="0" >
1324 <class>QLabel</class>
1325 <property stdset="1">
1326 <name>name</name>
1327 <cstring>TextLabel1_5_3_2</cstring>
1328 </property>
1329 <property stdset="1">
1330 <name>text</name>
1331 <string>Bytes</string>
1332 </property>
1333 </widget>
1334 <widget row="1" column="3" >
1335 <class>QLabel</class>
1336 <property stdset="1">
1337 <name>name</name>
1338 <cstring>SndDropped_LBL</cstring>
1339 </property>
1340 <property stdset="1">
1341 <name>sizePolicy</name>
1342 <sizepolicy>
1343 <hsizetype>7</hsizetype>
1344 <vsizetype>1</vsizetype>
1345 </sizepolicy>
1346 </property>
1347 <property stdset="1">
1348 <name>frameShape</name>
1349 <enum>Panel</enum>
1350 </property>
1351 <property stdset="1">
1352 <name>frameShadow</name>
1353 <enum>Sunken</enum>
1354 </property>
1355 <property stdset="1">
1356 <name>indent</name>
1357 <number>0</number>
1358 </property>
1359 </widget>
1360 <widget row="1" column="1" >
1361 <class>QLabel</class>
1362 <property stdset="1">
1363 <name>name</name>
1364 <cstring>SndErrors_LBL</cstring>
1365 </property>
1366 <property stdset="1">
1367 <name>sizePolicy</name>
1368 <sizepolicy>
1369 <hsizetype>7</hsizetype>
1370 <vsizetype>1</vsizetype>
1371 </sizepolicy>
1372 </property>
1373 <property stdset="1">
1374 <name>frameShape</name>
1375 <enum>Panel</enum>
1376 </property>
1377 <property stdset="1">
1378 <name>frameShadow</name>
1379 <enum>Sunken</enum>
1380 </property>
1381 <property stdset="1">
1382 <name>indent</name>
1383 <number>0</number>
1384 </property>
1385 </widget>
1386 <widget row="0" column="1" rowspan="1" colspan="3" >
1387 <class>QLabel</class>
1388 <property stdset="1">
1389 <name>name</name>
1390 <cstring>SndBytes_LBL</cstring>
1391 </property>
1392 <property stdset="1">
1393 <name>sizePolicy</name>
1394 <sizepolicy>
1395 <hsizetype>7</hsizetype>
1396 <vsizetype>1</vsizetype>
1397 </sizepolicy>
1398 </property>
1399 <property stdset="1">
1400 <name>frameShape</name>
1401 <enum>Panel</enum>
1402 </property>
1403 <property stdset="1">
1404 <name>frameShadow</name>
1405 <enum>Sunken</enum>
1406 </property>
1407 <property stdset="1">
1408 <name>indent</name>
1409 <number>0</number>
1410 </property>
1411 </widget>
1412 </grid>
1413 </widget>
1414 </hbox>
1415 </widget>
1416 <widget>
1417 <class>QLayoutWidget</class>
1418 <property stdset="1">
1419 <name>name</name>
1420 <cstring>Layout7</cstring>
1421 </property>
1422 <hbox>
1423 <property stdset="1">
1424 <name>margin</name>
1425 <number>0</number>
1426 </property>
1427 <property stdset="1">
1428 <name>spacing</name>
1429 <number>6</number>
1430 </property>
1431 <widget>
1432 <class>QLabel</class>
1433 <property stdset="1">
1434 <name>name</name>
1435 <cstring>TextLabel1_3</cstring>
1436 </property>
1437 <property stdset="1">
1438 <name>sizePolicy</name>
1439 <sizepolicy>
1440 <hsizetype>0</hsizetype>
1441 <vsizetype>1</vsizetype>
1442 </sizepolicy>
1443 </property>
1444 <property stdset="1">
1445 <name>text</name>
1446 <string>Others</string>
1447 </property>
1448 </widget>
1449 <spacer>
1450 <property>
1451 <name>name</name>
1452 <cstring>Spacer19</cstring>
1453 </property>
1454 <property stdset="1">
1455 <name>orientation</name>
1456 <enum>Horizontal</enum>
1457 </property>
1458 <property stdset="1">
1459 <name>sizeType</name>
1460 <enum>Expanding</enum>
1461 </property>
1462 <property>
1463 <name>sizeHint</name>
1464 <size>
1465 <width>20</width>
1466 <height>20</height>
1467 </size>
1468 </property>
1469 </spacer>
1470 </hbox>
1471 </widget>
1472 <widget>
1473 <class>QLayoutWidget</class>
1474 <property stdset="1">
1475 <name>name</name>
1476 <cstring>Layout45</cstring>
1477 </property>
1478 <property>
1479 <name>layoutMargin</name>
1480 </property>
1481 <property>
1482 <name>layoutSpacing</name>
1483 </property>
1484 <hbox>
1485 <property stdset="1">
1486 <name>margin</name>
1487 <number>2</number>
1488 </property>
1489 <property stdset="1">
1490 <name>spacing</name>
1491 <number>0</number>
1492 </property>
1493 <widget>
1494 <class>QFrame</class>
1495 <property stdset="1">
1496 <name>name</name>
1497 <cstring>Frame116</cstring>
1498 </property>
1499 <property stdset="1">
1500 <name>sizePolicy</name>
1501 <sizepolicy>
1502 <hsizetype>0</hsizetype>
1503 <vsizetype>5</vsizetype>
1504 </sizepolicy>
1505 </property>
1506 <property stdset="1">
1507 <name>minimumSize</name>
1508 <size>
1509 <width>5</width>
1510 <height>0</height>
1511 </size>
1512 </property>
1513 <property stdset="1">
1514 <name>maximumSize</name>
1515 <size>
1516 <width>5</width>
1517 <height>32767</height>
1518 </size>
1519 </property>
1520 <property stdset="1">
1521 <name>frameShape</name>
1522 <enum>NoFrame</enum>
1523 </property>
1524 <property stdset="1">
1525 <name>frameShadow</name>
1526 <enum>Raised</enum>
1527 </property>
1528 </widget>
1529 <widget>
1530 <class>QFrame</class>
1531 <property stdset="1">
1532 <name>name</name>
1533 <cstring>Collisions_FRM</cstring>
1534 </property>
1535 <property stdset="1">
1536 <name>enabled</name>
1537 <bool>false</bool>
1538 </property>
1539 <property stdset="1">
1540 <name>sizePolicy</name>
1541 <sizepolicy>
1542 <hsizetype>7</hsizetype>
1543 <vsizetype>5</vsizetype>
1544 </sizepolicy>
1545 </property>
1546 <property stdset="1">
1547 <name>frameShape</name>
1548 <enum>NoFrame</enum>
1549 </property>
1550 <property stdset="1">
1551 <name>frameShadow</name>
1552 <enum>Raised</enum>
1553 </property>
1554 <property>
1555 <name>layoutMargin</name>
1556 </property>
1557 <property>
1558 <name>layoutSpacing</name>
1559 </property>
1560 <hbox>
1561 <property stdset="1">
1562 <name>margin</name>
1563 <number>0</number>
1564 </property>
1565 <property stdset="1">
1566 <name>spacing</name>
1567 <number>2</number>
1568 </property>
1569 <widget>
1570 <class>QLabel</class>
1571 <property stdset="1">
1572 <name>name</name>
1573 <cstring>TextLabel1_5_3_3</cstring>
1574 </property>
1575 <property stdset="1">
1576 <name>text</name>
1577 <string>Collisions</string>
1578 </property>
1579 </widget>
1580 <widget>
1581 <class>QLabel</class>
1582 <property stdset="1">
1583 <name>name</name>
1584 <cstring>Collisions_LBL</cstring>
1585 </property>
1586 <property stdset="1">
1587 <name>sizePolicy</name>
1588 <sizepolicy>
1589 <hsizetype>7</hsizetype>
1590 <vsizetype>1</vsizetype>
1591 </sizepolicy>
1592 </property>
1593 <property stdset="1">
1594 <name>frameShape</name>
1595 <enum>Panel</enum>
1596 </property>
1597 <property stdset="1">
1598 <name>frameShadow</name>
1599 <enum>Sunken</enum>
1600 </property>
1601 <property stdset="1">
1602 <name>indent</name>
1603 <number>0</number>
1604 </property>
1605 </widget>
1606 <spacer>
1607 <property>
1608 <name>name</name>
1609 <cstring>Spacer18</cstring>
1610 </property>
1611 <property stdset="1">
1612 <name>orientation</name>
1613 <enum>Horizontal</enum>
1614 </property>
1615 <property stdset="1">
1616 <name>sizeType</name>
1617 <enum>Expanding</enum>
1618 </property>
1619 <property>
1620 <name>sizeHint</name>
1621 <size>
1622 <width>20</width>
1623 <height>20</height>
1624 </size>
1625 </property>
1626 </spacer>
1627 </hbox>
1628 </widget>
1629 </hbox>
1630 </widget>
1631 <spacer>
1632 <property>
1633 <name>name</name>
1634 <cstring>Spacer17</cstring>
1635 </property>
1636 <property stdset="1">
1637 <name>orientation</name>
1638 <enum>Vertical</enum>
1639 </property>
1640 <property stdset="1">
1641 <name>sizeType</name>
1642 <enum>Expanding</enum>
1643 </property>
1644 <property>
1645 <name>sizeHint</name>
1646 <size>
1647 <width>20</width>
1648 <height>20</height>
1649 </size>
1650 </property>
1651 </spacer>
1652 <widget>
1653 <class>QLayoutWidget</class>
1654 <property stdset="1">
1655 <name>name</name>
1656 <cstring>Layout17</cstring>
1657 </property>
1658 <hbox>
1659 <property stdset="1">
1660 <name>margin</name>
1661 <number>0</number>
1662 </property>
1663 <property stdset="1">
1664 <name>spacing</name>
1665 <number>6</number>
1666 </property>
1667 <widget>
1668 <class>QCheckBox</class>
1669 <property stdset="1">
1670 <name>name</name>
1671 <cstring>Refresh_CB</cstring>
1672 </property>
1673 <property stdset="1">
1674 <name>text</name>
1675 <string>Live feed </string>
1676 </property>
1677 </widget>
1678 <spacer>
1679 <property>
1680 <name>name</name>
1681 <cstring>Spacer57</cstring>
1682 </property>
1683 <property stdset="1">
1684 <name>orientation</name>
1685 <enum>Horizontal</enum>
1686 </property>
1687 <property stdset="1">
1688 <name>sizeType</name>
1689 <enum>Expanding</enum>
1690 </property>
1691 <property>
1692 <name>sizeHint</name>
1693 <size>
1694 <width>20</width>
1695 <height>20</height>
1696 </size>
1697 </property>
1698 </spacer>
1699 </hbox>
1700 </widget>
1701 </vbox>
1702 </widget>
1703 </widget>
1704 </vbox>
1705</widget>
1706<connections>
1707 <connection>
1708 <sender>Refresh_CB</sender>
1709 <signal>toggled(bool)</signal>
1710 <receiver>Profile_FRM</receiver>
1711 <slot>SLOT_AutoRefresh(bool)</slot>
1712 </connection>
1713 <slot access="public">SLOT_AutoRefresh(bool)</slot>
1714</connections>
1715</UI>
diff --git a/noncore/settings/networksettings2/profile/profile_NN.cpp b/noncore/settings/networksettings2/profile/profile_NN.cpp
new file mode 100644
index 0000000..c39b86f
--- a/dev/null
+++ b/noncore/settings/networksettings2/profile/profile_NN.cpp
@@ -0,0 +1,61 @@
1#include "profile_NN.h"
2#include "profile_NNI.h"
3
4static const char * ProfileNeeds[] =
5 { "connection",
6 0
7 };
8
9/**
10 * Constructor, find all of the possible interfaces
11 */
12ProfileNetNode::ProfileNetNode() : ANetNode() {
13}
14
15/**
16 * Delete any interfaces that we own.
17 */
18ProfileNetNode::~ProfileNetNode(){
19}
20
21const QString ProfileNetNode::nodeDescription(){
22 return tr("\
23<p>Define use of an IP connection.</p>\
24<p>Configure if and when this connection needs to be established</p>\
25"
26);
27}
28
29ANetNodeInstance * ProfileNetNode::createInstance( void ) {
30 return new AProfile( this );
31}
32
33const char ** ProfileNetNode::needs( void ) {
34 return ProfileNeeds;
35}
36
37const char * ProfileNetNode::provides( void ) {
38 return "fullsetup";
39}
40
41bool ProfileNetNode::generateProperFilesFor(
42 ANetNodeInstance * ) {
43 return 1;
44}
45
46bool ProfileNetNode::hasDataFor( const QString & ) {
47 return 0;
48}
49
50bool ProfileNetNode::generateDataForCommonFile(
51 SystemFile & ,
52 long,
53 ANetNodeInstance * ) {
54 return 1;
55}
56
57extern "C" {
58void create_plugin( QList<ANetNode> & PNN ) {
59 PNN.append( new ProfileNetNode() );
60}
61}
diff --git a/noncore/settings/networksettings2/profile/profile_NN.h b/noncore/settings/networksettings2/profile/profile_NN.h
new file mode 100644
index 0000000..2b469c7
--- a/dev/null
+++ b/noncore/settings/networksettings2/profile/profile_NN.h
@@ -0,0 +1,44 @@
1#ifndef PROFILE_NETNODE_H
2#define PROFILE_NETNODE_H
3
4#include "netnode.h"
5
6class AProfile;
7
8class ProfileNetNode : public ANetNode{
9
10 Q_OBJECT
11
12public:
13
14 ProfileNetNode();
15 virtual ~ProfileNetNode();
16
17 virtual const QString pixmapName()
18 { return "commprofile"; }
19
20 virtual const QString nodeName()
21 { return tr("Regular profile"); }
22
23 virtual const QString nodeDescription() ;
24
25 virtual ANetNodeInstance * createInstance( void );
26
27 virtual const char ** needs( void );
28 virtual const char * provides( void );
29
30 virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
31 virtual bool hasDataFor( const QString & S );
32 virtual bool generateDataForCommonFile(
33 SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
34
35private:
36
37};
38
39extern "C"
40{
41 void create_plugin( QList<ANetNode> & PNN );
42};
43
44#endif
diff --git a/noncore/settings/networksettings2/profile/profile_NNI.cpp b/noncore/settings/networksettings2/profile/profile_NNI.cpp
new file mode 100644
index 0000000..bc0118e
--- a/dev/null
+++ b/noncore/settings/networksettings2/profile/profile_NNI.cpp
@@ -0,0 +1,48 @@
1#include "profileedit.h"
2#include "profile_NNI.h"
3#include "profile_NN.h"
4
5AProfile::AProfile( ProfileNetNode * PNN ) : ANetNodeInstance( PNN ) {
6 Data.Automatic = 1;
7 Data.Confirm = 0;
8 Data.Description = "";
9 Data.Disabled = 0;
10 GUI = 0;
11 RT = 0;
12}
13
14void AProfile::setSpecificAttribute( QString & Attr, QString & Value ) {
15
16 if ( Attr == "automatic" ) {
17 Data.Automatic = (Value=="yes");
18 } else if ( Attr == "preconfirm" ) {
19 Data.Confirm = (Value=="yes");
20 } else if ( Attr == "disabled" ) {
21 Data.Disabled = (Value=="yes");
22 } else if ( Attr == "description" ) {
23 Data.Description = Value;
24 }
25}
26
27void AProfile::saveSpecificAttribute( QTextStream & TS ) {
28 TS << "automatic=" << ((Data.Automatic) ? "yes" : "no") << endl;
29 TS << "preconfirm=" << ((Data.Confirm) ? "yes" : "no") << endl;
30 TS << "disabled=" << ((Data.Disabled) ? "yes" : "no") << endl;
31 TS << "description=" << Data.Description << endl;
32}
33
34QWidget * AProfile::edit( QWidget * parent ) {
35 GUI = new ProfileEdit( parent, this );
36 GUI->showData( Data );
37 return GUI;
38}
39
40QString AProfile::acceptable( void ) {
41 return ( GUI ) ? GUI->acceptable( ) : QString();
42}
43
44void AProfile::commit( void ) {
45 if( GUI && GUI->commit( Data ) )
46 setModified( 1 );
47}
48
diff --git a/noncore/settings/networksettings2/profile/profile_NNI.h b/noncore/settings/networksettings2/profile/profile_NNI.h
new file mode 100644
index 0000000..dfeb178
--- a/dev/null
+++ b/noncore/settings/networksettings2/profile/profile_NNI.h
@@ -0,0 +1,45 @@
1#ifndef PROFILE_H
2#define PROFILE_H
3
4#include <netnode.h>
5#include "profiledata.h"
6#include "profilerun.h"
7
8class ProfileNetNode;
9class ProfileEdit;
10
11class AProfile : public ANetNodeInstance {
12
13public :
14
15 AProfile( ProfileNetNode * PNN );
16
17 QWidget * edit( QWidget * parent );
18 QString acceptable( void );
19 void commit( void );
20
21 const QString & description( void )
22 { return Data.Description; }
23 RuntimeInfo * runtime( void )
24 { if( RT == 0 )
25 RT = new ProfileRun( this, Data );
26 return RT;
27 }
28
29 virtual void * data( void )
30 { return (void *)&Data; }
31
32protected :
33
34 virtual void setSpecificAttribute( QString & Attr, QString & Value );
35 virtual void saveSpecificAttribute( QTextStream & TS );
36
37private :
38
39 ProfileEdit * GUI;
40 ProfileData Data;
41 ProfileRun * RT;
42
43};
44
45#endif
diff --git a/noncore/settings/networksettings2/profile/profiledata.h b/noncore/settings/networksettings2/profile/profiledata.h
new file mode 100644
index 0000000..b4168e2
--- a/dev/null
+++ b/noncore/settings/networksettings2/profile/profiledata.h
@@ -0,0 +1,15 @@
1#ifndef PROFILE_DATA_H
2#define PROFILE_DATA_H
3
4#include <qstring.h>
5typedef struct ProfileData {
6 QString Description;
7 // start up automatically
8 bool Automatic;
9 // if started up automatically, ask user for confirmation
10 bool Confirm;
11 // Do not bring this connection up
12 bool Disabled;
13} ProfileData_t;
14
15#endif
diff --git a/noncore/settings/networksettings2/profile/profileedit.cpp b/noncore/settings/networksettings2/profile/profileedit.cpp
new file mode 100644
index 0000000..3f72c52
--- a/dev/null
+++ b/noncore/settings/networksettings2/profile/profileedit.cpp
@@ -0,0 +1,93 @@
1#include <qlabel.h>
2#include <qframe.h>
3#include <qcheckbox.h>
4#include <qmultilineedit.h>
5#include <qcheckbox.h>
6
7#include <GUIUtils.h>
8#include <asdevice.h>
9#include <resources.h>
10
11#include "profileedit.h"
12
13ProfileEdit::ProfileEdit( QWidget * Parent, ANetNodeInstance * TNNI ) :
14 ProfileGUI( Parent ), TrafficRefresh(this) {
15 InterfaceInfo * II;
16
17 NNI = TNNI;
18 Dev = NNI->runtime()->device();
19 if( ( II = Dev->assignedInterface() ) ) {
20 Refresh_CB->setEnabled( TRUE );
21 Snd_GB->setEnabled( TRUE );
22 Rcv_GB->setEnabled( TRUE );
23 Collisions_FRM->setEnabled( TRUE );
24 // show current content
25 SLOT_Refresh();
26
27 // fill in static data
28 InterfaceName_LBL->setText( II->Name );
29 IPAddress_LBL->setText( II->Address );
30 SubnetMask_LBL->setText( II->Netmask );
31 Broadcast_LBL->setText( II->BCastAddress );
32 MACAddress_LBL->setText( II->MACAddress );
33 if( II->IsPointToPoint ) {
34 PointToPoint_LBL->setText( II->DstAddress );
35 }
36 QString S;
37 InterfaceName_LBL->setText( II->Name );
38 if( II->HasMulticast ) {
39 S += "Multicast";
40 }
41 if( ! S.isEmpty() ) {
42 S.prepend( " : " );
43 }
44 InterfaceOptions_LBL->setText( S );
45 }
46
47 connect( &TrafficRefresh, SIGNAL( timeout() ),
48 this, SLOT( SLOT_Refresh() ) );
49}
50
51QString ProfileEdit::acceptable( void ) {
52 return QString();
53}
54
55void ProfileEdit::showData( ProfileData_t & Data ) {
56 Description_LE->setText( Data.Description );
57 Automatic_CB->setChecked( Data.Automatic );
58 Confirm_CB->setChecked( Data.Confirm );
59 Disabled_CB->setChecked( Data.Disabled );
60}
61
62
63bool ProfileEdit::commit( ProfileData_t & Data ) {
64 bool SM = 0;
65 TXTM( Data.Description, Description_LE, SM );
66
67 CBM( Data.Automatic, Automatic_CB, SM );
68 CBM( Data.Disabled, Disabled_CB, SM );
69 CBM( Data.Confirm, Confirm_CB, SM );
70
71 return SM;
72}
73
74void ProfileEdit::SLOT_Refresh( void ) {
75 InterfaceInfo * II = Dev->assignedInterface();
76 NSResources->system().refreshStatistics( *II );
77 RcvBytes_LBL->setText( II->RcvBytes );
78 SndBytes_LBL->setText( II->SndBytes );
79 RcvErrors_LBL->setText( II->RcvErrors );
80 SndErrors_LBL->setText( II->SndErrors );
81 RcvDropped_LBL->setText( II->RcvDropped );
82 SndDropped_LBL->setText( II->SndDropped );
83 Collisions_LBL->setText( II->Collisions );
84}
85
86void ProfileEdit::SLOT_AutoRefresh( bool ar ) {
87 if( ar ) {
88 TrafficRefresh.start( 1000 );
89 SLOT_Refresh();
90 } else {
91 TrafficRefresh.stop();
92 }
93}
diff --git a/noncore/settings/networksettings2/profile/profileedit.h b/noncore/settings/networksettings2/profile/profileedit.h
new file mode 100644
index 0000000..8ca34be
--- a/dev/null
+++ b/noncore/settings/networksettings2/profile/profileedit.h
@@ -0,0 +1,29 @@
1#include "profiledata.h"
2#include "profileGUI.h"
3
4#include <qtimer.h>
5class ANetNodeInstance;
6class AsDevice;
7
8class ProfileEdit : public ProfileGUI {
9
10 Q_OBJECT
11
12public :
13
14 ProfileEdit( QWidget * parent, ANetNodeInstance * NNI );
15 QString acceptable( void );
16 bool commit( ProfileData_t & Data );
17 void showData( ProfileData_t & Data );
18
19public slots :
20
21 void SLOT_AutoRefresh( bool );
22 void SLOT_Refresh( void );
23
24private :
25
26 QTimer TrafficRefresh;
27 ANetNodeInstance * NNI;
28 AsDevice * Dev;
29};
diff --git a/noncore/settings/networksettings2/profile/profilerun.cpp b/noncore/settings/networksettings2/profile/profilerun.cpp
new file mode 100644
index 0000000..90c37ed
--- a/dev/null
+++ b/noncore/settings/networksettings2/profile/profilerun.cpp
@@ -0,0 +1,67 @@
1#include <resources.h>
2
3#include "profilerun.h"
4
5void ProfileRun::detectState( NodeCollection * NC ) {
6 if( Data->Disabled ) {
7 NC->setCurrentState( Disabled );
8 } else {
9 // find next item in connection
10 // convert to runtime and ask to detect the state
11 netNode()->nextNode()->runtime()->detectState( NC );
12 }
13}
14
15bool ProfileRun::setState( NodeCollection * NC, Action_t A ) {
16 ANetNodeInstance * NNNI;
17
18 NNNI = netNode()->nextNode();
19 switch ( A ) {
20 case Enable :
21 if( NC->currentState() == Disabled ) {
22 NC->setCurrentState( Off ); // at least
23 // ... but request deeper
24 NNNI->runtime()->detectState(NC);
25 return 1;
26 }
27 return 1;
28 case Disable :
29 if( NC->currentState() == IsUp ) {
30 // bring down -> make available
31 NNNI->runtime()->setState(NC, Down);
32 }
33 if( NC->currentState() == Available ) {
34 // make unavailable
35 NNNI->runtime()->setState(NC, Deactivate);
36 }
37 if( NC->currentState() > Available ) {
38 // could not disable
39 return 0;
40 }
41 NC->setCurrentState( Disabled );
42 return 1;
43 default :
44 break;
45 }
46 return NNNI->runtime()->setState(NC, A);
47}
48
49bool ProfileRun::canSetState( State_t Curr, Action_t A ) {
50 RuntimeInfo * RI;
51 switch ( A ) {
52 case Enable :
53 case Disable :
54 // always possible
55 return 1;
56 default :
57 break;
58 }
59 RI = netNode()->nextNode()->runtime();
60 return ( Curr != Disabled ) ?
61 RI->canSetState(Curr, A) : 0;
62}
63
64bool ProfileRun::handlesInterface( const QString & S ) {
65 // donno -> pass deeper
66 return netNode()->nextNode()->runtime()->handlesInterface(S);
67}
diff --git a/noncore/settings/networksettings2/profile/profilerun.h b/noncore/settings/networksettings2/profile/profilerun.h
new file mode 100644
index 0000000..d3797b5
--- a/dev/null
+++ b/noncore/settings/networksettings2/profile/profilerun.h
@@ -0,0 +1,28 @@
1#ifndef PROFILERUN_H
2#define PROFILERUN_H
3
4#include <asfullsetup.h>
5#include "profiledata.h"
6
7class ProfileRun : public AsFullSetup {
8
9public :
10
11 ProfileRun( ANetNodeInstance * NNI, ProfileData & D ) :
12 AsFullSetup( NNI )
13 { Data = &D; }
14
15 void detectState( NodeCollection * NC );
16 bool setState( NodeCollection * NC, Action_t A );
17 bool canSetState( State_t Curr, Action_t A );
18
19 bool handlesInterface( const QString & I );
20
21 virtual const QString & description( void )
22 { return Data->Description; }
23private :
24
25 ProfileData * Data;
26
27};
28#endif
diff --git a/noncore/settings/networksettings2/setmacaddress.sh b/noncore/settings/networksettings2/setmacaddress.sh
new file mode 100755
index 0000000..f9abca2
--- a/dev/null
+++ b/noncore/settings/networksettings2/setmacaddress.sh
@@ -0,0 +1,4 @@
1#!/bin/sh
2BDIR=/opt/QtPalmtop/etc/networktemplates
3[ ! -z "$1" -a -f ${BDIR}/$1.mac ] && ifconfig $1 hw ether `cat ${BDIR}/$1.mac`
4exit 0
diff --git a/noncore/settings/networksettings2/usb/config.in b/noncore/settings/networksettings2/usb/config.in
new file mode 100644
index 0000000..988601a
--- a/dev/null
+++ b/noncore/settings/networksettings2/usb/config.in
@@ -0,0 +1,4 @@
1 config NS2USB
2 boolean "opie-networksettings2plugin-usb (set up USB)"
3 default "n" if NS2
4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && NS2 && NS2CORE
diff --git a/noncore/settings/networksettings2/usb/usb.pro b/noncore/settings/networksettings2/usb/usb.pro
new file mode 100644
index 0000000..cc2f9db
--- a/dev/null
+++ b/noncore/settings/networksettings2/usb/usb.pro
@@ -0,0 +1,18 @@
1TEMPLATE = lib
2CONFIG += qt warn_on release
3DESTDIR = $(OPIEDIR)/plugins/networksettings2
4 HEADERS = usb_NN.h \
5 usb_NNI.h \
6 usbedit.h
7 SOURCES = usb_NN.cpp \
8 usb_NNI.cpp \
9 usbedit.cpp \
10 usbrun.cpp
11 INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2
12 DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2
13LIBS += -lqpe
14 INTERFACES= usbGUI.ui
15 TARGET = usb
16 VERSION = 1.0.0
17
18include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/networksettings2/usb/usbGUI.ui b/noncore/settings/networksettings2/usb/usbGUI.ui
new file mode 100644
index 0000000..bd78ab4
--- a/dev/null
+++ b/noncore/settings/networksettings2/usb/usbGUI.ui
@@ -0,0 +1,57 @@
1<!DOCTYPE UI><UI>
2<class>USBGUI</class>
3<widget>
4 <class>QWidget</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>USB_FRM</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>279</width>
15 <height>199</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>USB</string>
21 </property>
22 <property>
23 <name>layoutMargin</name>
24 </property>
25 <property>
26 <name>layoutSpacing</name>
27 </property>
28 <vbox>
29 <property stdset="1">
30 <name>margin</name>
31 <number>0</number>
32 </property>
33 <property stdset="1">
34 <name>spacing</name>
35 <number>0</number>
36 </property>
37 <widget>
38 <class>QLabel</class>
39 <property stdset="1">
40 <name>name</name>
41 <cstring>TextLabel3</cstring>
42 </property>
43 <property stdset="1">
44 <name>text</name>
45 <string>Nothing to configure</string>
46 </property>
47 <property stdset="1">
48 <name>alignment</name>
49 <set>AlignCenter</set>
50 </property>
51 <property>
52 <name>hAlign</name>
53 </property>
54 </widget>
55 </vbox>
56</widget>
57</UI>
diff --git a/noncore/settings/networksettings2/usb/usb_NN.cpp b/noncore/settings/networksettings2/usb/usb_NN.cpp
new file mode 100644
index 0000000..c65771d
--- a/dev/null
+++ b/noncore/settings/networksettings2/usb/usb_NN.cpp
@@ -0,0 +1,60 @@
1#include "usb_NN.h"
2#include "usb_NNI.h"
3
4static const char * USBNeeds[] =
5 { 0
6 };
7
8/**
9 * Constructor, find all of the possible interfaces
10 */
11USBNetNode::USBNetNode() : ANetNode() {
12}
13
14/**
15 * Delete any interfaces that we own.
16 */
17USBNetNode::~USBNetNode(){
18}
19
20const QString USBNetNode::nodeDescription(){
21 return tr("\
22<p>Configure Ethernet over USB.</p>\
23<p>Use this for a computer to computer USB cable connection</p>\
24"
25);
26}
27
28ANetNodeInstance * USBNetNode::createInstance( void ) {
29 return new AUSB( this );
30}
31
32const char ** USBNetNode::needs( void ) {
33 return USBNeeds;
34}
35
36const char * USBNetNode::provides( void ) {
37 return "device";
38}
39
40bool USBNetNode::generateProperFilesFor(
41 ANetNodeInstance * ) {
42 return 1;
43}
44
45bool USBNetNode::hasDataFor( const QString & S ) {
46 return (S== "interfaces");
47}
48
49bool USBNetNode::generateDataForCommonFile(
50 SystemFile & S ,
51 long DevNr,
52 ANetNodeInstance * NNI) {
53 return ((AUSB *)NNI)->generateDataForCommonFile(S, DevNr);
54}
55
56extern "C" {
57void create_plugin( QList<ANetNode> & PNN ) {
58 PNN.append( new USBNetNode() );
59}
60}
diff --git a/noncore/settings/networksettings2/usb/usb_NN.h b/noncore/settings/networksettings2/usb/usb_NN.h
new file mode 100644
index 0000000..3871afc
--- a/dev/null
+++ b/noncore/settings/networksettings2/usb/usb_NN.h
@@ -0,0 +1,44 @@
1#ifndef USB_NETNODE_H
2#define USB_NETNODE_H
3
4#include "netnode.h"
5
6class AUSB;
7
8class USBNetNode : public ANetNode{
9
10 Q_OBJECT
11
12public:
13
14 USBNetNode();
15 virtual ~USBNetNode();
16
17 virtual const QString pixmapName()
18 { return "usb"; }
19
20 virtual const QString nodeName()
21 { return tr("USB Cable Connect"); }
22
23 virtual const QString nodeDescription() ;
24
25 virtual ANetNodeInstance * createInstance( void );
26
27 virtual const char ** needs( void );
28 virtual const char * provides( void );
29
30 virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
31 virtual bool hasDataFor( const QString & S );
32 virtual bool generateDataForCommonFile(
33 SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
34
35private:
36
37};
38
39extern "C"
40{
41 void create_plugin( QList<ANetNode> & PNN );
42};
43
44#endif
diff --git a/noncore/settings/networksettings2/usb/usb_NNI.cpp b/noncore/settings/networksettings2/usb/usb_NNI.cpp
new file mode 100644
index 0000000..4729416
--- a/dev/null
+++ b/noncore/settings/networksettings2/usb/usb_NNI.cpp
@@ -0,0 +1,46 @@
1#include <qpe/qpeapplication.h>
2#include "usbedit.h"
3#include "usb_NNI.h"
4#include "usb_NN.h"
5
6AUSB::AUSB( USBNetNode * PNN ) : ANetNodeInstance( PNN ) {
7
8 GUI = 0;
9 RT = 0;
10}
11
12void AUSB::setSpecificAttribute( QString & , QString & ) {
13}
14
15void AUSB::saveSpecificAttribute( QTextStream & ) {
16}
17
18
19QWidget * AUSB::edit( QWidget * parent ) {
20 GUI = new USBEdit( parent );
21 GUI->showData( Data );
22 return GUI;
23}
24
25QString AUSB::acceptable( void ) {
26 return ( GUI ) ? GUI->acceptable( ) : QString();
27}
28
29void AUSB::commit( void ) {
30 if( GUI && GUI->commit( Data ) ) {
31 setModified( 1 );
32 }
33}
34
35bool AUSB::generateDataForCommonFile( SystemFile & S, long DevNr ) {
36 AsDevice * Dev = runtime()->device();
37 QString NIC = Dev->genNic( DevNr );
38
39 if( S.name() == "interfaces" ) {
40 // generate mapping stanza for this interface
41 S << " pre-up " << QPEApplication::qpeDir() << "bin/setmacaddress.sh " << NIC << " || true" << endl;
42 }
43 return 0;
44}
45
46
diff --git a/noncore/settings/networksettings2/usb/usb_NNI.h b/noncore/settings/networksettings2/usb/usb_NNI.h
new file mode 100644
index 0000000..b09f17a
--- a/dev/null
+++ b/noncore/settings/networksettings2/usb/usb_NNI.h
@@ -0,0 +1,44 @@
1#ifndef USB_H
2#define USB_H
3
4#include <netnode.h>
5#include "usbdata.h"
6#include "usbrun.h"
7
8class USBNetNode;
9class USBEdit;
10
11class AUSB : public ANetNodeInstance {
12
13public :
14
15 AUSB( USBNetNode * PNN );
16
17 QWidget * edit( QWidget * parent );
18 QString acceptable( void );
19 void commit( void );
20
21 RuntimeInfo * runtime( void )
22 { if( RT == 0 )
23 RT = new USBRun( this, Data );
24 return RT;
25 }
26
27 virtual void * data( void )
28 { return (void *)&Data; }
29
30 bool generateDataForCommonFile( SystemFile & S, long DevNr );
31
32protected :
33
34 virtual void setSpecificAttribute( QString & Attr, QString & Value );
35 virtual void saveSpecificAttribute( QTextStream & TS );
36
37private :
38
39 USBEdit * GUI;
40 USBData Data;
41 USBRun * RT;
42};
43
44#endif
diff --git a/noncore/settings/networksettings2/usb/usbdata.h b/noncore/settings/networksettings2/usb/usbdata.h
new file mode 100644
index 0000000..c59f508
--- a/dev/null
+++ b/noncore/settings/networksettings2/usb/usbdata.h
@@ -0,0 +1,8 @@
1#ifndef USB_DATA_H
2#define USB_DATA_H
3
4typedef struct USBData {
5 bool Fake;
6} USBData_t;
7
8#endif
diff --git a/noncore/settings/networksettings2/usb/usbedit.cpp b/noncore/settings/networksettings2/usb/usbedit.cpp
new file mode 100644
index 0000000..153c497
--- a/dev/null
+++ b/noncore/settings/networksettings2/usb/usbedit.cpp
@@ -0,0 +1,17 @@
1#include <GUIUtils.h>
2#include "usbedit.h"
3
4USBEdit::USBEdit( QWidget * Parent ) : USBGUI( Parent ){
5
6}
7
8QString USBEdit::acceptable( void ) {
9 return QString();
10}
11
12void USBEdit::showData( USBData_t & Data ) {
13}
14
15bool USBEdit::commit( USBData_t & Data ) {
16 return 1;
17}
diff --git a/noncore/settings/networksettings2/usb/usbedit.h b/noncore/settings/networksettings2/usb/usbedit.h
new file mode 100644
index 0000000..441f2f0
--- a/dev/null
+++ b/noncore/settings/networksettings2/usb/usbedit.h
@@ -0,0 +1,12 @@
1#include "usbdata.h"
2#include "usbGUI.h"
3
4class USBEdit : public USBGUI {
5
6public :
7
8 USBEdit( QWidget * parent );
9 QString acceptable( void );
10 bool commit( USBData_t & Data );
11 void showData( USBData_t & Data );
12};
diff --git a/noncore/settings/networksettings2/usb/usbrun.cpp b/noncore/settings/networksettings2/usb/usbrun.cpp
new file mode 100644
index 0000000..49b5a77
--- a/dev/null
+++ b/noncore/settings/networksettings2/usb/usbrun.cpp
@@ -0,0 +1,171 @@
1#include <qfile.h>
2#include <qfileinfo.h>
3#include <qtextstream.h>
4#include <resources.h>
5#include "usbrun.h"
6
7void USBRun::detectState( NodeCollection * NC ) {
8 // unavailable : no card found
9 // available : card found and assigned to us or free
10 // up : card found and assigned to us and up
11 QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number());
12 System & Sys = NSResources->system();
13 InterfaceInfo * Run;
14 QFile F( S );
15
16 if( F.open( IO_ReadOnly ) ) {
17 // could open file -> read interface and assign
18 QString X;
19 QTextStream TS(&F);
20 X = TS.readLine();
21 // find interface
22 if( handlesInterface( X ) ) {
23 for( QDictIterator<InterfaceInfo> It(Sys.interfaces());
24 It.current();
25 ++It ) {
26 Run = It.current();
27 if( X == Run->Name ) {
28 Run->assignNode( netNode() );
29 assignInterface( Run );
30 NC->setCurrentState( IsUp );
31 return;
32 }
33 }
34 }
35 }
36
37 fprintf( stderr, "NUP\n" );
38 // definitively not up
39 assignInterface( 0 );
40
41 // find possible interface
42 for( QDictIterator<InterfaceInfo> It(Sys.interfaces());
43 It.current();
44 ++It ) {
45 Run = It.current();
46 fprintf( stderr, "%s %d %d=%d %d\n",
47 Run->Name.latin1(),
48 handlesInterface( Run->Name ),
49 Run->CardType, ARPHRD_ETHER,
50 ! Run->IsUp );
51 if( handlesInterface( Run->Name ) &&
52 Run->CardType == ARPHRD_ETHER &&
53 ! Run->IsUp
54 ) {
55 fprintf( stderr, "OFF\n" );
56 // proper type, and Not UP -> free
57 NC->setCurrentState( Off );
58 return;
59 }
60 }
61 // no free found
62 fprintf( stderr, "UNA\n" );
63
64 NC->setCurrentState( Unavailable );
65}
66
67bool USBRun::setState( NodeCollection * NC, Action_t A ) {
68
69 // we only handle activate and deactivate
70 switch( A ) {
71 case Activate :
72 {
73 if( NC->currentState() != Off ) {
74 return 0;
75 }
76 InterfaceInfo * N = getInterface();
77 if( ! N ) {
78 // no interface available
79 NC->setCurrentState( Unavailable );
80 return 0;
81 }
82 // because we were OFF the interface
83 // we get back is NOT assigned
84 N->assignNode( netNode() );
85 assignInterface( N );
86 NC->setCurrentState( Available );
87 return 1;
88 }
89 case Deactivate :
90 if( NC->currentState() == IsUp ) {
91 // bring down first
92 if( ! connection()->setState( Down ) )
93 // could not ...
94 return 0;
95 }
96 if( NC->currentState() != Available ) {
97 return 1;
98 }
99 assignedInterface()->assignNode( 0 ); // release
100 assignInterface( 0 );
101 NC->setCurrentState( Off );
102 return 1;
103 default :
104 // FT
105 break;
106 }
107 return 0;
108}
109
110bool USBRun::canSetState( State_t Curr, Action_t A ) {
111 // we only handle up down activate and deactivate
112 switch( A ) {
113 case Activate :
114 { // at least available
115 if( Curr == Available ) {
116 return 1;
117 }
118 // or we can make one available
119 InterfaceInfo * N = getInterface();
120 if( ! N || N->assignedNode() != 0 ) {
121 // non available or assigned
122 return 0;
123 }
124 return 1;
125 }
126 case Deactivate :
127 return ( Curr >= Available );
128 default :
129 // FT
130 break;
131 }
132 return 0;
133}
134
135// get interface that is free or assigned to us
136InterfaceInfo * USBRun::getInterface( void ) {
137
138 System & S = NSResources->system();
139 InterfaceInfo * best = 0, * Run;
140 QRegExp R( "usb[0-9abcdef]" );
141
142 for( QDictIterator<InterfaceInfo> It(S.interfaces());
143 It.current();
144 ++It ) {
145 Run = It.current();
146 if( handlesInterface( Run->Name ) &&
147 Run->CardType == ARPHRD_ETHER
148 ) {
149 // this is a USB card
150 if( Run->assignedNode() == netNode() ) {
151 // assigned to us
152 return Run;
153 } else if( Run->assignedNode() == 0 ) {
154 // free
155 best = Run;
156 }
157 }
158 }
159 return best; // can be 0
160}
161
162bool USBRun::handlesInterface( const QString & S ) {
163 return Pat.match( S ) >= 0;
164}
165
166QString USBRun::genNic( long nr ) {
167 QString S;
168 S.sprintf( "usbf" );
169 return S;
170}
171
diff --git a/noncore/settings/networksettings2/usb/usbrun.h b/noncore/settings/networksettings2/usb/usbrun.h
new file mode 100644
index 0000000..c9c9121
--- a/dev/null
+++ b/noncore/settings/networksettings2/usb/usbrun.h
@@ -0,0 +1,38 @@
1#ifndef USBRUN_H
2#define USBRUN_H
3
4#include <asdevice.h>
5#include <qregexp.h>
6#include "usbdata.h"
7
8class USBRun : public AsDevice {
9
10public :
11
12 USBRun( ANetNodeInstance * NNI,
13 USBData & Data ) :
14 AsDevice( NNI ),
15 Pat( "usb[0-9abcdef]" )
16 { }
17
18 virtual long count( void )
19 { return 1; }
20 virtual QString genNic( long nr );
21 virtual AsDevice * device( void )
22 { return asDevice(); }
23
24protected :
25
26 void detectState( NodeCollection * );
27 bool setState( NodeCollection * , Action_t A );
28 bool canSetState( State_t , Action_t A );
29
30 bool handlesInterface( const QString & I );
31
32private :
33
34 InterfaceInfo * getInterface( void );
35 QRegExp Pat;
36
37};
38#endif
diff --git a/noncore/settings/networksettings2/vpn/config.in b/noncore/settings/networksettings2/vpn/config.in
new file mode 100644
index 0000000..796f996
--- a/dev/null
+++ b/noncore/settings/networksettings2/vpn/config.in
@@ -0,0 +1,4 @@
1 config NS2VPN
2 boolean "opie-networksettings2plugin-vpn (set up VPN)"
3 default "n" if NS2
4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && NS2 && NS2CORE
diff --git a/noncore/settings/networksettings2/vpn/vpn.pro b/noncore/settings/networksettings2/vpn/vpn.pro
new file mode 100644
index 0000000..81b4d08
--- a/dev/null
+++ b/noncore/settings/networksettings2/vpn/vpn.pro
@@ -0,0 +1,18 @@
1TEMPLATE = lib
2CONFIG += qt warn_on release
3DESTDIR = $(OPIEDIR)/plugins/networksettings2
4 HEADERS = vpn_NN.h \
5 vpn_NNI.h \
6 vpnedit.h
7 SOURCES = vpn_NN.cpp \
8 vpn_NNI.cpp \
9 vpnedit.cpp \
10 vpnrun.cpp
11 INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2
12 DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2
13LIBS += -lqpe
14 INTERFACES= vpnGUI.ui
15 TARGET = vpn
16 VERSION = 1.0.0
17
18include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/networksettings2/vpn/vpnGUI.cpp b/noncore/settings/networksettings2/vpn/vpnGUI.cpp
new file mode 100644
index 0000000..708c92b
--- a/dev/null
+++ b/noncore/settings/networksettings2/vpn/vpnGUI.cpp
@@ -0,0 +1,76 @@
1/****************************************************************************
2** Form implementation generated from reading ui file 'vpnGUI.ui'
3**
4** Created: Tue Mar 30 02:42:53 2004
5** by: The User Interface Compiler (uic)
6**
7** WARNING! All changes made in this file will be lost!
8****************************************************************************/
9#include "vpnGUI.h"
10
11#include <qcheckbox.h>
12#include <qlabel.h>
13#include <qlineedit.h>
14#include <qmultilineedit.h>
15#include <qpushbutton.h>
16#include <qlayout.h>
17#include <qvariant.h>
18#include <qtooltip.h>
19#include <qwhatsthis.h>
20
21/*
22 * Constructs a VPNGUI which is a child of 'parent', with the
23 * name 'name' and widget flags set to 'f'
24 */
25VPNGUI::VPNGUI( QWidget* parent, const char* name, WFlags fl )
26 : QWidget( parent, name, fl )
27{
28 if ( !name )
29 setName( "VPN_FRM" );
30 resize( 283, 199 );
31 setCaption( tr( "VPN" ) );
32 VPN_FRMLayout = new QVBoxLayout( this );
33 VPN_FRMLayout->setSpacing( 2 );
34 VPN_FRMLayout->setMargin( 2 );
35
36 Layout4 = new QHBoxLayout;
37 Layout4->setSpacing( 6 );
38 Layout4->setMargin( 0 );
39
40 TextLabel4 = new QLabel( this, "TextLabel4" );
41 TextLabel4->setText( tr( "Name" ) );
42 Layout4->addWidget( TextLabel4 );
43
44 Name_LE = new QLineEdit( this, "Name_LE" );
45 Layout4->addWidget( Name_LE );
46 VPN_FRMLayout->addLayout( Layout4 );
47
48 TextLabel3 = new QLabel( this, "TextLabel3" );
49 TextLabel3->setText( tr( "Description" ) );
50 VPN_FRMLayout->addWidget( TextLabel3 );
51
52 Description_LE = new QMultiLineEdit( this, "Description_LE" );
53 VPN_FRMLayout->addWidget( Description_LE );
54
55 Layout5 = new QHBoxLayout;
56 Layout5->setSpacing( 6 );
57 Layout5->setMargin( 0 );
58
59 Automatic_CB = new QCheckBox( this, "Automatic_CB" );
60 Automatic_CB->setText( tr( "Start automatically" ) );
61 Layout5->addWidget( Automatic_CB );
62
63 Confirm_CB = new QCheckBox( this, "Confirm_CB" );
64 Confirm_CB->setText( tr( "Confirm before start" ) );
65 Layout5->addWidget( Confirm_CB );
66 VPN_FRMLayout->addLayout( Layout5 );
67}
68
69/*
70 * Destroys the object and frees any allocated resources
71 */
72VPNGUI::~VPNGUI()
73{
74 // no need to delete child widgets, Qt does it all for us
75}
76
diff --git a/noncore/settings/networksettings2/vpn/vpnGUI.h b/noncore/settings/networksettings2/vpn/vpnGUI.h
new file mode 100644
index 0000000..fcc3e54
--- a/dev/null
+++ b/noncore/settings/networksettings2/vpn/vpnGUI.h
@@ -0,0 +1,43 @@
1/****************************************************************************
2** Form interface generated from reading ui file 'vpnGUI.ui'
3**
4** Created: Tue Mar 30 02:42:50 2004
5** by: The User Interface Compiler (uic)
6**
7** WARNING! All changes made in this file will be lost!
8****************************************************************************/
9#ifndef VPN_FRM_H
10#define VPN_FRM_H
11
12#include <qvariant.h>
13#include <qwidget.h>
14class QVBoxLayout;
15class QHBoxLayout;
16class QGridLayout;
17class QCheckBox;
18class QLabel;
19class QLineEdit;
20class QMultiLineEdit;
21
22class VPNGUI : public QWidget
23{
24 Q_OBJECT
25
26public:
27 VPNGUI( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
28 ~VPNGUI();
29
30 QLabel* TextLabel4;
31 QLineEdit* Name_LE;
32 QLabel* TextLabel3;
33 QMultiLineEdit* Description_LE;
34 QCheckBox* Automatic_CB;
35 QCheckBox* Confirm_CB;
36
37protected:
38 QVBoxLayout* VPN_FRMLayout;
39 QHBoxLayout* Layout4;
40 QHBoxLayout* Layout5;
41};
42
43#endif // VPN_FRM_H
diff --git a/noncore/settings/networksettings2/vpn/vpn_NN.cpp b/noncore/settings/networksettings2/vpn/vpn_NN.cpp
new file mode 100644
index 0000000..c800929
--- a/dev/null
+++ b/noncore/settings/networksettings2/vpn/vpn_NN.cpp
@@ -0,0 +1,61 @@
1#include "vpn_NN.h"
2#include "vpn_NNI.h"
3
4static const char * VPNNeeds[] =
5 { "connection",
6 0
7 };
8
9/**
10 * Constructor, find all of the possible interfaces
11 */
12VPNNetNode::VPNNetNode() : ANetNode() {
13}
14
15/**
16 * Delete any interfaces that we own.
17 */
18VPNNetNode::~VPNNetNode(){
19}
20
21const QString VPNNetNode::nodeDescription(){
22 return tr("\
23<p>Configure private IP connection.</p>\
24<p>Defines Secure tunnels over non secure IP sessions</p>\
25"
26);
27}
28
29ANetNodeInstance * VPNNetNode::createInstance( void ) {
30 return new AVPN( this );
31}
32
33const char ** VPNNetNode::needs( void ) {
34 return VPNNeeds;
35}
36
37const char * VPNNetNode::provides( void ) {
38 return "connection";
39}
40
41bool VPNNetNode::generateProperFilesFor(
42 ANetNodeInstance * ) {
43 return 1;
44}
45
46bool VPNNetNode::hasDataFor( const QString & ) {
47 return 0;
48}
49
50bool VPNNetNode::generateDataForCommonFile(
51 SystemFile & ,
52 long,
53 ANetNodeInstance * ) {
54 return 1;
55}
56
57extern "C" {
58void create_plugin( QList<ANetNode> & PNN ) {
59 PNN.append( new VPNNetNode() );
60}
61}
diff --git a/noncore/settings/networksettings2/vpn/vpn_NN.h b/noncore/settings/networksettings2/vpn/vpn_NN.h
new file mode 100644
index 0000000..5718961
--- a/dev/null
+++ b/noncore/settings/networksettings2/vpn/vpn_NN.h
@@ -0,0 +1,44 @@
1#ifndef VPN_NETNODE_H
2#define VPN_NETNODE_H
3
4#include "netnode.h"
5
6class AVPN;
7
8class VPNNetNode : public ANetNode{
9
10 Q_OBJECT
11
12public:
13
14 VPNNetNode();
15 virtual ~VPNNetNode();
16
17 virtual const QString pixmapName()
18 { return "vpn"; }
19
20 virtual const QString nodeName()
21 { return tr("VPN Connection"); }
22
23 virtual const QString nodeDescription() ;
24
25 virtual ANetNodeInstance * createInstance( void );
26
27 virtual const char ** needs( void );
28 virtual const char * provides( void );
29
30 virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
31 virtual bool hasDataFor( const QString & S );
32 virtual bool generateDataForCommonFile(
33 SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
34
35private:
36
37};
38
39extern "C"
40{
41 void create_plugin( QList<ANetNode> & PNN );
42};
43
44#endif
diff --git a/noncore/settings/networksettings2/vpn/vpn_NNI.cpp b/noncore/settings/networksettings2/vpn/vpn_NNI.cpp
new file mode 100644
index 0000000..6c20aeb
--- a/dev/null
+++ b/noncore/settings/networksettings2/vpn/vpn_NNI.cpp
@@ -0,0 +1,30 @@
1#include "vpnedit.h"
2#include "vpn_NNI.h"
3#include "vpn_NN.h"
4
5AVPN::AVPN( VPNNetNode * PNN ) : ANetNodeInstance( PNN ) {
6 GUI = 0;
7 RT = 0;
8}
9
10void AVPN::setSpecificAttribute( QString & , QString & ) {
11}
12
13void AVPN::saveSpecificAttribute( QTextStream & ) {
14}
15
16QWidget * AVPN::edit( QWidget * parent ) {
17 GUI = new VPNEdit( parent );
18 GUI->showData( Data );
19 return GUI;
20}
21
22QString AVPN::acceptable( void ) {
23 return ( GUI ) ? GUI->acceptable( ) : QString();
24}
25
26void AVPN::commit( void ) {
27 if( GUI && GUI->commit( Data ) )
28 setModified( 1 );
29}
30
diff --git a/noncore/settings/networksettings2/vpn/vpn_NNI.h b/noncore/settings/networksettings2/vpn/vpn_NNI.h
new file mode 100644
index 0000000..31ce0d6
--- a/dev/null
+++ b/noncore/settings/networksettings2/vpn/vpn_NNI.h
@@ -0,0 +1,43 @@
1#ifndef VPN_H
2#define VPN_H
3
4#include <netnode.h>
5#include "vpndata.h"
6#include "vpnrun.h"
7
8class VPNNetNode;
9class VPNEdit;
10
11class AVPN : public ANetNodeInstance {
12
13public :
14
15 AVPN( VPNNetNode * PNN );
16
17 QWidget * edit( QWidget * parent );
18 QString acceptable( void );
19 void commit( void );
20
21 RuntimeInfo * runtime( void )
22 { if( RT == 0 )
23 RT = new VPNRun( this, Data );
24 return RT;
25 }
26
27 virtual void * data( void )
28 { return (void *)&Data; }
29
30protected :
31
32 virtual void setSpecificAttribute( QString & Attr, QString & Value );
33 virtual void saveSpecificAttribute( QTextStream & TS );
34
35private :
36
37 VPNEdit * GUI;
38 VPNData Data;
39 VPNRun * RT;
40
41};
42
43#endif
diff --git a/noncore/settings/networksettings2/vpn/vpndata.h b/noncore/settings/networksettings2/vpn/vpndata.h
new file mode 100644
index 0000000..5c986aa
--- a/dev/null
+++ b/noncore/settings/networksettings2/vpn/vpndata.h
@@ -0,0 +1,16 @@
1#ifndef VPN_DATA_H
2#define VPN_DATA_H
3
4#include <qstring.h>
5typedef struct VPNData {
6 QString Device;
7 QString LockFile;
8 long Speed;
9 short Parity;
10 short DataBits;
11 short StopBits;
12 bool HardwareControl;
13 bool SoftwareControl;
14} VPNData_t;
15
16#endif
diff --git a/noncore/settings/networksettings2/vpn/vpnedit.cpp b/noncore/settings/networksettings2/vpn/vpnedit.cpp
new file mode 100644
index 0000000..f336394
--- a/dev/null
+++ b/noncore/settings/networksettings2/vpn/vpnedit.cpp
@@ -0,0 +1,18 @@
1#include <GUIUtils.h>
2#include "vpnedit.h"
3
4
5VPNEdit::VPNEdit( QWidget * Parent ) : VPNGUI( Parent ){
6
7}
8
9QString VPNEdit::acceptable( void ) {
10 return QString();
11}
12
13void VPNEdit::showData( VPNData_t & Data ) {
14}
15
16bool VPNEdit::commit( VPNData_t & Data ) {
17 return 0;
18}
diff --git a/noncore/settings/networksettings2/vpn/vpnedit.h b/noncore/settings/networksettings2/vpn/vpnedit.h
new file mode 100644
index 0000000..76480cd
--- a/dev/null
+++ b/noncore/settings/networksettings2/vpn/vpnedit.h
@@ -0,0 +1,12 @@
1#include "vpndata.h"
2#include "vpnGUI.h"
3
4class VPNEdit : public VPNGUI {
5
6public :
7
8 VPNEdit( QWidget * parent );
9 QString acceptable( void );
10 bool commit( VPNData_t & Data );
11 void showData( VPNData_t & Data );
12};
diff --git a/noncore/settings/networksettings2/vpn/vpnrun.cpp b/noncore/settings/networksettings2/vpn/vpnrun.cpp
new file mode 100644
index 0000000..ab2966c
--- a/dev/null
+++ b/noncore/settings/networksettings2/vpn/vpnrun.cpp
@@ -0,0 +1,6 @@
1#include "vpnrun.h"
2
3bool VPNRun::handlesInterface( const QString & ) {
4 // to be figured out
5 return 0;
6}
diff --git a/noncore/settings/networksettings2/vpn/vpnrun.h b/noncore/settings/networksettings2/vpn/vpnrun.h
new file mode 100644
index 0000000..c221fd0
--- a/dev/null
+++ b/noncore/settings/networksettings2/vpn/vpnrun.h
@@ -0,0 +1,30 @@
1#ifndef VPNRUN_H
2#define VPNRUN_H
3
4#include <asconnection.h>
5#include "vpndata.h"
6
7class VPNRun : public AsConnection {
8
9public :
10
11 VPNRun( ANetNodeInstance * NNI, VPNData & Data ) :
12 AsConnection( NNI )
13 { }
14
15protected :
16
17 void detectState( NodeCollection * )
18 { }
19
20 bool setState( NodeCollection *, Action_t )
21 { return 0; }
22
23 bool canSetState( State_t, Action_t )
24 { return 0; }
25
26 bool handlesInterface( const QString & I );
27
28};
29
30#endif
diff --git a/noncore/settings/networksettings2/wlan/wlan.pro b/noncore/settings/networksettings2/wlan/wlan.pro
new file mode 100644
index 0000000..4cc47ee
--- a/dev/null
+++ b/noncore/settings/networksettings2/wlan/wlan.pro
@@ -0,0 +1,18 @@
1TEMPLATE = lib
2CONFIG += qt warn_on release
3DESTDIR = $(OPIEDIR)/plugins/networksettings2
4 HEADERS = wlan_NN.h \
5 wlan_NNI.h \
6 wlanedit.h
7 SOURCES = wlan_NN.cpp \
8 wlan_NNI.cpp \
9 wlanedit.cpp \
10 wlanrun.cpp
11 INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2
12 DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2
13LIBS += -lqpe
14 INTERFACES= wlanGUI.ui
15 TARGET = wlan
16 VERSION = 1.0.0
17
18include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/networksettings2/wlan/wlanGUI.cpp b/noncore/settings/networksettings2/wlan/wlanGUI.cpp
new file mode 100644
index 0000000..902bd27
--- a/dev/null
+++ b/noncore/settings/networksettings2/wlan/wlanGUI.cpp
@@ -0,0 +1,360 @@
1/****************************************************************************
2** Form implementation generated from reading ui file 'wlanGUI.ui'
3**
4** Created: Tue Mar 30 02:42:58 2004
5** by: The User Interface Compiler (uic)
6**
7** WARNING! All changes made in this file will be lost!
8****************************************************************************/
9#include "wlanGUI.h"
10
11#include <qbuttongroup.h>
12#include <qcheckbox.h>
13#include <qcombobox.h>
14#include <qgroupbox.h>
15#include <qlabel.h>
16#include <qlineedit.h>
17#include <qprogressbar.h>
18#include <qpushbutton.h>
19#include <qradiobutton.h>
20#include <qspinbox.h>
21#include <qtabwidget.h>
22#include <qlayout.h>
23#include <qvariant.h>
24#include <qtooltip.h>
25#include <qwhatsthis.h>
26
27/*
28 * Constructs a WLanGUI which is a child of 'parent', with the
29 * name 'name' and widget flags set to 'f'
30 */
31WLanGUI::WLanGUI( QWidget* parent, const char* name, WFlags fl )
32 : QWidget( parent, name, fl )
33{
34 if ( !name )
35 setName( "WLanGUI" );
36 resize( 196, 329 );
37 setCaption( tr( "Form1" ) );
38 WLanGUILayout = new QVBoxLayout( this );
39 WLanGUILayout->setSpacing( 0 );
40 WLanGUILayout->setMargin( 0 );
41
42 tabWidget = new QTabWidget( this, "tabWidget" );
43 tabWidget->setEnabled( TRUE );
44
45 ConfigPage = new QWidget( tabWidget, "ConfigPage" );
46 ConfigPageLayout = new QVBoxLayout( ConfigPage );
47 ConfigPageLayout->setSpacing( 2 );
48 ConfigPageLayout->setMargin( 0 );
49
50 Layout6 = new QGridLayout;
51 Layout6->setSpacing( 6 );
52 Layout6->setMargin( 1 );
53
54 essidLabel = new QLabel( ConfigPage, "essidLabel" );
55 essidLabel->setEnabled( TRUE );
56 essidLabel->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, essidLabel->sizePolicy().hasHeightForWidth() ) );
57 essidLabel->setText( tr( "ESS-ID" ) );
58
59 Layout6->addWidget( essidLabel, 1, 0 );
60
61 essid = new QComboBox( FALSE, ConfigPage, "essid" );
62 essid->insertItem( tr( "any" ) );
63 essid->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, essid->sizePolicy().hasHeightForWidth() ) );
64 essid->setEditable( TRUE );
65 essid->setCurrentItem( 0 );
66 essid->setSizeLimit( 5 );
67 essid->setAutoCompletion( TRUE );
68 essid->setDuplicatesEnabled( FALSE );
69
70 Layout6->addWidget( essid, 1, 1 );
71
72 modeLabel = new QLabel( ConfigPage, "modeLabel" );
73 modeLabel->setEnabled( TRUE );
74 modeLabel->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, modeLabel->sizePolicy().hasHeightForWidth() ) );
75 modeLabel->setText( tr( "Mode" ) );
76
77 Layout6->addWidget( modeLabel, 0, 0 );
78
79 mode = new QComboBox( FALSE, ConfigPage, "mode" );
80 mode->insertItem( tr( "Infrastructure" ) );
81 mode->insertItem( tr( "Auto" ) );
82 mode->insertItem( tr( "Managed" ) );
83 mode->insertItem( tr( "Ad-Hoc" ) );
84 mode->setEnabled( TRUE );
85 mode->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, mode->sizePolicy().hasHeightForWidth() ) );
86
87 Layout6->addWidget( mode, 0, 1 );
88 ConfigPageLayout->addLayout( Layout6 );
89
90 Layout8 = new QGridLayout;
91 Layout8->setSpacing( 2 );
92 Layout8->setMargin( 1 );
93
94 specifyAp = new QCheckBox( ConfigPage, "specifyAp" );
95 specifyAp->setText( tr( "Specify &Access Point" ) );
96
97 Layout8->addMultiCellWidget( specifyAp, 0, 0, 0, 2 );
98
99 macLabel = new QLabel( ConfigPage, "macLabel" );
100 macLabel->setEnabled( FALSE );
101 macLabel->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)1, macLabel->sizePolicy().hasHeightForWidth() ) );
102 macLabel->setText( tr( "MAC" ) );
103
104 Layout8->addWidget( macLabel, 1, 1 );
105
106 macEdit = new QLineEdit( ConfigPage, "macEdit" );
107 macEdit->setEnabled( FALSE );
108 macEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)1, macEdit->sizePolicy().hasHeightForWidth() ) );
109
110 Layout8->addWidget( macEdit, 1, 2 );
111 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Fixed, QSizePolicy::Minimum );
112 Layout8->addItem( spacer, 1, 0 );
113 ConfigPageLayout->addLayout( Layout8 );
114
115 Layout7 = new QHBoxLayout;
116 Layout7->setSpacing( 6 );
117 Layout7->setMargin( 1 );
118
119 specifyChan = new QCheckBox( ConfigPage, "specifyChan" );
120 specifyChan->setText( tr( "Specific &Channel" ) );
121 Layout7->addWidget( specifyChan );
122
123 networkChannel = new QSpinBox( ConfigPage, "networkChannel" );
124 networkChannel->setEnabled( FALSE );
125 networkChannel->setMaxValue( 15 );
126 networkChannel->setMinValue( 1 );
127 networkChannel->setValue( 1 );
128 Layout7->addWidget( networkChannel );
129 ConfigPageLayout->addLayout( Layout7 );
130 QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
131 ConfigPageLayout->addItem( spacer_2 );
132 tabWidget->insertTab( ConfigPage, tr( "General" ) );
133
134 WepPage = new QWidget( tabWidget, "WepPage" );
135 WepPageLayout = new QVBoxLayout( WepPage );
136 WepPageLayout->setSpacing( 2 );
137 WepPageLayout->setMargin( 0 );
138
139 wepEnabled = new QCheckBox( WepPage, "wepEnabled" );
140 wepEnabled->setText( tr( "&Enable Encryption" ) );
141 WepPageLayout->addWidget( wepEnabled );
142
143 KeyButtonGroup = new QButtonGroup( WepPage, "KeyButtonGroup" );
144 KeyButtonGroup->setEnabled( FALSE );
145 KeyButtonGroup->setTitle( tr( "&Key Setting" ) );
146 KeyButtonGroup->setColumnLayout(0, Qt::Vertical );
147 KeyButtonGroup->layout()->setSpacing( 0 );
148 KeyButtonGroup->layout()->setMargin( 0 );
149 KeyButtonGroupLayout = new QGridLayout( KeyButtonGroup->layout() );
150 KeyButtonGroupLayout->setAlignment( Qt::AlignTop );
151 KeyButtonGroupLayout->setSpacing( 2 );
152 KeyButtonGroupLayout->setMargin( 2 );
153
154 keyRadio0 = new QRadioButton( KeyButtonGroup, "keyRadio0" );
155 keyRadio0->setText( tr( "Key &1" ) );
156 keyRadio0->setChecked( TRUE );
157
158 KeyButtonGroupLayout->addWidget( keyRadio0, 0, 0 );
159
160 keyRadio3 = new QRadioButton( KeyButtonGroup, "keyRadio3" );
161 keyRadio3->setText( tr( "Key &4" ) );
162
163 KeyButtonGroupLayout->addWidget( keyRadio3, 3, 0 );
164
165 LineEdit6 = new QLineEdit( KeyButtonGroup, "LineEdit6" );
166
167 KeyButtonGroupLayout->addWidget( LineEdit6, 0, 1 );
168
169 keyRadio1 = new QRadioButton( KeyButtonGroup, "keyRadio1" );
170 keyRadio1->setText( tr( "Key &2" ) );
171
172 KeyButtonGroupLayout->addWidget( keyRadio1, 1, 0 );
173
174 keyRadio2 = new QRadioButton( KeyButtonGroup, "keyRadio2" );
175 keyRadio2->setText( tr( "Key &3" ) );
176
177 KeyButtonGroupLayout->addWidget( keyRadio2, 2, 0 );
178
179 LineEdit6_2 = new QLineEdit( KeyButtonGroup, "LineEdit6_2" );
180
181 KeyButtonGroupLayout->addWidget( LineEdit6_2, 1, 1 );
182
183 LineEdit6_4 = new QLineEdit( KeyButtonGroup, "LineEdit6_4" );
184
185 KeyButtonGroupLayout->addWidget( LineEdit6_4, 3, 1 );
186
187 LineEdit6_3 = new QLineEdit( KeyButtonGroup, "LineEdit6_3" );
188
189 KeyButtonGroupLayout->addWidget( LineEdit6_3, 2, 1 );
190 WepPageLayout->addWidget( KeyButtonGroup );
191
192 NonEncButtonGroup = new QButtonGroup( WepPage, "NonEncButtonGroup" );
193 NonEncButtonGroup->setEnabled( FALSE );
194 NonEncButtonGroup->setTitle( tr( "Non-encrypted Packets" ) );
195 NonEncButtonGroup->setRadioButtonExclusive( TRUE );
196 NonEncButtonGroup->setColumnLayout(0, Qt::Vertical );
197 NonEncButtonGroup->layout()->setSpacing( 0 );
198 NonEncButtonGroup->layout()->setMargin( 0 );
199 NonEncButtonGroupLayout = new QGridLayout( NonEncButtonGroup->layout() );
200 NonEncButtonGroupLayout->setAlignment( Qt::AlignTop );
201 NonEncButtonGroupLayout->setSpacing( 6 );
202 NonEncButtonGroupLayout->setMargin( 2 );
203
204 acceptNonEnc = new QRadioButton( NonEncButtonGroup, "acceptNonEnc" );
205 acceptNonEnc->setText( tr( "&Accept" ) );
206 acceptNonEnc->setChecked( TRUE );
207 NonEncButtonGroup->insert( acceptNonEnc, 0 );
208
209 NonEncButtonGroupLayout->addWidget( acceptNonEnc, 0, 0 );
210
211 rejectNonEnc = new QRadioButton( NonEncButtonGroup, "rejectNonEnc" );
212 rejectNonEnc->setText( tr( "&Reject" ) );
213 NonEncButtonGroup->insert( rejectNonEnc, 1 );
214
215 NonEncButtonGroupLayout->addWidget( rejectNonEnc, 0, 1 );
216 WepPageLayout->addWidget( NonEncButtonGroup );
217 QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
218 WepPageLayout->addItem( spacer_3 );
219 tabWidget->insertTab( WepPage, tr( "Encryption" ) );
220
221 tab = new QWidget( tabWidget, "tab" );
222 tabLayout = new QVBoxLayout( tab );
223 tabLayout->setSpacing( 2 );
224 tabLayout->setMargin( 0 );
225
226 Layout12 = new QGridLayout;
227 Layout12->setSpacing( 2 );
228 Layout12->setMargin( 0 );
229
230 TextLabel1_3 = new QLabel( tab, "TextLabel1_3" );
231 TextLabel1_3->setText( tr( "Station" ) );
232
233 Layout12->addWidget( TextLabel1_3, 0, 0 );
234
235 Channel_LBL = new QLabel( tab, "Channel_LBL" );
236 Channel_LBL->setFrameShape( QLabel::Panel );
237 Channel_LBL->setFrameShadow( QLabel::Sunken );
238
239 Layout12->addWidget( Channel_LBL, 3, 1 );
240
241 TextLabel4_3 = new QLabel( tab, "TextLabel4_3" );
242 TextLabel4_3->setText( tr( "Channel" ) );
243
244 Layout12->addWidget( TextLabel4_3, 3, 0 );
245
246 TextLabel3_3 = new QLabel( tab, "TextLabel3_3" );
247 TextLabel3_3->setText( tr( "Mode" ) );
248
249 Layout12->addWidget( TextLabel3_3, 2, 0 );
250
251 TextLabel2_3 = new QLabel( tab, "TextLabel2_3" );
252 TextLabel2_3->setText( tr( "ESSID" ) );
253
254 Layout12->addWidget( TextLabel2_3, 1, 0 );
255
256 TextLabel9_2 = new QLabel( tab, "TextLabel9_2" );
257 TextLabel9_2->setText( tr( "AP" ) );
258
259 Layout12->addWidget( TextLabel9_2, 4, 0 );
260
261 Station_LBL = new QLabel( tab, "Station_LBL" );
262 Station_LBL->setFrameShape( QLabel::Panel );
263 Station_LBL->setFrameShadow( QLabel::Sunken );
264
265 Layout12->addWidget( Station_LBL, 0, 1 );
266
267 Rate_LBL = new QLabel( tab, "Rate_LBL" );
268 Rate_LBL->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)1, Rate_LBL->sizePolicy().hasHeightForWidth() ) );
269 Rate_LBL->setFrameShape( QLabel::Panel );
270 Rate_LBL->setFrameShadow( QLabel::Sunken );
271
272 Layout12->addWidget( Rate_LBL, 5, 1 );
273
274 TextLabel4_2_2 = new QLabel( tab, "TextLabel4_2_2" );
275 TextLabel4_2_2->setText( tr( "Rate" ) );
276
277 Layout12->addWidget( TextLabel4_2_2, 5, 0 );
278
279 AP_LBL = new QLabel( tab, "AP_LBL" );
280 AP_LBL->setFrameShape( QLabel::Panel );
281 AP_LBL->setFrameShadow( QLabel::Sunken );
282
283 Layout12->addWidget( AP_LBL, 4, 1 );
284
285 essidLabel_3 = new QLabel( tab, "essidLabel_3" );
286 essidLabel_3->setFrameShape( QLabel::Panel );
287 essidLabel_3->setFrameShadow( QLabel::Sunken );
288
289 Layout12->addWidget( essidLabel_3, 1, 1 );
290
291 modeLabel_3 = new QLabel( tab, "modeLabel_3" );
292 modeLabel_3->setFrameShape( QLabel::Panel );
293 modeLabel_3->setFrameShadow( QLabel::Sunken );
294
295 Layout12->addWidget( modeLabel_3, 2, 1 );
296 tabLayout->addLayout( Layout12 );
297
298 GroupBox1 = new QGroupBox( tab, "GroupBox1" );
299 GroupBox1->setTitle( tr( "Link Quality" ) );
300 GroupBox1->setColumnLayout(0, Qt::Vertical );
301 GroupBox1->layout()->setSpacing( 0 );
302 GroupBox1->layout()->setMargin( 0 );
303 GroupBox1Layout = new QGridLayout( GroupBox1->layout() );
304 GroupBox1Layout->setAlignment( Qt::AlignTop );
305 GroupBox1Layout->setSpacing( 2 );
306 GroupBox1Layout->setMargin( 2 );
307
308 TextLabel2_2_2 = new QLabel( GroupBox1, "TextLabel2_2_2" );
309 TextLabel2_2_2->setText( tr( "Noise" ) );
310
311 GroupBox1Layout->addWidget( TextLabel2_2_2, 1, 0 );
312
313 TextLabel3_2_2 = new QLabel( GroupBox1, "TextLabel3_2_2" );
314 TextLabel3_2_2->setText( tr( "Quality" ) );
315
316 GroupBox1Layout->addWidget( TextLabel3_2_2, 2, 0 );
317
318 Noise_PB = new QProgressBar( GroupBox1, "Noise_PB" );
319 Noise_PB->setProgress( 0 );
320
321 GroupBox1Layout->addWidget( Noise_PB, 1, 2 );
322
323 Quality_PB = new QProgressBar( GroupBox1, "Quality_PB" );
324 Quality_PB->setProgress( 0 );
325
326 GroupBox1Layout->addWidget( Quality_PB, 2, 2 );
327
328 TextLabel1_2_2 = new QLabel( GroupBox1, "TextLabel1_2_2" );
329 TextLabel1_2_2->setText( tr( "Signal" ) );
330
331 GroupBox1Layout->addWidget( TextLabel1_2_2, 0, 0 );
332 QSpacerItem* spacer_4 = new QSpacerItem( 16, 20, QSizePolicy::Fixed, QSizePolicy::Minimum );
333 GroupBox1Layout->addItem( spacer_4, 0, 1 );
334
335 Signal_PB = new QProgressBar( GroupBox1, "Signal_PB" );
336 Signal_PB->setProgress( 0 );
337
338 GroupBox1Layout->addWidget( Signal_PB, 0, 2 );
339 tabLayout->addWidget( GroupBox1 );
340 QSpacerItem* spacer_5 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
341 tabLayout->addItem( spacer_5 );
342 tabWidget->insertTab( tab, tr( "State" ) );
343 WLanGUILayout->addWidget( tabWidget );
344
345 // signals and slots connections
346 connect( wepEnabled, SIGNAL( toggled(bool) ), KeyButtonGroup, SLOT( setEnabled(bool) ) );
347 connect( wepEnabled, SIGNAL( toggled(bool) ), NonEncButtonGroup, SLOT( setEnabled(bool) ) );
348 connect( specifyAp, SIGNAL( toggled(bool) ), macEdit, SLOT( setEnabled(bool) ) );
349 connect( specifyAp, SIGNAL( toggled(bool) ), macLabel, SLOT( setEnabled(bool) ) );
350 connect( specifyChan, SIGNAL( toggled(bool) ), networkChannel, SLOT( setEnabled(bool) ) );
351}
352
353/*
354 * Destroys the object and frees any allocated resources
355 */
356WLanGUI::~WLanGUI()
357{
358 // no need to delete child widgets, Qt does it all for us
359}
360
diff --git a/noncore/settings/networksettings2/wlan/wlanGUI.h b/noncore/settings/networksettings2/wlan/wlanGUI.h
new file mode 100644
index 0000000..42e8705
--- a/dev/null
+++ b/noncore/settings/networksettings2/wlan/wlanGUI.h
@@ -0,0 +1,96 @@
1/****************************************************************************
2** Form interface generated from reading ui file 'wlanGUI.ui'
3**
4** Created: Tue Mar 30 02:42:55 2004
5** by: The User Interface Compiler (uic)
6**
7** WARNING! All changes made in this file will be lost!
8****************************************************************************/
9#ifndef WLANGUI_H
10#define WLANGUI_H
11
12#include <qvariant.h>
13#include <qwidget.h>
14class QVBoxLayout;
15class QHBoxLayout;
16class QGridLayout;
17class QButtonGroup;
18class QCheckBox;
19class QComboBox;
20class QGroupBox;
21class QLabel;
22class QLineEdit;
23class QProgressBar;
24class QRadioButton;
25class QSpinBox;
26class QTabWidget;
27
28class WLanGUI : public QWidget
29{
30 Q_OBJECT
31
32public:
33 WLanGUI( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
34 ~WLanGUI();
35
36 QTabWidget* tabWidget;
37 QWidget* ConfigPage;
38 QLabel* essidLabel;
39 QComboBox* essid;
40 QLabel* modeLabel;
41 QComboBox* mode;
42 QCheckBox* specifyAp;
43 QLabel* macLabel;
44 QLineEdit* macEdit;
45 QCheckBox* specifyChan;
46 QSpinBox* networkChannel;
47 QWidget* WepPage;
48 QCheckBox* wepEnabled;
49 QButtonGroup* KeyButtonGroup;
50 QRadioButton* keyRadio0;
51 QRadioButton* keyRadio3;
52 QLineEdit* LineEdit6;
53 QRadioButton* keyRadio1;
54 QRadioButton* keyRadio2;
55 QLineEdit* LineEdit6_2;
56 QLineEdit* LineEdit6_4;
57 QLineEdit* LineEdit6_3;
58 QButtonGroup* NonEncButtonGroup;
59 QRadioButton* acceptNonEnc;
60 QRadioButton* rejectNonEnc;
61 QWidget* tab;
62 QLabel* TextLabel1_3;
63 QLabel* Channel_LBL;
64 QLabel* TextLabel4_3;
65 QLabel* TextLabel3_3;
66 QLabel* TextLabel2_3;
67 QLabel* TextLabel9_2;
68 QLabel* Station_LBL;
69 QLabel* Rate_LBL;
70 QLabel* TextLabel4_2_2;
71 QLabel* AP_LBL;
72 QLabel* essidLabel_3;
73 QLabel* modeLabel_3;
74 QGroupBox* GroupBox1;
75 QLabel* TextLabel2_2_2;
76 QLabel* TextLabel3_2_2;
77 QProgressBar* Noise_PB;
78 QProgressBar* Quality_PB;
79 QLabel* TextLabel1_2_2;
80 QProgressBar* Signal_PB;
81
82protected:
83 QVBoxLayout* WLanGUILayout;
84 QVBoxLayout* ConfigPageLayout;
85 QGridLayout* Layout6;
86 QGridLayout* Layout8;
87 QHBoxLayout* Layout7;
88 QVBoxLayout* WepPageLayout;
89 QGridLayout* KeyButtonGroupLayout;
90 QGridLayout* NonEncButtonGroupLayout;
91 QVBoxLayout* tabLayout;
92 QGridLayout* Layout12;
93 QGridLayout* GroupBox1Layout;
94};
95
96#endif // WLANGUI_H
diff --git a/noncore/settings/networksettings2/wlan/wlan_NN.cpp b/noncore/settings/networksettings2/wlan/wlan_NN.cpp
new file mode 100644
index 0000000..5a26e41
--- a/dev/null
+++ b/noncore/settings/networksettings2/wlan/wlan_NN.cpp
@@ -0,0 +1,60 @@
1#include "wlan_NN.h"
2#include "wlan_NNI.h"
3
4static const char * WLanNeeds[] =
5 { 0
6 };
7
8/**
9 * Constructor, find all of the possible interfaces
10 */
11WLanNetNode::WLanNetNode() : ANetNode() {
12}
13
14/**
15 * Delete any interfaces that we own.
16 */
17WLanNetNode::~WLanNetNode(){
18}
19
20const QString WLanNetNode::nodeDescription(){
21 return tr("\
22<p>Configure Wi/Fi or WLan network cards.</p>\
23<p>Defines Wireless options for those cards</p>\
24"
25);
26}
27
28ANetNodeInstance * WLanNetNode::createInstance( void ) {
29 return new AWLan( this );
30}
31
32const char ** WLanNetNode::needs( void ) {
33 return WLanNeeds;
34}
35
36const char * WLanNetNode::provides( void ) {
37 return "device";
38}
39
40bool WLanNetNode::generateProperFilesFor(
41 ANetNodeInstance * ) {
42 return 1;
43}
44
45bool WLanNetNode::hasDataFor( const QString & ) {
46 return 0;
47}
48
49bool WLanNetNode::generateDataForCommonFile(
50 SystemFile & ,
51 long,
52 ANetNodeInstance * ) {
53 return 1;
54}
55
56extern "C" {
57void create_plugin( QList<ANetNode> & PNN ) {
58 PNN.append( new WLanNetNode() );
59}
60}
diff --git a/noncore/settings/networksettings2/wlan/wlan_NN.h b/noncore/settings/networksettings2/wlan/wlan_NN.h
new file mode 100644
index 0000000..d1d6ded
--- a/dev/null
+++ b/noncore/settings/networksettings2/wlan/wlan_NN.h
@@ -0,0 +1,44 @@
1#ifndef WLAN_NETNODE_H
2#define WLAN_NETNODE_H
3
4#include "netnode.h"
5
6class AWLan;
7
8class WLanNetNode : public ANetNode{
9
10 Q_OBJECT
11
12public:
13
14 WLanNetNode();
15 virtual ~WLanNetNode();
16
17 virtual const QString pixmapName()
18 { return "wlan"; }
19
20 virtual const QString nodeName()
21 { return tr("WLan Device"); }
22
23 virtual const QString nodeDescription() ;
24
25 virtual ANetNodeInstance * createInstance( void );
26
27 virtual const char ** needs( void );
28 virtual const char * provides( void );
29
30 virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
31 virtual bool hasDataFor( const QString & S );
32 virtual bool generateDataForCommonFile(
33 SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
34
35private:
36
37};
38
39extern "C"
40{
41 void create_plugin( QList<ANetNode> & PNN );
42};
43
44#endif
diff --git a/noncore/settings/networksettings2/wlan/wlan_NNI.cpp b/noncore/settings/networksettings2/wlan/wlan_NNI.cpp
new file mode 100644
index 0000000..92f3457
--- a/dev/null
+++ b/noncore/settings/networksettings2/wlan/wlan_NNI.cpp
@@ -0,0 +1,30 @@
1#include "wlanedit.h"
2#include "wlan_NNI.h"
3#include "wlan_NN.h"
4
5AWLan::AWLan( WLanNetNode * PNN ) : ANetNodeInstance( PNN ) {
6 GUI = 0;
7 RT = 0;
8}
9
10void AWLan::setSpecificAttribute( QString & , QString & ) {
11}
12
13void AWLan::saveSpecificAttribute( QTextStream & ) {
14}
15
16QWidget * AWLan::edit( QWidget * parent ) {
17 GUI = new WLanEdit( parent );
18 GUI->showData( Data );
19 return GUI;
20}
21
22QString AWLan::acceptable( void ) {
23 return ( GUI ) ? GUI->acceptable( ) : QString();
24}
25
26void AWLan::commit( void ) {
27 if( GUI && GUI->commit( Data ) )
28 setModified( 1 );
29}
30
diff --git a/noncore/settings/networksettings2/wlan/wlan_NNI.h b/noncore/settings/networksettings2/wlan/wlan_NNI.h
new file mode 100644
index 0000000..8b695b5
--- a/dev/null
+++ b/noncore/settings/networksettings2/wlan/wlan_NNI.h
@@ -0,0 +1,43 @@
1#ifndef WLAN_H
2#define WLAN_H
3
4#include <netnode.h>
5#include "wlandata.h"
6#include "wlanrun.h"
7
8class WLanNetNode;
9class WLanEdit;
10
11class AWLan : public ANetNodeInstance {
12
13public :
14
15 AWLan( WLanNetNode * PNN );
16
17 QWidget * edit( QWidget * parent );
18 QString acceptable( void );
19 void commit( void );
20
21 RuntimeInfo * runtime( void )
22 { if( RT == 0 )
23 RT = new WLanRun( this, Data );
24 return RT;
25 }
26
27 virtual void * data( void )
28 { return (void *)&Data; }
29
30protected :
31
32 virtual void setSpecificAttribute( QString & Attr, QString & Value );
33 virtual void saveSpecificAttribute( QTextStream & TS );
34
35private :
36
37 WLanEdit * GUI;
38 WLanData Data;
39 WLanRun * RT;
40
41};
42
43#endif
diff --git a/noncore/settings/networksettings2/wlan/wlandata.h b/noncore/settings/networksettings2/wlan/wlandata.h
new file mode 100644
index 0000000..ba1f2c2
--- a/dev/null
+++ b/noncore/settings/networksettings2/wlan/wlandata.h
@@ -0,0 +1,17 @@
1#ifndef WLAN_DATA_H
2#define WLAN_DATA_H
3
4#include <qstring.h>
5typedef struct WLanData {
6 QString Device;
7 QString LockFile;
8 long Speed;
9 short Parity;
10 short DataBits;
11 short StopBits;
12 bool HardwareControl;
13 bool SoftwareControl;
14
15} WLanData_t;
16
17#endif
diff --git a/noncore/settings/networksettings2/wlan/wlanedit.cpp b/noncore/settings/networksettings2/wlan/wlanedit.cpp
new file mode 100644
index 0000000..c884886
--- a/dev/null
+++ b/noncore/settings/networksettings2/wlan/wlanedit.cpp
@@ -0,0 +1,16 @@
1#include <GUIUtils.h>
2#include "wlanedit.h"
3
4WLanEdit::WLanEdit( QWidget * Parent ) : WLanGUI( Parent ){
5}
6
7QString WLanEdit::acceptable( void ) {
8 return QString();
9}
10
11void WLanEdit::showData( WLanData_t & Data ) {
12}
13
14bool WLanEdit::commit( WLanData_t & Data ) {
15 return 0;
16}
diff --git a/noncore/settings/networksettings2/wlan/wlanedit.h b/noncore/settings/networksettings2/wlan/wlanedit.h
new file mode 100644
index 0000000..b7442d5
--- a/dev/null
+++ b/noncore/settings/networksettings2/wlan/wlanedit.h
@@ -0,0 +1,12 @@
1#include "wlandata.h"
2#include "wlanGUI.h"
3
4class WLanEdit : public WLanGUI {
5
6public :
7
8 WLanEdit( QWidget * parent );
9 QString acceptable( void );
10 void showData( WLanData_t & Data );
11 bool commit( WLanData_t & Data );
12};
diff --git a/noncore/settings/networksettings2/wlan/wlanrun.cpp b/noncore/settings/networksettings2/wlan/wlanrun.cpp
new file mode 100644
index 0000000..79f11f7
--- a/dev/null
+++ b/noncore/settings/networksettings2/wlan/wlanrun.cpp
@@ -0,0 +1,5 @@
1#include "wlanrun.h"
2
3bool WLanRun::handlesInterface( const QString & S ) {
4 return Pat.match( S ) >= 0;
5}
diff --git a/noncore/settings/networksettings2/wlan/wlanrun.h b/noncore/settings/networksettings2/wlan/wlanrun.h
new file mode 100644
index 0000000..4cbb059
--- a/dev/null
+++ b/noncore/settings/networksettings2/wlan/wlanrun.h
@@ -0,0 +1,42 @@
1#ifndef WLANRUN_H
2#define WLANRUN_H
3
4#include <qregexp.h>
5#include <asdevice.h>
6#include "wlandata.h"
7
8class WLanRun : public AsDevice {
9
10public :
11
12 WLanRun( ANetNodeInstance * NNI, WLanData & Data ) :
13 AsDevice( NNI ),
14 Pat( "wlan[0-9]" )
15 { }
16
17 virtual long count( void )
18 { return 2; }
19 virtual QString genNic( long nr )
20 { QString S; return S.sprintf( "wlan%ld", nr ); }
21 virtual AsDevice * device( void )
22 { return asDevice(); }
23
24protected :
25
26 void detectState( NodeCollection * )
27 { }
28
29 bool setState( NodeCollection *, Action_t )
30 { return 0; }
31
32 bool canSetState( State_t, Action_t )
33 { return 0; }
34
35 bool handlesInterface( const QString & I );
36
37private :
38
39 QRegExp Pat;
40};
41
42#endif