summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/network/network_NNI.cpp
Side-by-side diff
Diffstat (limited to 'noncore/settings/networksettings2/network/network_NNI.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/network/network_NNI.cpp50
1 files changed, 24 insertions, 26 deletions
diff --git a/noncore/settings/networksettings2/network/network_NNI.cpp b/noncore/settings/networksettings2/network/network_NNI.cpp
index 324c6e2..78e6545 100644
--- a/noncore/settings/networksettings2/network/network_NNI.cpp
+++ b/noncore/settings/networksettings2/network/network_NNI.cpp
@@ -1,26 +1,26 @@
#include <system.h>
-#include <asdevice.h>
+#include <netnode.h>
#include "networkedit.h"
#include "network_NNI.h"
#include "network_NN.h"
ANetwork::ANetwork( NetworkNetNode * PNN ) : ANetNodeInstance( PNN ) {
Data.UseDHCP = 1;
Data.IPAddress = "";
Data.NetMask = "";
Data.Broadcast = "";
Data.Gateway = "";
Data.DNS1 = "";
Data.DNS2 = "";
Data.SendHostname = 0;
Data.Hostname = "";
Data.PreUp_SL.clear();
Data.PreDown_SL.clear();
Data.PostUp_SL.clear();
Data.PostDown_SL.clear();
GUI = 0;
RT = 0;
}
void ANetwork::setSpecificAttribute( QString & A, QString & V ) {
if( A == "usedhcp" ) {
@@ -78,142 +78,140 @@ void ANetwork::saveSpecificAttribute( QTextStream & TS ) {
TS << "postup=" << quote(*it) << endl;
}
for ( QStringList::Iterator it = Data.PostDown_SL.begin();
it != Data.PostDown_SL.end();
++it ) {
TS << "postdown=" << quote(*it) << endl;
}
}
QWidget * ANetwork::edit( QWidget * parent ) {
GUI = new NetworkEdit( parent );
GUI->showData( Data );
return GUI;
}
QString ANetwork::acceptable( void ) {
return ( GUI ) ? GUI->acceptable( ) : QString();
}
void ANetwork::commit( void ) {
if( GUI && GUI->commit( Data ) )
setModified( 1 );
}
-bool ANetwork::hasDataForFile( const QString & S ) {
- return S == "interfaces";
+bool ANetwork::hasDataForFile( SystemFile & S ) {
+ return S.name() == "interfaces";
}
-short ANetwork::generateFile( const QString & ID,
- const QString & Path,
- QTextStream &TS,
- long DevNr
- ) {
+short ANetwork::generateFile( SystemFile &SF,
+ long DevNr
+ ) {
short rvl, rvd ;
QString NIC = runtime()->device()->netNode()->nodeClass()->genNic( DevNr );
rvl = 1;
- if( ID == "interfaces" ) {
- Log(("Generate Network for %s\n", ID.latin1() ));
+ if( SF.name() == "interfaces" ) {
+ Log(("Generate Network for %s\n", SF.name().latin1() ));
// we can safely call from here since device item is deeper
if( Data.UseDHCP ) {
- TS << "iface "
+ SF << "iface "
<< NIC
<< "-c"
<< connection()->number()
<< "-allowed inet dhcp"
<< endl;
- TS << " up echo \""
+ SF << " up echo \""
<< NIC
<< "\" > /tmp/profile-"
<< connection()->number()
<< ".up"
<< endl;
if( Data.SendHostname ) {
- TS << " hostname "
+ SF << " hostname "
<< Data.Hostname
<< endl;
}
- TS << " down rm -f /tmp/profile-"
+ SF << " down rm -f /tmp/profile-"
<< connection()->number()
<< ".up"
<< endl;
} else {
- TS << "iface "
+ SF << "iface "
<< NIC << "-c"
<< connection()->number()
<< "-allowed inet static"
<< endl;
- TS << " up echo \""
+ SF << " up echo \""
<< NIC
<< "\" > /tmp/profile-"
<< connection()->number()
<< ".up"
<< endl;
- TS << " down rm -f /tmp/profile-"
+ SF << " down rm -f /tmp/profile-"
<< connection()->number()
<< ".up"
<< endl;
- TS << " address "
+ SF << " address "
<< Data.IPAddress
<< endl;
- TS << " broadcast "
+ SF << " broadcast "
<< Data.Broadcast
<< endl;
- TS << " netmask "
+ SF << " netmask "
<< Data.NetMask
<< endl;
// derive network address = IPAddress & netmask
{ QString NW;
QStringList ipal = QStringList::split( '.', Data.IPAddress );
QStringList nmal = QStringList::split( '.', Data.NetMask );
NW = QString( "%1.%2.%3.%4" ).
arg( ipal[0].toShort() & nmal[0].toShort() ).
arg( ipal[1].toShort() & nmal[1].toShort() ).
arg( ipal[2].toShort() & nmal[2].toShort() ).
arg( ipal[3].toShort() & nmal[3].toShort() );
- TS << " network "
+ SF << " network "
<< NW
<< endl;
}
}
for ( QStringList::Iterator it = Data.PreUp_SL.begin();
it != Data.PreUp_SL.end();
++it ) {
- TS << " pre-up "
+ SF << " pre-up "
<< (*it)
<< endl;
}
for ( QStringList::Iterator it = Data.PostUp_SL.begin();
it != Data.PostUp_SL.end();
++it ) {
- TS << " up "
+ SF << " up "
<< (*it)
<< endl;
}
for ( QStringList::Iterator it = Data.PreDown_SL.begin();
it != Data.PreDown_SL.end();
++it ) {
- TS << " down "
+ SF << " down "
<< (*it)
<< endl;
}
for ( QStringList::Iterator it = Data.PostDown_SL.begin();
it != Data.PostDown_SL.end();
++it ) {
- TS << " post-down "
+ SF << " post-down "
<< (*it)
<< endl;
}
rvl = 0;
}
// embed other info in it
- rvd = connection()->getToplevel()->generateFileEmbedded( ID, Path, TS, DevNr );
+ rvd = connection()->getToplevel()->generateFileEmbedded( SF, DevNr );
return (rvd == 2 || rvl == 2 ) ? 2 :
(rvd == 0 || rvl == 0 ) ? 0 : 1;
}