author | wimpie <wimpie> | 2004-04-04 00:27:59 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2004-04-04 00:27:59 (UTC) |
commit | a416c6c9630d6d63ee63cf520953b86af8b7cddc (patch) (unidiff) | |
tree | dbd0f5173728129f5a3faffdafd4f73d8cc72407 | |
parent | 152ffce2a4e8191d28738e3b40d8a726250a8767 (diff) | |
download | opie-a416c6c9630d6d63ee63cf520953b86af8b7cddc.zip opie-a416c6c9630d6d63ee63cf520953b86af8b7cddc.tar.gz opie-a416c6c9630d6d63ee63cf520953b86af8b7cddc.tar.bz2 |
*** empty log message ***
25 files changed, 130 insertions, 250 deletions
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.h b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.h index 4dd508d..57ff95e 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.h +++ b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.h | |||
@@ -1,42 +1,42 @@ | |||
1 | #ifndef BLUETOOTHRFCOMM_H | 1 | #ifndef BLUETOOTHRFCOMM_H |
2 | #define BLUETOOTHRFCOMM_H | 2 | #define BLUETOOTHRFCOMM_H |
3 | 3 | ||
4 | #include <netnode.h> | 4 | #include <netnode.h> |
5 | #include "bluetoothRFCOMMdata.h" | 5 | #include "bluetoothRFCOMMdata.h" |
6 | #include "bluetoothRFCOMMrun.h" | 6 | #include "bluetoothRFCOMMrun.h" |
7 | 7 | ||
8 | class BluetoothRFCOMMNetNode; | 8 | class BluetoothRFCOMMNetNode; |
9 | class BluetoothRFCOMMEdit; | 9 | class BluetoothRFCOMMEdit; |
10 | 10 | ||
11 | class ABluetoothRFCOMM : public ANetNodeInstance { | 11 | class ABluetoothRFCOMM : public ANetNodeInstance { |
12 | 12 | ||
13 | public : | 13 | public : |
14 | 14 | ||
15 | ABluetoothRFCOMM( BluetoothRFCOMMNetNode * PNN ); | 15 | ABluetoothRFCOMM( BluetoothRFCOMMNetNode * PNN ); |
16 | 16 | ||
17 | QWidget * edit( QWidget * parent ); | 17 | QWidget * edit( QWidget * parent ); |
18 | QString acceptable( void ); | 18 | QString acceptable( void ); |
19 | void commit( void ); | 19 | void commit( void ); |
20 | 20 | ||
21 | RuntimeInfo * runtime( void ) | 21 | RuntimeInfo * runtime( void ) |
22 | { if( RT ) | 22 | { if( RT == 0 ) |
23 | RT = new BluetoothRFCOMMRun( this, Data ); | 23 | RT = new BluetoothRFCOMMRun( this, Data ); |
24 | return RT; | 24 | return RT; |
25 | } | 25 | } |
26 | 26 | ||
27 | virtual void * data( void ) | 27 | virtual void * data( void ) |
28 | { return (void *)&Data; } | 28 | { return (void *)&Data; } |
29 | 29 | ||
30 | protected : | 30 | protected : |
31 | 31 | ||
32 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 32 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
33 | virtual void saveSpecificAttribute( QTextStream & TS ); | 33 | virtual void saveSpecificAttribute( QTextStream & TS ); |
34 | 34 | ||
35 | private : | 35 | private : |
36 | 36 | ||
37 | BluetoothRFCOMMEdit * GUI; | 37 | BluetoothRFCOMMEdit * GUI; |
38 | BluetoothRFCOMMData Data; | 38 | BluetoothRFCOMMData Data; |
39 | BluetoothRFCOMMRun * RT; | 39 | BluetoothRFCOMMRun * RT; |
40 | }; | 40 | }; |
41 | 41 | ||
42 | #endif | 42 | #endif |
diff --git a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h index ee346f0..705201c 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h +++ b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h | |||
@@ -1,75 +1,75 @@ | |||
1 | #ifndef BLUETOOTH_NETNODE_H | 1 | #ifndef BLUETOOTH_NETNODE_H |
2 | #define BLUETOOTH_NETNODE_H | 2 | #define BLUETOOTH_NETNODE_H |
3 | 3 | ||
4 | #include "netnode.h" | 4 | #include "netnode.h" |
5 | 5 | ||
6 | class ABluetoothBNEP; | 6 | class ABluetoothBNEP; |
7 | 7 | ||
8 | class BluetoothBNEPNetNode : public ANetNode { | 8 | class BluetoothBNEPNetNode : public ANetNode { |
9 | 9 | ||
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | 11 | ||
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 "bluetooth"; } | 18 | { return "Devices/bluetooth"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | 20 | virtual const QString nodeName() |
21 | { return tr("Bluetooth PAN/NAP"); } | 21 | { return tr("Bluetooth PAN/NAP"); } |
22 | 22 | ||
23 | virtual const QString nodeDescription() ; | 23 | virtual const QString nodeDescription() ; |
24 | 24 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 25 | virtual ANetNodeInstance * createInstance( void ); |
26 | 26 | ||
27 | virtual const char ** needs( void ); | 27 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 28 | virtual const char * provides( void ); |
29 | 29 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | virtual bool hasDataFor( const QString & S ); | 31 | virtual bool hasDataFor( const QString & S ); |
32 | virtual bool generateDataForCommonFile( | 32 | virtual bool generateDataForCommonFile( |
33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | 33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); |
34 | 34 | ||
35 | private: | 35 | private: |
36 | 36 | ||
37 | }; | 37 | }; |
38 | 38 | ||
39 | class BluetoothRFCOMMNetNode : public ANetNode { | 39 | class BluetoothRFCOMMNetNode : public ANetNode { |
40 | 40 | ||
41 | Q_OBJECT | 41 | Q_OBJECT |
42 | 42 | ||
43 | public: | 43 | public: |
44 | 44 | ||
45 | BluetoothRFCOMMNetNode(); | 45 | BluetoothRFCOMMNetNode(); |
46 | virtual ~BluetoothRFCOMMNetNode(); | 46 | virtual ~BluetoothRFCOMMNetNode(); |
47 | 47 | ||
48 | virtual const QString pixmapName() | 48 | virtual const QString pixmapName() |
49 | { return "bluetooth"; } | 49 | { return "Devices/bluetooth"; } |
50 | 50 | ||
51 | virtual const QString nodeName() | 51 | virtual const QString nodeName() |
52 | { return tr("Bluetooth serial link"); } | 52 | { return tr("Bluetooth serial link"); } |
53 | 53 | ||
54 | virtual const QString nodeDescription() ; | 54 | virtual const QString nodeDescription() ; |
55 | 55 | ||
56 | virtual ANetNodeInstance * createInstance( void ); | 56 | virtual ANetNodeInstance * createInstance( void ); |
57 | 57 | ||
58 | virtual const char ** needs( void ); | 58 | virtual const char ** needs( void ); |
59 | virtual const char * provides( void ); | 59 | virtual const char * provides( void ); |
60 | 60 | ||
61 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 61 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
62 | virtual bool hasDataFor( const QString & S ); | 62 | virtual bool hasDataFor( const QString & S ); |
63 | virtual bool generateDataForCommonFile( | 63 | virtual bool generateDataForCommonFile( |
64 | SystemFile & SF, long, ANetNodeInstance * NNI ); | 64 | SystemFile & SF, long, ANetNodeInstance * NNI ); |
65 | 65 | ||
66 | private: | 66 | private: |
67 | 67 | ||
68 | }; | 68 | }; |
69 | 69 | ||
70 | extern "C" | 70 | extern "C" |
71 | { | 71 | { |
72 | void create_plugin( QList<ANetNode> & PNN ); | 72 | void create_plugin( QList<ANetNode> & PNN ); |
73 | }; | 73 | }; |
74 | 74 | ||
75 | #endif | 75 | #endif |
diff --git a/noncore/settings/networksettings2/cable/cable_NN.h b/noncore/settings/networksettings2/cable/cable_NN.h index 401317b..da99c1c 100644 --- a/noncore/settings/networksettings2/cable/cable_NN.h +++ b/noncore/settings/networksettings2/cable/cable_NN.h | |||
@@ -1,44 +1,44 @@ | |||
1 | #ifndef CABLE_NETNODE_H | 1 | #ifndef CABLE_NETNODE_H |
2 | #define CABLE_NETNODE_H | 2 | #define CABLE_NETNODE_H |
3 | 3 | ||
4 | #include "netnode.h" | 4 | #include "netnode.h" |
5 | 5 | ||
6 | class ACable; | 6 | class ACable; |
7 | 7 | ||
8 | class CableNetNode : public ANetNode { | 8 | class CableNetNode : public ANetNode { |
9 | 9 | ||
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | 11 | ||
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 "cable"; } | 18 | { return "Devices/cable"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | 20 | virtual const QString nodeName() |
21 | { return tr("Cable Connection"); } | 21 | { return tr("Cable Connection"); } |
22 | 22 | ||
23 | virtual const QString nodeDescription() ; | 23 | virtual const QString nodeDescription() ; |
24 | 24 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 25 | virtual ANetNodeInstance * createInstance( void ); |
26 | 26 | ||
27 | virtual const char ** needs( void ); | 27 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 28 | virtual const char * provides( void ); |
29 | 29 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | virtual bool hasDataFor( const QString & S ); | 31 | virtual bool hasDataFor( const QString & S ); |
32 | virtual bool generateDataForCommonFile( | 32 | virtual bool generateDataForCommonFile( |
33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | 33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); |
34 | 34 | ||
35 | private: | 35 | private: |
36 | 36 | ||
37 | }; | 37 | }; |
38 | 38 | ||
39 | extern "C" | 39 | extern "C" |
40 | { | 40 | { |
41 | void create_plugin( QList<ANetNode> & PNN ); | 41 | void create_plugin( QList<ANetNode> & PNN ); |
42 | }; | 42 | }; |
43 | 43 | ||
44 | #endif | 44 | #endif |
diff --git a/noncore/settings/networksettings2/editconnection.cpp b/noncore/settings/networksettings2/editconnection.cpp index d4b2bb3..ce13573 100644 --- a/noncore/settings/networksettings2/editconnection.cpp +++ b/noncore/settings/networksettings2/editconnection.cpp | |||
@@ -260,65 +260,65 @@ NodeCollection * EditConnection::connection( void ) { | |||
260 | return SelectedNodes; | 260 | return SelectedNodes; |
261 | } | 261 | } |
262 | 262 | ||
263 | // Build device tree -> start | 263 | // Build device tree -> start |
264 | void EditConnection::buildFullTree( void ) { | 264 | void EditConnection::buildFullTree( void ) { |
265 | ANetNode * NN; | 265 | ANetNode * NN; |
266 | 266 | ||
267 | // toplevel item | 267 | // toplevel item |
268 | MyQCheckListItem * TheTop = new MyQCheckListItem( | 268 | MyQCheckListItem * TheTop = new MyQCheckListItem( |
269 | Nodes_LV, | 269 | Nodes_LV, |
270 | NSResources->netNode2Name("fullsetup"), | 270 | NSResources->netNode2Name("fullsetup"), |
271 | QCheckListItem::Controller ); | 271 | QCheckListItem::Controller ); |
272 | TheTop->setOpen( TRUE ); | 272 | TheTop->setOpen( TRUE ); |
273 | Description_LBL->setText( | 273 | Description_LBL->setText( |
274 | NSResources->netNode2Description( "fullsetup" ) ); | 274 | NSResources->netNode2Description( "fullsetup" ) ); |
275 | Nodes_LV->setSelected( TheTop, TRUE ); | 275 | Nodes_LV->setSelected( TheTop, TRUE ); |
276 | 276 | ||
277 | // find all Nodes that care toplevel nodes -> ie provide | 277 | // find all Nodes that care toplevel nodes -> ie provide |
278 | // TCP/IP Connection | 278 | // TCP/IP Connection |
279 | for( QDictIterator<NetNode_t> Iter(NSResources->netNodes()); | 279 | for( QDictIterator<NetNode_t> Iter(NSResources->netNodes()); |
280 | Iter.current(); | 280 | Iter.current(); |
281 | ++Iter ) { | 281 | ++Iter ) { |
282 | 282 | ||
283 | NN = Iter.current()->NetNode; | 283 | NN = Iter.current()->NetNode; |
284 | 284 | ||
285 | if( ! NN->isToplevel() ) { | 285 | if( ! NN->isToplevel() ) { |
286 | continue; | 286 | continue; |
287 | } | 287 | } |
288 | 288 | ||
289 | MyQCheckListItem * it = new MyQCheckListItem( TheTop, | 289 | MyQCheckListItem * it = new MyQCheckListItem( TheTop, |
290 | NN->nodeName(), | 290 | NN->nodeName(), |
291 | QCheckListItem::RadioButton ); | 291 | QCheckListItem::RadioButton ); |
292 | it->setPixmap( 0, NSResources->getPixmap( "commprofile" ) ); | 292 | it->setPixmap( 0, NSResources->getPixmap( "Devices/commprofile" ) ); |
293 | // remember that this node maps to this listitem | 293 | // remember that this node maps to this listitem |
294 | Mapping->insert( it, NN ); | 294 | Mapping->insert( it, NN ); |
295 | buildSubTree( it, NN ); | 295 | buildSubTree( it, NN ); |
296 | } | 296 | } |
297 | } | 297 | } |
298 | 298 | ||
299 | // Build device tree -> help function | 299 | // Build device tree -> help function |
300 | void EditConnection::buildSubTree( QListViewItem * it, ANetNode *NN ) { | 300 | void EditConnection::buildSubTree( QListViewItem * it, ANetNode *NN ) { |
301 | ANetNode::NetNodeList & NNL = NN->alternatives(); | 301 | ANetNode::NetNodeList & NNL = NN->alternatives(); |
302 | 302 | ||
303 | if( NNL.size() > 1 ) { | 303 | if( NNL.size() > 1 ) { |
304 | // this node has alternatives -> needs radio buttons | 304 | // this node has alternatives -> needs radio buttons |
305 | it = new MyQCheckListItem( | 305 | it = new MyQCheckListItem( |
306 | it, | 306 | it, |
307 | NSResources->netNode2Name(NNL[0]->provides()), | 307 | NSResources->netNode2Name(NNL[0]->provides()), |
308 | QCheckListItem::Controller ); | 308 | QCheckListItem::Controller ); |
309 | it->setSelectable( FALSE ); | 309 | it->setSelectable( FALSE ); |
310 | } | 310 | } |
311 | 311 | ||
312 | for ( unsigned int i=0; i < NNL.size(); i++ ) { | 312 | for ( unsigned int i=0; i < NNL.size(); i++ ) { |
313 | QListViewItem * CI; | 313 | QListViewItem * CI; |
314 | if( NNL.size() > 1 ) { | 314 | if( NNL.size() > 1 ) { |
315 | // generate radio buttons | 315 | // generate radio buttons |
316 | CI = new MyQCheckListItem( | 316 | CI = new MyQCheckListItem( |
317 | (QCheckListItem *)it, | 317 | (QCheckListItem *)it, |
318 | NNL[i]->nodeName(), QCheckListItem::RadioButton ); | 318 | NNL[i]->nodeName(), QCheckListItem::RadioButton ); |
319 | // remember that this node maps to this listitem | 319 | // remember that this node maps to this listitem |
320 | CI->setPixmap( 0, NSResources->getPixmap( NNL[i]->pixmapName() ) ); | 320 | CI->setPixmap( 0, NSResources->getPixmap( NNL[i]->pixmapName() ) ); |
321 | Mapping->insert( CI, NNL[i] ); | 321 | Mapping->insert( CI, NNL[i] ); |
322 | CI->setSelectable( FALSE ); | 322 | CI->setSelectable( FALSE ); |
323 | } else { | 323 | } else { |
324 | // Single item | 324 | // Single item |
diff --git a/noncore/settings/networksettings2/irda/irda_NN.h b/noncore/settings/networksettings2/irda/irda_NN.h index 82811a4..6574c17 100644 --- a/noncore/settings/networksettings2/irda/irda_NN.h +++ b/noncore/settings/networksettings2/irda/irda_NN.h | |||
@@ -1,44 +1,44 @@ | |||
1 | #ifndef IRDA_NETNODE_H | 1 | #ifndef IRDA_NETNODE_H |
2 | #define IRDA_NETNODE_H | 2 | #define IRDA_NETNODE_H |
3 | 3 | ||
4 | #include "netnode.h" | 4 | #include "netnode.h" |
5 | 5 | ||
6 | class AIRDA; | 6 | class AIRDA; |
7 | 7 | ||
8 | class IRDANetNode : public ANetNode { | 8 | class IRDANetNode : public ANetNode { |
9 | 9 | ||
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | 11 | ||
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 "irda"; } | 18 | { return "Devices/irda"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | 20 | virtual const QString nodeName() |
21 | { return tr("Infrared link"); } | 21 | { return tr("Infrared link"); } |
22 | 22 | ||
23 | virtual const QString nodeDescription() ; | 23 | virtual const QString nodeDescription() ; |
24 | 24 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 25 | virtual ANetNodeInstance * createInstance( void ); |
26 | 26 | ||
27 | virtual const char ** needs( void ); | 27 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 28 | virtual const char * provides( void ); |
29 | 29 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | virtual bool hasDataFor( const QString & S ); | 31 | virtual bool hasDataFor( const QString & S ); |
32 | virtual bool generateDataForCommonFile( | 32 | virtual bool generateDataForCommonFile( |
33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | 33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); |
34 | 34 | ||
35 | private: | 35 | private: |
36 | 36 | ||
37 | }; | 37 | }; |
38 | 38 | ||
39 | extern "C" | 39 | extern "C" |
40 | { | 40 | { |
41 | void create_plugin( QList<ANetNode> & PNN ); | 41 | void create_plugin( QList<ANetNode> & PNN ); |
42 | }; | 42 | }; |
43 | 43 | ||
44 | #endif | 44 | #endif |
diff --git a/noncore/settings/networksettings2/lancard/lancard_NN.h b/noncore/settings/networksettings2/lancard/lancard_NN.h index 576a6e0..71b49d0 100644 --- a/noncore/settings/networksettings2/lancard/lancard_NN.h +++ b/noncore/settings/networksettings2/lancard/lancard_NN.h | |||
@@ -1,44 +1,44 @@ | |||
1 | #ifndef LANCARD_NETNODE_H | 1 | #ifndef LANCARD_NETNODE_H |
2 | #define LANCARD_NETNODE_H | 2 | #define LANCARD_NETNODE_H |
3 | 3 | ||
4 | #include "netnode.h" | 4 | #include "netnode.h" |
5 | 5 | ||
6 | class ALanCard; | 6 | class ALanCard; |
7 | 7 | ||
8 | class LanCardNetNode : public ANetNode{ | 8 | class LanCardNetNode : public ANetNode{ |
9 | 9 | ||
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | 11 | ||
12 | public: | 12 | public: |
13 | 13 | ||
14 | LanCardNetNode(); | 14 | LanCardNetNode(); |
15 | virtual ~LanCardNetNode(); | 15 | virtual ~LanCardNetNode(); |
16 | 16 | ||
17 | virtual const QString pixmapName() | 17 | virtual const QString pixmapName() |
18 | { return "card"; } | 18 | { return "Devices/card"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | 20 | virtual const QString nodeName() |
21 | { return tr("LAN card"); } | 21 | { return tr("LAN card"); } |
22 | 22 | ||
23 | virtual const QString nodeDescription() ; | 23 | virtual const QString nodeDescription() ; |
24 | 24 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 25 | virtual ANetNodeInstance * createInstance( void ); |
26 | 26 | ||
27 | virtual const char ** needs( void ); | 27 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 28 | virtual const char * provides( void ); |
29 | 29 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | virtual bool hasDataFor( const QString & S ); | 31 | virtual bool hasDataFor( const QString & S ); |
32 | virtual bool generateDataForCommonFile( | 32 | virtual bool generateDataForCommonFile( |
33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | 33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); |
34 | 34 | ||
35 | private: | 35 | private: |
36 | 36 | ||
37 | }; | 37 | }; |
38 | 38 | ||
39 | extern "C" | 39 | extern "C" |
40 | { | 40 | { |
41 | void create_plugin( QList<ANetNode> & PNN ); | 41 | void create_plugin( QList<ANetNode> & PNN ); |
42 | }; | 42 | }; |
43 | 43 | ||
44 | #endif | 44 | #endif |
diff --git a/noncore/settings/networksettings2/main.cpp b/noncore/settings/networksettings2/main.cpp index 1e1270e..7ec26a7 100644 --- a/noncore/settings/networksettings2/main.cpp +++ b/noncore/settings/networksettings2/main.cpp | |||
@@ -59,61 +59,61 @@ int main( int argc, char * argv[] ) { | |||
59 | 59 | ||
60 | // Start Qt | 60 | // Start Qt |
61 | #ifdef _WS_QWS_ | 61 | #ifdef _WS_QWS_ |
62 | // because QPEApplication does not handle GuiType well | 62 | // because QPEApplication does not handle GuiType well |
63 | if( GuiType == QApplication::Tty ) { | 63 | if( GuiType == QApplication::Tty ) { |
64 | // this cast is NOT correct but we do not use | 64 | // this cast is NOT correct but we do not use |
65 | // TheApp anymore ... | 65 | // TheApp anymore ... |
66 | TheApp = (QPEApplication *)new QApplication( argc, argv, GuiType ); | 66 | TheApp = (QPEApplication *)new QApplication( argc, argv, GuiType ); |
67 | } else { | 67 | } else { |
68 | TheApp = new QPEApplication( argc, argv, GuiType ); | 68 | TheApp = new QPEApplication( argc, argv, GuiType ); |
69 | } | 69 | } |
70 | #else | 70 | #else |
71 | TheApp = new QApplication( argc, argv, GuiType ); | 71 | TheApp = new QApplication( argc, argv, GuiType ); |
72 | #endif | 72 | #endif |
73 | 73 | ||
74 | // init qt with app widget | 74 | // init qt with app widget |
75 | 75 | ||
76 | switch( Action ) { | 76 | switch( Action ) { |
77 | case ACT_REQUEST : | 77 | case ACT_REQUEST : |
78 | { NetworkSettingsData NS; | 78 | { NetworkSettingsData NS; |
79 | NS.canStart( argv[1] ); | 79 | NS.canStart( argv[1] ); |
80 | } | 80 | } |
81 | break; | 81 | break; |
82 | case ACT_REGEN : | 82 | case ACT_REGEN : |
83 | { NetworkSettingsData NS; | 83 | { NetworkSettingsData NS; |
84 | // regen returns 0 if OK | 84 | // regen returns 0 if OK |
85 | rv = (NS.regenerate()) ? 1 : 0; | 85 | rv = (NS.regenerate()) ? 1 : 0; |
86 | } | 86 | } |
87 | break; | 87 | break; |
88 | case ACT_PROMPT : | 88 | case ACT_PROMPT : |
89 | { ActivateProfile AP(argv[1]); | 89 | { ActivateProfile AP(argv[1]); |
90 | if( AP.exec() == QDialog::Accepted ) { | 90 | if( AP.exec() == QDialog::Accepted ) { |
91 | printf( "%s-c%d-allowed", AP.selectedProfile() ); | 91 | printf( "%s-c%ld-allowed", argv[1], AP.selectedProfile() ); |
92 | } else { | 92 | } else { |
93 | printf( "%s-cNN-disallowed" ); | 93 | printf( "%s-cNN-disallowed", argv[1] ); |
94 | } | 94 | } |
95 | } | 95 | } |
96 | break; | 96 | break; |
97 | case ACT_GUI : | 97 | case ACT_GUI : |
98 | { QWidget * W = new NetworkSettings(0); | 98 | { QWidget * W = new NetworkSettings(0); |
99 | TheApp->setMainWidget( W ); | 99 | TheApp->setMainWidget( W ); |
100 | W->show(); | 100 | W->show(); |
101 | #ifdef _WS_QWS_ | 101 | #ifdef _WS_QWS_ |
102 | W->showMaximized(); | 102 | W->showMaximized(); |
103 | #else | 103 | #else |
104 | W->resize( W->sizeHint() ); | 104 | W->resize( W->sizeHint() ); |
105 | #endif | 105 | #endif |
106 | rv = TheApp->exec(); | 106 | rv = TheApp->exec(); |
107 | delete W; | 107 | delete W; |
108 | } | 108 | } |
109 | break; | 109 | break; |
110 | } | 110 | } |
111 | 111 | ||
112 | return rv; | 112 | return rv; |
113 | } | 113 | } |
114 | 114 | ||
115 | #endif | 115 | #endif |
116 | 116 | ||
117 | 117 | ||
118 | // main.cpp | 118 | // main.cpp |
119 | 119 | ||
diff --git a/noncore/settings/networksettings2/modem/modem_NN.h b/noncore/settings/networksettings2/modem/modem_NN.h index 0f4c124..5eceed2 100644 --- a/noncore/settings/networksettings2/modem/modem_NN.h +++ b/noncore/settings/networksettings2/modem/modem_NN.h | |||
@@ -1,44 +1,44 @@ | |||
1 | #ifndef MODEM_NETNODE_H | 1 | #ifndef MODEM_NETNODE_H |
2 | #define MODEM_NETNODE_H | 2 | #define MODEM_NETNODE_H |
3 | 3 | ||
4 | #include "netnode.h" | 4 | #include "netnode.h" |
5 | 5 | ||
6 | class AModem; | 6 | class AModem; |
7 | 7 | ||
8 | class ModemNetNode : public ANetNode{ | 8 | class ModemNetNode : public ANetNode{ |
9 | 9 | ||
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | 11 | ||
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 "modem"; } | 18 | { return "Devices/modem"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | 20 | virtual const QString nodeName() |
21 | { return tr("Dialup modem"); } | 21 | { return tr("Dialup modem"); } |
22 | 22 | ||
23 | virtual const QString nodeDescription() ; | 23 | virtual const QString nodeDescription() ; |
24 | 24 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 25 | virtual ANetNodeInstance * createInstance( void ); |
26 | 26 | ||
27 | virtual const char ** needs( void ); | 27 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 28 | virtual const char * provides( void ); |
29 | 29 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | virtual bool hasDataFor( const QString & S ); | 31 | virtual bool hasDataFor( const QString & S ); |
32 | virtual bool generateDataForCommonFile( | 32 | virtual bool generateDataForCommonFile( |
33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | 33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); |
34 | 34 | ||
35 | private: | 35 | private: |
36 | 36 | ||
37 | }; | 37 | }; |
38 | 38 | ||
39 | extern "C" | 39 | extern "C" |
40 | { | 40 | { |
41 | void create_plugin( QList<ANetNode> & PNN ); | 41 | void create_plugin( QList<ANetNode> & PNN ); |
42 | }; | 42 | }; |
43 | 43 | ||
44 | #endif | 44 | #endif |
diff --git a/noncore/settings/networksettings2/network/network_NN.h b/noncore/settings/networksettings2/network/network_NN.h index 3b0cd64..220e00f 100644 --- a/noncore/settings/networksettings2/network/network_NN.h +++ b/noncore/settings/networksettings2/network/network_NN.h | |||
@@ -1,44 +1,44 @@ | |||
1 | #ifndef NETWORK_NETNODE_H | 1 | #ifndef NETWORK_NETNODE_H |
2 | #define NETWORK_NETNODE_H | 2 | #define NETWORK_NETNODE_H |
3 | 3 | ||
4 | #include "netnode.h" | 4 | #include "netnode.h" |
5 | 5 | ||
6 | class ANetwork; | 6 | class ANetwork; |
7 | 7 | ||
8 | class NetworkNetNode : public ANetNode{ | 8 | class NetworkNetNode : public ANetNode{ |
9 | 9 | ||
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | 11 | ||
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 "tcpip"; } | 18 | { return "Devices/tcpip"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | 20 | virtual const QString nodeName() |
21 | { return tr("IP Configuration"); } | 21 | { return tr("IP Configuration"); } |
22 | 22 | ||
23 | virtual const QString nodeDescription() ; | 23 | virtual const QString nodeDescription() ; |
24 | 24 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 25 | virtual ANetNodeInstance * createInstance( void ); |
26 | 26 | ||
27 | virtual const char ** needs( void ); | 27 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 28 | virtual const char * provides( void ); |
29 | 29 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | virtual bool hasDataFor( const QString & S ); | 31 | virtual bool hasDataFor( const QString & S ); |
32 | virtual bool generateDataForCommonFile( | 32 | virtual bool generateDataForCommonFile( |
33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | 33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); |
34 | 34 | ||
35 | private: | 35 | private: |
36 | 36 | ||
37 | }; | 37 | }; |
38 | 38 | ||
39 | extern "C" | 39 | extern "C" |
40 | { | 40 | { |
41 | void create_plugin( QList<ANetNode> & PNN ); | 41 | void create_plugin( QList<ANetNode> & PNN ); |
42 | }; | 42 | }; |
43 | 43 | ||
44 | #endif | 44 | #endif |
diff --git a/noncore/settings/networksettings2/network/networkrun.cpp b/noncore/settings/networksettings2/network/networkrun.cpp index e732bfa..8deca14 100644 --- a/noncore/settings/networksettings2/network/networkrun.cpp +++ b/noncore/settings/networksettings2/network/networkrun.cpp | |||
@@ -1,61 +1,61 @@ | |||
1 | #include <system.h> | 1 | #include <system.h> |
2 | #include <asdevice.h> | 2 | #include <asdevice.h> |
3 | #include "networkrun.h" | 3 | #include "networkrun.h" |
4 | 4 | ||
5 | void NetworkRun::detectState( NodeCollection * NC ) { | 5 | void NetworkRun::detectState( NodeCollection * NC ) { |
6 | RuntimeInfo * RI = netNode()->nextNode()->runtime(); | 6 | RuntimeInfo * RI = netNode()->nextNode()->runtime(); |
7 | AsDevice * Next = RI->asDevice(); | 7 | AsDevice * Next = RI->asDevice(); |
8 | InterfaceInfo * II = Next->assignedInterface(); | 8 | InterfaceInfo * II = Next->assignedInterface(); |
9 | 9 | ||
10 | if( II ) { | 10 | if( II ) { |
11 | // device has assigned interface | 11 | // device has assigned interface |
12 | NC->setCurrentState( (( II->IsUp ) ? IsUp : Available) ); | 12 | NC->setCurrentState( (( II->IsUp ) ? IsUp : Available) ); |
13 | } | 13 | } |
14 | 14 | ||
15 | // has no interface -> delegate | 15 | // has no interface -> delegate |
16 | RI->detectState( NC ); | 16 | RI->detectState( NC ); |
17 | } | 17 | } |
18 | 18 | ||
19 | bool NetworkRun::setState( NodeCollection * NC, Action_t A ) { | 19 | bool NetworkRun::setState( NodeCollection * NC, Action_t A ) { |
20 | // we handle UP and DOWN | 20 | // we handle UP and DOWN |
21 | RuntimeInfo * RI = netNode()->nextNode()->runtime(); | 21 | RuntimeInfo * RI = netNode()->nextNode()->runtime(); |
22 | AsDevice * Next = RI->asDevice(); | 22 | AsDevice * Next = RI->asDevice(); |
23 | InterfaceInfo * II = Next->assignedInterface(); | 23 | InterfaceInfo * II = Next->assignedInterface(); |
24 | 24 | ||
25 | if( A == Up ) { | 25 | if( A == Up ) { |
26 | // we can bring UP if lower level is available | 26 | // we can bring UP if lower level is available |
27 | if( NC->currentState() == Available ) { | 27 | if( NC->currentState() == Available ) { |
28 | QString S; | 28 | QString S; |
29 | S.sprintf( "ifup %s=manual", II->Name.latin1() ); | 29 | S.sprintf( "ifup %s", II->Name.latin1() ); |
30 | NSResources->system().execute( S ); | 30 | NSResources->system().execute( S ); |
31 | NC->setCurrentState( IsUp ); | 31 | NC->setCurrentState( IsUp ); |
32 | } | 32 | } |
33 | return 1; | 33 | return 1; |
34 | } else if( A == Down ) { | 34 | } else if( A == Down ) { |
35 | if( NC->currentState() == IsUp ) { | 35 | if( NC->currentState() == IsUp ) { |
36 | QString S; | 36 | QString S; |
37 | S.sprintf( "ifdown %s", II->Name.latin1() ); | 37 | S.sprintf( "ifdown %s", II->Name.latin1() ); |
38 | NSResources->system().execute( S ); | 38 | NSResources->system().execute( S ); |
39 | NC->setCurrentState( Available ); | 39 | NC->setCurrentState( Available ); |
40 | } | 40 | } |
41 | return 1; | 41 | return 1; |
42 | } | 42 | } |
43 | // delegate | 43 | // delegate |
44 | return RI->setState( NC, A ); | 44 | return RI->setState( NC, A ); |
45 | } | 45 | } |
46 | 46 | ||
47 | bool NetworkRun::canSetState( State_t Curr, Action_t A ) { | 47 | bool NetworkRun::canSetState( State_t Curr, Action_t A ) { |
48 | // we handle UP and DOWN | 48 | // we handle UP and DOWN |
49 | RuntimeInfo * RI = netNode()->nextNode()->runtime(); | 49 | RuntimeInfo * RI = netNode()->nextNode()->runtime(); |
50 | 50 | ||
51 | if( A == Up ) { | 51 | if( A == Up ) { |
52 | return ( Curr == Available ); | 52 | return ( Curr == Available ); |
53 | } else if( A == Down ) { | 53 | } else if( A == Down ) { |
54 | return ( Curr == IsUp ); | 54 | return ( Curr == IsUp ); |
55 | } | 55 | } |
56 | // delegate | 56 | // delegate |
57 | return RI->canSetState( Curr, A ); | 57 | return RI->canSetState( Curr, A ); |
58 | } | 58 | } |
59 | 59 | ||
60 | bool NetworkRun::handlesInterface( const QString & S ) { | 60 | bool NetworkRun::handlesInterface( const QString & S ) { |
61 | // donno -> pass deeper | 61 | // donno -> pass deeper |
diff --git a/noncore/settings/networksettings2/networksettings.cpp b/noncore/settings/networksettings2/networksettings.cpp index f72fa8e..e1110e2 100644 --- a/noncore/settings/networksettings2/networksettings.cpp +++ b/noncore/settings/networksettings2/networksettings.cpp | |||
@@ -1,402 +1,399 @@ | |||
1 | #include <stdio.h> | 1 | #include <stdio.h> |
2 | 2 | ||
3 | #include <qpe/qpeapplication.h> | 3 | #include <qpe/qpeapplication.h> |
4 | #include <qiconset.h> | 4 | #include <qlistbox.h> |
5 | #include <qgroupbox.h> | 5 | #include <qgroupbox.h> |
6 | #include <qtimer.h> | 6 | #include <qtimer.h> |
7 | #include <qlistbox.h> | 7 | #include <qlistbox.h> |
8 | #include <qmessagebox.h> | 8 | #include <qmessagebox.h> |
9 | #include <qlabel.h> | 9 | #include <qlabel.h> |
10 | #include <qiconview.h> | 10 | #include <qiconview.h> |
11 | #include <qtimer.h> | 11 | #include <qtimer.h> |
12 | #include <qpe/qpeapplication.h> | 12 | #include <qpe/qpeapplication.h> |
13 | #include <qtoolbutton.h> | 13 | #include <qtoolbutton.h> |
14 | 14 | ||
15 | #include <asdevice.h> | 15 | #include <asdevice.h> |
16 | #include "networksettings.h" | 16 | #include "networksettings.h" |
17 | #include "netnode.h" | 17 | #include "netnode.h" |
18 | #include "editconnection.h" | 18 | #include "editconnection.h" |
19 | 19 | ||
20 | NetworkSettings::NetworkSettings( QWidget *parent, | 20 | NetworkSettings::NetworkSettings( QWidget *parent, |
21 | const char *name, | 21 | const char *name, |
22 | WFlags fl ) : NetworkSettingsGUI(parent,name,fl), | 22 | WFlags fl ) : NetworkSettingsGUI(parent,name,fl), |
23 | NSD() { | 23 | NSD() { |
24 | 24 | ||
25 | UpdateTimer = new QTimer( this ); | 25 | UpdateTimer = new QTimer( this ); |
26 | // set pixmaps | 26 | // set pixmaps |
27 | Add_TB->setPixmap( NSResources->getPixmap( "add" ) ); | 27 | Add_TB->setPixmap( NSResources->getPixmap( "add" ) ); |
28 | Delete_TB->setPixmap( NSResources->getPixmap( "remove" ) ); | 28 | Delete_TB->setPixmap( NSResources->getPixmap( "remove" ) ); |
29 | CheckState_TB->setPixmap( NSResources->getPixmap( "check" ) ); | 29 | CheckState_TB->setPixmap( NSResources->getPixmap( "check" ) ); |
30 | Enable_TB->setPixmap( NSResources->getPixmap( "disabled" ) ); | 30 | Enable_TB->setPixmap( NSResources->getPixmap( "disabled" ) ); |
31 | GenConfig_TB->setPixmap( NSResources->getPixmap( "configure" ) ); | 31 | GenConfig_TB->setPixmap( NSResources->getPixmap( "configure" ) ); |
32 | 32 | ||
33 | Connect_TB->setPixmap( NSResources->getPixmap( "connected" ) ); | 33 | Connect_TB->setPixmap( NSResources->getPixmap( "connected" ) ); |
34 | 34 | ||
35 | On_TB->setPixmap( NSResources->getPixmap( "off" ) ); | 35 | On_TB->setPixmap( NSResources->getPixmap( "off" ) ); |
36 | 36 | ||
37 | // populate main Listbox | 37 | // populate main Listbox |
38 | Profiles_IV->clear(); | 38 | Profiles_LB->clear(); |
39 | { Name2Connection_t & M = NSResources->connections(); | 39 | { Name2Connection_t & M = NSResources->connections(); |
40 | NodeCollection * NC; | 40 | NodeCollection * NC; |
41 | QIconViewItem * IVI; | ||
42 | |||
43 | // for all connections | 41 | // for all connections |
44 | for( QDictIterator<NodeCollection> it(M); | 42 | for( QDictIterator<NodeCollection> it(M); |
45 | it.current(); | 43 | it.current(); |
46 | ++it ) { | 44 | ++it ) { |
47 | NC = it.current(); | 45 | NC = it.current(); |
48 | IVI = new QIconViewItem( Profiles_IV, | 46 | Profiles_LB->insertItem( NC->devicePixmap(), |
49 | NC->name(), | 47 | NC->name() ); |
50 | NC->devicePixmap() ); | ||
51 | } | 48 | } |
52 | } | 49 | } |
53 | 50 | ||
54 | if( Profiles_IV->count() ) { | 51 | if( Profiles_LB->count() ) { |
55 | Profiles_IV->setSelected( Profiles_IV->firstItem(), TRUE ); | 52 | Profiles_LB->setSelected( 0, TRUE ); |
56 | } | 53 | } |
57 | 54 | ||
58 | // if no profiles -> auto popup editing | 55 | // if no profiles -> auto popup editing |
59 | if( NSResources->connections().count() == 0 ) { | 56 | if( NSResources->connections().count() == 0 ) { |
60 | QTimer::singleShot( 100, this, SLOT(SLOT_AddNode() ) ); | 57 | QTimer::singleShot( 100, this, SLOT(SLOT_AddNode() ) ); |
61 | } | 58 | } |
62 | 59 | ||
63 | UpdateTimer->start( 5000 ); | 60 | UpdateTimer->start( 5000 ); |
64 | connect( UpdateTimer, SIGNAL( timeout() ), | 61 | connect( UpdateTimer, SIGNAL( timeout() ), |
65 | this, SLOT( SLOT_RefreshStates() ) ); | 62 | this, SLOT( SLOT_RefreshStates() ) ); |
66 | 63 | ||
67 | /* Add QCopChannel */ | 64 | /* Add QCopChannel */ |
68 | connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), | 65 | connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), |
69 | this, SLOT(SLOT_QCopMessage(const QCString&,const QByteArray&)) ); | 66 | this, SLOT(SLOT_QCopMessage(const QCString&,const QByteArray&)) ); |
70 | } | 67 | } |
71 | 68 | ||
72 | NetworkSettings::~NetworkSettings() { | 69 | NetworkSettings::~NetworkSettings() { |
73 | QString S; | 70 | QString S; |
74 | 71 | ||
75 | S = NSD.generateSettings(); | 72 | S = NSD.generateSettings(); |
76 | if( ! S.isEmpty() ) { | 73 | if( ! S.isEmpty() ) { |
77 | QMessageBox::warning( | 74 | QMessageBox::warning( |
78 | 0, | 75 | 0, |
79 | tr( "Generating system configuration" ), | 76 | tr( "Generating system configuration" ), |
80 | S | 77 | S |
81 | ); | 78 | ); |
82 | } | 79 | } |
83 | 80 | ||
84 | S = NSD.saveSettings(); | 81 | S = NSD.saveSettings(); |
85 | if( ! S.isEmpty() ) { | 82 | if( ! S.isEmpty() ) { |
86 | // problem saving | 83 | // problem saving |
87 | QMessageBox::warning( | 84 | QMessageBox::warning( |
88 | 0, | 85 | 0, |
89 | tr( "Saving setup" ), S ); | 86 | tr( "Saving setup" ), S ); |
90 | } | 87 | } |
91 | } | 88 | } |
92 | 89 | ||
93 | void NetworkSettings::SLOT_RefreshStates( void ) { | 90 | void NetworkSettings::SLOT_RefreshStates( void ) { |
94 | QIconViewItem * IVI = Profiles_IV->currentItem(); // remeber | 91 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); // remember |
95 | 92 | ||
96 | if( IVI ) { | 93 | if( LBI ) { |
97 | NodeCollection * NC; | 94 | NodeCollection * NC; |
98 | NSResources->system().probeInterfaces(); | 95 | NSResources->system().probeInterfaces(); |
99 | // update current selection only | 96 | // update current selection only |
100 | NC = NSResources->findConnection( IVI->text() ); | 97 | NC = NSResources->findConnection( LBI->text() ); |
101 | if( NC ) { | 98 | if( NC ) { |
102 | State_t OldS = NC->state(); | 99 | State_t OldS = NC->state(); |
103 | State_t NewS = NC->state(1); | 100 | State_t NewS = NC->state(1); |
104 | if( OldS != NewS ) { | 101 | if( OldS != NewS ) { |
105 | updateProfileState( IVI ); | 102 | updateProfileState( LBI ); |
106 | } | 103 | } |
107 | } | 104 | } |
108 | } | 105 | } |
109 | 106 | ||
110 | 107 | ||
111 | /* -> LATER !! | 108 | /* -> LATER !! |
112 | bool is; | 109 | bool is; |
113 | NodeCollection * NC; | 110 | NodeCollection * NC; |
114 | 111 | ||
115 | for( unsigned int i = 0; i < Profiles_LB->count() ; i ++ ) { | 112 | for( unsigned int i = 0; i < Profiles_LB->count() ; i ++ ) { |
116 | NC = NSResources->findConnection( Profiles_LB->text(i) ); | 113 | NC = NSResources->findConnection( Profiles_LB->text(i) ); |
117 | if( NC ) { | 114 | if( NC ) { |
118 | State_t OldS = NC->state(); | 115 | State_t OldS = NC->state(); |
119 | State_t NewS = NC->state(1); | 116 | State_t NewS = NC->state(1); |
120 | if( OldS != NewS ) { | 117 | if( OldS != NewS ) { |
121 | is = Profiles_LB->isSelected(i); | 118 | is = Profiles_LB->isSelected(i); |
122 | Profiles_LB->changeItem( NC->statePixmap(NewS), | 119 | Profiles_LB->changeItem( NC->statePixmap(NewS), |
123 | NC->name(), | 120 | NC->name(), |
124 | i ); | 121 | i ); |
125 | if( is ) { | 122 | if( is ) { |
126 | Profiles_LB->setSelected( i, TRUE ); | 123 | Profiles_LB->setSelected( i, TRUE ); |
127 | } | 124 | } |
128 | } | 125 | } |
129 | } | 126 | } |
130 | } | 127 | } |
131 | if( ci >= 0 ) | 128 | if( ci >= 0 ) |
132 | Profiles_LB->setCurrentItem( ci ); | 129 | Profiles_LB->setCurrentItem( ci ); |
133 | */ | 130 | */ |
134 | } | 131 | } |
135 | 132 | ||
136 | void NetworkSettings::SLOT_AddNode( void ) { | 133 | void NetworkSettings::SLOT_AddNode( void ) { |
137 | SLOT_EditNode( 0 ); | 134 | SLOT_EditNode( 0 ); |
138 | } | 135 | } |
139 | 136 | ||
140 | void NetworkSettings::SLOT_DeleteNode( void ) { | 137 | void NetworkSettings::SLOT_DeleteNode( void ) { |
141 | QIconViewItem * IVI = Profiles_IV->currentItem(); | 138 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); |
142 | 139 | ||
143 | if ( ! IVI ) | 140 | if ( ! LBI ) |
144 | return; | 141 | return; |
145 | 142 | ||
146 | if( QMessageBox::warning( | 143 | if( QMessageBox::warning( |
147 | 0, | 144 | 0, |
148 | tr( "Removing profile" ), | 145 | tr( "Removing profile" ), |
149 | tr( "Remove selected profile ?" ), | 146 | tr( "Remove selected profile ?" ), |
150 | 1, 0 ) == 1 ) { | 147 | 1, 0 ) == 1 ) { |
151 | NSResources->removeConnection( IVI->text() ); | 148 | NSResources->removeConnection( LBI->text() ); |
152 | delete IVI; | 149 | delete LBI; |
153 | setModified( 1 ); | 150 | setModified( 1 ); |
154 | NSD.forceGeneration(1); | 151 | NSD.forceGeneration(1); |
155 | } | 152 | } |
156 | } | 153 | } |
157 | 154 | ||
158 | void NetworkSettings::SLOT_EditNode( QIconViewItem * IVI ) { | 155 | void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) { |
159 | QString OldName = ""; | 156 | QString OldName = ""; |
160 | EditConnection EC( this ); | 157 | EditConnection EC( this ); |
161 | 158 | ||
162 | if( IVI ) { | 159 | if( LBI ) { |
163 | NodeCollection * NC = NSResources->findConnection( IVI->text() ); | 160 | NodeCollection * NC = NSResources->findConnection( LBI->text() ); |
164 | if( ! NC ) { | 161 | if( ! NC ) { |
165 | return; | 162 | return; |
166 | } | 163 | } |
167 | OldName = NC->name(); | 164 | OldName = NC->name(); |
168 | EC.setConnection( NC ); | 165 | EC.setConnection( NC ); |
169 | } | 166 | } |
170 | 167 | ||
171 | EC.showMaximized(); | 168 | EC.showMaximized(); |
172 | // disable refresh timer | 169 | // disable refresh timer |
173 | UpdateTimer->stop(); | 170 | UpdateTimer->stop(); |
174 | if( EC.exec() == QDialog::Accepted ) { | 171 | if( EC.exec() == QDialog::Accepted ) { |
175 | // toplevel item -> store | 172 | // toplevel item -> store |
176 | NodeCollection * NC = EC.connection(); | 173 | NodeCollection * NC = EC.connection(); |
177 | if( NC->isModified() ) { | 174 | if( NC->isModified() ) { |
178 | setModified( 1 ); | 175 | setModified( 1 ); |
179 | if( IVI ) { | 176 | if( LBI ) { |
180 | // new name -> remove item | 177 | // new name -> remove item |
181 | NSResources->removeConnection( OldName ); | 178 | NSResources->removeConnection( OldName ); |
182 | // must add it here since change will trigger event | 179 | // must add it here since change will trigger event |
183 | NSResources->addConnection( NC ); | 180 | NSResources->addConnection( NC ); |
184 | IVI->setText( NC->name() ); | 181 | Profiles_LB->changeItem( NC->devicePixmap(), |
185 | IVI->setPixmap( NC->devicePixmap() ); | 182 | NC->name(), |
183 | Profiles_LB->index( LBI ) | ||
184 | ); | ||
186 | } else { | 185 | } else { |
187 | // new item | 186 | // new item |
187 | int ci = Profiles_LB->count(); | ||
188 | NSResources->addConnection( NC ); | 188 | NSResources->addConnection( NC ); |
189 | NC->setNumber( NC->maxConnectionNumber()+1 ); | 189 | NC->setNumber( NC->maxConnectionNumber()+1 ); |
190 | IVI = new QIconViewItem( Profiles_IV, | 190 | Profiles_LB->insertItem( NC->devicePixmap(), NC->name() ); |
191 | NC->name(), | 191 | Profiles_LB->setSelected( ci, TRUE ); |
192 | NC->devicePixmap() | ||
193 | ); | ||
194 | Profiles_IV->setSelected( IVI, TRUE ); | ||
195 | } | 192 | } |
196 | updateProfileState( IVI ); | 193 | updateProfileState( LBI ); |
197 | } | 194 | } |
198 | } else { | 195 | } else { |
199 | // cancelled : reset connection | 196 | // cancelled : reset connection |
200 | if( IVI ) { | 197 | if( LBI ) { |
201 | NodeCollection * NC = NSResources->findConnection( IVI->text() ); | 198 | NodeCollection * NC = NSResources->findConnection( LBI->text() ); |
202 | NC->reassign(); | 199 | NC->reassign(); |
203 | } | 200 | } |
204 | } | 201 | } |
205 | // reenable | 202 | // reenable |
206 | UpdateTimer->start( 5000 ); | 203 | UpdateTimer->start( 5000 ); |
207 | } | 204 | } |
208 | 205 | ||
209 | void NetworkSettings::SLOT_ShowNode( QIconViewItem * IVI ) { | 206 | void NetworkSettings::SLOT_ShowNode( QListBoxItem * LBI ) { |
210 | if( IVI == 0 ) | 207 | if( LBI == 0 ) |
211 | return; | 208 | return; |
212 | 209 | ||
213 | NodeCollection * NC = NSResources->findConnection( IVI->text() ); | 210 | NodeCollection * NC = NSResources->findConnection( LBI->text() ); |
214 | 211 | ||
215 | // is button possible | 212 | // is button possible |
216 | bool EnabledPossible, OnPossible, ConnectPossible; | 213 | bool EnabledPossible, OnPossible, ConnectPossible; |
217 | // is button On or Off | 214 | // is button On or Off |
218 | bool DisabledOn, OnOn, ConnectOn; | 215 | bool DisabledOn, OnOn, ConnectOn; |
219 | 216 | ||
220 | EnabledPossible = OnPossible = ConnectPossible = 1; | 217 | EnabledPossible = OnPossible = ConnectPossible = 1; |
221 | DisabledOn = 1; | 218 | DisabledOn = 1; |
222 | OnOn = ConnectOn = 0; | 219 | OnOn = ConnectOn = 0; |
223 | 220 | ||
224 | switch( NC->state() ) { | 221 | switch( NC->state() ) { |
225 | case Unknown : | 222 | case Unknown : |
226 | // cannot occur here | 223 | // cannot occur here |
227 | break; | 224 | break; |
228 | case Unchecked : | 225 | case Unchecked : |
229 | case Unavailable : | 226 | case Unavailable : |
230 | // cannot do anything but recheck | 227 | // cannot do anything but recheck |
231 | EnabledPossible = OnPossible = ConnectPossible = 0; | 228 | EnabledPossible = OnPossible = ConnectPossible = 0; |
232 | break; | 229 | break; |
233 | case Disabled : | 230 | case Disabled : |
234 | OnPossible = ConnectPossible = 0; | 231 | OnPossible = ConnectPossible = 0; |
235 | break; | 232 | break; |
236 | case Off : | 233 | case Off : |
237 | DisabledOn = 0; | 234 | DisabledOn = 0; |
238 | break; | 235 | break; |
239 | case Available : | 236 | case Available : |
240 | OnOn = 1; | 237 | OnOn = 1; |
241 | DisabledOn = 0; | 238 | DisabledOn = 0; |
242 | break; | 239 | break; |
243 | case IsUp : | 240 | case IsUp : |
244 | OnOn = ConnectOn = 1; | 241 | OnOn = ConnectOn = 1; |
245 | DisabledOn = 0; | 242 | DisabledOn = 0; |
246 | break; | 243 | break; |
247 | } | 244 | } |
248 | 245 | ||
249 | // set button state | 246 | // set button state |
250 | Enable_TB->setEnabled( EnabledPossible ); | 247 | Enable_TB->setEnabled( EnabledPossible ); |
251 | On_TB->setEnabled( OnPossible ); | 248 | On_TB->setEnabled( OnPossible ); |
252 | Connect_TB->setEnabled( ConnectPossible ); | 249 | Connect_TB->setEnabled( ConnectPossible ); |
253 | 250 | ||
254 | Enable_TB->setOn( DisabledOn ); | 251 | Enable_TB->setOn( DisabledOn ); |
255 | On_TB->setOn( OnOn ); | 252 | On_TB->setOn( OnOn ); |
256 | Connect_TB->setOn( ConnectOn ); | 253 | Connect_TB->setOn( ConnectOn ); |
257 | 254 | ||
258 | if( NC->description().isEmpty() ) { | 255 | if( NC->description().isEmpty() ) { |
259 | Description_LBL->setText( tr( "No description" ) ); | 256 | Description_LBL->setText( tr( "No description" ) ); |
260 | } else { | 257 | } else { |
261 | Description_LBL->setText( NC->description() ); | 258 | Description_LBL->setText( NC->description() ); |
262 | } | 259 | } |
263 | 260 | ||
264 | CurProfile_GB->setTitle( IVI->text() ); | 261 | CurProfile_GB->setTitle( LBI->text() ); |
265 | State_LBL->setText( NC->stateName() ); | 262 | State_LBL->setText( NC->stateName() ); |
266 | } | 263 | } |
267 | 264 | ||
268 | void NetworkSettings::SLOT_CheckState( void ) { | 265 | void NetworkSettings::SLOT_CheckState( void ) { |
269 | QIconViewItem * IVI = Profiles_IV->currentItem(); | 266 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); |
270 | if ( ! IVI ) | 267 | if ( ! LBI ) |
271 | return; | 268 | return; |
272 | updateProfileState( IVI ); | 269 | updateProfileState( LBI ); |
273 | } | 270 | } |
274 | 271 | ||
275 | void NetworkSettings::updateProfileState( QIconViewItem * IVI ) { | 272 | void NetworkSettings::updateProfileState( QListBoxItem * LBI ) { |
276 | if( IVI == Profiles_IV->currentItem() ) { | 273 | if( LBI == Profiles_LB->item( Profiles_LB->currentItem() ) ) { |
277 | SLOT_ShowNode( IVI ); | 274 | SLOT_ShowNode( LBI ); |
278 | } | 275 | } |
279 | } | 276 | } |
280 | 277 | ||
281 | void NetworkSettings::SLOT_GenerateConfig( void ) { | 278 | void NetworkSettings::SLOT_GenerateConfig( void ) { |
282 | QString S = NSD.generateSettings( TRUE ); | 279 | QString S = NSD.generateSettings( TRUE ); |
283 | 280 | ||
284 | if( ! S.isEmpty() ) { | 281 | if( ! S.isEmpty() ) { |
285 | QMessageBox::warning( | 282 | QMessageBox::warning( |
286 | 0, | 283 | 0, |
287 | tr( "Generating system configuration" ), | 284 | tr( "Generating system configuration" ), |
288 | S | 285 | S |
289 | ); | 286 | ); |
290 | } | 287 | } |
291 | } | 288 | } |
292 | 289 | ||
293 | void NetworkSettings::SLOT_Enable( void ) { | 290 | void NetworkSettings::SLOT_Enable( void ) { |
294 | QIconViewItem * IVI = Profiles_IV->currentItem(); | 291 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); |
295 | QString Msg; | 292 | QString Msg; |
296 | if ( ! IVI ) | 293 | if ( ! LBI ) |
297 | return; | 294 | return; |
298 | 295 | ||
299 | NodeCollection * NC = | 296 | NodeCollection * NC = |
300 | NSResources->findConnection( IVI->text() ); | 297 | NSResources->findConnection( LBI->text() ); |
301 | 298 | ||
302 | bool rv; | 299 | bool rv; |
303 | switch( NC->state() ) { | 300 | switch( NC->state() ) { |
304 | case Disabled : | 301 | case Disabled : |
305 | Msg = tr( "Cannot enable profile" ); | 302 | Msg = tr( "Cannot enable profile" ); |
306 | rv = NC->setState( Enable ); | 303 | rv = NC->setState( Enable ); |
307 | break; | 304 | break; |
308 | default : | 305 | default : |
309 | Msg = tr( "Cannot disable profile" ); | 306 | Msg = tr( "Cannot disable profile" ); |
310 | rv = NC->setState( Disable ); | 307 | rv = NC->setState( Disable ); |
311 | break; | 308 | break; |
312 | } | 309 | } |
313 | 310 | ||
314 | if( ! rv ) { | 311 | if( ! rv ) { |
315 | QMessageBox::warning( | 312 | QMessageBox::warning( |
316 | 0, | 313 | 0, |
317 | tr( "Activating profile" ), | 314 | tr( "Activating profile" ), |
318 | Msg ); | 315 | Msg ); |
319 | return; | 316 | return; |
320 | } | 317 | } |
321 | updateProfileState( IVI ); | 318 | updateProfileState( LBI ); |
322 | } | 319 | } |
323 | 320 | ||
324 | void NetworkSettings::SLOT_On( void ) { | 321 | void NetworkSettings::SLOT_On( void ) { |
325 | QIconViewItem * IVI = Profiles_IV->currentItem(); | 322 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); |
326 | 323 | ||
327 | if ( ! IVI ) | 324 | if ( ! LBI ) |
328 | return; | 325 | return; |
329 | 326 | ||
330 | NodeCollection * NC = | 327 | NodeCollection * NC = |
331 | NSResources->findConnection( IVI->text() ); | 328 | NSResources->findConnection( LBI->text() ); |
332 | 329 | ||
333 | bool rv; | 330 | bool rv; |
334 | switch( NC->state() ) { | 331 | switch( NC->state() ) { |
335 | case Off : | 332 | case Off : |
336 | // activate interface | 333 | // activate interface |
337 | rv = NC->setState( Activate ); | 334 | rv = NC->setState( Activate ); |
338 | break; | 335 | break; |
339 | case Available : | 336 | case Available : |
340 | // deactivate | 337 | // deactivate |
341 | rv = NC->setState( Deactivate ); | 338 | rv = NC->setState( Deactivate ); |
342 | break; | 339 | break; |
343 | case IsUp : | 340 | case IsUp : |
344 | // bring down and deactivate | 341 | // bring down and deactivate |
345 | rv = ( NC->setState( Down ) && | 342 | rv = ( NC->setState( Down ) && |
346 | NC->setState( Deactivate ) ); | 343 | NC->setState( Deactivate ) ); |
347 | break; | 344 | break; |
348 | default : | 345 | default : |
349 | // others no change | 346 | // others no change |
350 | return; | 347 | return; |
351 | } | 348 | } |
352 | 349 | ||
353 | if( ! rv ) { | 350 | if( ! rv ) { |
354 | QMessageBox::warning( | 351 | QMessageBox::warning( |
355 | 0, | 352 | 0, |
356 | tr( "Activating profile" ), | 353 | tr( "Activating profile" ), |
357 | tr( "Cannot enable profile" ) ); | 354 | tr( "Cannot enable profile" ) ); |
358 | return; | 355 | return; |
359 | } | 356 | } |
360 | updateProfileState( IVI ); | 357 | updateProfileState( LBI ); |
361 | } | 358 | } |
362 | 359 | ||
363 | void NetworkSettings::SLOT_Connect( void ) { | 360 | void NetworkSettings::SLOT_Connect( void ) { |
364 | QIconViewItem * IVI = Profiles_IV->currentItem(); | 361 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); |
365 | 362 | ||
366 | if ( ! IVI ) | 363 | if ( ! LBI ) |
367 | return; | 364 | return; |
368 | 365 | ||
369 | NodeCollection * NC = | 366 | NodeCollection * NC = |
370 | NSResources->findConnection( IVI->text() ); | 367 | NSResources->findConnection( LBI->text() ); |
371 | 368 | ||
372 | bool rv; | 369 | bool rv; |
373 | switch( NC->state() ) { | 370 | switch( NC->state() ) { |
374 | case IsUp : | 371 | case IsUp : |
375 | // down interface | 372 | // down interface |
376 | rv = NC->setState( Down ); | 373 | rv = NC->setState( Down ); |
377 | break; | 374 | break; |
378 | case Available : | 375 | case Available : |
379 | // up interface | 376 | // up interface |
380 | rv = NC->setState( Up ); | 377 | rv = NC->setState( Up ); |
381 | break; | 378 | break; |
382 | case Off : | 379 | case Off : |
383 | // activate and bring up | 380 | // activate and bring up |
384 | rv = ( NC->setState( Activate ) && | 381 | rv = ( NC->setState( Activate ) && |
385 | NC->setState( Up ) ); | 382 | NC->setState( Up ) ); |
386 | break; | 383 | break; |
387 | default : | 384 | default : |
388 | // others no change | 385 | // others no change |
389 | return; | 386 | return; |
390 | } | 387 | } |
391 | 388 | ||
392 | if( ! rv ) { | 389 | if( ! rv ) { |
393 | QMessageBox::warning( | 390 | QMessageBox::warning( |
394 | 0, | 391 | 0, |
395 | tr( "Activating profile" ), | 392 | tr( "Activating profile" ), |
396 | tr( "Cannot enable profile" ) ); | 393 | tr( "Cannot enable profile" ) ); |
397 | return; | 394 | return; |
398 | } | 395 | } |
399 | 396 | ||
400 | // we do not update the GUI but wait for the REAL upping of the device | 397 | // we do not update the GUI but wait for the REAL upping of the device |
401 | } | 398 | } |
402 | 399 | ||
diff --git a/noncore/settings/networksettings2/networksettings.h b/noncore/settings/networksettings2/networksettings.h index fadf81b..d9ea5d4 100644 --- a/noncore/settings/networksettings2/networksettings.h +++ b/noncore/settings/networksettings2/networksettings.h | |||
@@ -1,49 +1,49 @@ | |||
1 | #include "nsdata.h" | 1 | #include "nsdata.h" |
2 | #include "networksettingsGUI.h" | 2 | #include "networksettingsGUI.h" |
3 | #include "resources.h" | 3 | #include "resources.h" |
4 | 4 | ||
5 | class ANetNode; | 5 | class ANetNode; |
6 | class ANetNodeInstance; | 6 | class ANetNodeInstance; |
7 | class QTimer; | 7 | class QTimer; |
8 | class QIconViewItem; | 8 | class QListBoxItem; |
9 | 9 | ||
10 | class NetworkSettings : public NetworkSettingsGUI { | 10 | class NetworkSettings : public NetworkSettingsGUI { |
11 | 11 | ||
12 | Q_OBJECT | 12 | Q_OBJECT |
13 | 13 | ||
14 | public : | 14 | public : |
15 | 15 | ||
16 | NetworkSettings( QWidget *parent=0, | 16 | NetworkSettings( QWidget *parent=0, |
17 | const char *name=0, | 17 | const char *name=0, |
18 | WFlags fl = 0 ); | 18 | WFlags fl = 0 ); |
19 | ~NetworkSettings( void ); | 19 | ~NetworkSettings( void ); |
20 | 20 | ||
21 | static QString appName( void ) | 21 | static QString appName( void ) |
22 | { return QString::fromLatin1("networksettings"); } | 22 | { return QString::fromLatin1("networksettings"); } |
23 | 23 | ||
24 | bool isModified( void ) | 24 | bool isModified( void ) |
25 | { return NSD.isModified(); } | 25 | { return NSD.isModified(); } |
26 | void setModified( bool m ) | 26 | void setModified( bool m ) |
27 | { NSD.setModified( m ); } | 27 | { NSD.setModified( m ); } |
28 | 28 | ||
29 | public slots : | 29 | public slots : |
30 | 30 | ||
31 | void SLOT_AddNode( void ); | 31 | void SLOT_AddNode( void ); |
32 | void SLOT_DeleteNode( void ); | 32 | void SLOT_DeleteNode( void ); |
33 | void SLOT_ShowNode( QIconViewItem * ); | 33 | void SLOT_ShowNode( QListBoxItem * ); |
34 | void SLOT_EditNode( QIconViewItem * ); | 34 | void SLOT_EditNode( QListBoxItem * ); |
35 | void SLOT_CheckState( void ); | 35 | void SLOT_CheckState( void ); |
36 | void SLOT_Enable( void ); | 36 | void SLOT_Enable( void ); |
37 | void SLOT_On( void ); | 37 | void SLOT_On( void ); |
38 | void SLOT_Connect( void ); | 38 | void SLOT_Connect( void ); |
39 | void SLOT_GenerateConfig( void ); | 39 | void SLOT_GenerateConfig( void ); |
40 | void SLOT_RefreshStates( void ); | 40 | void SLOT_RefreshStates( void ); |
41 | void SLOT_QCopMessage( const QCString&,const QByteArray& ); | 41 | void SLOT_QCopMessage( const QCString&,const QByteArray& ); |
42 | 42 | ||
43 | private : | 43 | private : |
44 | 44 | ||
45 | void updateProfileState( QIconViewItem * it ); | 45 | void updateProfileState( QListBoxItem * it ); |
46 | QTimer * UpdateTimer; | 46 | QTimer * UpdateTimer; |
47 | NetworkSettingsData NSD; | 47 | NetworkSettingsData NSD; |
48 | 48 | ||
49 | }; | 49 | }; |
diff --git a/noncore/settings/networksettings2/networksettings2/netnode.cpp b/noncore/settings/networksettings2/networksettings2/netnode.cpp index d36a1e5..f040c99 100644 --- a/noncore/settings/networksettings2/networksettings2/netnode.cpp +++ b/noncore/settings/networksettings2/networksettings2/netnode.cpp | |||
@@ -203,66 +203,66 @@ ANetNodeInstance * NodeCollection::findNext( ANetNodeInstance * NNI ) { | |||
203 | 203 | ||
204 | for( QListIterator<ANetNodeInstance> it(*this); | 204 | for( QListIterator<ANetNodeInstance> it(*this); |
205 | it.current(); | 205 | it.current(); |
206 | ++it ) { | 206 | ++it ) { |
207 | NNNI = it.current(); | 207 | NNNI = it.current(); |
208 | if( NNNI == NNI ) { | 208 | if( NNNI == NNI ) { |
209 | ++it; | 209 | ++it; |
210 | return it.current(); | 210 | return it.current(); |
211 | } | 211 | } |
212 | } | 212 | } |
213 | return 0; // no more next | 213 | return 0; // no more next |
214 | } | 214 | } |
215 | 215 | ||
216 | int NodeCollection::compareItems( QCollection::Item I1, | 216 | int NodeCollection::compareItems( QCollection::Item I1, |
217 | QCollection::Item I2 ) { | 217 | QCollection::Item I2 ) { |
218 | ANetNodeInstance * NNI1, * NNI2; | 218 | ANetNodeInstance * NNI1, * NNI2; |
219 | NNI1 = (ANetNodeInstance *)I1; | 219 | NNI1 = (ANetNodeInstance *)I1; |
220 | NNI2 = (ANetNodeInstance *)I2; | 220 | NNI2 = (ANetNodeInstance *)I2; |
221 | return NNI1->nodeName().compare( NNI2->nodeName() ); | 221 | return NNI1->nodeName().compare( NNI2->nodeName() ); |
222 | } | 222 | } |
223 | 223 | ||
224 | static char * State2PixmapTbl[] = { | 224 | static char * State2PixmapTbl[] = { |
225 | "NULL", // Unchecked : no pixmap | 225 | "NULL", // Unchecked : no pixmap |
226 | "check", // Unknown | 226 | "check", // Unknown |
227 | "delete", // unavailable | 227 | "delete", // unavailable |
228 | "disabled", // disabled | 228 | "disabled", // disabled |
229 | "off", // off | 229 | "off", // off |
230 | "disconnected", // available | 230 | "disconnected", // available |
231 | "connected" // up | 231 | "connected" // up |
232 | }; | 232 | }; |
233 | 233 | ||
234 | QPixmap NodeCollection::devicePixmap( void ) { | 234 | QPixmap NodeCollection::devicePixmap( void ) { |
235 | return NSResources->getPixmap( | 235 | return NSResources->getPixmap( |
236 | device()->netNode()->pixmapName()+"-large" ); | 236 | device()->netNode()->pixmapName()+"-large" ); |
237 | } | 237 | } |
238 | 238 | ||
239 | QPixmap NodeCollection::statePixmap( State_t S) { | 239 | QPixmap NodeCollection::statePixmap( State_t S) { |
240 | return NSResources->getPixmap( State2PixmapTbl[S] ); | 240 | return NSResources->getPixmap( State2PixmapTbl[S] ); |
241 | } | 241 | } |
242 | 242 | ||
243 | QString NodeCollection::stateName( State_t S) { | 243 | QString NodeCollection::stateName( State_t S) { |
244 | switch( S ) { | 244 | switch( S ) { |
245 | case Unknown : | 245 | case Unknown : |
246 | return qApp->translate( "networksettings2", "Unknown"); | 246 | return qApp->translate( "networksettings2", "Unknown"); |
247 | case Unavailable : | 247 | case Unavailable : |
248 | return qApp->translate( "networksettings2", "Unavailable"); | 248 | return qApp->translate( "networksettings2", "Unavailable"); |
249 | case Disabled : | 249 | case Disabled : |
250 | return qApp->translate( "networksettings2", "Disabled"); | 250 | return qApp->translate( "networksettings2", "Disabled"); |
251 | case Off : | 251 | case Off : |
252 | return qApp->translate( "networksettings2", "Off"); | 252 | return qApp->translate( "networksettings2", "Off"); |
253 | case Available : | 253 | case Available : |
254 | return qApp->translate( "networksettings2", "Available"); | 254 | return qApp->translate( "networksettings2", "Available"); |
255 | case IsUp : | 255 | case IsUp : |
256 | return qApp->translate( "networksettings2", "IsUp"); | 256 | return qApp->translate( "networksettings2", "IsUp"); |
257 | case Unchecked : /* FT */ | 257 | case Unchecked : /* FT */ |
258 | default : | 258 | default : |
259 | break; | 259 | break; |
260 | } | 260 | } |
261 | return QString(""); | 261 | return QString(""); |
262 | } | 262 | } |
263 | 263 | ||
264 | void NodeCollection::reassign( void ) { | 264 | void NodeCollection::reassign( void ) { |
265 | for( QListIterator<ANetNodeInstance> it(*this); | 265 | for( QListIterator<ANetNodeInstance> it(*this); |
266 | it.current(); | 266 | it.current(); |
267 | ++it ) { | 267 | ++it ) { |
268 | it.current()->setConnection( this ); | 268 | it.current()->setConnection( this ); |
diff --git a/noncore/settings/networksettings2/networksettings2/resources.cpp b/noncore/settings/networksettings2/networksettings2/resources.cpp index 15e1b64..0301361 100644 --- a/noncore/settings/networksettings2/networksettings2/resources.cpp +++ b/noncore/settings/networksettings2/networksettings2/resources.cpp | |||
@@ -139,65 +139,68 @@ bool TheNSResources::loadNetNode( | |||
139 | 139 | ||
140 | GetNetNodeListFt_t getNetNodeList = (GetNetNodeListFt_t)res; | 140 | GetNetNodeListFt_t getNetNodeList = (GetNetNodeListFt_t)res; |
141 | 141 | ||
142 | // Try to get an object. | 142 | // Try to get an object. |
143 | QList<ANetNode> PNN; | 143 | QList<ANetNode> PNN; |
144 | 144 | ||
145 | getNetNodeList( PNN ); | 145 | getNetNodeList( PNN ); |
146 | if( PNN.isEmpty() ) { | 146 | if( PNN.isEmpty() ) { |
147 | delete lib; | 147 | delete lib; |
148 | return 0; | 148 | return 0; |
149 | } | 149 | } |
150 | 150 | ||
151 | ANetNode * NNP; | 151 | ANetNode * NNP; |
152 | for( QListIterator<ANetNode> it(PNN); | 152 | for( QListIterator<ANetNode> it(PNN); |
153 | it.current(); | 153 | it.current(); |
154 | ++it ) { | 154 | ++it ) { |
155 | NetNode_t * NN; | 155 | NetNode_t * NN; |
156 | 156 | ||
157 | NNP = it.current(); | 157 | NNP = it.current(); |
158 | NN = new NetNode_t; | 158 | NN = new NetNode_t; |
159 | NN->NetNode = NNP; | 159 | NN->NetNode = NNP; |
160 | NN->TheLibrary = lib; | 160 | NN->TheLibrary = lib; |
161 | NN->NodeCountInLib = PNN.count(); | 161 | NN->NodeCountInLib = PNN.count(); |
162 | 162 | ||
163 | // store mapping | 163 | // store mapping |
164 | AllNodeTypes.insert( NN->NetNode->nodeName(), NN ); | 164 | AllNodeTypes.insert( NN->NetNode->nodeName(), NN ); |
165 | } | 165 | } |
166 | 166 | ||
167 | return 1; | 167 | return 1; |
168 | } | 168 | } |
169 | 169 | ||
170 | QPixmap TheNSResources::getPixmap( const QString & QS ) { | 170 | QPixmap TheNSResources::getPixmap( const QString & QS ) { |
171 | return Resource::loadPixmap( QString("networksettings2")+QS ); | 171 | QString S("networksettings2/"); |
172 | S += QS; | ||
173 | printf( " pixmap %s\n", S.latin1() ); | ||
174 | return Resource::loadPixmap( QString("networksettings2/")+QS ); | ||
172 | } | 175 | } |
173 | 176 | ||
174 | QString TheNSResources::tr( const char * s ) { | 177 | QString TheNSResources::tr( const char * s ) { |
175 | return qApp->translate( "resource", s ); | 178 | return qApp->translate( "resource", s ); |
176 | } | 179 | } |
177 | 180 | ||
178 | const QString & TheNSResources::netNode2Name( const char * s ) { | 181 | const QString & TheNSResources::netNode2Name( const char * s ) { |
179 | return NodeTypeNameMap[s]; | 182 | return NodeTypeNameMap[s]; |
180 | } | 183 | } |
181 | 184 | ||
182 | const QString & TheNSResources::netNode2Description( const char * s ) { | 185 | const QString & TheNSResources::netNode2Description( const char * s ) { |
183 | return NodeTypeDescriptionMap[s]; | 186 | return NodeTypeDescriptionMap[s]; |
184 | } | 187 | } |
185 | 188 | ||
186 | void TheNSResources::addConnection( NodeCollection * NC ) { | 189 | void TheNSResources::addConnection( NodeCollection * NC ) { |
187 | ANetNodeInstance * NNI; | 190 | ANetNodeInstance * NNI; |
188 | ConnectionsMap.insert( NC->name(), NC ); | 191 | ConnectionsMap.insert( NC->name(), NC ); |
189 | // add (new) nodes to NodeList | 192 | // add (new) nodes to NodeList |
190 | for( QListIterator<ANetNodeInstance> it(*NC); | 193 | for( QListIterator<ANetNodeInstance> it(*NC); |
191 | it.current(); | 194 | it.current(); |
192 | ++it ) { | 195 | ++it ) { |
193 | NNI = it.current(); | 196 | NNI = it.current(); |
194 | if( findNodeInstance( NNI->nodeName() ) == 0 ) { | 197 | if( findNodeInstance( NNI->nodeName() ) == 0 ) { |
195 | // new item | 198 | // new item |
196 | addNodeInstance( NNI ); | 199 | addNodeInstance( NNI ); |
197 | } | 200 | } |
198 | } | 201 | } |
199 | } | 202 | } |
200 | 203 | ||
201 | void TheNSResources::removeConnection( const QString & N ) { | 204 | void TheNSResources::removeConnection( const QString & N ) { |
202 | NodeCollection * NC = findConnection( N ); | 205 | NodeCollection * NC = findConnection( N ); |
203 | if( ! NC ) | 206 | if( ! NC ) |
diff --git a/noncore/settings/networksettings2/networksettings2/system.cpp b/noncore/settings/networksettings2/networksettings2/system.cpp index 99f642e..85dcd7d 100644 --- a/noncore/settings/networksettings2/networksettings2/system.cpp +++ b/noncore/settings/networksettings2/networksettings2/system.cpp | |||
@@ -285,34 +285,35 @@ void System::probeInterfaces( void ) { | |||
285 | } | 285 | } |
286 | } else // else already probed before -> just update | 286 | } else // else already probed before -> just update |
287 | fprintf( stderr, "OLDNIC %s\n", NicName.latin1()); | 287 | fprintf( stderr, "OLDNIC %s\n", NicName.latin1()); |
288 | 288 | ||
289 | // get dynamic info | 289 | // get dynamic info |
290 | if( ioctl(sockfd, SIOCGIFFLAGS, &ifrs) >= 0 ) { | 290 | if( ioctl(sockfd, SIOCGIFFLAGS, &ifrs) >= 0 ) { |
291 | IFI->IsUp = ((ifrs.ifr_flags & IFF_UP) == IFF_UP); | 291 | IFI->IsUp = ((ifrs.ifr_flags & IFF_UP) == IFF_UP); |
292 | IFI->HasMulticast = ((ifrs.ifr_flags & IFF_MULTICAST) == IFF_MULTICAST); | 292 | IFI->HasMulticast = ((ifrs.ifr_flags & IFF_MULTICAST) == IFF_MULTICAST); |
293 | } else { | 293 | } else { |
294 | IFI->IsUp = 0; | 294 | IFI->IsUp = 0; |
295 | IFI->HasMulticast = 0; | 295 | IFI->HasMulticast = 0; |
296 | } | 296 | } |
297 | 297 | ||
298 | if( ioctl(sockfd, SIOCGIFADDR, &ifrs) >= 0 ) { | 298 | if( ioctl(sockfd, SIOCGIFADDR, &ifrs) >= 0 ) { |
299 | IFI->Address = | 299 | IFI->Address = |
300 | inet_ntoa(((struct sockaddr_in*)&ifrs.ifr_addr)->sin_addr); | 300 | inet_ntoa(((struct sockaddr_in*)&ifrs.ifr_addr)->sin_addr); |
301 | } else { | 301 | } else { |
302 | IFI->Address = ""; | 302 | IFI->Address = ""; |
303 | IFI->IsUp = 0; | 303 | IFI->IsUp = 0; |
304 | } | 304 | } |
305 | if( ioctl(sockfd, SIOCGIFBRDADDR, &ifrs) >= 0 ) { | 305 | if( ioctl(sockfd, SIOCGIFBRDADDR, &ifrs) >= 0 ) { |
306 | IFI->BCastAddress = | 306 | IFI->BCastAddress = |
307 | inet_ntoa(((struct sockaddr_in*)&ifrs.ifr_broadaddr)->sin_addr); | 307 | inet_ntoa(((struct sockaddr_in*)&ifrs.ifr_broadaddr)->sin_addr); |
308 | } else { | 308 | } else { |
309 | IFI->BCastAddress = ""; | 309 | IFI->BCastAddress = ""; |
310 | } | 310 | } |
311 | if( ioctl(sockfd, SIOCGIFNETMASK, &ifrs) >= 0 ) { | 311 | if( ioctl(sockfd, SIOCGIFNETMASK, &ifrs) >= 0 ) { |
312 | IFI->Netmask = | 312 | IFI->Netmask = |
313 | inet_ntoa(((struct sockaddr_in*)&ifrs.ifr_netmask)->sin_addr); | 313 | inet_ntoa(((struct sockaddr_in*)&ifrs.ifr_netmask)->sin_addr); |
314 | } else { | 314 | } else { |
315 | IFI->Netmask = ""; | 315 | IFI->Netmask = ""; |
316 | } | 316 | } |
317 | fprintf( stderr, "NIC %s UP %d\n", NicName.latin1(), IFI->IsUp ); | ||
317 | } | 318 | } |
318 | } | 319 | } |
diff --git a/noncore/settings/networksettings2/networksettingsGUI.ui b/noncore/settings/networksettings2/networksettingsGUI.ui index d457c35..1d79123 100644 --- a/noncore/settings/networksettings2/networksettingsGUI.ui +++ b/noncore/settings/networksettings2/networksettingsGUI.ui | |||
@@ -1,67 +1,67 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>NetworkSettingsGUI</class> | 2 | <class>NetworkSettingsGUI</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QWidget</class> | 4 | <class>QWidget</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>NetworkSettingsGUI</cstring> | 7 | <cstring>NetworkSettingsGUI</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>403</width> | 14 | <width>399</width> |
15 | <height>502</height> | 15 | <height>502</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>Network Settings</string> | 20 | <string>Network Settings</string> |
21 | </property> | 21 | </property> |
22 | <property> | 22 | <property> |
23 | <name>layoutMargin</name> | 23 | <name>layoutMargin</name> |
24 | </property> | 24 | </property> |
25 | <property> | 25 | <property> |
26 | <name>layoutSpacing</name> | 26 | <name>layoutSpacing</name> |
27 | </property> | 27 | </property> |
28 | <vbox> | 28 | <vbox> |
29 | <property stdset="1"> | 29 | <property stdset="1"> |
30 | <name>margin</name> | 30 | <name>margin</name> |
31 | <number>0</number> | 31 | <number>0</number> |
32 | </property> | 32 | </property> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>spacing</name> | 34 | <name>spacing</name> |
35 | <number>2</number> | 35 | <number>0</number> |
36 | </property> | 36 | </property> |
37 | <widget> | 37 | <widget> |
38 | <class>QFrame</class> | 38 | <class>QFrame</class> |
39 | <property stdset="1"> | 39 | <property stdset="1"> |
40 | <name>name</name> | 40 | <name>name</name> |
41 | <cstring>Frame4</cstring> | 41 | <cstring>Frame4</cstring> |
42 | </property> | 42 | </property> |
43 | <property stdset="1"> | 43 | <property stdset="1"> |
44 | <name>sizePolicy</name> | 44 | <name>sizePolicy</name> |
45 | <sizepolicy> | 45 | <sizepolicy> |
46 | <hsizetype>7</hsizetype> | 46 | <hsizetype>7</hsizetype> |
47 | <vsizetype>0</vsizetype> | 47 | <vsizetype>0</vsizetype> |
48 | </sizepolicy> | 48 | </sizepolicy> |
49 | </property> | 49 | </property> |
50 | <property stdset="1"> | 50 | <property stdset="1"> |
51 | <name>frameShape</name> | 51 | <name>frameShape</name> |
52 | <enum>NoFrame</enum> | 52 | <enum>NoFrame</enum> |
53 | </property> | 53 | </property> |
54 | <property stdset="1"> | 54 | <property stdset="1"> |
55 | <name>frameShadow</name> | 55 | <name>frameShadow</name> |
56 | <enum>Raised</enum> | 56 | <enum>Raised</enum> |
57 | </property> | 57 | </property> |
58 | <property> | 58 | <property> |
59 | <name>layoutMargin</name> | 59 | <name>layoutMargin</name> |
60 | </property> | 60 | </property> |
61 | <property> | 61 | <property> |
62 | <name>layoutSpacing</name> | 62 | <name>layoutSpacing</name> |
63 | </property> | 63 | </property> |
64 | <hbox> | 64 | <hbox> |
65 | <property stdset="1"> | 65 | <property stdset="1"> |
66 | <name>margin</name> | 66 | <name>margin</name> |
67 | <number>0</number> | 67 | <number>0</number> |
@@ -215,219 +215,84 @@ | |||
215 | <bool>true</bool> | 215 | <bool>true</bool> |
216 | </property> | 216 | </property> |
217 | </widget> | 217 | </widget> |
218 | <widget> | 218 | <widget> |
219 | <class>QToolButton</class> | 219 | <class>QToolButton</class> |
220 | <property stdset="1"> | 220 | <property stdset="1"> |
221 | <name>name</name> | 221 | <name>name</name> |
222 | <cstring>Connect_TB</cstring> | 222 | <cstring>Connect_TB</cstring> |
223 | </property> | 223 | </property> |
224 | <property stdset="1"> | 224 | <property stdset="1"> |
225 | <name>sizePolicy</name> | 225 | <name>sizePolicy</name> |
226 | <sizepolicy> | 226 | <sizepolicy> |
227 | <hsizetype>0</hsizetype> | 227 | <hsizetype>0</hsizetype> |
228 | <vsizetype>0</vsizetype> | 228 | <vsizetype>0</vsizetype> |
229 | </sizepolicy> | 229 | </sizepolicy> |
230 | </property> | 230 | </property> |
231 | <property stdset="1"> | 231 | <property stdset="1"> |
232 | <name>text</name> | 232 | <name>text</name> |
233 | <string>...</string> | 233 | <string>...</string> |
234 | </property> | 234 | </property> |
235 | <property stdset="1"> | 235 | <property stdset="1"> |
236 | <name>toggleButton</name> | 236 | <name>toggleButton</name> |
237 | <bool>true</bool> | 237 | <bool>true</bool> |
238 | </property> | 238 | </property> |
239 | <property stdset="1"> | 239 | <property stdset="1"> |
240 | <name>toggleButton</name> | 240 | <name>toggleButton</name> |
241 | <bool>true</bool> | 241 | <bool>true</bool> |
242 | </property> | 242 | </property> |
243 | </widget> | 243 | </widget> |
244 | </hbox> | 244 | </hbox> |
245 | </widget> | 245 | </widget> |
246 | <widget> | 246 | <widget> |
247 | <class>QIconView</class> | 247 | <class>QListBox</class> |
248 | <item> | ||
249 | <property> | ||
250 | <name>text</name> | ||
251 | <string>New Item</string> | ||
252 | </property> | ||
253 | <property> | ||
254 | <name>pixmap</name> | ||
255 | <pixmap>image0</pixmap> | ||
256 | </property> | ||
257 | </item> | ||
258 | <item> | ||
259 | <property> | ||
260 | <name>text</name> | ||
261 | <string>New Item</string> | ||
262 | </property> | ||
263 | <property> | ||
264 | <name>pixmap</name> | ||
265 | <pixmap>image0</pixmap> | ||
266 | </property> | ||
267 | </item> | ||
268 | <item> | ||
269 | <property> | ||
270 | <name>text</name> | ||
271 | <string>New Item</string> | ||
272 | </property> | ||
273 | <property> | ||
274 | <name>pixmap</name> | ||
275 | <pixmap>image0</pixmap> | ||
276 | </property> | ||
277 | </item> | ||
278 | <item> | ||
279 | <property> | ||
280 | <name>text</name> | ||
281 | <string>New Item</string> | ||
282 | </property> | ||
283 | <property> | ||
284 | <name>pixmap</name> | ||
285 | <pixmap>image0</pixmap> | ||
286 | </property> | ||
287 | </item> | ||
288 | <item> | ||
289 | <property> | ||
290 | <name>text</name> | ||
291 | <string>New Item</string> | ||
292 | </property> | ||
293 | <property> | ||
294 | <name>pixmap</name> | ||
295 | <pixmap>image0</pixmap> | ||
296 | </property> | ||
297 | </item> | ||
298 | <item> | ||
299 | <property> | ||
300 | <name>text</name> | ||
301 | <string>New Item</string> | ||
302 | </property> | ||
303 | <property> | ||
304 | <name>pixmap</name> | ||
305 | <pixmap>image0</pixmap> | ||
306 | </property> | ||
307 | </item> | ||
308 | <item> | ||
309 | <property> | ||
310 | <name>text</name> | ||
311 | <string>New Item</string> | ||
312 | </property> | ||
313 | <property> | ||
314 | <name>pixmap</name> | ||
315 | <pixmap>image0</pixmap> | ||
316 | </property> | ||
317 | </item> | ||
318 | <item> | ||
319 | <property> | ||
320 | <name>text</name> | ||
321 | <string>New Item</string> | ||
322 | </property> | ||
323 | <property> | ||
324 | <name>pixmap</name> | ||
325 | <pixmap>image0</pixmap> | ||
326 | </property> | ||
327 | </item> | ||
328 | <item> | ||
329 | <property> | ||
330 | <name>text</name> | ||
331 | <string>New Item</string> | ||
332 | </property> | ||
333 | <property> | ||
334 | <name>pixmap</name> | ||
335 | <pixmap>image0</pixmap> | ||
336 | </property> | ||
337 | </item> | ||
338 | <item> | ||
339 | <property> | ||
340 | <name>text</name> | ||
341 | <string>New Item</string> | ||
342 | </property> | ||
343 | <property> | ||
344 | <name>pixmap</name> | ||
345 | <pixmap>image0</pixmap> | ||
346 | </property> | ||
347 | </item> | ||
348 | <item> | ||
349 | <property> | ||
350 | <name>text</name> | ||
351 | <string>New Item</string> | ||
352 | </property> | ||
353 | <property> | ||
354 | <name>pixmap</name> | ||
355 | <pixmap>image0</pixmap> | ||
356 | </property> | ||
357 | </item> | ||
358 | <item> | ||
359 | <property> | ||
360 | <name>text</name> | ||
361 | <string>New Item</string> | ||
362 | </property> | ||
363 | <property> | ||
364 | <name>pixmap</name> | ||
365 | <pixmap>image0</pixmap> | ||
366 | </property> | ||
367 | </item> | ||
368 | <item> | ||
369 | <property> | ||
370 | <name>text</name> | ||
371 | <string>New Item</string> | ||
372 | </property> | ||
373 | <property> | ||
374 | <name>pixmap</name> | ||
375 | <pixmap>image0</pixmap> | ||
376 | </property> | ||
377 | </item> | ||
378 | <property stdset="1"> | 248 | <property stdset="1"> |
379 | <name>name</name> | 249 | <name>name</name> |
380 | <cstring>Profiles_IV</cstring> | 250 | <cstring>Profiles_LB</cstring> |
381 | </property> | ||
382 | <property stdset="1"> | ||
383 | <name>spacing</name> | ||
384 | <number>5</number> | ||
385 | </property> | ||
386 | <property stdset="1"> | ||
387 | <name>itemsMovable</name> | ||
388 | <bool>false</bool> | ||
389 | </property> | ||
390 | <property stdset="1"> | ||
391 | <name>showToolTips</name> | ||
392 | <bool>false</bool> | ||
393 | </property> | 251 | </property> |
394 | </widget> | 252 | </widget> |
395 | <widget> | 253 | <widget> |
396 | <class>QGroupBox</class> | 254 | <class>QGroupBox</class> |
397 | <property stdset="1"> | 255 | <property stdset="1"> |
398 | <name>name</name> | 256 | <name>name</name> |
399 | <cstring>CurProfile_GB</cstring> | 257 | <cstring>CurProfile_GB</cstring> |
400 | </property> | 258 | </property> |
401 | <property stdset="1"> | 259 | <property stdset="1"> |
260 | <name>sizePolicy</name> | ||
261 | <sizepolicy> | ||
262 | <hsizetype>5</hsizetype> | ||
263 | <vsizetype>1</vsizetype> | ||
264 | </sizepolicy> | ||
265 | </property> | ||
266 | <property stdset="1"> | ||
402 | <name>title</name> | 267 | <name>title</name> |
403 | <string></string> | 268 | <string></string> |
404 | </property> | 269 | </property> |
405 | <property> | 270 | <property> |
406 | <name>layoutMargin</name> | 271 | <name>layoutMargin</name> |
407 | </property> | 272 | </property> |
408 | <property> | 273 | <property> |
409 | <name>layoutSpacing</name> | 274 | <name>layoutSpacing</name> |
410 | </property> | 275 | </property> |
411 | <vbox> | 276 | <vbox> |
412 | <property stdset="1"> | 277 | <property stdset="1"> |
413 | <name>margin</name> | 278 | <name>margin</name> |
414 | <number>4</number> | 279 | <number>4</number> |
415 | </property> | 280 | </property> |
416 | <property stdset="1"> | 281 | <property stdset="1"> |
417 | <name>spacing</name> | 282 | <name>spacing</name> |
418 | <number>1</number> | 283 | <number>1</number> |
419 | </property> | 284 | </property> |
420 | <widget> | 285 | <widget> |
421 | <class>QLayoutWidget</class> | 286 | <class>QLayoutWidget</class> |
422 | <property stdset="1"> | 287 | <property stdset="1"> |
423 | <name>name</name> | 288 | <name>name</name> |
424 | <cstring>Layout3</cstring> | 289 | <cstring>Layout3</cstring> |
425 | </property> | 290 | </property> |
426 | <hbox> | 291 | <hbox> |
427 | <property stdset="1"> | 292 | <property stdset="1"> |
428 | <name>margin</name> | 293 | <name>margin</name> |
429 | <number>0</number> | 294 | <number>0</number> |
430 | </property> | 295 | </property> |
431 | <property stdset="1"> | 296 | <property stdset="1"> |
432 | <name>spacing</name> | 297 | <name>spacing</name> |
433 | <number>6</number> | 298 | <number>6</number> |
@@ -489,110 +354,104 @@ | |||
489 | </property> | 354 | </property> |
490 | <property stdset="1"> | 355 | <property stdset="1"> |
491 | <name>sizePolicy</name> | 356 | <name>sizePolicy</name> |
492 | <sizepolicy> | 357 | <sizepolicy> |
493 | <hsizetype>5</hsizetype> | 358 | <hsizetype>5</hsizetype> |
494 | <vsizetype>7</vsizetype> | 359 | <vsizetype>7</vsizetype> |
495 | </sizepolicy> | 360 | </sizepolicy> |
496 | </property> | 361 | </property> |
497 | <property stdset="1"> | 362 | <property stdset="1"> |
498 | <name>frameShape</name> | 363 | <name>frameShape</name> |
499 | <enum>NoFrame</enum> | 364 | <enum>NoFrame</enum> |
500 | </property> | 365 | </property> |
501 | <property stdset="1"> | 366 | <property stdset="1"> |
502 | <name>frameShadow</name> | 367 | <name>frameShadow</name> |
503 | <enum>Raised</enum> | 368 | <enum>Raised</enum> |
504 | </property> | 369 | </property> |
505 | <property stdset="1"> | 370 | <property stdset="1"> |
506 | <name>text</name> | 371 | <name>text</name> |
507 | <string></string> | 372 | <string></string> |
508 | </property> | 373 | </property> |
509 | <property stdset="1"> | 374 | <property stdset="1"> |
510 | <name>alignment</name> | 375 | <name>alignment</name> |
511 | <set>AlignTop|AlignLeft</set> | 376 | <set>AlignTop|AlignLeft</set> |
512 | </property> | 377 | </property> |
513 | <property> | 378 | <property> |
514 | <name>vAlign</name> | 379 | <name>vAlign</name> |
515 | </property> | 380 | </property> |
516 | </widget> | 381 | </widget> |
517 | </vbox> | 382 | </vbox> |
518 | </widget> | 383 | </widget> |
519 | </vbox> | 384 | </vbox> |
520 | </widget> | 385 | </widget> |
521 | <images> | ||
522 | <image> | ||
523 | <name>image0</name> | ||
524 | <data format="XPM.GZ" length="1347">789c7dd3c14ac4301405d07dbf22f4ed8a743ace0882f8098a4b415ca4c92475310a3a2e44fc777393a64df2dabed7452e1c6eb368778d787e7a10cdaefabac8cb9b126a909fa2d1dfe7f3cfcbebfd6f551fae857bf69dd8d75755dd0a251e3fde4f38933b53e707b10f518df18478e8b08803e271c21af1e6168b681165e7f688681055874594211a13a242347efc95da9688dad58946ca75e58d6be9e5ba0a46e92d351a952aa2d3b2495459989849f949546632b5688c32c65aeadde428ed0132da23306e4c5863f1ba017042738f6fc138a5fdbd0a135b2203ec7bca7b723022e23d19628601cb0d6f59e8612dce0c2b2641658fb5650b375a0795a2c2b8afcaaba4859ba852c4cda4364da9964daed64caa60c2475d9a590503c54d54d1d0a2096abb67541bf79955fc0debbfbbea1f81b84f0e</data> | ||
525 | </image> | ||
526 | </images> | ||
527 | <connections> | 386 | <connections> |
528 | <connection> | 387 | <connection> |
529 | <sender>Add_TB</sender> | 388 | <sender>Add_TB</sender> |
530 | <signal>clicked()</signal> | 389 | <signal>clicked()</signal> |
531 | <receiver>NetworkSettingsGUI</receiver> | 390 | <receiver>NetworkSettingsGUI</receiver> |
532 | <slot>SLOT_AddNode()</slot> | 391 | <slot>SLOT_AddNode()</slot> |
533 | </connection> | 392 | </connection> |
534 | <connection> | 393 | <connection> |
535 | <sender>Delete_TB</sender> | 394 | <sender>Delete_TB</sender> |
536 | <signal>clicked()</signal> | 395 | <signal>clicked()</signal> |
537 | <receiver>NetworkSettingsGUI</receiver> | 396 | <receiver>NetworkSettingsGUI</receiver> |
538 | <slot>SLOT_DeleteNode()</slot> | 397 | <slot>SLOT_DeleteNode()</slot> |
539 | </connection> | 398 | </connection> |
540 | <connection> | 399 | <connection> |
541 | <sender>CheckState_TB</sender> | 400 | <sender>CheckState_TB</sender> |
542 | <signal>clicked()</signal> | 401 | <signal>clicked()</signal> |
543 | <receiver>NetworkSettingsGUI</receiver> | 402 | <receiver>NetworkSettingsGUI</receiver> |
544 | <slot>SLOT_CheckState()</slot> | 403 | <slot>SLOT_CheckState()</slot> |
545 | </connection> | 404 | </connection> |
546 | <connection> | 405 | <connection> |
547 | <sender>Enable_TB</sender> | 406 | <sender>Enable_TB</sender> |
548 | <signal>clicked()</signal> | 407 | <signal>clicked()</signal> |
549 | <receiver>NetworkSettingsGUI</receiver> | 408 | <receiver>NetworkSettingsGUI</receiver> |
550 | <slot>SLOT_Enable()</slot> | 409 | <slot>SLOT_Enable()</slot> |
551 | </connection> | 410 | </connection> |
552 | <connection> | 411 | <connection> |
553 | <sender>Connect_TB</sender> | 412 | <sender>Connect_TB</sender> |
554 | <signal>clicked()</signal> | 413 | <signal>clicked()</signal> |
555 | <receiver>NetworkSettingsGUI</receiver> | 414 | <receiver>NetworkSettingsGUI</receiver> |
556 | <slot>SLOT_Connect()</slot> | 415 | <slot>SLOT_Connect()</slot> |
557 | </connection> | 416 | </connection> |
558 | <connection> | 417 | <connection> |
559 | <sender>On_TB</sender> | 418 | <sender>On_TB</sender> |
560 | <signal>clicked()</signal> | 419 | <signal>clicked()</signal> |
561 | <receiver>NetworkSettingsGUI</receiver> | 420 | <receiver>NetworkSettingsGUI</receiver> |
562 | <slot>SLOT_On()</slot> | 421 | <slot>SLOT_On()</slot> |
563 | </connection> | 422 | </connection> |
564 | <connection> | 423 | <connection> |
565 | <sender>GenConfig_TB</sender> | 424 | <sender>GenConfig_TB</sender> |
566 | <signal>clicked()</signal> | 425 | <signal>clicked()</signal> |
567 | <receiver>NetworkSettingsGUI</receiver> | 426 | <receiver>NetworkSettingsGUI</receiver> |
568 | <slot>SLOT_GenerateConfig()</slot> | 427 | <slot>SLOT_GenerateConfig()</slot> |
569 | </connection> | 428 | </connection> |
570 | <connection> | 429 | <connection> |
571 | <sender>Profiles_IV</sender> | 430 | <sender>Profiles_LB</sender> |
572 | <signal>selectionChanged(QIconViewItem*)</signal> | 431 | <signal>clicked(QListBoxItem*)</signal> |
573 | <receiver>NetworkSettingsGUI</receiver> | 432 | <receiver>NetworkSettingsGUI</receiver> |
574 | <slot>SLOT_ShowNode( QIconViewItem*)</slot> | 433 | <slot>SLOT_ShowNode( QListBoxItem*)</slot> |
575 | </connection> | 434 | </connection> |
576 | <connection> | 435 | <connection> |
577 | <sender>Profiles_IV</sender> | 436 | <sender>Profiles_LB</sender> |
578 | <signal>doubleClicked(QIconViewItem*)</signal> | 437 | <signal>currentChanged(QListBoxItem*)</signal> |
579 | <receiver>NetworkSettingsGUI</receiver> | 438 | <receiver>NetworkSettingsGUI</receiver> |
580 | <slot>SLOT_EditNode( QIconViewItem*)</slot> | 439 | <slot>SLOT_ShowNode( QListBoxItem*)</slot> |
581 | </connection> | 440 | </connection> |
582 | <connection> | 441 | <connection> |
583 | <sender>Profiles_IV</sender> | 442 | <sender>Profiles_LB</sender> |
584 | <signal>currentChanged(QIconViewItem*)</signal> | 443 | <signal>doubleClicked(QListBoxItem*)</signal> |
585 | <receiver>NetworkSettingsGUI</receiver> | 444 | <receiver>NetworkSettingsGUI</receiver> |
586 | <slot>SLOT_ShowNode( QIconViewItem*)</slot> | 445 | <slot>SLOT_EditNode( QListBoxItem *)</slot> |
587 | </connection> | 446 | </connection> |
588 | <slot access="public">SLOT_AddNode()</slot> | 447 | <slot access="public">SLOT_AddNode()</slot> |
589 | <slot access="public">SLOT_CheckState()</slot> | 448 | <slot access="public">SLOT_CheckState()</slot> |
590 | <slot access="public">SLOT_Connect()</slot> | 449 | <slot access="public">SLOT_Connect()</slot> |
591 | <slot access="public">SLOT_DeleteNode()</slot> | 450 | <slot access="public">SLOT_DeleteNode()</slot> |
592 | <slot access="public">SLOT_EditNode( QIconViewItem*)</slot> | 451 | <slot access="public">SLOT_EditNode( QListBoxItem *)</slot> |
593 | <slot access="public">SLOT_Enable()</slot> | 452 | <slot access="public">SLOT_Enable()</slot> |
594 | <slot access="public">SLOT_GenerateConfig()</slot> | 453 | <slot access="public">SLOT_GenerateConfig()</slot> |
595 | <slot access="public">SLOT_On()</slot> | 454 | <slot access="public">SLOT_On()</slot> |
596 | <slot access="public">SLOT_ShowNode( QIconViewItem*)</slot> | 455 | <slot access="public">SLOT_ShowNode( QListBoxItem*)</slot> |
597 | </connections> | 456 | </connections> |
598 | </UI> | 457 | </UI> |
diff --git a/noncore/settings/networksettings2/nsdata.cpp b/noncore/settings/networksettings2/nsdata.cpp index 9b2ad3a..3f5e958 100644 --- a/noncore/settings/networksettings2/nsdata.cpp +++ b/noncore/settings/networksettings2/nsdata.cpp | |||
@@ -1,53 +1,54 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | #include <qpe/qpeapplication.h> | 2 | #include <qpe/qpeapplication.h> |
3 | #include <qtextstream.h> | 3 | #include <qtextstream.h> |
4 | #include <qdir.h> | 4 | #include <qdir.h> |
5 | #include <qfile.h> | 5 | #include <qfile.h> |
6 | #include <qfileinfo.h> | 6 | #include <qfileinfo.h> |
7 | 7 | ||
8 | #include "nsdata.h" | 8 | #include "nsdata.h" |
9 | #include <asdevice.h> | 9 | #include <asdevice.h> |
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", getenv("HOME") ); | 18 | CfgFile.sprintf( "%s/NETCONFIG", getenv("HOME") ); |
19 | 19 | ||
20 | // load settings | 20 | // load settings |
21 | Force = 0; | 21 | Force = 0; |
22 | IsModified = 0; | ||
22 | loadSettings(); | 23 | loadSettings(); |
23 | } | 24 | } |
24 | 25 | ||
25 | // saving is done by caller | 26 | // saving is done by caller |
26 | NetworkSettingsData::~NetworkSettingsData( void ) { | 27 | NetworkSettingsData::~NetworkSettingsData( void ) { |
27 | delete NSResources; | 28 | delete NSResources; |
28 | } | 29 | } |
29 | 30 | ||
30 | void NetworkSettingsData::loadSettings( void ) { | 31 | void NetworkSettingsData::loadSettings( void ) { |
31 | QString S; | 32 | QString S; |
32 | ANetNodeInstance* NNI; | 33 | ANetNodeInstance* NNI; |
33 | QString Attr, Value; | 34 | QString Attr, Value; |
34 | long idx; | 35 | long idx; |
35 | 36 | ||
36 | QFile F( CfgFile ); | 37 | QFile F( CfgFile ); |
37 | QTextStream TS( &F ); | 38 | QTextStream TS( &F ); |
38 | 39 | ||
39 | do { | 40 | do { |
40 | 41 | ||
41 | if( ! F.open(IO_ReadOnly) ) | 42 | if( ! F.open(IO_ReadOnly) ) |
42 | break; | 43 | break; |
43 | 44 | ||
44 | /* load the file -> | 45 | /* load the file -> |
45 | 46 | ||
46 | FORMAT : | 47 | FORMAT : |
47 | 48 | ||
48 | [NETNODETYPE] | 49 | [NETNODETYPE] |
49 | Entries ... | 50 | Entries ... |
50 | <EMPTYLINE> | 51 | <EMPTYLINE> |
51 | [connection] | 52 | [connection] |
52 | Name=Name | 53 | Name=Name |
53 | Node=Name | 54 | Node=Name |
diff --git a/noncore/settings/networksettings2/ppp/ppp_NN.h b/noncore/settings/networksettings2/ppp/ppp_NN.h index a933523..3f9a338 100644 --- a/noncore/settings/networksettings2/ppp/ppp_NN.h +++ b/noncore/settings/networksettings2/ppp/ppp_NN.h | |||
@@ -1,44 +1,44 @@ | |||
1 | #ifndef PPP_NETNODE_H | 1 | #ifndef PPP_NETNODE_H |
2 | #define PPP_NETNODE_H | 2 | #define PPP_NETNODE_H |
3 | 3 | ||
4 | #include "netnode.h" | 4 | #include "netnode.h" |
5 | 5 | ||
6 | class APPP; | 6 | class APPP; |
7 | 7 | ||
8 | class PPPNetNode : public ANetNode{ | 8 | class PPPNetNode : public ANetNode{ |
9 | 9 | ||
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | 11 | ||
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 "ppp"; } | 18 | { return "Devices/ppp"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | 20 | virtual const QString nodeName() |
21 | { return tr("PPP Connection"); } | 21 | { return tr("PPP Connection"); } |
22 | 22 | ||
23 | virtual const QString nodeDescription() ; | 23 | virtual const QString nodeDescription() ; |
24 | 24 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 25 | virtual ANetNodeInstance * createInstance( void ); |
26 | 26 | ||
27 | virtual const char ** needs( void ); | 27 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 28 | virtual const char * provides( void ); |
29 | 29 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | virtual bool hasDataFor( const QString & S ); | 31 | virtual bool hasDataFor( const QString & S ); |
32 | virtual bool generateDataForCommonFile( | 32 | virtual bool generateDataForCommonFile( |
33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | 33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); |
34 | 34 | ||
35 | private: | 35 | private: |
36 | 36 | ||
37 | }; | 37 | }; |
38 | 38 | ||
39 | extern "C" | 39 | extern "C" |
40 | { | 40 | { |
41 | void create_plugin( QList<ANetNode> & PNN ); | 41 | void create_plugin( QList<ANetNode> & PNN ); |
42 | }; | 42 | }; |
43 | 43 | ||
44 | #endif | 44 | #endif |
diff --git a/noncore/settings/networksettings2/ppp/ppp_NNI.h b/noncore/settings/networksettings2/ppp/ppp_NNI.h index 08dca1d..a17721a 100644 --- a/noncore/settings/networksettings2/ppp/ppp_NNI.h +++ b/noncore/settings/networksettings2/ppp/ppp_NNI.h | |||
@@ -1,43 +1,43 @@ | |||
1 | #ifndef PPP_H | 1 | #ifndef PPP_H |
2 | #define PPP_H | 2 | #define PPP_H |
3 | 3 | ||
4 | #include <netnode.h> | 4 | #include <netnode.h> |
5 | #include "pppdata.h" | 5 | #include "pppdata.h" |
6 | #include "ppprun.h" | 6 | #include "ppprun.h" |
7 | 7 | ||
8 | class PPPNetNode; | 8 | class PPPNetNode; |
9 | class PPPEdit; | 9 | class PPPEdit; |
10 | 10 | ||
11 | class APPP : public ANetNodeInstance { | 11 | class APPP : public ANetNodeInstance { |
12 | 12 | ||
13 | public : | 13 | public : |
14 | 14 | ||
15 | APPP( PPPNetNode * PNN ); | 15 | APPP( PPPNetNode * PNN ); |
16 | 16 | ||
17 | QWidget * edit( QWidget * parent ); | 17 | QWidget * edit( QWidget * parent ); |
18 | QString acceptable( void ); | 18 | QString acceptable( void ); |
19 | void commit( void ); | 19 | void commit( void ); |
20 | 20 | ||
21 | RuntimeInfo * runtime( void ) | 21 | RuntimeInfo * runtime( void ) |
22 | { if( RT == 0 ) | 22 | { if( RT == 0 ) |
23 | RT = new PPPRun( this, Data ); | 23 | RT = new PPPRun( this, Data ); |
24 | return RT; | 24 | return RT->runtimeInfo(); |
25 | } | 25 | } |
26 | 26 | ||
27 | virtual void * data( void ) | 27 | virtual void * data( void ) |
28 | { return (void *)&Data; } | 28 | { return (void *)&Data; } |
29 | 29 | ||
30 | protected : | 30 | protected : |
31 | 31 | ||
32 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 32 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
33 | virtual void saveSpecificAttribute( QTextStream & TS ); | 33 | virtual void saveSpecificAttribute( QTextStream & TS ); |
34 | 34 | ||
35 | private : | 35 | private : |
36 | 36 | ||
37 | PPPEdit * GUI; | 37 | PPPEdit * GUI; |
38 | PPPData Data; | 38 | PPPData Data; |
39 | PPPRun * RT; | 39 | PPPRun * RT; |
40 | 40 | ||
41 | }; | 41 | }; |
42 | 42 | ||
43 | #endif | 43 | #endif |
diff --git a/noncore/settings/networksettings2/ppp/ppprun.cpp b/noncore/settings/networksettings2/ppp/ppprun.cpp index 8933f85..4ac0c5a 100644 --- a/noncore/settings/networksettings2/ppp/ppprun.cpp +++ b/noncore/settings/networksettings2/ppp/ppprun.cpp | |||
@@ -1,77 +1,90 @@ | |||
1 | #include <resources.h> | 1 | #include <resources.h> |
2 | #include "ppprun.h" | 2 | #include "ppprun.h" |
3 | 3 | ||
4 | PPPRun::PPPRun( ANetNodeInstance * NNI, PPPData & Data ) : | ||
5 | AsConnection( NNI ), AsDevice( NNI ), Pat( "eth[0-9]" ) { | ||
6 | D = &Data; | ||
7 | } | ||
8 | |||
4 | void PPPRun::detectState( NodeCollection * NC ) { | 9 | void PPPRun::detectState( NodeCollection * NC ) { |
5 | if( isMyPPPDRunning( ) ) { | 10 | if( isMyPPPDRunning( ) ) { |
6 | if( isMyPPPUp() ) { | 11 | if( isMyPPPUp() ) { |
7 | NC->setCurrentState( IsUp ); | 12 | NC->setCurrentState( IsUp ); |
8 | } else { | 13 | } else { |
9 | NC->setCurrentState( Available ); | 14 | NC->setCurrentState( Available ); |
10 | } | 15 | } |
11 | } else { | 16 | } else { |
12 | NC->setCurrentState( Off ); // at least this | 17 | NC->setCurrentState( Off ); // at least this |
13 | // but could also be unavailable | 18 | // but could also be unavailable |
14 | netNode()->nextNode()->runtime()->detectState( NC ); | 19 | ANetNodeInstance * NNI; |
20 | RuntimeInfo * RI; | ||
21 | NNI = AsDevice::netNode(); | ||
22 | printf( "%p\n", NNI ); | ||
23 | NNI = NNI->nextNode(); | ||
24 | printf( "%p\n", NNI ); | ||
25 | RI = NNI->runtime(); | ||
26 | printf( "%p\n", RI ); | ||
27 | RI->detectState( NC ); | ||
15 | } | 28 | } |
16 | } | 29 | } |
17 | 30 | ||
18 | bool PPPRun::setState( NodeCollection * NC, Action_t A ) { | 31 | bool PPPRun::setState( NodeCollection * NC, Action_t A ) { |
19 | switch( A ) { | 32 | switch( A ) { |
20 | case Activate : | 33 | case Activate : |
21 | NC->setCurrentState( Available ); | 34 | NC->setCurrentState( Available ); |
22 | // no | 35 | // no |
23 | break; | 36 | break; |
24 | case Deactivate : | 37 | case Deactivate : |
25 | if( NC->currentState() == IsUp ) { | 38 | if( NC->currentState() == IsUp ) { |
26 | NC->state( Down ); | 39 | NC->state( Down ); |
27 | } | 40 | } |
28 | // cannot really disable | 41 | // cannot really disable |
29 | NC->setCurrentState( Available ); | 42 | NC->setCurrentState( Available ); |
30 | break; | 43 | break; |
31 | case Up : | 44 | case Up : |
32 | if( NC->currentState() != IsUp ) { | 45 | if( NC->currentState() != IsUp ) { |
33 | // start my PPPD | 46 | // start my PPPD |
34 | NC->setCurrentState( IsUp ); | 47 | NC->setCurrentState( IsUp ); |
35 | } | 48 | } |
36 | break; | 49 | break; |
37 | case Down : | 50 | case Down : |
38 | if( NC->currentState() == IsUp ) { | 51 | if( NC->currentState() == IsUp ) { |
39 | // stop my PPPD | 52 | // stop my PPPD |
40 | NC->setCurrentState( Available ); | 53 | NC->setCurrentState( Available ); |
41 | } | 54 | } |
42 | break; | 55 | break; |
43 | default : // FT | 56 | default : // FT |
44 | break; | 57 | break; |
45 | } | 58 | } |
46 | return 1; | 59 | return 1; |
47 | } | 60 | } |
48 | 61 | ||
49 | bool PPPRun::isMyPPPDRunning( void ) { | 62 | bool PPPRun::isMyPPPDRunning( void ) { |
50 | return 0; | 63 | return 0; |
51 | } | 64 | } |
52 | 65 | ||
53 | bool PPPRun::isMyPPPUp( void ) { | 66 | bool PPPRun::isMyPPPUp( void ) { |
54 | System & S = NSResources->system(); | 67 | System & S = NSResources->system(); |
55 | InterfaceInfo * best = 0, * Run; | 68 | InterfaceInfo * Run; |
56 | QRegExp R( "ppp[0-9]" ); | 69 | QRegExp R( "ppp[0-9]" ); |
57 | 70 | ||
58 | for( QDictIterator<InterfaceInfo> It(S.interfaces()); | 71 | for( QDictIterator<InterfaceInfo> It(S.interfaces()); |
59 | It.current(); | 72 | It.current(); |
60 | ++It ) { | 73 | ++It ) { |
61 | Run = It.current(); | 74 | Run = It.current(); |
62 | if( R.match( Run->Name ) >= 0 && | 75 | if( R.match( Run->Name ) >= 0 && |
63 | Run->IsPointToPoint | 76 | Run->IsPointToPoint |
64 | ) { | 77 | ) { |
65 | // this is a LAN card | 78 | // this is a LAN card |
66 | if( Run->assignedNode() == netNode() ) { | 79 | if( Run->assignedNode() == AsDevice::netNode() ) { |
67 | // assigned to us | 80 | // assigned to us |
68 | return 1; | 81 | return 1; |
69 | } | 82 | } |
70 | } | 83 | } |
71 | } | 84 | } |
72 | return 0; | 85 | return 0; |
73 | } | 86 | } |
74 | 87 | ||
75 | bool PPPRun::handlesInterface( const QString & S ) { | 88 | bool PPPRun::handlesInterface( const QString & S ) { |
76 | return Pat.match( S ) >= 0; | 89 | return Pat.match( S ) >= 0; |
77 | } | 90 | } |
diff --git a/noncore/settings/networksettings2/ppp/ppprun.h b/noncore/settings/networksettings2/ppp/ppprun.h index 76a05be..abb9176 100644 --- a/noncore/settings/networksettings2/ppp/ppprun.h +++ b/noncore/settings/networksettings2/ppp/ppprun.h | |||
@@ -1,37 +1,43 @@ | |||
1 | #ifndef PPPRUN_H | 1 | #ifndef PPPRUN_H |
2 | #define PPPRUN_H | 2 | #define PPPRUN_H |
3 | 3 | ||
4 | #include <qregexp.h> | 4 | #include <qregexp.h> |
5 | #include <asconnection.h> | 5 | #include <asconnection.h> |
6 | #include <asdevice.h> | ||
6 | #include "pppdata.h" | 7 | #include "pppdata.h" |
7 | 8 | ||
8 | class PPPRun : public AsConnection { | 9 | class PPPRun : public AsConnection, public AsDevice { |
9 | 10 | ||
10 | public : | 11 | public : |
11 | 12 | ||
12 | PPPRun( ANetNodeInstance * NNI, | 13 | PPPRun( ANetNodeInstance * NNI, |
13 | PPPData & Data ) : | 14 | PPPData & Data ); |
14 | AsConnection( NNI ), | 15 | virtual QString genNic( long NicNr ) |
15 | Pat( "eth[0-9]" ) | 16 | { QString S; return S.sprintf( "ppp%ld", NicNr ); } |
16 | { D = &Data; } | ||
17 | 17 | ||
18 | protected : | 18 | virtual AsDevice * device( void ) |
19 | { return AsDevice::asDevice(); } | ||
20 | virtual RuntimeInfo * runtimeInfo( void ) | ||
21 | { return ( AsConnection *)this; } | ||
22 | |||
23 | protected : | ||
19 | 24 | ||
20 | void detectState( NodeCollection * NC ); | 25 | void detectState( NodeCollection * NC ); |
21 | bool setState( NodeCollection * NC, Action_t A ); | 26 | bool setState( NodeCollection * NC, Action_t A ); |
22 | bool canSetState( State_t S, Action_t A ) | 27 | bool canSetState( State_t S, Action_t A ) |
23 | { return connection()->findNext( netNode() )->runtime()->canSetState( S,A ); } | 28 | { return AsDevice::connection()->findNext( |
29 | AsDevice::netNode() )->runtime()->canSetState( S,A ); } | ||
24 | 30 | ||
25 | bool handlesInterface( const QString & I ); | 31 | bool handlesInterface( const QString & I ); |
26 | 32 | ||
27 | private : | 33 | private : |
28 | 34 | ||
29 | bool isMyPPPDRunning( void ); | 35 | bool isMyPPPDRunning( void ); |
30 | bool isMyPPPUp( void ); | 36 | bool isMyPPPUp( void ); |
31 | 37 | ||
32 | PPPData_t * D; | 38 | PPPData_t * D; |
33 | QRegExp Pat; | 39 | QRegExp Pat; |
34 | 40 | ||
35 | }; | 41 | }; |
36 | 42 | ||
37 | #endif | 43 | #endif |
diff --git a/noncore/settings/networksettings2/profile/profile_NN.h b/noncore/settings/networksettings2/profile/profile_NN.h index 2b469c7..3c06947 100644 --- a/noncore/settings/networksettings2/profile/profile_NN.h +++ b/noncore/settings/networksettings2/profile/profile_NN.h | |||
@@ -1,44 +1,44 @@ | |||
1 | #ifndef PROFILE_NETNODE_H | 1 | #ifndef PROFILE_NETNODE_H |
2 | #define PROFILE_NETNODE_H | 2 | #define PROFILE_NETNODE_H |
3 | 3 | ||
4 | #include "netnode.h" | 4 | #include "netnode.h" |
5 | 5 | ||
6 | class AProfile; | 6 | class AProfile; |
7 | 7 | ||
8 | class ProfileNetNode : public ANetNode{ | 8 | class ProfileNetNode : public ANetNode{ |
9 | 9 | ||
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | 11 | ||
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 "commprofile"; } | 18 | { return "Devices/commprofile"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | 20 | virtual const QString nodeName() |
21 | { return tr("Regular profile"); } | 21 | { return tr("Regular profile"); } |
22 | 22 | ||
23 | virtual const QString nodeDescription() ; | 23 | virtual const QString nodeDescription() ; |
24 | 24 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 25 | virtual ANetNodeInstance * createInstance( void ); |
26 | 26 | ||
27 | virtual const char ** needs( void ); | 27 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 28 | virtual const char * provides( void ); |
29 | 29 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | virtual bool hasDataFor( const QString & S ); | 31 | virtual bool hasDataFor( const QString & S ); |
32 | virtual bool generateDataForCommonFile( | 32 | virtual bool generateDataForCommonFile( |
33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | 33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); |
34 | 34 | ||
35 | private: | 35 | private: |
36 | 36 | ||
37 | }; | 37 | }; |
38 | 38 | ||
39 | extern "C" | 39 | extern "C" |
40 | { | 40 | { |
41 | void create_plugin( QList<ANetNode> & PNN ); | 41 | void create_plugin( QList<ANetNode> & PNN ); |
42 | }; | 42 | }; |
43 | 43 | ||
44 | #endif | 44 | #endif |
diff --git a/noncore/settings/networksettings2/usb/usb_NN.h b/noncore/settings/networksettings2/usb/usb_NN.h index 3871afc..8b97452 100644 --- a/noncore/settings/networksettings2/usb/usb_NN.h +++ b/noncore/settings/networksettings2/usb/usb_NN.h | |||
@@ -1,44 +1,44 @@ | |||
1 | #ifndef USB_NETNODE_H | 1 | #ifndef USB_NETNODE_H |
2 | #define USB_NETNODE_H | 2 | #define USB_NETNODE_H |
3 | 3 | ||
4 | #include "netnode.h" | 4 | #include "netnode.h" |
5 | 5 | ||
6 | class AUSB; | 6 | class AUSB; |
7 | 7 | ||
8 | class USBNetNode : public ANetNode{ | 8 | class USBNetNode : public ANetNode{ |
9 | 9 | ||
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | 11 | ||
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 "usb"; } | 18 | { return "Devices/usb"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | 20 | virtual const QString nodeName() |
21 | { return tr("USB Cable Connect"); } | 21 | { return tr("USB Cable Connect"); } |
22 | 22 | ||
23 | virtual const QString nodeDescription() ; | 23 | virtual const QString nodeDescription() ; |
24 | 24 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 25 | virtual ANetNodeInstance * createInstance( void ); |
26 | 26 | ||
27 | virtual const char ** needs( void ); | 27 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 28 | virtual const char * provides( void ); |
29 | 29 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | virtual bool hasDataFor( const QString & S ); | 31 | virtual bool hasDataFor( const QString & S ); |
32 | virtual bool generateDataForCommonFile( | 32 | virtual bool generateDataForCommonFile( |
33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | 33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); |
34 | 34 | ||
35 | private: | 35 | private: |
36 | 36 | ||
37 | }; | 37 | }; |
38 | 38 | ||
39 | extern "C" | 39 | extern "C" |
40 | { | 40 | { |
41 | void create_plugin( QList<ANetNode> & PNN ); | 41 | void create_plugin( QList<ANetNode> & PNN ); |
42 | }; | 42 | }; |
43 | 43 | ||
44 | #endif | 44 | #endif |
diff --git a/noncore/settings/networksettings2/vpn/vpn_NN.h b/noncore/settings/networksettings2/vpn/vpn_NN.h index 5718961..a113ab9 100644 --- a/noncore/settings/networksettings2/vpn/vpn_NN.h +++ b/noncore/settings/networksettings2/vpn/vpn_NN.h | |||
@@ -1,44 +1,44 @@ | |||
1 | #ifndef VPN_NETNODE_H | 1 | #ifndef VPN_NETNODE_H |
2 | #define VPN_NETNODE_H | 2 | #define VPN_NETNODE_H |
3 | 3 | ||
4 | #include "netnode.h" | 4 | #include "netnode.h" |
5 | 5 | ||
6 | class AVPN; | 6 | class AVPN; |
7 | 7 | ||
8 | class VPNNetNode : public ANetNode{ | 8 | class VPNNetNode : public ANetNode{ |
9 | 9 | ||
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | 11 | ||
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 "vpn"; } | 18 | { return "Devices/vpn"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | 20 | virtual const QString nodeName() |
21 | { return tr("VPN Connection"); } | 21 | { return tr("VPN Connection"); } |
22 | 22 | ||
23 | virtual const QString nodeDescription() ; | 23 | virtual const QString nodeDescription() ; |
24 | 24 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 25 | virtual ANetNodeInstance * createInstance( void ); |
26 | 26 | ||
27 | virtual const char ** needs( void ); | 27 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 28 | virtual const char * provides( void ); |
29 | 29 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | virtual bool hasDataFor( const QString & S ); | 31 | virtual bool hasDataFor( const QString & S ); |
32 | virtual bool generateDataForCommonFile( | 32 | virtual bool generateDataForCommonFile( |
33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | 33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); |
34 | 34 | ||
35 | private: | 35 | private: |
36 | 36 | ||
37 | }; | 37 | }; |
38 | 38 | ||
39 | extern "C" | 39 | extern "C" |
40 | { | 40 | { |
41 | void create_plugin( QList<ANetNode> & PNN ); | 41 | void create_plugin( QList<ANetNode> & PNN ); |
42 | }; | 42 | }; |
43 | 43 | ||
44 | #endif | 44 | #endif |
diff --git a/noncore/settings/networksettings2/wlan/wlan_NN.h b/noncore/settings/networksettings2/wlan/wlan_NN.h index d1d6ded..0728a79 100644 --- a/noncore/settings/networksettings2/wlan/wlan_NN.h +++ b/noncore/settings/networksettings2/wlan/wlan_NN.h | |||
@@ -1,44 +1,44 @@ | |||
1 | #ifndef WLAN_NETNODE_H | 1 | #ifndef WLAN_NETNODE_H |
2 | #define WLAN_NETNODE_H | 2 | #define WLAN_NETNODE_H |
3 | 3 | ||
4 | #include "netnode.h" | 4 | #include "netnode.h" |
5 | 5 | ||
6 | class AWLan; | 6 | class AWLan; |
7 | 7 | ||
8 | class WLanNetNode : public ANetNode{ | 8 | class WLanNetNode : public ANetNode{ |
9 | 9 | ||
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | 11 | ||
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 "wlan"; } | 18 | { return "Devices/wlan"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | 20 | virtual const QString nodeName() |
21 | { return tr("WLan Device"); } | 21 | { return tr("WLan Device"); } |
22 | 22 | ||
23 | virtual const QString nodeDescription() ; | 23 | virtual const QString nodeDescription() ; |
24 | 24 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 25 | virtual ANetNodeInstance * createInstance( void ); |
26 | 26 | ||
27 | virtual const char ** needs( void ); | 27 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 28 | virtual const char * provides( void ); |
29 | 29 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | virtual bool hasDataFor( const QString & S ); | 31 | virtual bool hasDataFor( const QString & S ); |
32 | virtual bool generateDataForCommonFile( | 32 | virtual bool generateDataForCommonFile( |
33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | 33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); |
34 | 34 | ||
35 | private: | 35 | private: |
36 | 36 | ||
37 | }; | 37 | }; |
38 | 38 | ||
39 | extern "C" | 39 | extern "C" |
40 | { | 40 | { |
41 | void create_plugin( QList<ANetNode> & PNN ); | 41 | void create_plugin( QList<ANetNode> & PNN ); |
42 | }; | 42 | }; |
43 | 43 | ||
44 | #endif | 44 | #endif |