author | wimpie <wimpie> | 2005-01-07 01:19:13 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2005-01-07 01:19:13 (UTC) |
commit | 7af7203a51ddcf85f9f60e39157fcad21f7d9e34 (patch) (side-by-side diff) | |
tree | 49829585a0100a5a741d55424f86be39c01d3150 | |
parent | a8e5ecd107a79f940d8a99d4a77071606a3a932f (diff) | |
download | opie-7af7203a51ddcf85f9f60e39157fcad21f7d9e34.zip opie-7af7203a51ddcf85f9f60e39157fcad21f7d9e34.tar.gz opie-7af7203a51ddcf85f9f60e39157fcad21f7d9e34.tar.bz2 |
First implementation of plugins
THIS VERSION DOES NOT COMPILE
45 files changed, 576 insertions, 77 deletions
diff --git a/noncore/settings/networksettings2/bluetooth/bluetooth.pro b/noncore/settings/networksettings2/bluetooth/bluetooth.pro index 2e3b5bb..053a6cb 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetooth.pro +++ b/noncore/settings/networksettings2/bluetooth/bluetooth.pro @@ -1,3 +1,3 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt warn_on release plugin DESTDIR = $(OPIEDIR)/plugins/networksettings2 diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NN.cpp b/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NN.cpp index ee3e92b..5e4d951 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NN.cpp +++ b/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NN.cpp @@ -4,2 +4,8 @@ +#ifndef MYPLUGIN + +#include "netnodeinterface.h" + +#endif + // @@ -71,2 +77,4 @@ void BluetoothBNEPNetNode::saveSpecificAttribute( QTextStream & TS) { +#ifndef MYPLUGIN + extern "C" { @@ -77,2 +85,10 @@ void create_plugin( QList<ANetNode> & PNN ) { } + +#else + +typedef Opie::Core::MakeTypelist<BluetoothBNEPNetNode, BluetoothRFCOMMNetNode>::Result BluetoothTypes; +OPIE_NS2_PLUGIN( NetNodeInterface<BluetoothTypes> ) + +#endif + } diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.cpp b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.cpp index 9d4ae97..5c937a1 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.cpp +++ b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.cpp @@ -6,2 +6,6 @@ +using Opietooth2::OTGateway; +using Opietooth2::OTPANConnection; +using Opietooth2::PANConnectionVector; + BluetoothBNEPRun::BluetoothBNEPRun( ANetNodeInstance * NNI, diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h index a05a7a2..8551a2e 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h +++ b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h @@ -4,3 +4,2 @@ #include <OTGateway.h> -using namespace Opietooth2; @@ -32,4 +31,4 @@ private : BluetoothBNEPData & Data; - OTGateway * OT; - QRegExp Pat; + Opietooth2::OTGateway * OT; + QRegExp Pat; }; diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMedit.h b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMedit.h index 9ad8f2a..fe474fc 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMedit.h +++ b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMedit.h @@ -4,3 +4,2 @@ #include <Opietooth.h> -using namespace Opietooth2; @@ -17,4 +16,4 @@ public : - bool Modified; - OTGateway * OT; + bool Modified; + Opietooth2::OTGateway * OT; diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.cpp b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.cpp index 1e91ed1..ef6878a 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.cpp +++ b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.cpp @@ -6,3 +6,5 @@ -using namespace Opietooth2; +using Opietooth2::OTGateway; +using Opietooth2::OTDevice; +using Opietooth2::OTDeviceAddress; diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h index 24e3dae..5a31a94 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h +++ b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h @@ -4,3 +4,2 @@ #include <OTGateway.h> -using namespace Opietooth2; @@ -29,5 +28,5 @@ private : RFCOMMChannel * getChannel( void ); - BluetoothRFCOMMData * Data; + BluetoothRFCOMMData * Data; Opietooth2::OTGateway * OT; - int DeviceNr; // cached from detection + int DeviceNr; // cached from detection }; diff --git a/noncore/settings/networksettings2/cable/cable.pro b/noncore/settings/networksettings2/cable/cable.pro index 8a046b7..660f95e 100644 --- a/noncore/settings/networksettings2/cable/cable.pro +++ b/noncore/settings/networksettings2/cable/cable.pro @@ -1,3 +1,3 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt warn_on release plugin DESTDIR = $(OPIEDIR)/plugins/networksettings2 diff --git a/noncore/settings/networksettings2/cable/cable_NN.cpp b/noncore/settings/networksettings2/cable/cable_NN.cpp index dc4205c..20299e4 100644 --- a/noncore/settings/networksettings2/cable/cable_NN.cpp +++ b/noncore/settings/networksettings2/cable/cable_NN.cpp @@ -3,2 +3,8 @@ +#ifndef MYPLUGIN + +#include "netnodeinterface.h" + +#endif + static const char * CableNeeds[] = @@ -49,2 +55,4 @@ void CableNetNode::saveSpecificAttribute( QTextStream & ) { +#ifdef MYPLUGIN + extern "C" { @@ -53,2 +61,9 @@ void create_plugin( QList<ANetNode> & PNN ) { } + +#else + +OPIE_NS2_PLUGIN( NetNodeInterface<CableNetNode> ) + +#endif + } diff --git a/noncore/settings/networksettings2/gprs/GPRS.pro b/noncore/settings/networksettings2/gprs/GPRS.pro index 7818415..480c872 100644 --- a/noncore/settings/networksettings2/gprs/GPRS.pro +++ b/noncore/settings/networksettings2/gprs/GPRS.pro @@ -1,3 +1,3 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt warn_on release plugin DESTDIR = $(OPIEDIR)/plugins/networksettings2 diff --git a/noncore/settings/networksettings2/gprs/GPRS_NN.cpp b/noncore/settings/networksettings2/gprs/GPRS_NN.cpp index 5393324..4415739 100644 --- a/noncore/settings/networksettings2/gprs/GPRS_NN.cpp +++ b/noncore/settings/networksettings2/gprs/GPRS_NN.cpp @@ -6,2 +6,8 @@ +#ifndef MYPLUGIN + +#include "netnodeinterface.h" + +#endif + static const char * GPRSNeeds[] = @@ -75,2 +81,4 @@ QStringList GPRSNetNode::properFiles( void ) { +#ifdef MYPLUGIN + extern "C" { @@ -79,2 +87,9 @@ void create_plugin( QList<ANetNode> & PNN ) { } + +#else + +OPIE_NS2_PLUGIN( NetNodeInterface<GPRSNetNode> ) + +#endif + } diff --git a/noncore/settings/networksettings2/irda/irda.pro b/noncore/settings/networksettings2/irda/irda.pro index 4613abe..87f7a62 100644 --- a/noncore/settings/networksettings2/irda/irda.pro +++ b/noncore/settings/networksettings2/irda/irda.pro @@ -1,3 +1,3 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt warn_on release plugin DESTDIR = $(OPIEDIR)/plugins/networksettings2 diff --git a/noncore/settings/networksettings2/irda/irda_NN.cpp b/noncore/settings/networksettings2/irda/irda_NN.cpp index 485cad3..6858157 100644 --- a/noncore/settings/networksettings2/irda/irda_NN.cpp +++ b/noncore/settings/networksettings2/irda/irda_NN.cpp @@ -3,2 +3,8 @@ +#ifndef MYPLUGIN + +#include "netnodeinterface.h" + +#endif + static const char * IRDANeeds[] = @@ -49,2 +55,4 @@ void IRDANetNode::saveSpecificAttribute( QTextStream & ) { +#ifdef MYPLUGIN + extern "C" { @@ -53,2 +61,9 @@ void create_plugin( QList<ANetNode> & PNN ) { } + +#else + +OPIE_NS2_PLUGIN( NetNodeInterface<IRDANetNode> ) + +#endif + } diff --git a/noncore/settings/networksettings2/lancard/lancard.pro b/noncore/settings/networksettings2/lancard/lancard.pro index 6f04e01..05f0fa0 100644 --- a/noncore/settings/networksettings2/lancard/lancard.pro +++ b/noncore/settings/networksettings2/lancard/lancard.pro @@ -1,3 +1,3 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt warn_on release plugin DESTDIR = $(OPIEDIR)/plugins/networksettings2 diff --git a/noncore/settings/networksettings2/lancard/lancard_NN.cpp b/noncore/settings/networksettings2/lancard/lancard_NN.cpp index e36f757..fce3d29 100644 --- a/noncore/settings/networksettings2/lancard/lancard_NN.cpp +++ b/noncore/settings/networksettings2/lancard/lancard_NN.cpp @@ -3,2 +3,8 @@ +#ifndef MYPLUGIN + +#include "netnodeinterface.h" + +#endif + static const char * LanCardNeeds[] = @@ -72,2 +78,4 @@ void LanCardNetNode::saveSpecificAttribute( QTextStream & TS) { +#ifdef MYPLUGIN + extern "C" { @@ -76,2 +84,9 @@ void create_plugin( QList<ANetNode> & PNN ) { } + +#else + +OPIE_NS2_PLUGIN( NetNodeInterface<LanCardNetNode> ) + +#endif + } diff --git a/noncore/settings/networksettings2/modem/modem.pro b/noncore/settings/networksettings2/modem/modem.pro index 25e29d4..4511e07 100644 --- a/noncore/settings/networksettings2/modem/modem.pro +++ b/noncore/settings/networksettings2/modem/modem.pro @@ -1,3 +1,3 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt warn_on release plugin DESTDIR = $(OPIEDIR)/plugins/networksettings2 diff --git a/noncore/settings/networksettings2/modem/modem_NN.cpp b/noncore/settings/networksettings2/modem/modem_NN.cpp index 06f417c..c7f6e78 100644 --- a/noncore/settings/networksettings2/modem/modem_NN.cpp +++ b/noncore/settings/networksettings2/modem/modem_NN.cpp @@ -3,2 +3,8 @@ +#ifndef MYPLUGIN + +#include "netnodeinterface.h" + +#endif + static const char * ModemNeeds[] = @@ -50,2 +56,4 @@ void ModemNetNode::saveSpecificAttribute( QTextStream & ) { +#ifdef MYPLUGIN + extern "C" { @@ -54,2 +62,9 @@ void create_plugin( QList<ANetNode> & PNN ) { } + +#else + +OPIE_NS2_PLUGIN( NetNodeInterface<ModemNetNode> ) + +#endif + } diff --git a/noncore/settings/networksettings2/network/network.pro b/noncore/settings/networksettings2/network/network.pro index 05df007..5ca78b9 100644 --- a/noncore/settings/networksettings2/network/network.pro +++ b/noncore/settings/networksettings2/network/network.pro @@ -1,3 +1,3 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt warn_on release plugin DESTDIR = $(OPIEDIR)/plugins/networksettings2 diff --git a/noncore/settings/networksettings2/network/network_NN.cpp b/noncore/settings/networksettings2/network/network_NN.cpp index 23b3d44..82d0c29 100644 --- a/noncore/settings/networksettings2/network/network_NN.cpp +++ b/noncore/settings/networksettings2/network/network_NN.cpp @@ -6,2 +6,8 @@ +#ifndef MYPLUGIN + +#include "netnodeinterface.h" + +#endif + static const char * NetworkNeeds[] = @@ -92,2 +98,4 @@ void NetworkNetNode::saveSpecificAttribute( QTextStream & ) { +#ifdef MYPLUGIN + extern "C" { @@ -96,2 +104,9 @@ void create_plugin( QList<ANetNode> & PNN ) { } + +#else + +OPIE_NS2_PLUGIN( NetNodeInterface<NetworkNetNode> ) + +#endif + } diff --git a/noncore/settings/networksettings2/networksettings2/netnodeinterface.h b/noncore/settings/networksettings2/networksettings2/netnodeinterface.h new file mode 100644 index 0000000..34f3bb5 --- a/dev/null +++ b/noncore/settings/networksettings2/networksettings2/netnodeinterface.h @@ -0,0 +1,139 @@ +/* + This file is part of the Opie Project + + Copyright (C) 2005 Holger Hans Peter Freyther <freyther@handhelds.org> + =. + .=l. + .>+-= + _;:, .> :=|. This program is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU Library General Public +.="- .-=="i, .._ License as published by the Free Software + - . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This program is distributed in the hope that + + . -:. = it will be useful, but WITHOUT ANY WARRANTY; + : .. .:, . . . without even the implied warranty of + =_ + =;=|` MERCHANTABILITY or FITNESS FOR A + _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU +..}^=.= = ; Library General Public License for more +++= -. .` .: details. + : = ...= . :.=- + -. .:....=;==+<; You should have received a copy of the GNU + -_. . . )=. = Library General Public License along with + -- :-=` this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + +*/ + +#ifndef ANET_NODE_INTERFACE_H +#define ANET_NODE_INTERFACE_H + +#include <opie2/oapplicationfactory.h> +#include <qpe/qcom.h> + +// {A215A785-FB73-4F74-84B0-053BCC77DB87} +#ifndef IID_NetworkSettings2 + +#define IID_NetworkSettings2 QUuid( 0xa215a785, 0xfb73, 0x4f74, 0x84, 0xb0, 0x05, 0x3b, 0xcc, 0x77, 0xdb, 0x87) + +#endif + + + +/** + * Multiple Types + */ +template <class Node > +struct NS2PrivateFactory { + + inline static void createPlugins( QList<ANetNode> & PNN) { + PNN.append( new Node()); + } + +}; + +/* + * Stop recursion here + */ +template <> +struct NS2PrivateFactory<Opie::Core::NullType> { + + inline static void createPlugins( QList<ANetNode> &) { + + } + +}; + +template <class Node, class Tail> +struct NS2PrivateFactory<Opie::Core::Typelist<Node, Tail> > { + + inline static void createPlugins( QList<ANetNode> & PNN ) { + NS2PrivateFactory<Node>::createPlugins(PNN); + NS2PrivateFactory<Tail>::createPlugins(PNN); + } + +}; + +template<class Node> +struct NetNodeInterface : public QUnknownInterface { + + QRESULT queryInterface(const QUuid& uuid, QUnknownInterface **iface) { + *iface = 0; + + if( uuid == IID_QUnknown ) + *iface = this; + else if( uuid == IID_NetworkSettings2 ) + *iface = this; + else + return QS_FALSE; + + (*iface)->addRef(); + + return QS_OK; + + } + + void create_plugin( QList<ANetNode> & PNN ) { + + PNN.append( new Node()); + + } + + Q_REFCOUNT +}; + +template<class Node, class Tail> +struct NetNodeInterface<Opie::Core::Typelist<Node, Tail> > + : public QUnknownInterface { + + QRESULT queryInterface( const QUuid& uuid, + QUnknownInterface **iface) { + + *iface = 0; + + if( uuid == IID_QUnknown ) *iface = this; + else if( uuid == IID_NetworkSettings2 ) *iface = this; + else return QS_FALSE; + + (*iface)->addRef(); + return QS_OK; + + } + + void create_plugin( QList<ANetNode> & PNN ) { + NS2PrivateFactory<Opie::Core::Typelist<Node,Tail> >::createPlugin( PNN ); + } + + Q_REFCOUNT + +}; + +#define OPIE_NS2_PLUGIN( factory ) \ + Q_EXPORT_INTERFACE() { Q_CREATE_INSTANCE( factory) } + +#endif + diff --git a/noncore/settings/networksettings2/networksettings2/resources.cpp b/noncore/settings/networksettings2/networksettings2/resources.cpp index 50fb15a..79d41ea 100644 --- a/noncore/settings/networksettings2/networksettings2/resources.cpp +++ b/noncore/settings/networksettings2/networksettings2/resources.cpp @@ -6,5 +6,10 @@ #include <qdir.h> +#include <qmessagebox.h> + #include <qpe/qlibrary.h> #include <qpe/qpeapplication.h> + #include <opie2/odebug.h> +#include <opie2/opluginloader.h> + #include <qtopia/resource.h> @@ -13,2 +18,3 @@ #include "resources.h" +#include "netnodeinterface.h" @@ -28,2 +34,5 @@ TheNSResources::TheNSResources( void ) : NodeTypeNameMap(), // load available netnodes + +#ifdef MYPLUGIN + findAvailableNetNodes(QPEApplication::qpeDir() + PLUGINDIR ); @@ -68,2 +77,48 @@ TheNSResources::TheNSResources( void ) : NodeTypeNameMap(), +#else + + Plugins = 0; + findAvailableNetNodes(); + + // compile provides and needs lists + { const char ** NeedsRun; + QDictIterator<ANetNode> 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<ANetNode> InnerIt( AllNodeTypes ); + InnerIt.current(); ++InnerIt ) { + + if( InnerIt.current() == OuterIt.current() ) + // avoid recursive + continue; + + const char ** Provides = InnerIt.current()->provides(); + NeedsRun = OuterIt.current()->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(); + Done = 1; // break from 2 loops + break; + } + } + } + } + OuterIt.current()->setAlternatives( NNLP ); + } + } + +#endif + // define built in Node types to Description map @@ -86,3 +141,11 @@ TheNSResources::TheNSResources( void ) : NodeTypeNameMap(), TheNSResources::~TheNSResources( void ) { + +#ifndef MYPLUGINS + if( Plugins ) { + delete Plugins; + delete PluginManager; + } +#endif delete TheSystem; + } @@ -118,2 +181,3 @@ void TheNSResources::busy( bool ) { +#ifdef MYPLUGIN /** @@ -162,23 +226,2 @@ void TheNSResources::findAvailableNetNodes(const QString &path){ -// used to find unique connection number -int TheNSResources::assignConnectionNumber( void ) { - bool found = 1; - for( int trial = 0; ; trial ++ ) { - found = 1; - for( QDictIterator<NodeCollection> it(ConnectionsMap); - it.current(); - ++it ) { - if( it.current()->number() == trial ) { - found = 0; - break; - } - } - - if( found ) { - Log(("Assign profile number %d\n", trial )); - return trial; - } - } -} - /** @@ -229,2 +272,96 @@ bool TheNSResources::loadNetNode( +#else + +void TheNSResources::findAvailableNetNodes( void ){ + + Plugins = new OPluginLoader( "networksettings2" ); + Plugins->setAutoDelete( true ); + + PluginManager = new OPluginManager( Plugins ); + PluginManager->load(); + + if( Plugins->isInSafeMode() ) { + QMessageBox::information( + 0, + tr( "Today Error"), + tr( "<qt>The plugin '%1' caused Today to crash." + " It could be that the plugin is not properly" + " installed.<br>Today tries to continue loading" + " plugins.</qt>" ) + .arg( PluginManager->crashedPlugin().name())); + } + + // Get All Plugins + OPluginLoader::List allplugins = Plugins->filtered(); + + for( OPluginLoader::List::Iterator it = allplugins.begin(); + it != allplugins.end(); + ++it ) { + + // check if this plugin supports the proper interface + NetNodeInterface * interface = + Plugins->load<NetNodeInterface>( *it, IID_NetworkSettings2 ); + + if( ! interface ) { + Log(( "Plugin %s from %s does not support proper interface\n", + it->name().latin1(), it->path().latin1() )); + continue; + } + + // add the nodes in this plugin to the dictionary + { QList<ANetNode> PNN; + + interface->create_plugin( PNN ); + + if( PNN.isEmpty() ) { + Log(( "Plugin %s from %s does offer any nodes\n", + it->name().latin1(), it->path().latin1() )); + delete interface; + continue; + } + + // merge this node with global node + for( QListIterator<ANetNode> it(PNN); + it.current(); + ++it ) { + AllNodeTypes.insert( it->current()->name(), it->current() ); + } + } + + // load the translation + QTranslator *trans = new QTranslator(qApp); + QString fn = QPEApplication::qpeDir()+ + "/i18n/"+lang+"/"+ it->name() + ".qm"; + + if( trans->load( fn ) ) + qApp->installTranslator( trans ); + else + delete trans; + } + +} + +#endif + +// used to find unique connection number +int TheNSResources::assignConnectionNumber( void ) { + bool found = 1; + for( int trial = 0; ; trial ++ ) { + found = 1; + for( QDictIterator<NodeCollection> it(ConnectionsMap); + it.current(); + ++it ) { + if( it.current()->number() == trial ) { + found = 0; + break; + } + } + + if( found ) { + Log(("Assign profile number %d\n", trial )); + return trial; + } + } +} + QPixmap TheNSResources::getPixmap( const QString & QS ) { diff --git a/noncore/settings/networksettings2/networksettings2/resources.h b/noncore/settings/networksettings2/networksettings2/resources.h index 5d90286..421a433 100644 --- a/noncore/settings/networksettings2/networksettings2/resources.h +++ b/noncore/settings/networksettings2/networksettings2/resources.h @@ -16,9 +16,10 @@ class ANetNodeInstance; -typedef void (*GetNetNodeListFt_t)(QList<ANetNode>& PNN ); +namespace Opie { + namespace Core { + class OPluginLoader; + class OPluginManager; + } +} -typedef struct NetNode_S { - ANetNode * NetNode; - QLibrary * TheLibrary; - long NodeCountInLib; -} NetNode_t; +typedef void (*GetNetNodeListFt_t)(QList<ANetNode>& PNN ); @@ -39,3 +40,17 @@ 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; @@ -64,2 +79,3 @@ public : { return AllNodeTypes.find(X)!=0; } +#ifdef MYPLUGIN ANetNode * findNetNode( const QString & N ) @@ -68,3 +84,7 @@ public : } - +#else + ANetNode * findNetNode( const QString & N ) + { return AllNodeTypes.find(N); + } +#endif // define new plugin (=node) @@ -83,2 +103,3 @@ public : printf( "Find node type %s\n", S.latin1() ); +#ifdef MYPLUGIN NetNode_t * NNT = AllNodeTypes[S]; @@ -88,2 +109,9 @@ public : NNI = NNT->NetNode->createInstance(); +#else + ANetNode * NNT = AllNodeTypes[S]; + if( ! NNT ) { + return 0; + } + NNI = NNT->createInstance(); +#endif NNI->initialize(); @@ -120,2 +148,4 @@ private : QString tr( const char * path ); + +#ifdef MYPLUGIN void findAvailableNetNodes( const QString &path ); @@ -124,2 +154,5 @@ private : const QString &resolveString = "create_plugin"); +#else + void findAvailableNetNodes( void ); +#endif @@ -127,13 +160,19 @@ private : QMap< QString, QString> NodeTypeDescriptionMap; - Name2Connection_t ConnectionsMap; - System * TheSystem; - Name2SystemFile_t SystemFiles; + Name2Connection_t ConnectionsMap; + System * TheSystem; + Name2SystemFile_t SystemFiles; // all node type classes - Name2NetNode_t AllNodeTypes; + Name2NetNode_t AllNodeTypes; // all nodes - Name2Instance_t AllNodes; + Name2Instance_t AllNodes; + + CurrentQPEUser CurrentUser; + +#ifndef MYPLUGIN + Opie::Core::OPluginLoader * Plugins; + Opie::Core::OPluginManager * PluginManager; +#endif - CurrentQPEUser CurrentUser; }; diff --git a/noncore/settings/networksettings2/opietooth2/OTDevice.h b/noncore/settings/networksettings2/opietooth2/OTDevice.h index cf1c4b6..09de7ee 100644 --- a/noncore/settings/networksettings2/opietooth2/OTDevice.h +++ b/noncore/settings/networksettings2/opietooth2/OTDevice.h @@ -18,4 +18,4 @@ namespace Opie { class OProcess; - }; -}; + } +} @@ -113,3 +113,3 @@ namespace Opietooth2 { }; -}; +} diff --git a/noncore/settings/networksettings2/opietooth2/OTDeviceAddress.h b/noncore/settings/networksettings2/opietooth2/OTDeviceAddress.h index 50f28fc..8395f37 100644 --- a/noncore/settings/networksettings2/opietooth2/OTDeviceAddress.h +++ b/noncore/settings/networksettings2/opietooth2/OTDeviceAddress.h @@ -105,3 +105,3 @@ protected: -}; +} diff --git a/noncore/settings/networksettings2/opietooth2/OTDriver.h b/noncore/settings/networksettings2/opietooth2/OTDriver.h index f249cf7..b54ffdf 100644 --- a/noncore/settings/networksettings2/opietooth2/OTDriver.h +++ b/noncore/settings/networksettings2/opietooth2/OTDriver.h @@ -230,3 +230,3 @@ private: -}; +} #endif diff --git a/noncore/settings/networksettings2/opietooth2/OTGateway.h b/noncore/settings/networksettings2/opietooth2/OTGateway.h index a47cefb..d97ef35 100644 --- a/noncore/settings/networksettings2/opietooth2/OTGateway.h +++ b/noncore/settings/networksettings2/opietooth2/OTGateway.h @@ -197,3 +197,3 @@ private : }; -}; +} diff --git a/noncore/settings/networksettings2/opietooth2/OTHCISocket.h b/noncore/settings/networksettings2/opietooth2/OTHCISocket.h index d508078..a004989 100644 --- a/noncore/settings/networksettings2/opietooth2/OTHCISocket.h +++ b/noncore/settings/networksettings2/opietooth2/OTHCISocket.h @@ -113,3 +113,3 @@ private slots: -}; +} diff --git a/noncore/settings/networksettings2/opietooth2/OTIcons.h b/noncore/settings/networksettings2/opietooth2/OTIcons.h index 966ed24..ee10831 100644 --- a/noncore/settings/networksettings2/opietooth2/OTIcons.h +++ b/noncore/settings/networksettings2/opietooth2/OTIcons.h @@ -51,3 +51,3 @@ private: }; -}; +} diff --git a/noncore/settings/networksettings2/opietooth2/OTInquiry.h b/noncore/settings/networksettings2/opietooth2/OTInquiry.h index 2682499..f7bdeec 100644 --- a/noncore/settings/networksettings2/opietooth2/OTInquiry.h +++ b/noncore/settings/networksettings2/opietooth2/OTInquiry.h @@ -176,3 +176,3 @@ private slots: -}; +} #endif diff --git a/noncore/settings/networksettings2/opietooth2/OTPeer.h b/noncore/settings/networksettings2/opietooth2/OTPeer.h index 9cd0dc7..c09af15 100644 --- a/noncore/settings/networksettings2/opietooth2/OTPeer.h +++ b/noncore/settings/networksettings2/opietooth2/OTPeer.h @@ -132,3 +132,3 @@ private: -}; +} diff --git a/noncore/settings/networksettings2/opietooth2/OTSDPAttribute.h b/noncore/settings/networksettings2/opietooth2/OTSDPAttribute.h index 86b5623..e79e33d 100644 --- a/noncore/settings/networksettings2/opietooth2/OTSDPAttribute.h +++ b/noncore/settings/networksettings2/opietooth2/OTSDPAttribute.h @@ -137,3 +137,3 @@ private: -}; +} diff --git a/noncore/settings/networksettings2/opietooth2/OTSDPService.h b/noncore/settings/networksettings2/opietooth2/OTSDPService.h index 21d7344..4831df0 100644 --- a/noncore/settings/networksettings2/opietooth2/OTSDPService.h +++ b/noncore/settings/networksettings2/opietooth2/OTSDPService.h @@ -72,3 +72,3 @@ private: -}; +} diff --git a/noncore/settings/networksettings2/opietooth2/OTUUID.h b/noncore/settings/networksettings2/opietooth2/OTUUID.h index 97df114..aebd9b9 100644 --- a/noncore/settings/networksettings2/opietooth2/OTUUID.h +++ b/noncore/settings/networksettings2/opietooth2/OTUUID.h @@ -56,3 +56,3 @@ public : }; -}; +} #endif diff --git a/noncore/settings/networksettings2/opietooth2/Opietooth.h b/noncore/settings/networksettings2/opietooth2/Opietooth.h index e66787f..f077dd7 100644 --- a/noncore/settings/networksettings2/opietooth2/Opietooth.h +++ b/noncore/settings/networksettings2/opietooth2/Opietooth.h @@ -13,5 +13,5 @@ namespace Opie { - }; + } -}; +} @@ -53,3 +53,3 @@ private : }; -}; +} @@ -82,3 +82,3 @@ private : }; -}; +} @@ -160,3 +160,3 @@ private : }; -}; +} @@ -198,3 +198,3 @@ private : }; -}; +} @@ -236,3 +236,3 @@ private : }; -}; +} #endif diff --git a/noncore/settings/networksettings2/ppp/ppp.pro b/noncore/settings/networksettings2/ppp/ppp.pro index dd3408c..10d0f1b 100644 --- a/noncore/settings/networksettings2/ppp/ppp.pro +++ b/noncore/settings/networksettings2/ppp/ppp.pro @@ -1,3 +1,3 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt warn_on release plugin DESTDIR = $(OPIEDIR)/plugins/networksettings2 diff --git a/noncore/settings/networksettings2/ppp/ppp_NN.cpp b/noncore/settings/networksettings2/ppp/ppp_NN.cpp index 51ba27d..bd13ab9 100644 --- a/noncore/settings/networksettings2/ppp/ppp_NN.cpp +++ b/noncore/settings/networksettings2/ppp/ppp_NN.cpp @@ -6,2 +6,8 @@ +#ifndef MYPLUGIN + +#include "netnodeinterface.h" + +#endif + QStringList * PPPNetNode::ProperFiles = 0; @@ -80,2 +86,4 @@ void PPPNetNode::saveSpecificAttribute( QTextStream & ) { +#ifdef MYPLUGIN + extern "C" { @@ -84,2 +92,9 @@ void create_plugin( QList<ANetNode> & PNN ) { } + +#else + +OPIE_NS2_PLUGIN( NetNodeInterface<PPPNetNode> ) + +#endif + } diff --git a/noncore/settings/networksettings2/profile/profile.pro b/noncore/settings/networksettings2/profile/profile.pro index f980034..4db7a5d 100644 --- a/noncore/settings/networksettings2/profile/profile.pro +++ b/noncore/settings/networksettings2/profile/profile.pro @@ -1,3 +1,3 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt warn_on release plugin DESTDIR = $(OPIEDIR)/plugins/networksettings2 diff --git a/noncore/settings/networksettings2/profile/profile_NN.cpp b/noncore/settings/networksettings2/profile/profile_NN.cpp index b7d8aa0..6028ea5 100644 --- a/noncore/settings/networksettings2/profile/profile_NN.cpp +++ b/noncore/settings/networksettings2/profile/profile_NN.cpp @@ -4,2 +4,8 @@ +#ifndef MYPLUGIN + +#include "netnodeinterface.h" + +#endif + static const char * ProfileNeeds[] = @@ -55,2 +61,4 @@ void ProfileNetNode::saveSpecificAttribute( QTextStream & ) { +#ifdef MYPLUGIN + extern "C" { @@ -59,2 +67,9 @@ void create_plugin( QList<ANetNode> & PNN ) { } + +#else + +OPIE_NS2_PLUGIN( NetNodeInterface<ProfileNetNode> ) + +#endif + } diff --git a/noncore/settings/networksettings2/usb/usb.pro b/noncore/settings/networksettings2/usb/usb.pro index 37c1bde..d9890b6 100644 --- a/noncore/settings/networksettings2/usb/usb.pro +++ b/noncore/settings/networksettings2/usb/usb.pro @@ -1,3 +1,3 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt warn_on release plugin DESTDIR = $(OPIEDIR)/plugins/networksettings2 diff --git a/noncore/settings/networksettings2/usb/usb_NN.cpp b/noncore/settings/networksettings2/usb/usb_NN.cpp index bd9ae2b..9c07b82 100644 --- a/noncore/settings/networksettings2/usb/usb_NN.cpp +++ b/noncore/settings/networksettings2/usb/usb_NN.cpp @@ -4,2 +4,8 @@ +#ifndef MYPLUGIN + +#include "netnodeinterface.h" + +#endif + static const char * USBNeeds[] = @@ -57,2 +63,4 @@ void USBNetNode::saveSpecificAttribute( QTextStream & ) { +#ifdef MYPLUGIN + extern "C" { @@ -61,2 +69,9 @@ void create_plugin( QList<ANetNode> & PNN ) { } + +#else + +OPIE_NS2_PLUGIN( NetNodeInterface<USBNetNode> ) + +#endif + } diff --git a/noncore/settings/networksettings2/usb/usb_NNI.cpp b/noncore/settings/networksettings2/usb/usb_NNI.cpp index 600b771..424845c 100644 --- a/noncore/settings/networksettings2/usb/usb_NNI.cpp +++ b/noncore/settings/networksettings2/usb/usb_NNI.cpp @@ -47,3 +47,3 @@ short AUSB::generateFileEmbedded( SystemFile & SF, << QPEApplication::qpeDir() - << "bin/setmacaddress.sh " + << "bin/NS2SetMac.sh " << NIC diff --git a/noncore/settings/networksettings2/vpn/vpn.pro b/noncore/settings/networksettings2/vpn/vpn.pro index a131a1f..349571e 100644 --- a/noncore/settings/networksettings2/vpn/vpn.pro +++ b/noncore/settings/networksettings2/vpn/vpn.pro @@ -1,3 +1,3 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt warn_on release plugin DESTDIR = $(OPIEDIR)/plugins/networksettings2 diff --git a/noncore/settings/networksettings2/vpn/vpn_NN.cpp b/noncore/settings/networksettings2/vpn/vpn_NN.cpp index 23ec04a..6dd5332 100644 --- a/noncore/settings/networksettings2/vpn/vpn_NN.cpp +++ b/noncore/settings/networksettings2/vpn/vpn_NN.cpp @@ -3,2 +3,8 @@ +#ifndef MYPLUGIN + +#include "netnodeinterface.h" + +#endif + static const char * VPNNeeds[] = @@ -49,2 +55,4 @@ void VPNNetNode::saveSpecificAttribute( QTextStream & ) { +#ifdef MYPLUGIN + extern "C" { @@ -53,2 +61,9 @@ void create_plugin( QList<ANetNode> & PNN ) { } + +#else + +OPIE_NS2_PLUGIN( NetNodeInterface<VPNNetNode> ) + +#endif + } diff --git a/noncore/settings/networksettings2/wlan/wlan.pro b/noncore/settings/networksettings2/wlan/wlan.pro index f4c55df..a08cbbb 100644 --- a/noncore/settings/networksettings2/wlan/wlan.pro +++ b/noncore/settings/networksettings2/wlan/wlan.pro @@ -1,3 +1,3 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt warn_on release plugin DESTDIR = $(OPIEDIR)/plugins/networksettings2 diff --git a/noncore/settings/networksettings2/wlan/wlan_NN.cpp b/noncore/settings/networksettings2/wlan/wlan_NN.cpp index 36a5c33..c56da06 100644 --- a/noncore/settings/networksettings2/wlan/wlan_NN.cpp +++ b/noncore/settings/networksettings2/wlan/wlan_NN.cpp @@ -4,2 +4,8 @@ +#ifndef MYPLUGIN + +#include "netnodeinterface.h" + +#endif + static const char * WLanNeeds[] = @@ -65,2 +71,4 @@ void WLanNetNode::saveSpecificAttribute( QTextStream & TS ) { +#ifdef MYPLUGIN + extern "C" { @@ -69,2 +77,9 @@ void create_plugin( QList<ANetNode> & PNN ) { } + +#else + +OPIE_NS2_PLUGIN( NetNodeInterface<WLanNetNode> ) + +#endif + } |