summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/lancard/lancard_NN.cpp
Side-by-side diff
Diffstat (limited to 'noncore/settings/networksettings2/lancard/lancard_NN.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/lancard/lancard_NN.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/noncore/settings/networksettings2/lancard/lancard_NN.cpp b/noncore/settings/networksettings2/lancard/lancard_NN.cpp
index ba1c1f8..a4afab1 100644
--- a/noncore/settings/networksettings2/lancard/lancard_NN.cpp
+++ b/noncore/settings/networksettings2/lancard/lancard_NN.cpp
@@ -1,34 +1,34 @@
#include "lancard_NN.h"
#include "lancard_NNI.h"
static const char * LanCardNeeds[] =
{ 0 };
/**
* Constructor, find all of the possible interfaces
*/
-LanCardNetNode::LanCardNetNode() : ANetNode() {
+LanCardNetNode::LanCardNetNode() : ANetNode(tr("LAN card")), NICMACAddresses() {
InstanceCount = 2;
}
/**
* Delete any interfaces that we own.
*/
LanCardNetNode::~LanCardNetNode(){
}
const QString LanCardNetNode::nodeDescription(){
return tr("\
<p>Sets up a wired regular LAN card.</p>\
<p>Use this to set up 10/100/1000 MBit LAN cards.</p>\
"
);
}
ANetNodeInstance * LanCardNetNode::createInstance( void ) {
return new ALanCard( this );
}
const char ** LanCardNetNode::needs( void ) {
return LanCardNeeds;
@@ -48,38 +48,47 @@ bool LanCardNetNode::hasDataFor( const QString & S ) {
}
bool LanCardNetNode::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 LanCardNetNode::genNic( long nr ) {
QString S;
return S.sprintf( "eth%ld", nr );
}
void LanCardNetNode::setSpecificAttribute( QString & A, QString & V ) {
if( A == "interfacecount" ) {
InstanceCount = V.toLong();
+ } else if ( A == "macaddress" ) {
+ NICMACAddresses.append( V );
}
}
void LanCardNetNode::saveSpecificAttribute( QTextStream & TS) {
TS << "interfacecount="
<< InstanceCount
<< endl;
+ for( QStringList::Iterator it = NICMACAddresses.begin();
+ it != NICMACAddresses.end();
+ ++it ) {
+ TS << "macaddress="
+ << (*it)
+ << endl;
+ }
}
extern "C" {
void create_plugin( QList<ANetNode> & PNN ) {
PNN.append( new LanCardNetNode() );
}
}