author | wimpie <wimpie> | 2004-04-05 22:58:06 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2004-04-05 22:58:06 (UTC) |
commit | 9aeac7cefc3c8baf32944e7275b57e0a0cde1515 (patch) (unidiff) | |
tree | dc8161657d98d0e97d5f29554cb35d9b57202c49 | |
parent | 1d958f56a9e1357c20e76d763579d4dc184978e0 (diff) | |
download | opie-9aeac7cefc3c8baf32944e7275b57e0a0cde1515.zip opie-9aeac7cefc3c8baf32944e7275b57e0a0cde1515.tar.gz opie-9aeac7cefc3c8baf32944e7275b57e0a0cde1515.tar.bz2 |
Add save of node specific config data
27 files changed, 224 insertions, 135 deletions
diff --git a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp index 3d1aa69..4579e37 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp +++ b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp | |||
@@ -11,16 +11,17 @@ | |||
11 | static const char * BluetoothBNEPNeeds[] = | 11 | static const char * BluetoothBNEPNeeds[] = |
12 | { 0 | 12 | { 0 |
13 | }; | 13 | }; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * Constructor, find all of the possible interfaces | 16 | * Constructor, find all of the possible interfaces |
17 | */ | 17 | */ |
18 | BluetoothBNEPNetNode::BluetoothBNEPNetNode() : ANetNode() { | 18 | BluetoothBNEPNetNode::BluetoothBNEPNetNode() : ANetNode() { |
19 | InstanceCount = 7; // default | ||
19 | } | 20 | } |
20 | 21 | ||
21 | /** | 22 | /** |
22 | * Delete any interfaces that we own. | 23 | * Delete any interfaces that we own. |
23 | */ | 24 | */ |
24 | BluetoothBNEPNetNode::~BluetoothBNEPNetNode(){ | 25 | BluetoothBNEPNetNode::~BluetoothBNEPNetNode(){ |
25 | } | 26 | } |
26 | 27 | ||
@@ -59,19 +60,32 @@ bool BluetoothBNEPNetNode::generateDeviceDataForCommonFile( | |||
59 | return 1; | 60 | return 1; |
60 | } | 61 | } |
61 | 62 | ||
62 | QString BluetoothBNEPNetNode::genNic( long nr ) { | 63 | QString BluetoothBNEPNetNode::genNic( long nr ) { |
63 | QString S; | 64 | QString S; |
64 | return S.sprintf( "bnep%ld", nr ); | 65 | return S.sprintf( "bnep%ld", nr ); |
65 | } | 66 | } |
66 | 67 | ||
68 | |||
69 | void BluetoothBNEPNetNode::setSpecificAttribute( QString & A, QString & V ) { | ||
70 | if( A == "interfacecount" ) { | ||
71 | InstanceCount = V.toLong(); | ||
72 | } | ||
73 | } | ||
74 | |||
75 | void BluetoothBNEPNetNode::saveSpecificAttribute( QTextStream & TS) { | ||
76 | TS << "interfacecount=" | ||
77 | << InstanceCount | ||
78 | << endl; | ||
79 | } | ||
80 | |||
67 | // | 81 | // |
68 | // | 82 | // |
69 | // BLUETOOTH PAN/NAP node | 83 | // BLUETOOTH RFCOMM |
70 | // | 84 | // |
71 | // | 85 | // |
72 | 86 | ||
73 | static const char * BluetoothRFCOMMNeeds[] = | 87 | static const char * BluetoothRFCOMMNeeds[] = |
74 | { 0 | 88 | { 0 |
75 | }; | 89 | }; |
76 | 90 | ||
77 | BluetoothRFCOMMNetNode::BluetoothRFCOMMNetNode() : ANetNode() { | 91 | BluetoothRFCOMMNetNode::BluetoothRFCOMMNetNode() : ANetNode() { |
@@ -110,14 +124,20 @@ bool BluetoothRFCOMMNetNode::hasDataFor( const QString & ) { | |||
110 | } | 124 | } |
111 | 125 | ||
112 | bool BluetoothRFCOMMNetNode::generateDeviceDataForCommonFile( | 126 | bool BluetoothRFCOMMNetNode::generateDeviceDataForCommonFile( |
113 | SystemFile & , | 127 | SystemFile & , |
114 | long ) { | 128 | long ) { |
115 | return 0; | 129 | return 0; |
116 | } | 130 | } |
117 | 131 | ||
132 | void BluetoothRFCOMMNetNode::setSpecificAttribute( QString &, QString & ) { | ||
133 | } | ||
134 | |||
135 | void BluetoothRFCOMMNetNode::saveSpecificAttribute( QTextStream & ) { | ||
136 | } | ||
137 | |||
118 | extern "C" { | 138 | extern "C" { |
119 | void create_plugin( QList<ANetNode> & PNN ) { | 139 | void create_plugin( QList<ANetNode> & PNN ) { |
120 | PNN.append( new BluetoothBNEPNetNode() ); | 140 | PNN.append( new BluetoothBNEPNetNode() ); |
121 | PNN.append( new BluetoothRFCOMMNetNode() ); | 141 | PNN.append( new BluetoothRFCOMMNetNode() ); |
122 | } | 142 | } |
123 | } | 143 | } |
diff --git a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h index 5cd6c52..882d2e3 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h +++ b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h | |||
@@ -28,21 +28,27 @@ public: | |||
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 generateDeviceDataForCommonFile( | 32 | virtual bool generateDeviceDataForCommonFile( |
33 | SystemFile & , long DevNr ); | 33 | SystemFile & , long DevNr ); |
34 | 34 | ||
35 | virtual long instanceCount( void ) | 35 | virtual long instanceCount( void ) |
36 | { return 7; } | 36 | { return InstanceCount; } |
37 | virtual QString genNic( long ); | 37 | virtual QString genNic( long ); |
38 | 38 | ||
39 | private: | 39 | private: |
40 | 40 | ||
41 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | ||
42 | virtual void saveSpecificAttribute( QTextStream & TS ); | ||
43 | |||
44 | // number of interfaces for this device | ||
45 | long InstanceCount; | ||
46 | |||
41 | }; | 47 | }; |
42 | 48 | ||
43 | class BluetoothRFCOMMNetNode : public ANetNode { | 49 | class BluetoothRFCOMMNetNode : public ANetNode { |
44 | 50 | ||
45 | Q_OBJECT | 51 | Q_OBJECT |
46 | 52 | ||
47 | public: | 53 | public: |
48 | 54 | ||
@@ -64,16 +70,18 @@ public: | |||
64 | 70 | ||
65 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 71 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
66 | virtual bool hasDataFor( const QString & S ); | 72 | virtual bool hasDataFor( const QString & S ); |
67 | virtual bool generateDeviceDataForCommonFile( | 73 | virtual bool generateDeviceDataForCommonFile( |
68 | SystemFile & , long ); | 74 | SystemFile & , long ); |
69 | 75 | ||
70 | private: | 76 | private: |
71 | 77 | ||
78 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | ||
79 | virtual void saveSpecificAttribute( QTextStream & TS ); | ||
72 | }; | 80 | }; |
73 | 81 | ||
74 | extern "C" | 82 | extern "C" |
75 | { | 83 | { |
76 | void create_plugin( QList<ANetNode> & PNN ); | 84 | void create_plugin( QList<ANetNode> & PNN ); |
77 | }; | 85 | }; |
78 | 86 | ||
79 | #endif | 87 | #endif |
diff --git a/noncore/settings/networksettings2/cable/cable_NN.cpp b/noncore/settings/networksettings2/cable/cable_NN.cpp index a6be4d5..dd41c1f 100644 --- a/noncore/settings/networksettings2/cable/cable_NN.cpp +++ b/noncore/settings/networksettings2/cable/cable_NN.cpp | |||
@@ -42,13 +42,19 @@ bool CableNetNode::generateProperFilesFor( | |||
42 | } | 42 | } |
43 | 43 | ||
44 | bool CableNetNode::generateDeviceDataForCommonFile( | 44 | bool CableNetNode::generateDeviceDataForCommonFile( |
45 | SystemFile & , | 45 | SystemFile & , |
46 | long ) { | 46 | long ) { |
47 | return 1; | 47 | return 1; |
48 | } | 48 | } |
49 | 49 | ||
50 | void CableNetNode::setSpecificAttribute( QString & , QString & ) { | ||
51 | } | ||
52 | |||
53 | void CableNetNode::saveSpecificAttribute( QTextStream & ) { | ||
54 | } | ||
55 | |||
50 | extern "C" { | 56 | extern "C" { |
51 | void create_plugin( QList<ANetNode> & PNN ) { | 57 | void create_plugin( QList<ANetNode> & PNN ) { |
52 | PNN.append( new CableNetNode() ); | 58 | PNN.append( new CableNetNode() ); |
53 | } | 59 | } |
54 | } | 60 | } |
diff --git a/noncore/settings/networksettings2/cable/cable_NN.h b/noncore/settings/networksettings2/cable/cable_NN.h index 83b98e0..b37f31a 100644 --- a/noncore/settings/networksettings2/cable/cable_NN.h +++ b/noncore/settings/networksettings2/cable/cable_NN.h | |||
@@ -30,16 +30,18 @@ public: | |||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | virtual bool hasDataFor( const QString & ) | 31 | virtual bool hasDataFor( const QString & ) |
32 | { return 0; } | 32 | { return 0; } |
33 | virtual bool generateDeviceDataForCommonFile( | 33 | virtual bool generateDeviceDataForCommonFile( |
34 | SystemFile & SF, long DevNr); | 34 | SystemFile & SF, long DevNr); |
35 | 35 | ||
36 | private: | 36 | private: |
37 | 37 | ||
38 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | ||
39 | virtual void saveSpecificAttribute( QTextStream & TS ); | ||
38 | }; | 40 | }; |
39 | 41 | ||
40 | extern "C" | 42 | extern "C" |
41 | { | 43 | { |
42 | void create_plugin( QList<ANetNode> & PNN ); | 44 | void create_plugin( QList<ANetNode> & PNN ); |
43 | }; | 45 | }; |
44 | 46 | ||
45 | #endif | 47 | #endif |
diff --git a/noncore/settings/networksettings2/irda/irda_NN.cpp b/noncore/settings/networksettings2/irda/irda_NN.cpp index 96327a5..49b7707 100644 --- a/noncore/settings/networksettings2/irda/irda_NN.cpp +++ b/noncore/settings/networksettings2/irda/irda_NN.cpp | |||
@@ -42,13 +42,19 @@ bool IRDANetNode::generateProperFilesFor( | |||
42 | } | 42 | } |
43 | 43 | ||
44 | bool IRDANetNode::generateDeviceDataForCommonFile( | 44 | bool IRDANetNode::generateDeviceDataForCommonFile( |
45 | SystemFile & , | 45 | SystemFile & , |
46 | long ) { | 46 | long ) { |
47 | return 1; | 47 | return 1; |
48 | } | 48 | } |
49 | 49 | ||
50 | void IRDANetNode::setSpecificAttribute( QString & , QString & ) { | ||
51 | } | ||
52 | |||
53 | void IRDANetNode::saveSpecificAttribute( QTextStream & ) { | ||
54 | } | ||
55 | |||
50 | extern "C" { | 56 | extern "C" { |
51 | void create_plugin( QList<ANetNode> & PNN ) { | 57 | void create_plugin( QList<ANetNode> & PNN ) { |
52 | PNN.append( new IRDANetNode() ); | 58 | PNN.append( new IRDANetNode() ); |
53 | } | 59 | } |
54 | } | 60 | } |
diff --git a/noncore/settings/networksettings2/irda/irda_NN.h b/noncore/settings/networksettings2/irda/irda_NN.h index a5b6cc5..2dcef74 100644 --- a/noncore/settings/networksettings2/irda/irda_NN.h +++ b/noncore/settings/networksettings2/irda/irda_NN.h | |||
@@ -30,16 +30,18 @@ public: | |||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | virtual bool hasDataFor( const QString & ) | 31 | virtual bool hasDataFor( const QString & ) |
32 | { return 0; } | 32 | { return 0; } |
33 | virtual bool generateDeviceDataForCommonFile( | 33 | virtual bool generateDeviceDataForCommonFile( |
34 | SystemFile & SF, long DevNr ); | 34 | SystemFile & SF, long DevNr ); |
35 | 35 | ||
36 | private: | 36 | private: |
37 | 37 | ||
38 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | ||
39 | virtual void saveSpecificAttribute( QTextStream & TS ); | ||
38 | }; | 40 | }; |
39 | 41 | ||
40 | extern "C" | 42 | extern "C" |
41 | { | 43 | { |
42 | void create_plugin( QList<ANetNode> & PNN ); | 44 | void create_plugin( QList<ANetNode> & PNN ); |
43 | }; | 45 | }; |
44 | 46 | ||
45 | #endif | 47 | #endif |
diff --git a/noncore/settings/networksettings2/lancard/lancard_NN.cpp b/noncore/settings/networksettings2/lancard/lancard_NN.cpp index 480ddf9..ba1c1f8 100644 --- a/noncore/settings/networksettings2/lancard/lancard_NN.cpp +++ b/noncore/settings/networksettings2/lancard/lancard_NN.cpp | |||
@@ -3,16 +3,17 @@ | |||
3 | 3 | ||
4 | static const char * LanCardNeeds[] = | 4 | static const char * LanCardNeeds[] = |
5 | { 0 }; | 5 | { 0 }; |
6 | 6 | ||
7 | /** | 7 | /** |
8 | * Constructor, find all of the possible interfaces | 8 | * Constructor, find all of the possible interfaces |
9 | */ | 9 | */ |
10 | LanCardNetNode::LanCardNetNode() : ANetNode() { | 10 | LanCardNetNode::LanCardNetNode() : ANetNode() { |
11 | InstanceCount = 2; | ||
11 | } | 12 | } |
12 | 13 | ||
13 | /** | 14 | /** |
14 | * Delete any interfaces that we own. | 15 | * Delete any interfaces that we own. |
15 | */ | 16 | */ |
16 | LanCardNetNode::~LanCardNetNode(){ | 17 | LanCardNetNode::~LanCardNetNode(){ |
17 | } | 18 | } |
18 | 19 | ||
@@ -60,13 +61,25 @@ bool LanCardNetNode::generateDeviceDataForCommonFile( | |||
60 | return 0; | 61 | return 0; |
61 | } | 62 | } |
62 | 63 | ||
63 | QString LanCardNetNode::genNic( long nr ) { | 64 | QString LanCardNetNode::genNic( long nr ) { |
64 | QString S; | 65 | QString S; |
65 | return S.sprintf( "eth%ld", nr ); | 66 | return S.sprintf( "eth%ld", nr ); |
66 | } | 67 | } |
67 | 68 | ||
69 | void LanCardNetNode::setSpecificAttribute( QString & A, QString & V ) { | ||
70 | if( A == "interfacecount" ) { | ||
71 | InstanceCount = V.toLong(); | ||
72 | } | ||
73 | } | ||
74 | |||
75 | void LanCardNetNode::saveSpecificAttribute( QTextStream & TS) { | ||
76 | TS << "interfacecount=" | ||
77 | << InstanceCount | ||
78 | << endl; | ||
79 | } | ||
80 | |||
68 | extern "C" { | 81 | extern "C" { |
69 | void create_plugin( QList<ANetNode> & PNN ) { | 82 | void create_plugin( QList<ANetNode> & PNN ) { |
70 | PNN.append( new LanCardNetNode() ); | 83 | PNN.append( new LanCardNetNode() ); |
71 | } | 84 | } |
72 | } | 85 | } |
diff --git a/noncore/settings/networksettings2/lancard/lancard_NN.h b/noncore/settings/networksettings2/lancard/lancard_NN.h index dcdd0da..5f2b25d 100644 --- a/noncore/settings/networksettings2/lancard/lancard_NN.h +++ b/noncore/settings/networksettings2/lancard/lancard_NN.h | |||
@@ -28,22 +28,28 @@ public: | |||
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 generateDeviceDataForCommonFile( | 32 | virtual bool generateDeviceDataForCommonFile( |
33 | SystemFile & SF, long DevNr ); | 33 | SystemFile & SF, long DevNr ); |
34 | 34 | ||
35 | virtual long instanceCount( void ) | 35 | virtual long instanceCount( void ) |
36 | { return 2; } | 36 | { return InstanceCount; } |
37 | 37 | ||
38 | virtual QString genNic( long ); | 38 | virtual QString genNic( long ); |
39 | 39 | ||
40 | private: | 40 | private: |
41 | 41 | ||
42 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | ||
43 | virtual void saveSpecificAttribute( QTextStream & TS ); | ||
44 | |||
45 | // number of interfaces for this device | ||
46 | long InstanceCount; | ||
47 | |||
42 | }; | 48 | }; |
43 | 49 | ||
44 | extern "C" | 50 | extern "C" |
45 | { | 51 | { |
46 | void create_plugin( QList<ANetNode> & PNN ); | 52 | void create_plugin( QList<ANetNode> & PNN ); |
47 | }; | 53 | }; |
48 | 54 | ||
49 | #endif | 55 | #endif |
diff --git a/noncore/settings/networksettings2/modem/modem_NN.cpp b/noncore/settings/networksettings2/modem/modem_NN.cpp index 65b06ee..1cc8524 100644 --- a/noncore/settings/networksettings2/modem/modem_NN.cpp +++ b/noncore/settings/networksettings2/modem/modem_NN.cpp | |||
@@ -43,13 +43,19 @@ bool ModemNetNode::generateProperFilesFor( | |||
43 | } | 43 | } |
44 | 44 | ||
45 | bool ModemNetNode::generateDeviceDataForCommonFile( | 45 | bool ModemNetNode::generateDeviceDataForCommonFile( |
46 | SystemFile & , | 46 | SystemFile & , |
47 | long ) { | 47 | long ) { |
48 | return 1; | 48 | return 1; |
49 | } | 49 | } |
50 | 50 | ||
51 | void ModemNetNode::setSpecificAttribute( QString & , QString & ) { | ||
52 | } | ||
53 | |||
54 | void ModemNetNode::saveSpecificAttribute( QTextStream & ) { | ||
55 | } | ||
56 | |||
51 | extern "C" { | 57 | extern "C" { |
52 | void create_plugin( QList<ANetNode> & PNN ) { | 58 | void create_plugin( QList<ANetNode> & PNN ) { |
53 | PNN.append( new ModemNetNode() ); | 59 | PNN.append( new ModemNetNode() ); |
54 | } | 60 | } |
55 | } | 61 | } |
diff --git a/noncore/settings/networksettings2/modem/modem_NN.h b/noncore/settings/networksettings2/modem/modem_NN.h index 49244b2..849f928 100644 --- a/noncore/settings/networksettings2/modem/modem_NN.h +++ b/noncore/settings/networksettings2/modem/modem_NN.h | |||
@@ -30,16 +30,18 @@ public: | |||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | virtual bool hasDataFor( const QString & ) | 31 | virtual bool hasDataFor( const QString & ) |
32 | { return 0; } | 32 | { return 0; } |
33 | virtual bool generateDeviceDataForCommonFile( | 33 | virtual bool generateDeviceDataForCommonFile( |
34 | SystemFile & SF, long DevNr ); | 34 | SystemFile & SF, long DevNr ); |
35 | 35 | ||
36 | private: | 36 | private: |
37 | 37 | ||
38 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | ||
39 | virtual void saveSpecificAttribute( QTextStream & TS ); | ||
38 | }; | 40 | }; |
39 | 41 | ||
40 | extern "C" | 42 | extern "C" |
41 | { | 43 | { |
42 | void create_plugin( QList<ANetNode> & PNN ); | 44 | void create_plugin( QList<ANetNode> & PNN ); |
43 | }; | 45 | }; |
44 | 46 | ||
45 | #endif | 47 | #endif |
diff --git a/noncore/settings/networksettings2/network/network_NN.cpp b/noncore/settings/networksettings2/network/network_NN.cpp index 4a77e6a..d27d54a 100644 --- a/noncore/settings/networksettings2/network/network_NN.cpp +++ b/noncore/settings/networksettings2/network/network_NN.cpp | |||
@@ -44,13 +44,19 @@ bool NetworkNetNode::generateProperFilesFor( | |||
44 | } | 44 | } |
45 | 45 | ||
46 | bool NetworkNetNode::generateDeviceDataForCommonFile( | 46 | bool NetworkNetNode::generateDeviceDataForCommonFile( |
47 | SystemFile & , | 47 | SystemFile & , |
48 | long ) { | 48 | long ) { |
49 | return 1; | 49 | return 1; |
50 | } | 50 | } |
51 | 51 | ||
52 | void NetworkNetNode::setSpecificAttribute( QString & , QString & ) { | ||
53 | } | ||
54 | |||
55 | void NetworkNetNode::saveSpecificAttribute( QTextStream & ) { | ||
56 | } | ||
57 | |||
52 | extern "C" { | 58 | extern "C" { |
53 | void create_plugin( QList<ANetNode> & PNN ) { | 59 | void create_plugin( QList<ANetNode> & PNN ) { |
54 | PNN.append( new NetworkNetNode() ); | 60 | PNN.append( new NetworkNetNode() ); |
55 | } | 61 | } |
56 | } | 62 | } |
diff --git a/noncore/settings/networksettings2/network/network_NN.h b/noncore/settings/networksettings2/network/network_NN.h index 59f0526..0f87e1b 100644 --- a/noncore/settings/networksettings2/network/network_NN.h +++ b/noncore/settings/networksettings2/network/network_NN.h | |||
@@ -30,16 +30,18 @@ public: | |||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | virtual bool hasDataFor( const QString & ) | 31 | virtual bool hasDataFor( const QString & ) |
32 | { return 0; } | 32 | { return 0; } |
33 | virtual bool generateDeviceDataForCommonFile( | 33 | virtual bool generateDeviceDataForCommonFile( |
34 | SystemFile & SF, long DevNr ); | 34 | SystemFile & SF, long DevNr ); |
35 | 35 | ||
36 | private: | 36 | private: |
37 | 37 | ||
38 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | ||
39 | virtual void saveSpecificAttribute( QTextStream & TS ); | ||
38 | }; | 40 | }; |
39 | 41 | ||
40 | extern "C" | 42 | extern "C" |
41 | { | 43 | { |
42 | void create_plugin( QList<ANetNode> & PNN ); | 44 | void create_plugin( QList<ANetNode> & PNN ); |
43 | }; | 45 | }; |
44 | 46 | ||
45 | #endif | 47 | #endif |
diff --git a/noncore/settings/networksettings2/networksettings2/netnode.cpp b/noncore/settings/networksettings2/networksettings2/netnode.cpp index fcc6044..3691e5a 100644 --- a/noncore/settings/networksettings2/networksettings2/netnode.cpp +++ b/noncore/settings/networksettings2/networksettings2/netnode.cpp | |||
@@ -40,19 +40,34 @@ QString quote( QString X ) { | |||
40 | 40 | ||
41 | OutString += X; | 41 | OutString += X; |
42 | OutString += "\""; | 42 | OutString += "\""; |
43 | X = OutString; | 43 | X = OutString; |
44 | } | 44 | } |
45 | return X; | 45 | return X; |
46 | } | 46 | } |
47 | 47 | ||
48 | |||
49 | // | ||
50 | // | ||
51 | // ANETNODE | ||
48 | // | 52 | // |
49 | // | 53 | // |
54 | |||
55 | void ANetNode::saveAttributes( QTextStream & TS ) { | ||
56 | saveSpecificAttribute( TS ); | ||
57 | } | ||
58 | |||
59 | void ANetNode::setAttribute( QString & Attr, QString & Value ){ | ||
60 | setSpecificAttribute( Attr, Value ); | ||
61 | } | ||
62 | |||
63 | // | ||
50 | // | 64 | // |
65 | // ANETNODEINSTANCE | ||
51 | // | 66 | // |
52 | // | 67 | // |
53 | 68 | ||
54 | long ANetNodeInstance::InstanceCounter = -1; | 69 | long ANetNodeInstance::InstanceCounter = -1; |
55 | 70 | ||
56 | void ANetNodeInstance::initialize( void ) { | 71 | void ANetNodeInstance::initialize( void ) { |
57 | if( InstanceCounter == -1 ) | 72 | if( InstanceCounter == -1 ) |
58 | InstanceCounter = time(0); | 73 | InstanceCounter = time(0); |
@@ -77,17 +92,17 @@ void ANetNodeInstance::saveAttributes( QTextStream & TS ) { | |||
77 | } | 92 | } |
78 | 93 | ||
79 | ANetNodeInstance * ANetNodeInstance::nextNode( void ) { | 94 | ANetNodeInstance * ANetNodeInstance::nextNode( void ) { |
80 | return connection()->findNext( this ); | 95 | return connection()->findNext( this ); |
81 | } | 96 | } |
82 | 97 | ||
83 | // | 98 | // |
84 | // | 99 | // |
85 | // | 100 | // NODECOLLECTION |
86 | // | 101 | // |
87 | // | 102 | // |
88 | 103 | ||
89 | long NodeCollection::MaxNr = -1; | 104 | long NodeCollection::MaxNr = -1; |
90 | 105 | ||
91 | NodeCollection::NodeCollection( void ) : QList<ANetNodeInstance>() { | 106 | NodeCollection::NodeCollection( void ) : QList<ANetNodeInstance>() { |
92 | IsModified = 0; | 107 | IsModified = 0; |
93 | Index = -1; | 108 | Index = -1; |
@@ -264,39 +279,21 @@ QString NodeCollection::stateName( State_t S) { | |||
264 | void NodeCollection::reassign( void ) { | 279 | void NodeCollection::reassign( void ) { |
265 | for( QListIterator<ANetNodeInstance> it(*this); | 280 | for( QListIterator<ANetNodeInstance> it(*this); |
266 | it.current(); | 281 | it.current(); |
267 | ++it ) { | 282 | ++it ) { |
268 | it.current()->setConnection( this ); | 283 | it.current()->setConnection( this ); |
269 | } | 284 | } |
270 | } | 285 | } |
271 | 286 | ||
287 | // | ||
288 | // | ||
289 | // RUNTIMEINFO | ||
290 | // | ||
291 | // | ||
292 | |||
272 | InterfaceInfo * RuntimeInfo::assignedInterface( void ) { | 293 | InterfaceInfo * RuntimeInfo::assignedInterface( void ) { |
273 | return netNode()->nextNode()->runtime()->assignedInterface(); | 294 | return netNode()->nextNode()->runtime()->assignedInterface(); |
274 | } | 295 | } |
275 | 296 | ||
276 | AsDevice * RuntimeInfo::device( void ) { | 297 | AsDevice * RuntimeInfo::device( void ) { |
277 | return netNode()->nextNode()->runtime()->device(); | 298 | return netNode()->nextNode()->runtime()->device(); |
278 | } | 299 | } |
279 | |||
280 | ANetNodeInstance * FakeNetNode::createInstance( void ) { | ||
281 | return new FakeNetNodeInstance( this ); | ||
282 | } | ||
283 | |||
284 | void FakeNetNodeInstance::setSpecificAttribute( | ||
285 | QString & A, QString & V ) { | ||
286 | ValAttrPairs.insert( A, new QString(V) ); | ||
287 | } | ||
288 | |||
289 | void FakeNetNodeInstance::saveSpecificAttribute( QTextStream &TS ) { | ||
290 | for( QDictIterator<QString> it( ValAttrPairs ); | ||
291 | it.current(); | ||
292 | ++ it ) { | ||
293 | TS << it.currentKey().latin1() | ||
294 | << "=" | ||
295 | << quote( *(it.current())) | ||
296 | << endl ; | ||
297 | ++it; | ||
298 | } | ||
299 | } | ||
300 | |||
301 | // collects all info that no plugin acceps | ||
302 | FakeNetNode * FakeNode = 0; | ||
diff --git a/noncore/settings/networksettings2/networksettings2/netnode.h b/noncore/settings/networksettings2/networksettings2/netnode.h index 9681c6e..6ec9ef6 100644 --- a/noncore/settings/networksettings2/networksettings2/netnode.h +++ b/noncore/settings/networksettings2/networksettings2/netnode.h | |||
@@ -110,27 +110,35 @@ public: | |||
110 | virtual QString genNic( long ) | 110 | virtual QString genNic( long ) |
111 | { return QString(""); } | 111 | { return QString(""); } |
112 | 112 | ||
113 | // max number of instances for this node type | 113 | // max number of instances for this node type |
114 | // only relevant if node instances are devices | 114 | // only relevant if node instances are devices |
115 | virtual long instanceCount( void ) | 115 | virtual long instanceCount( void ) |
116 | { return 1; } | 116 | { return 1; } |
117 | 117 | ||
118 | // set the value of an attribute | ||
119 | void setAttribute( QString & Attr, QString & Value ) ; | ||
120 | void saveAttributes( QTextStream & TS ) ; | ||
121 | |||
118 | // compiled references to 'needed' NetNodes -> needs list | 122 | // compiled references to 'needed' NetNodes -> needs list |
119 | void setAlternatives( NetNodeList * Alt ) | 123 | void setAlternatives( NetNodeList * Alt ) |
120 | { Alternatives = Alt; } | 124 | { Alternatives = Alt; } |
121 | NetNodeList & alternatives( void ) | 125 | NetNodeList & alternatives( void ) |
122 | { return *Alternatives; } | 126 | { return *Alternatives; } |
123 | 127 | ||
124 | protected : | 128 | protected : |
125 | 129 | ||
126 | NetNodeList * Alternatives; | 130 | NetNodeList * Alternatives; |
127 | 131 | ||
128 | private : | 132 | private : |
133 | |||
134 | virtual void setSpecificAttribute( QString & , QString & ) = 0; | ||
135 | virtual void saveSpecificAttribute( QTextStream & ) = 0; | ||
136 | |||
129 | }; | 137 | }; |
130 | 138 | ||
131 | class ANetNodeInstance : public QObject { | 139 | class ANetNodeInstance : public QObject { |
132 | 140 | ||
133 | public: | 141 | public: |
134 | 142 | ||
135 | ANetNodeInstance( ANetNode * NN ) : QObject() | 143 | ANetNodeInstance( ANetNode * NN ) : QObject() |
136 | { IsModified=0; NodeType = NN; IsNew = TRUE; } | 144 | { IsModified=0; NodeType = NN; IsNew = TRUE; } |
@@ -373,93 +381,9 @@ private : | |||
373 | // loaded from file | 381 | // loaded from file |
374 | bool IsNew; | 382 | bool IsNew; |
375 | // index in listbox | 383 | // index in listbox |
376 | int Index; | 384 | int Index; |
377 | bool IsModified; | 385 | bool IsModified; |
378 | 386 | ||
379 | }; | 387 | }; |
380 | 388 | ||
381 | // | ||
382 | // special node that is used to remember entries for plugins | ||
383 | // that seem missing. This way we never loose data | ||
384 | // | ||
385 | |||
386 | class FakeNetNode : public ANetNode { | ||
387 | |||
388 | public: | ||
389 | |||
390 | FakeNetNode( ) { }; | ||
391 | virtual ~FakeNetNode(){}; | ||
392 | |||
393 | const QString pixmapName() | ||
394 | { return QString(""); } | ||
395 | const QString nodeName() | ||
396 | { return QString("Fake node" ); } | ||
397 | const QString nodeDescription() | ||
398 | { return QString("Fake node" ); } | ||
399 | ANetNodeInstance * createInstance( void ); | ||
400 | const char * provides( void ) | ||
401 | { return ""; } | ||
402 | virtual const char ** needs( void ) | ||
403 | { return 0; } | ||
404 | virtual bool generateProperFilesFor( ANetNodeInstance * ) | ||
405 | { return 0; } | ||
406 | virtual bool hasDataFor( const QString & ) | ||
407 | { return 0; } | ||
408 | virtual bool generateDeviceDataForCommonFile( | ||
409 | SystemFile & , long ) | ||
410 | {return 1; } | ||
411 | |||
412 | private : | ||
413 | |||
414 | }; | ||
415 | |||
416 | class FakeNetNodeInstance : public ANetNodeInstance { | ||
417 | |||
418 | public: | ||
419 | |||
420 | FakeNetNodeInstance( ANetNode * NN ) : | ||
421 | ANetNodeInstance( NN ), ValAttrPairs() { } | ||
422 | virtual ~FakeNetNodeInstance( void ) { } | ||
423 | |||
424 | virtual RuntimeInfo * runtime( void ) | ||
425 | { return 0; } | ||
426 | |||
427 | // create edit widget under parent | ||
428 | virtual QWidget * edit( QWidget * ) | ||
429 | { return 0; } | ||
430 | // is given data acceptable | ||
431 | virtual QString acceptable( void ) | ||
432 | { return QString(""); } | ||
433 | |||
434 | // get data from GUI and store in node | ||
435 | virtual void commit( void ) {} | ||
436 | |||
437 | // get next node | ||
438 | ANetNodeInstance * nextNode() | ||
439 | { return 0; } | ||
440 | // return NetNode this is an instance of | ||
441 | |||
442 | // intialize am instance of a net node | ||
443 | void initialize( void ){} | ||
444 | |||
445 | // returns node specific data -> only useful for 'buddy' | ||
446 | virtual void * data( void ) | ||
447 | { return 0; } | ||
448 | |||
449 | virtual bool hasDataFor( const QString & ) | ||
450 | { return 0; } | ||
451 | |||
452 | virtual bool generateDataForCommonFile( SystemFile & , long ) | ||
453 | { return 1; } | ||
454 | |||
455 | protected : | ||
456 | |||
457 | virtual void setSpecificAttribute( QString & , QString & ); | ||
458 | virtual void saveSpecificAttribute( QTextStream & ); | ||
459 | |||
460 | QDict<QString> ValAttrPairs; | ||
461 | }; | ||
462 | |||
463 | extern FakeNetNode * FakeNode; | ||
464 | |||
465 | #endif | 389 | #endif |
diff --git a/noncore/settings/networksettings2/networksettings2/resources.h b/noncore/settings/networksettings2/networksettings2/resources.h index 3048fb3..7050f10 100644 --- a/noncore/settings/networksettings2/networksettings2/resources.h +++ b/noncore/settings/networksettings2/networksettings2/resources.h | |||
@@ -50,33 +50,33 @@ public : | |||
50 | { return *TheSystem; } | 50 | { return *TheSystem; } |
51 | 51 | ||
52 | QPixmap getPixmap( const QString & Name ); | 52 | QPixmap getPixmap( const QString & Name ); |
53 | 53 | ||
54 | Name2NetNode_t & netNodes( void ) | 54 | Name2NetNode_t & netNodes( void ) |
55 | { return AllNodeTypes; } | 55 | { return AllNodeTypes; } |
56 | bool netNodeExists( const QString & X ) | 56 | bool netNodeExists( const QString & X ) |
57 | { return AllNodeTypes.find(X)!=0; } | 57 | { return AllNodeTypes.find(X)!=0; } |
58 | ANetNode * findNetNode( const QString & N ) | ||
59 | { NetNode_t * NNT = AllNodeTypes.find(N); | ||
60 | return (NNT) ? NNT->NetNode : 0; | ||
61 | } | ||
58 | 62 | ||
59 | Name2SystemFile_t & systemFiles( void ) | 63 | Name2SystemFile_t & systemFiles( void ) |
60 | { return SystemFiles; } | 64 | { return SystemFiles; } |
61 | void addSystemFile( SystemFile * SF ) | 65 | void addSystemFile( SystemFile * SF ) |
62 | { SystemFiles.insert( SF->name(), SF ); } | 66 | { SystemFiles.insert( SF->name(), SF ); } |
63 | 67 | ||
64 | ANetNodeInstance * createNodeInstance( const QString & S ) | 68 | ANetNodeInstance * createNodeInstance( const QString & S ) |
65 | { ANetNodeInstance * NNI = 0; | 69 | { ANetNodeInstance * NNI = 0; |
66 | NetNode_t * NNT = AllNodeTypes[S]; | 70 | NetNode_t * NNT = AllNodeTypes[S]; |
67 | ANetNode * NN; | ||
68 | if( ! NNT ) { | 71 | if( ! NNT ) { |
69 | NN = FakeNode = | 72 | return 0; |
70 | ( FakeNode ) ? FakeNode : new FakeNetNode(); | ||
71 | } else { | ||
72 | NN = NNT->NetNode; | ||
73 | } | 73 | } |
74 | NNI = NN->createInstance(); | 74 | NNI = NNT->NetNode->createInstance(); |
75 | NNI->initialize(); | 75 | NNI->initialize(); |
76 | return NNI; | 76 | return NNI; |
77 | } | 77 | } |
78 | 78 | ||
79 | Name2Instance_t & netNodeInstances( void ) | 79 | Name2Instance_t & netNodeInstances( void ) |
80 | { return AllNodes; } | 80 | { return AllNodes; } |
81 | void addNodeInstance( ANetNodeInstance * I ) | 81 | void addNodeInstance( ANetNodeInstance * I ) |
82 | { AllNodes.insert( I->nodeName(), I ); } | 82 | { AllNodes.insert( I->nodeName(), I ); } |
diff --git a/noncore/settings/networksettings2/nsdata.cpp b/noncore/settings/networksettings2/nsdata.cpp index b4d9aaa..13979ce 100644 --- a/noncore/settings/networksettings2/nsdata.cpp +++ b/noncore/settings/networksettings2/nsdata.cpp | |||
@@ -26,18 +26,17 @@ NetworkSettingsData::NetworkSettingsData( void ) { | |||
26 | } | 26 | } |
27 | 27 | ||
28 | // saving is done by caller | 28 | // saving is done by caller |
29 | NetworkSettingsData::~NetworkSettingsData( void ) { | 29 | NetworkSettingsData::~NetworkSettingsData( void ) { |
30 | delete NSResources; | 30 | delete NSResources; |
31 | } | 31 | } |
32 | 32 | ||
33 | void NetworkSettingsData::loadSettings( void ) { | 33 | void NetworkSettingsData::loadSettings( void ) { |
34 | QString S; | 34 | QString Line, S; |
35 | ANetNodeInstance* NNI; | ||
36 | QString Attr, Value; | 35 | QString Attr, Value; |
37 | long idx; | 36 | long idx; |
38 | 37 | ||
39 | QFile F( CfgFile ); | 38 | QFile F( CfgFile ); |
40 | QTextStream TS( &F ); | 39 | QTextStream TS( &F ); |
41 | 40 | ||
42 | do { | 41 | do { |
43 | 42 | ||
@@ -52,65 +51,82 @@ void NetworkSettingsData::loadSettings( void ) { | |||
52 | Entries ... | 51 | Entries ... |
53 | <EMPTYLINE> | 52 | <EMPTYLINE> |
54 | [connection] | 53 | [connection] |
55 | Name=Name | 54 | Name=Name |
56 | Node=Name | 55 | Node=Name |
57 | <EMPTYLINE> | 56 | <EMPTYLINE> |
58 | */ | 57 | */ |
59 | while( ! TS.atEnd() ) { | 58 | while( ! TS.atEnd() ) { |
60 | S = TS.readLine(); | 59 | S = Line = TS.readLine(); |
61 | 60 | ||
62 | if ( S.isEmpty() || S[0] != '[' ) | 61 | if ( S.isEmpty() || S[0] != '[' ) |
63 | continue; | 62 | continue; |
64 | 63 | ||
65 | S = S.mid( 1, S.length()-2 ); | 64 | S = S.mid( 1, S.length()-2 ); |
66 | 65 | ||
67 | if( ! NSResources ) { | 66 | if( ! NSResources ) { |
68 | continue; | 67 | continue; |
69 | } | 68 | } |
70 | 69 | ||
71 | if( S == "connection" ) { | 70 | if( S == "connection" ) { |
72 | // load connections -> collections of nodes | 71 | // load connections -> collections of nodes |
73 | NodeCollection * NC = new NodeCollection( TS ); | 72 | NodeCollection * NC = new NodeCollection( TS ); |
74 | NSResources->addConnection( NC ); | 73 | NSResources->addConnection( NC ); |
75 | } else { | 74 | } else { |
76 | // load nodes | 75 | ANetNode * NN = 0; |
77 | NNI = NSResources->createNodeInstance( S ); | 76 | ANetNodeInstance* NNI = 0; |
78 | if( ! NNI ) { | 77 | if( S.startsWith( "nodetype " ) ) { |
79 | printf( "SKIPPING %s\n", S.latin1() ); | 78 | S = S.mid( 9, S.length()-9-1 ); |
79 | fprintf( stderr, "Node %s\n", S.latin1() ); | ||
80 | // try to find netnode | ||
81 | NN = NSResources->findNetNode( S ); | ||
82 | } else { | ||
83 | // try to find instance | ||
84 | NNI = NSResources->createNodeInstance( S ); | ||
80 | } | 85 | } |
81 | 86 | ||
82 | do { | 87 | do { |
83 | S = TS.readLine(); | 88 | S = TS.readLine(); |
84 | if( S.isEmpty() ) { | 89 | |
85 | // empty line | 90 | if( NN || NNI ) { |
86 | break; | 91 | if( S.isEmpty() ) { |
87 | } | 92 | // empty line |
88 | // node found ? | 93 | break; |
89 | if( NNI ) { | 94 | } |
90 | idx = S.find( '=' ); | 95 | idx = S.find( '=' ); |
91 | if( idx > 0 ) { | 96 | if( idx > 0 ) { |
92 | Attr = S.left( idx ); | 97 | Attr = S.left( idx ); |
93 | Value = S.mid( idx+1, S.length() ); | 98 | Value = S.mid( idx+1, S.length() ); |
94 | } else { | 99 | } else { |
95 | Value=""; | 100 | Value=""; |
96 | Attr = S; | 101 | Attr = S; |
97 | } | 102 | } |
98 | 103 | ||
99 | Value.stripWhiteSpace(); | 104 | Value.stripWhiteSpace(); |
100 | Attr.stripWhiteSpace(); | 105 | Attr.stripWhiteSpace(); |
101 | Attr.lower(); | 106 | Attr.lower(); |
102 | // dequote Attr | 107 | // dequote Attr |
103 | Value = deQuote(Value); | 108 | Value = deQuote(Value); |
104 | 109 | ||
105 | // set the attribute | 110 | if( NN ) { |
106 | NNI->setAttribute( Attr, Value ); | 111 | // set the attribute |
112 | NNI->setAttribute( Attr, Value ); | ||
113 | } else { | ||
114 | // set the attribute | ||
115 | NNI->setAttribute( Attr, Value ); | ||
116 | } | ||
117 | } else { | ||
118 | LeftOvers.append( Line ); | ||
119 | // add empty line too as delimiter | ||
120 | if( S.isEmpty() ) { | ||
121 | // empty line | ||
122 | break; | ||
123 | } | ||
107 | } | 124 | } |
108 | |||
109 | } while( 1 ); | 125 | } while( 1 ); |
110 | if( NNI ) { | 126 | if( NNI ) { |
111 | // loading from file -> exists | 127 | // loading from file -> exists |
112 | NNI->setNew( FALSE ); | 128 | NNI->setNew( FALSE ); |
113 | NSResources->addNodeInstance( NNI ); | 129 | NSResources->addNodeInstance( NNI ); |
114 | } | 130 | } |
115 | } | 131 | } |
116 | } | 132 | } |
@@ -133,16 +149,35 @@ QString NetworkSettingsData::saveSettings( void ) { | |||
133 | ErrS = qApp->translate( "NetworkSettings", | 149 | ErrS = qApp->translate( "NetworkSettings", |
134 | "<p>Could not save setup to \"%1\" !</p>" ). | 150 | "<p>Could not save setup to \"%1\" !</p>" ). |
135 | arg(CfgFile); | 151 | arg(CfgFile); |
136 | // problem | 152 | // problem |
137 | return ErrS; | 153 | return ErrS; |
138 | } | 154 | } |
139 | 155 | ||
140 | QTextStream TS( &F ); | 156 | QTextStream TS( &F ); |
157 | |||
158 | // save leftovers | ||
159 | for ( QStringList::Iterator it = LeftOvers.begin(); | ||
160 | it != LeftOvers.end(); ++it ) { | ||
161 | TS << (*it) << endl; | ||
162 | } | ||
163 | |||
164 | // save global configs | ||
165 | for( QDictIterator<NetNode_t> it( NSResources->netNodes() ); | ||
166 | it.current(); | ||
167 | ++it ) { | ||
168 | TS << "[nodetype " | ||
169 | << it.current()->NetNode->name() | ||
170 | << "]" | ||
171 | << endl; | ||
172 | |||
173 | it.current()->NetNode->saveAttributes( TS ); | ||
174 | } | ||
175 | |||
141 | { Name2Connection_t & M = NSResources->connections(); | 176 | { Name2Connection_t & M = NSResources->connections(); |
142 | ANetNodeInstance * NNI; | 177 | ANetNodeInstance * NNI; |
143 | 178 | ||
144 | // for all connections | 179 | // for all connections |
145 | for( QDictIterator<NodeCollection> it(M); | 180 | for( QDictIterator<NodeCollection> it(M); |
146 | it.current(); | 181 | it.current(); |
147 | ++it ) { | 182 | ++it ) { |
148 | // all nodes in those connections | 183 | // all nodes in those connections |
diff --git a/noncore/settings/networksettings2/nsdata.h b/noncore/settings/networksettings2/nsdata.h index eb96930..57eb722 100644 --- a/noncore/settings/networksettings2/nsdata.h +++ b/noncore/settings/networksettings2/nsdata.h | |||
@@ -33,11 +33,14 @@ private : | |||
33 | QString NetworkSettingsData::generateSystemFileNode( | 33 | QString NetworkSettingsData::generateSystemFileNode( |
34 | SystemFile & SF, | 34 | SystemFile & SF, |
35 | AsDevice * CurDev, | 35 | AsDevice * CurDev, |
36 | ANetNodeInstance * DevNNI, | 36 | ANetNodeInstance * DevNNI, |
37 | long DevInstNr ); | 37 | long DevInstNr ); |
38 | bool IsModified; | 38 | bool IsModified; |
39 | bool Force; | 39 | bool Force; |
40 | 40 | ||
41 | // collect strings in config file nobody wants | ||
42 | QStringList LeftOvers; | ||
43 | |||
41 | }; | 44 | }; |
42 | 45 | ||
43 | #endif | 46 | #endif |
diff --git a/noncore/settings/networksettings2/ppp/ppp_NN.cpp b/noncore/settings/networksettings2/ppp/ppp_NN.cpp index b3f70c5..0bf415b 100644 --- a/noncore/settings/networksettings2/ppp/ppp_NN.cpp +++ b/noncore/settings/networksettings2/ppp/ppp_NN.cpp | |||
@@ -50,13 +50,19 @@ bool PPPNetNode::generateDeviceDataForCommonFile( | |||
50 | return 1; | 50 | return 1; |
51 | } | 51 | } |
52 | 52 | ||
53 | QString PPPNetNode::genNic( long NicNr ) { | 53 | QString PPPNetNode::genNic( long NicNr ) { |
54 | QString S; | 54 | QString S; |
55 | return S.sprintf( "ppp%ld", NicNr ); | 55 | return S.sprintf( "ppp%ld", NicNr ); |
56 | } | 56 | } |
57 | 57 | ||
58 | void PPPNetNode::setSpecificAttribute( QString & , QString & ) { | ||
59 | } | ||
60 | |||
61 | void PPPNetNode::saveSpecificAttribute( QTextStream & ) { | ||
62 | } | ||
63 | |||
58 | extern "C" { | 64 | extern "C" { |
59 | void create_plugin( QList<ANetNode> & PNN ) { | 65 | void create_plugin( QList<ANetNode> & PNN ) { |
60 | PNN.append( new PPPNetNode() ); | 66 | PNN.append( new PPPNetNode() ); |
61 | } | 67 | } |
62 | } | 68 | } |
diff --git a/noncore/settings/networksettings2/ppp/ppp_NN.h b/noncore/settings/networksettings2/ppp/ppp_NN.h index c33f281..fbbbbe1 100644 --- a/noncore/settings/networksettings2/ppp/ppp_NN.h +++ b/noncore/settings/networksettings2/ppp/ppp_NN.h | |||
@@ -32,16 +32,18 @@ public: | |||
32 | { return 0; } | 32 | { return 0; } |
33 | virtual bool generateDeviceDataForCommonFile( | 33 | virtual bool generateDeviceDataForCommonFile( |
34 | SystemFile & SF, long DevNr ); | 34 | SystemFile & SF, long DevNr ); |
35 | 35 | ||
36 | virtual QString genNic( long NicNr ); | 36 | virtual QString genNic( long NicNr ); |
37 | 37 | ||
38 | private: | 38 | private: |
39 | 39 | ||
40 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | ||
41 | virtual void saveSpecificAttribute( QTextStream & TS ); | ||
40 | }; | 42 | }; |
41 | 43 | ||
42 | extern "C" | 44 | extern "C" |
43 | { | 45 | { |
44 | void create_plugin( QList<ANetNode> & PNN ); | 46 | void create_plugin( QList<ANetNode> & PNN ); |
45 | }; | 47 | }; |
46 | 48 | ||
47 | #endif | 49 | #endif |
diff --git a/noncore/settings/networksettings2/profile/profile_NN.cpp b/noncore/settings/networksettings2/profile/profile_NN.cpp index 7609cdc..0f71dc7 100644 --- a/noncore/settings/networksettings2/profile/profile_NN.cpp +++ b/noncore/settings/networksettings2/profile/profile_NN.cpp | |||
@@ -44,13 +44,19 @@ bool ProfileNetNode::generateProperFilesFor( | |||
44 | } | 44 | } |
45 | 45 | ||
46 | bool ProfileNetNode::generateDeviceDataForCommonFile( | 46 | bool ProfileNetNode::generateDeviceDataForCommonFile( |
47 | SystemFile & , | 47 | SystemFile & , |
48 | long ) { | 48 | long ) { |
49 | return 1; | 49 | return 1; |
50 | } | 50 | } |
51 | 51 | ||
52 | void ProfileNetNode::setSpecificAttribute( QString & , QString & ) { | ||
53 | } | ||
54 | |||
55 | void ProfileNetNode::saveSpecificAttribute( QTextStream & ) { | ||
56 | } | ||
57 | |||
52 | extern "C" { | 58 | extern "C" { |
53 | void create_plugin( QList<ANetNode> & PNN ) { | 59 | void create_plugin( QList<ANetNode> & PNN ) { |
54 | PNN.append( new ProfileNetNode() ); | 60 | PNN.append( new ProfileNetNode() ); |
55 | } | 61 | } |
56 | } | 62 | } |
diff --git a/noncore/settings/networksettings2/profile/profile_NN.h b/noncore/settings/networksettings2/profile/profile_NN.h index f7c2b22..1313ab2 100644 --- a/noncore/settings/networksettings2/profile/profile_NN.h +++ b/noncore/settings/networksettings2/profile/profile_NN.h | |||
@@ -30,16 +30,18 @@ public: | |||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | virtual bool hasDataFor( const QString & ) | 31 | virtual bool hasDataFor( const QString & ) |
32 | { return 0; } | 32 | { return 0; } |
33 | virtual bool generateDeviceDataForCommonFile( | 33 | virtual bool generateDeviceDataForCommonFile( |
34 | SystemFile & SF, long DevNr); | 34 | SystemFile & SF, long DevNr); |
35 | 35 | ||
36 | private: | 36 | private: |
37 | 37 | ||
38 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | ||
39 | virtual void saveSpecificAttribute( QTextStream & TS ); | ||
38 | }; | 40 | }; |
39 | 41 | ||
40 | extern "C" | 42 | extern "C" |
41 | { | 43 | { |
42 | void create_plugin( QList<ANetNode> & PNN ); | 44 | void create_plugin( QList<ANetNode> & PNN ); |
43 | }; | 45 | }; |
44 | 46 | ||
45 | #endif | 47 | #endif |
diff --git a/noncore/settings/networksettings2/usb/usb_NN.cpp b/noncore/settings/networksettings2/usb/usb_NN.cpp index 30c72db..d5971cf 100644 --- a/noncore/settings/networksettings2/usb/usb_NN.cpp +++ b/noncore/settings/networksettings2/usb/usb_NN.cpp | |||
@@ -59,13 +59,19 @@ bool USBNetNode::generateDeviceDataForCommonFile( | |||
59 | } | 59 | } |
60 | return 0; | 60 | return 0; |
61 | } | 61 | } |
62 | 62 | ||
63 | QString USBNetNode::genNic( long ) { | 63 | QString USBNetNode::genNic( long ) { |
64 | return QString( "usbf" ); | 64 | return QString( "usbf" ); |
65 | } | 65 | } |
66 | 66 | ||
67 | void USBNetNode::setSpecificAttribute( QString & , QString & ) { | ||
68 | } | ||
69 | |||
70 | void USBNetNode::saveSpecificAttribute( QTextStream & ) { | ||
71 | } | ||
72 | |||
67 | extern "C" { | 73 | extern "C" { |
68 | void create_plugin( QList<ANetNode> & PNN ) { | 74 | void create_plugin( QList<ANetNode> & PNN ) { |
69 | PNN.append( new USBNetNode() ); | 75 | PNN.append( new USBNetNode() ); |
70 | } | 76 | } |
71 | } | 77 | } |
diff --git a/noncore/settings/networksettings2/usb/usb_NN.h b/noncore/settings/networksettings2/usb/usb_NN.h index ba22b1c..0b83ea6 100644 --- a/noncore/settings/networksettings2/usb/usb_NN.h +++ b/noncore/settings/networksettings2/usb/usb_NN.h | |||
@@ -31,16 +31,18 @@ public: | |||
31 | virtual bool hasDataFor( const QString & S); | 31 | virtual bool hasDataFor( const QString & S); |
32 | virtual bool generateDeviceDataForCommonFile( | 32 | virtual bool generateDeviceDataForCommonFile( |
33 | SystemFile & SF, long DevNr ); | 33 | SystemFile & SF, long DevNr ); |
34 | 34 | ||
35 | virtual QString genNic( long nr ); | 35 | virtual QString genNic( long nr ); |
36 | 36 | ||
37 | private: | 37 | private: |
38 | 38 | ||
39 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | ||
40 | virtual void saveSpecificAttribute( QTextStream & TS ); | ||
39 | }; | 41 | }; |
40 | 42 | ||
41 | extern "C" | 43 | extern "C" |
42 | { | 44 | { |
43 | void create_plugin( QList<ANetNode> & PNN ); | 45 | void create_plugin( QList<ANetNode> & PNN ); |
44 | }; | 46 | }; |
45 | 47 | ||
46 | #endif | 48 | #endif |
diff --git a/noncore/settings/networksettings2/vpn/vpn_NN.cpp b/noncore/settings/networksettings2/vpn/vpn_NN.cpp index d9aa892..307e9dd 100644 --- a/noncore/settings/networksettings2/vpn/vpn_NN.cpp +++ b/noncore/settings/networksettings2/vpn/vpn_NN.cpp | |||
@@ -44,13 +44,19 @@ bool VPNNetNode::generateProperFilesFor( | |||
44 | } | 44 | } |
45 | 45 | ||
46 | bool VPNNetNode::generateDeviceDataForCommonFile( | 46 | bool VPNNetNode::generateDeviceDataForCommonFile( |
47 | SystemFile & , | 47 | SystemFile & , |
48 | long ) { | 48 | long ) { |
49 | return 1; | 49 | return 1; |
50 | } | 50 | } |
51 | 51 | ||
52 | void VPNNetNode::setSpecificAttribute( QString & , QString & ) { | ||
53 | } | ||
54 | |||
55 | void VPNNetNode::saveSpecificAttribute( QTextStream & ) { | ||
56 | } | ||
57 | |||
52 | extern "C" { | 58 | extern "C" { |
53 | void create_plugin( QList<ANetNode> & PNN ) { | 59 | void create_plugin( QList<ANetNode> & PNN ) { |
54 | PNN.append( new VPNNetNode() ); | 60 | PNN.append( new VPNNetNode() ); |
55 | } | 61 | } |
56 | } | 62 | } |
diff --git a/noncore/settings/networksettings2/vpn/vpn_NN.h b/noncore/settings/networksettings2/vpn/vpn_NN.h index 7ce8e3a..1cd3fcc 100644 --- a/noncore/settings/networksettings2/vpn/vpn_NN.h +++ b/noncore/settings/networksettings2/vpn/vpn_NN.h | |||
@@ -30,16 +30,18 @@ public: | |||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | virtual bool hasDataFor( const QString & ) | 31 | virtual bool hasDataFor( const QString & ) |
32 | { return 0; } | 32 | { return 0; } |
33 | virtual bool generateDeviceDataForCommonFile( | 33 | virtual bool generateDeviceDataForCommonFile( |
34 | SystemFile & SF, long DevNr ); | 34 | SystemFile & SF, long DevNr ); |
35 | 35 | ||
36 | private: | 36 | private: |
37 | 37 | ||
38 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | ||
39 | virtual void saveSpecificAttribute( QTextStream & TS ); | ||
38 | }; | 40 | }; |
39 | 41 | ||
40 | extern "C" | 42 | extern "C" |
41 | { | 43 | { |
42 | void create_plugin( QList<ANetNode> & PNN ); | 44 | void create_plugin( QList<ANetNode> & PNN ); |
43 | }; | 45 | }; |
44 | 46 | ||
45 | #endif | 47 | #endif |
diff --git a/noncore/settings/networksettings2/wlan/wlan_NN.cpp b/noncore/settings/networksettings2/wlan/wlan_NN.cpp index 4e59ac1..e0c4db2 100644 --- a/noncore/settings/networksettings2/wlan/wlan_NN.cpp +++ b/noncore/settings/networksettings2/wlan/wlan_NN.cpp | |||
@@ -4,16 +4,17 @@ | |||
4 | static const char * WLanNeeds[] = | 4 | static const char * WLanNeeds[] = |
5 | { 0 | 5 | { 0 |
6 | }; | 6 | }; |
7 | 7 | ||
8 | /** | 8 | /** |
9 | * Constructor, find all of the possible interfaces | 9 | * Constructor, find all of the possible interfaces |
10 | */ | 10 | */ |
11 | WLanNetNode::WLanNetNode() : ANetNode() { | 11 | WLanNetNode::WLanNetNode() : ANetNode() { |
12 | InstanceCount = 2; | ||
12 | } | 13 | } |
13 | 14 | ||
14 | /** | 15 | /** |
15 | * Delete any interfaces that we own. | 16 | * Delete any interfaces that we own. |
16 | */ | 17 | */ |
17 | WLanNetNode::~WLanNetNode(){ | 18 | WLanNetNode::~WLanNetNode(){ |
18 | } | 19 | } |
19 | 20 | ||
@@ -60,13 +61,25 @@ bool WLanNetNode::generateDeviceDataForCommonFile( | |||
60 | return 0; | 61 | return 0; |
61 | } | 62 | } |
62 | 63 | ||
63 | QString WLanNetNode::genNic( long nr ) { | 64 | QString WLanNetNode::genNic( long nr ) { |
64 | QString S; | 65 | QString S; |
65 | return S.sprintf( "wlan%ld", nr ); | 66 | return S.sprintf( "wlan%ld", nr ); |
66 | } | 67 | } |
67 | 68 | ||
69 | void WLanNetNode::setSpecificAttribute( QString & A, QString & V ) { | ||
70 | if( A == "interfacecount" ) { | ||
71 | InstanceCount = V.toLong(); | ||
72 | } | ||
73 | } | ||
74 | |||
75 | void WLanNetNode::saveSpecificAttribute( QTextStream & TS ) { | ||
76 | TS << "interfacecount=" | ||
77 | << InstanceCount | ||
78 | << endl; | ||
79 | } | ||
80 | |||
68 | extern "C" { | 81 | extern "C" { |
69 | void create_plugin( QList<ANetNode> & PNN ) { | 82 | void create_plugin( QList<ANetNode> & PNN ) { |
70 | PNN.append( new WLanNetNode() ); | 83 | PNN.append( new WLanNetNode() ); |
71 | } | 84 | } |
72 | } | 85 | } |
diff --git a/noncore/settings/networksettings2/wlan/wlan_NN.h b/noncore/settings/networksettings2/wlan/wlan_NN.h index f27e71c..e93a89a 100644 --- a/noncore/settings/networksettings2/wlan/wlan_NN.h +++ b/noncore/settings/networksettings2/wlan/wlan_NN.h | |||
@@ -29,22 +29,28 @@ public: | |||
29 | 29 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | 31 | ||
32 | virtual bool hasDataFor( const QString & S ); | 32 | virtual bool hasDataFor( const QString & S ); |
33 | virtual bool generateDeviceDataForCommonFile( | 33 | virtual bool generateDeviceDataForCommonFile( |
34 | SystemFile & SF, long DevNr ); | 34 | SystemFile & SF, long DevNr ); |
35 | 35 | ||
36 | virtual long instanceCount( void ) | 36 | virtual long instanceCount( void ) |
37 | { return 2; } | 37 | { return InstanceCount; } |
38 | 38 | ||
39 | virtual QString genNic( long ); | 39 | virtual QString genNic( long ); |
40 | 40 | ||
41 | private: | 41 | private: |
42 | 42 | ||
43 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | ||
44 | virtual void saveSpecificAttribute( QTextStream & TS ); | ||
45 | |||
46 | // number of interfaces for this device | ||
47 | long InstanceCount; | ||
48 | |||
43 | }; | 49 | }; |
44 | 50 | ||
45 | extern "C" | 51 | extern "C" |
46 | { | 52 | { |
47 | void create_plugin( QList<ANetNode> & PNN ); | 53 | void create_plugin( QList<ANetNode> & PNN ); |
48 | }; | 54 | }; |
49 | 55 | ||
50 | #endif | 56 | #endif |