summaryrefslogtreecommitdiff
path: root/noncore/settings
authorwimpie <wimpie>2005-01-07 15:23:23 (UTC)
committer wimpie <wimpie>2005-01-07 15:23:23 (UTC)
commitb4eced64efad35beeb2004243ca26bf7eb20eaba (patch) (side-by-side diff)
tree14caf32705c787a8bffc917ecdf216ad40cfbdc0 /noncore/settings
parent7af7203a51ddcf85f9f60e39157fcad21f7d9e34 (diff)
downloadopie-b4eced64efad35beeb2004243ca26bf7eb20eaba.zip
opie-b4eced64efad35beeb2004243ca26bf7eb20eaba.tar.gz
opie-b4eced64efad35beeb2004243ca26bf7eb20eaba.tar.bz2
All NS2 libraries are now properly working plugins
Diffstat (limited to 'noncore/settings') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NN.cpp21
-rw-r--r--noncore/settings/networksettings2/cable/cable_NN.cpp19
-rw-r--r--noncore/settings/networksettings2/editconnection.cpp5
-rw-r--r--noncore/settings/networksettings2/gprs/GPRS_NN.cpp19
-rw-r--r--noncore/settings/networksettings2/irda/irda_NN.cpp19
-rw-r--r--noncore/settings/networksettings2/lancard/lancard_NN.cpp19
-rw-r--r--noncore/settings/networksettings2/modem/modem_NN.cpp19
-rw-r--r--noncore/settings/networksettings2/network/network_NN.cpp19
-rw-r--r--noncore/settings/networksettings2/networksettings.cpp4
-rw-r--r--noncore/settings/networksettings2/networksettings2/netnode.cpp37
-rw-r--r--noncore/settings/networksettings2/networksettings2/netnode.h48
-rw-r--r--noncore/settings/networksettings2/networksettings2/netnodeinterface.h18
-rw-r--r--noncore/settings/networksettings2/networksettings2/resources.cpp171
-rw-r--r--noncore/settings/networksettings2/networksettings2/resources.h60
-rw-r--r--noncore/settings/networksettings2/nsdata.cpp152
-rw-r--r--noncore/settings/networksettings2/ppp/ppp_NN.cpp19
-rw-r--r--noncore/settings/networksettings2/profile/profile_NN.cpp19
-rw-r--r--noncore/settings/networksettings2/usb/usb_NN.cpp19
-rw-r--r--noncore/settings/networksettings2/usb/usbrun.cpp15
-rw-r--r--noncore/settings/networksettings2/vpn/vpn_NN.cpp19
-rw-r--r--noncore/settings/networksettings2/wlan/wlan_NN.cpp19
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 @@
-#ifndef MYPLUGIN
-
#include "netnodeinterface.h"
-#endif
-
//
@@ -77,18 +73,3 @@ void BluetoothBNEPNetNode::saveSpecificAttribute( QTextStream & TS) {
-#ifndef MYPLUGIN
-
-extern "C" {
-// create plugin registers both BT functions
-void create_plugin( QList<ANetNode> & PNN ) {
- PNN.append( new BluetoothBNEPNetNode() );
- PNN.append( new BluetoothRFCOMMNetNode() );
-}
-
-#else
-
typedef Opie::Core::MakeTypelist<BluetoothBNEPNetNode, BluetoothRFCOMMNetNode>::Result BluetoothTypes;
-OPIE_NS2_PLUGIN( NetNodeInterface<BluetoothTypes> )
-
-#endif
-
-}
+OPIE_NS2_PLUGIN( NetNodeInterface_T<BluetoothTypes> )
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 @@
-#ifndef MYPLUGIN
-
#include "netnodeinterface.h"
-#endif
-
static const char * CableNeeds[] =
@@ -55,15 +51,2 @@ void CableNetNode::saveSpecificAttribute( QTextStream & ) {
-#ifdef MYPLUGIN
-
-extern "C" {
-void create_plugin( QList<ANetNode> & PNN ) {
- PNN.append( new CableNetNode() );
-}
-
-#else
-
-OPIE_NS2_PLUGIN( NetNodeInterface<CableNetNode> )
-
-#endif
-
-}
+OPIE_NS2_PLUGIN( NetNodeInterface_T<CableNetNode> )
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 ) {
// TCP/IP Connection
- for( QDictIterator<NetNode_t> Iter(NSResources->netNodes());
+ for( QDictIterator<ANetNode> Iter(NSResources->netNodes());
Iter.current();
++Iter ) {
-
- NN = Iter.current()->NetNode;
+ NN = Iter.current();
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 @@
-#ifndef MYPLUGIN
-
#include "netnodeinterface.h"
-#endif
-
static const char * GPRSNeeds[] =
@@ -81,15 +77,2 @@ QStringList GPRSNetNode::properFiles( void ) {
-#ifdef MYPLUGIN
-
-extern "C" {
-void create_plugin( QList<ANetNode> & PNN ) {
- PNN.append( new GPRSNetNode() );
-}
-
-#else
-
-OPIE_NS2_PLUGIN( NetNodeInterface<GPRSNetNode> )
-
-#endif
-
-}
+OPIE_NS2_PLUGIN( NetNodeInterface_T<GPRSNetNode> )
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 @@
-#ifndef MYPLUGIN
-
#include "netnodeinterface.h"
-#endif
-
static const char * IRDANeeds[] =
@@ -55,15 +51,2 @@ void IRDANetNode::saveSpecificAttribute( QTextStream & ) {
-#ifdef MYPLUGIN
-
-extern "C" {
-void create_plugin( QList<ANetNode> & PNN ) {
- PNN.append( new IRDANetNode() );
-}
-
-#else
-
-OPIE_NS2_PLUGIN( NetNodeInterface<IRDANetNode> )
-
-#endif
-
-}
+OPIE_NS2_PLUGIN( NetNodeInterface_T<IRDANetNode> )
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 @@
-#ifndef MYPLUGIN
-
#include "netnodeinterface.h"
-#endif
-
static const char * LanCardNeeds[] =
@@ -78,15 +74,2 @@ void LanCardNetNode::saveSpecificAttribute( QTextStream & TS) {
-#ifdef MYPLUGIN
-
-extern "C" {
-void create_plugin( QList<ANetNode> & PNN ) {
- PNN.append( new LanCardNetNode() );
-}
-
-#else
-
-OPIE_NS2_PLUGIN( NetNodeInterface<LanCardNetNode> )
-
-#endif
-
-}
+OPIE_NS2_PLUGIN( NetNodeInterface_T<LanCardNetNode> )
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 @@
-#ifndef MYPLUGIN
-
#include "netnodeinterface.h"
-#endif
-
static const char * ModemNeeds[] =
@@ -56,15 +52,2 @@ void ModemNetNode::saveSpecificAttribute( QTextStream & ) {
-#ifdef MYPLUGIN
-
-extern "C" {
-void create_plugin( QList<ANetNode> & PNN ) {
- PNN.append( new ModemNetNode() );
-}
-
-#else
-
-OPIE_NS2_PLUGIN( NetNodeInterface<ModemNetNode> )
-
-#endif
-
-}
+OPIE_NS2_PLUGIN( NetNodeInterface_T<ModemNetNode> )
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 @@
-#ifndef MYPLUGIN
-
#include "netnodeinterface.h"
-#endif
-
static const char * NetworkNeeds[] =
@@ -98,15 +94,2 @@ void NetworkNetNode::saveSpecificAttribute( QTextStream & ) {
-#ifdef MYPLUGIN
-
-extern "C" {
-void create_plugin( QList<ANetNode> & PNN ) {
- PNN.append( new NetworkNetNode() );
-}
-
-#else
-
-OPIE_NS2_PLUGIN( NetNodeInterface<NetworkNetNode> )
-
-#endif
-
-}
+OPIE_NS2_PLUGIN( NetNodeInterface_T<NetworkNetNode> )
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 ) {
NSResources->removeConnection( OldName );
- NSResources->addConnection( NC );
+ NSResources->addConnection( NC, 0 );
} // else not changed
@@ -250,3 +250,3 @@ void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) {
int ci = Profiles_LB->count();
- NSResources->addConnection( NC );
+ NSResources->addConnection( NC, 0 );
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>() {
AssignedInterface = 0;
+ Number = -1;
+ Done = 0;
}
-NodeCollection::NodeCollection( QTextStream & TS ) :
+NodeCollection::NodeCollection( QTextStream & TS, bool & Dangling ) :
QList<ANetNodeInstance>() {
long idx;
- bool InError = 0;
QString S, A, N;
+
+ Number = -1;
+ Done = 0;
IsModified = 0;
@@ -157,2 +161,4 @@ NodeCollection::NodeCollection( QTextStream & TS ) :
+ Dangling = 0; // by default node collection is ok
+
do {
@@ -160,6 +166,2 @@ NodeCollection::NodeCollection( QTextStream & TS ) :
if( S.isEmpty() ) {
- if( InError ) {
- // remove all nodes
- clear();
- }
// empty line
@@ -183,3 +185,3 @@ NodeCollection::NodeCollection( QTextStream & TS ) :
Log(( "Find node %s : %p\n", N.latin1(), NNI ));
- if( NNI && ! InError ) {
+ if( NNI ) {
append( NNI );
@@ -187,3 +189,7 @@ NodeCollection::NodeCollection( QTextStream & TS ) :
// could not find a node type -> collection invalid
- InError = 1;
+ Log(( "Node %s missing -> connection dangling\n",
+ N.latin1() ));
+ // create placeholder for this dangling NNI
+ NNI = new ErrorNNI( N );
+ Dangling = 1;
}
@@ -196,3 +202,2 @@ NodeCollection::NodeCollection( QTextStream & TS ) :
-
NodeCollection::~NodeCollection( void ) {
@@ -231,6 +236,7 @@ ANetNodeInstance * NodeCollection::getToplevel( void ) {
NNI = it.current();
- if( NNI->nodeClass()->isToplevel() )
- break;
+ if( NNI->nodeClass()->isToplevel() ) {
+ return NNI;
+ }
}
- return NNI;
+ return 0;
}
@@ -243,6 +249,7 @@ ANetNodeInstance * NodeCollection::findByName( const QString & S ) {
NNI = it.current();
- if( NNI->name() == S )
- break;
+ if( NNI->name() == S ) {
+ return NNI;
+ }
}
- return NNI;
+ return 0;
}
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 :
bool IsModified;
+ // true if this nodeinstance was just created (and not
+ // loaded from file
bool IsNew;
@@ -327,2 +329,42 @@ protected :
+class ErrorNNI: public ANetNodeInstance {
+
+public:
+
+ ErrorNNI( const QString & _Name ) : ANetNodeInstance( 0 ) {
+ setName( _Name.latin1() );
+ }
+
+ RuntimeInfo * runtime( void ) {
+ return 0;
+ }
+
+ // create edit widget under parent
+ QWidget * edit( QWidget * parent ) {
+ return 0;
+ }
+
+ // is given data acceptable
+ QString acceptable( void ) {
+ return QString();
+ }
+
+ // get data from GUI and store in node
+ void commit( void ) {
+ }
+
+ // returns node specific data -> only useful for 'buddy'
+ void * data( void ) {
+ return 0;
+ }
+
+protected :
+
+ void setSpecificAttribute( QString & , QString & ) {
+ }
+
+ void saveSpecificAttribute( QTextStream & ) {
+ }
+};
+
class RuntimeInfo : public QObject {
@@ -470,3 +512,3 @@ public :
NodeCollection( void );
- NodeCollection( QTextStream & TS );
+ NodeCollection( QTextStream & TS, bool & Dangling );
~NodeCollection( void );
@@ -587,5 +629,5 @@ private :
// index in listbox
- int Index;
+ int Index;
bool IsModified;
- int Done;
+ int Done;
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> > {
+class NetNodeInterface : public QUnknownInterface {
+
+public :
+
+ virtual QRESULT queryInterface( const QUuid& uuid,
+ QUnknownInterface **iface ) = 0;
+
+ virtual void create_plugin( QList<ANetNode> & PNN ) = 0;
+};
+
template<class Node>
-struct NetNodeInterface : public QUnknownInterface {
+struct NetNodeInterface_T : public NetNodeInterface {
@@ -109,4 +119,4 @@ struct NetNodeInterface : public QUnknownInterface {
template<class Node, class Tail>
-struct NetNodeInterface<Opie::Core::Typelist<Node, Tail> >
- : public QUnknownInterface {
+struct NetNodeInterface_T<Opie::Core::Typelist<Node, Tail> >
+ : public NetNodeInterface {
@@ -127,3 +137,3 @@ struct NetNodeInterface<Opie::Core::Typelist<Node, Tail> >
void create_plugin( QList<ANetNode> & PNN ) {
- NS2PrivateFactory<Opie::Core::Typelist<Node,Tail> >::createPlugin( PNN );
+ NS2PrivateFactory<Opie::Core::Typelist<Node,Tail> >::createPlugins( PNN );
}
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;
TheNSResources::TheNSResources( void ) : NodeTypeNameMap(),
- ConnectionsMap() {
+ ConnectionsMap(), DanglingConnectionsMap() {
@@ -35,46 +35,2 @@ TheNSResources::TheNSResources( void ) : NodeTypeNameMap(),
-#ifdef MYPLUGIN
-
- findAvailableNetNodes(QPEApplication::qpeDir() + PLUGINDIR );
-
- // compile provides and needs lists
- { const char ** NeedsRun;
- QDictIterator<NetNode_t> OuterIt( AllNodeTypes );
- bool Done;
-
- for ( ; OuterIt.current(); ++OuterIt ) {
- // find needs list
- ANetNode::NetNodeList * NNLP = new ANetNode::NetNodeList;
- ANetNode::NetNodeList & NNL = *(NNLP);
-
- // must iterate this way to avoid duplication pointers
- for ( QDictIterator<NetNode_t> InnerIt( AllNodeTypes );
- InnerIt.current(); ++InnerIt ) {
- if( InnerIt.current() == OuterIt.current() )
- // avoid recursive
- continue;
-
- const char ** Provides = InnerIt.current()->NetNode->provides();
- NeedsRun = OuterIt.current()->NetNode->needs();
-
- for( ; *NeedsRun; NeedsRun ++ ) {
- const char ** PRun;
- PRun = Provides;
- for( ; *PRun; PRun ++ ) {
- if( strcmp( *PRun, *NeedsRun ) == 0 ) {
- // inner provides what outer needs
- NNL.resize( NNL.size() + 1 );
- NNL[NNL.size()-1] = InnerIt.current()->NetNode;
- Done = 1; // break from 2 loops
- break;
- }
- }
- }
- }
- OuterIt.current()->NetNode->setAlternatives( NNLP );
- }
- }
-
-#else
-
Plugins = 0;
@@ -121,4 +77,2 @@ TheNSResources::TheNSResources( void ) : NodeTypeNameMap(),
-#endif
-
// define built in Node types to Description map
@@ -142,3 +96,2 @@ TheNSResources::~TheNSResources( void ) {
-#ifndef MYPLUGINS
if( Plugins ) {
@@ -147,3 +100,2 @@ TheNSResources::~TheNSResources( void ) {
}
-#endif
delete TheSystem;
@@ -181,95 +133,2 @@ void TheNSResources::busy( bool ) {
-#ifdef MYPLUGIN
-/**
- * Load all modules that are found in the path
- * @param path a directory that is scaned for any plugins that can be loaded
- * and attempts to load them
- */
-void TheNSResources::findAvailableNetNodes(const QString &path){
-
- Log(("Locate plugins in %s\n", path.latin1() ));
- QDir d(path);
- if(!d.exists())
- return;
-
- QString lang = ::getenv("LANG");
-
- // Don't want sym links
- d.setFilter( QDir::Files | QDir::NoSymLinks );
- const QFileInfoList *list = d.entryInfoList();
- QFileInfoListIterator it( *list );
- QFileInfo *fi;
-
- while ( (fi=it.current()) ) {
-
- if( fi->fileName().contains(".so")){
- /* if loaded install translation */
- if( loadNetNode(path + "/" + fi->fileName()) ) {
- Log(( "Loading plugin %s\n", fi->fileName().latin1()));
- QTranslator *trans = new QTranslator(qApp);
- QString fn = QPEApplication::qpeDir()+
- "/i18n/"+lang+"/"+
- fi->fileName().left( fi->fileName().find(".") )+
- ".qm";
-
- if( trans->load( fn ) )
- qApp->installTranslator( trans );
- else
- delete trans;
- } else {
- Log(( "Error loading plugin %s\n", fi->fileName().latin1()));
- }
- }
- ++it;
- }
-}
-
-/**
- * Attempt to load a function and resolve a function.
- * @param pluginFileName - the name of the file in which to attempt to load
- * @param resolveString - function pointer to resolve
- * @return true of loading is successful
- */
-bool TheNSResources::loadNetNode(
- const QString &pluginFileName, const QString &resolveString){
-
- QLibrary *lib = new QLibrary(pluginFileName);
- void * res = lib->resolve(resolveString);
- if( ! res ){
- delete lib;
- return 0;
- }
-
- GetNetNodeListFt_t getNetNodeList = (GetNetNodeListFt_t)res;
-
- // Try to get an object.
- QList<ANetNode> PNN;
-
- getNetNodeList( PNN );
- if( PNN.isEmpty() ) {
- delete lib;
- return 0;
- }
-
- ANetNode * NNP;
- for( QListIterator<ANetNode> it(PNN);
- it.current();
- ++it ) {
- NetNode_t * NN;
-
- NNP = it.current();
- NN = new NetNode_t;
- NN->NetNode = NNP;
- NN->TheLibrary = lib;
- NN->NodeCountInLib = PNN.count();
-
- // store mapping
- AllNodeTypes.insert( NN->NetNode->name(), NN );
- }
-
- return 1;
-}
-
-#else
-
void TheNSResources::findAvailableNetNodes( void ){
@@ -295,2 +154,3 @@ void TheNSResources::findAvailableNetNodes( void ){
OPluginLoader::List allplugins = Plugins->filtered();
+ QString lang = ::getenv("LANG");
@@ -306,3 +166,3 @@ void TheNSResources::findAvailableNetNodes( void ){
Log(( "Plugin %s from %s does not support proper interface\n",
- it->name().latin1(), it->path().latin1() ));
+ (*it).name().latin1(), (*it).path().latin1() ));
continue;
@@ -317,3 +177,3 @@ void TheNSResources::findAvailableNetNodes( void ){
Log(( "Plugin %s from %s does offer any nodes\n",
- it->name().latin1(), it->path().latin1() ));
+ (*it).name().latin1(), (*it).path().latin1() ));
delete interface;
@@ -326,3 +186,3 @@ void TheNSResources::findAvailableNetNodes( void ){
++it ) {
- AllNodeTypes.insert( it->current()->name(), it->current() );
+ AllNodeTypes.insert( it.current()->name(), it.current() );
}
@@ -333,3 +193,3 @@ void TheNSResources::findAvailableNetNodes( void ){
QString fn = QPEApplication::qpeDir()+
- "/i18n/"+lang+"/"+ it->name() + ".qm";
+ "/i18n/"+lang+"/"+ (*it).name() + ".qm";
@@ -343,4 +203,2 @@ void TheNSResources::findAvailableNetNodes( void ){
-#endif
-
// used to find unique connection number
@@ -389,5 +247,10 @@ const QString & TheNSResources::netNode2Description( const char * s ) {
-void TheNSResources::addConnection( NodeCollection * NC ) {
+void TheNSResources::addConnection( NodeCollection * NC, bool Dangling ) {
ANetNodeInstance * NNI;
- ConnectionsMap.insert( NC->name(), NC );
+ if( Dangling ) {
+ DanglingConnectionsMap.insert( NC->name(), NC );
+ } else {
+ ConnectionsMap.insert( NC->name(), NC );
+ }
+
// add (new) nodes to NodeList
@@ -414,5 +277,11 @@ void TheNSResources::removeConnection( const QString & N ) {
}
- ConnectionsMap.remove( N );
+ if( ConnectionsMap.find( N ) ) {
+ ConnectionsMap.remove( N );
+ } else {
+ DanglingConnectionsMap.remove( N );
+ }
+
}
+// dangling connections are filtered out
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 :
-#ifdef MYPLUGIN
-
-typedef struct NetNode_S {
- ANetNode * NetNode;
- QLibrary * TheLibrary;
- long NodeCountInLib;
-} NetNode_t;
-typedef QDict<NetNode_t> Name2NetNode_t;
-
-#else
-
typedef QDict<ANetNode> Name2NetNode_t;
-
-#endif
-
typedef QDict<ANetNodeInstance > Name2Instance_t;
@@ -79,8 +65,2 @@ public :
{ return AllNodeTypes.find(X)!=0; }
-#ifdef MYPLUGIN
- ANetNode * findNetNode( const QString & N )
- { NetNode_t * NNT = AllNodeTypes.find(N);
- return (NNT) ? NNT->NetNode : 0;
- }
-#else
ANetNode * findNetNode( const QString & N )
@@ -88,3 +68,2 @@ public :
}
-#endif
// define new plugin (=node)
@@ -101,17 +80,11 @@ public :
ANetNodeInstance * createNodeInstance( const QString & S )
- { ANetNodeInstance * NNI = 0;
- printf( "Find node type %s\n", S.latin1() );
-#ifdef MYPLUGIN
- NetNode_t * NNT = AllNodeTypes[S];
- if( ! NNT ) {
- return 0;
- }
- NNI = NNT->NetNode->createInstance();
-#else
- ANetNode * NNT = AllNodeTypes[S];
- if( ! NNT ) {
+ { ANetNode * NN = findNetNode( S );
+
+ Log(( "Find node type %s : %p\n", S.latin1(), NN ));
+
+ if( NN == 0 )
+ // type of this instance not found
return 0;
- }
- NNI = NNT->createInstance();
-#endif
+
+ ANetNodeInstance * NNI = NN->createInstance();
NNI->initialize();
@@ -132,3 +105,3 @@ public :
- void addConnection( NodeCollection * NC );
+ void addConnection( NodeCollection * NC, bool Dangling );
void removeConnection( const QString & N );
@@ -138,2 +111,4 @@ public :
{ return ConnectionsMap; }
+ Name2Connection_t & danglingConnections( void )
+ { return ConnectionsMap; }
@@ -149,10 +124,3 @@ private :
-#ifdef MYPLUGIN
- void findAvailableNetNodes( const QString &path );
- bool loadNetNode(
- const QString &pluginFileName,
- const QString &resolveString = "create_plugin");
-#else
void findAvailableNetNodes( void );
-#endif
@@ -160,3 +128,7 @@ private :
QMap< QString, QString> NodeTypeDescriptionMap;
+ // list of connections that are valid
Name2Connection_t ConnectionsMap;
+ // list of connection configurations that are not valid
+ // e.g. because plugins are missing
+ Name2Connection_t DanglingConnectionsMap;
System * TheSystem;
@@ -172,6 +144,4 @@ private :
-#ifndef MYPLUGIN
Opie::Core::OPluginLoader * Plugins;
Opie::Core::OPluginManager * PluginManager;
-#endif
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 ) {
// load connections -> collections of nodes
- NodeCollection * NC = new NodeCollection( TS );
- NSResources->addConnection( NC );
+ bool Dangling;
+ NodeCollection * NC = new NodeCollection( TS, Dangling );
+ NSResources->addConnection( NC, Dangling );
} else {
@@ -135,4 +136,13 @@ void NetworkSettingsData::loadSettings( void ) {
LeftOvers.append( Line );
- }
+ do {
+ Line = TS.readLine();
+ // store even delimiter
+ LeftOvers.append( Line );
+ } while ( ! Line.isEmpty() );
+
+ //next section
+ continue;
+ }
+ // read entries of this section
do {
@@ -140,36 +150,27 @@ void NetworkSettingsData::loadSettings( void ) {
- if( NN || NNI ) {
- if( S.isEmpty() ) {
- // empty line
- break;
- }
- idx = S.find( '=' );
- if( idx > 0 ) {
- Attr = S.left( idx );
- Value = S.mid( idx+1, S.length() );
- } else {
- Value="";
- Attr = S;
- }
+ if( S.isEmpty() ) {
+ // empty line
+ break;
+ }
+ idx = S.find( '=' );
+ if( idx > 0 ) {
+ Attr = S.left( idx );
+ Value = S.mid( idx+1, S.length() );
+ } else {
+ Value="";
+ Attr = S;
+ }
- Value.stripWhiteSpace();
- Attr.stripWhiteSpace();
- Attr.lower();
- // dequote Attr
- Value = deQuote(Value);
-
- if( NN ) {
- // set the attribute
- NN->setAttribute( Attr, Value );
- } else {
- // set the attribute
- NNI->setAttribute( Attr, Value );
- }
+ Value.stripWhiteSpace();
+ Attr.stripWhiteSpace();
+ Attr.lower();
+ // dequote Attr
+ Value = deQuote(Value);
+
+ if( NN ) {
+ // set the attribute
+ NN->setAttribute( Attr, Value );
} else {
- LeftOvers.append( Line );
- // add empty line too as delimiter
- if( S.isEmpty() ) {
- // empty line
- break;
- }
+ // set the attribute
+ NNI->setAttribute( Attr, Value );
}
@@ -183,2 +184,3 @@ void NetworkSettingsData::loadSettings( void ) {
}
+
if( NN ) {
@@ -213,10 +215,4 @@ QString NetworkSettingsData::saveSettings( void ) {
- // save leftovers
- for ( QStringList::Iterator it = LeftOvers.begin();
- it != LeftOvers.end(); ++it ) {
- TS << (*it) << endl;
- }
-
// save global configs
- for( QDictIterator<NetNode_t> it( NSResources->netNodes() );
+ for( QDictIterator<ANetNode> it( NSResources->netNodes() );
it.current();
@@ -224,3 +220,3 @@ QString NetworkSettingsData::saveSettings( void ) {
TS << "[nodetype "
- << quote( QString( it.current()->NetNode->name() ) )
+ << quote( QString( it.current()->name() ) )
<< "]"
@@ -228,3 +224,3 @@ QString NetworkSettingsData::saveSettings( void ) {
- it.current()->NetNode->saveAttributes( TS );
+ it.current()->saveAttributes( TS );
TS << endl;
@@ -232,4 +228,27 @@ QString NetworkSettingsData::saveSettings( void ) {
+ // save leftovers
+ for ( QStringList::Iterator it = LeftOvers.begin();
+ it != LeftOvers.end(); ++it ) {
+ TS << (*it) << endl;
+ }
+
+ // save all netnode instances
+ { ANetNodeInstance * NNI;
+ for( QDictIterator<ANetNodeInstance> nit(
+ NSResources->netNodeInstances());
+ nit.current();
+ ++nit ) {
+ // header
+ NNI = nit.current();
+ TS << '['
+ << QString(NNI->nodeClass()->name())
+ << ']'
+ << endl;
+ NNI->saveAttributes( TS );
+ TS << endl;
+ }
+ }
+
+ // good connections
{ Name2Connection_t & M = NSResources->connections();
- ANetNodeInstance * NNI;
@@ -239,16 +258,14 @@ QString NetworkSettingsData::saveSettings( void ) {
++it ) {
- // all nodes in those connections
- for( QListIterator<ANetNodeInstance> nit(*(it.current()));
- nit.current();
- ++nit ) {
- // header
- NNI = nit.current();
- TS << '['
- << QString(NNI->nodeClass()->name())
- << ']'
- << endl;
- NNI->saveAttributes( TS );
- TS << endl;
- }
+ TS << "[connection]" << endl;
+ it.current()->save(TS);
+ }
+ }
+ // save dangling connections
+ { Name2Connection_t & M = NSResources->danglingConnections();
+
+ // for all connections
+ for( QDictIterator<NodeCollection> it(M);
+ it.current();
+ ++it ) {
TS << "[connection]" << endl;
@@ -291,10 +308,11 @@ QString NetworkSettingsData::generateSettings( void ) {
- for( QDictIterator<NetNode_t> nnit( NSResources->netNodes() );
+ for( QDictIterator<ANetNode> nnit( NSResources->netNodes() );
nnit.current();
++nnit ) {
- { QStringList SL;
- bool FirstItem = 1;
- bool Generated = 0;
+ bool FirstItem = 1;
+ bool Generated = 0;
- CurDevNN = nnit.current()->NetNode;
+ CurDevNN = nnit.current();
+
+ { QStringList SL;
SL = CurDevNN->properFiles();
@@ -397,6 +415,6 @@ QString NetworkSettingsData::generateSettings( void ) {
// reset all
- for( QDictIterator<NetNode_t> nnit( NSResources->netNodes() );
+ for( QDictIterator<ANetNode> nnit( NSResources->netNodes() );
nnit.current();
++nnit ) {
- nnit.current()->NetNode->setDone(0);
+ nnit.current()->setDone(0);
}
@@ -422,3 +440,3 @@ QString NetworkSettingsData::generateSettings( void ) {
// to write data in this system file ?
- for( QDictIterator<NetNode_t> nnit( NSResources->netNodes() );
+ for( QDictIterator<ANetNode> nnit( NSResources->netNodes() );
! needToGenerate && nnit.current();
@@ -426,3 +444,3 @@ QString NetworkSettingsData::generateSettings( void ) {
- NN = nnit.current()->NetNode;
+ NN = nnit.current();
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 @@
-#ifndef MYPLUGIN
-
#include "netnodeinterface.h"
-#endif
-
QStringList * PPPNetNode::ProperFiles = 0;
@@ -86,15 +82,2 @@ void PPPNetNode::saveSpecificAttribute( QTextStream & ) {
-#ifdef MYPLUGIN
-
-extern "C" {
-void create_plugin( QList<ANetNode> & PNN ) {
- PNN.append( new PPPNetNode() );
-}
-
-#else
-
-OPIE_NS2_PLUGIN( NetNodeInterface<PPPNetNode> )
-
-#endif
-
-}
+OPIE_NS2_PLUGIN( NetNodeInterface_T<PPPNetNode> )
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 @@
-#ifndef MYPLUGIN
-
#include "netnodeinterface.h"
-#endif
-
static const char * ProfileNeeds[] =
@@ -61,15 +57,2 @@ void ProfileNetNode::saveSpecificAttribute( QTextStream & ) {
-#ifdef MYPLUGIN
-
-extern "C" {
-void create_plugin( QList<ANetNode> & PNN ) {
- PNN.append( new ProfileNetNode() );
-}
-
-#else
-
-OPIE_NS2_PLUGIN( NetNodeInterface<ProfileNetNode> )
-
-#endif
-
-}
+OPIE_NS2_PLUGIN( NetNodeInterface_T<ProfileNetNode> )
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 @@
-#ifndef MYPLUGIN
-
#include "netnodeinterface.h"
-#endif
-
static const char * USBNeeds[] =
@@ -63,15 +59,2 @@ void USBNetNode::saveSpecificAttribute( QTextStream & ) {
-#ifdef MYPLUGIN
-
-extern "C" {
-void create_plugin( QList<ANetNode> & PNN ) {
- PNN.append( new USBNetNode() );
-}
-
-#else
-
-OPIE_NS2_PLUGIN( NetNodeInterface<USBNetNode> )
-
-#endif
-
-}
+OPIE_NS2_PLUGIN( NetNodeInterface_T<USBNetNode> )
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 @@
State_t USBRun::detectState( void ) {
+
// unavailable : no card found
@@ -10,2 +11,3 @@ State_t USBRun::detectState( void ) {
// up : card found and assigned to us and up
+
NodeCollection * NC = nodeCollection();
@@ -66,3 +68,5 @@ State_t USBRun::detectState( void ) {
// proper type, and Not UP -> free
- return Off;
+ // usb cables are currently always available when requested
+ // until we can detect if we are plugged in
+ return Available;
}
@@ -77,11 +81,2 @@ QString USBRun::setMyState( NodeCollection * NC, Action_t A, bool ) {
// a cable
-
- // perhaps (later) we can figure out if the device is IN the
- // cradle
- if( A == Activate ) {
- NC->setCurrentState( Available );
- } else if ( A == Deactivate ) {
- NC->setCurrentState( Unavailable );
- }
-
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 @@
-#ifndef MYPLUGIN
-
#include "netnodeinterface.h"
-#endif
-
static const char * VPNNeeds[] =
@@ -55,15 +51,2 @@ void VPNNetNode::saveSpecificAttribute( QTextStream & ) {
-#ifdef MYPLUGIN
-
-extern "C" {
-void create_plugin( QList<ANetNode> & PNN ) {
- PNN.append( new VPNNetNode() );
-}
-
-#else
-
-OPIE_NS2_PLUGIN( NetNodeInterface<VPNNetNode> )
-
-#endif
-
-}
+OPIE_NS2_PLUGIN( NetNodeInterface_T<VPNNetNode> )
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 @@
-#ifndef MYPLUGIN
-
#include "netnodeinterface.h"
-#endif
-
static const char * WLanNeeds[] =
@@ -71,15 +67,2 @@ void WLanNetNode::saveSpecificAttribute( QTextStream & TS ) {
-#ifdef MYPLUGIN
-
-extern "C" {
-void create_plugin( QList<ANetNode> & PNN ) {
- PNN.append( new WLanNetNode() );
-}
-
-#else
-
-OPIE_NS2_PLUGIN( NetNodeInterface<WLanNetNode> )
-
-#endif
-
-}
+OPIE_NS2_PLUGIN( NetNodeInterface_T<WLanNetNode> )