60 files changed, 435 insertions, 505 deletions
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NNI.h b/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NNI.h index a21f574..bb3e7e7 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NNI.h +++ b/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NNI.h | |||
@@ -22,16 +22,19 @@ public : | |||
22 | { if( RT == 0 ) | 22 | { if( RT == 0 ) |
23 | RT = new BluetoothBNEPRun( this, Data ); | 23 | RT = new BluetoothBNEPRun( 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 | virtual bool hasDataFor( const QString & S ); | ||
31 | virtual bool generateDataForCommonFile( SystemFile & SF, long ); | ||
32 | |||
30 | protected : | 33 | protected : |
31 | 34 | ||
32 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 35 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
33 | virtual void saveSpecificAttribute( QTextStream & TS ); | 36 | virtual void saveSpecificAttribute( QTextStream & TS ); |
34 | 37 | ||
35 | private : | 38 | private : |
36 | 39 | ||
37 | BluetoothBNEPEdit * GUI; | 40 | BluetoothBNEPEdit * GUI; |
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h index 347da0c..4a773cd 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h +++ b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h | |||
@@ -4,21 +4,16 @@ | |||
4 | class BluetoothBNEPRun : public AsDevice { | 4 | class BluetoothBNEPRun : public AsDevice { |
5 | 5 | ||
6 | public : | 6 | public : |
7 | 7 | ||
8 | BluetoothBNEPRun( ANetNodeInstance * NNI, | 8 | BluetoothBNEPRun( ANetNodeInstance * NNI, |
9 | BluetoothBNEPData & Data ) : AsDevice( NNI ) | 9 | BluetoothBNEPData & Data ) : AsDevice( NNI ) |
10 | { } | 10 | { } |
11 | 11 | ||
12 | virtual long count( void ) | ||
13 | { return 3; } | ||
14 | virtual QString genNic( long nr ) | ||
15 | { QString S; return S.sprintf( "bnep%ld", nr ); } | ||
16 | |||
17 | virtual AsDevice * asDevice( void ) | 12 | virtual AsDevice * asDevice( void ) |
18 | { return (AsDevice *)this; } | 13 | { return (AsDevice *)this; } |
19 | 14 | ||
20 | virtual AsDevice * device( void ) | 15 | virtual AsDevice * device( void ) |
21 | { return asDevice(); } | 16 | { return asDevice(); } |
22 | 17 | ||
23 | protected : | 18 | protected : |
24 | 19 | ||
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.h b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.h index 57ff95e..97bd29c 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.h +++ b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.h | |||
@@ -22,16 +22,19 @@ public : | |||
22 | { if( RT == 0 ) | 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 | virtual bool hasDataFor( const QString & S ); | ||
31 | virtual bool generateDataForCommonFile( SystemFile & SF, long ); | ||
32 | |||
30 | protected : | 33 | protected : |
31 | 34 | ||
32 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 35 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
33 | virtual void saveSpecificAttribute( QTextStream & TS ); | 36 | virtual void saveSpecificAttribute( QTextStream & TS ); |
34 | 37 | ||
35 | private : | 38 | private : |
36 | 39 | ||
37 | BluetoothRFCOMMEdit * GUI; | 40 | BluetoothRFCOMMEdit * GUI; |
diff --git a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp index 47272c4..3d1aa69 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp +++ b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp | |||
@@ -44,32 +44,29 @@ const char * BluetoothBNEPNetNode::provides( void ) { | |||
44 | return "device"; | 44 | return "device"; |
45 | } | 45 | } |
46 | 46 | ||
47 | bool BluetoothBNEPNetNode::generateProperFilesFor( | 47 | bool BluetoothBNEPNetNode::generateProperFilesFor( |
48 | ANetNodeInstance * ) { | 48 | ANetNodeInstance * ) { |
49 | return 1; | 49 | return 1; |
50 | } | 50 | } |
51 | 51 | ||
52 | bool BluetoothBNEPNetNode::hasDataFor( const QString & S, bool DS ) { | 52 | bool BluetoothBNEPNetNode::hasDataFor( const QString & S ) { |
53 | return DS && S == "interfaces"; | 53 | return S == "interfaces"; |
54 | } | 54 | } |
55 | 55 | ||
56 | bool BluetoothBNEPNetNode::generateDataForCommonFile( | 56 | bool BluetoothBNEPNetNode::generateDeviceDataForCommonFile( |
57 | SystemFile & , | 57 | SystemFile & , |
58 | long , | 58 | long ) { |
59 | ANetNodeInstance * ) { | ||
60 | return 1; | 59 | return 1; |
61 | } | 60 | } |
62 | 61 | ||
63 | bool BluetoothBNEPNetNode::generateDeviceDataForCommonFile( | 62 | QString BluetoothBNEPNetNode::genNic( long nr ) { |
64 | SystemFile & , | 63 | QString S; |
65 | long , | 64 | return S.sprintf( "bnep%ld", nr ); |
66 | ANetNodeInstance * ) { | ||
67 | return 1; | ||
68 | } | 65 | } |
69 | 66 | ||
70 | // | 67 | // |
71 | // | 68 | // |
72 | // BLUETOOTH PAN/NAP node | 69 | // BLUETOOTH PAN/NAP node |
73 | // | 70 | // |
74 | // | 71 | // |
75 | 72 | ||
@@ -103,24 +100,23 @@ const char * BluetoothRFCOMMNetNode::provides( void ) { | |||
103 | return "line"; | 100 | return "line"; |
104 | } | 101 | } |
105 | 102 | ||
106 | bool BluetoothRFCOMMNetNode::generateProperFilesFor( | 103 | bool BluetoothRFCOMMNetNode::generateProperFilesFor( |
107 | ANetNodeInstance * ) { | 104 | ANetNodeInstance * ) { |
108 | return 0; | 105 | return 0; |
109 | } | 106 | } |
110 | 107 | ||
111 | bool BluetoothRFCOMMNetNode::hasDataFor( const QString &, bool ) { | 108 | bool BluetoothRFCOMMNetNode::hasDataFor( const QString & ) { |
112 | return 0; | 109 | return 0; |
113 | } | 110 | } |
114 | 111 | ||
115 | bool BluetoothRFCOMMNetNode::generateDataForCommonFile( | 112 | bool BluetoothRFCOMMNetNode::generateDeviceDataForCommonFile( |
116 | SystemFile & , | 113 | SystemFile & , |
117 | long, | 114 | long ) { |
118 | ANetNodeInstance * ) { | ||
119 | return 0; | 115 | return 0; |
120 | } | 116 | } |
121 | 117 | ||
122 | extern "C" { | 118 | extern "C" { |
123 | void create_plugin( QList<ANetNode> & PNN ) { | 119 | void create_plugin( QList<ANetNode> & PNN ) { |
124 | PNN.append( new BluetoothBNEPNetNode() ); | 120 | PNN.append( new BluetoothBNEPNetNode() ); |
125 | PNN.append( new BluetoothRFCOMMNetNode() ); | 121 | PNN.append( new BluetoothRFCOMMNetNode() ); |
126 | } | 122 | } |
diff --git a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h index d72b0d4..5cd6c52 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h +++ b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h | |||
@@ -23,21 +23,23 @@ public: | |||
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, bool DS ); | 31 | virtual bool hasDataFor( const QString & S ); |
32 | virtual bool generateDataForCommonFile( | ||
33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | ||
34 | virtual bool generateDeviceDataForCommonFile( | 32 | virtual bool generateDeviceDataForCommonFile( |
35 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | 33 | SystemFile & , long DevNr ); |
34 | |||
35 | virtual long instanceCount( void ) | ||
36 | { return 7; } | ||
37 | virtual QString genNic( long ); | ||
36 | 38 | ||
37 | private: | 39 | private: |
38 | 40 | ||
39 | }; | 41 | }; |
40 | 42 | ||
41 | class BluetoothRFCOMMNetNode : public ANetNode { | 43 | class BluetoothRFCOMMNetNode : public ANetNode { |
42 | 44 | ||
43 | Q_OBJECT | 45 | Q_OBJECT |
@@ -56,21 +58,19 @@ public: | |||
56 | virtual const QString nodeDescription() ; | 58 | virtual const QString nodeDescription() ; |
57 | 59 | ||
58 | virtual ANetNodeInstance * createInstance( void ); | 60 | virtual ANetNodeInstance * createInstance( void ); |
59 | 61 | ||
60 | virtual const char ** needs( void ); | 62 | virtual const char ** needs( void ); |
61 | virtual const char * provides( void ); | 63 | virtual const char * provides( void ); |
62 | 64 | ||
63 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 65 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
64 | virtual bool hasDataFor( const QString & S, bool ); | 66 | virtual bool hasDataFor( const QString & S ); |
65 | virtual bool generateDataForCommonFile( | ||
66 | SystemFile & SF, long, ANetNodeInstance * NNI ); | ||
67 | virtual bool generateDeviceDataForCommonFile( | 67 | virtual bool generateDeviceDataForCommonFile( |
68 | SystemFile & SF, long, ANetNodeInstance * NNI ); | 68 | SystemFile & , long ); |
69 | 69 | ||
70 | private: | 70 | private: |
71 | 71 | ||
72 | }; | 72 | }; |
73 | 73 | ||
74 | extern "C" | 74 | extern "C" |
75 | { | 75 | { |
76 | void create_plugin( QList<ANetNode> & PNN ); | 76 | void create_plugin( QList<ANetNode> & PNN ); |
diff --git a/noncore/settings/networksettings2/cable/cable_NN.cpp b/noncore/settings/networksettings2/cable/cable_NN.cpp index 6f62772..a6be4d5 100644 --- a/noncore/settings/networksettings2/cable/cable_NN.cpp +++ b/noncore/settings/networksettings2/cable/cable_NN.cpp | |||
@@ -36,31 +36,19 @@ const char * CableNetNode::provides( void ) { | |||
36 | return "line"; | 36 | return "line"; |
37 | } | 37 | } |
38 | 38 | ||
39 | bool CableNetNode::generateProperFilesFor( | 39 | bool CableNetNode::generateProperFilesFor( |
40 | ANetNodeInstance * ) { | 40 | ANetNodeInstance * ) { |
41 | return 1; | 41 | return 1; |
42 | } | 42 | } |
43 | 43 | ||
44 | bool CableNetNode::hasDataFor( const QString &, bool ) { | ||
45 | return 0; | ||
46 | } | ||
47 | |||
48 | bool CableNetNode::generateDataForCommonFile( | ||
49 | SystemFile & , | ||
50 | long , | ||
51 | ANetNodeInstance * ) { | ||
52 | return 1; | ||
53 | } | ||
54 | |||
55 | bool CableNetNode::generateDeviceDataForCommonFile( | 44 | bool CableNetNode::generateDeviceDataForCommonFile( |
56 | SystemFile & , | 45 | SystemFile & , |
57 | long , | 46 | long ) { |
58 | ANetNodeInstance * ) { | ||
59 | return 1; | 47 | return 1; |
60 | } | 48 | } |
61 | 49 | ||
62 | extern "C" { | 50 | extern "C" { |
63 | void create_plugin( QList<ANetNode> & PNN ) { | 51 | void create_plugin( QList<ANetNode> & PNN ) { |
64 | PNN.append( new CableNetNode() ); | 52 | PNN.append( new CableNetNode() ); |
65 | } | 53 | } |
66 | } | 54 | } |
diff --git a/noncore/settings/networksettings2/cable/cable_NN.h b/noncore/settings/networksettings2/cable/cable_NN.h index 3875af6..83b98e0 100644 --- a/noncore/settings/networksettings2/cable/cable_NN.h +++ b/noncore/settings/networksettings2/cable/cable_NN.h | |||
@@ -23,21 +23,20 @@ public: | |||
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, bool DS ); | 31 | virtual bool hasDataFor( const QString & ) |
32 | virtual bool generateDataForCommonFile( | 32 | { return 0; } |
33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | ||
34 | virtual bool generateDeviceDataForCommonFile( | 33 | virtual bool generateDeviceDataForCommonFile( |
35 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | 34 | SystemFile & SF, long DevNr); |
36 | 35 | ||
37 | private: | 36 | private: |
38 | 37 | ||
39 | }; | 38 | }; |
40 | 39 | ||
41 | extern "C" | 40 | extern "C" |
42 | { | 41 | { |
43 | void create_plugin( QList<ANetNode> & PNN ); | 42 | void create_plugin( QList<ANetNode> & PNN ); |
diff --git a/noncore/settings/networksettings2/cable/cable_NNI.cpp b/noncore/settings/networksettings2/cable/cable_NNI.cpp index d26afd1..ca21135 100644 --- a/noncore/settings/networksettings2/cable/cable_NNI.cpp +++ b/noncore/settings/networksettings2/cable/cable_NNI.cpp | |||
@@ -59,8 +59,15 @@ QString ACable::acceptable( void ) { | |||
59 | return ( GUI ) ? GUI->acceptable( ) : QString(); | 59 | return ( GUI ) ? GUI->acceptable( ) : QString(); |
60 | } | 60 | } |
61 | 61 | ||
62 | void ACable::commit( void ) { | 62 | void ACable::commit( void ) { |
63 | if( GUI && GUI->commit( Data ) ) { | 63 | if( GUI && GUI->commit( Data ) ) { |
64 | setModified( 1 ); | 64 | setModified( 1 ); |
65 | } | 65 | } |
66 | } | 66 | } |
67 | |||
68 | bool ACable::generateDataForCommonFile( | ||
69 | SystemFile & , | ||
70 | long ) { | ||
71 | return 1; | ||
72 | } | ||
73 | |||
diff --git a/noncore/settings/networksettings2/cable/cable_NNI.h b/noncore/settings/networksettings2/cable/cable_NNI.h index 0654a5d..bf3e292 100644 --- a/noncore/settings/networksettings2/cable/cable_NNI.h +++ b/noncore/settings/networksettings2/cable/cable_NNI.h | |||
@@ -22,16 +22,21 @@ public : | |||
22 | { if( RT == 0 ) | 22 | { if( RT == 0 ) |
23 | RT = new CableRun( this, Data ); | 23 | RT = new CableRun( 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 | virtual bool hasDataFor( const QString & ) | ||
31 | { return 0; } | ||
32 | virtual bool generateDataForCommonFile( | ||
33 | SystemFile & SF, long DevNr ); | ||
34 | |||
30 | protected : | 35 | protected : |
31 | 36 | ||
32 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 37 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
33 | virtual void saveSpecificAttribute( QTextStream & TS ); | 38 | virtual void saveSpecificAttribute( QTextStream & TS ); |
34 | 39 | ||
35 | private : | 40 | private : |
36 | 41 | ||
37 | CableEdit * GUI; | 42 | CableEdit * GUI; |
diff --git a/noncore/settings/networksettings2/editconnection.cpp b/noncore/settings/networksettings2/editconnection.cpp index ce13573..4bbe502 100644 --- a/noncore/settings/networksettings2/editconnection.cpp +++ b/noncore/settings/networksettings2/editconnection.cpp | |||
@@ -99,26 +99,24 @@ EditConnection::EditConnection( QWidget* parent ) : | |||
99 | 99 | ||
100 | NodeCollection * EditConnection::getTmpCollection( void ) { | 100 | NodeCollection * EditConnection::getTmpCollection( void ) { |
101 | 101 | ||
102 | if( TmpIsValid ) | 102 | if( TmpIsValid ) |
103 | // content is stil OK | 103 | // content is stil OK |
104 | return &(TmpCollection); | 104 | return &(TmpCollection); |
105 | 105 | ||
106 | // reset collection -> delete all NEW NetNodes | 106 | // reset collection -> delete all NEW NetNodes |
107 | { ANetNodeInstance * NNI; | 107 | for( QListIterator<ANetNodeInstance> it(TmpCollection); |
108 | for( QListIterator<ANetNodeInstance> it(TmpCollection); | 108 | it.current(); |
109 | it.current(); | 109 | ++it ) { |
110 | ++it ) { | 110 | if( it.current()->isNew() ) { |
111 | if( it.current()->isNew() ) { | 111 | delete it.current(); |
112 | delete it.current(); | ||
113 | } | ||
114 | } | 112 | } |
115 | TmpCollection.clear(); | ||
116 | } | 113 | } |
114 | TmpCollection.clear(); | ||
117 | 115 | ||
118 | // update content | 116 | // update content |
119 | QListViewItem * it = Nodes_LV->firstChild(); | 117 | QListViewItem * it = Nodes_LV->firstChild(); |
120 | ANetNode * NN; | 118 | ANetNode * NN; |
121 | // start iter | 119 | // start iter |
122 | ANetNodeInstance * NNI = | 120 | ANetNodeInstance * NNI = |
123 | (SelectedNodes) ? SelectedNodes->first() : 0 ; | 121 | (SelectedNodes) ? SelectedNodes->first() : 0 ; |
124 | 122 | ||
@@ -130,17 +128,17 @@ NodeCollection * EditConnection::getTmpCollection( void ) { | |||
130 | // child is controller -> has sub radio | 128 | // child is controller -> has sub radio |
131 | // check if one radio is selected | 129 | // check if one radio is selected |
132 | it = it->firstChild(); | 130 | it = it->firstChild(); |
133 | while( it ) { | 131 | while( it ) { |
134 | if( ((QCheckListItem *)it)->isOn() ) { | 132 | if( ((QCheckListItem *)it)->isOn() ) { |
135 | // this radio is selected -> go deeper | 133 | // this radio is selected -> go deeper |
136 | if( SelectedNodes == 0 || | 134 | if( SelectedNodes == 0 || |
137 | NNI == 0 || | 135 | NNI == 0 || |
138 | NNI->netNode()->nodeName() != it->text(0) ) { | 136 | NNI->nodeClass()->nodeName() != it->text(0) ) { |
139 | // new item not in previous collection | 137 | // new item not in previous collection |
140 | ANetNodeInstance * NNI = (*Mapping)[it]->createInstance(); | 138 | ANetNodeInstance * NNI = (*Mapping)[it]->createInstance(); |
141 | NNI->initialize(); | 139 | NNI->initialize(); |
142 | // this node type not in collection | 140 | // this node type not in collection |
143 | TmpCollection.append( NNI ); | 141 | TmpCollection.append( NNI ); |
144 | // master collection changed because new item in it | 142 | // master collection changed because new item in it |
145 | TmpCollection.setModified( 1 ); | 143 | TmpCollection.setModified( 1 ); |
146 | // no more valid items in old list | 144 | // no more valid items in old list |
@@ -193,20 +191,20 @@ void EditConnection::setConnection( NodeCollection * NC ) { | |||
193 | NN = (*Mapping)[it]; | 191 | NN = (*Mapping)[it]; |
194 | if( NN == 0 ) { | 192 | if( NN == 0 ) { |
195 | // child is controller -> has sub radio | 193 | // child is controller -> has sub radio |
196 | QString Ctr = it->text(0); | 194 | QString Ctr = it->text(0); |
197 | // check if one radio is selected | 195 | // check if one radio is selected |
198 | it = it->firstChild(); | 196 | it = it->firstChild(); |
199 | Found = 0; | 197 | Found = 0; |
200 | while( it ) { | 198 | while( it ) { |
201 | if( NNI && NNI->netNode()->nodeName() == it->text(0) ) { | 199 | if( NNI && NNI->nodeClass()->nodeName() == it->text(0) ) { |
202 | // this radio is part of the collection | 200 | // this radio is part of the collection |
203 | ((QCheckListItem *)it)->setOn( 1 ); | 201 | ((QCheckListItem *)it)->setOn( 1 ); |
204 | updateGUI( it, NNI->netNode() ); | 202 | updateGUI( it, NNI->nodeClass() ); |
205 | // check its children | 203 | // check its children |
206 | Found = 1; | 204 | Found = 1; |
207 | it = it->firstChild(); | 205 | it = it->firstChild(); |
208 | NNI = SelectedNodes->next(); | 206 | NNI = SelectedNodes->next(); |
209 | // do not bother to check other items | 207 | // do not bother to check other items |
210 | break; | 208 | break; |
211 | } | 209 | } |
212 | it = it->nextSibling(); | 210 | it = it->nextSibling(); |
@@ -235,23 +233,20 @@ NodeCollection * EditConnection::connection( void ) { | |||
235 | // new collection | 233 | // new collection |
236 | SelectedNodes = new NodeCollection; | 234 | SelectedNodes = new NodeCollection; |
237 | } | 235 | } |
238 | 236 | ||
239 | // clean out old entries | 237 | // clean out old entries |
240 | SelectedNodes->clear(); | 238 | SelectedNodes->clear(); |
241 | 239 | ||
242 | // transfer | 240 | // transfer |
243 | { ANetNodeInstance * NNI; | 241 | for( QListIterator<ANetNodeInstance> it(TmpCollection); |
244 | 242 | it.current(); | |
245 | for( QListIterator<ANetNodeInstance> it(TmpCollection); | 243 | ++it ) { |
246 | it.current(); | 244 | SelectedNodes->append( it.current() ); |
247 | ++it ) { | ||
248 | SelectedNodes->append( it.current() ); | ||
249 | } | ||
250 | } | 245 | } |
251 | 246 | ||
252 | if( TmpCollection.isModified() ) | 247 | if( TmpCollection.isModified() ) |
253 | SelectedNodes->setModified( 1 ); | 248 | SelectedNodes->setModified( 1 ); |
254 | 249 | ||
255 | if( SelectedNodes->name() != Name_LE->text() ) { | 250 | if( SelectedNodes->name() != Name_LE->text() ) { |
256 | SelectedNodes->setName( Name_LE->text() ); | 251 | SelectedNodes->setName( Name_LE->text() ); |
257 | SelectedNodes->setModified( 1 ); | 252 | SelectedNodes->setModified( 1 ); |
@@ -443,18 +438,18 @@ void EditConnection::SLOT_AlterTab( const QString & S ) { | |||
443 | { ANetNodeInstance * NNI; | 438 | { ANetNodeInstance * NNI; |
444 | QListIterator<ANetNodeInstance> it(TmpCollection); | 439 | QListIterator<ANetNodeInstance> it(TmpCollection); |
445 | int i = 0; | 440 | int i = 0; |
446 | QWidget * W; | 441 | QWidget * W; |
447 | 442 | ||
448 | for ( ; it.current(); ++it ) { | 443 | for ( ; it.current(); ++it ) { |
449 | NNI = it.current(); | 444 | NNI = it.current(); |
450 | Devices_CB->insertItem( | 445 | Devices_CB->insertItem( |
451 | NSResources->getPixmap( NNI->netNode()->pixmapName() ), | 446 | NSResources->getPixmap( NNI->nodeClass()->pixmapName() ), |
452 | NNI->netNode()->nodeName() | 447 | NNI->nodeClass()->nodeName() |
453 | ); | 448 | ); |
454 | 449 | ||
455 | // add edit widget | 450 | // add edit widget |
456 | W = NNI->edit( Setup_WS ); | 451 | W = NNI->edit( Setup_WS ); |
457 | if( ! W) { | 452 | if( ! W) { |
458 | W = new QLabel( Setup_WS, | 453 | W = new QLabel( Setup_WS, |
459 | tr("No configuration required")); | 454 | tr("No configuration required")); |
460 | } | 455 | } |
diff --git a/noncore/settings/networksettings2/irda/irda_NN.cpp b/noncore/settings/networksettings2/irda/irda_NN.cpp index 4347191..96327a5 100644 --- a/noncore/settings/networksettings2/irda/irda_NN.cpp +++ b/noncore/settings/networksettings2/irda/irda_NN.cpp | |||
@@ -36,31 +36,19 @@ const char * IRDANetNode::provides( void ) { | |||
36 | return "line"; | 36 | return "line"; |
37 | } | 37 | } |
38 | 38 | ||
39 | bool IRDANetNode::generateProperFilesFor( | 39 | bool IRDANetNode::generateProperFilesFor( |
40 | ANetNodeInstance * ) { | 40 | ANetNodeInstance * ) { |
41 | return 1; | 41 | return 1; |
42 | } | 42 | } |
43 | 43 | ||
44 | bool IRDANetNode::hasDataFor( const QString &, bool ) { | ||
45 | return 0; | ||
46 | } | ||
47 | |||
48 | bool IRDANetNode::generateDataForCommonFile( | ||
49 | SystemFile & , | ||
50 | long , | ||
51 | ANetNodeInstance * ) { | ||
52 | return 1; | ||
53 | } | ||
54 | |||
55 | bool IRDANetNode::generateDeviceDataForCommonFile( | 44 | bool IRDANetNode::generateDeviceDataForCommonFile( |
56 | SystemFile & , | 45 | SystemFile & , |
57 | long , | 46 | long ) { |
58 | ANetNodeInstance * ) { | ||
59 | return 1; | 47 | return 1; |
60 | } | 48 | } |
61 | 49 | ||
62 | extern "C" { | 50 | extern "C" { |
63 | void create_plugin( QList<ANetNode> & PNN ) { | 51 | void create_plugin( QList<ANetNode> & PNN ) { |
64 | PNN.append( new IRDANetNode() ); | 52 | PNN.append( new IRDANetNode() ); |
65 | } | 53 | } |
66 | } | 54 | } |
diff --git a/noncore/settings/networksettings2/irda/irda_NN.h b/noncore/settings/networksettings2/irda/irda_NN.h index a772f69..a5b6cc5 100644 --- a/noncore/settings/networksettings2/irda/irda_NN.h +++ b/noncore/settings/networksettings2/irda/irda_NN.h | |||
@@ -23,21 +23,20 @@ public: | |||
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, bool DS ); | 31 | virtual bool hasDataFor( const QString & ) |
32 | virtual bool generateDataForCommonFile( | 32 | { return 0; } |
33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | ||
34 | virtual bool generateDeviceDataForCommonFile( | 33 | virtual bool generateDeviceDataForCommonFile( |
35 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | 34 | SystemFile & SF, long DevNr ); |
36 | 35 | ||
37 | private: | 36 | private: |
38 | 37 | ||
39 | }; | 38 | }; |
40 | 39 | ||
41 | extern "C" | 40 | extern "C" |
42 | { | 41 | { |
43 | void create_plugin( QList<ANetNode> & PNN ); | 42 | void create_plugin( QList<ANetNode> & PNN ); |
diff --git a/noncore/settings/networksettings2/irda/irda_NNI.cpp b/noncore/settings/networksettings2/irda/irda_NNI.cpp index 78d6ff9..f00a1d5 100644 --- a/noncore/settings/networksettings2/irda/irda_NNI.cpp +++ b/noncore/settings/networksettings2/irda/irda_NNI.cpp | |||
@@ -23,8 +23,15 @@ QWidget * AIRDA::edit( QWidget * parent ) { | |||
23 | QString AIRDA::acceptable( void ) { | 23 | QString AIRDA::acceptable( void ) { |
24 | return ( GUI ) ? GUI->acceptable( ) : QString(); | 24 | return ( GUI ) ? GUI->acceptable( ) : QString(); |
25 | } | 25 | } |
26 | 26 | ||
27 | void AIRDA::commit( void ) { | 27 | void AIRDA::commit( void ) { |
28 | if( GUI && GUI->commit( Data ) ) | 28 | if( GUI && GUI->commit( Data ) ) |
29 | setModified( 1 ); | 29 | setModified( 1 ); |
30 | } | 30 | } |
31 | |||
32 | bool AIRDA::generateDataForCommonFile( | ||
33 | SystemFile & , | ||
34 | long ) { | ||
35 | return 1; | ||
36 | } | ||
37 | |||
diff --git a/noncore/settings/networksettings2/irda/irda_NNI.h b/noncore/settings/networksettings2/irda/irda_NNI.h index c2d6875..210d87d 100644 --- a/noncore/settings/networksettings2/irda/irda_NNI.h +++ b/noncore/settings/networksettings2/irda/irda_NNI.h | |||
@@ -22,16 +22,21 @@ public : | |||
22 | { if( RT == 0 ) | 22 | { if( RT == 0 ) |
23 | RT = new IRDARun( this, Data ); | 23 | RT = new IRDARun( 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 | virtual bool hasDataFor( const QString & ) | ||
31 | { return 0; } | ||
32 | virtual bool generateDataForCommonFile( | ||
33 | SystemFile & SF, long DevNr ); | ||
34 | |||
30 | protected : | 35 | protected : |
31 | 36 | ||
32 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 37 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
33 | virtual void saveSpecificAttribute( QTextStream & TS ); | 38 | virtual void saveSpecificAttribute( QTextStream & TS ); |
34 | 39 | ||
35 | private : | 40 | private : |
36 | 41 | ||
37 | IRDAEdit * GUI; | 42 | IRDAEdit * GUI; |
diff --git a/noncore/settings/networksettings2/lancard/lancard_NN.cpp b/noncore/settings/networksettings2/lancard/lancard_NN.cpp index 7d36918..480ddf9 100644 --- a/noncore/settings/networksettings2/lancard/lancard_NN.cpp +++ b/noncore/settings/networksettings2/lancard/lancard_NN.cpp | |||
@@ -37,31 +37,36 @@ const char * LanCardNetNode::provides( void ) { | |||
37 | return "device"; | 37 | return "device"; |
38 | } | 38 | } |
39 | 39 | ||
40 | bool LanCardNetNode::generateProperFilesFor( | 40 | bool LanCardNetNode::generateProperFilesFor( |
41 | ANetNodeInstance * ) { | 41 | ANetNodeInstance * ) { |
42 | return 1; | 42 | return 1; |
43 | } | 43 | } |
44 | 44 | ||
45 | bool LanCardNetNode::hasDataFor( const QString & S, bool DS ) { | 45 | bool LanCardNetNode::hasDataFor( const QString & S ) { |
46 | return DS && S == "interfaces"; | 46 | return S == "interfaces"; |
47 | } | ||
48 | |||
49 | bool LanCardNetNode::generateDataForCommonFile( | ||
50 | SystemFile & , | ||
51 | long , | ||
52 | ANetNodeInstance * ) { | ||
53 | return 1; | ||
54 | } | 47 | } |
55 | 48 | ||
56 | bool LanCardNetNode::generateDeviceDataForCommonFile( | 49 | bool LanCardNetNode::generateDeviceDataForCommonFile( |
57 | SystemFile & S , | 50 | SystemFile & S , |
58 | long DevNr , | 51 | long DevNr ) { |
59 | ANetNodeInstance * NNI ) { | 52 | QString NIC = genNic( DevNr ); |
60 | return ((ALanCard *)NNI)->generateDeviceDataForCommonFile(S, DevNr); | 53 | |
54 | if( S.name() == "interfaces" ) { | ||
55 | // generate mapping stanza for this interface | ||
56 | S << "# check if " << NIC << " can be brought UP" << endl; | ||
57 | S << "mapping " << NIC << endl; | ||
58 | S << " script networksettings2-request" << endl << endl; | ||
59 | } | ||
60 | return 0; | ||
61 | } | ||
62 | |||
63 | QString LanCardNetNode::genNic( long nr ) { | ||
64 | QString S; | ||
65 | return S.sprintf( "eth%ld", nr ); | ||
61 | } | 66 | } |
62 | 67 | ||
63 | extern "C" { | 68 | extern "C" { |
64 | void create_plugin( QList<ANetNode> & PNN ) { | 69 | void create_plugin( QList<ANetNode> & PNN ) { |
65 | PNN.append( new LanCardNetNode() ); | 70 | PNN.append( new LanCardNetNode() ); |
66 | } | 71 | } |
67 | } | 72 | } |
diff --git a/noncore/settings/networksettings2/lancard/lancard_NN.h b/noncore/settings/networksettings2/lancard/lancard_NN.h index 9690c76..dcdd0da 100644 --- a/noncore/settings/networksettings2/lancard/lancard_NN.h +++ b/noncore/settings/networksettings2/lancard/lancard_NN.h | |||
@@ -23,21 +23,24 @@ public: | |||
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, bool DS ); | 31 | virtual bool hasDataFor( const QString & S ); |
32 | virtual bool generateDataForCommonFile( | ||
33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | ||
34 | virtual bool generateDeviceDataForCommonFile( | 32 | virtual bool generateDeviceDataForCommonFile( |
35 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | 33 | SystemFile & SF, long DevNr ); |
34 | |||
35 | virtual long instanceCount( void ) | ||
36 | { return 2; } | ||
37 | |||
38 | virtual QString genNic( long ); | ||
36 | 39 | ||
37 | private: | 40 | private: |
38 | 41 | ||
39 | }; | 42 | }; |
40 | 43 | ||
41 | extern "C" | 44 | extern "C" |
42 | { | 45 | { |
43 | void create_plugin( QList<ANetNode> & PNN ); | 46 | void create_plugin( QList<ANetNode> & PNN ); |
diff --git a/noncore/settings/networksettings2/lancard/lancard_NNI.cpp b/noncore/settings/networksettings2/lancard/lancard_NNI.cpp index a6401db..5962d52 100644 --- a/noncore/settings/networksettings2/lancard/lancard_NNI.cpp +++ b/noncore/settings/networksettings2/lancard/lancard_NNI.cpp | |||
@@ -38,21 +38,14 @@ QString ALanCard::acceptable( void ) { | |||
38 | return ( GUI ) ? GUI->acceptable( ) : QString(); | 38 | return ( GUI ) ? GUI->acceptable( ) : QString(); |
39 | } | 39 | } |
40 | 40 | ||
41 | void ALanCard::commit( void ) { | 41 | void ALanCard::commit( void ) { |
42 | if( GUI && GUI->commit( Data ) ) | 42 | if( GUI && GUI->commit( Data ) ) |
43 | setModified( 1 ); | 43 | setModified( 1 ); |
44 | } | 44 | } |
45 | 45 | ||
46 | bool ALanCard::generateDeviceDataForCommonFile( SystemFile & S, long DevNr ) { | 46 | bool ALanCard::generateDataForCommonFile( |
47 | AsDevice * Dev = runtime()->device(); | 47 | SystemFile & , |
48 | QString NIC = Dev->genNic( DevNr ); | 48 | long ) { |
49 | 49 | return 1; | |
50 | if( S.name() == "interfaces" ) { | ||
51 | // generate mapping stanza for this interface | ||
52 | S << "# check if " << NIC << " can be brought UP" << endl; | ||
53 | S << "mapping " << NIC << endl; | ||
54 | S << " script networksettings2-request" << endl << endl; | ||
55 | } | ||
56 | return 0; | ||
57 | } | 50 | } |
58 | 51 | ||
diff --git a/noncore/settings/networksettings2/lancard/lancard_NNI.h b/noncore/settings/networksettings2/lancard/lancard_NNI.h index 16f5f56..4e91523 100644 --- a/noncore/settings/networksettings2/lancard/lancard_NNI.h +++ b/noncore/settings/networksettings2/lancard/lancard_NNI.h | |||
@@ -22,18 +22,20 @@ public : | |||
22 | { if( RT == 0 ) | 22 | { if( RT == 0 ) |
23 | RT = new LanCardRun( this, Data ); | 23 | RT = new LanCardRun( 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 | bool generateDeviceDataForCommonFile( SystemFile & S, long DevNr ); | 30 | virtual bool hasDataFor( const QString & ) |
31 | 31 | { return 0; } | |
32 | virtual bool generateDataForCommonFile( | ||
33 | SystemFile & S, long DevNr ); | ||
32 | protected : | 34 | protected : |
33 | 35 | ||
34 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 36 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
35 | virtual void saveSpecificAttribute( QTextStream & TS ); | 37 | virtual void saveSpecificAttribute( QTextStream & TS ); |
36 | 38 | ||
37 | private : | 39 | private : |
38 | 40 | ||
39 | LanCardEdit * GUI; | 41 | LanCardEdit * GUI; |
diff --git a/noncore/settings/networksettings2/lancard/lancardrun.h b/noncore/settings/networksettings2/lancard/lancardrun.h index 8dbd1b1..499b417 100644 --- a/noncore/settings/networksettings2/lancard/lancardrun.h +++ b/noncore/settings/networksettings2/lancard/lancardrun.h | |||
@@ -9,21 +9,16 @@ class LanCardRun : public AsDevice { | |||
9 | 9 | ||
10 | public : | 10 | public : |
11 | 11 | ||
12 | LanCardRun( ANetNodeInstance * NNI, | 12 | LanCardRun( ANetNodeInstance * NNI, |
13 | LanCardData & Data ) : AsDevice( NNI ), | 13 | LanCardData & Data ) : AsDevice( NNI ), |
14 | Pat( "eth[0-9]" ) | 14 | Pat( "eth[0-9]" ) |
15 | { } | 15 | { } |
16 | 16 | ||
17 | virtual long count( void ) | ||
18 | { return 2; } | ||
19 | virtual QString genNic( long nr ) | ||
20 | { QString S; return S.sprintf( "eth%ld", nr ); } | ||
21 | |||
22 | virtual AsDevice * device( void ) | 17 | virtual AsDevice * device( void ) |
23 | { return (AsDevice *)this; } | 18 | { return (AsDevice *)this; } |
24 | 19 | ||
25 | virtual AsDevice * asDevice( void ) | 20 | virtual AsDevice * asDevice( void ) |
26 | { return (AsDevice *)this; } | 21 | { return (AsDevice *)this; } |
27 | 22 | ||
28 | protected : | 23 | protected : |
29 | 24 | ||
diff --git a/noncore/settings/networksettings2/modem/modem_NN.cpp b/noncore/settings/networksettings2/modem/modem_NN.cpp index 2807963..65b06ee 100644 --- a/noncore/settings/networksettings2/modem/modem_NN.cpp +++ b/noncore/settings/networksettings2/modem/modem_NN.cpp | |||
@@ -37,31 +37,19 @@ const char * ModemNetNode::provides( void ) { | |||
37 | return "line"; | 37 | return "line"; |
38 | } | 38 | } |
39 | 39 | ||
40 | bool ModemNetNode::generateProperFilesFor( | 40 | bool ModemNetNode::generateProperFilesFor( |
41 | ANetNodeInstance * ) { | 41 | ANetNodeInstance * ) { |
42 | return 1; | 42 | return 1; |
43 | } | 43 | } |
44 | 44 | ||
45 | bool ModemNetNode::hasDataFor( const QString &, bool ) { | ||
46 | return 0; | ||
47 | } | ||
48 | |||
49 | bool ModemNetNode::generateDataForCommonFile( | ||
50 | SystemFile & , | ||
51 | long , | ||
52 | ANetNodeInstance * ) { | ||
53 | return 1; | ||
54 | } | ||
55 | |||
56 | bool ModemNetNode::generateDeviceDataForCommonFile( | 45 | bool ModemNetNode::generateDeviceDataForCommonFile( |
57 | SystemFile & , | 46 | SystemFile & , |
58 | long , | 47 | long ) { |
59 | ANetNodeInstance * ) { | ||
60 | return 1; | 48 | return 1; |
61 | } | 49 | } |
62 | 50 | ||
63 | extern "C" { | 51 | extern "C" { |
64 | void create_plugin( QList<ANetNode> & PNN ) { | 52 | void create_plugin( QList<ANetNode> & PNN ) { |
65 | PNN.append( new ModemNetNode() ); | 53 | PNN.append( new ModemNetNode() ); |
66 | } | 54 | } |
67 | } | 55 | } |
diff --git a/noncore/settings/networksettings2/modem/modem_NN.h b/noncore/settings/networksettings2/modem/modem_NN.h index bd921c6..49244b2 100644 --- a/noncore/settings/networksettings2/modem/modem_NN.h +++ b/noncore/settings/networksettings2/modem/modem_NN.h | |||
@@ -23,21 +23,20 @@ public: | |||
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, bool DS ); | 31 | virtual bool hasDataFor( const QString & ) |
32 | virtual bool generateDataForCommonFile( | 32 | { return 0; } |
33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | ||
34 | virtual bool generateDeviceDataForCommonFile( | 33 | virtual bool generateDeviceDataForCommonFile( |
35 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | 34 | SystemFile & SF, long DevNr ); |
36 | 35 | ||
37 | private: | 36 | private: |
38 | 37 | ||
39 | }; | 38 | }; |
40 | 39 | ||
41 | extern "C" | 40 | extern "C" |
42 | { | 41 | { |
43 | void create_plugin( QList<ANetNode> & PNN ); | 42 | void create_plugin( QList<ANetNode> & PNN ); |
diff --git a/noncore/settings/networksettings2/modem/modem_NNI.cpp b/noncore/settings/networksettings2/modem/modem_NNI.cpp index 91df22b..6c76b56 100644 --- a/noncore/settings/networksettings2/modem/modem_NNI.cpp +++ b/noncore/settings/networksettings2/modem/modem_NNI.cpp | |||
@@ -24,8 +24,14 @@ QString AModem::acceptable( void ) { | |||
24 | return ( GUI ) ? GUI->acceptable( ) : QString(); | 24 | return ( GUI ) ? GUI->acceptable( ) : QString(); |
25 | } | 25 | } |
26 | 26 | ||
27 | void AModem::commit( void ) { | 27 | void AModem::commit( void ) { |
28 | if( GUI && GUI->commit( Data ) ) | 28 | if( GUI && GUI->commit( Data ) ) |
29 | setModified( 1 ); | 29 | setModified( 1 ); |
30 | } | 30 | } |
31 | 31 | ||
32 | bool AModem::generateDataForCommonFile( | ||
33 | SystemFile & , | ||
34 | long ) { | ||
35 | return 1; | ||
36 | } | ||
37 | |||
diff --git a/noncore/settings/networksettings2/modem/modem_NNI.h b/noncore/settings/networksettings2/modem/modem_NNI.h index 7543e7d..a623704 100644 --- a/noncore/settings/networksettings2/modem/modem_NNI.h +++ b/noncore/settings/networksettings2/modem/modem_NNI.h | |||
@@ -22,16 +22,21 @@ public : | |||
22 | { if( RT == 0 ) | 22 | { if( RT == 0 ) |
23 | RT = new ModemRun( this, Data ); | 23 | RT = new ModemRun( 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 | virtual bool hasDataFor( const QString & ) | ||
31 | { return 0; } | ||
32 | virtual bool generateDataForCommonFile( | ||
33 | SystemFile & SF, long DevNr ); | ||
34 | |||
30 | protected : | 35 | protected : |
31 | 36 | ||
32 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 37 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
33 | virtual void saveSpecificAttribute( QTextStream & TS ); | 38 | virtual void saveSpecificAttribute( QTextStream & TS ); |
34 | 39 | ||
35 | private : | 40 | private : |
36 | 41 | ||
37 | ModemEdit * GUI; | 42 | ModemEdit * GUI; |
diff --git a/noncore/settings/networksettings2/network/network_NN.cpp b/noncore/settings/networksettings2/network/network_NN.cpp index a6b15c6..4a77e6a 100644 --- a/noncore/settings/networksettings2/network/network_NN.cpp +++ b/noncore/settings/networksettings2/network/network_NN.cpp | |||
@@ -38,34 +38,19 @@ const char * NetworkNetNode::provides( void ) { | |||
38 | return "connection"; | 38 | return "connection"; |
39 | } | 39 | } |
40 | 40 | ||
41 | bool NetworkNetNode::generateProperFilesFor( | 41 | bool NetworkNetNode::generateProperFilesFor( |
42 | ANetNodeInstance * ) { | 42 | ANetNodeInstance * ) { |
43 | return 1; | 43 | return 1; |
44 | } | 44 | } |
45 | 45 | ||
46 | bool NetworkNetNode::hasDataFor( const QString & S, bool DS ) { | ||
47 | if( ! DS && S == "interfaces" ) { | ||
48 | return 1; | ||
49 | } | ||
50 | return 0; | ||
51 | } | ||
52 | |||
53 | bool NetworkNetNode::generateDataForCommonFile( | ||
54 | SystemFile & S, | ||
55 | long DevNr, | ||
56 | ANetNodeInstance * NNI ) { | ||
57 | return ((ANetwork *)NNI)->generateDataForCommonFile(S, DevNr); | ||
58 | } | ||
59 | |||
60 | bool NetworkNetNode::generateDeviceDataForCommonFile( | 46 | bool NetworkNetNode::generateDeviceDataForCommonFile( |
61 | SystemFile & , | 47 | SystemFile & , |
62 | long , | 48 | long ) { |
63 | ANetNodeInstance * ) { | ||
64 | return 1; | 49 | return 1; |
65 | } | 50 | } |
66 | 51 | ||
67 | extern "C" { | 52 | extern "C" { |
68 | void create_plugin( QList<ANetNode> & PNN ) { | 53 | void create_plugin( QList<ANetNode> & PNN ) { |
69 | PNN.append( new NetworkNetNode() ); | 54 | PNN.append( new NetworkNetNode() ); |
70 | } | 55 | } |
71 | } | 56 | } |
diff --git a/noncore/settings/networksettings2/network/network_NN.h b/noncore/settings/networksettings2/network/network_NN.h index 62a3f10..59f0526 100644 --- a/noncore/settings/networksettings2/network/network_NN.h +++ b/noncore/settings/networksettings2/network/network_NN.h | |||
@@ -23,21 +23,20 @@ public: | |||
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, bool DS ); | 31 | virtual bool hasDataFor( const QString & ) |
32 | virtual bool generateDataForCommonFile( | 32 | { return 0; } |
33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | ||
34 | virtual bool generateDeviceDataForCommonFile( | 33 | virtual bool generateDeviceDataForCommonFile( |
35 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | 34 | SystemFile & SF, long DevNr ); |
36 | 35 | ||
37 | private: | 36 | private: |
38 | 37 | ||
39 | }; | 38 | }; |
40 | 39 | ||
41 | extern "C" | 40 | extern "C" |
42 | { | 41 | { |
43 | void create_plugin( QList<ANetNode> & PNN ); | 42 | void create_plugin( QList<ANetNode> & PNN ); |
diff --git a/noncore/settings/networksettings2/network/network_NNI.cpp b/noncore/settings/networksettings2/network/network_NNI.cpp index eac2d66..054385a 100644 --- a/noncore/settings/networksettings2/network/network_NNI.cpp +++ b/noncore/settings/networksettings2/network/network_NNI.cpp | |||
@@ -94,19 +94,22 @@ QString ANetwork::acceptable( void ) { | |||
94 | return ( GUI ) ? GUI->acceptable( ) : QString(); | 94 | return ( GUI ) ? GUI->acceptable( ) : QString(); |
95 | } | 95 | } |
96 | 96 | ||
97 | void ANetwork::commit( void ) { | 97 | void ANetwork::commit( void ) { |
98 | if( GUI && GUI->commit( Data ) ) | 98 | if( GUI && GUI->commit( Data ) ) |
99 | setModified( 1 ); | 99 | setModified( 1 ); |
100 | } | 100 | } |
101 | 101 | ||
102 | bool ANetwork::hasDataFor( const QString & S ) { | ||
103 | return S == "interfaces"; | ||
104 | } | ||
105 | |||
102 | bool ANetwork::generateDataForCommonFile( SystemFile & S, long DevNr ) { | 106 | bool ANetwork::generateDataForCommonFile( SystemFile & S, long DevNr ) { |
103 | AsDevice * Dev = runtime()->device(); | 107 | QString NIC = runtime()->device()->netNode()->nodeClass()->genNic( DevNr ); |
104 | QString NIC = Dev->genNic( DevNr ); | ||
105 | 108 | ||
106 | if( S.name() == "interfaces" ) { | 109 | if( S.name() == "interfaces" ) { |
107 | // we can safely call from here since device item is deeper | 110 | // we can safely call from here since device item is deeper |
108 | if( Data.UseDHCP ) { | 111 | if( Data.UseDHCP ) { |
109 | S << "iface " << NIC << "-c" << connection()->number() << | 112 | S << "iface " << NIC << "-c" << connection()->number() << |
110 | "-allowed inet dhcp" << endl; | 113 | "-allowed inet dhcp" << endl; |
111 | S << " up echo \"" << NIC << "\" > /tmp/profile-" << connection()->number() << | 114 | S << " up echo \"" << NIC << "\" > /tmp/profile-" << connection()->number() << |
112 | ".up" << Data.IPAddress << endl; | 115 | ".up" << Data.IPAddress << endl; |
diff --git a/noncore/settings/networksettings2/network/network_NNI.h b/noncore/settings/networksettings2/network/network_NNI.h index b98ff6e..0058793 100644 --- a/noncore/settings/networksettings2/network/network_NNI.h +++ b/noncore/settings/networksettings2/network/network_NNI.h | |||
@@ -23,17 +23,19 @@ public : | |||
23 | { if( RT == 0 ) | 23 | { if( RT == 0 ) |
24 | RT = new NetworkRun( this, Data ); | 24 | RT = new NetworkRun( this, Data ); |
25 | return RT; | 25 | return RT; |
26 | } | 26 | } |
27 | 27 | ||
28 | virtual void * data( void ) | 28 | virtual void * data( void ) |
29 | { return (void *)&Data; } | 29 | { return (void *)&Data; } |
30 | 30 | ||
31 | bool generateDataForCommonFile( SystemFile & S, long DevNr ); | 31 | virtual bool hasDataFor( const QString & S ); |
32 | virtual bool generateDataForCommonFile( | ||
33 | SystemFile & SF, long DevNr ); | ||
32 | 34 | ||
33 | protected : | 35 | protected : |
34 | 36 | ||
35 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 37 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
36 | virtual void saveSpecificAttribute( QTextStream & TS ); | 38 | virtual void saveSpecificAttribute( QTextStream & TS ); |
37 | 39 | ||
38 | private : | 40 | private : |
39 | 41 | ||
diff --git a/noncore/settings/networksettings2/network/networkrun.cpp b/noncore/settings/networksettings2/network/networkrun.cpp index f34fdbf..ddb9a5f 100644 --- a/noncore/settings/networksettings2/network/networkrun.cpp +++ b/noncore/settings/networksettings2/network/networkrun.cpp | |||
@@ -5,16 +5,17 @@ | |||
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 | return; | ||
13 | } | 14 | } |
14 | 15 | ||
15 | // has no interface -> delegate | 16 | // has no interface -> delegate |
16 | RI->detectState( NC ); | 17 | RI->detectState( NC ); |
17 | } | 18 | } |
18 | 19 | ||
19 | bool NetworkRun::setState( NodeCollection * NC, Action_t A ) { | 20 | bool NetworkRun::setState( NodeCollection * NC, Action_t A ) { |
20 | // we handle UP and DOWN | 21 | // we handle UP and DOWN |
diff --git a/noncore/settings/networksettings2/networksettings.cpp b/noncore/settings/networksettings2/networksettings.cpp index c3e6572..3ddcbde 100644 --- a/noncore/settings/networksettings2/networksettings.cpp +++ b/noncore/settings/networksettings2/networksettings.cpp | |||
@@ -68,17 +68,17 @@ NetworkSettings::NetworkSettings( QWidget *parent, | |||
68 | 68 | ||
69 | NetworkSettings::~NetworkSettings() { | 69 | NetworkSettings::~NetworkSettings() { |
70 | QString S; | 70 | QString S; |
71 | 71 | ||
72 | S = NSD.generateSettings(); | 72 | S = NSD.generateSettings(); |
73 | if( ! S.isEmpty() ) { | 73 | if( ! S.isEmpty() ) { |
74 | QMessageBox::warning( | 74 | QMessageBox::warning( |
75 | 0, | 75 | 0, |
76 | tr( "Generating system configuration" ), | 76 | tr( "In System Config" ), |
77 | S | 77 | S |
78 | ); | 78 | ); |
79 | } | 79 | } |
80 | 80 | ||
81 | S = NSD.saveSettings(); | 81 | S = NSD.saveSettings(); |
82 | if( ! S.isEmpty() ) { | 82 | if( ! S.isEmpty() ) { |
83 | // problem saving | 83 | // problem saving |
84 | QMessageBox::warning( | 84 | QMessageBox::warning( |
@@ -178,17 +178,17 @@ void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) { | |||
178 | if( LBI ) { | 178 | if( LBI ) { |
179 | if( NC->name() != OldName ) { | 179 | if( NC->name() != OldName ) { |
180 | // find if new name is free | 180 | // find if new name is free |
181 | NodeCollection * LCN = NSResources->findConnection( | 181 | NodeCollection * LCN = NSResources->findConnection( |
182 | NC->name() ); | 182 | NC->name() ); |
183 | if( LCN ) { | 183 | if( LCN ) { |
184 | QMessageBox::warning( | 184 | QMessageBox::warning( |
185 | 0, | 185 | 0, |
186 | tr( "Generating system configuration" ), | 186 | tr( "In System Config" ), |
187 | tr( "Name %1 already exists" ).arg(NC->name()) | 187 | tr( "Name %1 already exists" ).arg(NC->name()) |
188 | ); | 188 | ); |
189 | continue; // restart exec | 189 | continue; // restart exec |
190 | } // else new name | 190 | } // else new name |
191 | // new name -> remove item | 191 | // new name -> remove item |
192 | NSResources->removeConnection( OldName ); | 192 | NSResources->removeConnection( OldName ); |
193 | NSResources->addConnection( NC ); | 193 | NSResources->addConnection( NC ); |
194 | } // else not changed | 194 | } // else not changed |
diff --git a/noncore/settings/networksettings2/networksettings2/asdevice.h b/noncore/settings/networksettings2/networksettings2/asdevice.h index 058fc4c..19241c1 100644 --- a/noncore/settings/networksettings2/networksettings2/asdevice.h +++ b/noncore/settings/networksettings2/networksettings2/asdevice.h | |||
@@ -17,21 +17,15 @@ public : | |||
17 | 17 | ||
18 | // return the interface assigned to this device | 18 | // return the interface assigned to this device |
19 | // e.g eth0, wlan, ... | 19 | // e.g eth0, wlan, ... |
20 | InterfaceInfo * assignedInterface( void ) | 20 | InterfaceInfo * assignedInterface( void ) |
21 | { return AssignedInterface; } | 21 | { return AssignedInterface; } |
22 | virtual void assignInterface( InterfaceInfo * NI ) | 22 | virtual void assignInterface( InterfaceInfo * NI ) |
23 | { AssignedInterface = NI; } | 23 | { AssignedInterface = NI; } |
24 | 24 | ||
25 | // number of device to configure for this Device type | ||
26 | virtual long count( void ) | ||
27 | { return 1; } | ||
28 | // generate NIC name of device number ... | ||
29 | virtual QString genNic( long NicNr ) = 0; | ||
30 | |||
31 | private : | 25 | private : |
32 | 26 | ||
33 | InterfaceInfo * AssignedInterface; | 27 | InterfaceInfo * AssignedInterface; |
34 | 28 | ||
35 | }; | 29 | }; |
36 | 30 | ||
37 | #endif | 31 | #endif |
diff --git a/noncore/settings/networksettings2/networksettings2/netnode.cpp b/noncore/settings/networksettings2/networksettings2/netnode.cpp index f040c99..fcc6044 100644 --- a/noncore/settings/networksettings2/networksettings2/netnode.cpp +++ b/noncore/settings/networksettings2/networksettings2/netnode.cpp | |||
@@ -172,17 +172,17 @@ void NodeCollection::save( QTextStream & TS ) { | |||
172 | } | 172 | } |
173 | 173 | ||
174 | ANetNodeInstance * NodeCollection::getToplevel( void ) { | 174 | ANetNodeInstance * NodeCollection::getToplevel( void ) { |
175 | ANetNodeInstance * NNI = 0; | 175 | ANetNodeInstance * NNI = 0; |
176 | for( QListIterator<ANetNodeInstance> it(*this); | 176 | for( QListIterator<ANetNodeInstance> it(*this); |
177 | it.current(); | 177 | it.current(); |
178 | ++it ) { | 178 | ++it ) { |
179 | NNI = it.current(); | 179 | NNI = it.current(); |
180 | if( NNI->netNode()->isToplevel() ) | 180 | if( NNI->nodeClass()->isToplevel() ) |
181 | break; | 181 | break; |
182 | } | 182 | } |
183 | return NNI; | 183 | return NNI; |
184 | } | 184 | } |
185 | 185 | ||
186 | ANetNodeInstance * NodeCollection::findByName( const QString & S ) { | 186 | ANetNodeInstance * NodeCollection::findByName( const QString & S ) { |
187 | ANetNodeInstance * NNI = 0; | 187 | ANetNodeInstance * NNI = 0; |
188 | for( QListIterator<ANetNodeInstance> it(*this); | 188 | for( QListIterator<ANetNodeInstance> it(*this); |
diff --git a/noncore/settings/networksettings2/networksettings2/netnode.h b/noncore/settings/networksettings2/networksettings2/netnode.h index f4a5e30..9681c6e 100644 --- a/noncore/settings/networksettings2/networksettings2/netnode.h +++ b/noncore/settings/networksettings2/networksettings2/netnode.h | |||
@@ -90,30 +90,36 @@ public: | |||
90 | // return feature this NetNode provides | 90 | // return feature this NetNode provides |
91 | virtual const char * provides( void ) = 0; | 91 | virtual const char * provides( void ) = 0; |
92 | virtual const char ** needs( void ) = 0; | 92 | virtual const char ** needs( void ) = 0; |
93 | 93 | ||
94 | // generate files specific for this node (if any) | 94 | // generate files specific for this node (if any) |
95 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ) = 0; | 95 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ) = 0; |
96 | // return TRUE if this node has data to be inserted in systemfile | 96 | // return TRUE if this node has data to be inserted in systemfile |
97 | // with name S | 97 | // with name S |
98 | virtual bool hasDataFor( const QString & S, bool DeviceSpecific ) = 0; | 98 | virtual bool hasDataFor( const QString & S ) = 0; |
99 | // generate data specific for a profile and for the system file S | ||
100 | // called only IF data was needed | ||
101 | virtual bool generateDataForCommonFile( | ||
102 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ) = 0; | ||
103 | // generate data specific for the device for the system file S | 99 | // generate data specific for the device for the system file S |
104 | // called only IF data was needed | 100 | // called only IF data was needed |
105 | virtual bool generateDeviceDataForCommonFile( | 101 | virtual bool generateDeviceDataForCommonFile( |
106 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ) = 0; | 102 | SystemFile & SF, long DevNr ) = 0; |
107 | 103 | ||
108 | // does this Node provide a Connection | 104 | // does this Node provide a Connection |
109 | bool isToplevel( void ) | 105 | bool isToplevel( void ) |
110 | { return strcmp( provides(), "fullsetup") == 0 ; } | 106 | { return strcmp( provides(), "fullsetup") == 0 ; } |
111 | 107 | ||
108 | // generate NIC name based on instance nr | ||
109 | // only relevant if node instances are devices | ||
110 | virtual QString genNic( long ) | ||
111 | { return QString(""); } | ||
112 | |||
113 | // max number of instances for this node type | ||
114 | // only relevant if node instances are devices | ||
115 | virtual long instanceCount( void ) | ||
116 | { return 1; } | ||
117 | |||
112 | // compiled references to 'needed' NetNodes -> needs list | 118 | // compiled references to 'needed' NetNodes -> needs list |
113 | void setAlternatives( NetNodeList * Alt ) | 119 | void setAlternatives( NetNodeList * Alt ) |
114 | { Alternatives = Alt; } | 120 | { Alternatives = Alt; } |
115 | NetNodeList & alternatives( void ) | 121 | NetNodeList & alternatives( void ) |
116 | { return *Alternatives; } | 122 | { return *Alternatives; } |
117 | 123 | ||
118 | protected : | 124 | protected : |
119 | 125 | ||
@@ -149,17 +155,17 @@ public: | |||
149 | { return IsModified; } | 155 | { return IsModified; } |
150 | 156 | ||
151 | // get data from GUI and store in node | 157 | // get data from GUI and store in node |
152 | virtual void commit( void ) = 0; | 158 | virtual void commit( void ) = 0; |
153 | 159 | ||
154 | // get next node | 160 | // get next node |
155 | ANetNodeInstance * nextNode(); | 161 | ANetNodeInstance * nextNode(); |
156 | // return NetNode this is an instance of | 162 | // return NetNode this is an instance of |
157 | ANetNode * netNode( void ) | 163 | ANetNode * nodeClass( void ) |
158 | { return NodeType; } | 164 | { return NodeType; } |
159 | 165 | ||
160 | // intialize am instance of a net node | 166 | // intialize am instance of a net node |
161 | void initialize( void ); | 167 | void initialize( void ); |
162 | 168 | ||
163 | // set the value of an attribute | 169 | // set the value of an attribute |
164 | void setAttribute( QString & Attr, QString & Value ) ; | 170 | void setAttribute( QString & Attr, QString & Value ) ; |
165 | void saveAttributes( QTextStream & TS ) ; | 171 | void saveAttributes( QTextStream & TS ) ; |
@@ -189,16 +195,25 @@ public: | |||
189 | { return NodeType->provides(); } | 195 | { return NodeType->provides(); } |
190 | 196 | ||
191 | const char ** needs( void ) | 197 | const char ** needs( void ) |
192 | { return NodeType->needs(); } | 198 | { return NodeType->needs(); } |
193 | 199 | ||
194 | // returns node specific data -> only useful for 'buddy' | 200 | // returns node specific data -> only useful for 'buddy' |
195 | virtual void * data( void ) = 0; | 201 | virtual void * data( void ) = 0; |
196 | 202 | ||
203 | // return TRUE if this node has data to be inserted in systemfile | ||
204 | // with name S | ||
205 | virtual bool hasDataFor( const QString & S ) = 0; | ||
206 | |||
207 | // generate data specific for a profile and for the system file S | ||
208 | // called only IF data was needed | ||
209 | virtual bool generateDataForCommonFile( | ||
210 | SystemFile & SF, long DevNr ) = 0; | ||
211 | |||
197 | protected : | 212 | protected : |
198 | 213 | ||
199 | virtual void setSpecificAttribute( QString & , QString & ) = 0; | 214 | virtual void setSpecificAttribute( QString & , QString & ) = 0; |
200 | virtual void saveSpecificAttribute( QTextStream & ) = 0; | 215 | virtual void saveSpecificAttribute( QTextStream & ) = 0; |
201 | 216 | ||
202 | ANetNode * NodeType; | 217 | ANetNode * NodeType; |
203 | // connection to which this node belongs to | 218 | // connection to which this node belongs to |
204 | NodeCollection * Connection; | 219 | NodeCollection * Connection; |
@@ -215,23 +230,23 @@ class RuntimeInfo : public QObject { | |||
215 | Q_OBJECT | 230 | Q_OBJECT |
216 | 231 | ||
217 | public : | 232 | public : |
218 | 233 | ||
219 | RuntimeInfo( ANetNodeInstance * TheNNI ) | 234 | RuntimeInfo( ANetNodeInstance * TheNNI ) |
220 | { NNI = TheNNI; } | 235 | { NNI = TheNNI; } |
221 | 236 | ||
222 | // downcast implemented by specify runtime classes | 237 | // downcast implemented by specify runtime classes |
223 | AsDevice * asDevice( void ) | 238 | virtual AsDevice * asDevice( void ) |
224 | { return 0; } | 239 | { return 0; } |
225 | AsConnection * asConnection( void ) | 240 | virtual AsConnection * asConnection( void ) |
226 | { return 0; } | 241 | { return 0; } |
227 | AsLine * asLine( void ) | 242 | virtual AsLine * asLine( void ) |
228 | { return 0; } | 243 | { return 0; } |
229 | AsFullSetup * asFullSetup( void ) | 244 | virtual AsFullSetup * asFullSetup( void ) |
230 | { return 0; } | 245 | { return 0; } |
231 | 246 | ||
232 | // does this node handles this interface e.g.eth0 | 247 | // does this node handles this interface e.g.eth0 |
233 | // recurse deeper if this node cannot answer that question | 248 | // recurse deeper if this node cannot answer that question |
234 | virtual bool handlesInterface( const QString & ) | 249 | virtual bool handlesInterface( const QString & ) |
235 | { return 0; } | 250 | { return 0; } |
236 | virtual InterfaceInfo * assignedInterface( void ); | 251 | virtual InterfaceInfo * assignedInterface( void ); |
237 | virtual AsDevice * device( void ); | 252 | virtual AsDevice * device( void ); |
@@ -383,23 +398,20 @@ public: | |||
383 | { return QString("Fake node" ); } | 398 | { return QString("Fake node" ); } |
384 | ANetNodeInstance * createInstance( void ); | 399 | ANetNodeInstance * createInstance( void ); |
385 | const char * provides( void ) | 400 | const char * provides( void ) |
386 | { return ""; } | 401 | { return ""; } |
387 | virtual const char ** needs( void ) | 402 | virtual const char ** needs( void ) |
388 | { return 0; } | 403 | { return 0; } |
389 | virtual bool generateProperFilesFor( ANetNodeInstance * ) | 404 | virtual bool generateProperFilesFor( ANetNodeInstance * ) |
390 | { return 0; } | 405 | { return 0; } |
391 | virtual bool hasDataFor( const QString &, bool DS ) | 406 | virtual bool hasDataFor( const QString & ) |
392 | { return 0; } | 407 | { return 0; } |
393 | virtual bool generateDataForCommonFile( | ||
394 | SystemFile & , long , ANetNodeInstance * ) | ||
395 | {return 1; } | ||
396 | virtual bool generateDeviceDataForCommonFile( | 408 | virtual bool generateDeviceDataForCommonFile( |
397 | SystemFile & , long , ANetNodeInstance * ) | 409 | SystemFile & , long ) |
398 | {return 1; } | 410 | {return 1; } |
399 | 411 | ||
400 | private : | 412 | private : |
401 | 413 | ||
402 | }; | 414 | }; |
403 | 415 | ||
404 | class FakeNetNodeInstance : public ANetNodeInstance { | 416 | class FakeNetNodeInstance : public ANetNodeInstance { |
405 | 417 | ||
@@ -429,16 +441,22 @@ public: | |||
429 | 441 | ||
430 | // intialize am instance of a net node | 442 | // intialize am instance of a net node |
431 | void initialize( void ){} | 443 | void initialize( void ){} |
432 | 444 | ||
433 | // returns node specific data -> only useful for 'buddy' | 445 | // returns node specific data -> only useful for 'buddy' |
434 | virtual void * data( void ) | 446 | virtual void * data( void ) |
435 | { return 0; } | 447 | { return 0; } |
436 | 448 | ||
449 | virtual bool hasDataFor( const QString & ) | ||
450 | { return 0; } | ||
451 | |||
452 | virtual bool generateDataForCommonFile( SystemFile & , long ) | ||
453 | { return 1; } | ||
454 | |||
437 | protected : | 455 | protected : |
438 | 456 | ||
439 | virtual void setSpecificAttribute( QString & , QString & ); | 457 | virtual void setSpecificAttribute( QString & , QString & ); |
440 | virtual void saveSpecificAttribute( QTextStream & ); | 458 | virtual void saveSpecificAttribute( QTextStream & ); |
441 | 459 | ||
442 | QDict<QString> ValAttrPairs; | 460 | QDict<QString> ValAttrPairs; |
443 | }; | 461 | }; |
444 | 462 | ||
diff --git a/noncore/settings/networksettings2/networksettings2/systemfile.cpp b/noncore/settings/networksettings2/networksettings2/systemfile.cpp index 394ff52..62bb6af 100644 --- a/noncore/settings/networksettings2/networksettings2/systemfile.cpp +++ b/noncore/settings/networksettings2/networksettings2/systemfile.cpp | |||
@@ -119,25 +119,25 @@ bool SystemFile::preNodeSection( ANetNodeInstance * NNI, long ) { | |||
119 | QFile Fl( TemplDir + Name + "/prenodesection" ); | 119 | QFile Fl( TemplDir + Name + "/prenodesection" ); |
120 | if( ! Fl.open( IO_ReadOnly ) ) | 120 | if( ! Fl.open( IO_ReadOnly ) ) |
121 | return 1; // error | 121 | return 1; // error |
122 | QTextStream TX( &Fl ); | 122 | QTextStream TX( &Fl ); |
123 | QString Out; | 123 | QString Out; |
124 | QString S = TX.readLine(); | 124 | QString S = TX.readLine(); |
125 | while( ! TX.eof() ) { | 125 | while( ! TX.eof() ) { |
126 | Out = S. | 126 | Out = S. |
127 | arg(NNI->netNode()->nodeName()); | 127 | arg(NNI->nodeClass()->nodeName()); |
128 | (*this) << Out << endl; | 128 | (*this) << Out << endl; |
129 | S = TX.readLine(); | 129 | S = TX.readLine(); |
130 | } | 130 | } |
131 | } | 131 | } |
132 | return 0; | 132 | return 0; |
133 | } | 133 | } |
134 | 134 | ||
135 | bool SystemFile::postNodeSection( ANetNodeInstance * NNI, long DevNr ) { | 135 | bool SystemFile::postNodeSection( ANetNodeInstance * NNI, long ) { |
136 | if( hasPostNodeSection ) { | 136 | if( hasPostNodeSection ) { |
137 | QFile Fl( TemplDir + Name + "/postnodesection" ); | 137 | QFile Fl( TemplDir + Name + "/postnodesection" ); |
138 | if( ! Fl.open( IO_ReadOnly ) ) | 138 | if( ! Fl.open( IO_ReadOnly ) ) |
139 | return 1; // error | 139 | return 1; // error |
140 | QTextStream TX( &Fl ); | 140 | QTextStream TX( &Fl ); |
141 | QString Out; | 141 | QString Out; |
142 | QString S = TX.readLine(); | 142 | QString S = TX.readLine(); |
143 | while( ! TX.eof() ) { | 143 | while( ! TX.eof() ) { |
@@ -145,43 +145,41 @@ bool SystemFile::postNodeSection( ANetNodeInstance * NNI, long DevNr ) { | |||
145 | arg(NNI->nodeName()); | 145 | arg(NNI->nodeName()); |
146 | (*this) << Out << endl; | 146 | (*this) << Out << endl; |
147 | S = TX.readLine(); | 147 | S = TX.readLine(); |
148 | } | 148 | } |
149 | } | 149 | } |
150 | return 0; | 150 | return 0; |
151 | } | 151 | } |
152 | 152 | ||
153 | bool SystemFile::preDeviceSection( ANetNodeInstance * NNI, long ) { | 153 | bool SystemFile::preDeviceSection( ANetNode * NN ) { |
154 | if( hasPreDeviceSection ) { | 154 | if( hasPreDeviceSection ) { |
155 | QFile Fl( TemplDir + Name + "/predevicesection" ); | 155 | QFile Fl( TemplDir + Name + "/predevicesection" ); |
156 | if( ! Fl.open( IO_ReadOnly ) ) | 156 | if( ! Fl.open( IO_ReadOnly ) ) |
157 | return 1; // error | 157 | return 1; // error |
158 | QTextStream TX( &Fl ); | 158 | QTextStream TX( &Fl ); |
159 | QString Out; | 159 | QString Out; |
160 | QString S = TX.readLine(); | 160 | QString S = TX.readLine(); |
161 | while( ! TX.eof() ) { | 161 | while( ! TX.eof() ) { |
162 | Out = S. | 162 | Out = S.arg(NN->nodeName()); |
163 | arg(NNI->netNode()->nodeName()); | ||
164 | (*this) << Out << endl; | 163 | (*this) << Out << endl; |
165 | S = TX.readLine(); | 164 | S = TX.readLine(); |
166 | } | 165 | } |
167 | } | 166 | } |
168 | return 0; | 167 | return 0; |
169 | } | 168 | } |
170 | 169 | ||
171 | bool SystemFile::postDeviceSection( ANetNodeInstance * NNI, long DevNr ) { | 170 | bool SystemFile::postDeviceSection( ANetNode * NN ) { |
172 | if( hasPostDeviceSection ) { | 171 | if( hasPostDeviceSection ) { |
173 | QFile Fl( TemplDir + Name + "/postdevicesection" ); | 172 | QFile Fl( TemplDir + Name + "/postdevicesection" ); |
174 | if( ! Fl.open( IO_ReadOnly ) ) | 173 | if( ! Fl.open( IO_ReadOnly ) ) |
175 | return 1; // error | 174 | return 1; // error |
176 | QTextStream TX( &Fl ); | 175 | QTextStream TX( &Fl ); |
177 | QString Out; | 176 | QString Out; |
178 | QString S = TX.readLine(); | 177 | QString S = TX.readLine(); |
179 | while( ! TX.eof() ) { | 178 | while( ! TX.eof() ) { |
180 | Out = S. | 179 | Out = S.arg(NN->nodeName()); |
181 | arg(NNI->nodeName()); | ||
182 | (*this) << Out << endl; | 180 | (*this) << Out << endl; |
183 | S = TX.readLine(); | 181 | S = TX.readLine(); |
184 | } | 182 | } |
185 | } | 183 | } |
186 | return 0; | 184 | return 0; |
187 | } | 185 | } |
diff --git a/noncore/settings/networksettings2/networksettings2/systemfile.h b/noncore/settings/networksettings2/networksettings2/systemfile.h index 35e0dfc..f57dab0 100644 --- a/noncore/settings/networksettings2/networksettings2/systemfile.h +++ b/noncore/settings/networksettings2/networksettings2/systemfile.h | |||
@@ -19,18 +19,18 @@ public : | |||
19 | 19 | ||
20 | bool open( void ); | 20 | bool open( void ); |
21 | bool close( void ); | 21 | bool close( void ); |
22 | 22 | ||
23 | bool preSection( void ); | 23 | bool preSection( void ); |
24 | bool postSection( void ); | 24 | bool postSection( void ); |
25 | bool preNodeSection( ANetNodeInstance * NNI, long DevNr ); | 25 | bool preNodeSection( ANetNodeInstance * NNI, long DevNr ); |
26 | bool postNodeSection( ANetNodeInstance * NNI, long DevNr ); | 26 | bool postNodeSection( ANetNodeInstance * NNI, long DevNr ); |
27 | bool preDeviceSection( ANetNodeInstance * NNI, long DevNr ); | 27 | bool preDeviceSection( ANetNode * NN ); |
28 | bool postDeviceSection( ANetNodeInstance * NNI, long DevNr ); | 28 | bool postDeviceSection( ANetNode * NN ); |
29 | 29 | ||
30 | private : | 30 | private : |
31 | 31 | ||
32 | QString Name; | 32 | QString Name; |
33 | QString Path; | 33 | QString Path; |
34 | QFile * F; | 34 | QFile * F; |
35 | bool hasPreSection; | 35 | bool hasPreSection; |
36 | bool hasPostSection; | 36 | bool hasPostSection; |
diff --git a/noncore/settings/networksettings2/nsdata.cpp b/noncore/settings/networksettings2/nsdata.cpp index 6541596..eb63e02 100644 --- a/noncore/settings/networksettings2/nsdata.cpp +++ b/noncore/settings/networksettings2/nsdata.cpp | |||
@@ -124,17 +124,17 @@ QString NetworkSettingsData::saveSettings( void ) { | |||
124 | return ErrS; | 124 | return ErrS; |
125 | 125 | ||
126 | QString S; | 126 | QString S; |
127 | QFile F( CfgFile + ".bup" ); | 127 | QFile F( CfgFile + ".bup" ); |
128 | 128 | ||
129 | printf( "Saving settings to %s\n", CfgFile.latin1() ); | 129 | printf( "Saving settings to %s\n", CfgFile.latin1() ); |
130 | if( ! F.open( IO_WriteOnly | IO_Truncate ) ) { | 130 | if( ! F.open( IO_WriteOnly | IO_Truncate ) ) { |
131 | ErrS = qApp->translate( "NetworkSettings", | 131 | ErrS = qApp->translate( "NetworkSettings", |
132 | "<p>Could not save setup to %1 !</p>" ). | 132 | "<p>Could not save setup to \"%1\" !</p>" ). |
133 | arg(CfgFile); | 133 | arg(CfgFile); |
134 | // problem | 134 | // problem |
135 | return ErrS; | 135 | return ErrS; |
136 | } | 136 | } |
137 | 137 | ||
138 | QTextStream TS( &F ); | 138 | QTextStream TS( &F ); |
139 | { Name2Connection_t & M = NSResources->connections(); | 139 | { Name2Connection_t & M = NSResources->connections(); |
140 | ANetNodeInstance * NNI; | 140 | ANetNodeInstance * NNI; |
@@ -144,17 +144,17 @@ QString NetworkSettingsData::saveSettings( void ) { | |||
144 | it.current(); | 144 | it.current(); |
145 | ++it ) { | 145 | ++it ) { |
146 | // all nodes in those connections | 146 | // all nodes in those connections |
147 | for( QListIterator<ANetNodeInstance> nit(*(it.current())); | 147 | for( QListIterator<ANetNodeInstance> nit(*(it.current())); |
148 | nit.current(); | 148 | nit.current(); |
149 | ++nit ) { | 149 | ++nit ) { |
150 | // header | 150 | // header |
151 | NNI = nit.current(); | 151 | NNI = nit.current(); |
152 | TS << '[' <<NNI->netNode()->nodeName() << ']' << endl; | 152 | TS << '[' <<NNI->nodeClass()->nodeName() << ']' << endl; |
153 | NNI->saveAttributes( TS ); | 153 | NNI->saveAttributes( TS ); |
154 | TS << endl; | 154 | TS << endl; |
155 | } | 155 | } |
156 | 156 | ||
157 | TS << "[connection]" << endl; | 157 | TS << "[connection]" << endl; |
158 | it.current()->save(TS); | 158 | it.current()->save(TS); |
159 | } | 159 | } |
160 | } | 160 | } |
@@ -176,24 +176,25 @@ QString NetworkSettingsData::generateSettings( bool ForceReq ) { | |||
176 | 176 | ||
177 | // include own force flag | 177 | // include own force flag |
178 | ForceIt = (Force) ? 1 : ForceReq; | 178 | ForceIt = (Force) ? 1 : ForceReq; |
179 | 179 | ||
180 | if( ! ForceIt && ! isModified() ) | 180 | if( ! ForceIt && ! isModified() ) |
181 | return S; | 181 | return S; |
182 | 182 | ||
183 | // regenerate system files | 183 | // regenerate system files |
184 | printf( "Generating settings from %s\n", CfgFile.latin1() ); | 184 | fprintf( stderr, "Generating settings from %s\n", CfgFile.latin1() ); |
185 | 185 | ||
186 | { Name2SystemFile_t & SFM = NSResources->systemFiles(); | 186 | { Name2SystemFile_t & SFM = NSResources->systemFiles(); |
187 | Name2Connection_t & M = NSResources->connections(); | 187 | Name2Connection_t & M = NSResources->connections(); |
188 | NodeCollection * NC; | 188 | NodeCollection * NC; |
189 | ANetNodeInstance * NNI; | 189 | ANetNodeInstance * NNI; |
190 | SystemFile * SF; | 190 | SystemFile * SF; |
191 | AsDevice * CurDev; | 191 | AsDevice * CurDev; |
192 | ANetNode * CurDevNN; | ||
192 | bool needToRegenerate = ForceIt; | 193 | bool needToRegenerate = ForceIt; |
193 | 194 | ||
194 | // | 195 | // |
195 | // check if we need to generate at least one of the system files | 196 | // check if we need to generate at least one of the system files |
196 | // | 197 | // |
197 | if( ! ForceIt ) { | 198 | if( ! ForceIt ) { |
198 | for( QDictIterator<SystemFile> sfit(SFM); | 199 | for( QDictIterator<SystemFile> sfit(SFM); |
199 | sfit.current(); | 200 | sfit.current(); |
@@ -210,18 +211,18 @@ QString NetworkSettingsData::generateSettings( bool ForceReq ) { | |||
210 | NC = ncit.current(); | 211 | NC = ncit.current(); |
211 | 212 | ||
212 | if( NC->isModified() ) { | 213 | if( NC->isModified() ) { |
213 | // does this connection 'touch' this system file ? | 214 | // does this connection 'touch' this system file ? |
214 | for( QListIterator<ANetNodeInstance> cncit(*NC); | 215 | for( QListIterator<ANetNodeInstance> cncit(*NC); |
215 | cncit.current(); | 216 | cncit.current(); |
216 | ++cncit ) { | 217 | ++cncit ) { |
217 | NNI = cncit.current(); | 218 | NNI = cncit.current(); |
218 | if( ( NNI->netNode()->hasDataFor( SF->name(), 1 ) || | 219 | if( ( NNI->nodeClass()->hasDataFor( SF->name() ) || |
219 | NNI->netNode()->hasDataFor( SF->name(), 0 ) | 220 | NNI->hasDataFor( SF->name() ) |
220 | ) && | 221 | ) && |
221 | NNI->isModified() ) { | 222 | NNI->isModified() ) { |
222 | needToRegenerate = 1; | 223 | needToRegenerate = 1; |
223 | break; | 224 | break; |
224 | } | 225 | } |
225 | } | 226 | } |
226 | } | 227 | } |
227 | if( needToRegenerate ) | 228 | if( needToRegenerate ) |
@@ -248,248 +249,91 @@ QString NetworkSettingsData::generateSettings( bool ForceReq ) { | |||
248 | for( QDictIterator<ANetNodeInstance> NNIIt(NNIs); | 249 | for( QDictIterator<ANetNodeInstance> NNIIt(NNIs); |
249 | NNIIt.current(); | 250 | NNIIt.current(); |
250 | ++NNIIt | 251 | ++NNIIt |
251 | ){ | 252 | ){ |
252 | // for all nodes find those that are modified | 253 | // for all nodes find those that are modified |
253 | NNI = NNIIt.current(); | 254 | NNI = NNIIt.current(); |
254 | 255 | ||
255 | if( ForceIt || NNI->isModified() ) { | 256 | if( ForceIt || NNI->isModified() ) { |
256 | if( ! NNI->netNode()->generateProperFilesFor( NNI ) ) { | 257 | if( ! NNI->nodeClass()->generateProperFilesFor( NNI ) ) { |
257 | // problem generating | 258 | // problem generating |
258 | S = qApp->translate( "NetworkSettings", | 259 | S = qApp->translate( "NetworkSettings", |
259 | "<p>Cannot generate files proper to %1</p>" ). | 260 | "<p>Cannot generate files proper to \"%1\"</p>" ). |
260 | arg(NNI->netNode()->nodeName()) ; | 261 | arg(NNI->nodeClass()->nodeName()) ; |
261 | return S; | 262 | return S; |
262 | } | 263 | } |
263 | } | 264 | } |
264 | } | 265 | } |
265 | } | 266 | } |
266 | 267 | ||
267 | // | 268 | // |
268 | // generate all system files | 269 | // generate all system files |
269 | // | 270 | // |
270 | for( QDictIterator<SystemFile> sfit(SFM); | 271 | for( QDictIterator<SystemFile> sfit(SFM); |
271 | sfit.current(); | 272 | sfit.current(); |
272 | ++sfit ) { | 273 | ++sfit ) { |
273 | SF = sfit.current(); | 274 | SF = sfit.current(); |
274 | 275 | ||
275 | printf( "Generating %s\n", SF->name().latin1() ); | 276 | fprintf( stderr, "Generating %s\n", SF->name().latin1() ); |
276 | SF->open(); | 277 | SF->open(); |
277 | 278 | ||
278 | do { // so we can break; | 279 | do { // so we can break; |
279 | 280 | ||
280 | // global presection for this system file | 281 | // global presection for this system file |
281 | if( SF->preSection() ) { | 282 | if( SF->preSection() ) { |
282 | S = qApp->translate( "NetworkSettings", | 283 | S = qApp->translate( "NetworkSettings", |
283 | "<p>Error in preSection for file %1</p>" ). | 284 | "<p>Error in preSection for file \"%1\"</p>" ). |
284 | arg( SF->name() ); | 285 | arg( SF->name() ); |
285 | return S; | 286 | return S; |
286 | } | 287 | } |
287 | 288 | ||
288 | // find all netnodes and figure out if | 289 | // find all netnodes and figure out if |
289 | // for that node there are instances | 290 | // for that node there are instances |
290 | for( QDictIterator<NetNode_t> nnit( | 291 | for( QDictIterator<NetNode_t> nnit( |
291 | NSResources->netNodes() ); | 292 | NSResources->netNodes() ); |
292 | nnit.current(); | 293 | nnit.current(); |
293 | ++nnit ) { | 294 | ++nnit ) { |
294 | ANetNode * NN; | 295 | |
295 | 296 | CurDevNN = nnit.current()->NetNode; | |
296 | NN = nnit.current()->NetNode; | 297 | |
297 | 298 | // are there instances for this netnode ? | |
298 | // are there instances ? | 299 | NNI = 0; |
299 | NNI = 0; | 300 | for( QDictIterator<ANetNodeInstance> nniit( |
300 | for( QDictIterator<ANetNodeInstance> nniit( | 301 | NSResources->netNodeInstances() ); |
301 | NSResources->netNodeInstances() ); | 302 | nniit.current(); |
302 | nniit.current(); | 303 | ++nniit ) { |
303 | ++nniit ) { | 304 | if( nniit.current()->nodeClass() == CurDevNN ) { |
304 | if( nniit.current()->netNode() == NN ) { | 305 | NNI = nniit.current(); |
305 | NNI = nniit.current(); | 306 | break; |
306 | break; | ||
307 | } | ||
308 | } | 307 | } |
308 | } | ||
309 | 309 | ||
310 | if( ! NNI ) | 310 | if( ! NNI ) |
311 | // no instances | 311 | // no instances -> next netnode type |
312 | continue; | 312 | continue; |
313 | 313 | ||
314 | // has this node data for this system file ? | 314 | // has this node data for this system file ? |
315 | if( (CurDev = NNI->runtime()->asDevice() ) ) { | 315 | if( (CurDev = NNI->runtime()->asDevice() ) ) { |
316 | // generate start for this nodetype for all possible devices of this type | 316 | // generate start for this nodetype for all possible devices of this type |
317 | for( int i = 0; i < CurDev->count(); i ++ ) { | 317 | for( int i = 0; i < CurDevNN->instanceCount(); i ++ ) { |
318 | if( SF->preDeviceSection( NNI, i ) ) { | 318 | S = generateSystemFileNode( *SF, CurDev, NNI, i ); |
319 | S = qApp->translate( "NetworkSettings", | 319 | if( ! S.isEmpty() ) |
320 | "<p>Error in preDeviceSection for file %1 and node %2</p>" ). | ||
321 | arg( SF->name() ). | ||
322 | arg( NN->nodeName() ); | ||
323 | return S; | ||
324 | } | ||
325 | |||
326 | if( ! NN->hasDataFor( SF->name(), 1 ) ) { | ||
327 | if( NN->generateDeviceDataForCommonFile( *SF, i, NNI ) ) { | ||
328 | S = qApp->translate( "NetworkSettings", | ||
329 | "<p>Error in node part for file %1 and node %2</p>" ). | ||
330 | arg( SF->name() ). | ||
331 | arg( NN->nodeName() ); | ||
332 | return S; | ||
333 | } | ||
334 | } | ||
335 | } | ||
336 | } else { | ||
337 | // just request this once | ||
338 | if( SF->preDeviceSection( NNI, -1 ) ) { | ||
339 | S = qApp->translate( "NetworkSettings", | ||
340 | "<p>Error in preDeviceSection for file %1 and node %2</p>" ). | ||
341 | arg( SF->name() ). | ||
342 | arg( NN->nodeName() ); | ||
343 | return S; | ||
344 | } | ||
345 | |||
346 | if( ! NN->hasDataFor( SF->name(), 1 ) ) { | ||
347 | if( NN->generateDeviceDataForCommonFile( *SF, -1, NNI ) ) { | ||
348 | S = qApp->translate( "NetworkSettings", | ||
349 | "<p>Error in node part for file %1 and node %2</p>" ). | ||
350 | arg( SF->name() ). | ||
351 | arg( NN->nodeName() ); | ||
352 | return S; | ||
353 | } | ||
354 | } | ||
355 | } | ||
356 | |||
357 | // now generate profile specific data for all | ||
358 | // connections working on a device of the current | ||
359 | // netnode type | ||
360 | for( QDictIterator<NodeCollection> ncit(M); | ||
361 | ncit.current(); | ||
362 | ++ncit ) { | ||
363 | NC = ncit.current(); | ||
364 | |||
365 | NNI = NC->getToplevel(); | ||
366 | |||
367 | // no output needed | ||
368 | if( ! NNI->netNode()->hasDataFor( SF->name(), 0 ) ) | ||
369 | continue; | ||
370 | |||
371 | // get the netnode that serves as the device for this | ||
372 | // connection | ||
373 | AsDevice * Dev = NC->device(); | ||
374 | |||
375 | if( CurDev ) { | ||
376 | if( CurDev != Dev ) { | ||
377 | // other device -> later | ||
378 | continue; | ||
379 | } | ||
380 | |||
381 | // generate 'entry' for every combination of device and profile | ||
382 | // each node delegates to deeper level | ||
383 | for( int i = 0; i < CurDev->count(); i ++ ) { | ||
384 | if( SF->preNodeSection( NNI, i ) ) { | ||
385 | S = qApp->translate( "NetworkSettings", | ||
386 | "<p>Error in preNodeSection for file %1 and node %2</p>" ). | ||
387 | arg( SF->name() ). | ||
388 | arg( NNI->netNode()->nodeName() ); | ||
389 | return S; | ||
390 | } | ||
391 | |||
392 | // ask all nodes in connection | ||
393 | |||
394 | for( QListIterator<ANetNodeInstance> cncit(*NC); | ||
395 | cncit.current(); | ||
396 | ++cncit ) { | ||
397 | NNI = cncit.current(); | ||
398 | |||
399 | if( NNI->netNode()->hasDataFor( SF->name(), 0 ) ) { | ||
400 | if( NNI->netNode()->generateDataForCommonFile(*SF,i,NNI) ) { | ||
401 | S = qApp->translate( "NetworkSettings", | ||
402 | "<p>Error in node part for file %1 and node %2</p>" ). | ||
403 | arg( SF->name() ). | ||
404 | arg( NNI->netNode()->nodeName() ); | ||
405 | return S; | ||
406 | } | ||
407 | } | ||
408 | } | ||
409 | |||
410 | if( SF->postNodeSection( NNI, i ) ) { | ||
411 | S = qApp->translate( "NetworkSettings", | ||
412 | "<p>Error in postNodeSection for file %1 and node %2</p>" ). | ||
413 | arg( SF->name() ). | ||
414 | arg( NNI->netNode()->nodeName() ); | ||
415 | return S; | ||
416 | } | ||
417 | } | ||
418 | |||
419 | } else { | ||
420 | if( Dev ) { | ||
421 | // other | ||
422 | continue; | ||
423 | } | ||
424 | |||
425 | // one entry to generate | ||
426 | if( SF->preNodeSection( NNI, -1 ) ) { | ||
427 | S = qApp->translate( "NetworkSettings", | ||
428 | "<p>Error in preNodeSection for file %1 and node %2</p>" ). | ||
429 | arg( SF->name() ). | ||
430 | arg( NNI->netNode()->nodeName() ); | ||
431 | return S; | ||
432 | } | ||
433 | |||
434 | if( NNI->netNode()->generateDataForCommonFile(*SF,-1,NNI) ) { | ||
435 | S = qApp->translate( "NetworkSettings", | ||
436 | "<p>Error in node part for file %1 and node %2</p>" ). | ||
437 | arg( SF->name() ). | ||
438 | arg( NNI->netNode()->nodeName() ); | ||
439 | return S; | ||
440 | } | ||
441 | |||
442 | if( SF->postNodeSection( NNI, -1 ) ) { | ||
443 | S = qApp->translate( "NetworkSettings", | ||
444 | "<p>Error in postNodeSection for file %1 and node %2</p>" ). | ||
445 | arg( SF->name() ). | ||
446 | arg( NNI->netNode()->nodeName() ); | ||
447 | return S; | ||
448 | } | ||
449 | } | ||
450 | |||
451 | // generated some data | ||
452 | if( SF->postNodeSection( NNI, -1 ) ) { | ||
453 | S = qApp->translate( "NetworkSettings", | ||
454 | "<p>Error in postNodeSection for file %1 and node %2</p>" ). | ||
455 | arg( SF->name() ). | ||
456 | arg( NNI->netNode()->nodeName() ); | ||
457 | return S; | ||
458 | } | ||
459 | *SF << endl; | ||
460 | } | ||
461 | |||
462 | if( CurDev ) { | ||
463 | // generate 'entry' for every combination of device and profile | ||
464 | // each node delegates to deeper level | ||
465 | for( int i = 0; i < CurDev->count(); i ++ ) { | ||
466 | if( SF->postDeviceSection( NNI, i ) ) { | ||
467 | S = qApp->translate( "NetworkSettings", | ||
468 | "<p>Error in postDeviceSection for file %1 and node %2</p>" ). | ||
469 | arg( SF->name() ). | ||
470 | arg( NNI->netNode()->nodeName() ); | ||
471 | return S; | 320 | return S; |
472 | } | ||
473 | } | 321 | } |
474 | } else { | 322 | } else { |
475 | if( SF->postDeviceSection( NNI, -1 ) ) { | 323 | S = generateSystemFileNode( *SF, 0, NNI, -1 ); |
476 | S = qApp->translate( "NetworkSettings", | 324 | if( ! S.isEmpty() ) |
477 | "<p>Error in postDeviceSection for file %1 and node %2</p>" ). | ||
478 | arg( SF->name() ). | ||
479 | arg( NNI->netNode()->nodeName() ); | ||
480 | return S; | 325 | return S; |
481 | } | ||
482 | } | 326 | } |
483 | } | 327 | } |
484 | 328 | ||
485 | if( SF->postSection() ) { | 329 | if( SF->postSection() ) { |
486 | S = qApp->translate( "NetworkSettings", | 330 | S = qApp->translate( "NetworkSettings", |
487 | "<p>Error in postSection for file %1</p>" ). | 331 | "<p>Error in postSection for file \"%1\"</p>" ). |
488 | arg( SF->name() ); | 332 | arg( SF->name() ); |
489 | return S; | 333 | return S; |
490 | } | 334 | } |
491 | 335 | ||
492 | } while( 0 ); | 336 | } while( 0 ); |
493 | SF->close(); | 337 | SF->close(); |
494 | } | 338 | } |
495 | } | 339 | } |
@@ -584,8 +428,113 @@ bool NetworkSettingsData::regenerate( void ) { | |||
584 | S = generateSettings( TRUE ); | 428 | S = generateSettings( TRUE ); |
585 | if( ! S.isEmpty() ) { | 429 | if( ! S.isEmpty() ) { |
586 | fprintf( stdout, "%s\n", S.latin1() ); | 430 | fprintf( stdout, "%s\n", S.latin1() ); |
587 | return 1; | 431 | return 1; |
588 | } | 432 | } |
589 | return 0; | 433 | return 0; |
590 | } | 434 | } |
591 | 435 | ||
436 | QString NetworkSettingsData::generateSystemFileNode( | ||
437 | SystemFile &SF, | ||
438 | AsDevice * CurDev, | ||
439 | ANetNodeInstance * DevNNI, | ||
440 | long DevInstNr ) { | ||
441 | |||
442 | QString S=""; | ||
443 | ANetNode * CurDevNN = DevNNI->nodeClass(); | ||
444 | Name2Connection_t & M = NSResources->connections(); | ||
445 | |||
446 | if( SF.preDeviceSection( CurDevNN ) ) { | ||
447 | S = qApp->translate( "NetworkSettings", | ||
448 | "<p>Error in preDeviceSection for file \"%1\" and nodetype \"%2\"</p>" ). | ||
449 | arg( SF.name() ). | ||
450 | arg( CurDevNN->nodeName() ); | ||
451 | return S; | ||
452 | } | ||
453 | |||
454 | if( CurDevNN->hasDataFor( SF.name() ) ) { | ||
455 | if( CurDevNN->generateDeviceDataForCommonFile( SF, DevInstNr ) ) { | ||
456 | S = qApp->translate( "NetworkSettings", | ||
457 | "<p>Error in node Device part for file \"%1\" and node \"%2\"</p>" ). | ||
458 | arg( SF.name() ). | ||
459 | arg( CurDevNN->nodeName() ); | ||
460 | return S; | ||
461 | } | ||
462 | } | ||
463 | |||
464 | if( CurDev ) | ||
465 | fprintf( stderr, "Cur %s\n", CurDevNN->nodeName().latin1() ); | ||
466 | else | ||
467 | fprintf( stderr, "Cur NO\n" ); | ||
468 | |||
469 | // now generate profile specific data for all | ||
470 | // connections working on a device of the current | ||
471 | // netnode type | ||
472 | for( QDictIterator<NodeCollection> ncit(M); | ||
473 | ncit.current(); | ||
474 | ++ncit ) { | ||
475 | NodeCollection * NC = ncit.current(); | ||
476 | |||
477 | // currenly only those connections that work on | ||
478 | // the current device (or on no device if no current) | ||
479 | AsDevice * Dev = NC->device(); | ||
480 | |||
481 | fprintf( stderr, "%s\n", Dev->netNode()->nodeName().latin1() ); | ||
482 | if( CurDev ) { | ||
483 | if( CurDevNN != Dev->netNode()->nodeClass() ) { | ||
484 | // other device type -> later | ||
485 | fprintf( stderr, "Other Dev type\n" ); | ||
486 | continue; | ||
487 | } | ||
488 | } else { | ||
489 | if( Dev ) { | ||
490 | // other | ||
491 | continue; | ||
492 | } | ||
493 | } | ||
494 | |||
495 | // generate 'entry' | ||
496 | if( SF.preNodeSection( DevNNI, DevInstNr ) ) { | ||
497 | S = qApp->translate( "NetworkSettings", | ||
498 | "<p>Error in preNodeSection for file \"%1\" and node \"%2\"</p>" ). | ||
499 | arg( SF.name() ). | ||
500 | arg( CurDevNN->nodeName() ); | ||
501 | return S; | ||
502 | } | ||
503 | |||
504 | // ask all nodes in connection | ||
505 | for( QListIterator<ANetNodeInstance> cncit(*NC); | ||
506 | cncit.current(); | ||
507 | ++cncit ) { | ||
508 | ANetNodeInstance * NNI = cncit.current(); | ||
509 | |||
510 | if( NNI->hasDataFor( SF.name() ) ) { | ||
511 | if( NNI->generateDataForCommonFile(SF,DevInstNr) ) { | ||
512 | S = qApp->translate( "NetworkSettings", | ||
513 | "<p>Error in node part for file \"%1\" and node \"%2\"</p>" ). | ||
514 | arg( SF.name() ). | ||
515 | arg( NNI->nodeClass()->nodeName() ); | ||
516 | return S; | ||
517 | } | ||
518 | } | ||
519 | } | ||
520 | |||
521 | if( SF.postNodeSection( DevNNI, DevInstNr ) ) { | ||
522 | S = qApp->translate( "NetworkSettings", | ||
523 | "<p>Error in postNodeSection for file \"%1\" and node \"%2\"</p>" ). | ||
524 | arg( SF.name() ). | ||
525 | arg( CurDevNN->nodeName() ); | ||
526 | return S; | ||
527 | } | ||
528 | SF << endl; | ||
529 | } | ||
530 | |||
531 | if( SF.postDeviceSection( CurDevNN ) ) { | ||
532 | S = qApp->translate( "NetworkSettings", | ||
533 | "<p>Error in postDeviceSection for file \"%1\" and node \"%2\"</p>" ). | ||
534 | arg( SF.name() ). | ||
535 | arg( CurDevNN->nodeName() ); | ||
536 | return S; | ||
537 | } | ||
538 | |||
539 | return S; | ||
540 | } | ||
diff --git a/noncore/settings/networksettings2/nsdata.h b/noncore/settings/networksettings2/nsdata.h index 55f8c71..b54df24 100644 --- a/noncore/settings/networksettings2/nsdata.h +++ b/noncore/settings/networksettings2/nsdata.h | |||
@@ -24,14 +24,19 @@ public : | |||
24 | void canStart( const char * Interface ); | 24 | void canStart( const char * Interface ); |
25 | bool regenerate( void ); | 25 | bool regenerate( void ); |
26 | 26 | ||
27 | void forceGeneration( bool m ) | 27 | void forceGeneration( bool m ) |
28 | { Force = m; } | 28 | { Force = m; } |
29 | 29 | ||
30 | private : | 30 | private : |
31 | 31 | ||
32 | QString NetworkSettingsData::generateSystemFileNode( | ||
33 | SystemFile & SF, | ||
34 | AsDevice * CurDev, | ||
35 | ANetNodeInstance * DevNNI, | ||
36 | long DevInstNr ); | ||
32 | bool IsModified; | 37 | bool IsModified; |
33 | bool Force; | 38 | bool Force; |
34 | 39 | ||
35 | }; | 40 | }; |
36 | 41 | ||
37 | #endif | 42 | #endif |
diff --git a/noncore/settings/networksettings2/ppp/ppp_NN.cpp b/noncore/settings/networksettings2/ppp/ppp_NN.cpp index 51d17ec..b3f70c5 100644 --- a/noncore/settings/networksettings2/ppp/ppp_NN.cpp +++ b/noncore/settings/networksettings2/ppp/ppp_NN.cpp | |||
@@ -39,31 +39,24 @@ const char * PPPNetNode::provides( void ) { | |||
39 | return "connection"; | 39 | return "connection"; |
40 | } | 40 | } |
41 | 41 | ||
42 | bool PPPNetNode::generateProperFilesFor( | 42 | bool PPPNetNode::generateProperFilesFor( |
43 | ANetNodeInstance * ) { | 43 | ANetNodeInstance * ) { |
44 | return 1; | 44 | return 1; |
45 | } | 45 | } |
46 | 46 | ||
47 | bool PPPNetNode::hasDataFor( const QString &, bool ) { | 47 | bool PPPNetNode::generateDeviceDataForCommonFile( |
48 | return 0; | ||
49 | } | ||
50 | |||
51 | bool PPPNetNode::generateDataForCommonFile( | ||
52 | SystemFile & , | 48 | SystemFile & , |
53 | long, | 49 | long ) { |
54 | ANetNodeInstance * ) { | ||
55 | return 1; | 50 | return 1; |
56 | } | 51 | } |
57 | 52 | ||
58 | bool PPPNetNode::generateDeviceDataForCommonFile( | 53 | QString PPPNetNode::genNic( long NicNr ) { |
59 | SystemFile & , | 54 | QString S; |
60 | long , | 55 | return S.sprintf( "ppp%ld", NicNr ); |
61 | ANetNodeInstance * ) { | ||
62 | return 1; | ||
63 | } | 56 | } |
64 | 57 | ||
65 | extern "C" { | 58 | extern "C" { |
66 | void create_plugin( QList<ANetNode> & PNN ) { | 59 | void create_plugin( QList<ANetNode> & PNN ) { |
67 | PNN.append( new PPPNetNode() ); | 60 | PNN.append( new PPPNetNode() ); |
68 | } | 61 | } |
69 | } | 62 | } |
diff --git a/noncore/settings/networksettings2/ppp/ppp_NN.h b/noncore/settings/networksettings2/ppp/ppp_NN.h index 8d56e7f..c33f281 100644 --- a/noncore/settings/networksettings2/ppp/ppp_NN.h +++ b/noncore/settings/networksettings2/ppp/ppp_NN.h | |||
@@ -23,21 +23,22 @@ public: | |||
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, bool DS ); | 31 | virtual bool hasDataFor( const QString & ) |
32 | virtual bool generateDataForCommonFile( | 32 | { return 0; } |
33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | ||
34 | virtual bool generateDeviceDataForCommonFile( | 33 | virtual bool generateDeviceDataForCommonFile( |
35 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | 34 | SystemFile & SF, long DevNr ); |
35 | |||
36 | virtual QString genNic( long NicNr ); | ||
36 | 37 | ||
37 | private: | 38 | private: |
38 | 39 | ||
39 | }; | 40 | }; |
40 | 41 | ||
41 | extern "C" | 42 | extern "C" |
42 | { | 43 | { |
43 | void create_plugin( QList<ANetNode> & PNN ); | 44 | void create_plugin( QList<ANetNode> & PNN ); |
diff --git a/noncore/settings/networksettings2/ppp/ppp_NNI.cpp b/noncore/settings/networksettings2/ppp/ppp_NNI.cpp index d09ecf9..d0fd31c 100644 --- a/noncore/settings/networksettings2/ppp/ppp_NNI.cpp +++ b/noncore/settings/networksettings2/ppp/ppp_NNI.cpp | |||
@@ -108,8 +108,14 @@ QString APPP::acceptable( void ) { | |||
108 | } | 108 | } |
109 | 109 | ||
110 | void APPP::commit( void ) { | 110 | void APPP::commit( void ) { |
111 | if( GUI && GUI->commit( Data ) ) { | 111 | if( GUI && GUI->commit( Data ) ) { |
112 | setModified( 1 ); | 112 | setModified( 1 ); |
113 | } | 113 | } |
114 | } | 114 | } |
115 | 115 | ||
116 | bool APPP::generateDataForCommonFile( | ||
117 | SystemFile & , | ||
118 | long) { | ||
119 | return 1; | ||
120 | } | ||
121 | |||
diff --git a/noncore/settings/networksettings2/ppp/ppp_NNI.h b/noncore/settings/networksettings2/ppp/ppp_NNI.h index a17721a..989c2f0 100644 --- a/noncore/settings/networksettings2/ppp/ppp_NNI.h +++ b/noncore/settings/networksettings2/ppp/ppp_NNI.h | |||
@@ -22,16 +22,21 @@ public : | |||
22 | { if( RT == 0 ) | 22 | { if( RT == 0 ) |
23 | RT = new PPPRun( this, Data ); | 23 | RT = new PPPRun( this, Data ); |
24 | return RT->runtimeInfo(); | 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 | virtual bool hasDataFor( const QString & ) | ||
31 | { return 0; } | ||
32 | |||
33 | virtual bool generateDataForCommonFile( | ||
34 | SystemFile & SF, long DevNr ); | ||
30 | protected : | 35 | protected : |
31 | 36 | ||
32 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 37 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
33 | virtual void saveSpecificAttribute( QTextStream & TS ); | 38 | virtual void saveSpecificAttribute( QTextStream & TS ); |
34 | 39 | ||
35 | private : | 40 | private : |
36 | 41 | ||
37 | PPPEdit * GUI; | 42 | PPPEdit * GUI; |
diff --git a/noncore/settings/networksettings2/ppp/ppprun.h b/noncore/settings/networksettings2/ppp/ppprun.h index 765aff2..af51fbe 100644 --- a/noncore/settings/networksettings2/ppp/ppprun.h +++ b/noncore/settings/networksettings2/ppp/ppprun.h | |||
@@ -7,18 +7,16 @@ | |||
7 | #include "pppdata.h" | 7 | #include "pppdata.h" |
8 | 8 | ||
9 | class PPPRun : public AsConnection, public AsDevice { | 9 | class PPPRun : public AsConnection, public AsDevice { |
10 | 10 | ||
11 | public : | 11 | public : |
12 | 12 | ||
13 | PPPRun( ANetNodeInstance * NNI, | 13 | PPPRun( ANetNodeInstance * NNI, |
14 | PPPData & Data ); | 14 | PPPData & Data ); |
15 | virtual QString genNic( long NicNr ) | ||
16 | { QString S; return S.sprintf( "ppp%ld", NicNr ); } | ||
17 | 15 | ||
18 | virtual AsDevice * asDevice( void ) | 16 | virtual AsDevice * asDevice( void ) |
19 | { return (AsDevice *)this; } | 17 | { return (AsDevice *)this; } |
20 | virtual AsConnection * asConnection( void ) | 18 | virtual AsConnection * asConnection( void ) |
21 | { return (AsConnection *)this; } | 19 | { return (AsConnection *)this; } |
22 | 20 | ||
23 | virtual AsDevice * device( void ) | 21 | virtual AsDevice * device( void ) |
24 | { return (AsDevice *)this; } | 22 | { return (AsDevice *)this; } |
diff --git a/noncore/settings/networksettings2/profile/profile_NN.cpp b/noncore/settings/networksettings2/profile/profile_NN.cpp index fcf1ca6..7609cdc 100644 --- a/noncore/settings/networksettings2/profile/profile_NN.cpp +++ b/noncore/settings/networksettings2/profile/profile_NN.cpp | |||
@@ -38,31 +38,19 @@ const char * ProfileNetNode::provides( void ) { | |||
38 | return "fullsetup"; | 38 | return "fullsetup"; |
39 | } | 39 | } |
40 | 40 | ||
41 | bool ProfileNetNode::generateProperFilesFor( | 41 | bool ProfileNetNode::generateProperFilesFor( |
42 | ANetNodeInstance * ) { | 42 | ANetNodeInstance * ) { |
43 | return 1; | 43 | return 1; |
44 | } | 44 | } |
45 | 45 | ||
46 | bool ProfileNetNode::hasDataFor( const QString &, bool ) { | ||
47 | return 0; | ||
48 | } | ||
49 | |||
50 | bool ProfileNetNode::generateDataForCommonFile( | ||
51 | SystemFile & , | ||
52 | long, | ||
53 | ANetNodeInstance * ) { | ||
54 | return 1; | ||
55 | } | ||
56 | |||
57 | bool ProfileNetNode::generateDeviceDataForCommonFile( | 46 | bool ProfileNetNode::generateDeviceDataForCommonFile( |
58 | SystemFile & , | 47 | SystemFile & , |
59 | long , | 48 | long ) { |
60 | ANetNodeInstance * ) { | ||
61 | return 1; | 49 | return 1; |
62 | } | 50 | } |
63 | 51 | ||
64 | extern "C" { | 52 | extern "C" { |
65 | void create_plugin( QList<ANetNode> & PNN ) { | 53 | void create_plugin( QList<ANetNode> & PNN ) { |
66 | PNN.append( new ProfileNetNode() ); | 54 | PNN.append( new ProfileNetNode() ); |
67 | } | 55 | } |
68 | } | 56 | } |
diff --git a/noncore/settings/networksettings2/profile/profile_NN.h b/noncore/settings/networksettings2/profile/profile_NN.h index b64a6dd..f7c2b22 100644 --- a/noncore/settings/networksettings2/profile/profile_NN.h +++ b/noncore/settings/networksettings2/profile/profile_NN.h | |||
@@ -23,21 +23,20 @@ public: | |||
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, bool DS ); | 31 | virtual bool hasDataFor( const QString & ) |
32 | virtual bool generateDataForCommonFile( | 32 | { return 0; } |
33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | ||
34 | virtual bool generateDeviceDataForCommonFile( | 33 | virtual bool generateDeviceDataForCommonFile( |
35 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | 34 | SystemFile & SF, long DevNr); |
36 | 35 | ||
37 | private: | 36 | private: |
38 | 37 | ||
39 | }; | 38 | }; |
40 | 39 | ||
41 | extern "C" | 40 | extern "C" |
42 | { | 41 | { |
43 | void create_plugin( QList<ANetNode> & PNN ); | 42 | void create_plugin( QList<ANetNode> & PNN ); |
diff --git a/noncore/settings/networksettings2/profile/profile_NNI.cpp b/noncore/settings/networksettings2/profile/profile_NNI.cpp index bc0118e..5b54aa4 100644 --- a/noncore/settings/networksettings2/profile/profile_NNI.cpp +++ b/noncore/settings/networksettings2/profile/profile_NNI.cpp | |||
@@ -41,8 +41,14 @@ QString AProfile::acceptable( void ) { | |||
41 | return ( GUI ) ? GUI->acceptable( ) : QString(); | 41 | return ( GUI ) ? GUI->acceptable( ) : QString(); |
42 | } | 42 | } |
43 | 43 | ||
44 | void AProfile::commit( void ) { | 44 | void AProfile::commit( void ) { |
45 | if( GUI && GUI->commit( Data ) ) | 45 | if( GUI && GUI->commit( Data ) ) |
46 | setModified( 1 ); | 46 | setModified( 1 ); |
47 | } | 47 | } |
48 | 48 | ||
49 | bool AProfile::generateDataForCommonFile( | ||
50 | SystemFile & , | ||
51 | long) { | ||
52 | return 1; | ||
53 | } | ||
54 | |||
diff --git a/noncore/settings/networksettings2/profile/profile_NNI.h b/noncore/settings/networksettings2/profile/profile_NNI.h index dfeb178..2c2db7f 100644 --- a/noncore/settings/networksettings2/profile/profile_NNI.h +++ b/noncore/settings/networksettings2/profile/profile_NNI.h | |||
@@ -24,16 +24,22 @@ public : | |||
24 | { if( RT == 0 ) | 24 | { if( RT == 0 ) |
25 | RT = new ProfileRun( this, Data ); | 25 | RT = new ProfileRun( this, Data ); |
26 | return RT; | 26 | return RT; |
27 | } | 27 | } |
28 | 28 | ||
29 | virtual void * data( void ) | 29 | virtual void * data( void ) |
30 | { return (void *)&Data; } | 30 | { return (void *)&Data; } |
31 | 31 | ||
32 | virtual bool hasDataFor( const QString & ) | ||
33 | { return 0; } | ||
34 | |||
35 | virtual bool generateDataForCommonFile( | ||
36 | SystemFile & SF, long DevNr); | ||
37 | |||
32 | protected : | 38 | protected : |
33 | 39 | ||
34 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 40 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
35 | virtual void saveSpecificAttribute( QTextStream & TS ); | 41 | virtual void saveSpecificAttribute( QTextStream & TS ); |
36 | 42 | ||
37 | private : | 43 | private : |
38 | 44 | ||
39 | ProfileEdit * GUI; | 45 | ProfileEdit * GUI; |
diff --git a/noncore/settings/networksettings2/usb/usb_NN.cpp b/noncore/settings/networksettings2/usb/usb_NN.cpp index be4a2bc..30c72db 100644 --- a/noncore/settings/networksettings2/usb/usb_NN.cpp +++ b/noncore/settings/networksettings2/usb/usb_NN.cpp | |||
@@ -37,31 +37,35 @@ const char * USBNetNode::provides( void ) { | |||
37 | return "device"; | 37 | return "device"; |
38 | } | 38 | } |
39 | 39 | ||
40 | bool USBNetNode::generateProperFilesFor( | 40 | bool USBNetNode::generateProperFilesFor( |
41 | ANetNodeInstance * ) { | 41 | ANetNodeInstance * ) { |
42 | return 1; | 42 | return 1; |
43 | } | 43 | } |
44 | 44 | ||
45 | bool USBNetNode::hasDataFor( const QString & S, bool ) { | 45 | bool USBNetNode::hasDataFor( const QString & S ) { |
46 | return (S== "interfaces"); | 46 | return (S== "interfaces"); |
47 | } | 47 | } |
48 | 48 | ||
49 | bool USBNetNode::generateDataForCommonFile( | 49 | bool USBNetNode::generateDeviceDataForCommonFile( |
50 | SystemFile & S , | 50 | SystemFile & S , |
51 | long DevNr, | 51 | long DevNr ) { |
52 | ANetNodeInstance * NNI) { | 52 | QString NIC = genNic( DevNr ); |
53 | return ((AUSB *)NNI)->generateDataForCommonFile(S, DevNr); | 53 | |
54 | if( S.name() == "interfaces" ) { | ||
55 | // generate mapping stanza for this interface | ||
56 | S << "# check if " << NIC << " can be brought UP" << endl; | ||
57 | S << "mapping " << NIC << endl; | ||
58 | S << " script networksettings2-request" << endl << endl; | ||
59 | } | ||
60 | return 0; | ||
54 | } | 61 | } |
55 | 62 | ||
56 | bool USBNetNode::generateDeviceDataForCommonFile( | 63 | QString USBNetNode::genNic( long ) { |
57 | SystemFile & S , | 64 | return QString( "usbf" ); |
58 | long DevNr, | ||
59 | ANetNodeInstance * NNI) { | ||
60 | return ((AUSB *)NNI)->generateDeviceDataForCommonFile(S, DevNr); | ||
61 | } | 65 | } |
62 | 66 | ||
63 | extern "C" { | 67 | extern "C" { |
64 | void create_plugin( QList<ANetNode> & PNN ) { | 68 | void create_plugin( QList<ANetNode> & PNN ) { |
65 | PNN.append( new USBNetNode() ); | 69 | PNN.append( new USBNetNode() ); |
66 | } | 70 | } |
67 | } | 71 | } |
diff --git a/noncore/settings/networksettings2/usb/usb_NN.h b/noncore/settings/networksettings2/usb/usb_NN.h index 8ff5289..ba22b1c 100644 --- a/noncore/settings/networksettings2/usb/usb_NN.h +++ b/noncore/settings/networksettings2/usb/usb_NN.h | |||
@@ -23,21 +23,21 @@ public: | |||
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, bool DeviceSpec ); | 31 | virtual bool hasDataFor( const QString & S); |
32 | virtual bool generateDataForCommonFile( | ||
33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | ||
34 | virtual bool generateDeviceDataForCommonFile( | 32 | virtual bool generateDeviceDataForCommonFile( |
35 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | 33 | SystemFile & SF, long DevNr ); |
34 | |||
35 | virtual QString genNic( long nr ); | ||
36 | 36 | ||
37 | private: | 37 | private: |
38 | 38 | ||
39 | }; | 39 | }; |
40 | 40 | ||
41 | extern "C" | 41 | extern "C" |
42 | { | 42 | { |
43 | void create_plugin( QList<ANetNode> & PNN ); | 43 | void create_plugin( QList<ANetNode> & PNN ); |
diff --git a/noncore/settings/networksettings2/usb/usb_NNI.cpp b/noncore/settings/networksettings2/usb/usb_NNI.cpp index 6fcd6d5..e90204c 100644 --- a/noncore/settings/networksettings2/usb/usb_NNI.cpp +++ b/noncore/settings/networksettings2/usb/usb_NNI.cpp | |||
@@ -27,31 +27,26 @@ QString AUSB::acceptable( void ) { | |||
27 | } | 27 | } |
28 | 28 | ||
29 | void AUSB::commit( void ) { | 29 | void AUSB::commit( void ) { |
30 | if( GUI && GUI->commit( Data ) ) { | 30 | if( GUI && GUI->commit( Data ) ) { |
31 | setModified( 1 ); | 31 | setModified( 1 ); |
32 | } | 32 | } |
33 | } | 33 | } |
34 | 34 | ||
35 | bool AUSB::generateDataForCommonFile( SystemFile & S, long DevNr ) { | 35 | bool AUSB::hasDataFor( const QString & S ) { |
36 | AsDevice * Dev = runtime()->device(); | 36 | return (S== "interfaces"); |
37 | QString NIC = Dev->genNic( DevNr ); | ||
38 | |||
39 | if( S.name() == "interfaces" ) { | ||
40 | // generate mapping stanza for this interface | ||
41 | S << " pre-up " << QPEApplication::qpeDir() << "bin/setmacaddress.sh " << NIC << " || true" << endl; | ||
42 | } | ||
43 | return 0; | ||
44 | } | 37 | } |
45 | 38 | ||
46 | bool AUSB::generateDeviceDataForCommonFile( SystemFile & S, long DevNr ) { | 39 | bool AUSB::generateDataForCommonFile( SystemFile & S, long DevNr ) { |
47 | AsDevice * Dev = runtime()->device(); | 40 | QString NIC = runtime()->device()->netNode()->nodeClass()->genNic( DevNr ); |
48 | QString NIC = Dev->genNic( DevNr ); | ||
49 | 41 | ||
50 | if( S.name() == "interfaces" ) { | 42 | if( S.name() == "interfaces" ) { |
51 | // generate mapping stanza for this interface | 43 | // generate mapping stanza for this interface |
52 | S << "# check if " << NIC << " can be brought UP" << endl; | 44 | S << " pre-up " |
53 | S << "mapping " << NIC << endl; | 45 | << QPEApplication::qpeDir() |
54 | S << " script networksettings2-request" << endl << endl; | 46 | << "bin/setmacaddress.sh " |
47 | << NIC | ||
48 | << " || true" | ||
49 | << endl; | ||
55 | } | 50 | } |
56 | return 0; | 51 | return 0; |
57 | } | 52 | } |
diff --git a/noncore/settings/networksettings2/usb/usb_NNI.h b/noncore/settings/networksettings2/usb/usb_NNI.h index 5dead36..d2ee217 100644 --- a/noncore/settings/networksettings2/usb/usb_NNI.h +++ b/noncore/settings/networksettings2/usb/usb_NNI.h | |||
@@ -22,18 +22,19 @@ public : | |||
22 | { if( RT == 0 ) | 22 | { if( RT == 0 ) |
23 | RT = new USBRun( this, Data ); | 23 | RT = new USBRun( 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 | bool generateDataForCommonFile( SystemFile & S, long DevNr ); | 30 | virtual bool hasDataFor( const QString & S); |
31 | bool generateDeviceDataForCommonFile( SystemFile & S, long DevNr ); | 31 | virtual bool generateDataForCommonFile( |
32 | SystemFile & SF, long DevNr ); | ||
32 | 33 | ||
33 | protected : | 34 | protected : |
34 | 35 | ||
35 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 36 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
36 | virtual void saveSpecificAttribute( QTextStream & TS ); | 37 | virtual void saveSpecificAttribute( QTextStream & TS ); |
37 | 38 | ||
38 | private : | 39 | private : |
39 | 40 | ||
diff --git a/noncore/settings/networksettings2/usb/usbrun.cpp b/noncore/settings/networksettings2/usb/usbrun.cpp index 3007e79..4ce6721 100644 --- a/noncore/settings/networksettings2/usb/usbrun.cpp +++ b/noncore/settings/networksettings2/usb/usbrun.cpp | |||
@@ -169,14 +169,8 @@ InterfaceInfo * USBRun::getInterface( void ) { | |||
169 | } | 169 | } |
170 | return best; // can be 0 | 170 | return best; // can be 0 |
171 | } | 171 | } |
172 | 172 | ||
173 | bool USBRun::handlesInterface( const QString & S ) { | 173 | bool USBRun::handlesInterface( const QString & S ) { |
174 | return Pat.match( S ) >= 0; | 174 | return Pat.match( S ) >= 0; |
175 | } | 175 | } |
176 | 176 | ||
177 | QString USBRun::genNic( long nr ) { | ||
178 | QString S; | ||
179 | S.sprintf( "usbf" ); | ||
180 | return S; | ||
181 | } | ||
182 | |||
diff --git a/noncore/settings/networksettings2/usb/usbrun.h b/noncore/settings/networksettings2/usb/usbrun.h index 60f9fe8..6c6e4e4 100644 --- a/noncore/settings/networksettings2/usb/usbrun.h +++ b/noncore/settings/networksettings2/usb/usbrun.h | |||
@@ -10,20 +10,16 @@ class USBRun : public AsDevice { | |||
10 | public : | 10 | public : |
11 | 11 | ||
12 | USBRun( ANetNodeInstance * NNI, | 12 | USBRun( ANetNodeInstance * NNI, |
13 | USBData & Data ) : | 13 | USBData & Data ) : |
14 | AsDevice( NNI ), | 14 | AsDevice( NNI ), |
15 | Pat( "usb[0-9abcdef]" ) | 15 | Pat( "usb[0-9abcdef]" ) |
16 | { } | 16 | { } |
17 | 17 | ||
18 | virtual long count( void ) | ||
19 | { return 1; } | ||
20 | virtual QString genNic( long nr ); | ||
21 | |||
22 | virtual AsDevice * device( void ) | 18 | virtual AsDevice * device( void ) |
23 | { return (AsDevice *)this; } | 19 | { return (AsDevice *)this; } |
24 | 20 | ||
25 | virtual AsDevice * asDevice( void ) | 21 | virtual AsDevice * asDevice( void ) |
26 | { return (AsDevice *)this; } | 22 | { return (AsDevice *)this; } |
27 | protected : | 23 | protected : |
28 | 24 | ||
29 | void detectState( NodeCollection * ); | 25 | void detectState( NodeCollection * ); |
diff --git a/noncore/settings/networksettings2/vpn/vpn_NN.cpp b/noncore/settings/networksettings2/vpn/vpn_NN.cpp index f570fb2..d9aa892 100644 --- a/noncore/settings/networksettings2/vpn/vpn_NN.cpp +++ b/noncore/settings/networksettings2/vpn/vpn_NN.cpp | |||
@@ -38,31 +38,19 @@ const char * VPNNetNode::provides( void ) { | |||
38 | return "connection"; | 38 | return "connection"; |
39 | } | 39 | } |
40 | 40 | ||
41 | bool VPNNetNode::generateProperFilesFor( | 41 | bool VPNNetNode::generateProperFilesFor( |
42 | ANetNodeInstance * ) { | 42 | ANetNodeInstance * ) { |
43 | return 1; | 43 | return 1; |
44 | } | 44 | } |
45 | 45 | ||
46 | bool VPNNetNode::hasDataFor( const QString &, bool ) { | ||
47 | return 0; | ||
48 | } | ||
49 | |||
50 | bool VPNNetNode::generateDataForCommonFile( | ||
51 | SystemFile & , | ||
52 | long, | ||
53 | ANetNodeInstance * ) { | ||
54 | return 1; | ||
55 | } | ||
56 | |||
57 | bool VPNNetNode::generateDeviceDataForCommonFile( | 46 | bool VPNNetNode::generateDeviceDataForCommonFile( |
58 | SystemFile & , | 47 | SystemFile & , |
59 | long , | 48 | long ) { |
60 | ANetNodeInstance * ) { | ||
61 | return 1; | 49 | return 1; |
62 | } | 50 | } |
63 | 51 | ||
64 | extern "C" { | 52 | extern "C" { |
65 | void create_plugin( QList<ANetNode> & PNN ) { | 53 | void create_plugin( QList<ANetNode> & PNN ) { |
66 | PNN.append( new VPNNetNode() ); | 54 | PNN.append( new VPNNetNode() ); |
67 | } | 55 | } |
68 | } | 56 | } |
diff --git a/noncore/settings/networksettings2/vpn/vpn_NN.h b/noncore/settings/networksettings2/vpn/vpn_NN.h index cdb5117..7ce8e3a 100644 --- a/noncore/settings/networksettings2/vpn/vpn_NN.h +++ b/noncore/settings/networksettings2/vpn/vpn_NN.h | |||
@@ -23,21 +23,20 @@ public: | |||
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, bool DS ); | 31 | virtual bool hasDataFor( const QString & ) |
32 | virtual bool generateDataForCommonFile( | 32 | { return 0; } |
33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | ||
34 | virtual bool generateDeviceDataForCommonFile( | 33 | virtual bool generateDeviceDataForCommonFile( |
35 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | 34 | SystemFile & SF, long DevNr ); |
36 | 35 | ||
37 | private: | 36 | private: |
38 | 37 | ||
39 | }; | 38 | }; |
40 | 39 | ||
41 | extern "C" | 40 | extern "C" |
42 | { | 41 | { |
43 | void create_plugin( QList<ANetNode> & PNN ); | 42 | void create_plugin( QList<ANetNode> & PNN ); |
diff --git a/noncore/settings/networksettings2/vpn/vpn_NNI.cpp b/noncore/settings/networksettings2/vpn/vpn_NNI.cpp index 6c20aeb..ee999e8 100644 --- a/noncore/settings/networksettings2/vpn/vpn_NNI.cpp +++ b/noncore/settings/networksettings2/vpn/vpn_NNI.cpp | |||
@@ -23,8 +23,14 @@ QString AVPN::acceptable( void ) { | |||
23 | return ( GUI ) ? GUI->acceptable( ) : QString(); | 23 | return ( GUI ) ? GUI->acceptable( ) : QString(); |
24 | } | 24 | } |
25 | 25 | ||
26 | void AVPN::commit( void ) { | 26 | void AVPN::commit( void ) { |
27 | if( GUI && GUI->commit( Data ) ) | 27 | if( GUI && GUI->commit( Data ) ) |
28 | setModified( 1 ); | 28 | setModified( 1 ); |
29 | } | 29 | } |
30 | 30 | ||
31 | bool AVPN::generateDataForCommonFile( | ||
32 | SystemFile & , | ||
33 | long) { | ||
34 | return 1; | ||
35 | } | ||
36 | |||
diff --git a/noncore/settings/networksettings2/vpn/vpn_NNI.h b/noncore/settings/networksettings2/vpn/vpn_NNI.h index 31ce0d6..c3eb016 100644 --- a/noncore/settings/networksettings2/vpn/vpn_NNI.h +++ b/noncore/settings/networksettings2/vpn/vpn_NNI.h | |||
@@ -22,16 +22,20 @@ public : | |||
22 | { if( RT == 0 ) | 22 | { if( RT == 0 ) |
23 | RT = new VPNRun( this, Data ); | 23 | RT = new VPNRun( 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 | virtual bool hasDataFor( const QString & ) | ||
31 | { return 0; } | ||
32 | virtual bool generateDataForCommonFile( | ||
33 | SystemFile & SF, long DevNr ); | ||
30 | protected : | 34 | protected : |
31 | 35 | ||
32 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 36 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
33 | virtual void saveSpecificAttribute( QTextStream & TS ); | 37 | virtual void saveSpecificAttribute( QTextStream & TS ); |
34 | 38 | ||
35 | private : | 39 | private : |
36 | 40 | ||
37 | VPNEdit * GUI; | 41 | VPNEdit * GUI; |
diff --git a/noncore/settings/networksettings2/wlan/wlan_NN.cpp b/noncore/settings/networksettings2/wlan/wlan_NN.cpp index e1e20c0..4e59ac1 100644 --- a/noncore/settings/networksettings2/wlan/wlan_NN.cpp +++ b/noncore/settings/networksettings2/wlan/wlan_NN.cpp | |||
@@ -37,31 +37,36 @@ const char * WLanNetNode::provides( void ) { | |||
37 | return "device"; | 37 | return "device"; |
38 | } | 38 | } |
39 | 39 | ||
40 | bool WLanNetNode::generateProperFilesFor( | 40 | bool WLanNetNode::generateProperFilesFor( |
41 | ANetNodeInstance * ) { | 41 | ANetNodeInstance * ) { |
42 | return 1; | 42 | return 1; |
43 | } | 43 | } |
44 | 44 | ||
45 | bool WLanNetNode::hasDataFor( const QString & S, bool DS ) { | 45 | bool WLanNetNode::hasDataFor( const QString & S ) { |
46 | return DS && S == "interfaces"; | 46 | return S == "interfaces"; |
47 | } | ||
48 | |||
49 | bool WLanNetNode::generateDataForCommonFile( | ||
50 | SystemFile &, | ||
51 | long , | ||
52 | ANetNodeInstance * ) { | ||
53 | return 1; | ||
54 | } | 47 | } |
55 | 48 | ||
56 | bool WLanNetNode::generateDeviceDataForCommonFile( | 49 | bool WLanNetNode::generateDeviceDataForCommonFile( |
57 | SystemFile & S, | 50 | SystemFile & S, |
58 | long DevNr, | 51 | long DevNr ) { |
59 | ANetNodeInstance * NNI ) { | 52 | QString NIC = genNic( DevNr ); |
60 | return ((AWLan *)NNI)->generateDeviceDataForCommonFile(S, DevNr); | 53 | |
54 | if( S.name() == "interfaces" ) { | ||
55 | // generate mapping stanza for this interface | ||
56 | S << "# check if " << NIC << " can be brought UP" << endl; | ||
57 | S << "mapping " << NIC << endl; | ||
58 | S << " script networksettings2-request" << endl << endl; | ||
59 | } | ||
60 | return 0; | ||
61 | } | ||
62 | |||
63 | QString WLanNetNode::genNic( long nr ) { | ||
64 | QString S; | ||
65 | return S.sprintf( "wlan%ld", nr ); | ||
61 | } | 66 | } |
62 | 67 | ||
63 | extern "C" { | 68 | extern "C" { |
64 | void create_plugin( QList<ANetNode> & PNN ) { | 69 | void create_plugin( QList<ANetNode> & PNN ) { |
65 | PNN.append( new WLanNetNode() ); | 70 | PNN.append( new WLanNetNode() ); |
66 | } | 71 | } |
67 | } | 72 | } |
diff --git a/noncore/settings/networksettings2/wlan/wlan_NN.h b/noncore/settings/networksettings2/wlan/wlan_NN.h index 9111995..f27e71c 100644 --- a/noncore/settings/networksettings2/wlan/wlan_NN.h +++ b/noncore/settings/networksettings2/wlan/wlan_NN.h | |||
@@ -23,21 +23,25 @@ public: | |||
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, bool DS ); | 31 | |
32 | virtual bool generateDataForCommonFile( | 32 | virtual bool hasDataFor( const QString & S ); |
33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | ||
34 | virtual bool generateDeviceDataForCommonFile( | 33 | virtual bool generateDeviceDataForCommonFile( |
35 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | 34 | SystemFile & SF, long DevNr ); |
35 | |||
36 | virtual long instanceCount( void ) | ||
37 | { return 2; } | ||
38 | |||
39 | virtual QString genNic( long ); | ||
36 | 40 | ||
37 | private: | 41 | private: |
38 | 42 | ||
39 | }; | 43 | }; |
40 | 44 | ||
41 | extern "C" | 45 | extern "C" |
42 | { | 46 | { |
43 | void create_plugin( QList<ANetNode> & PNN ); | 47 | void create_plugin( QList<ANetNode> & PNN ); |
diff --git a/noncore/settings/networksettings2/wlan/wlan_NNI.cpp b/noncore/settings/networksettings2/wlan/wlan_NNI.cpp index 8b948e0..78e756c 100644 --- a/noncore/settings/networksettings2/wlan/wlan_NNI.cpp +++ b/noncore/settings/networksettings2/wlan/wlan_NNI.cpp | |||
@@ -23,20 +23,14 @@ QString AWLan::acceptable( void ) { | |||
23 | return ( GUI ) ? GUI->acceptable( ) : QString(); | 23 | return ( GUI ) ? GUI->acceptable( ) : QString(); |
24 | } | 24 | } |
25 | 25 | ||
26 | void AWLan::commit( void ) { | 26 | void AWLan::commit( void ) { |
27 | if( GUI && GUI->commit( Data ) ) | 27 | if( GUI && GUI->commit( Data ) ) |
28 | setModified( 1 ); | 28 | setModified( 1 ); |
29 | } | 29 | } |
30 | 30 | ||
31 | bool AWLan::generateDeviceDataForCommonFile( SystemFile & S, long DevNr ) { | 31 | bool AWLan::generateDataForCommonFile( |
32 | AsDevice * Dev = runtime()->device(); | 32 | SystemFile &, |
33 | QString NIC = Dev->genNic( DevNr ); | 33 | long ) { |
34 | 34 | return 1; | |
35 | if( S.name() == "interfaces" ) { | ||
36 | // generate mapping stanza for this interface | ||
37 | S << "# check if " << NIC << " can be brought UP" << endl; | ||
38 | S << "mapping " << NIC << endl; | ||
39 | S << " script networksettings2-request" << endl << endl; | ||
40 | } | ||
41 | return 0; | ||
42 | } | 35 | } |
36 | |||
diff --git a/noncore/settings/networksettings2/wlan/wlan_NNI.h b/noncore/settings/networksettings2/wlan/wlan_NNI.h index e464c84..d861d13 100644 --- a/noncore/settings/networksettings2/wlan/wlan_NNI.h +++ b/noncore/settings/networksettings2/wlan/wlan_NNI.h | |||
@@ -22,18 +22,20 @@ public : | |||
22 | { if( RT == 0 ) | 22 | { if( RT == 0 ) |
23 | RT = new WLanRun( this, Data ); | 23 | RT = new WLanRun( 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 | bool generateDeviceDataForCommonFile( SystemFile & S, long DevNr ); | 30 | virtual bool hasDataFor( const QString & ) |
31 | 31 | { return 0; } | |
32 | virtual bool generateDataForCommonFile( | ||
33 | SystemFile & SF, long DevNr ); | ||
32 | protected : | 34 | protected : |
33 | 35 | ||
34 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 36 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
35 | virtual void saveSpecificAttribute( QTextStream & TS ); | 37 | virtual void saveSpecificAttribute( QTextStream & TS ); |
36 | 38 | ||
37 | private : | 39 | private : |
38 | 40 | ||
39 | WLanEdit * GUI; | 41 | WLanEdit * GUI; |
diff --git a/noncore/settings/networksettings2/wlan/wlanrun.h b/noncore/settings/networksettings2/wlan/wlanrun.h index b853262..f46bcb7 100644 --- a/noncore/settings/networksettings2/wlan/wlanrun.h +++ b/noncore/settings/networksettings2/wlan/wlanrun.h | |||
@@ -9,20 +9,16 @@ class WLanRun : public AsDevice { | |||
9 | 9 | ||
10 | public : | 10 | public : |
11 | 11 | ||
12 | WLanRun( ANetNodeInstance * NNI, WLanData & Data ) : | 12 | WLanRun( ANetNodeInstance * NNI, WLanData & Data ) : |
13 | AsDevice( NNI ), | 13 | AsDevice( NNI ), |
14 | Pat( "wlan[0-9]" ) | 14 | Pat( "wlan[0-9]" ) |
15 | { } | 15 | { } |
16 | 16 | ||
17 | virtual long count( void ) | ||
18 | { return 2; } | ||
19 | virtual QString genNic( long nr ) | ||
20 | { QString S; return S.sprintf( "wlan%ld", nr ); } | ||
21 | virtual AsDevice * device( void ) | 17 | virtual AsDevice * device( void ) |
22 | { return (AsDevice *)this; } | 18 | { return (AsDevice *)this; } |
23 | virtual AsDevice * asDevice( void ) | 19 | virtual AsDevice * asDevice( void ) |
24 | { return (AsDevice *)this; } | 20 | { return (AsDevice *)this; } |
25 | 21 | ||
26 | protected : | 22 | protected : |
27 | 23 | ||
28 | void detectState( NodeCollection * ) | 24 | void detectState( NodeCollection * ) |