Diffstat (limited to 'noncore/settings/networksettings2/wlan') (more/less context) (ignore 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 | 107 | ||||
-rw-r--r-- | noncore/settings/networksettings2/wlan/wlan_NNI.h | 20 |
4 files changed, 69 insertions, 90 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 @@ -37,31 +37,8 @@ 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 ); } 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 @@ -17,23 +17,14 @@ public: 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: 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 @@ -78,63 +78,74 @@ 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 \"" - << Data.ESSID - << "\"" - << endl; + short rvl, rvd; - 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 " - << Buf - << endl; + 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 + TS << " wireless_nick " + << Buf + << endl; + } + } else { + TS << " wireless_nick \"" + << Data.NodeName + << "\"" + << endl; } - } else { - S << " wireless_nick \"" - << Data.NodeName - << "\"" - << endl; } - } - char * M; - switch ( Data.Mode ) { - case 0 : - M = "Auto"; - break; - case 1 : - M = "Managed"; - break; - case 2 : - M = "Ad-Hoc"; - break; - } + char * M = "Auto"; + switch ( Data.Mode ) { + case 0 : + break; + case 1 : + M = "Managed"; + break; + case 2 : + M = "Ad-Hoc"; + break; + } - S << " wireless_mode " - << M - << endl; - if( Data.Encrypted ) { - for( int i = 0; i < 4; i ++ ) { - if( ! Data.Key[i].isEmpty() ) { - S << " wireless_key" - << i - << " " - << Data.Key[i] - << endl; + TS << " wireless_mode " + << M + << endl; + if( Data.Encrypted ) { + for( int i = 0; i < 4; i ++ ) { + if( ! Data.Key[i].isEmpty() ) { + TS << " wireless_key" + << i + << " " + << Data.Key[i] + << endl; + } } + TS << " wireless_keymode " + << ((Data.AcceptNonEncrypted) ? "open" : "restricted") + << endl; } - S << " wireless_keymode " - << ((Data.AcceptNonEncrypted) ? "open" : "restricted") - << endl; + rvl = 0; } - return 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 @@ -13,25 +13,25 @@ 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 ); |