author | wimpie <wimpie> | 2004-08-12 12:46:55 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2004-08-12 12:46:55 (UTC) |
commit | 8f215ba9ceb395f262517855a99d7d2d303ca760 (patch) (side-by-side diff) | |
tree | aa5f9b14c249217b4d3fc30f4771bdaf1c3545d3 /noncore/settings/networksettings2/wlan | |
parent | ef64880308b5035cc8ca2e4e79325db613af525b (diff) | |
download | opie-8f215ba9ceb395f262517855a99d7d2d303ca760.zip opie-8f215ba9ceb395f262517855a99d7d2d303ca760.tar.gz opie-8f215ba9ceb395f262517855a99d7d2d303ca760.tar.bz2 |
MANY changes
- now generates peers/pap-chap secrets files
(no chatscript yet)
(not all usefull ppp options included yet)
- still not ready for prime time yet
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 @@ -29,47 +29,24 @@ const QString WLanNetNode::nodeDescription(){ 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 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 ) { if( A == "interfacecount" ) { InstanceCount = V.toLong(); } } void WLanNetNode::saveSpecificAttribute( QTextStream & TS ) { 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 @@ -9,39 +9,30 @@ class WLanNetNode : public ANetNode{ Q_OBJECT public: WLanNetNode(); 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 ); // number of interfaces for this device long InstanceCount; }; 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 @@ -70,71 +70,82 @@ QWidget * AWLan::edit( QWidget * parent ) { return GUI; } QString AWLan::acceptable( void ) { return ( GUI ) ? GUI->acceptable( ) : QString(); } 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 @@ -5,41 +5,41 @@ #include "wlandata.h" #include "wlanrun.h" class WLanNetNode; 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 : WLanEdit * GUI; WLanData Data; WLanRun * RT; }; |