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.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/noncore/settings/networksettings2/lancard/lancard_NN.cpp b/noncore/settings/networksettings2/lancard/lancard_NN.cpp index 480ddf9..ba1c1f8 100644 --- a/noncore/settings/networksettings2/lancard/lancard_NN.cpp +++ b/noncore/settings/networksettings2/lancard/lancard_NN.cpp | |||
@@ -1,72 +1,85 @@ | |||
1 | #include "lancard_NN.h" | 1 | #include "lancard_NN.h" |
2 | #include "lancard_NNI.h" | 2 | #include "lancard_NNI.h" |
3 | 3 | ||
4 | static const char * LanCardNeeds[] = | 4 | static const char * LanCardNeeds[] = |
5 | { 0 }; | 5 | { 0 }; |
6 | 6 | ||
7 | /** | 7 | /** |
8 | * Constructor, find all of the possible interfaces | 8 | * Constructor, find all of the possible interfaces |
9 | */ | 9 | */ |
10 | LanCardNetNode::LanCardNetNode() : ANetNode() { | 10 | LanCardNetNode::LanCardNetNode() : ANetNode() { |
11 | InstanceCount = 2; | ||
11 | } | 12 | } |
12 | 13 | ||
13 | /** | 14 | /** |
14 | * Delete any interfaces that we own. | 15 | * Delete any interfaces that we own. |
15 | */ | 16 | */ |
16 | LanCardNetNode::~LanCardNetNode(){ | 17 | LanCardNetNode::~LanCardNetNode(){ |
17 | } | 18 | } |
18 | 19 | ||
19 | const QString LanCardNetNode::nodeDescription(){ | 20 | const QString LanCardNetNode::nodeDescription(){ |
20 | return tr("\ | 21 | return tr("\ |
21 | <p>Sets up a wired regular LAN card.</p>\ | 22 | <p>Sets up a wired regular LAN card.</p>\ |
22 | <p>Use this to set up 10/100/1000 MBit LAN cards.</p>\ | 23 | <p>Use this to set up 10/100/1000 MBit LAN cards.</p>\ |
23 | " | 24 | " |
24 | ); | 25 | ); |
25 | } | 26 | } |
26 | 27 | ||
27 | ANetNodeInstance * LanCardNetNode::createInstance( void ) { | 28 | ANetNodeInstance * LanCardNetNode::createInstance( void ) { |
28 | return new ALanCard( this ); | 29 | return new ALanCard( this ); |
29 | } | 30 | } |
30 | 31 | ||
31 | 32 | ||
32 | const char ** LanCardNetNode::needs( void ) { | 33 | const char ** LanCardNetNode::needs( void ) { |
33 | return LanCardNeeds; | 34 | return LanCardNeeds; |
34 | } | 35 | } |
35 | 36 | ||
36 | const char * LanCardNetNode::provides( void ) { | 37 | const char * LanCardNetNode::provides( void ) { |
37 | return "device"; | 38 | return "device"; |
38 | } | 39 | } |
39 | 40 | ||
40 | bool LanCardNetNode::generateProperFilesFor( | 41 | bool LanCardNetNode::generateProperFilesFor( |
41 | ANetNodeInstance * ) { | 42 | ANetNodeInstance * ) { |
42 | return 1; | 43 | return 1; |
43 | } | 44 | } |
44 | 45 | ||
45 | bool LanCardNetNode::hasDataFor( const QString & S ) { | 46 | bool LanCardNetNode::hasDataFor( const QString & S ) { |
46 | return S == "interfaces"; | 47 | return S == "interfaces"; |
47 | } | 48 | } |
48 | 49 | ||
49 | bool LanCardNetNode::generateDeviceDataForCommonFile( | 50 | bool LanCardNetNode::generateDeviceDataForCommonFile( |
50 | SystemFile & S , | 51 | SystemFile & S , |
51 | long DevNr ) { | 52 | long DevNr ) { |
52 | QString NIC = genNic( DevNr ); | 53 | QString NIC = genNic( DevNr ); |
53 | 54 | ||
54 | if( S.name() == "interfaces" ) { | 55 | if( S.name() == "interfaces" ) { |
55 | // generate mapping stanza for this interface | 56 | // generate mapping stanza for this interface |
56 | S << "# check if " << NIC << " can be brought UP" << endl; | 57 | S << "# check if " << NIC << " can be brought UP" << endl; |
57 | S << "mapping " << NIC << endl; | 58 | S << "mapping " << NIC << endl; |
58 | S << " script networksettings2-request" << endl << endl; | 59 | S << " script networksettings2-request" << endl << endl; |
59 | } | 60 | } |
60 | return 0; | 61 | return 0; |
61 | } | 62 | } |
62 | 63 | ||
63 | QString LanCardNetNode::genNic( long nr ) { | 64 | QString LanCardNetNode::genNic( long nr ) { |
64 | QString S; | 65 | QString S; |
65 | return S.sprintf( "eth%ld", nr ); | 66 | return S.sprintf( "eth%ld", nr ); |
66 | } | 67 | } |
67 | 68 | ||
69 | void LanCardNetNode::setSpecificAttribute( QString & A, QString & V ) { | ||
70 | if( A == "interfacecount" ) { | ||
71 | InstanceCount = V.toLong(); | ||
72 | } | ||
73 | } | ||
74 | |||
75 | void LanCardNetNode::saveSpecificAttribute( QTextStream & TS) { | ||
76 | TS << "interfacecount=" | ||
77 | << InstanceCount | ||
78 | << endl; | ||
79 | } | ||
80 | |||
68 | extern "C" { | 81 | extern "C" { |
69 | void create_plugin( QList<ANetNode> & PNN ) { | 82 | void create_plugin( QList<ANetNode> & PNN ) { |
70 | PNN.append( new LanCardNetNode() ); | 83 | PNN.append( new LanCardNetNode() ); |
71 | } | 84 | } |
72 | } | 85 | } |