author | wimpie <wimpie> | 2004-04-07 00:09:37 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2004-04-07 00:09:37 (UTC) |
commit | b93d9e0c4384be0a6f40be257ba791004388400b (patch) (unidiff) | |
tree | 2ca0e41dc8c99e1af3ce2f0305d458f76d10db45 /noncore/settings | |
parent | 1b7aaf904fa70c16eee03155bd826e921798cc22 (diff) | |
download | opie-b93d9e0c4384be0a6f40be257ba791004388400b.zip opie-b93d9e0c4384be0a6f40be257ba791004388400b.tar.gz opie-b93d9e0c4384be0a6f40be257ba791004388400b.tar.bz2 |
MANY changes ... lancards should be OK now
38 files changed, 554 insertions, 172 deletions
diff --git a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp index 4579e37..1d0a0f7 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp +++ b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp | |||
@@ -10,17 +10,18 @@ | |||
10 | 10 | ||
11 | static const char * BluetoothBNEPNeeds[] = | 11 | static const char * BluetoothBNEPNeeds[] = |
12 | { 0 | 12 | { 0 |
13 | }; | 13 | }; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * Constructor, find all of the possible interfaces | 16 | * Constructor, find all of the possible interfaces |
17 | */ | 17 | */ |
18 | BluetoothBNEPNetNode::BluetoothBNEPNetNode() : ANetNode() { | 18 | BluetoothBNEPNetNode::BluetoothBNEPNetNode() : |
19 | ANetNode(tr("Bluetooth PAN/NAP")) { | ||
19 | InstanceCount = 7; // default | 20 | InstanceCount = 7; // default |
20 | } | 21 | } |
21 | 22 | ||
22 | /** | 23 | /** |
23 | * Delete any interfaces that we own. | 24 | * Delete any interfaces that we own. |
24 | */ | 25 | */ |
25 | BluetoothBNEPNetNode::~BluetoothBNEPNetNode(){ | 26 | BluetoothBNEPNetNode::~BluetoothBNEPNetNode(){ |
26 | } | 27 | } |
@@ -83,17 +84,18 @@ void BluetoothBNEPNetNode::saveSpecificAttribute( QTextStream & TS) { | |||
83 | // BLUETOOTH RFCOMM | 84 | // BLUETOOTH RFCOMM |
84 | // | 85 | // |
85 | // | 86 | // |
86 | 87 | ||
87 | static const char * BluetoothRFCOMMNeeds[] = | 88 | static const char * BluetoothRFCOMMNeeds[] = |
88 | { 0 | 89 | { 0 |
89 | }; | 90 | }; |
90 | 91 | ||
91 | BluetoothRFCOMMNetNode::BluetoothRFCOMMNetNode() : ANetNode() { | 92 | BluetoothRFCOMMNetNode::BluetoothRFCOMMNetNode() : |
93 | ANetNode( tr("Bluetooth serial link") ) { | ||
92 | } | 94 | } |
93 | 95 | ||
94 | BluetoothRFCOMMNetNode::~BluetoothRFCOMMNetNode(){ | 96 | BluetoothRFCOMMNetNode::~BluetoothRFCOMMNetNode(){ |
95 | } | 97 | } |
96 | 98 | ||
97 | const QString BluetoothRFCOMMNetNode::nodeDescription(){ | 99 | const QString BluetoothRFCOMMNetNode::nodeDescription(){ |
98 | return tr("\ | 100 | return tr("\ |
99 | <p>Sets up a bluetooth link using the bluetooth serial profile.</p>\ | 101 | <p>Sets up a bluetooth link using the bluetooth serial profile.</p>\ |
diff --git a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h index 882d2e3..2e5e1d2 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h +++ b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h | |||
@@ -12,19 +12,16 @@ class BluetoothBNEPNetNode : public ANetNode { | |||
12 | public: | 12 | public: |
13 | 13 | ||
14 | BluetoothBNEPNetNode(); | 14 | BluetoothBNEPNetNode(); |
15 | virtual ~BluetoothBNEPNetNode(); | 15 | virtual ~BluetoothBNEPNetNode(); |
16 | 16 | ||
17 | virtual const QString pixmapName() | 17 | virtual const QString pixmapName() |
18 | { return "Devices/bluetooth"; } | 18 | { return "Devices/bluetooth"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | ||
21 | { return tr("Bluetooth PAN/NAP"); } | ||
22 | |||
23 | virtual const QString nodeDescription() ; | 20 | virtual const QString nodeDescription() ; |
24 | 21 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 22 | virtual ANetNodeInstance * createInstance( void ); |
26 | 23 | ||
27 | virtual const char ** needs( void ); | 24 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 25 | virtual const char * provides( void ); |
29 | 26 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 27 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
@@ -53,19 +50,16 @@ class BluetoothRFCOMMNetNode : public ANetNode { | |||
53 | public: | 50 | public: |
54 | 51 | ||
55 | BluetoothRFCOMMNetNode(); | 52 | BluetoothRFCOMMNetNode(); |
56 | virtual ~BluetoothRFCOMMNetNode(); | 53 | virtual ~BluetoothRFCOMMNetNode(); |
57 | 54 | ||
58 | virtual const QString pixmapName() | 55 | virtual const QString pixmapName() |
59 | { return "Devices/bluetooth"; } | 56 | { return "Devices/bluetooth"; } |
60 | 57 | ||
61 | virtual const QString nodeName() | ||
62 | { return tr("Bluetooth serial link"); } | ||
63 | |||
64 | virtual const QString nodeDescription() ; | 58 | virtual const QString nodeDescription() ; |
65 | 59 | ||
66 | virtual ANetNodeInstance * createInstance( void ); | 60 | virtual ANetNodeInstance * createInstance( void ); |
67 | 61 | ||
68 | virtual const char ** needs( void ); | 62 | virtual const char ** needs( void ); |
69 | virtual const char * provides( void ); | 63 | virtual const char * provides( void ); |
70 | 64 | ||
71 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 65 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
diff --git a/noncore/settings/networksettings2/cable/cable_NN.cpp b/noncore/settings/networksettings2/cable/cable_NN.cpp index dd41c1f..e95b4f6 100644 --- a/noncore/settings/networksettings2/cable/cable_NN.cpp +++ b/noncore/settings/networksettings2/cable/cable_NN.cpp | |||
@@ -3,17 +3,17 @@ | |||
3 | 3 | ||
4 | static const char * CableNeeds[] = | 4 | static const char * CableNeeds[] = |
5 | { 0 | 5 | { 0 |
6 | }; | 6 | }; |
7 | 7 | ||
8 | /** | 8 | /** |
9 | * Constructor, find all of the possible interfaces | 9 | * Constructor, find all of the possible interfaces |
10 | */ | 10 | */ |
11 | CableNetNode::CableNetNode() : ANetNode() { | 11 | CableNetNode::CableNetNode() : ANetNode(tr("Cable Connection")) { |
12 | } | 12 | } |
13 | 13 | ||
14 | /** | 14 | /** |
15 | * Delete any interfaces that we own. | 15 | * Delete any interfaces that we own. |
16 | */ | 16 | */ |
17 | CableNetNode::~CableNetNode(){ | 17 | CableNetNode::~CableNetNode(){ |
18 | } | 18 | } |
19 | 19 | ||
diff --git a/noncore/settings/networksettings2/cable/cable_NN.h b/noncore/settings/networksettings2/cable/cable_NN.h index b37f31a..c48037a 100644 --- a/noncore/settings/networksettings2/cable/cable_NN.h +++ b/noncore/settings/networksettings2/cable/cable_NN.h | |||
@@ -12,19 +12,16 @@ class CableNetNode : public ANetNode { | |||
12 | public: | 12 | public: |
13 | 13 | ||
14 | CableNetNode(); | 14 | CableNetNode(); |
15 | virtual ~CableNetNode(); | 15 | virtual ~CableNetNode(); |
16 | 16 | ||
17 | virtual const QString pixmapName() | 17 | virtual const QString pixmapName() |
18 | { return "Devices/cable"; } | 18 | { return "Devices/cable"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | ||
21 | { return tr("Cable Connection"); } | ||
22 | |||
23 | virtual const QString nodeDescription() ; | 20 | virtual const QString nodeDescription() ; |
24 | 21 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 22 | virtual ANetNodeInstance * createInstance( void ); |
26 | 23 | ||
27 | virtual const char ** needs( void ); | 24 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 25 | virtual const char * provides( void ); |
29 | 26 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 27 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
diff --git a/noncore/settings/networksettings2/editconnection.cpp b/noncore/settings/networksettings2/editconnection.cpp index 4bbe502..77826d1 100644 --- a/noncore/settings/networksettings2/editconnection.cpp +++ b/noncore/settings/networksettings2/editconnection.cpp | |||
@@ -128,17 +128,17 @@ NodeCollection * EditConnection::getTmpCollection( void ) { | |||
128 | // child is controller -> has sub radio | 128 | // child is controller -> has sub radio |
129 | // check if one radio is selected | 129 | // check if one radio is selected |
130 | it = it->firstChild(); | 130 | it = it->firstChild(); |
131 | while( it ) { | 131 | while( it ) { |
132 | if( ((QCheckListItem *)it)->isOn() ) { | 132 | if( ((QCheckListItem *)it)->isOn() ) { |
133 | // this radio is selected -> go deeper | 133 | // this radio is selected -> go deeper |
134 | if( SelectedNodes == 0 || | 134 | if( SelectedNodes == 0 || |
135 | NNI == 0 || | 135 | NNI == 0 || |
136 | NNI->nodeClass()->nodeName() != it->text(0) ) { | 136 | it->text(0) != NNI->nodeClass()->name() ) { |
137 | // new item not in previous collection | 137 | // new item not in previous collection |
138 | ANetNodeInstance * NNI = (*Mapping)[it]->createInstance(); | 138 | ANetNodeInstance * NNI = (*Mapping)[it]->createInstance(); |
139 | NNI->initialize(); | 139 | NNI->initialize(); |
140 | // this node type not in collection | 140 | // this node type not in collection |
141 | TmpCollection.append( NNI ); | 141 | TmpCollection.append( NNI ); |
142 | // master collection changed because new item in it | 142 | // master collection changed because new item in it |
143 | TmpCollection.setModified( 1 ); | 143 | TmpCollection.setModified( 1 ); |
144 | // no more valid items in old list | 144 | // no more valid items in old list |
@@ -191,17 +191,17 @@ void EditConnection::setConnection( NodeCollection * NC ) { | |||
191 | NN = (*Mapping)[it]; | 191 | NN = (*Mapping)[it]; |
192 | if( NN == 0 ) { | 192 | if( NN == 0 ) { |
193 | // child is controller -> has sub radio | 193 | // child is controller -> has sub radio |
194 | QString Ctr = it->text(0); | 194 | QString Ctr = it->text(0); |
195 | // check if one radio is selected | 195 | // check if one radio is selected |
196 | it = it->firstChild(); | 196 | it = it->firstChild(); |
197 | Found = 0; | 197 | Found = 0; |
198 | while( it ) { | 198 | while( it ) { |
199 | if( NNI && NNI->nodeClass()->nodeName() == it->text(0) ) { | 199 | if( NNI && it->text(0) == NNI->nodeClass()->name() ) { |
200 | // this radio is part of the collection | 200 | // this radio is part of the collection |
201 | ((QCheckListItem *)it)->setOn( 1 ); | 201 | ((QCheckListItem *)it)->setOn( 1 ); |
202 | updateGUI( it, NNI->nodeClass() ); | 202 | updateGUI( it, NNI->nodeClass() ); |
203 | // check its children | 203 | // check its children |
204 | Found = 1; | 204 | Found = 1; |
205 | it = it->firstChild(); | 205 | it = it->firstChild(); |
206 | NNI = SelectedNodes->next(); | 206 | NNI = SelectedNodes->next(); |
207 | // do not bother to check other items | 207 | // do not bother to check other items |
@@ -277,17 +277,17 @@ void EditConnection::buildFullTree( void ) { | |||
277 | 277 | ||
278 | NN = Iter.current()->NetNode; | 278 | NN = Iter.current()->NetNode; |
279 | 279 | ||
280 | if( ! NN->isToplevel() ) { | 280 | if( ! NN->isToplevel() ) { |
281 | continue; | 281 | continue; |
282 | } | 282 | } |
283 | 283 | ||
284 | MyQCheckListItem * it = new MyQCheckListItem( TheTop, | 284 | MyQCheckListItem * it = new MyQCheckListItem( TheTop, |
285 | NN->nodeName(), | 285 | NN->name(), |
286 | QCheckListItem::RadioButton ); | 286 | QCheckListItem::RadioButton ); |
287 | it->setPixmap( 0, NSResources->getPixmap( "Devices/commprofile" ) ); | 287 | it->setPixmap( 0, NSResources->getPixmap( "Devices/commprofile" ) ); |
288 | // remember that this node maps to this listitem | 288 | // remember that this node maps to this listitem |
289 | Mapping->insert( it, NN ); | 289 | Mapping->insert( it, NN ); |
290 | buildSubTree( it, NN ); | 290 | buildSubTree( it, NN ); |
291 | } | 291 | } |
292 | } | 292 | } |
293 | 293 | ||
@@ -305,24 +305,24 @@ void EditConnection::buildSubTree( QListViewItem * it, ANetNode *NN ) { | |||
305 | } | 305 | } |
306 | 306 | ||
307 | for ( unsigned int i=0; i < NNL.size(); i++ ) { | 307 | for ( unsigned int i=0; i < NNL.size(); i++ ) { |
308 | QListViewItem * CI; | 308 | QListViewItem * CI; |
309 | if( NNL.size() > 1 ) { | 309 | if( NNL.size() > 1 ) { |
310 | // generate radio buttons | 310 | // generate radio buttons |
311 | CI = new MyQCheckListItem( | 311 | CI = new MyQCheckListItem( |
312 | (QCheckListItem *)it, | 312 | (QCheckListItem *)it, |
313 | NNL[i]->nodeName(), QCheckListItem::RadioButton ); | 313 | NNL[i]->name(), QCheckListItem::RadioButton ); |
314 | // remember that this node maps to this listitem | 314 | // remember that this node maps to this listitem |
315 | CI->setPixmap( 0, NSResources->getPixmap( NNL[i]->pixmapName() ) ); | 315 | CI->setPixmap( 0, NSResources->getPixmap( NNL[i]->pixmapName() ) ); |
316 | Mapping->insert( CI, NNL[i] ); | 316 | Mapping->insert( CI, NNL[i] ); |
317 | CI->setSelectable( FALSE ); | 317 | CI->setSelectable( FALSE ); |
318 | } else { | 318 | } else { |
319 | // Single item | 319 | // Single item |
320 | CI = new MyQListViewItem( it, NNL[i]->nodeName() ); | 320 | CI = new MyQListViewItem( it, NNL[i]->name() ); |
321 | // remember that this node maps to this listitem | 321 | // remember that this node maps to this listitem |
322 | Mapping->insert( CI, NNL[i] ); | 322 | Mapping->insert( CI, NNL[i] ); |
323 | CI->setSelectable( FALSE ); | 323 | CI->setSelectable( FALSE ); |
324 | CI->setPixmap( 0, NSResources->getPixmap( NNL[i]->pixmapName() ) ); | 324 | CI->setPixmap( 0, NSResources->getPixmap( NNL[i]->pixmapName() ) ); |
325 | } | 325 | } |
326 | buildSubTree( CI, NNL[i] ); | 326 | buildSubTree( CI, NNL[i] ); |
327 | } | 327 | } |
328 | } | 328 | } |
@@ -439,17 +439,17 @@ void EditConnection::SLOT_AlterTab( const QString & S ) { | |||
439 | QListIterator<ANetNodeInstance> it(TmpCollection); | 439 | QListIterator<ANetNodeInstance> it(TmpCollection); |
440 | int i = 0; | 440 | int i = 0; |
441 | QWidget * W; | 441 | QWidget * W; |
442 | 442 | ||
443 | for ( ; it.current(); ++it ) { | 443 | for ( ; it.current(); ++it ) { |
444 | NNI = it.current(); | 444 | NNI = it.current(); |
445 | Devices_CB->insertItem( | 445 | Devices_CB->insertItem( |
446 | NSResources->getPixmap( NNI->nodeClass()->pixmapName() ), | 446 | NSResources->getPixmap( NNI->nodeClass()->pixmapName() ), |
447 | NNI->nodeClass()->nodeName() | 447 | NNI->nodeClass()->name() |
448 | ); | 448 | ); |
449 | 449 | ||
450 | // add edit widget | 450 | // add edit widget |
451 | W = NNI->edit( Setup_WS ); | 451 | W = NNI->edit( Setup_WS ); |
452 | if( ! W) { | 452 | if( ! W) { |
453 | W = new QLabel( Setup_WS, | 453 | W = new QLabel( Setup_WS, |
454 | tr("No configuration required")); | 454 | tr("No configuration required")); |
455 | } | 455 | } |
diff --git a/noncore/settings/networksettings2/irda/irda_NN.cpp b/noncore/settings/networksettings2/irda/irda_NN.cpp index 49b7707..f2fda5c 100644 --- a/noncore/settings/networksettings2/irda/irda_NN.cpp +++ b/noncore/settings/networksettings2/irda/irda_NN.cpp | |||
@@ -3,17 +3,17 @@ | |||
3 | 3 | ||
4 | static const char * IRDANeeds[] = | 4 | static const char * IRDANeeds[] = |
5 | { 0 | 5 | { 0 |
6 | }; | 6 | }; |
7 | 7 | ||
8 | /** | 8 | /** |
9 | * Constructor, find all of the possible interfaces | 9 | * Constructor, find all of the possible interfaces |
10 | */ | 10 | */ |
11 | IRDANetNode::IRDANetNode() : ANetNode() { | 11 | IRDANetNode::IRDANetNode() : ANetNode(tr("Infrared link")) { |
12 | } | 12 | } |
13 | 13 | ||
14 | /** | 14 | /** |
15 | * Delete any interfaces that we own. | 15 | * Delete any interfaces that we own. |
16 | */ | 16 | */ |
17 | IRDANetNode::~IRDANetNode(){ | 17 | IRDANetNode::~IRDANetNode(){ |
18 | } | 18 | } |
19 | 19 | ||
diff --git a/noncore/settings/networksettings2/irda/irda_NN.h b/noncore/settings/networksettings2/irda/irda_NN.h index 2dcef74..fa6408d 100644 --- a/noncore/settings/networksettings2/irda/irda_NN.h +++ b/noncore/settings/networksettings2/irda/irda_NN.h | |||
@@ -12,19 +12,16 @@ class IRDANetNode : public ANetNode { | |||
12 | public: | 12 | public: |
13 | 13 | ||
14 | IRDANetNode(); | 14 | IRDANetNode(); |
15 | virtual ~IRDANetNode(); | 15 | virtual ~IRDANetNode(); |
16 | 16 | ||
17 | virtual const QString pixmapName() | 17 | virtual const QString pixmapName() |
18 | { return "Devices/irda"; } | 18 | { return "Devices/irda"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | ||
21 | { return tr("Infrared link"); } | ||
22 | |||
23 | virtual const QString nodeDescription() ; | 20 | virtual const QString nodeDescription() ; |
24 | 21 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 22 | virtual ANetNodeInstance * createInstance( void ); |
26 | 23 | ||
27 | virtual const char ** needs( void ); | 24 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 25 | virtual const char * provides( void ); |
29 | 26 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 27 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
diff --git a/noncore/settings/networksettings2/lancard/lancardGUI.ui b/noncore/settings/networksettings2/lancard/lancardGUI.ui index 8d94816..c407175 100644 --- a/noncore/settings/networksettings2/lancard/lancardGUI.ui +++ b/noncore/settings/networksettings2/lancard/lancardGUI.ui | |||
@@ -6,17 +6,17 @@ | |||
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>Lancard_FRM</cstring> | 7 | <cstring>Lancard_FRM</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>362</width> | 14 | <width>354</width> |
15 | <height>359</height> | 15 | <height>359</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>LAN card</string> | 20 | <string>LAN card</string> |
21 | </property> | 21 | </property> |
22 | <property> | 22 | <property> |
@@ -64,41 +64,27 @@ | |||
64 | <string>Select Card</string> | 64 | <string>Select Card</string> |
65 | </property> | 65 | </property> |
66 | <property> | 66 | <property> |
67 | <name>layoutMargin</name> | 67 | <name>layoutMargin</name> |
68 | </property> | 68 | </property> |
69 | <vbox> | 69 | <vbox> |
70 | <property stdset="1"> | 70 | <property stdset="1"> |
71 | <name>margin</name> | 71 | <name>margin</name> |
72 | <number>11</number> | 72 | <number>5</number> |
73 | </property> | 73 | </property> |
74 | <property stdset="1"> | 74 | <property stdset="1"> |
75 | <name>spacing</name> | 75 | <name>spacing</name> |
76 | <number>6</number> | 76 | <number>6</number> |
77 | </property> | 77 | </property> |
78 | <widget> | 78 | <widget> |
79 | <class>QListView</class> | 79 | <class>QListView</class> |
80 | <column> | 80 | <column> |
81 | <property> | 81 | <property> |
82 | <name>text</name> | 82 | <name>text</name> |
83 | <string>Name</string> | ||
84 | </property> | ||
85 | <property> | ||
86 | <name>clickable</name> | ||
87 | <bool>true</bool> | ||
88 | </property> | ||
89 | <property> | ||
90 | <name>resizeable</name> | ||
91 | <bool>true</bool> | ||
92 | </property> | ||
93 | </column> | ||
94 | <column> | ||
95 | <property> | ||
96 | <name>text</name> | ||
97 | <string>MACAddress</string> | 83 | <string>MACAddress</string> |
98 | </property> | 84 | </property> |
99 | <property> | 85 | <property> |
100 | <name>clickable</name> | 86 | <name>clickable</name> |
101 | <bool>true</bool> | 87 | <bool>true</bool> |
102 | </property> | 88 | </property> |
103 | <property> | 89 | <property> |
104 | <name>resizeable</name> | 90 | <name>resizeable</name> |
@@ -109,21 +95,95 @@ | |||
109 | <name>name</name> | 95 | <name>name</name> |
110 | <cstring>LanCards_LV</cstring> | 96 | <cstring>LanCards_LV</cstring> |
111 | </property> | 97 | </property> |
112 | <property stdset="1"> | 98 | <property stdset="1"> |
113 | <name>allColumnsShowFocus</name> | 99 | <name>allColumnsShowFocus</name> |
114 | <bool>true</bool> | 100 | <bool>true</bool> |
115 | </property> | 101 | </property> |
116 | </widget> | 102 | </widget> |
103 | <widget> | ||
104 | <class>QLayoutWidget</class> | ||
105 | <property stdset="1"> | ||
106 | <name>name</name> | ||
107 | <cstring>Layout2</cstring> | ||
108 | </property> | ||
109 | <hbox> | ||
110 | <property stdset="1"> | ||
111 | <name>margin</name> | ||
112 | <number>0</number> | ||
113 | </property> | ||
114 | <property stdset="1"> | ||
115 | <name>spacing</name> | ||
116 | <number>6</number> | ||
117 | </property> | ||
118 | <widget> | ||
119 | <class>QPushButton</class> | ||
120 | <property stdset="1"> | ||
121 | <name>name</name> | ||
122 | <cstring>RemoveUnknown_BUT</cstring> | ||
123 | </property> | ||
124 | <property stdset="1"> | ||
125 | <name>text</name> | ||
126 | <string>Remove Unknown</string> | ||
127 | </property> | ||
128 | </widget> | ||
129 | <spacer> | ||
130 | <property> | ||
131 | <name>name</name> | ||
132 | <cstring>Spacer1</cstring> | ||
133 | </property> | ||
134 | <property stdset="1"> | ||
135 | <name>orientation</name> | ||
136 | <enum>Horizontal</enum> | ||
137 | </property> | ||
138 | <property stdset="1"> | ||
139 | <name>sizeType</name> | ||
140 | <enum>Expanding</enum> | ||
141 | </property> | ||
142 | <property> | ||
143 | <name>sizeHint</name> | ||
144 | <size> | ||
145 | <width>20</width> | ||
146 | <height>20</height> | ||
147 | </size> | ||
148 | </property> | ||
149 | </spacer> | ||
150 | <widget> | ||
151 | <class>QPushButton</class> | ||
152 | <property stdset="1"> | ||
153 | <name>name</name> | ||
154 | <cstring>RescanCards_BUT</cstring> | ||
155 | </property> | ||
156 | <property stdset="1"> | ||
157 | <name>text</name> | ||
158 | <string>Rescan</string> | ||
159 | </property> | ||
160 | </widget> | ||
161 | </hbox> | ||
162 | </widget> | ||
117 | </vbox> | 163 | </vbox> |
118 | </widget> | 164 | </widget> |
119 | </vbox> | 165 | </vbox> |
120 | </widget> | 166 | </widget> |
121 | <connections> | 167 | <connections> |
122 | <connection> | 168 | <connection> |
123 | <sender>AnyCard_CB</sender> | 169 | <sender>AnyCard_CB</sender> |
124 | <signal>toggled(bool)</signal> | 170 | <signal>toggled(bool)</signal> |
125 | <receiver>GroupBox1</receiver> | 171 | <receiver>GroupBox1</receiver> |
126 | <slot>setDisabled(bool)</slot> | 172 | <slot>setDisabled(bool)</slot> |
127 | </connection> | 173 | </connection> |
174 | <connection> | ||
175 | <sender>RescanCards_BUT</sender> | ||
176 | <signal>clicked()</signal> | ||
177 | <receiver>Lancard_FRM</receiver> | ||
178 | <slot>SLOT_ScanCards()</slot> | ||
179 | </connection> | ||
180 | <connection> | ||
181 | <sender>RemoveUnknown_BUT</sender> | ||
182 | <signal>clicked()</signal> | ||
183 | <receiver>Lancard_FRM</receiver> | ||
184 | <slot>SLOT_RemoveUnknown()</slot> | ||
185 | </connection> | ||
186 | <slot access="public">SLOT_ScanCards()</slot> | ||
187 | <slot access="public">SLOT_RemoveUnknown()</slot> | ||
128 | </connections> | 188 | </connections> |
129 | </UI> | 189 | </UI> |
diff --git a/noncore/settings/networksettings2/lancard/lancard_NN.cpp b/noncore/settings/networksettings2/lancard/lancard_NN.cpp index ba1c1f8..a4afab1 100644 --- a/noncore/settings/networksettings2/lancard/lancard_NN.cpp +++ b/noncore/settings/networksettings2/lancard/lancard_NN.cpp | |||
@@ -2,17 +2,17 @@ | |||
2 | #include "lancard_NNI.h" | 2 | #include "lancard_NNI.h" |
3 | 3 | ||
4 | static const char * LanCardNeeds[] = | 4 | static const char * LanCardNeeds[] = |
5 | { 0 }; | 5 | { 0 }; |
6 | 6 | ||
7 | /** | 7 | /** |
8 | * Constructor, find all of the possible interfaces | 8 | * Constructor, find all of the possible interfaces |
9 | */ | 9 | */ |
10 | LanCardNetNode::LanCardNetNode() : ANetNode() { | 10 | LanCardNetNode::LanCardNetNode() : ANetNode(tr("LAN card")), NICMACAddresses() { |
11 | InstanceCount = 2; | 11 | InstanceCount = 2; |
12 | } | 12 | } |
13 | 13 | ||
14 | /** | 14 | /** |
15 | * Delete any interfaces that we own. | 15 | * Delete any interfaces that we own. |
16 | */ | 16 | */ |
17 | LanCardNetNode::~LanCardNetNode(){ | 17 | LanCardNetNode::~LanCardNetNode(){ |
18 | } | 18 | } |
@@ -64,22 +64,31 @@ bool LanCardNetNode::generateDeviceDataForCommonFile( | |||
64 | QString LanCardNetNode::genNic( long nr ) { | 64 | QString LanCardNetNode::genNic( long nr ) { |
65 | QString S; | 65 | QString S; |
66 | return S.sprintf( "eth%ld", nr ); | 66 | return S.sprintf( "eth%ld", nr ); |
67 | } | 67 | } |
68 | 68 | ||
69 | void LanCardNetNode::setSpecificAttribute( QString & A, QString & V ) { | 69 | void LanCardNetNode::setSpecificAttribute( QString & A, QString & V ) { |
70 | if( A == "interfacecount" ) { | 70 | if( A == "interfacecount" ) { |
71 | InstanceCount = V.toLong(); | 71 | InstanceCount = V.toLong(); |
72 | } else if ( A == "macaddress" ) { | ||
73 | NICMACAddresses.append( V ); | ||
72 | } | 74 | } |
73 | } | 75 | } |
74 | 76 | ||
75 | void LanCardNetNode::saveSpecificAttribute( QTextStream & TS) { | 77 | void LanCardNetNode::saveSpecificAttribute( QTextStream & TS) { |
76 | TS << "interfacecount=" | 78 | TS << "interfacecount=" |
77 | << InstanceCount | 79 | << InstanceCount |
78 | << endl; | 80 | << endl; |
81 | for( QStringList::Iterator it = NICMACAddresses.begin(); | ||
82 | it != NICMACAddresses.end(); | ||
83 | ++it ) { | ||
84 | TS << "macaddress=" | ||
85 | << (*it) | ||
86 | << endl; | ||
87 | } | ||
79 | } | 88 | } |
80 | 89 | ||
81 | extern "C" { | 90 | extern "C" { |
82 | void create_plugin( QList<ANetNode> & PNN ) { | 91 | void create_plugin( QList<ANetNode> & PNN ) { |
83 | PNN.append( new LanCardNetNode() ); | 92 | PNN.append( new LanCardNetNode() ); |
84 | } | 93 | } |
85 | } | 94 | } |
diff --git a/noncore/settings/networksettings2/lancard/lancard_NN.h b/noncore/settings/networksettings2/lancard/lancard_NN.h index 5f2b25d..d58823c 100644 --- a/noncore/settings/networksettings2/lancard/lancard_NN.h +++ b/noncore/settings/networksettings2/lancard/lancard_NN.h | |||
@@ -1,55 +1,57 @@ | |||
1 | #ifndef LANCARD_NETNODE_H | 1 | #ifndef LANCARD_NETNODE_H |
2 | #define LANCARD_NETNODE_H | 2 | #define LANCARD_NETNODE_H |
3 | 3 | ||
4 | #include <qstringlist.h> | ||
4 | #include "netnode.h" | 5 | #include "netnode.h" |
5 | 6 | ||
6 | class ALanCard; | 7 | class ALanCard; |
7 | 8 | ||
8 | class LanCardNetNode : public ANetNode{ | 9 | class LanCardNetNode : public ANetNode{ |
9 | 10 | ||
10 | Q_OBJECT | 11 | Q_OBJECT |
11 | 12 | ||
12 | public: | 13 | public: |
13 | 14 | ||
14 | LanCardNetNode(); | 15 | LanCardNetNode(); |
15 | virtual ~LanCardNetNode(); | 16 | virtual ~LanCardNetNode(); |
16 | 17 | ||
17 | virtual const QString pixmapName() | 18 | virtual const QString pixmapName() |
18 | { return "Devices/card"; } | 19 | { return "Devices/card"; } |
19 | 20 | ||
20 | virtual const QString nodeName() | ||
21 | { return tr("LAN card"); } | ||
22 | |||
23 | virtual const QString nodeDescription() ; | 21 | virtual const QString nodeDescription() ; |
24 | 22 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 23 | virtual ANetNodeInstance * createInstance( void ); |
26 | 24 | ||
27 | virtual const char ** needs( void ); | 25 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 26 | virtual const char * provides( void ); |
29 | 27 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 28 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | virtual bool hasDataFor( const QString & S ); | 29 | virtual bool hasDataFor( const QString & S ); |
32 | virtual bool generateDeviceDataForCommonFile( | 30 | virtual bool generateDeviceDataForCommonFile( |
33 | SystemFile & SF, long DevNr ); | 31 | SystemFile & SF, long DevNr ); |
34 | 32 | ||
35 | virtual long instanceCount( void ) | 33 | virtual long instanceCount( void ) |
36 | { return InstanceCount; } | 34 | { return InstanceCount; } |
37 | 35 | ||
38 | virtual QString genNic( long ); | 36 | virtual QString genNic( long ); |
37 | virtual QStringList & addressesOfNIC( void ) | ||
38 | { return NICMACAddresses; } | ||
39 | 39 | ||
40 | private: | 40 | private: |
41 | 41 | ||
42 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 42 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
43 | virtual void saveSpecificAttribute( QTextStream & TS ); | 43 | virtual void saveSpecificAttribute( QTextStream & TS ); |
44 | 44 | ||
45 | // number of interfaces for this device | 45 | // number of interfaces for this device |
46 | long InstanceCount; | 46 | long InstanceCount; |
47 | 47 | ||
48 | QStringList NICMACAddresses; | ||
49 | |||
48 | }; | 50 | }; |
49 | 51 | ||
50 | extern "C" | 52 | extern "C" |
51 | { | 53 | { |
52 | void create_plugin( QList<ANetNode> & PNN ); | 54 | void create_plugin( QList<ANetNode> & PNN ); |
53 | }; | 55 | }; |
54 | 56 | ||
55 | #endif | 57 | #endif |
diff --git a/noncore/settings/networksettings2/lancard/lancard_NNI.cpp b/noncore/settings/networksettings2/lancard/lancard_NNI.cpp index 5962d52..99c033e 100644 --- a/noncore/settings/networksettings2/lancard/lancard_NNI.cpp +++ b/noncore/settings/networksettings2/lancard/lancard_NNI.cpp | |||
@@ -25,17 +25,17 @@ void ALanCard::saveSpecificAttribute( QTextStream & TS) { | |||
25 | for( QStringList::Iterator it = Data.HWAddresses.begin(); | 25 | for( QStringList::Iterator it = Data.HWAddresses.begin(); |
26 | it != Data.HWAddresses.end(); ++it ) { | 26 | it != Data.HWAddresses.end(); ++it ) { |
27 | TS << "match=" << quote( *it ) << endl; | 27 | TS << "match=" << quote( *it ) << endl; |
28 | } | 28 | } |
29 | } | 29 | } |
30 | 30 | ||
31 | QWidget * ALanCard::edit( QWidget * parent ) { | 31 | QWidget * ALanCard::edit( QWidget * parent ) { |
32 | GUI = new LanCardEdit( parent ); | 32 | GUI = new LanCardEdit( parent ); |
33 | GUI->showData( Data ); | 33 | GUI->showData( this ); |
34 | return GUI; | 34 | return GUI; |
35 | } | 35 | } |
36 | 36 | ||
37 | QString ALanCard::acceptable( void ) { | 37 | QString ALanCard::acceptable( void ) { |
38 | return ( GUI ) ? GUI->acceptable( ) : QString(); | 38 | return ( GUI ) ? GUI->acceptable( ) : QString(); |
39 | } | 39 | } |
40 | 40 | ||
41 | void ALanCard::commit( void ) { | 41 | void ALanCard::commit( void ) { |
diff --git a/noncore/settings/networksettings2/lancard/lancardedit.cpp b/noncore/settings/networksettings2/lancard/lancardedit.cpp index fa7f6dc..ffe9bf6 100644 --- a/noncore/settings/networksettings2/lancard/lancardedit.cpp +++ b/noncore/settings/networksettings2/lancard/lancardedit.cpp | |||
@@ -1,95 +1,208 @@ | |||
1 | #include <GUIUtils.h> | 1 | #include <GUIUtils.h> |
2 | #include <resources.h> | 2 | #include <resources.h> |
3 | #include <qarray.h> | ||
3 | #include <qlistview.h> | 4 | #include <qlistview.h> |
4 | #include <qcheckbox.h> | 5 | #include <qcheckbox.h> |
5 | #include <qheader.h> | 6 | #include <qheader.h> |
6 | #include <qregexp.h> | 7 | #include <qregexp.h> |
8 | |||
7 | #include "lancardedit.h" | 9 | #include "lancardedit.h" |
10 | #include "lancard_NN.h" | ||
11 | #include "lancard_NNI.h" | ||
8 | 12 | ||
9 | LanCardEdit::LanCardEdit( QWidget * Parent ) : LanCardGUI( Parent ){ | 13 | LanCardEdit::LanCardEdit( QWidget * Parent ) : LanCardGUI( Parent ){ |
10 | System & S = NSResources->system(); | ||
11 | QRegExp R( "eth[0-9]" ); | ||
12 | QCheckListItem * CLI; | ||
13 | |||
14 | LanCards_LV->header()->hide(); | 14 | LanCards_LV->header()->hide(); |
15 | 15 | ||
16 | // populate with all lancards in system | ||
17 | for( QDictIterator<InterfaceInfo> It(S.interfaces()); | ||
18 | It.current(); | ||
19 | ++It ) { | ||
20 | if( R.match( It.current()->Name ) >= 0 && | ||
21 | It.current()->CardType == ARPHRD_ETHER | ||
22 | ) { | ||
23 | CLI = new QCheckListItem( LanCards_LV, It.current()->Name, | ||
24 | QCheckListItem::CheckBox ); | ||
25 | CLI->setText( 1, It.current()->MACAddress ); | ||
26 | } | ||
27 | } | ||
28 | } | 16 | } |
29 | 17 | ||
30 | QString LanCardEdit::acceptable( void ) { | 18 | QString LanCardEdit::acceptable( void ) { |
31 | return QString(); | 19 | return QString(); |
32 | } | 20 | } |
33 | 21 | ||
34 | |||
35 | bool LanCardEdit::commit( LanCardData & Data ) { | 22 | bool LanCardEdit::commit( LanCardData & Data ) { |
36 | bool SM = 0; | 23 | bool SM = 0; |
37 | CBM( Data.AnyLanCard, AnyCard_CB, SM ); | 24 | CBM( Data.AnyLanCard, AnyCard_CB, SM ); |
38 | 25 | ||
39 | if( ! Data.AnyLanCard ) { | 26 | if( ! Data.AnyLanCard ) { |
40 | // collect set of lancards that match | 27 | // take copy for orig list |
28 | QStringList NewList( Data.HWAddresses ); | ||
29 | |||
30 | // update HWAddresses to new state | ||
31 | // remove item also from NewList | ||
41 | int idx; | 32 | int idx; |
42 | QCheckListItem * CLI = (QCheckListItem *)LanCards_LV->firstChild(); | 33 | QCheckListItem * CLI = (QCheckListItem *)LanCards_LV->firstChild(); |
43 | while( CLI ) { | 34 | while( CLI ) { |
44 | idx = Data.HWAddresses.findIndex(CLI->text(1)); | 35 | idx = Data.HWAddresses.findIndex(CLI->text(0)); |
45 | if( CLI->isOn() ) { | 36 | if( CLI->isOn() ) { |
46 | if( idx < 0 ) { | 37 | if( idx < 0 ) { |
47 | // should be in list | 38 | // should be in list |
48 | Data.HWAddresses.append( CLI->text(1) ); | 39 | Data.HWAddresses.append( CLI->text(0) ); |
49 | SM = 1; | 40 | SM = 1; |
50 | } | 41 | } |
51 | } else { | 42 | } else { |
52 | // should not be in list | 43 | // should not be in list |
53 | if( idx >= 0 ) { | 44 | if( idx >= 0 ) { |
54 | Data.HWAddresses.remove( Data.HWAddresses.at(idx) ); | 45 | NewList.remove( CLI->text(0) ); |
46 | Data.HWAddresses.remove( CLI->text(0) ); | ||
55 | SM = 1; | 47 | SM = 1; |
56 | } | 48 | } |
57 | } | 49 | } |
58 | CLI = (QCheckListItem *)CLI->nextSibling(); | 50 | CLI = (QCheckListItem *)CLI->nextSibling(); |
59 | } | 51 | } |
52 | |||
53 | // if newlist still contains items. it were items | ||
54 | // that were checked but no longer are present in the system | ||
55 | SM |= ( NewList.count() > 0 ) ; | ||
60 | } | 56 | } |
61 | return SM || ContainedObsoleteMAC ; | 57 | return SM; |
62 | } | 58 | } |
63 | 59 | ||
64 | void LanCardEdit::showData( LanCardData & Data ) { | 60 | void LanCardEdit::showData( ALanCard * LC ) { |
61 | NNI = LC; | ||
62 | LanCardData & Data = *((LanCardData *)LC->data()); | ||
63 | |||
65 | AnyCard_CB->setChecked( Data.AnyLanCard ); | 64 | AnyCard_CB->setChecked( Data.AnyLanCard ); |
66 | 65 | ||
66 | // load all cards | ||
67 | populateList(); | ||
68 | |||
69 | // set checks | ||
67 | QCheckListItem * CLI = (QCheckListItem *)LanCards_LV->firstChild(); | 70 | QCheckListItem * CLI = (QCheckListItem *)LanCards_LV->firstChild(); |
71 | while( CLI ) { | ||
72 | CLI->setOn( Data.HWAddresses.findIndex(CLI->text(0)) >= 0 ); | ||
73 | CLI = (QCheckListItem *)CLI->nextSibling(); | ||
74 | } | ||
75 | } | ||
68 | 76 | ||
69 | ContainedObsoleteMAC = 0; | 77 | // load all known cards in list |
70 | // remove obsolete address | 78 | void LanCardEdit::populateList( void ) { |
71 | for( QStringList::Iterator it=Data.HWAddresses.begin(); | 79 | LanCardNetNode *NN = (LanCardNetNode *)NNI->nodeClass(); |
72 | it != Data.HWAddresses.end(); | 80 | QCheckListItem * CLI; |
73 | ) { | 81 | bool Found; |
74 | CLI = (QCheckListItem *)LanCards_LV->firstChild(); | 82 | |
75 | while( CLI ) { | 83 | LanCards_LV->clear(); |
76 | if( CLI->text(1) == (*it) ) | 84 | |
77 | // still valid | 85 | for( QStringList::Iterator it = NN->addressesOfNIC().begin(); |
86 | it != NN->addressesOfNIC().end(); | ||
87 | ++it ) { | ||
88 | CLI = new QCheckListItem( LanCards_LV, (*it), QCheckListItem::CheckBox ); | ||
89 | |||
90 | // check interfaces and see if this card is present | ||
91 | Found = 0; | ||
92 | for( QDictIterator<InterfaceInfo> NIt(NSResources->system().interfaces()); | ||
93 | NIt.current(); | ||
94 | ++NIt ) { | ||
95 | if( NIt.current()->MACAddress == (*it) ) { | ||
96 | Found = 1; | ||
78 | break; | 97 | break; |
79 | CLI = (QCheckListItem *)CLI->nextSibling(); | 98 | } |
80 | } | 99 | } |
81 | if( CLI == 0 ) { | 100 | |
82 | // address not found -> remove | 101 | CLI->setPixmap( 0, NSResources->getPixmap( |
83 | ContainedObsoleteMAC = 1; | 102 | (Found) ? "add" : "remove" ) ); |
84 | Data.HWAddresses.remove( it ); | 103 | } |
85 | } else { | 104 | } |
86 | ++ it; | 105 | |
106 | // rescan system for new cards | ||
107 | void LanCardEdit::SLOT_ScanCards( void ) { | ||
108 | LanCardNetNode *NN = (LanCardNetNode *)NNI->nodeClass(); | ||
109 | |||
110 | // add any NIC that is new and matches our interfacename | ||
111 | System & S = NSResources->system(); | ||
112 | QRegExp R( "eth[0-9]" ); | ||
113 | // populate with all lancards in system | ||
114 | for( QDictIterator<InterfaceInfo> It(S.interfaces()); | ||
115 | It.current(); | ||
116 | ++It ) { | ||
117 | fprintf( stderr, "TEST %s %s\n", | ||
118 | It.current()->Name.latin1(), | ||
119 | It.current()->MACAddress.latin1() ); | ||
120 | if( R.match( It.current()->Name ) >= 0 && | ||
121 | ( It.current()->CardType == ARPHRD_ETHER | ||
122 | #ifdef ARPHRD_IEEE1394 | ||
123 | || It.current()->CardType == ARPHRD_IEEE1394 | ||
124 | #endif | ||
125 | ) | ||
126 | ) { | ||
127 | // old item ? | ||
128 | QCheckListItem * CLI = | ||
129 | (QCheckListItem *)LanCards_LV->firstChild(); | ||
130 | while( CLI ) { | ||
131 | if( CLI->text(0) == It.current()->MACAddress ) { | ||
132 | break; | ||
133 | } | ||
134 | CLI = (QCheckListItem *)CLI->nextSibling(); | ||
135 | } | ||
136 | |||
137 | if( ! CLI ) { | ||
138 | // new item | ||
139 | CLI = new QCheckListItem( LanCards_LV, | ||
140 | It.current()->MACAddress, | ||
141 | QCheckListItem::CheckBox ); | ||
142 | } | ||
143 | |||
144 | // mark present | ||
145 | CLI->setPixmap( 0, NSResources->getPixmap( | ||
146 | "add" ) ); | ||
147 | |||
148 | if( NN->addressesOfNIC().findIndex( It.current()->MACAddress) < 0 ) { | ||
149 | // new | ||
150 | NN->addressesOfNIC().append( It.current()->MACAddress ); | ||
151 | } | ||
87 | } | 152 | } |
88 | } | 153 | } |
89 | 154 | ||
90 | // set checks | 155 | } |
156 | |||
157 | // remove all cards that are not present -> flagged with 'remove' | ||
158 | // and unchecked | ||
159 | void LanCardEdit::SLOT_RemoveUnknown( void ) { | ||
160 | QArray<QCheckListItem *> AllItems; | ||
161 | |||
162 | LanCardNetNode *NN = (LanCardNetNode *)NNI->nodeClass(); | ||
163 | |||
164 | QCheckListItem * CLI = (QCheckListItem *)LanCards_LV->firstChild(); | ||
91 | while( CLI ) { | 165 | while( CLI ) { |
92 | CLI->setOn( Data.HWAddresses.findIndex(CLI->text(1)) >= 0 ); | 166 | AllItems.resize( AllItems.size()+1 ); |
167 | AllItems[ AllItems.size()-1 ] = CLI; | ||
93 | CLI = (QCheckListItem *)CLI->nextSibling(); | 168 | CLI = (QCheckListItem *)CLI->nextSibling(); |
94 | } | 169 | } |
170 | |||
171 | // force update of system | ||
172 | System & S = NSResources->system(); | ||
173 | S.probeInterfaces(); | ||
174 | |||
175 | // add any NIC that is new and matches our interfacename | ||
176 | QRegExp R( "eth[0-9]" ); | ||
177 | |||
178 | |||
179 | for( QDictIterator<InterfaceInfo> It(S.interfaces()); | ||
180 | It.current(); | ||
181 | ++It ) { | ||
182 | if( R.match( It.current()->Name ) >= 0 && | ||
183 | ( It.current()->CardType == ARPHRD_ETHER | ||
184 | #ifdef ARPHRD_IEEE1394 | ||
185 | || It.current()->CardType == ARPHRD_IEEE1394 | ||
186 | #endif | ||
187 | ) | ||
188 | ) { | ||
189 | |||
190 | for ( unsigned i = 0; i< AllItems.size(); i++ ) { | ||
191 | if( AllItems[i] && | ||
192 | AllItems[i]->text(0) == It.current()->MACAddress ) { | ||
193 | AllItems[i] = 0; | ||
194 | break; | ||
195 | } | ||
196 | } | ||
197 | } | ||
198 | } | ||
199 | |||
200 | // AllItems now contains all cards NOT present | ||
201 | // remove all items non null and not ON | ||
202 | for ( unsigned i = 0; i< AllItems.size(); i++ ) { | ||
203 | if( AllItems[i] && ! AllItems[i]->isOn() ) { | ||
204 | NN->addressesOfNIC().remove( AllItems[i]->text(0) ); | ||
205 | delete AllItems[i]; | ||
206 | } | ||
207 | } | ||
95 | } | 208 | } |
diff --git a/noncore/settings/networksettings2/lancard/lancardedit.h b/noncore/settings/networksettings2/lancard/lancardedit.h index 8def789..282db1f 100644 --- a/noncore/settings/networksettings2/lancard/lancardedit.h +++ b/noncore/settings/networksettings2/lancard/lancardedit.h | |||
@@ -1,16 +1,24 @@ | |||
1 | #include "lancarddata.h" | 1 | #include "lancarddata.h" |
2 | #include "lancardGUI.h" | 2 | #include "lancardGUI.h" |
3 | 3 | ||
4 | class ALanCard; | ||
5 | |||
4 | class LanCardEdit : public LanCardGUI { | 6 | class LanCardEdit : public LanCardGUI { |
5 | 7 | ||
6 | public : | 8 | public : |
7 | 9 | ||
8 | LanCardEdit( QWidget * parent ); | 10 | LanCardEdit( QWidget * parent ); |
9 | QString acceptable( void ); | 11 | QString acceptable( void ); |
10 | bool commit( LanCardData & Data ); | 12 | bool commit( LanCardData & Data ); |
11 | void showData( LanCardData & Data ); | 13 | void showData( ALanCard * NNI ); |
14 | |||
15 | public slots : | ||
16 | |||
17 | void SLOT_ScanCards( void ); | ||
18 | void SLOT_RemoveUnknown( void ); | ||
12 | 19 | ||
13 | private : | 20 | private : |
14 | 21 | ||
15 | bool ContainedObsoleteMAC; | 22 | void populateList( void ); |
23 | ALanCard * NNI; | ||
16 | }; | 24 | }; |
diff --git a/noncore/settings/networksettings2/lancard/lancardrun.cpp b/noncore/settings/networksettings2/lancard/lancardrun.cpp index 951756d..2e4fc43 100644 --- a/noncore/settings/networksettings2/lancard/lancardrun.cpp +++ b/noncore/settings/networksettings2/lancard/lancardrun.cpp | |||
@@ -1,10 +1,11 @@ | |||
1 | #include <qfile.h> | 1 | #include <qfile.h> |
2 | #include <qtextstream.h> | 2 | #include <qtextstream.h> |
3 | #include <qstringlist.h> | ||
3 | #include <resources.h> | 4 | #include <resources.h> |
4 | #include "lancardrun.h" | 5 | #include "lancardrun.h" |
5 | 6 | ||
6 | void LanCardRun::detectState( NodeCollection * NC ) { | 7 | void LanCardRun::detectState( NodeCollection * NC ) { |
7 | 8 | ||
8 | // unavailable : no card found | 9 | // unavailable : no card found |
9 | // available : card found and assigned to us or free | 10 | // available : card found and assigned to us or free |
10 | // up : card found and assigned to us and up | 11 | // up : card found and assigned to us and up |
@@ -48,18 +49,22 @@ void LanCardRun::detectState( NodeCollection * NC ) { | |||
48 | // nothing (valid) assigned to us | 49 | // nothing (valid) assigned to us |
49 | assignInterface( 0 ); | 50 | assignInterface( 0 ); |
50 | 51 | ||
51 | // find possible interface | 52 | // find possible interface |
52 | for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); | 53 | for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); |
53 | It.current(); | 54 | It.current(); |
54 | ++It ) { | 55 | ++It ) { |
55 | Run = It.current(); | 56 | Run = It.current(); |
56 | if( handlesInterface( Run->Name ) && | 57 | if( handlesInterface( *Run ) && |
57 | Run->CardType == ARPHRD_ETHER && | 58 | ( Run->CardType == ARPHRD_ETHER |
59 | #ifdef ARPHRD_IEEE1394 | ||
60 | || Run->CardType == ARPHRD_IEEE1394 | ||
61 | #endif | ||
62 | ) && | ||
58 | ! Run->IsUp | 63 | ! Run->IsUp |
59 | ) { | 64 | ) { |
60 | // proper type, and Not UP -> free | 65 | // proper type, and Not UP -> free |
61 | NC->setCurrentState( Off ); | 66 | NC->setCurrentState( Off ); |
62 | return; | 67 | return; |
63 | } | 68 | } |
64 | } | 69 | } |
65 | // no free found | 70 | // no free found |
@@ -140,27 +145,48 @@ InterfaceInfo * LanCardRun::getInterface( void ) { | |||
140 | 145 | ||
141 | System & S = NSResources->system(); | 146 | System & S = NSResources->system(); |
142 | InterfaceInfo * best = 0, * Run; | 147 | InterfaceInfo * best = 0, * Run; |
143 | 148 | ||
144 | for( QDictIterator<InterfaceInfo> It(S.interfaces()); | 149 | for( QDictIterator<InterfaceInfo> It(S.interfaces()); |
145 | It.current(); | 150 | It.current(); |
146 | ++It ) { | 151 | ++It ) { |
147 | Run = It.current(); | 152 | Run = It.current(); |
148 | if( handlesInterface( Run->Name ) && | 153 | if( handlesInterface( *Run ) && |
149 | Run->CardType == ARPHRD_ETHER | 154 | ( Run->CardType == ARPHRD_ETHER |
155 | #ifdef ARPHRD_IEEE1394 | ||
156 | || Run->CardType == ARPHRD_IEEE1394 | ||
157 | #endif | ||
158 | ) | ||
150 | ) { | 159 | ) { |
151 | // this is a LAN card | 160 | // this is a LAN card |
152 | if( Run->assignedNode() == netNode() ) { | 161 | if( Run->assignedNode() == netNode() ) { |
153 | // assigned to us | 162 | // assigned to us |
154 | return Run; | 163 | return Run; |
155 | } else if( Run->assignedNode() == 0 ) { | 164 | } else if( Run->assignedNode() == 0 ) { |
156 | // free | 165 | // free |
157 | best = Run; | 166 | best = Run; |
158 | } | 167 | } |
159 | } | 168 | } |
160 | } | 169 | } |
161 | return best; // can be 0 | 170 | return best; // can be 0 |
162 | } | 171 | } |
163 | 172 | ||
164 | bool LanCardRun::handlesInterface( const QString & S ) { | 173 | bool LanCardRun::handlesInterface( const QString & S ) { |
174 | InterfaceInfo * II; | ||
175 | II = NSResources->system().interface( S ); | ||
176 | if( ( II = NSResources->system().interface( S ) ) ) { | ||
177 | return handlesInterface( *II ); | ||
178 | } | ||
165 | return Pat.match( S ) >= 0; | 179 | return Pat.match( S ) >= 0; |
166 | } | 180 | } |
181 | |||
182 | bool LanCardRun::handlesInterface( const InterfaceInfo & II ) { | ||
183 | if( Pat.match( II.Name ) < 0 ) | ||
184 | return 0; | ||
185 | |||
186 | if( Data->AnyLanCard ) { | ||
187 | return 1; | ||
188 | } | ||
189 | |||
190 | // must also match hardware address | ||
191 | return ( Data->HWAddresses.findIndex( II.MACAddress ) >= 0 ); | ||
192 | } | ||
diff --git a/noncore/settings/networksettings2/lancard/lancardrun.h b/noncore/settings/networksettings2/lancard/lancardrun.h index 499b417..e8a535a 100644 --- a/noncore/settings/networksettings2/lancard/lancardrun.h +++ b/noncore/settings/networksettings2/lancard/lancardrun.h | |||
@@ -5,33 +5,35 @@ | |||
5 | #include <qregexp.h> | 5 | #include <qregexp.h> |
6 | #include "lancarddata.h" | 6 | #include "lancarddata.h" |
7 | 7 | ||
8 | class LanCardRun : public AsDevice { | 8 | class LanCardRun : public AsDevice { |
9 | 9 | ||
10 | public : | 10 | public : |
11 | 11 | ||
12 | LanCardRun( ANetNodeInstance * NNI, | 12 | LanCardRun( ANetNodeInstance * NNI, |
13 | LanCardData & Data ) : AsDevice( NNI ), | 13 | LanCardData & D ) : AsDevice( NNI ), |
14 | Pat( "eth[0-9]" ) | 14 | Pat( "eth[0-9]" ) |
15 | { } | 15 | { Data = &D; } |
16 | 16 | ||
17 | virtual AsDevice * device( void ) | 17 | virtual AsDevice * device( void ) |
18 | { return (AsDevice *)this; } | 18 | { return (AsDevice *)this; } |
19 | 19 | ||
20 | virtual AsDevice * asDevice( void ) | 20 | virtual AsDevice * asDevice( void ) |
21 | { return (AsDevice *)this; } | 21 | { return (AsDevice *)this; } |
22 | 22 | ||
23 | protected : | 23 | protected : |
24 | 24 | ||
25 | void detectState( NodeCollection * NC ); | 25 | void detectState( NodeCollection * NC ); |
26 | bool setState( NodeCollection * NC, Action_t A ); | 26 | bool setState( NodeCollection * NC, Action_t A ); |
27 | bool canSetState( State_t Curr, Action_t A ); | 27 | bool canSetState( State_t Curr, Action_t A ); |
28 | 28 | ||
29 | bool handlesInterface( const QString & I ); | 29 | bool handlesInterface( const QString & I ); |
30 | bool handlesInterface( const InterfaceInfo & II ); | ||
30 | 31 | ||
31 | private : | 32 | private : |
32 | 33 | ||
33 | InterfaceInfo * getInterface( void ); | 34 | InterfaceInfo * getInterface( void ); |
34 | QRegExp Pat; | 35 | QRegExp Pat; |
36 | LanCardData * Data; | ||
35 | 37 | ||
36 | }; | 38 | }; |
37 | #endif | 39 | #endif |
diff --git a/noncore/settings/networksettings2/modem/modem_NN.cpp b/noncore/settings/networksettings2/modem/modem_NN.cpp index 1cc8524..9d70d7a 100644 --- a/noncore/settings/networksettings2/modem/modem_NN.cpp +++ b/noncore/settings/networksettings2/modem/modem_NN.cpp | |||
@@ -3,17 +3,17 @@ | |||
3 | 3 | ||
4 | static const char * ModemNeeds[] = | 4 | static const char * ModemNeeds[] = |
5 | { "line" | 5 | { "line" |
6 | }; | 6 | }; |
7 | 7 | ||
8 | /** | 8 | /** |
9 | * Constructor, find all of the possible interfaces | 9 | * Constructor, find all of the possible interfaces |
10 | */ | 10 | */ |
11 | ModemNetNode::ModemNetNode() : ANetNode() { | 11 | ModemNetNode::ModemNetNode() : ANetNode(tr("Dialup modem")) { |
12 | } | 12 | } |
13 | 13 | ||
14 | /** | 14 | /** |
15 | * Delete any interfaces that we own. | 15 | * Delete any interfaces that we own. |
16 | */ | 16 | */ |
17 | ModemNetNode::~ModemNetNode(){ | 17 | ModemNetNode::~ModemNetNode(){ |
18 | } | 18 | } |
19 | 19 | ||
diff --git a/noncore/settings/networksettings2/modem/modem_NN.h b/noncore/settings/networksettings2/modem/modem_NN.h index 849f928..2f496dd 100644 --- a/noncore/settings/networksettings2/modem/modem_NN.h +++ b/noncore/settings/networksettings2/modem/modem_NN.h | |||
@@ -12,19 +12,16 @@ class ModemNetNode : public ANetNode{ | |||
12 | public: | 12 | public: |
13 | 13 | ||
14 | ModemNetNode(); | 14 | ModemNetNode(); |
15 | virtual ~ModemNetNode(); | 15 | virtual ~ModemNetNode(); |
16 | 16 | ||
17 | virtual const QString pixmapName() | 17 | virtual const QString pixmapName() |
18 | { return "Devices/modem"; } | 18 | { return "Devices/modem"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | ||
21 | { return tr("Dialup modem"); } | ||
22 | |||
23 | virtual const QString nodeDescription() ; | 20 | virtual const QString nodeDescription() ; |
24 | 21 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 22 | virtual ANetNodeInstance * createInstance( void ); |
26 | 23 | ||
27 | virtual const char ** needs( void ); | 24 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 25 | virtual const char * provides( void ); |
29 | 26 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 27 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
diff --git a/noncore/settings/networksettings2/network/networkGUI.ui b/noncore/settings/networksettings2/network/networkGUI.ui index 9115ec0..5f71f82 100644 --- a/noncore/settings/networksettings2/network/networkGUI.ui +++ b/noncore/settings/networksettings2/network/networkGUI.ui | |||
@@ -6,17 +6,17 @@ | |||
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>NetworkGUI</cstring> | 7 | <cstring>NetworkGUI</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>293</width> | 14 | <width>289</width> |
15 | <height>254</height> | 15 | <height>254</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Interface Configuration</string> | 20 | <string>Interface Configuration</string> |
21 | </property> | 21 | </property> |
22 | <property> | 22 | <property> |
@@ -33,17 +33,17 @@ | |||
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>spacing</name> | 34 | <name>spacing</name> |
35 | <number>0</number> | 35 | <number>0</number> |
36 | </property> | 36 | </property> |
37 | <widget> | 37 | <widget> |
38 | <class>QTabWidget</class> | 38 | <class>QTabWidget</class> |
39 | <property stdset="1"> | 39 | <property stdset="1"> |
40 | <name>name</name> | 40 | <name>name</name> |
41 | <cstring>TabWidget11</cstring> | 41 | <cstring>MainTab_TAB</cstring> |
42 | </property> | 42 | </property> |
43 | <property> | 43 | <property> |
44 | <name>layoutMargin</name> | 44 | <name>layoutMargin</name> |
45 | </property> | 45 | </property> |
46 | <property> | 46 | <property> |
47 | <name>layoutSpacing</name> | 47 | <name>layoutSpacing</name> |
48 | </property> | 48 | </property> |
49 | <widget> | 49 | <widget> |
@@ -478,17 +478,17 @@ | |||
478 | <name>name</name> | 478 | <name>name</name> |
479 | <cstring>Command_LE</cstring> | 479 | <cstring>Command_LE</cstring> |
480 | </property> | 480 | </property> |
481 | </widget> | 481 | </widget> |
482 | <widget> | 482 | <widget> |
483 | <class>QTabWidget</class> | 483 | <class>QTabWidget</class> |
484 | <property stdset="1"> | 484 | <property stdset="1"> |
485 | <name>name</name> | 485 | <name>name</name> |
486 | <cstring>Tab_TB</cstring> | 486 | <cstring>Tab_TAB</cstring> |
487 | </property> | 487 | </property> |
488 | <property> | 488 | <property> |
489 | <name>layoutMargin</name> | 489 | <name>layoutMargin</name> |
490 | </property> | 490 | </property> |
491 | <property> | 491 | <property> |
492 | <name>layoutSpacing</name> | 492 | <name>layoutSpacing</name> |
493 | </property> | 493 | </property> |
494 | <widget> | 494 | <widget> |
@@ -1053,17 +1053,142 @@ | |||
1053 | <slot>setEnabled(bool)</slot> | 1053 | <slot>setEnabled(bool)</slot> |
1054 | </connection> | 1054 | </connection> |
1055 | <connection> | 1055 | <connection> |
1056 | <sender>SendHostname_CB</sender> | 1056 | <sender>SendHostname_CB</sender> |
1057 | <signal>toggled(bool)</signal> | 1057 | <signal>toggled(bool)</signal> |
1058 | <receiver>Hostname_LE</receiver> | 1058 | <receiver>Hostname_LE</receiver> |
1059 | <slot>setEnabled(bool)</slot> | 1059 | <slot>setEnabled(bool)</slot> |
1060 | </connection> | 1060 | </connection> |
1061 | <connection> | ||
1062 | <sender>AddPreUp_TB</sender> | ||
1063 | <signal>clicked()</signal> | ||
1064 | <receiver>NetworkGUI</receiver> | ||
1065 | <slot>SLOT_Add()</slot> | ||
1066 | </connection> | ||
1067 | <connection> | ||
1068 | <sender>DeletePreUp_TB</sender> | ||
1069 | <signal>clicked()</signal> | ||
1070 | <receiver>NetworkGUI</receiver> | ||
1071 | <slot>SLOT_Remove()</slot> | ||
1072 | </connection> | ||
1073 | <connection> | ||
1074 | <sender>UpPreUp_TB</sender> | ||
1075 | <signal>clicked()</signal> | ||
1076 | <receiver>NetworkGUI</receiver> | ||
1077 | <slot>SLOT_Up()</slot> | ||
1078 | </connection> | ||
1079 | <connection> | ||
1080 | <sender>DownPreUp_TB</sender> | ||
1081 | <signal>clicked()</signal> | ||
1082 | <receiver>NetworkGUI</receiver> | ||
1083 | <slot>SLOT_Down()</slot> | ||
1084 | </connection> | ||
1085 | <connection> | ||
1086 | <sender>AddPostUp_TB</sender> | ||
1087 | <signal>clicked()</signal> | ||
1088 | <receiver>NetworkGUI</receiver> | ||
1089 | <slot>SLOT_Add()</slot> | ||
1090 | </connection> | ||
1091 | <connection> | ||
1092 | <sender>DeletePostUp_TB</sender> | ||
1093 | <signal>clicked()</signal> | ||
1094 | <receiver>NetworkGUI</receiver> | ||
1095 | <slot>SLOT_Remove()</slot> | ||
1096 | </connection> | ||
1097 | <connection> | ||
1098 | <sender>UpPostUp_TB</sender> | ||
1099 | <signal>clicked()</signal> | ||
1100 | <receiver>NetworkGUI</receiver> | ||
1101 | <slot>SLOT_Up()</slot> | ||
1102 | </connection> | ||
1103 | <connection> | ||
1104 | <sender>DownPostUp_TB</sender> | ||
1105 | <signal>clicked()</signal> | ||
1106 | <receiver>NetworkGUI</receiver> | ||
1107 | <slot>SLOT_Down()</slot> | ||
1108 | </connection> | ||
1109 | <connection> | ||
1110 | <sender>AddPreDown_TB</sender> | ||
1111 | <signal>clicked()</signal> | ||
1112 | <receiver>NetworkGUI</receiver> | ||
1113 | <slot>SLOT_Add()</slot> | ||
1114 | </connection> | ||
1115 | <connection> | ||
1116 | <sender>DeletePreDown_TB</sender> | ||
1117 | <signal>clicked()</signal> | ||
1118 | <receiver>NetworkGUI</receiver> | ||
1119 | <slot>SLOT_Remove()</slot> | ||
1120 | </connection> | ||
1121 | <connection> | ||
1122 | <sender>UpPreDown_TB</sender> | ||
1123 | <signal>clicked()</signal> | ||
1124 | <receiver>NetworkGUI</receiver> | ||
1125 | <slot>SLOT_Up()</slot> | ||
1126 | </connection> | ||
1127 | <connection> | ||
1128 | <sender>DownPreDown_TB</sender> | ||
1129 | <signal>clicked()</signal> | ||
1130 | <receiver>NetworkGUI</receiver> | ||
1131 | <slot>SLOT_Down()</slot> | ||
1132 | </connection> | ||
1133 | <connection> | ||
1134 | <sender>AddPostDown_TB</sender> | ||
1135 | <signal>clicked()</signal> | ||
1136 | <receiver>NetworkGUI</receiver> | ||
1137 | <slot>SLOT_Add()</slot> | ||
1138 | </connection> | ||
1139 | <connection> | ||
1140 | <sender>DeletePostDown_TB</sender> | ||
1141 | <signal>clicked()</signal> | ||
1142 | <receiver>NetworkGUI</receiver> | ||
1143 | <slot>SLOT_Remove()</slot> | ||
1144 | </connection> | ||
1145 | <connection> | ||
1146 | <sender>UpPostDown_TB</sender> | ||
1147 | <signal>clicked()</signal> | ||
1148 | <receiver>NetworkGUI</receiver> | ||
1149 | <slot>SLOT_Up()</slot> | ||
1150 | </connection> | ||
1151 | <connection> | ||
1152 | <sender>DownPostDown_TB</sender> | ||
1153 | <signal>clicked()</signal> | ||
1154 | <receiver>NetworkGUI</receiver> | ||
1155 | <slot>SLOT_Down()</slot> | ||
1156 | </connection> | ||
1157 | <connection> | ||
1158 | <sender>PreUp_LB</sender> | ||
1159 | <signal>doubleClicked(QListBoxItem*)</signal> | ||
1160 | <receiver>NetworkGUI</receiver> | ||
1161 | <slot>SLOT_ShowCommand( QListBoxItem *)</slot> | ||
1162 | </connection> | ||
1163 | <connection> | ||
1164 | <sender>PreDown_LB</sender> | ||
1165 | <signal>doubleClicked(QListBoxItem*)</signal> | ||
1166 | <receiver>NetworkGUI</receiver> | ||
1167 | <slot>SLOT_ShowCommand( QListBoxItem *)</slot> | ||
1168 | </connection> | ||
1169 | <connection> | ||
1170 | <sender>PostDown_LB</sender> | ||
1171 | <signal>doubleClicked(QListBoxItem*)</signal> | ||
1172 | <receiver>NetworkGUI</receiver> | ||
1173 | <slot>SLOT_ShowCommand( QListBoxItem *)</slot> | ||
1174 | </connection> | ||
1175 | <connection> | ||
1176 | <sender>PostUp_LB</sender> | ||
1177 | <signal>doubleClicked(QListBoxItem*)</signal> | ||
1178 | <receiver>NetworkGUI</receiver> | ||
1179 | <slot>SLOT_ShowCommand( QListBoxItem *)</slot> | ||
1180 | </connection> | ||
1181 | <slot access="public">SLOT_Add()</slot> | ||
1182 | <slot access="public">SLOT_Down()</slot> | ||
1061 | <slot access="public">SLOT_NetmaskModified( const QString & )</slot> | 1183 | <slot access="public">SLOT_NetmaskModified( const QString & )</slot> |
1184 | <slot access="public">SLOT_Remove()</slot> | ||
1185 | <slot access="public">SLOT_Up()</slot> | ||
1186 | <slot access="public">SLOT_ShowCommand( QListBoxItem *)</slot> | ||
1062 | </connections> | 1187 | </connections> |
1063 | <tabstops> | 1188 | <tabstops> |
1064 | <tabstop>DHCP_CB</tabstop> | 1189 | <tabstop>DHCP_CB</tabstop> |
1065 | <tabstop>IPAddress_LE</tabstop> | 1190 | <tabstop>IPAddress_LE</tabstop> |
1066 | <tabstop>SubnetMask_LE</tabstop> | 1191 | <tabstop>SubnetMask_LE</tabstop> |
1067 | <tabstop>Gateway_LE</tabstop> | 1192 | <tabstop>Gateway_LE</tabstop> |
1068 | <tabstop>DNS1_LE</tabstop> | 1193 | <tabstop>DNS1_LE</tabstop> |
1069 | <tabstop>DNS2_LE</tabstop> | 1194 | <tabstop>DNS2_LE</tabstop> |
diff --git a/noncore/settings/networksettings2/network/network_NN.cpp b/noncore/settings/networksettings2/network/network_NN.cpp index d27d54a..b5989df 100644 --- a/noncore/settings/networksettings2/network/network_NN.cpp +++ b/noncore/settings/networksettings2/network/network_NN.cpp | |||
@@ -4,17 +4,17 @@ | |||
4 | static const char * NetworkNeeds[] = | 4 | static const char * NetworkNeeds[] = |
5 | { "device", | 5 | { "device", |
6 | 0 | 6 | 0 |
7 | }; | 7 | }; |
8 | 8 | ||
9 | /** | 9 | /** |
10 | * Constructor, find all of the possible interfaces | 10 | * Constructor, find all of the possible interfaces |
11 | */ | 11 | */ |
12 | NetworkNetNode::NetworkNetNode() : ANetNode() { | 12 | NetworkNetNode::NetworkNetNode() : ANetNode(tr("IP Configuration")) { |
13 | } | 13 | } |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * Delete any interfaces that we own. | 16 | * Delete any interfaces that we own. |
17 | */ | 17 | */ |
18 | NetworkNetNode::~NetworkNetNode(){ | 18 | NetworkNetNode::~NetworkNetNode(){ |
19 | } | 19 | } |
20 | 20 | ||
diff --git a/noncore/settings/networksettings2/network/network_NN.h b/noncore/settings/networksettings2/network/network_NN.h index 0f87e1b..6548c32 100644 --- a/noncore/settings/networksettings2/network/network_NN.h +++ b/noncore/settings/networksettings2/network/network_NN.h | |||
@@ -12,19 +12,16 @@ class NetworkNetNode : public ANetNode{ | |||
12 | public: | 12 | public: |
13 | 13 | ||
14 | NetworkNetNode(); | 14 | NetworkNetNode(); |
15 | virtual ~NetworkNetNode(); | 15 | virtual ~NetworkNetNode(); |
16 | 16 | ||
17 | virtual const QString pixmapName() | 17 | virtual const QString pixmapName() |
18 | { return "Devices/tcpip"; } | 18 | { return "Devices/tcpip"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | ||
21 | { return tr("IP Configuration"); } | ||
22 | |||
23 | virtual const QString nodeDescription() ; | 20 | virtual const QString nodeDescription() ; |
24 | 21 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 22 | virtual ANetNodeInstance * createInstance( void ); |
26 | 23 | ||
27 | virtual const char ** needs( void ); | 24 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 25 | virtual const char * provides( void ); |
29 | 26 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 27 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
diff --git a/noncore/settings/networksettings2/network/networkedit.cpp b/noncore/settings/networksettings2/network/networkedit.cpp index 182213b..05110d9 100644 --- a/noncore/settings/networksettings2/network/networkedit.cpp +++ b/noncore/settings/networksettings2/network/networkedit.cpp | |||
@@ -1,10 +1,11 @@ | |||
1 | #include <qtoolbutton.h> | 1 | #include <qtoolbutton.h> |
2 | #include <qcheckbox.h> | 2 | #include <qcheckbox.h> |
3 | #include <qtabwidget.h> | ||
3 | #include <qlineedit.h> | 4 | #include <qlineedit.h> |
4 | #include <qlistbox.h> | 5 | #include <qlistbox.h> |
5 | #include <GUIUtils.h> | 6 | #include <GUIUtils.h> |
6 | #include <resources.h> | 7 | #include <resources.h> |
7 | #include "networkedit.h" | 8 | #include "networkedit.h" |
8 | 9 | ||
9 | NetworkEdit::NetworkEdit( QWidget * Parent ) : NetworkGUI( Parent ){ | 10 | NetworkEdit::NetworkEdit( QWidget * Parent ) : NetworkGUI( Parent ){ |
10 | 11 | ||
@@ -105,17 +106,23 @@ bool NetworkEdit::updateList( QStringList & SL, QListBox * LB ) { | |||
105 | bool Changed; | 106 | bool Changed; |
106 | QStringList NewSL; | 107 | QStringList NewSL; |
107 | 108 | ||
108 | // collect new list | 109 | // collect new list |
109 | for( unsigned int i = 0; i < LB->count() ; i ++ ) { | 110 | for( unsigned int i = 0; i < LB->count() ; i ++ ) { |
110 | NewSL.append( LB->text(i) ); | 111 | NewSL.append( LB->text(i) ); |
111 | } | 112 | } |
112 | 113 | ||
113 | // check if at least ONE item in new list is NEW | 114 | if( NewSL.count() != SL.count() ) { |
115 | // less or more items | ||
116 | SL= NewSL; | ||
117 | return 1; | ||
118 | } | ||
119 | |||
120 | // Same size -> same content ? | ||
114 | Changed = 0; | 121 | Changed = 0; |
115 | for ( QStringList::Iterator it = NewSL.begin(); | 122 | for ( QStringList::Iterator it = NewSL.begin(); |
116 | it != NewSL.end(); | 123 | it != NewSL.end(); |
117 | ++it ) { | 124 | ++it ) { |
118 | if( SL.findIndex( (*it) ) < 0 ) { | 125 | if( SL.findIndex( (*it) ) < 0 ) { |
119 | // new or modified item | 126 | // new or modified item |
120 | Changed = 1; | 127 | Changed = 1; |
121 | SL = NewSL; | 128 | SL = NewSL; |
@@ -153,8 +160,65 @@ void NetworkEdit::SLOT_NetmaskModified( const QString & ) { | |||
153 | NW = QString( "%1.%2.%3.%4" ). | 160 | NW = QString( "%1.%2.%3.%4" ). |
154 | arg( ipal[0].toShort() | ( ~ nmal[0].toShort() & 0x00ff) ). | 161 | arg( ipal[0].toShort() | ( ~ nmal[0].toShort() & 0x00ff) ). |
155 | arg( ipal[1].toShort() | ( ~ nmal[1].toShort() & 0x00ff) ). | 162 | arg( ipal[1].toShort() | ( ~ nmal[1].toShort() & 0x00ff) ). |
156 | arg( ipal[2].toShort() | ( ~ nmal[2].toShort() & 0x00ff) ). | 163 | arg( ipal[2].toShort() | ( ~ nmal[2].toShort() & 0x00ff) ). |
157 | arg( ipal[3].toShort() | ( ~ nmal[3].toShort() & 0x00ff) ); | 164 | arg( ipal[3].toShort() | ( ~ nmal[3].toShort() & 0x00ff) ); |
158 | Broadcast_LE->setText( NW ); | 165 | Broadcast_LE->setText( NW ); |
159 | } | 166 | } |
160 | } | 167 | } |
168 | |||
169 | QListBox * NetworkEdit::getActiveLB( void ) { | ||
170 | switch( Tab_TAB->currentPageIndex() ) { | ||
171 | case 0 : | ||
172 | return PreUp_LB; | ||
173 | case 1 : | ||
174 | return PostUp_LB; | ||
175 | case 2 : | ||
176 | return PreDown_LB; | ||
177 | } | ||
178 | return PostDown_LB; | ||
179 | } | ||
180 | |||
181 | void NetworkEdit::SLOT_Add( void ) { | ||
182 | if( Command_LE->text().isEmpty() ) | ||
183 | return; | ||
184 | QListBox * LB = getActiveLB(); | ||
185 | |||
186 | LB->insertItem( Command_LE->text() ); | ||
187 | } | ||
188 | |||
189 | void NetworkEdit::SLOT_Remove( void ) { | ||
190 | QListBox * LB = getActiveLB(); | ||
191 | int i; | ||
192 | |||
193 | if( ( i = LB->currentItem() ) >= 0 ) { | ||
194 | LB->removeItem( i ); | ||
195 | } | ||
196 | } | ||
197 | |||
198 | void NetworkEdit::SLOT_Up( void ) { | ||
199 | QListBox * LB = getActiveLB(); | ||
200 | int i; | ||
201 | |||
202 | if( ( i = LB->currentItem() ) > 0 ) { | ||
203 | QListBoxItem * LBI = LB->item(i); | ||
204 | LB->takeItem( LBI ); | ||
205 | LB->insertItem( LBI, --i ); | ||
206 | LB->setCurrentItem( i ); | ||
207 | } | ||
208 | } | ||
209 | |||
210 | void NetworkEdit::SLOT_Down( void ) { | ||
211 | QListBox * LB = getActiveLB(); | ||
212 | int i; | ||
213 | |||
214 | if( ( i = LB->currentItem() ) >= 0 && (unsigned)(i+1) != LB->count() ) { | ||
215 | QListBoxItem * LBI = LB->item(i); | ||
216 | LB->takeItem( LBI ); | ||
217 | LB->insertItem( LBI, ++i ); | ||
218 | LB->setCurrentItem( i ); | ||
219 | } | ||
220 | } | ||
221 | |||
222 | void NetworkEdit::SLOT_ShowCommand( QListBoxItem * It ) { | ||
223 | Command_LE->setText( It->text() ); | ||
224 | } | ||
diff --git a/noncore/settings/networksettings2/network/networkedit.h b/noncore/settings/networksettings2/network/networkedit.h index 9ed4e84..adc20e0 100644 --- a/noncore/settings/networksettings2/network/networkedit.h +++ b/noncore/settings/networksettings2/network/networkedit.h | |||
@@ -1,21 +1,29 @@ | |||
1 | #include "networkdata.h" | 1 | #include "networkdata.h" |
2 | #include "networkGUI.h" | 2 | #include "networkGUI.h" |
3 | 3 | ||
4 | class QListBox; | ||
5 | |||
4 | class NetworkEdit : public NetworkGUI { | 6 | class NetworkEdit : public NetworkGUI { |
5 | 7 | ||
6 | public : | 8 | public : |
7 | 9 | ||
8 | NetworkEdit( QWidget * parent ); | 10 | NetworkEdit( QWidget * parent ); |
9 | QString acceptable( void ); | 11 | QString acceptable( void ); |
10 | bool commit( NetworkData_t & Data ); | 12 | bool commit( NetworkData_t & Data ); |
11 | void showData( NetworkData_t & Data ); | 13 | void showData( NetworkData_t & Data ); |
12 | 14 | ||
13 | public slots : | 15 | public slots : |
14 | 16 | ||
15 | void SLOT_NetmaskModified( const QString & S ); | 17 | void SLOT_NetmaskModified( const QString & S ); |
18 | void SLOT_ShowCommand( QListBoxItem * LBI ); | ||
19 | void SLOT_Add( void ); | ||
20 | void SLOT_Remove( void ); | ||
21 | void SLOT_Up( void ); | ||
22 | void SLOT_Down( void ); | ||
16 | 23 | ||
17 | private : | 24 | private : |
18 | 25 | ||
26 | QListBox * getActiveLB( void ); | ||
19 | bool updateList( QStringList &SL, QListBox * LB ); | 27 | bool updateList( QStringList &SL, QListBox * LB ); |
20 | void populateList( QStringList &SL, QListBox * LB ); | 28 | void populateList( QStringList &SL, QListBox * LB ); |
21 | }; | 29 | }; |
diff --git a/noncore/settings/networksettings2/networksettings2/netnode.cpp b/noncore/settings/networksettings2/networksettings2/netnode.cpp index 3691e5a..417fba8 100644 --- a/noncore/settings/networksettings2/networksettings2/netnode.cpp +++ b/noncore/settings/networksettings2/networksettings2/netnode.cpp | |||
@@ -69,30 +69,30 @@ void ANetNode::setAttribute( QString & Attr, QString & Value ){ | |||
69 | long ANetNodeInstance::InstanceCounter = -1; | 69 | long ANetNodeInstance::InstanceCounter = -1; |
70 | 70 | ||
71 | void ANetNodeInstance::initialize( void ) { | 71 | void ANetNodeInstance::initialize( void ) { |
72 | if( InstanceCounter == -1 ) | 72 | if( InstanceCounter == -1 ) |
73 | InstanceCounter = time(0); | 73 | InstanceCounter = time(0); |
74 | // set name | 74 | // set name |
75 | QString N; | 75 | QString N; |
76 | N.sprintf( "-%ld", InstanceCounter++ ); | 76 | N.sprintf( "-%ld", InstanceCounter++ ); |
77 | N.prepend( NodeType->nodeName() ); | 77 | N.prepend( NodeType->name() ); |
78 | setNodeName( N ); | 78 | setName( N.latin1() ); |
79 | } | 79 | } |
80 | 80 | ||
81 | void ANetNodeInstance::setAttribute( QString & Attr, QString & Value ){ | 81 | void ANetNodeInstance::setAttribute( QString & Attr, QString & Value ){ |
82 | if( Attr == "name" ) { | 82 | if( Attr == "name" ) { |
83 | NodeName = Value; | 83 | setName( Value.latin1() ); |
84 | } else { | 84 | } else { |
85 | setSpecificAttribute( Attr, Value ); | 85 | setSpecificAttribute( Attr, Value ); |
86 | } | 86 | } |
87 | } | 87 | } |
88 | 88 | ||
89 | void ANetNodeInstance::saveAttributes( QTextStream & TS ) { | 89 | void ANetNodeInstance::saveAttributes( QTextStream & TS ) { |
90 | TS << "name=" << quote( NodeName ) << endl; | 90 | TS << "name=" << name() << endl; |
91 | saveSpecificAttribute( TS ); | 91 | saveSpecificAttribute( TS ); |
92 | } | 92 | } |
93 | 93 | ||
94 | ANetNodeInstance * ANetNodeInstance::nextNode( void ) { | 94 | ANetNodeInstance * ANetNodeInstance::nextNode( void ) { |
95 | return connection()->findNext( this ); | 95 | return connection()->findNext( this ); |
96 | } | 96 | } |
97 | 97 | ||
98 | // | 98 | // |
@@ -175,17 +175,17 @@ void NodeCollection::save( QTextStream & TS ) { | |||
175 | 175 | ||
176 | TS << "name=" << quote( Name ) << endl; | 176 | TS << "name=" << quote( Name ) << endl; |
177 | TS << "number=" << number() << endl; | 177 | TS << "number=" << number() << endl; |
178 | ANetNodeInstance * NNI; | 178 | ANetNodeInstance * NNI; |
179 | for( QListIterator<ANetNodeInstance> it(*this); | 179 | for( QListIterator<ANetNodeInstance> it(*this); |
180 | it.current(); | 180 | it.current(); |
181 | ++it ) { | 181 | ++it ) { |
182 | NNI = it.current(); | 182 | NNI = it.current(); |
183 | TS << "node=" << quote( NNI->nodeName() ) << endl; | 183 | TS << "node=" << NNI->name() << endl; |
184 | } | 184 | } |
185 | TS << endl; | 185 | TS << endl; |
186 | IsNew = 0; | 186 | IsNew = 0; |
187 | } | 187 | } |
188 | 188 | ||
189 | ANetNodeInstance * NodeCollection::getToplevel( void ) { | 189 | ANetNodeInstance * NodeCollection::getToplevel( void ) { |
190 | ANetNodeInstance * NNI = 0; | 190 | ANetNodeInstance * NNI = 0; |
191 | for( QListIterator<ANetNodeInstance> it(*this); | 191 | for( QListIterator<ANetNodeInstance> it(*this); |
@@ -228,17 +228,17 @@ ANetNodeInstance * NodeCollection::findNext( ANetNodeInstance * NNI ) { | |||
228 | return 0; // no more next | 228 | return 0; // no more next |
229 | } | 229 | } |
230 | 230 | ||
231 | int NodeCollection::compareItems( QCollection::Item I1, | 231 | int NodeCollection::compareItems( QCollection::Item I1, |
232 | QCollection::Item I2 ) { | 232 | QCollection::Item I2 ) { |
233 | ANetNodeInstance * NNI1, * NNI2; | 233 | ANetNodeInstance * NNI1, * NNI2; |
234 | NNI1 = (ANetNodeInstance *)I1; | 234 | NNI1 = (ANetNodeInstance *)I1; |
235 | NNI2 = (ANetNodeInstance *)I2; | 235 | NNI2 = (ANetNodeInstance *)I2; |
236 | return NNI1->nodeName().compare( NNI2->nodeName() ); | 236 | return strcmp( NNI1->name(), NNI2->name() ); |
237 | } | 237 | } |
238 | 238 | ||
239 | static char * State2PixmapTbl[] = { | 239 | static char * State2PixmapTbl[] = { |
240 | "NULL", // Unchecked : no pixmap | 240 | "NULL", // Unchecked : no pixmap |
241 | "check", // Unknown | 241 | "check", // Unknown |
242 | "delete", // unavailable | 242 | "delete", // unavailable |
243 | "disabled", // disabled | 243 | "disabled", // disabled |
244 | "off", // off | 244 | "off", // off |
diff --git a/noncore/settings/networksettings2/networksettings2/netnode.h b/noncore/settings/networksettings2/networksettings2/netnode.h index 6ec9ef6..27d54f8 100644 --- a/noncore/settings/networksettings2/networksettings2/netnode.h +++ b/noncore/settings/networksettings2/networksettings2/netnode.h | |||
@@ -67,25 +67,22 @@ typedef enum Action { | |||
67 | } Action_t; | 67 | } Action_t; |
68 | 68 | ||
69 | class ANetNode : public QObject{ | 69 | class ANetNode : public QObject{ |
70 | 70 | ||
71 | public: | 71 | public: |
72 | 72 | ||
73 | typedef QArray<ANetNode *> NetNodeList; | 73 | typedef QArray<ANetNode *> NetNodeList; |
74 | 74 | ||
75 | ANetNode(){}; | 75 | ANetNode( const char * Name ) : QObject( 0, Name ) {} |
76 | virtual ~ANetNode(){}; | 76 | virtual ~ANetNode(){}; |
77 | 77 | ||
78 | // pixmap needed for this NetNode | 78 | // pixmap needed for this NetNode |
79 | virtual const QString pixmapName() = 0; | 79 | virtual const QString pixmapName() = 0; |
80 | 80 | ||
81 | // name of this NetNode | ||
82 | virtual const QString nodeName() = 0; | ||
83 | |||
84 | // description for this NetNode | 81 | // description for this NetNode |
85 | virtual const QString nodeDescription() = 0; | 82 | virtual const QString nodeDescription() = 0; |
86 | 83 | ||
87 | // create a blank instance of a net node | 84 | // create a blank instance of a net node |
88 | virtual ANetNodeInstance * createInstance( void ) = 0; | 85 | virtual ANetNodeInstance * createInstance( void ) = 0; |
89 | 86 | ||
90 | // return feature this NetNode provides | 87 | // return feature this NetNode provides |
91 | virtual const char * provides( void ) = 0; | 88 | virtual const char * provides( void ) = 0; |
@@ -179,21 +176,16 @@ public: | |||
179 | void saveAttributes( QTextStream & TS ) ; | 176 | void saveAttributes( QTextStream & TS ) ; |
180 | 177 | ||
181 | // return true if node isntance is NEW and not loaded | 178 | // return true if node isntance is NEW and not loaded |
182 | void setNew( bool IsN ) | 179 | void setNew( bool IsN ) |
183 | { IsNew = IsN; } | 180 | { IsNew = IsN; } |
184 | bool isNew( void ) | 181 | bool isNew( void ) |
185 | { return IsNew; } | 182 | { return IsNew; } |
186 | 183 | ||
187 | // return logical name of this instance | ||
188 | QString & nodeName( void ) | ||
189 | { return NodeName; } | ||
190 | void setNodeName( const QString & S ) | ||
191 | { NodeName = S; } | ||
192 | // return description for this instance | 184 | // return description for this instance |
193 | QString & description( void ) | 185 | QString & description( void ) |
194 | { return Description; } | 186 | { return Description; } |
195 | void setDescription( const QString & S ) | 187 | void setDescription( const QString & S ) |
196 | { Description = S; } | 188 | { Description = S; } |
197 | 189 | ||
198 | // pixmap for this instance -> from NetNode | 190 | // pixmap for this instance -> from NetNode |
199 | const QString pixmapName( void ) | 191 | const QString pixmapName( void ) |
@@ -220,17 +212,16 @@ public: | |||
220 | protected : | 212 | protected : |
221 | 213 | ||
222 | virtual void setSpecificAttribute( QString & , QString & ) = 0; | 214 | virtual void setSpecificAttribute( QString & , QString & ) = 0; |
223 | virtual void saveSpecificAttribute( QTextStream & ) = 0; | 215 | virtual void saveSpecificAttribute( QTextStream & ) = 0; |
224 | 216 | ||
225 | ANetNode * NodeType; | 217 | ANetNode * NodeType; |
226 | // connection to which this node belongs to | 218 | // connection to which this node belongs to |
227 | NodeCollection * Connection; | 219 | NodeCollection * Connection; |
228 | QString NodeName; | ||
229 | QString Description; | 220 | QString Description; |
230 | bool IsModified; | 221 | bool IsModified; |
231 | bool IsNew; | 222 | bool IsNew; |
232 | 223 | ||
233 | static long InstanceCounter; | 224 | static long InstanceCounter; |
234 | }; | 225 | }; |
235 | 226 | ||
236 | class RuntimeInfo : public QObject { | 227 | class RuntimeInfo : public QObject { |
@@ -251,16 +242,18 @@ public : | |||
251 | { return 0; } | 242 | { return 0; } |
252 | virtual AsFullSetup * asFullSetup( void ) | 243 | virtual AsFullSetup * asFullSetup( void ) |
253 | { return 0; } | 244 | { return 0; } |
254 | 245 | ||
255 | // does this node handles this interface e.g.eth0 | 246 | // does this node handles this interface e.g.eth0 |
256 | // recurse deeper if this node cannot answer that question | 247 | // recurse deeper if this node cannot answer that question |
257 | virtual bool handlesInterface( const QString & ) | 248 | virtual bool handlesInterface( const QString & ) |
258 | { return 0; } | 249 | { return 0; } |
250 | virtual bool handlesInterface( const InterfaceInfo & ) | ||
251 | { return 0; } | ||
259 | virtual InterfaceInfo * assignedInterface( void ); | 252 | virtual InterfaceInfo * assignedInterface( void ); |
260 | virtual AsDevice * device( void ); | 253 | virtual AsDevice * device( void ); |
261 | 254 | ||
262 | ANetNodeInstance * netNode() | 255 | ANetNodeInstance * netNode() |
263 | { return NNI; } | 256 | { return NNI; } |
264 | NodeCollection * connection() | 257 | NodeCollection * connection() |
265 | { return NNI->connection(); } | 258 | { return NNI->connection(); } |
266 | 259 | ||
diff --git a/noncore/settings/networksettings2/networksettings2/resources.cpp b/noncore/settings/networksettings2/networksettings2/resources.cpp index e6ce2b7..4b7a62f 100644 --- a/noncore/settings/networksettings2/networksettings2/resources.cpp +++ b/noncore/settings/networksettings2/networksettings2/resources.cpp | |||
@@ -162,26 +162,26 @@ bool TheNSResources::loadNetNode( | |||
162 | 162 | ||
163 | NNP = it.current(); | 163 | NNP = it.current(); |
164 | NN = new NetNode_t; | 164 | NN = new NetNode_t; |
165 | NN->NetNode = NNP; | 165 | NN->NetNode = NNP; |
166 | NN->TheLibrary = lib; | 166 | NN->TheLibrary = lib; |
167 | NN->NodeCountInLib = PNN.count(); | 167 | NN->NodeCountInLib = PNN.count(); |
168 | 168 | ||
169 | // store mapping | 169 | // store mapping |
170 | AllNodeTypes.insert( NN->NetNode->nodeName(), NN ); | 170 | printf( "Store %s\n", NN->NetNode->name() ); |
171 | AllNodeTypes.insert( NN->NetNode->name(), NN ); | ||
171 | } | 172 | } |
172 | 173 | ||
173 | return 1; | 174 | return 1; |
174 | } | 175 | } |
175 | 176 | ||
176 | QPixmap TheNSResources::getPixmap( const QString & QS ) { | 177 | QPixmap TheNSResources::getPixmap( const QString & QS ) { |
177 | QString S("networksettings2/"); | 178 | QString S("networksettings2/"); |
178 | S += QS; | 179 | S += QS; |
179 | printf( " pixmap %s\n", S.latin1() ); | ||
180 | return Resource::loadPixmap( QString("networksettings2/")+QS ); | 180 | return Resource::loadPixmap( QString("networksettings2/")+QS ); |
181 | } | 181 | } |
182 | 182 | ||
183 | QString TheNSResources::tr( const char * s ) { | 183 | QString TheNSResources::tr( const char * s ) { |
184 | return qApp->translate( "resource", s ); | 184 | return qApp->translate( "resource", s ); |
185 | } | 185 | } |
186 | 186 | ||
187 | const QString & TheNSResources::netNode2Name( const char * s ) { | 187 | const QString & TheNSResources::netNode2Name( const char * s ) { |
@@ -195,32 +195,32 @@ const QString & TheNSResources::netNode2Description( const char * s ) { | |||
195 | void TheNSResources::addConnection( NodeCollection * NC ) { | 195 | void TheNSResources::addConnection( NodeCollection * NC ) { |
196 | ANetNodeInstance * NNI; | 196 | ANetNodeInstance * NNI; |
197 | ConnectionsMap.insert( NC->name(), NC ); | 197 | ConnectionsMap.insert( NC->name(), NC ); |
198 | // add (new) nodes to NodeList | 198 | // add (new) nodes to NodeList |
199 | for( QListIterator<ANetNodeInstance> it(*NC); | 199 | for( QListIterator<ANetNodeInstance> it(*NC); |
200 | it.current(); | 200 | it.current(); |
201 | ++it ) { | 201 | ++it ) { |
202 | NNI = it.current(); | 202 | NNI = it.current(); |
203 | if( findNodeInstance( NNI->nodeName() ) == 0 ) { | 203 | if( findNodeInstance( NNI->name() ) == 0 ) { |
204 | // new item | 204 | // new item |
205 | addNodeInstance( NNI ); | 205 | addNodeInstance( NNI ); |
206 | } | 206 | } |
207 | } | 207 | } |
208 | } | 208 | } |
209 | 209 | ||
210 | void TheNSResources::removeConnection( const QString & N ) { | 210 | void TheNSResources::removeConnection( const QString & N ) { |
211 | NodeCollection * NC = findConnection( N ); | 211 | NodeCollection * NC = findConnection( N ); |
212 | if( ! NC ) | 212 | if( ! NC ) |
213 | return; | 213 | return; |
214 | 214 | ||
215 | // delete netnodes in this connection | 215 | // delete netnodes in this connection |
216 | ANetNodeInstance * NNI; | 216 | ANetNodeInstance * NNI; |
217 | for( NNI = NC->first(); NNI != 0; NNI = NC->next() ) { | 217 | for( NNI = NC->first(); NNI != 0; NNI = NC->next() ) { |
218 | removeNodeInstance( NNI->nodeName() ); | 218 | removeNodeInstance( NNI->name() ); |
219 | } | 219 | } |
220 | ConnectionsMap.remove( N ); | 220 | ConnectionsMap.remove( N ); |
221 | } | 221 | } |
222 | 222 | ||
223 | NodeCollection * TheNSResources::findConnection( const QString & S ) { | 223 | NodeCollection * TheNSResources::findConnection( const QString & S ) { |
224 | return ConnectionsMap[ S ]; | 224 | return ConnectionsMap[ S ]; |
225 | } | 225 | } |
226 | 226 | ||
diff --git a/noncore/settings/networksettings2/networksettings2/resources.h b/noncore/settings/networksettings2/networksettings2/resources.h index 7050f10..3d6a44f 100644 --- a/noncore/settings/networksettings2/networksettings2/resources.h +++ b/noncore/settings/networksettings2/networksettings2/resources.h | |||
@@ -74,17 +74,17 @@ public : | |||
74 | NNI = NNT->NetNode->createInstance(); | 74 | NNI = NNT->NetNode->createInstance(); |
75 | NNI->initialize(); | 75 | NNI->initialize(); |
76 | return NNI; | 76 | return NNI; |
77 | } | 77 | } |
78 | 78 | ||
79 | Name2Instance_t & netNodeInstances( void ) | 79 | Name2Instance_t & netNodeInstances( void ) |
80 | { return AllNodes; } | 80 | { return AllNodes; } |
81 | void addNodeInstance( ANetNodeInstance * I ) | 81 | void addNodeInstance( ANetNodeInstance * I ) |
82 | { AllNodes.insert( I->nodeName(), I ); } | 82 | { AllNodes.insert( I->name(), I ); } |
83 | void removeNodeInstance( const QString & N ) | 83 | void removeNodeInstance( const QString & N ) |
84 | { AllNodes.remove( N );} | 84 | { AllNodes.remove( N );} |
85 | ANetNodeInstance * findNodeInstance( const QString & S ) | 85 | ANetNodeInstance * findNodeInstance( const QString & S ) |
86 | { return (AllNodes.find(S)!=0) ? AllNodes[S] : 0; } | 86 | { return (AllNodes.find(S)!=0) ? AllNodes[S] : 0; } |
87 | 87 | ||
88 | const QString & netNode2Name( const char * Type ); | 88 | const QString & netNode2Name( const char * Type ); |
89 | const QString & netNode2Description( const char * Type ); | 89 | const QString & netNode2Description( const char * Type ); |
90 | 90 | ||
diff --git a/noncore/settings/networksettings2/networksettings2/systemfile.cpp b/noncore/settings/networksettings2/networksettings2/systemfile.cpp index 62bb6af..b3fc1a5 100644 --- a/noncore/settings/networksettings2/networksettings2/systemfile.cpp +++ b/noncore/settings/networksettings2/networksettings2/systemfile.cpp | |||
@@ -119,17 +119,17 @@ bool SystemFile::preNodeSection( ANetNodeInstance * NNI, long ) { | |||
119 | QFile Fl( TemplDir + Name + "/prenodesection" ); | 119 | QFile Fl( TemplDir + Name + "/prenodesection" ); |
120 | if( ! Fl.open( IO_ReadOnly ) ) | 120 | if( ! Fl.open( IO_ReadOnly ) ) |
121 | return 1; // error | 121 | return 1; // error |
122 | QTextStream TX( &Fl ); | 122 | QTextStream TX( &Fl ); |
123 | QString Out; | 123 | QString Out; |
124 | QString S = TX.readLine(); | 124 | QString S = TX.readLine(); |
125 | while( ! TX.eof() ) { | 125 | while( ! TX.eof() ) { |
126 | Out = S. | 126 | Out = S. |
127 | arg(NNI->nodeClass()->nodeName()); | 127 | arg(NNI->nodeClass()->name()); |
128 | (*this) << Out << endl; | 128 | (*this) << Out << endl; |
129 | S = TX.readLine(); | 129 | S = TX.readLine(); |
130 | } | 130 | } |
131 | } | 131 | } |
132 | return 0; | 132 | return 0; |
133 | } | 133 | } |
134 | 134 | ||
135 | bool SystemFile::postNodeSection( ANetNodeInstance * NNI, long ) { | 135 | bool SystemFile::postNodeSection( ANetNodeInstance * NNI, long ) { |
@@ -137,49 +137,49 @@ bool SystemFile::postNodeSection( ANetNodeInstance * NNI, long ) { | |||
137 | QFile Fl( TemplDir + Name + "/postnodesection" ); | 137 | QFile Fl( TemplDir + Name + "/postnodesection" ); |
138 | if( ! Fl.open( IO_ReadOnly ) ) | 138 | if( ! Fl.open( IO_ReadOnly ) ) |
139 | return 1; // error | 139 | return 1; // error |
140 | QTextStream TX( &Fl ); | 140 | QTextStream TX( &Fl ); |
141 | QString Out; | 141 | QString Out; |
142 | QString S = TX.readLine(); | 142 | QString S = TX.readLine(); |
143 | while( ! TX.eof() ) { | 143 | while( ! TX.eof() ) { |
144 | Out = S. | 144 | Out = S. |
145 | arg(NNI->nodeName()); | 145 | arg(NNI->name()); |
146 | (*this) << Out << endl; | 146 | (*this) << Out << endl; |
147 | S = TX.readLine(); | 147 | S = TX.readLine(); |
148 | } | 148 | } |
149 | } | 149 | } |
150 | return 0; | 150 | return 0; |
151 | } | 151 | } |
152 | 152 | ||
153 | bool SystemFile::preDeviceSection( ANetNode * NN ) { | 153 | bool SystemFile::preDeviceSection( ANetNode * NN ) { |
154 | if( hasPreDeviceSection ) { | 154 | if( hasPreDeviceSection ) { |
155 | QFile Fl( TemplDir + Name + "/predevicesection" ); | 155 | QFile Fl( TemplDir + Name + "/predevicesection" ); |
156 | if( ! Fl.open( IO_ReadOnly ) ) | 156 | if( ! Fl.open( IO_ReadOnly ) ) |
157 | return 1; // error | 157 | return 1; // error |
158 | QTextStream TX( &Fl ); | 158 | QTextStream TX( &Fl ); |
159 | QString Out; | 159 | QString Out; |
160 | QString S = TX.readLine(); | 160 | QString S = TX.readLine(); |
161 | while( ! TX.eof() ) { | 161 | while( ! TX.eof() ) { |
162 | Out = S.arg(NN->nodeName()); | 162 | Out = S.arg(NN->name()); |
163 | (*this) << Out << endl; | 163 | (*this) << Out << endl; |
164 | S = TX.readLine(); | 164 | S = TX.readLine(); |
165 | } | 165 | } |
166 | } | 166 | } |
167 | return 0; | 167 | return 0; |
168 | } | 168 | } |
169 | 169 | ||
170 | bool SystemFile::postDeviceSection( ANetNode * NN ) { | 170 | bool SystemFile::postDeviceSection( ANetNode * NN ) { |
171 | if( hasPostDeviceSection ) { | 171 | if( hasPostDeviceSection ) { |
172 | QFile Fl( TemplDir + Name + "/postdevicesection" ); | 172 | QFile Fl( TemplDir + Name + "/postdevicesection" ); |
173 | if( ! Fl.open( IO_ReadOnly ) ) | 173 | if( ! Fl.open( IO_ReadOnly ) ) |
174 | return 1; // error | 174 | return 1; // error |
175 | QTextStream TX( &Fl ); | 175 | QTextStream TX( &Fl ); |
176 | QString Out; | 176 | QString Out; |
177 | QString S = TX.readLine(); | 177 | QString S = TX.readLine(); |
178 | while( ! TX.eof() ) { | 178 | while( ! TX.eof() ) { |
179 | Out = S.arg(NN->nodeName()); | 179 | Out = S.arg(NN->name()); |
180 | (*this) << Out << endl; | 180 | (*this) << Out << endl; |
181 | S = TX.readLine(); | 181 | S = TX.readLine(); |
182 | } | 182 | } |
183 | } | 183 | } |
184 | return 0; | 184 | return 0; |
185 | } | 185 | } |
diff --git a/noncore/settings/networksettings2/nsdata.cpp b/noncore/settings/networksettings2/nsdata.cpp index 13979ce..64b83f7 100644 --- a/noncore/settings/networksettings2/nsdata.cpp +++ b/noncore/settings/networksettings2/nsdata.cpp | |||
@@ -10,17 +10,17 @@ | |||
10 | #include <resources.h> | 10 | #include <resources.h> |
11 | 11 | ||
12 | static QString CfgFile; | 12 | static QString CfgFile; |
13 | 13 | ||
14 | NetworkSettingsData::NetworkSettingsData( void ) { | 14 | NetworkSettingsData::NetworkSettingsData( void ) { |
15 | // init global resources structure | 15 | // init global resources structure |
16 | new TheNSResources(); | 16 | new TheNSResources(); |
17 | 17 | ||
18 | CfgFile.sprintf( "%s/NETCONFIG", | 18 | CfgFile.sprintf( "%s/Settings/NS2.conf", |
19 | NSResources->currentUser().HomeDir.latin1() ); | 19 | NSResources->currentUser().HomeDir.latin1() ); |
20 | fprintf( stderr, "Cfg from %s\n", CfgFile.latin1() ); | 20 | fprintf( stderr, "Cfg from %s\n", CfgFile.latin1() ); |
21 | 21 | ||
22 | // load settings | 22 | // load settings |
23 | Force = 0; | 23 | Force = 0; |
24 | IsModified = 0; | 24 | IsModified = 0; |
25 | loadSettings(); | 25 | loadSettings(); |
26 | } | 26 | } |
@@ -70,27 +70,33 @@ void NetworkSettingsData::loadSettings( void ) { | |||
70 | if( S == "connection" ) { | 70 | if( S == "connection" ) { |
71 | // load connections -> collections of nodes | 71 | // load connections -> collections of nodes |
72 | NodeCollection * NC = new NodeCollection( TS ); | 72 | NodeCollection * NC = new NodeCollection( TS ); |
73 | NSResources->addConnection( NC ); | 73 | NSResources->addConnection( NC ); |
74 | } else { | 74 | } else { |
75 | ANetNode * NN = 0; | 75 | ANetNode * NN = 0; |
76 | ANetNodeInstance* NNI = 0; | 76 | ANetNodeInstance* NNI = 0; |
77 | if( S.startsWith( "nodetype " ) ) { | 77 | if( S.startsWith( "nodetype " ) ) { |
78 | S = S.mid( 9, S.length()-9-1 ); | 78 | S = S.mid( 9, S.length()-9 ); |
79 | fprintf( stderr, "Node %s\n", S.latin1() ); | 79 | S = deQuote(S); |
80 | // try to find netnode | 80 | // try to find netnode |
81 | NN = NSResources->findNetNode( S ); | 81 | NN = NSResources->findNetNode( S ); |
82 | fprintf( stderr, "Node %s : %p\n", S.latin1(), NN ); | ||
82 | } else { | 83 | } else { |
83 | // try to find instance | 84 | // try to find instance |
84 | NNI = NSResources->createNodeInstance( S ); | 85 | NNI = NSResources->createNodeInstance( S ); |
86 | fprintf( stderr, "NodeInstance %s : %p\n", S.latin1(), NNI ); | ||
87 | } | ||
88 | |||
89 | if( NN == 0 && NNI == 0 ) { | ||
90 | LeftOvers.append( Line ); | ||
85 | } | 91 | } |
86 | 92 | ||
87 | do { | 93 | do { |
88 | S = TS.readLine(); | 94 | S = Line = TS.readLine(); |
89 | 95 | ||
90 | if( NN || NNI ) { | 96 | if( NN || NNI ) { |
91 | if( S.isEmpty() ) { | 97 | if( S.isEmpty() ) { |
92 | // empty line | 98 | // empty line |
93 | break; | 99 | break; |
94 | } | 100 | } |
95 | idx = S.find( '=' ); | 101 | idx = S.find( '=' ); |
96 | if( idx > 0 ) { | 102 | if( idx > 0 ) { |
@@ -104,30 +110,31 @@ void NetworkSettingsData::loadSettings( void ) { | |||
104 | Value.stripWhiteSpace(); | 110 | Value.stripWhiteSpace(); |
105 | Attr.stripWhiteSpace(); | 111 | Attr.stripWhiteSpace(); |
106 | Attr.lower(); | 112 | Attr.lower(); |
107 | // dequote Attr | 113 | // dequote Attr |
108 | Value = deQuote(Value); | 114 | Value = deQuote(Value); |
109 | 115 | ||
110 | if( NN ) { | 116 | if( NN ) { |
111 | // set the attribute | 117 | // set the attribute |
112 | NNI->setAttribute( Attr, Value ); | 118 | NN->setAttribute( Attr, Value ); |
113 | } else { | 119 | } else { |
114 | // set the attribute | 120 | // set the attribute |
115 | NNI->setAttribute( Attr, Value ); | 121 | NNI->setAttribute( Attr, Value ); |
116 | } | 122 | } |
117 | } else { | 123 | } else { |
118 | LeftOvers.append( Line ); | 124 | LeftOvers.append( Line ); |
119 | // add empty line too as delimiter | 125 | // add empty line too as delimiter |
120 | if( S.isEmpty() ) { | 126 | if( S.isEmpty() ) { |
121 | // empty line | 127 | // empty line |
122 | break; | 128 | break; |
123 | } | 129 | } |
124 | } | 130 | } |
125 | } while( 1 ); | 131 | } while( 1 ); |
132 | |||
126 | if( NNI ) { | 133 | if( NNI ) { |
127 | // loading from file -> exists | 134 | // loading from file -> exists |
128 | NNI->setNew( FALSE ); | 135 | NNI->setNew( FALSE ); |
129 | NSResources->addNodeInstance( NNI ); | 136 | NSResources->addNodeInstance( NNI ); |
130 | } | 137 | } |
131 | } | 138 | } |
132 | } | 139 | } |
133 | 140 | ||
@@ -161,37 +168,41 @@ QString NetworkSettingsData::saveSettings( void ) { | |||
161 | TS << (*it) << endl; | 168 | TS << (*it) << endl; |
162 | } | 169 | } |
163 | 170 | ||
164 | // save global configs | 171 | // save global configs |
165 | for( QDictIterator<NetNode_t> it( NSResources->netNodes() ); | 172 | for( QDictIterator<NetNode_t> it( NSResources->netNodes() ); |
166 | it.current(); | 173 | it.current(); |
167 | ++it ) { | 174 | ++it ) { |
168 | TS << "[nodetype " | 175 | TS << "[nodetype " |
169 | << it.current()->NetNode->name() | 176 | << quote( QString( it.current()->NetNode->name() ) ) |
170 | << "]" | 177 | << "]" |
171 | << endl; | 178 | << endl; |
172 | 179 | ||
173 | it.current()->NetNode->saveAttributes( TS ); | 180 | it.current()->NetNode->saveAttributes( TS ); |
181 | TS << endl; | ||
174 | } | 182 | } |
175 | 183 | ||
176 | { Name2Connection_t & M = NSResources->connections(); | 184 | { Name2Connection_t & M = NSResources->connections(); |
177 | ANetNodeInstance * NNI; | 185 | ANetNodeInstance * NNI; |
178 | 186 | ||
179 | // for all connections | 187 | // for all connections |
180 | for( QDictIterator<NodeCollection> it(M); | 188 | for( QDictIterator<NodeCollection> it(M); |
181 | it.current(); | 189 | it.current(); |
182 | ++it ) { | 190 | ++it ) { |
183 | // all nodes in those connections | 191 | // all nodes in those connections |
184 | for( QListIterator<ANetNodeInstance> nit(*(it.current())); | 192 | for( QListIterator<ANetNodeInstance> nit(*(it.current())); |
185 | nit.current(); | 193 | nit.current(); |
186 | ++nit ) { | 194 | ++nit ) { |
187 | // header | 195 | // header |
188 | NNI = nit.current(); | 196 | NNI = nit.current(); |
189 | TS << '[' <<NNI->nodeClass()->nodeName() << ']' << endl; | 197 | TS << '[' |
198 | << QString(NNI->nodeClass()->name()) | ||
199 | << ']' | ||
200 | << endl; | ||
190 | NNI->saveAttributes( TS ); | 201 | NNI->saveAttributes( TS ); |
191 | TS << endl; | 202 | TS << endl; |
192 | } | 203 | } |
193 | 204 | ||
194 | TS << "[connection]" << endl; | 205 | TS << "[connection]" << endl; |
195 | it.current()->save(TS); | 206 | it.current()->save(TS); |
196 | } | 207 | } |
197 | } | 208 | } |
@@ -290,17 +301,17 @@ QString NetworkSettingsData::generateSettings( bool ForceReq ) { | |||
290 | // for all nodes find those that are modified | 301 | // for all nodes find those that are modified |
291 | NNI = NNIIt.current(); | 302 | NNI = NNIIt.current(); |
292 | 303 | ||
293 | if( ForceIt || NNI->isModified() ) { | 304 | if( ForceIt || NNI->isModified() ) { |
294 | if( ! NNI->nodeClass()->generateProperFilesFor( NNI ) ) { | 305 | if( ! NNI->nodeClass()->generateProperFilesFor( NNI ) ) { |
295 | // problem generating | 306 | // problem generating |
296 | S = qApp->translate( "NetworkSettings", | 307 | S = qApp->translate( "NetworkSettings", |
297 | "<p>Cannot generate files proper to \"%1\"</p>" ). | 308 | "<p>Cannot generate files proper to \"%1\"</p>" ). |
298 | arg(NNI->nodeClass()->nodeName()) ; | 309 | arg(NNI->nodeClass()->name()) ; |
299 | return S; | 310 | return S; |
300 | } | 311 | } |
301 | } | 312 | } |
302 | } | 313 | } |
303 | } | 314 | } |
304 | 315 | ||
305 | // | 316 | // |
306 | // generate all system files | 317 | // generate all system files |
@@ -385,22 +396,21 @@ QList<NodeCollection> NetworkSettingsData::collectPossible( const char * Interfa | |||
385 | Name2Connection_t & M = NSResources->connections(); | 396 | Name2Connection_t & M = NSResources->connections(); |
386 | 397 | ||
387 | // for all connections | 398 | // for all connections |
388 | for( QDictIterator<NodeCollection> it(M); | 399 | for( QDictIterator<NodeCollection> it(M); |
389 | it.current(); | 400 | it.current(); |
390 | ++it ) { | 401 | ++it ) { |
391 | NC = it.current(); | 402 | NC = it.current(); |
392 | // check if this profile handles the requested interface | 403 | // check if this profile handles the requested interface |
393 | fprintf( stderr, "check %s\n", NC->name().latin1() ); | ||
394 | if( NC->handlesInterface( Interface ) && // if different Intf. | 404 | if( NC->handlesInterface( Interface ) && // if different Intf. |
395 | NC->state() != Disabled && // if not enabled | 405 | NC->state() != Disabled && // if not enabled |
396 | NC->state() != IsUp // if already used | 406 | NC->state() != IsUp // if already used |
397 | ) { | 407 | ) { |
398 | fprintf( stderr, "Append %s\n", NC->name().latin1() ); | 408 | fprintf( stderr, "Append %s for %s\n", NC->name().latin1(), Interface); |
399 | PossibleConnections.append( NC ); | 409 | PossibleConnections.append( NC ); |
400 | } | 410 | } |
401 | } | 411 | } |
402 | return PossibleConnections; | 412 | return PossibleConnections; |
403 | } | 413 | } |
404 | 414 | ||
405 | 415 | ||
406 | /* | 416 | /* |
@@ -481,99 +491,92 @@ QString NetworkSettingsData::generateSystemFileNode( | |||
481 | QString S=""; | 491 | QString S=""; |
482 | ANetNode * CurDevNN = DevNNI->nodeClass(); | 492 | ANetNode * CurDevNN = DevNNI->nodeClass(); |
483 | Name2Connection_t & M = NSResources->connections(); | 493 | Name2Connection_t & M = NSResources->connections(); |
484 | 494 | ||
485 | if( SF.preDeviceSection( CurDevNN ) ) { | 495 | if( SF.preDeviceSection( CurDevNN ) ) { |
486 | S = qApp->translate( "NetworkSettings", | 496 | S = qApp->translate( "NetworkSettings", |
487 | "<p>Error in preDeviceSection for file \"%1\" and nodetype \"%2\"</p>" ). | 497 | "<p>Error in preDeviceSection for file \"%1\" and nodetype \"%2\"</p>" ). |
488 | arg( SF.name() ). | 498 | arg( SF.name() ). |
489 | arg( CurDevNN->nodeName() ); | 499 | arg( CurDevNN->name() ); |
490 | return S; | 500 | return S; |
491 | } | 501 | } |
492 | 502 | ||
493 | if( CurDevNN->hasDataFor( SF.name() ) ) { | 503 | if( CurDevNN->hasDataFor( SF.name() ) ) { |
494 | if( CurDevNN->generateDeviceDataForCommonFile( SF, DevInstNr ) ) { | 504 | if( CurDevNN->generateDeviceDataForCommonFile( SF, DevInstNr ) ) { |
495 | S = qApp->translate( "NetworkSettings", | 505 | S = qApp->translate( "NetworkSettings", |
496 | "<p>Error in node Device part for file \"%1\" and node \"%2\"</p>" ). | 506 | "<p>Error in node Device part for file \"%1\" and node \"%2\"</p>" ). |
497 | arg( SF.name() ). | 507 | arg( SF.name() ). |
498 | arg( CurDevNN->nodeName() ); | 508 | arg( CurDevNN->name() ); |
499 | return S; | 509 | return S; |
500 | } | 510 | } |
501 | } | 511 | } |
502 | 512 | ||
503 | if( CurDev ) | ||
504 | fprintf( stderr, "Cur %s\n", CurDevNN->nodeName().latin1() ); | ||
505 | else | ||
506 | fprintf( stderr, "Cur NO\n" ); | ||
507 | |||
508 | // now generate profile specific data for all | 513 | // now generate profile specific data for all |
509 | // connections working on a device of the current | 514 | // connections working on a device of the current |
510 | // netnode type | 515 | // netnode type |
511 | for( QDictIterator<NodeCollection> ncit(M); | 516 | for( QDictIterator<NodeCollection> ncit(M); |
512 | ncit.current(); | 517 | ncit.current(); |
513 | ++ncit ) { | 518 | ++ncit ) { |
514 | NodeCollection * NC = ncit.current(); | 519 | NodeCollection * NC = ncit.current(); |
515 | 520 | ||
516 | // currenly only those connections that work on | 521 | // currenly only those connections that work on |
517 | // the current device (or on no device if no current) | 522 | // the current device (or on no device if no current) |
518 | AsDevice * Dev = NC->device(); | 523 | AsDevice * Dev = NC->device(); |
519 | 524 | ||
520 | fprintf( stderr, "%s\n", Dev->netNode()->nodeName().latin1() ); | ||
521 | if( CurDev ) { | 525 | if( CurDev ) { |
522 | if( CurDevNN != Dev->netNode()->nodeClass() ) { | 526 | if( CurDevNN != Dev->netNode()->nodeClass() ) { |
523 | // other device type -> later | 527 | // other device type -> later |
524 | fprintf( stderr, "Other Dev type\n" ); | ||
525 | continue; | 528 | continue; |
526 | } | 529 | } |
527 | } else { | 530 | } else { |
528 | if( Dev ) { | 531 | if( Dev ) { |
529 | // other | 532 | // other |
530 | continue; | 533 | continue; |
531 | } | 534 | } |
532 | } | 535 | } |
533 | 536 | ||
534 | // generate 'entry' | 537 | // generate 'entry' |
535 | if( SF.preNodeSection( DevNNI, DevInstNr ) ) { | 538 | if( SF.preNodeSection( DevNNI, DevInstNr ) ) { |
536 | S = qApp->translate( "NetworkSettings", | 539 | S = qApp->translate( "NetworkSettings", |
537 | "<p>Error in preNodeSection for file \"%1\" and node \"%2\"</p>" ). | 540 | "<p>Error in preNodeSection for file \"%1\" and node \"%2\"</p>" ). |
538 | arg( SF.name() ). | 541 | arg( SF.name() ). |
539 | arg( CurDevNN->nodeName() ); | 542 | arg( CurDevNN->name() ); |
540 | return S; | 543 | return S; |
541 | } | 544 | } |
542 | 545 | ||
543 | // ask all nodes in connection | 546 | // ask all nodes in connection |
544 | for( QListIterator<ANetNodeInstance> cncit(*NC); | 547 | for( QListIterator<ANetNodeInstance> cncit(*NC); |
545 | cncit.current(); | 548 | cncit.current(); |
546 | ++cncit ) { | 549 | ++cncit ) { |
547 | ANetNodeInstance * NNI = cncit.current(); | 550 | ANetNodeInstance * NNI = cncit.current(); |
548 | 551 | ||
549 | if( NNI->hasDataFor( SF.name() ) ) { | 552 | if( NNI->hasDataFor( SF.name() ) ) { |
550 | if( NNI->generateDataForCommonFile(SF,DevInstNr) ) { | 553 | if( NNI->generateDataForCommonFile(SF,DevInstNr) ) { |
551 | S = qApp->translate( "NetworkSettings", | 554 | S = qApp->translate( "NetworkSettings", |
552 | "<p>Error in node part for file \"%1\" and node \"%2\"</p>" ). | 555 | "<p>Error in node part for file \"%1\" and node \"%2\"</p>" ). |
553 | arg( SF.name() ). | 556 | arg( SF.name() ). |
554 | arg( NNI->nodeClass()->nodeName() ); | 557 | arg( NNI->nodeClass()->name() ); |
555 | return S; | 558 | return S; |
556 | } | 559 | } |
557 | } | 560 | } |
558 | } | 561 | } |
559 | 562 | ||
560 | if( SF.postNodeSection( DevNNI, DevInstNr ) ) { | 563 | if( SF.postNodeSection( DevNNI, DevInstNr ) ) { |
561 | S = qApp->translate( "NetworkSettings", | 564 | S = qApp->translate( "NetworkSettings", |
562 | "<p>Error in postNodeSection for file \"%1\" and node \"%2\"</p>" ). | 565 | "<p>Error in postNodeSection for file \"%1\" and node \"%2\"</p>" ). |
563 | arg( SF.name() ). | 566 | arg( SF.name() ). |
564 | arg( CurDevNN->nodeName() ); | 567 | arg( CurDevNN->name() ); |
565 | return S; | 568 | return S; |
566 | } | 569 | } |
567 | SF << endl; | 570 | SF << endl; |
568 | } | 571 | } |
569 | 572 | ||
570 | if( SF.postDeviceSection( CurDevNN ) ) { | 573 | if( SF.postDeviceSection( CurDevNN ) ) { |
571 | S = qApp->translate( "NetworkSettings", | 574 | S = qApp->translate( "NetworkSettings", |
572 | "<p>Error in postDeviceSection for file \"%1\" and node \"%2\"</p>" ). | 575 | "<p>Error in postDeviceSection for file \"%1\" and node \"%2\"</p>" ). |
573 | arg( SF.name() ). | 576 | arg( SF.name() ). |
574 | arg( CurDevNN->nodeName() ); | 577 | arg( CurDevNN->name() ); |
575 | return S; | 578 | return S; |
576 | } | 579 | } |
577 | 580 | ||
578 | return S; | 581 | return S; |
579 | } | 582 | } |
diff --git a/noncore/settings/networksettings2/ppp/ppp_NN.cpp b/noncore/settings/networksettings2/ppp/ppp_NN.cpp index 0bf415b..208c7c2 100644 --- a/noncore/settings/networksettings2/ppp/ppp_NN.cpp +++ b/noncore/settings/networksettings2/ppp/ppp_NN.cpp | |||
@@ -5,17 +5,17 @@ static const char * PPPNeeds[] = | |||
5 | { "line", | 5 | { "line", |
6 | "modem", | 6 | "modem", |
7 | 0 | 7 | 0 |
8 | }; | 8 | }; |
9 | 9 | ||
10 | /** | 10 | /** |
11 | * Constructor, find all of the possible interfaces | 11 | * Constructor, find all of the possible interfaces |
12 | */ | 12 | */ |
13 | PPPNetNode::PPPNetNode() : ANetNode() { | 13 | PPPNetNode::PPPNetNode() : ANetNode(tr("PPP Connection")) { |
14 | } | 14 | } |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * Delete any interfaces that we own. | 17 | * Delete any interfaces that we own. |
18 | */ | 18 | */ |
19 | PPPNetNode::~PPPNetNode(){ | 19 | PPPNetNode::~PPPNetNode(){ |
20 | } | 20 | } |
21 | 21 | ||
diff --git a/noncore/settings/networksettings2/ppp/ppp_NN.h b/noncore/settings/networksettings2/ppp/ppp_NN.h index fbbbbe1..b1483c4 100644 --- a/noncore/settings/networksettings2/ppp/ppp_NN.h +++ b/noncore/settings/networksettings2/ppp/ppp_NN.h | |||
@@ -12,19 +12,16 @@ class PPPNetNode : public ANetNode{ | |||
12 | public: | 12 | public: |
13 | 13 | ||
14 | PPPNetNode(); | 14 | PPPNetNode(); |
15 | virtual ~PPPNetNode(); | 15 | virtual ~PPPNetNode(); |
16 | 16 | ||
17 | virtual const QString pixmapName() | 17 | virtual const QString pixmapName() |
18 | { return "Devices/ppp"; } | 18 | { return "Devices/ppp"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | ||
21 | { return tr("PPP Connection"); } | ||
22 | |||
23 | virtual const QString nodeDescription() ; | 20 | virtual const QString nodeDescription() ; |
24 | 21 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 22 | virtual ANetNodeInstance * createInstance( void ); |
26 | 23 | ||
27 | virtual const char ** needs( void ); | 24 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 25 | virtual const char * provides( void ); |
29 | 26 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 27 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
diff --git a/noncore/settings/networksettings2/profile/profile_NN.cpp b/noncore/settings/networksettings2/profile/profile_NN.cpp index 0f71dc7..d06b7ef 100644 --- a/noncore/settings/networksettings2/profile/profile_NN.cpp +++ b/noncore/settings/networksettings2/profile/profile_NN.cpp | |||
@@ -4,17 +4,17 @@ | |||
4 | static const char * ProfileNeeds[] = | 4 | static const char * ProfileNeeds[] = |
5 | { "connection", | 5 | { "connection", |
6 | 0 | 6 | 0 |
7 | }; | 7 | }; |
8 | 8 | ||
9 | /** | 9 | /** |
10 | * Constructor, find all of the possible interfaces | 10 | * Constructor, find all of the possible interfaces |
11 | */ | 11 | */ |
12 | ProfileNetNode::ProfileNetNode() : ANetNode() { | 12 | ProfileNetNode::ProfileNetNode() : ANetNode( tr("Regular profile")) { |
13 | } | 13 | } |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * Delete any interfaces that we own. | 16 | * Delete any interfaces that we own. |
17 | */ | 17 | */ |
18 | ProfileNetNode::~ProfileNetNode(){ | 18 | ProfileNetNode::~ProfileNetNode(){ |
19 | } | 19 | } |
20 | 20 | ||
diff --git a/noncore/settings/networksettings2/profile/profile_NN.h b/noncore/settings/networksettings2/profile/profile_NN.h index 1313ab2..e602bd7 100644 --- a/noncore/settings/networksettings2/profile/profile_NN.h +++ b/noncore/settings/networksettings2/profile/profile_NN.h | |||
@@ -12,19 +12,16 @@ class ProfileNetNode : public ANetNode{ | |||
12 | public: | 12 | public: |
13 | 13 | ||
14 | ProfileNetNode(); | 14 | ProfileNetNode(); |
15 | virtual ~ProfileNetNode(); | 15 | virtual ~ProfileNetNode(); |
16 | 16 | ||
17 | virtual const QString pixmapName() | 17 | virtual const QString pixmapName() |
18 | { return "Devices/commprofile"; } | 18 | { return "Devices/commprofile"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | ||
21 | { return tr("Regular profile"); } | ||
22 | |||
23 | virtual const QString nodeDescription() ; | 20 | virtual const QString nodeDescription() ; |
24 | 21 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 22 | virtual ANetNodeInstance * createInstance( void ); |
26 | 23 | ||
27 | virtual const char ** needs( void ); | 24 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 25 | virtual const char * provides( void ); |
29 | 26 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 27 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
diff --git a/noncore/settings/networksettings2/usb/usb_NN.cpp b/noncore/settings/networksettings2/usb/usb_NN.cpp index d5971cf..9101490 100644 --- a/noncore/settings/networksettings2/usb/usb_NN.cpp +++ b/noncore/settings/networksettings2/usb/usb_NN.cpp | |||
@@ -3,17 +3,17 @@ | |||
3 | 3 | ||
4 | static const char * USBNeeds[] = | 4 | static const char * USBNeeds[] = |
5 | { 0 | 5 | { 0 |
6 | }; | 6 | }; |
7 | 7 | ||
8 | /** | 8 | /** |
9 | * Constructor, find all of the possible interfaces | 9 | * Constructor, find all of the possible interfaces |
10 | */ | 10 | */ |
11 | USBNetNode::USBNetNode() : ANetNode() { | 11 | USBNetNode::USBNetNode() : ANetNode(tr("USB Cable Connect")) { |
12 | } | 12 | } |
13 | 13 | ||
14 | /** | 14 | /** |
15 | * Delete any interfaces that we own. | 15 | * Delete any interfaces that we own. |
16 | */ | 16 | */ |
17 | USBNetNode::~USBNetNode(){ | 17 | USBNetNode::~USBNetNode(){ |
18 | } | 18 | } |
19 | 19 | ||
diff --git a/noncore/settings/networksettings2/usb/usb_NN.h b/noncore/settings/networksettings2/usb/usb_NN.h index 0b83ea6..fea89f0 100644 --- a/noncore/settings/networksettings2/usb/usb_NN.h +++ b/noncore/settings/networksettings2/usb/usb_NN.h | |||
@@ -12,19 +12,16 @@ class USBNetNode : public ANetNode{ | |||
12 | public: | 12 | public: |
13 | 13 | ||
14 | USBNetNode(); | 14 | USBNetNode(); |
15 | virtual ~USBNetNode(); | 15 | virtual ~USBNetNode(); |
16 | 16 | ||
17 | virtual const QString pixmapName() | 17 | virtual const QString pixmapName() |
18 | { return "Devices/usb"; } | 18 | { return "Devices/usb"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | ||
21 | { return tr("USB Cable Connect"); } | ||
22 | |||
23 | virtual const QString nodeDescription() ; | 20 | virtual const QString nodeDescription() ; |
24 | 21 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 22 | virtual ANetNodeInstance * createInstance( void ); |
26 | 23 | ||
27 | virtual const char ** needs( void ); | 24 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 25 | virtual const char * provides( void ); |
29 | 26 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 27 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
diff --git a/noncore/settings/networksettings2/vpn/vpn_NN.cpp b/noncore/settings/networksettings2/vpn/vpn_NN.cpp index 307e9dd..bfc30f9 100644 --- a/noncore/settings/networksettings2/vpn/vpn_NN.cpp +++ b/noncore/settings/networksettings2/vpn/vpn_NN.cpp | |||
@@ -4,17 +4,17 @@ | |||
4 | static const char * VPNNeeds[] = | 4 | static const char * VPNNeeds[] = |
5 | { "connection", | 5 | { "connection", |
6 | 0 | 6 | 0 |
7 | }; | 7 | }; |
8 | 8 | ||
9 | /** | 9 | /** |
10 | * Constructor, find all of the possible interfaces | 10 | * Constructor, find all of the possible interfaces |
11 | */ | 11 | */ |
12 | VPNNetNode::VPNNetNode() : ANetNode() { | 12 | VPNNetNode::VPNNetNode() : ANetNode(tr("VPN Connection")) { |
13 | } | 13 | } |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * Delete any interfaces that we own. | 16 | * Delete any interfaces that we own. |
17 | */ | 17 | */ |
18 | VPNNetNode::~VPNNetNode(){ | 18 | VPNNetNode::~VPNNetNode(){ |
19 | } | 19 | } |
20 | 20 | ||
diff --git a/noncore/settings/networksettings2/vpn/vpn_NN.h b/noncore/settings/networksettings2/vpn/vpn_NN.h index 1cd3fcc..5b6632e 100644 --- a/noncore/settings/networksettings2/vpn/vpn_NN.h +++ b/noncore/settings/networksettings2/vpn/vpn_NN.h | |||
@@ -12,19 +12,16 @@ class VPNNetNode : public ANetNode{ | |||
12 | public: | 12 | public: |
13 | 13 | ||
14 | VPNNetNode(); | 14 | VPNNetNode(); |
15 | virtual ~VPNNetNode(); | 15 | virtual ~VPNNetNode(); |
16 | 16 | ||
17 | virtual const QString pixmapName() | 17 | virtual const QString pixmapName() |
18 | { return "Devices/vpn"; } | 18 | { return "Devices/vpn"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | ||
21 | { return tr("VPN Connection"); } | ||
22 | |||
23 | virtual const QString nodeDescription() ; | 20 | virtual const QString nodeDescription() ; |
24 | 21 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 22 | virtual ANetNodeInstance * createInstance( void ); |
26 | 23 | ||
27 | virtual const char ** needs( void ); | 24 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 25 | virtual const char * provides( void ); |
29 | 26 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 27 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
diff --git a/noncore/settings/networksettings2/wlan/wlan_NN.cpp b/noncore/settings/networksettings2/wlan/wlan_NN.cpp index e0c4db2..7a2c1a7 100644 --- a/noncore/settings/networksettings2/wlan/wlan_NN.cpp +++ b/noncore/settings/networksettings2/wlan/wlan_NN.cpp | |||
@@ -3,17 +3,17 @@ | |||
3 | 3 | ||
4 | static const char * WLanNeeds[] = | 4 | static const char * WLanNeeds[] = |
5 | { 0 | 5 | { 0 |
6 | }; | 6 | }; |
7 | 7 | ||
8 | /** | 8 | /** |
9 | * Constructor, find all of the possible interfaces | 9 | * Constructor, find all of the possible interfaces |
10 | */ | 10 | */ |
11 | WLanNetNode::WLanNetNode() : ANetNode() { | 11 | WLanNetNode::WLanNetNode() : ANetNode(tr("WLan Device")) { |
12 | InstanceCount = 2; | 12 | InstanceCount = 2; |
13 | } | 13 | } |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * Delete any interfaces that we own. | 16 | * Delete any interfaces that we own. |
17 | */ | 17 | */ |
18 | WLanNetNode::~WLanNetNode(){ | 18 | WLanNetNode::~WLanNetNode(){ |
19 | } | 19 | } |
diff --git a/noncore/settings/networksettings2/wlan/wlan_NN.h b/noncore/settings/networksettings2/wlan/wlan_NN.h index e93a89a..b5ff3fd 100644 --- a/noncore/settings/networksettings2/wlan/wlan_NN.h +++ b/noncore/settings/networksettings2/wlan/wlan_NN.h | |||
@@ -12,19 +12,16 @@ class WLanNetNode : public ANetNode{ | |||
12 | public: | 12 | public: |
13 | 13 | ||
14 | WLanNetNode(); | 14 | WLanNetNode(); |
15 | virtual ~WLanNetNode(); | 15 | virtual ~WLanNetNode(); |
16 | 16 | ||
17 | virtual const QString pixmapName() | 17 | virtual const QString pixmapName() |
18 | { return "Devices/wlan"; } | 18 | { return "Devices/wlan"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | ||
21 | { return tr("WLan Device"); } | ||
22 | |||
23 | virtual const QString nodeDescription() ; | 20 | virtual const QString nodeDescription() ; |
24 | 21 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 22 | virtual ANetNodeInstance * createInstance( void ); |
26 | 23 | ||
27 | virtual const char ** needs( void ); | 24 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 25 | virtual const char * provides( void ); |
29 | 26 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 27 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |