21 files changed, 222 insertions, 518 deletions
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NN.cpp b/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NN.cpp index 5e4d951..5c2b8b2 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NN.cpp +++ b/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NN.cpp | |||
@@ -4,8 +4,4 @@ | |||
4 | 4 | ||
5 | #ifndef MYPLUGIN | ||
6 | |||
7 | #include "netnodeinterface.h" | 5 | #include "netnodeinterface.h" |
8 | 6 | ||
9 | #endif | ||
10 | |||
11 | // | 7 | // |
@@ -77,18 +73,3 @@ void BluetoothBNEPNetNode::saveSpecificAttribute( QTextStream & TS) { | |||
77 | 73 | ||
78 | #ifndef MYPLUGIN | ||
79 | |||
80 | extern "C" { | ||
81 | // create plugin registers both BT functions | ||
82 | void create_plugin( QList<ANetNode> & PNN ) { | ||
83 | PNN.append( new BluetoothBNEPNetNode() ); | ||
84 | PNN.append( new BluetoothRFCOMMNetNode() ); | ||
85 | } | ||
86 | |||
87 | #else | ||
88 | |||
89 | typedef Opie::Core::MakeTypelist<BluetoothBNEPNetNode, BluetoothRFCOMMNetNode>::Result BluetoothTypes; | 74 | typedef Opie::Core::MakeTypelist<BluetoothBNEPNetNode, BluetoothRFCOMMNetNode>::Result BluetoothTypes; |
90 | OPIE_NS2_PLUGIN( NetNodeInterface<BluetoothTypes> ) | 75 | OPIE_NS2_PLUGIN( NetNodeInterface_T<BluetoothTypes> ) |
91 | |||
92 | #endif | ||
93 | |||
94 | } | ||
diff --git a/noncore/settings/networksettings2/cable/cable_NN.cpp b/noncore/settings/networksettings2/cable/cable_NN.cpp index 20299e4..58237a1 100644 --- a/noncore/settings/networksettings2/cable/cable_NN.cpp +++ b/noncore/settings/networksettings2/cable/cable_NN.cpp | |||
@@ -3,8 +3,4 @@ | |||
3 | 3 | ||
4 | #ifndef MYPLUGIN | ||
5 | |||
6 | #include "netnodeinterface.h" | 4 | #include "netnodeinterface.h" |
7 | 5 | ||
8 | #endif | ||
9 | |||
10 | static const char * CableNeeds[] = | 6 | static const char * CableNeeds[] = |
@@ -55,15 +51,2 @@ void CableNetNode::saveSpecificAttribute( QTextStream & ) { | |||
55 | 51 | ||
56 | #ifdef MYPLUGIN | 52 | OPIE_NS2_PLUGIN( NetNodeInterface_T<CableNetNode> ) |
57 | |||
58 | extern "C" { | ||
59 | void create_plugin( QList<ANetNode> & PNN ) { | ||
60 | PNN.append( new CableNetNode() ); | ||
61 | } | ||
62 | |||
63 | #else | ||
64 | |||
65 | OPIE_NS2_PLUGIN( NetNodeInterface<CableNetNode> ) | ||
66 | |||
67 | #endif | ||
68 | |||
69 | } | ||
diff --git a/noncore/settings/networksettings2/editconnection.cpp b/noncore/settings/networksettings2/editconnection.cpp index 3f8a53f..0c3ead6 100644 --- a/noncore/settings/networksettings2/editconnection.cpp +++ b/noncore/settings/networksettings2/editconnection.cpp | |||
@@ -323,7 +323,6 @@ void EditConnection::buildFullTree( void ) { | |||
323 | // TCP/IP Connection | 323 | // TCP/IP Connection |
324 | for( QDictIterator<NetNode_t> Iter(NSResources->netNodes()); | 324 | for( QDictIterator<ANetNode> Iter(NSResources->netNodes()); |
325 | Iter.current(); | 325 | Iter.current(); |
326 | ++Iter ) { | 326 | ++Iter ) { |
327 | 327 | NN = Iter.current(); | |
328 | NN = Iter.current()->NetNode; | ||
329 | 328 | ||
diff --git a/noncore/settings/networksettings2/gprs/GPRS_NN.cpp b/noncore/settings/networksettings2/gprs/GPRS_NN.cpp index 4415739..e9553a6 100644 --- a/noncore/settings/networksettings2/gprs/GPRS_NN.cpp +++ b/noncore/settings/networksettings2/gprs/GPRS_NN.cpp | |||
@@ -6,8 +6,4 @@ | |||
6 | 6 | ||
7 | #ifndef MYPLUGIN | ||
8 | |||
9 | #include "netnodeinterface.h" | 7 | #include "netnodeinterface.h" |
10 | 8 | ||
11 | #endif | ||
12 | |||
13 | static const char * GPRSNeeds[] = | 9 | static const char * GPRSNeeds[] = |
@@ -81,15 +77,2 @@ QStringList GPRSNetNode::properFiles( void ) { | |||
81 | 77 | ||
82 | #ifdef MYPLUGIN | 78 | OPIE_NS2_PLUGIN( NetNodeInterface_T<GPRSNetNode> ) |
83 | |||
84 | extern "C" { | ||
85 | void create_plugin( QList<ANetNode> & PNN ) { | ||
86 | PNN.append( new GPRSNetNode() ); | ||
87 | } | ||
88 | |||
89 | #else | ||
90 | |||
91 | OPIE_NS2_PLUGIN( NetNodeInterface<GPRSNetNode> ) | ||
92 | |||
93 | #endif | ||
94 | |||
95 | } | ||
diff --git a/noncore/settings/networksettings2/irda/irda_NN.cpp b/noncore/settings/networksettings2/irda/irda_NN.cpp index 6858157..a1ed686 100644 --- a/noncore/settings/networksettings2/irda/irda_NN.cpp +++ b/noncore/settings/networksettings2/irda/irda_NN.cpp | |||
@@ -3,8 +3,4 @@ | |||
3 | 3 | ||
4 | #ifndef MYPLUGIN | ||
5 | |||
6 | #include "netnodeinterface.h" | 4 | #include "netnodeinterface.h" |
7 | 5 | ||
8 | #endif | ||
9 | |||
10 | static const char * IRDANeeds[] = | 6 | static const char * IRDANeeds[] = |
@@ -55,15 +51,2 @@ void IRDANetNode::saveSpecificAttribute( QTextStream & ) { | |||
55 | 51 | ||
56 | #ifdef MYPLUGIN | 52 | OPIE_NS2_PLUGIN( NetNodeInterface_T<IRDANetNode> ) |
57 | |||
58 | extern "C" { | ||
59 | void create_plugin( QList<ANetNode> & PNN ) { | ||
60 | PNN.append( new IRDANetNode() ); | ||
61 | } | ||
62 | |||
63 | #else | ||
64 | |||
65 | OPIE_NS2_PLUGIN( NetNodeInterface<IRDANetNode> ) | ||
66 | |||
67 | #endif | ||
68 | |||
69 | } | ||
diff --git a/noncore/settings/networksettings2/lancard/lancard_NN.cpp b/noncore/settings/networksettings2/lancard/lancard_NN.cpp index fce3d29..520516c 100644 --- a/noncore/settings/networksettings2/lancard/lancard_NN.cpp +++ b/noncore/settings/networksettings2/lancard/lancard_NN.cpp | |||
@@ -3,8 +3,4 @@ | |||
3 | 3 | ||
4 | #ifndef MYPLUGIN | ||
5 | |||
6 | #include "netnodeinterface.h" | 4 | #include "netnodeinterface.h" |
7 | 5 | ||
8 | #endif | ||
9 | |||
10 | static const char * LanCardNeeds[] = | 6 | static const char * LanCardNeeds[] = |
@@ -78,15 +74,2 @@ void LanCardNetNode::saveSpecificAttribute( QTextStream & TS) { | |||
78 | 74 | ||
79 | #ifdef MYPLUGIN | 75 | OPIE_NS2_PLUGIN( NetNodeInterface_T<LanCardNetNode> ) |
80 | |||
81 | extern "C" { | ||
82 | void create_plugin( QList<ANetNode> & PNN ) { | ||
83 | PNN.append( new LanCardNetNode() ); | ||
84 | } | ||
85 | |||
86 | #else | ||
87 | |||
88 | OPIE_NS2_PLUGIN( NetNodeInterface<LanCardNetNode> ) | ||
89 | |||
90 | #endif | ||
91 | |||
92 | } | ||
diff --git a/noncore/settings/networksettings2/modem/modem_NN.cpp b/noncore/settings/networksettings2/modem/modem_NN.cpp index c7f6e78..e91b45a 100644 --- a/noncore/settings/networksettings2/modem/modem_NN.cpp +++ b/noncore/settings/networksettings2/modem/modem_NN.cpp | |||
@@ -3,8 +3,4 @@ | |||
3 | 3 | ||
4 | #ifndef MYPLUGIN | ||
5 | |||
6 | #include "netnodeinterface.h" | 4 | #include "netnodeinterface.h" |
7 | 5 | ||
8 | #endif | ||
9 | |||
10 | static const char * ModemNeeds[] = | 6 | static const char * ModemNeeds[] = |
@@ -56,15 +52,2 @@ void ModemNetNode::saveSpecificAttribute( QTextStream & ) { | |||
56 | 52 | ||
57 | #ifdef MYPLUGIN | 53 | OPIE_NS2_PLUGIN( NetNodeInterface_T<ModemNetNode> ) |
58 | |||
59 | extern "C" { | ||
60 | void create_plugin( QList<ANetNode> & PNN ) { | ||
61 | PNN.append( new ModemNetNode() ); | ||
62 | } | ||
63 | |||
64 | #else | ||
65 | |||
66 | OPIE_NS2_PLUGIN( NetNodeInterface<ModemNetNode> ) | ||
67 | |||
68 | #endif | ||
69 | |||
70 | } | ||
diff --git a/noncore/settings/networksettings2/network/network_NN.cpp b/noncore/settings/networksettings2/network/network_NN.cpp index 82d0c29..2fa31bd 100644 --- a/noncore/settings/networksettings2/network/network_NN.cpp +++ b/noncore/settings/networksettings2/network/network_NN.cpp | |||
@@ -6,8 +6,4 @@ | |||
6 | 6 | ||
7 | #ifndef MYPLUGIN | ||
8 | |||
9 | #include "netnodeinterface.h" | 7 | #include "netnodeinterface.h" |
10 | 8 | ||
11 | #endif | ||
12 | |||
13 | static const char * NetworkNeeds[] = | 9 | static const char * NetworkNeeds[] = |
@@ -98,15 +94,2 @@ void NetworkNetNode::saveSpecificAttribute( QTextStream & ) { | |||
98 | 94 | ||
99 | #ifdef MYPLUGIN | 95 | OPIE_NS2_PLUGIN( NetNodeInterface_T<NetworkNetNode> ) |
100 | |||
101 | extern "C" { | ||
102 | void create_plugin( QList<ANetNode> & PNN ) { | ||
103 | PNN.append( new NetworkNetNode() ); | ||
104 | } | ||
105 | |||
106 | #else | ||
107 | |||
108 | OPIE_NS2_PLUGIN( NetNodeInterface<NetworkNetNode> ) | ||
109 | |||
110 | #endif | ||
111 | |||
112 | } | ||
diff --git a/noncore/settings/networksettings2/networksettings.cpp b/noncore/settings/networksettings2/networksettings.cpp index dca6631..9680a96 100644 --- a/noncore/settings/networksettings2/networksettings.cpp +++ b/noncore/settings/networksettings2/networksettings.cpp | |||
@@ -239,3 +239,3 @@ void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) { | |||
239 | NSResources->removeConnection( OldName ); | 239 | NSResources->removeConnection( OldName ); |
240 | NSResources->addConnection( NC ); | 240 | NSResources->addConnection( NC, 0 ); |
241 | } // else not changed | 241 | } // else not changed |
@@ -250,3 +250,3 @@ void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) { | |||
250 | int ci = Profiles_LB->count(); | 250 | int ci = Profiles_LB->count(); |
251 | NSResources->addConnection( NC ); | 251 | NSResources->addConnection( NC, 0 ); |
252 | NC->setNumber( NSResources->assignConnectionNumber() ); | 252 | NC->setNumber( NSResources->assignConnectionNumber() ); |
diff --git a/noncore/settings/networksettings2/networksettings2/netnode.cpp b/noncore/settings/networksettings2/networksettings2/netnode.cpp index f8f2d1e..f00e0b3 100644 --- a/noncore/settings/networksettings2/networksettings2/netnode.cpp +++ b/noncore/settings/networksettings2/networksettings2/netnode.cpp | |||
@@ -143,9 +143,13 @@ NodeCollection::NodeCollection( void ) : QList<ANetNodeInstance>() { | |||
143 | AssignedInterface = 0; | 143 | AssignedInterface = 0; |
144 | Number = -1; | ||
145 | Done = 0; | ||
144 | } | 146 | } |
145 | 147 | ||
146 | NodeCollection::NodeCollection( QTextStream & TS ) : | 148 | NodeCollection::NodeCollection( QTextStream & TS, bool & Dangling ) : |
147 | QList<ANetNodeInstance>() { | 149 | QList<ANetNodeInstance>() { |
148 | long idx; | 150 | long idx; |
149 | bool InError = 0; | ||
150 | QString S, A, N; | 151 | QString S, A, N; |
152 | |||
153 | Number = -1; | ||
154 | Done = 0; | ||
151 | IsModified = 0; | 155 | IsModified = 0; |
@@ -157,2 +161,4 @@ NodeCollection::NodeCollection( QTextStream & TS ) : | |||
157 | 161 | ||
162 | Dangling = 0; // by default node collection is ok | ||
163 | |||
158 | do { | 164 | do { |
@@ -160,6 +166,2 @@ NodeCollection::NodeCollection( QTextStream & TS ) : | |||
160 | if( S.isEmpty() ) { | 166 | if( S.isEmpty() ) { |
161 | if( InError ) { | ||
162 | // remove all nodes | ||
163 | clear(); | ||
164 | } | ||
165 | // empty line | 167 | // empty line |
@@ -183,3 +185,3 @@ NodeCollection::NodeCollection( QTextStream & TS ) : | |||
183 | Log(( "Find node %s : %p\n", N.latin1(), NNI )); | 185 | Log(( "Find node %s : %p\n", N.latin1(), NNI )); |
184 | if( NNI && ! InError ) { | 186 | if( NNI ) { |
185 | append( NNI ); | 187 | append( NNI ); |
@@ -187,3 +189,7 @@ NodeCollection::NodeCollection( QTextStream & TS ) : | |||
187 | // could not find a node type -> collection invalid | 189 | // could not find a node type -> collection invalid |
188 | InError = 1; | 190 | Log(( "Node %s missing -> connection dangling\n", |
191 | N.latin1() )); | ||
192 | // create placeholder for this dangling NNI | ||
193 | NNI = new ErrorNNI( N ); | ||
194 | Dangling = 1; | ||
189 | } | 195 | } |
@@ -196,3 +202,2 @@ NodeCollection::NodeCollection( QTextStream & TS ) : | |||
196 | 202 | ||
197 | |||
198 | NodeCollection::~NodeCollection( void ) { | 203 | NodeCollection::~NodeCollection( void ) { |
@@ -231,6 +236,7 @@ ANetNodeInstance * NodeCollection::getToplevel( void ) { | |||
231 | NNI = it.current(); | 236 | NNI = it.current(); |
232 | if( NNI->nodeClass()->isToplevel() ) | 237 | if( NNI->nodeClass()->isToplevel() ) { |
233 | break; | 238 | return NNI; |
239 | } | ||
234 | } | 240 | } |
235 | return NNI; | 241 | return 0; |
236 | } | 242 | } |
@@ -243,6 +249,7 @@ ANetNodeInstance * NodeCollection::findByName( const QString & S ) { | |||
243 | NNI = it.current(); | 249 | NNI = it.current(); |
244 | if( NNI->name() == S ) | 250 | if( NNI->name() == S ) { |
245 | break; | 251 | return NNI; |
252 | } | ||
246 | } | 253 | } |
247 | return NNI; | 254 | return 0; |
248 | } | 255 | } |
diff --git a/noncore/settings/networksettings2/networksettings2/netnode.h b/noncore/settings/networksettings2/networksettings2/netnode.h index 4626381..151d546 100644 --- a/noncore/settings/networksettings2/networksettings2/netnode.h +++ b/noncore/settings/networksettings2/networksettings2/netnode.h | |||
@@ -321,2 +321,4 @@ protected : | |||
321 | bool IsModified; | 321 | bool IsModified; |
322 | // true if this nodeinstance was just created (and not | ||
323 | // loaded from file | ||
322 | bool IsNew; | 324 | bool IsNew; |
@@ -327,2 +329,42 @@ protected : | |||
327 | 329 | ||
330 | class ErrorNNI: public ANetNodeInstance { | ||
331 | |||
332 | public: | ||
333 | |||
334 | ErrorNNI( const QString & _Name ) : ANetNodeInstance( 0 ) { | ||
335 | setName( _Name.latin1() ); | ||
336 | } | ||
337 | |||
338 | RuntimeInfo * runtime( void ) { | ||
339 | return 0; | ||
340 | } | ||
341 | |||
342 | // create edit widget under parent | ||
343 | QWidget * edit( QWidget * parent ) { | ||
344 | return 0; | ||
345 | } | ||
346 | |||
347 | // is given data acceptable | ||
348 | QString acceptable( void ) { | ||
349 | return QString(); | ||
350 | } | ||
351 | |||
352 | // get data from GUI and store in node | ||
353 | void commit( void ) { | ||
354 | } | ||
355 | |||
356 | // returns node specific data -> only useful for 'buddy' | ||
357 | void * data( void ) { | ||
358 | return 0; | ||
359 | } | ||
360 | |||
361 | protected : | ||
362 | |||
363 | void setSpecificAttribute( QString & , QString & ) { | ||
364 | } | ||
365 | |||
366 | void saveSpecificAttribute( QTextStream & ) { | ||
367 | } | ||
368 | }; | ||
369 | |||
328 | class RuntimeInfo : public QObject { | 370 | class RuntimeInfo : public QObject { |
@@ -470,3 +512,3 @@ public : | |||
470 | NodeCollection( void ); | 512 | NodeCollection( void ); |
471 | NodeCollection( QTextStream & TS ); | 513 | NodeCollection( QTextStream & TS, bool & Dangling ); |
472 | ~NodeCollection( void ); | 514 | ~NodeCollection( void ); |
@@ -587,5 +629,5 @@ private : | |||
587 | // index in listbox | 629 | // index in listbox |
588 | int Index; | 630 | int Index; |
589 | bool IsModified; | 631 | bool IsModified; |
590 | int Done; | 632 | int Done; |
591 | 633 | ||
diff --git a/noncore/settings/networksettings2/networksettings2/netnodeinterface.h b/noncore/settings/networksettings2/networksettings2/netnodeinterface.h index 34f3bb5..06d1548 100644 --- a/noncore/settings/networksettings2/networksettings2/netnodeinterface.h +++ b/noncore/settings/networksettings2/networksettings2/netnodeinterface.h | |||
@@ -80,4 +80,14 @@ struct NS2PrivateFactory<Opie::Core::Typelist<Node, Tail> > { | |||
80 | 80 | ||
81 | class NetNodeInterface : public QUnknownInterface { | ||
82 | |||
83 | public : | ||
84 | |||
85 | virtual QRESULT queryInterface( const QUuid& uuid, | ||
86 | QUnknownInterface **iface ) = 0; | ||
87 | |||
88 | virtual void create_plugin( QList<ANetNode> & PNN ) = 0; | ||
89 | }; | ||
90 | |||
81 | template<class Node> | 91 | template<class Node> |
82 | struct NetNodeInterface : public QUnknownInterface { | 92 | struct NetNodeInterface_T : public NetNodeInterface { |
83 | 93 | ||
@@ -109,4 +119,4 @@ struct NetNodeInterface : public QUnknownInterface { | |||
109 | template<class Node, class Tail> | 119 | template<class Node, class Tail> |
110 | struct NetNodeInterface<Opie::Core::Typelist<Node, Tail> > | 120 | struct NetNodeInterface_T<Opie::Core::Typelist<Node, Tail> > |
111 | : public QUnknownInterface { | 121 | : public NetNodeInterface { |
112 | 122 | ||
@@ -127,3 +137,3 @@ struct NetNodeInterface<Opie::Core::Typelist<Node, Tail> > | |||
127 | void create_plugin( QList<ANetNode> & PNN ) { | 137 | void create_plugin( QList<ANetNode> & PNN ) { |
128 | NS2PrivateFactory<Opie::Core::Typelist<Node,Tail> >::createPlugin( PNN ); | 138 | NS2PrivateFactory<Opie::Core::Typelist<Node,Tail> >::createPlugins( PNN ); |
129 | } | 139 | } |
diff --git a/noncore/settings/networksettings2/networksettings2/resources.cpp b/noncore/settings/networksettings2/networksettings2/resources.cpp index 79d41ea..3479abb 100644 --- a/noncore/settings/networksettings2/networksettings2/resources.cpp +++ b/noncore/settings/networksettings2/networksettings2/resources.cpp | |||
@@ -27,3 +27,3 @@ TheNSResources * _NSResources = 0; | |||
27 | TheNSResources::TheNSResources( void ) : NodeTypeNameMap(), | 27 | TheNSResources::TheNSResources( void ) : NodeTypeNameMap(), |
28 | ConnectionsMap() { | 28 | ConnectionsMap(), DanglingConnectionsMap() { |
29 | 29 | ||
@@ -35,46 +35,2 @@ TheNSResources::TheNSResources( void ) : NodeTypeNameMap(), | |||
35 | 35 | ||
36 | #ifdef MYPLUGIN | ||
37 | |||
38 | findAvailableNetNodes(QPEApplication::qpeDir() + PLUGINDIR ); | ||
39 | |||
40 | // compile provides and needs lists | ||
41 | { const char ** NeedsRun; | ||
42 | QDictIterator<NetNode_t> OuterIt( AllNodeTypes ); | ||
43 | bool Done; | ||
44 | |||
45 | for ( ; OuterIt.current(); ++OuterIt ) { | ||
46 | // find needs list | ||
47 | ANetNode::NetNodeList * NNLP = new ANetNode::NetNodeList; | ||
48 | ANetNode::NetNodeList & NNL = *(NNLP); | ||
49 | |||
50 | // must iterate this way to avoid duplication pointers | ||
51 | for ( QDictIterator<NetNode_t> InnerIt( AllNodeTypes ); | ||
52 | InnerIt.current(); ++InnerIt ) { | ||
53 | if( InnerIt.current() == OuterIt.current() ) | ||
54 | // avoid recursive | ||
55 | continue; | ||
56 | |||
57 | const char ** Provides = InnerIt.current()->NetNode->provides(); | ||
58 | NeedsRun = OuterIt.current()->NetNode->needs(); | ||
59 | |||
60 | for( ; *NeedsRun; NeedsRun ++ ) { | ||
61 | const char ** PRun; | ||
62 | PRun = Provides; | ||
63 | for( ; *PRun; PRun ++ ) { | ||
64 | if( strcmp( *PRun, *NeedsRun ) == 0 ) { | ||
65 | // inner provides what outer needs | ||
66 | NNL.resize( NNL.size() + 1 ); | ||
67 | NNL[NNL.size()-1] = InnerIt.current()->NetNode; | ||
68 | Done = 1; // break from 2 loops | ||
69 | break; | ||
70 | } | ||
71 | } | ||
72 | } | ||
73 | } | ||
74 | OuterIt.current()->NetNode->setAlternatives( NNLP ); | ||
75 | } | ||
76 | } | ||
77 | |||
78 | #else | ||
79 | |||
80 | Plugins = 0; | 36 | Plugins = 0; |
@@ -121,4 +77,2 @@ TheNSResources::TheNSResources( void ) : NodeTypeNameMap(), | |||
121 | 77 | ||
122 | #endif | ||
123 | |||
124 | // define built in Node types to Description map | 78 | // define built in Node types to Description map |
@@ -142,3 +96,2 @@ TheNSResources::~TheNSResources( void ) { | |||
142 | 96 | ||
143 | #ifndef MYPLUGINS | ||
144 | if( Plugins ) { | 97 | if( Plugins ) { |
@@ -147,3 +100,2 @@ TheNSResources::~TheNSResources( void ) { | |||
147 | } | 100 | } |
148 | #endif | ||
149 | delete TheSystem; | 101 | delete TheSystem; |
@@ -181,95 +133,2 @@ void TheNSResources::busy( bool ) { | |||
181 | 133 | ||
182 | #ifdef MYPLUGIN | ||
183 | /** | ||
184 | * Load all modules that are found in the path | ||
185 | * @param path a directory that is scaned for any plugins that can be loaded | ||
186 | * and attempts to load them | ||
187 | */ | ||
188 | void TheNSResources::findAvailableNetNodes(const QString &path){ | ||
189 | |||
190 | Log(("Locate plugins in %s\n", path.latin1() )); | ||
191 | QDir d(path); | ||
192 | if(!d.exists()) | ||
193 | return; | ||
194 | |||
195 | QString lang = ::getenv("LANG"); | ||
196 | |||
197 | // Don't want sym links | ||
198 | d.setFilter( QDir::Files | QDir::NoSymLinks ); | ||
199 | const QFileInfoList *list = d.entryInfoList(); | ||
200 | QFileInfoListIterator it( *list ); | ||
201 | QFileInfo *fi; | ||
202 | |||
203 | while ( (fi=it.current()) ) { | ||
204 | |||
205 | if( fi->fileName().contains(".so")){ | ||
206 | /* if loaded install translation */ | ||
207 | if( loadNetNode(path + "/" + fi->fileName()) ) { | ||
208 | Log(( "Loading plugin %s\n", fi->fileName().latin1())); | ||
209 | QTranslator *trans = new QTranslator(qApp); | ||
210 | QString fn = QPEApplication::qpeDir()+ | ||
211 | "/i18n/"+lang+"/"+ | ||
212 | fi->fileName().left( fi->fileName().find(".") )+ | ||
213 | ".qm"; | ||
214 | |||
215 | if( trans->load( fn ) ) | ||
216 | qApp->installTranslator( trans ); | ||
217 | else | ||
218 | delete trans; | ||
219 | } else { | ||
220 | Log(( "Error loading plugin %s\n", fi->fileName().latin1())); | ||
221 | } | ||
222 | } | ||
223 | ++it; | ||
224 | } | ||
225 | } | ||
226 | |||
227 | /** | ||
228 | * Attempt to load a function and resolve a function. | ||
229 | * @param pluginFileName - the name of the file in which to attempt to load | ||
230 | * @param resolveString - function pointer to resolve | ||
231 | * @return true of loading is successful | ||
232 | */ | ||
233 | bool TheNSResources::loadNetNode( | ||
234 | const QString &pluginFileName, const QString &resolveString){ | ||
235 | |||
236 | QLibrary *lib = new QLibrary(pluginFileName); | ||
237 | void * res = lib->resolve(resolveString); | ||
238 | if( ! res ){ | ||
239 | delete lib; | ||
240 | return 0; | ||
241 | } | ||
242 | |||
243 | GetNetNodeListFt_t getNetNodeList = (GetNetNodeListFt_t)res; | ||
244 | |||
245 | // Try to get an object. | ||
246 | QList<ANetNode> PNN; | ||
247 | |||
248 | getNetNodeList( PNN ); | ||
249 | if( PNN.isEmpty() ) { | ||
250 | delete lib; | ||
251 | return 0; | ||
252 | } | ||
253 | |||
254 | ANetNode * NNP; | ||
255 | for( QListIterator<ANetNode> it(PNN); | ||
256 | it.current(); | ||
257 | ++it ) { | ||
258 | NetNode_t * NN; | ||
259 | |||
260 | NNP = it.current(); | ||
261 | NN = new NetNode_t; | ||
262 | NN->NetNode = NNP; | ||
263 | NN->TheLibrary = lib; | ||
264 | NN->NodeCountInLib = PNN.count(); | ||
265 | |||
266 | // store mapping | ||
267 | AllNodeTypes.insert( NN->NetNode->name(), NN ); | ||
268 | } | ||
269 | |||
270 | return 1; | ||
271 | } | ||
272 | |||
273 | #else | ||
274 | |||
275 | void TheNSResources::findAvailableNetNodes( void ){ | 134 | void TheNSResources::findAvailableNetNodes( void ){ |
@@ -295,2 +154,3 @@ void TheNSResources::findAvailableNetNodes( void ){ | |||
295 | OPluginLoader::List allplugins = Plugins->filtered(); | 154 | OPluginLoader::List allplugins = Plugins->filtered(); |
155 | QString lang = ::getenv("LANG"); | ||
296 | 156 | ||
@@ -306,3 +166,3 @@ void TheNSResources::findAvailableNetNodes( void ){ | |||
306 | Log(( "Plugin %s from %s does not support proper interface\n", | 166 | Log(( "Plugin %s from %s does not support proper interface\n", |
307 | it->name().latin1(), it->path().latin1() )); | 167 | (*it).name().latin1(), (*it).path().latin1() )); |
308 | continue; | 168 | continue; |
@@ -317,3 +177,3 @@ void TheNSResources::findAvailableNetNodes( void ){ | |||
317 | Log(( "Plugin %s from %s does offer any nodes\n", | 177 | Log(( "Plugin %s from %s does offer any nodes\n", |
318 | it->name().latin1(), it->path().latin1() )); | 178 | (*it).name().latin1(), (*it).path().latin1() )); |
319 | delete interface; | 179 | delete interface; |
@@ -326,3 +186,3 @@ void TheNSResources::findAvailableNetNodes( void ){ | |||
326 | ++it ) { | 186 | ++it ) { |
327 | AllNodeTypes.insert( it->current()->name(), it->current() ); | 187 | AllNodeTypes.insert( it.current()->name(), it.current() ); |
328 | } | 188 | } |
@@ -333,3 +193,3 @@ void TheNSResources::findAvailableNetNodes( void ){ | |||
333 | QString fn = QPEApplication::qpeDir()+ | 193 | QString fn = QPEApplication::qpeDir()+ |
334 | "/i18n/"+lang+"/"+ it->name() + ".qm"; | 194 | "/i18n/"+lang+"/"+ (*it).name() + ".qm"; |
335 | 195 | ||
@@ -343,4 +203,2 @@ void TheNSResources::findAvailableNetNodes( void ){ | |||
343 | 203 | ||
344 | #endif | ||
345 | |||
346 | // used to find unique connection number | 204 | // used to find unique connection number |
@@ -389,5 +247,10 @@ const QString & TheNSResources::netNode2Description( const char * s ) { | |||
389 | 247 | ||
390 | void TheNSResources::addConnection( NodeCollection * NC ) { | 248 | void TheNSResources::addConnection( NodeCollection * NC, bool Dangling ) { |
391 | ANetNodeInstance * NNI; | 249 | ANetNodeInstance * NNI; |
392 | ConnectionsMap.insert( NC->name(), NC ); | 250 | if( Dangling ) { |
251 | DanglingConnectionsMap.insert( NC->name(), NC ); | ||
252 | } else { | ||
253 | ConnectionsMap.insert( NC->name(), NC ); | ||
254 | } | ||
255 | |||
393 | // add (new) nodes to NodeList | 256 | // add (new) nodes to NodeList |
@@ -414,5 +277,11 @@ void TheNSResources::removeConnection( const QString & N ) { | |||
414 | } | 277 | } |
415 | ConnectionsMap.remove( N ); | 278 | if( ConnectionsMap.find( N ) ) { |
279 | ConnectionsMap.remove( N ); | ||
280 | } else { | ||
281 | DanglingConnectionsMap.remove( N ); | ||
282 | } | ||
283 | |||
416 | } | 284 | } |
417 | 285 | ||
286 | // dangling connections are filtered out | ||
418 | NodeCollection * TheNSResources::findConnection( const QString & S ) { | 287 | NodeCollection * TheNSResources::findConnection( const QString & S ) { |
diff --git a/noncore/settings/networksettings2/networksettings2/resources.h b/noncore/settings/networksettings2/networksettings2/resources.h index 421a433..b27cda1 100644 --- a/noncore/settings/networksettings2/networksettings2/resources.h +++ b/noncore/settings/networksettings2/networksettings2/resources.h | |||
@@ -40,17 +40,3 @@ public : | |||
40 | 40 | ||
41 | #ifdef MYPLUGIN | ||
42 | |||
43 | typedef struct NetNode_S { | ||
44 | ANetNode * NetNode; | ||
45 | QLibrary * TheLibrary; | ||
46 | long NodeCountInLib; | ||
47 | } NetNode_t; | ||
48 | typedef QDict<NetNode_t> Name2NetNode_t; | ||
49 | |||
50 | #else | ||
51 | |||
52 | typedef QDict<ANetNode> Name2NetNode_t; | 41 | typedef QDict<ANetNode> Name2NetNode_t; |
53 | |||
54 | #endif | ||
55 | |||
56 | typedef QDict<ANetNodeInstance > Name2Instance_t; | 42 | typedef QDict<ANetNodeInstance > Name2Instance_t; |
@@ -79,8 +65,2 @@ public : | |||
79 | { return AllNodeTypes.find(X)!=0; } | 65 | { return AllNodeTypes.find(X)!=0; } |
80 | #ifdef MYPLUGIN | ||
81 | ANetNode * findNetNode( const QString & N ) | ||
82 | { NetNode_t * NNT = AllNodeTypes.find(N); | ||
83 | return (NNT) ? NNT->NetNode : 0; | ||
84 | } | ||
85 | #else | ||
86 | ANetNode * findNetNode( const QString & N ) | 66 | ANetNode * findNetNode( const QString & N ) |
@@ -88,3 +68,2 @@ public : | |||
88 | } | 68 | } |
89 | #endif | ||
90 | // define new plugin (=node) | 69 | // define new plugin (=node) |
@@ -101,17 +80,11 @@ public : | |||
101 | ANetNodeInstance * createNodeInstance( const QString & S ) | 80 | ANetNodeInstance * createNodeInstance( const QString & S ) |
102 | { ANetNodeInstance * NNI = 0; | 81 | { ANetNode * NN = findNetNode( S ); |
103 | printf( "Find node type %s\n", S.latin1() ); | 82 | |
104 | #ifdef MYPLUGIN | 83 | Log(( "Find node type %s : %p\n", S.latin1(), NN )); |
105 | NetNode_t * NNT = AllNodeTypes[S]; | 84 | |
106 | if( ! NNT ) { | 85 | if( NN == 0 ) |
107 | return 0; | 86 | // type of this instance not found |
108 | } | ||
109 | NNI = NNT->NetNode->createInstance(); | ||
110 | #else | ||
111 | ANetNode * NNT = AllNodeTypes[S]; | ||
112 | if( ! NNT ) { | ||
113 | return 0; | 87 | return 0; |
114 | } | 88 | |
115 | NNI = NNT->createInstance(); | 89 | ANetNodeInstance * NNI = NN->createInstance(); |
116 | #endif | ||
117 | NNI->initialize(); | 90 | NNI->initialize(); |
@@ -132,3 +105,3 @@ public : | |||
132 | 105 | ||
133 | void addConnection( NodeCollection * NC ); | 106 | void addConnection( NodeCollection * NC, bool Dangling ); |
134 | void removeConnection( const QString & N ); | 107 | void removeConnection( const QString & N ); |
@@ -138,2 +111,4 @@ public : | |||
138 | { return ConnectionsMap; } | 111 | { return ConnectionsMap; } |
112 | Name2Connection_t & danglingConnections( void ) | ||
113 | { return ConnectionsMap; } | ||
139 | 114 | ||
@@ -149,10 +124,3 @@ private : | |||
149 | 124 | ||
150 | #ifdef MYPLUGIN | ||
151 | void findAvailableNetNodes( const QString &path ); | ||
152 | bool loadNetNode( | ||
153 | const QString &pluginFileName, | ||
154 | const QString &resolveString = "create_plugin"); | ||
155 | #else | ||
156 | void findAvailableNetNodes( void ); | 125 | void findAvailableNetNodes( void ); |
157 | #endif | ||
158 | 126 | ||
@@ -160,3 +128,7 @@ private : | |||
160 | QMap< QString, QString> NodeTypeDescriptionMap; | 128 | QMap< QString, QString> NodeTypeDescriptionMap; |
129 | // list of connections that are valid | ||
161 | Name2Connection_t ConnectionsMap; | 130 | Name2Connection_t ConnectionsMap; |
131 | // list of connection configurations that are not valid | ||
132 | // e.g. because plugins are missing | ||
133 | Name2Connection_t DanglingConnectionsMap; | ||
162 | System * TheSystem; | 134 | System * TheSystem; |
@@ -172,6 +144,4 @@ private : | |||
172 | 144 | ||
173 | #ifndef MYPLUGIN | ||
174 | Opie::Core::OPluginLoader * Plugins; | 145 | Opie::Core::OPluginLoader * Plugins; |
175 | Opie::Core::OPluginManager * PluginManager; | 146 | Opie::Core::OPluginManager * PluginManager; |
176 | #endif | ||
177 | 147 | ||
diff --git a/noncore/settings/networksettings2/nsdata.cpp b/noncore/settings/networksettings2/nsdata.cpp index 698a941..d76353a 100644 --- a/noncore/settings/networksettings2/nsdata.cpp +++ b/noncore/settings/networksettings2/nsdata.cpp | |||
@@ -118,4 +118,5 @@ void NetworkSettingsData::loadSettings( void ) { | |||
118 | // load connections -> collections of nodes | 118 | // load connections -> collections of nodes |
119 | NodeCollection * NC = new NodeCollection( TS ); | 119 | bool Dangling; |
120 | NSResources->addConnection( NC ); | 120 | NodeCollection * NC = new NodeCollection( TS, Dangling ); |
121 | NSResources->addConnection( NC, Dangling ); | ||
121 | } else { | 122 | } else { |
@@ -135,4 +136,13 @@ void NetworkSettingsData::loadSettings( void ) { | |||
135 | LeftOvers.append( Line ); | 136 | LeftOvers.append( Line ); |
136 | } | 137 | do { |
138 | Line = TS.readLine(); | ||
139 | // store even delimiter | ||
140 | LeftOvers.append( Line ); | ||
141 | } while ( ! Line.isEmpty() ); | ||
142 | |||
143 | //next section | ||
144 | continue; | ||
145 | } | ||
137 | 146 | ||
147 | // read entries of this section | ||
138 | do { | 148 | do { |
@@ -140,36 +150,27 @@ void NetworkSettingsData::loadSettings( void ) { | |||
140 | 150 | ||
141 | if( NN || NNI ) { | 151 | if( S.isEmpty() ) { |
142 | if( S.isEmpty() ) { | 152 | // empty line |
143 | // empty line | 153 | break; |
144 | break; | 154 | } |
145 | } | 155 | idx = S.find( '=' ); |
146 | idx = S.find( '=' ); | 156 | if( idx > 0 ) { |
147 | if( idx > 0 ) { | 157 | Attr = S.left( idx ); |
148 | Attr = S.left( idx ); | 158 | Value = S.mid( idx+1, S.length() ); |
149 | Value = S.mid( idx+1, S.length() ); | 159 | } else { |
150 | } else { | 160 | Value=""; |
151 | Value=""; | 161 | Attr = S; |
152 | Attr = S; | 162 | } |
153 | } | ||
154 | 163 | ||
155 | Value.stripWhiteSpace(); | 164 | Value.stripWhiteSpace(); |
156 | Attr.stripWhiteSpace(); | 165 | Attr.stripWhiteSpace(); |
157 | Attr.lower(); | 166 | Attr.lower(); |
158 | // dequote Attr | 167 | // dequote Attr |
159 | Value = deQuote(Value); | 168 | Value = deQuote(Value); |
160 | 169 | ||
161 | if( NN ) { | 170 | if( NN ) { |
162 | // set the attribute | 171 | // set the attribute |
163 | NN->setAttribute( Attr, Value ); | 172 | NN->setAttribute( Attr, Value ); |
164 | } else { | ||
165 | // set the attribute | ||
166 | NNI->setAttribute( Attr, Value ); | ||
167 | } | ||
168 | } else { | 173 | } else { |
169 | LeftOvers.append( Line ); | 174 | // set the attribute |
170 | // add empty line too as delimiter | 175 | NNI->setAttribute( Attr, Value ); |
171 | if( S.isEmpty() ) { | ||
172 | // empty line | ||
173 | break; | ||
174 | } | ||
175 | } | 176 | } |
@@ -183,2 +184,3 @@ void NetworkSettingsData::loadSettings( void ) { | |||
183 | } | 184 | } |
185 | |||
184 | if( NN ) { | 186 | if( NN ) { |
@@ -213,10 +215,4 @@ QString NetworkSettingsData::saveSettings( void ) { | |||
213 | 215 | ||
214 | // save leftovers | ||
215 | for ( QStringList::Iterator it = LeftOvers.begin(); | ||
216 | it != LeftOvers.end(); ++it ) { | ||
217 | TS << (*it) << endl; | ||
218 | } | ||
219 | |||
220 | // save global configs | 216 | // save global configs |
221 | for( QDictIterator<NetNode_t> it( NSResources->netNodes() ); | 217 | for( QDictIterator<ANetNode> it( NSResources->netNodes() ); |
222 | it.current(); | 218 | it.current(); |
@@ -224,3 +220,3 @@ QString NetworkSettingsData::saveSettings( void ) { | |||
224 | TS << "[nodetype " | 220 | TS << "[nodetype " |
225 | << quote( QString( it.current()->NetNode->name() ) ) | 221 | << quote( QString( it.current()->name() ) ) |
226 | << "]" | 222 | << "]" |
@@ -228,3 +224,3 @@ QString NetworkSettingsData::saveSettings( void ) { | |||
228 | 224 | ||
229 | it.current()->NetNode->saveAttributes( TS ); | 225 | it.current()->saveAttributes( TS ); |
230 | TS << endl; | 226 | TS << endl; |
@@ -232,4 +228,27 @@ QString NetworkSettingsData::saveSettings( void ) { | |||
232 | 228 | ||
229 | // save leftovers | ||
230 | for ( QStringList::Iterator it = LeftOvers.begin(); | ||
231 | it != LeftOvers.end(); ++it ) { | ||
232 | TS << (*it) << endl; | ||
233 | } | ||
234 | |||
235 | // save all netnode instances | ||
236 | { ANetNodeInstance * NNI; | ||
237 | for( QDictIterator<ANetNodeInstance> nit( | ||
238 | NSResources->netNodeInstances()); | ||
239 | nit.current(); | ||
240 | ++nit ) { | ||
241 | // header | ||
242 | NNI = nit.current(); | ||
243 | TS << '[' | ||
244 | << QString(NNI->nodeClass()->name()) | ||
245 | << ']' | ||
246 | << endl; | ||
247 | NNI->saveAttributes( TS ); | ||
248 | TS << endl; | ||
249 | } | ||
250 | } | ||
251 | |||
252 | // good connections | ||
233 | { Name2Connection_t & M = NSResources->connections(); | 253 | { Name2Connection_t & M = NSResources->connections(); |
234 | ANetNodeInstance * NNI; | ||
235 | 254 | ||
@@ -239,16 +258,14 @@ QString NetworkSettingsData::saveSettings( void ) { | |||
239 | ++it ) { | 258 | ++it ) { |
240 | // all nodes in those connections | 259 | TS << "[connection]" << endl; |
241 | for( QListIterator<ANetNodeInstance> nit(*(it.current())); | 260 | it.current()->save(TS); |
242 | nit.current(); | 261 | } |
243 | ++nit ) { | 262 | } |
244 | // header | ||
245 | NNI = nit.current(); | ||
246 | TS << '[' | ||
247 | << QString(NNI->nodeClass()->name()) | ||
248 | << ']' | ||
249 | << endl; | ||
250 | NNI->saveAttributes( TS ); | ||
251 | TS << endl; | ||
252 | } | ||
253 | 263 | ||
264 | // save dangling connections | ||
265 | { Name2Connection_t & M = NSResources->danglingConnections(); | ||
266 | |||
267 | // for all connections | ||
268 | for( QDictIterator<NodeCollection> it(M); | ||
269 | it.current(); | ||
270 | ++it ) { | ||
254 | TS << "[connection]" << endl; | 271 | TS << "[connection]" << endl; |
@@ -291,10 +308,11 @@ QString NetworkSettingsData::generateSettings( void ) { | |||
291 | 308 | ||
292 | for( QDictIterator<NetNode_t> nnit( NSResources->netNodes() ); | 309 | for( QDictIterator<ANetNode> nnit( NSResources->netNodes() ); |
293 | nnit.current(); | 310 | nnit.current(); |
294 | ++nnit ) { | 311 | ++nnit ) { |
295 | { QStringList SL; | 312 | bool FirstItem = 1; |
296 | bool FirstItem = 1; | 313 | bool Generated = 0; |
297 | bool Generated = 0; | ||
298 | 314 | ||
299 | CurDevNN = nnit.current()->NetNode; | 315 | CurDevNN = nnit.current(); |
316 | |||
317 | { QStringList SL; | ||
300 | SL = CurDevNN->properFiles(); | 318 | SL = CurDevNN->properFiles(); |
@@ -397,6 +415,6 @@ QString NetworkSettingsData::generateSettings( void ) { | |||
397 | // reset all | 415 | // reset all |
398 | for( QDictIterator<NetNode_t> nnit( NSResources->netNodes() ); | 416 | for( QDictIterator<ANetNode> nnit( NSResources->netNodes() ); |
399 | nnit.current(); | 417 | nnit.current(); |
400 | ++nnit ) { | 418 | ++nnit ) { |
401 | nnit.current()->NetNode->setDone(0); | 419 | nnit.current()->setDone(0); |
402 | } | 420 | } |
@@ -422,3 +440,3 @@ QString NetworkSettingsData::generateSettings( void ) { | |||
422 | // to write data in this system file ? | 440 | // to write data in this system file ? |
423 | for( QDictIterator<NetNode_t> nnit( NSResources->netNodes() ); | 441 | for( QDictIterator<ANetNode> nnit( NSResources->netNodes() ); |
424 | ! needToGenerate && nnit.current(); | 442 | ! needToGenerate && nnit.current(); |
@@ -426,3 +444,3 @@ QString NetworkSettingsData::generateSettings( void ) { | |||
426 | 444 | ||
427 | NN = nnit.current()->NetNode; | 445 | NN = nnit.current(); |
428 | 446 | ||
diff --git a/noncore/settings/networksettings2/ppp/ppp_NN.cpp b/noncore/settings/networksettings2/ppp/ppp_NN.cpp index bd13ab9..8c15e9c 100644 --- a/noncore/settings/networksettings2/ppp/ppp_NN.cpp +++ b/noncore/settings/networksettings2/ppp/ppp_NN.cpp | |||
@@ -6,8 +6,4 @@ | |||
6 | 6 | ||
7 | #ifndef MYPLUGIN | ||
8 | |||
9 | #include "netnodeinterface.h" | 7 | #include "netnodeinterface.h" |
10 | 8 | ||
11 | #endif | ||
12 | |||
13 | QStringList * PPPNetNode::ProperFiles = 0; | 9 | QStringList * PPPNetNode::ProperFiles = 0; |
@@ -86,15 +82,2 @@ void PPPNetNode::saveSpecificAttribute( QTextStream & ) { | |||
86 | 82 | ||
87 | #ifdef MYPLUGIN | 83 | OPIE_NS2_PLUGIN( NetNodeInterface_T<PPPNetNode> ) |
88 | |||
89 | extern "C" { | ||
90 | void create_plugin( QList<ANetNode> & PNN ) { | ||
91 | PNN.append( new PPPNetNode() ); | ||
92 | } | ||
93 | |||
94 | #else | ||
95 | |||
96 | OPIE_NS2_PLUGIN( NetNodeInterface<PPPNetNode> ) | ||
97 | |||
98 | #endif | ||
99 | |||
100 | } | ||
diff --git a/noncore/settings/networksettings2/profile/profile_NN.cpp b/noncore/settings/networksettings2/profile/profile_NN.cpp index 6028ea5..1e6912e 100644 --- a/noncore/settings/networksettings2/profile/profile_NN.cpp +++ b/noncore/settings/networksettings2/profile/profile_NN.cpp | |||
@@ -4,8 +4,4 @@ | |||
4 | 4 | ||
5 | #ifndef MYPLUGIN | ||
6 | |||
7 | #include "netnodeinterface.h" | 5 | #include "netnodeinterface.h" |
8 | 6 | ||
9 | #endif | ||
10 | |||
11 | static const char * ProfileNeeds[] = | 7 | static const char * ProfileNeeds[] = |
@@ -61,15 +57,2 @@ void ProfileNetNode::saveSpecificAttribute( QTextStream & ) { | |||
61 | 57 | ||
62 | #ifdef MYPLUGIN | 58 | OPIE_NS2_PLUGIN( NetNodeInterface_T<ProfileNetNode> ) |
63 | |||
64 | extern "C" { | ||
65 | void create_plugin( QList<ANetNode> & PNN ) { | ||
66 | PNN.append( new ProfileNetNode() ); | ||
67 | } | ||
68 | |||
69 | #else | ||
70 | |||
71 | OPIE_NS2_PLUGIN( NetNodeInterface<ProfileNetNode> ) | ||
72 | |||
73 | #endif | ||
74 | |||
75 | } | ||
diff --git a/noncore/settings/networksettings2/usb/usb_NN.cpp b/noncore/settings/networksettings2/usb/usb_NN.cpp index 9c07b82..6d90ae0 100644 --- a/noncore/settings/networksettings2/usb/usb_NN.cpp +++ b/noncore/settings/networksettings2/usb/usb_NN.cpp | |||
@@ -4,8 +4,4 @@ | |||
4 | 4 | ||
5 | #ifndef MYPLUGIN | ||
6 | |||
7 | #include "netnodeinterface.h" | 5 | #include "netnodeinterface.h" |
8 | 6 | ||
9 | #endif | ||
10 | |||
11 | static const char * USBNeeds[] = | 7 | static const char * USBNeeds[] = |
@@ -63,15 +59,2 @@ void USBNetNode::saveSpecificAttribute( QTextStream & ) { | |||
63 | 59 | ||
64 | #ifdef MYPLUGIN | 60 | OPIE_NS2_PLUGIN( NetNodeInterface_T<USBNetNode> ) |
65 | |||
66 | extern "C" { | ||
67 | void create_plugin( QList<ANetNode> & PNN ) { | ||
68 | PNN.append( new USBNetNode() ); | ||
69 | } | ||
70 | |||
71 | #else | ||
72 | |||
73 | OPIE_NS2_PLUGIN( NetNodeInterface<USBNetNode> ) | ||
74 | |||
75 | #endif | ||
76 | |||
77 | } | ||
diff --git a/noncore/settings/networksettings2/usb/usbrun.cpp b/noncore/settings/networksettings2/usb/usbrun.cpp index 0a46642..eb439c1 100644 --- a/noncore/settings/networksettings2/usb/usbrun.cpp +++ b/noncore/settings/networksettings2/usb/usbrun.cpp | |||
@@ -7,2 +7,3 @@ | |||
7 | State_t USBRun::detectState( void ) { | 7 | State_t USBRun::detectState( void ) { |
8 | |||
8 | // unavailable : no card found | 9 | // unavailable : no card found |
@@ -10,2 +11,3 @@ State_t USBRun::detectState( void ) { | |||
10 | // up : card found and assigned to us and up | 11 | // up : card found and assigned to us and up |
12 | |||
11 | NodeCollection * NC = nodeCollection(); | 13 | NodeCollection * NC = nodeCollection(); |
@@ -66,3 +68,5 @@ State_t USBRun::detectState( void ) { | |||
66 | // proper type, and Not UP -> free | 68 | // proper type, and Not UP -> free |
67 | return Off; | 69 | // usb cables are currently always available when requested |
70 | // until we can detect if we are plugged in | ||
71 | return Available; | ||
68 | } | 72 | } |
@@ -77,11 +81,2 @@ QString USBRun::setMyState( NodeCollection * NC, Action_t A, bool ) { | |||
77 | // a cable | 81 | // a cable |
78 | |||
79 | // perhaps (later) we can figure out if the device is IN the | ||
80 | // cradle | ||
81 | if( A == Activate ) { | ||
82 | NC->setCurrentState( Available ); | ||
83 | } else if ( A == Deactivate ) { | ||
84 | NC->setCurrentState( Unavailable ); | ||
85 | } | ||
86 | |||
87 | return QString(); | 82 | return QString(); |
diff --git a/noncore/settings/networksettings2/vpn/vpn_NN.cpp b/noncore/settings/networksettings2/vpn/vpn_NN.cpp index 6dd5332..96e9df2 100644 --- a/noncore/settings/networksettings2/vpn/vpn_NN.cpp +++ b/noncore/settings/networksettings2/vpn/vpn_NN.cpp | |||
@@ -3,8 +3,4 @@ | |||
3 | 3 | ||
4 | #ifndef MYPLUGIN | ||
5 | |||
6 | #include "netnodeinterface.h" | 4 | #include "netnodeinterface.h" |
7 | 5 | ||
8 | #endif | ||
9 | |||
10 | static const char * VPNNeeds[] = | 6 | static const char * VPNNeeds[] = |
@@ -55,15 +51,2 @@ void VPNNetNode::saveSpecificAttribute( QTextStream & ) { | |||
55 | 51 | ||
56 | #ifdef MYPLUGIN | 52 | OPIE_NS2_PLUGIN( NetNodeInterface_T<VPNNetNode> ) |
57 | |||
58 | extern "C" { | ||
59 | void create_plugin( QList<ANetNode> & PNN ) { | ||
60 | PNN.append( new VPNNetNode() ); | ||
61 | } | ||
62 | |||
63 | #else | ||
64 | |||
65 | OPIE_NS2_PLUGIN( NetNodeInterface<VPNNetNode> ) | ||
66 | |||
67 | #endif | ||
68 | |||
69 | } | ||
diff --git a/noncore/settings/networksettings2/wlan/wlan_NN.cpp b/noncore/settings/networksettings2/wlan/wlan_NN.cpp index c56da06..f7745be 100644 --- a/noncore/settings/networksettings2/wlan/wlan_NN.cpp +++ b/noncore/settings/networksettings2/wlan/wlan_NN.cpp | |||
@@ -4,8 +4,4 @@ | |||
4 | 4 | ||
5 | #ifndef MYPLUGIN | ||
6 | |||
7 | #include "netnodeinterface.h" | 5 | #include "netnodeinterface.h" |
8 | 6 | ||
9 | #endif | ||
10 | |||
11 | static const char * WLanNeeds[] = | 7 | static const char * WLanNeeds[] = |
@@ -71,15 +67,2 @@ void WLanNetNode::saveSpecificAttribute( QTextStream & TS ) { | |||
71 | 67 | ||
72 | #ifdef MYPLUGIN | 68 | OPIE_NS2_PLUGIN( NetNodeInterface_T<WLanNetNode> ) |
73 | |||
74 | extern "C" { | ||
75 | void create_plugin( QList<ANetNode> & PNN ) { | ||
76 | PNN.append( new WLanNetNode() ); | ||
77 | } | ||
78 | |||
79 | #else | ||
80 | |||
81 | OPIE_NS2_PLUGIN( NetNodeInterface<WLanNetNode> ) | ||
82 | |||
83 | #endif | ||
84 | |||
85 | } | ||