Diffstat (limited to 'noncore/settings/networksettings2/wlan') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/wlan/wlan_NN.cpp | 23 | ||||
-rw-r--r-- | noncore/settings/networksettings2/wlan/wlan_NN.h | 9 | ||||
-rw-r--r-- | noncore/settings/networksettings2/wlan/wlan_NNI.cpp | 35 | ||||
-rw-r--r-- | noncore/settings/networksettings2/wlan/wlan_NNI.h | 20 |
4 files changed, 33 insertions, 54 deletions
diff --git a/noncore/settings/networksettings2/wlan/wlan_NN.cpp b/noncore/settings/networksettings2/wlan/wlan_NN.cpp index ce8a734..e4c3f60 100644 --- a/noncore/settings/networksettings2/wlan/wlan_NN.cpp +++ b/noncore/settings/networksettings2/wlan/wlan_NN.cpp @@ -35,35 +35,12 @@ const char ** WLanNetNode::needs( void ) { } const char * WLanNetNode::provides( void ) { return "device"; } -bool WLanNetNode::generateProperFilesFor( - ANetNodeInstance * ) { - return 0; -} - -bool WLanNetNode::hasDataFor( const QString & S ) { - return S == "interfaces"; -} - -bool WLanNetNode::generateDeviceDataForCommonFile( - SystemFile & S, - long DevNr ) { - QString NIC = 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; -} - QString WLanNetNode::genNic( long nr ) { QString S; return S.sprintf( "wlan%ld", nr ); } void WLanNetNode::setSpecificAttribute( QString & A, QString & V ) { diff --git a/noncore/settings/networksettings2/wlan/wlan_NN.h b/noncore/settings/networksettings2/wlan/wlan_NN.h index b5ff3fd..c13c05c 100644 --- a/noncore/settings/networksettings2/wlan/wlan_NN.h +++ b/noncore/settings/networksettings2/wlan/wlan_NN.h @@ -15,27 +15,18 @@ public: virtual ~WLanNetNode(); virtual const QString pixmapName() { return "Devices/wlan"; } 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 generateDeviceDataForCommonFile( - SystemFile & SF, long DevNr ); - virtual long instanceCount( void ) { return InstanceCount; } - virtual QString genNic( long ); private: virtual void setSpecificAttribute( QString & Attr, QString & Value ); virtual void saveSpecificAttribute( QTextStream & TS ); diff --git a/noncore/settings/networksettings2/wlan/wlan_NNI.cpp b/noncore/settings/networksettings2/wlan/wlan_NNI.cpp index 61969f2..0e4fc4c 100644 --- a/noncore/settings/networksettings2/wlan/wlan_NNI.cpp +++ b/noncore/settings/networksettings2/wlan/wlan_NNI.cpp @@ -76,65 +76,76 @@ QString AWLan::acceptable( void ) { void AWLan::commit( void ) { if( GUI && GUI->commit( Data ) ) setModified( 1 ); } -bool AWLan::generateDataForCommonFile( - SystemFile & S, - long ) { +short AWLan::generateFileEmbedded( const QString & ID, + const QString & Path, + QTextStream & TS, + long DevNr ) { - S << " wireless_essid \"" + short rvl, rvd; + + rvl = 1; + + if( ID == "interfaces" ) { + Log(("Generate WLanNNI for %s\n", ID.latin1() )); + TS << " wireless_essid \"" << Data.ESSID << "\"" << endl; if( ! Data.NodeName.isEmpty() ) { if( Data.NodeName == tr("<UseHostName>") ) { char Buf[100]; if( gethostname(Buf, sizeof(Buf) ) == 0 ) { Buf[99] = '\0'; // just to make sure - S << " wireless_nick " + TS << " wireless_nick " << Buf << endl; } } else { - S << " wireless_nick \"" + TS << " wireless_nick \"" << Data.NodeName << "\"" << endl; } } - char * M; + char * M = "Auto"; switch ( Data.Mode ) { case 0 : - M = "Auto"; break; case 1 : M = "Managed"; break; case 2 : M = "Ad-Hoc"; break; } - S << " wireless_mode " + TS << " wireless_mode " << M << endl; if( Data.Encrypted ) { for( int i = 0; i < 4; i ++ ) { if( ! Data.Key[i].isEmpty() ) { - S << " wireless_key" + TS << " wireless_key" << i << " " << Data.Key[i] << endl; } } - S << " wireless_keymode " + TS << " wireless_keymode " << ((Data.AcceptNonEncrypted) ? "open" : "restricted") << endl; } - return 0; + rvl = 0; + } + rvd = ANetNodeInstance::generateFileEmbedded( ID, Path, TS, DevNr); + + return (rvd == 2 || rvl == 2 ) ? 2 : + (rvd == 0 || rvl == 0 ) ? 0 : 1; } diff --git a/noncore/settings/networksettings2/wlan/wlan_NNI.h b/noncore/settings/networksettings2/wlan/wlan_NNI.h index 2211c47..a9be65f 100644 --- a/noncore/settings/networksettings2/wlan/wlan_NNI.h +++ b/noncore/settings/networksettings2/wlan/wlan_NNI.h @@ -11,29 +11,29 @@ class WLanEdit; class AWLan : public ANetNodeInstance { public : AWLan( WLanNetNode * PNN ); + RuntimeInfo * runtime( void ) + { return + ( RT ) ? RT : ( RT = new WLanRun( this, Data ) ); + } + 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; } - virtual bool hasDataFor( const QString & ) - { return 1; } - virtual bool generateDataForCommonFile( - SystemFile & SF, long DevNr ); + virtual short generateFileEmbedded( const QString & ID, + const QString & Path, + QTextStream & TS, + long DevNr ); + protected : virtual void setSpecificAttribute( QString & Attr, QString & Value ); virtual void saveSpecificAttribute( QTextStream & TS ); private : |