Diffstat (limited to 'noncore/settings/networksettings2/wlan') (more/less context) (ignore whitespace changes)
5 files changed, 31 insertions, 6 deletions
diff --git a/noncore/settings/networksettings2/wlan/wlan_NN.cpp b/noncore/settings/networksettings2/wlan/wlan_NN.cpp index 5a26e41..e1e20c0 100644 --- a/noncore/settings/networksettings2/wlan/wlan_NN.cpp +++ b/noncore/settings/networksettings2/wlan/wlan_NN.cpp @@ -21,40 +21,47 @@ const QString WLanNetNode::nodeDescription(){ return tr("\ <p>Configure Wi/Fi or WLan network cards.</p>\ <p>Defines Wireless options for those cards</p>\ " ); } ANetNodeInstance * WLanNetNode::createInstance( void ) { return new AWLan( this ); } const char ** WLanNetNode::needs( void ) { return WLanNeeds; } const char * WLanNetNode::provides( void ) { return "device"; } bool WLanNetNode::generateProperFilesFor( ANetNodeInstance * ) { return 1; } -bool WLanNetNode::hasDataFor( const QString & ) { - return 0; +bool WLanNetNode::hasDataFor( const QString & S, bool DS ) { + return DS && S == "interfaces"; } bool WLanNetNode::generateDataForCommonFile( - SystemFile & , - long, + SystemFile &, + long , ANetNodeInstance * ) { return 1; } +bool WLanNetNode::generateDeviceDataForCommonFile( + SystemFile & S, + long DevNr, + ANetNodeInstance * NNI ) { + return ((AWLan *)NNI)->generateDeviceDataForCommonFile(S, DevNr); +} + extern "C" { void create_plugin( QList<ANetNode> & PNN ) { PNN.append( new WLanNetNode() ); } } diff --git a/noncore/settings/networksettings2/wlan/wlan_NN.h b/noncore/settings/networksettings2/wlan/wlan_NN.h index 0728a79..9111995 100644 --- a/noncore/settings/networksettings2/wlan/wlan_NN.h +++ b/noncore/settings/networksettings2/wlan/wlan_NN.h @@ -7,38 +7,40 @@ class AWLan; class WLanNetNode : public ANetNode{ Q_OBJECT public: WLanNetNode(); virtual ~WLanNetNode(); virtual const QString pixmapName() { return "Devices/wlan"; } virtual const QString nodeName() { return tr("WLan Device"); } virtual const QString nodeDescription() ; virtual ANetNodeInstance * createInstance( void ); virtual const char ** needs( void ); virtual const char * provides( void ); virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); - virtual bool hasDataFor( const QString & S ); + virtual bool hasDataFor( const QString & S, bool DS ); virtual bool generateDataForCommonFile( SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); + virtual bool generateDeviceDataForCommonFile( + SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); private: }; extern "C" { void create_plugin( QList<ANetNode> & PNN ); }; #endif diff --git a/noncore/settings/networksettings2/wlan/wlan_NNI.cpp b/noncore/settings/networksettings2/wlan/wlan_NNI.cpp index 92f3457..8b948e0 100644 --- a/noncore/settings/networksettings2/wlan/wlan_NNI.cpp +++ b/noncore/settings/networksettings2/wlan/wlan_NNI.cpp @@ -7,24 +7,36 @@ AWLan::AWLan( WLanNetNode * PNN ) : ANetNodeInstance( PNN ) { RT = 0; } void AWLan::setSpecificAttribute( QString & , QString & ) { } void AWLan::saveSpecificAttribute( QTextStream & ) { } QWidget * AWLan::edit( QWidget * parent ) { GUI = new WLanEdit( parent ); GUI->showData( Data ); return GUI; } QString AWLan::acceptable( void ) { return ( GUI ) ? GUI->acceptable( ) : QString(); } void AWLan::commit( void ) { if( GUI && GUI->commit( Data ) ) setModified( 1 ); } +bool AWLan::generateDeviceDataForCommonFile( SystemFile & S, long DevNr ) { + AsDevice * Dev = runtime()->device(); + QString NIC = Dev->genNic( DevNr ); + + if( S.name() == "interfaces" ) { + // generate mapping stanza for this interface + S << "# check if " << NIC << " can be brought UP" << endl; + S << "mapping " << NIC << endl; + S << " script networksettings2-request" << endl << endl; + } + return 0; +} diff --git a/noncore/settings/networksettings2/wlan/wlan_NNI.h b/noncore/settings/networksettings2/wlan/wlan_NNI.h index 8b695b5..e464c84 100644 --- a/noncore/settings/networksettings2/wlan/wlan_NNI.h +++ b/noncore/settings/networksettings2/wlan/wlan_NNI.h @@ -6,38 +6,40 @@ #include "wlanrun.h" class WLanNetNode; class WLanEdit; class AWLan : public ANetNodeInstance { public : AWLan( WLanNetNode * PNN ); QWidget * edit( QWidget * parent ); QString acceptable( void ); void commit( void ); RuntimeInfo * runtime( void ) { if( RT == 0 ) RT = new WLanRun( this, Data ); return RT; } virtual void * data( void ) { return (void *)&Data; } + bool generateDeviceDataForCommonFile( SystemFile & S, long DevNr ); + protected : virtual void setSpecificAttribute( QString & Attr, QString & Value ); virtual void saveSpecificAttribute( QTextStream & TS ); private : WLanEdit * GUI; WLanData Data; WLanRun * RT; }; #endif diff --git a/noncore/settings/networksettings2/wlan/wlanrun.h b/noncore/settings/networksettings2/wlan/wlanrun.h index 4cbb059..b853262 100644 --- a/noncore/settings/networksettings2/wlan/wlanrun.h +++ b/noncore/settings/networksettings2/wlan/wlanrun.h @@ -1,42 +1,44 @@ #ifndef WLANRUN_H #define WLANRUN_H #include <qregexp.h> #include <asdevice.h> #include "wlandata.h" class WLanRun : public AsDevice { public : WLanRun( ANetNodeInstance * NNI, WLanData & Data ) : AsDevice( NNI ), Pat( "wlan[0-9]" ) { } virtual long count( void ) { return 2; } virtual QString genNic( long nr ) { QString S; return S.sprintf( "wlan%ld", nr ); } virtual AsDevice * device( void ) - { return asDevice(); } + { return (AsDevice *)this; } + virtual AsDevice * asDevice( void ) + { return (AsDevice *)this; } protected : void detectState( NodeCollection * ) { } bool setState( NodeCollection *, Action_t ) { return 0; } bool canSetState( State_t, Action_t ) { return 0; } bool handlesInterface( const QString & I ); private : QRegExp Pat; }; #endif |