author | wimpie <wimpie> | 2004-04-05 22:58:06 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2004-04-05 22:58:06 (UTC) |
commit | 9aeac7cefc3c8baf32944e7275b57e0a0cde1515 (patch) (unidiff) | |
tree | dc8161657d98d0e97d5f29554cb35d9b57202c49 /noncore/settings/networksettings2/lancard | |
parent | 1d958f56a9e1357c20e76d763579d4dc184978e0 (diff) | |
download | opie-9aeac7cefc3c8baf32944e7275b57e0a0cde1515.zip opie-9aeac7cefc3c8baf32944e7275b57e0a0cde1515.tar.gz opie-9aeac7cefc3c8baf32944e7275b57e0a0cde1515.tar.bz2 |
Add save of node specific config data
Diffstat (limited to 'noncore/settings/networksettings2/lancard') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/lancard/lancard_NN.cpp | 13 | ||||
-rw-r--r-- | noncore/settings/networksettings2/lancard/lancard_NN.h | 8 |
2 files changed, 20 insertions, 1 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,34 +1,35 @@ | |||
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 | } |
@@ -44,29 +45,41 @@ bool LanCardNetNode::generateProperFilesFor( | |||
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 | } |
diff --git a/noncore/settings/networksettings2/lancard/lancard_NN.h b/noncore/settings/networksettings2/lancard/lancard_NN.h index dcdd0da..5f2b25d 100644 --- a/noncore/settings/networksettings2/lancard/lancard_NN.h +++ b/noncore/settings/networksettings2/lancard/lancard_NN.h | |||
@@ -12,38 +12,44 @@ class LanCardNetNode : public ANetNode{ | |||
12 | public: | 12 | public: |
13 | 13 | ||
14 | LanCardNetNode(); | 14 | LanCardNetNode(); |
15 | virtual ~LanCardNetNode(); | 15 | virtual ~LanCardNetNode(); |
16 | 16 | ||
17 | virtual const QString pixmapName() | 17 | virtual const QString pixmapName() |
18 | { return "Devices/card"; } | 18 | { return "Devices/card"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | 20 | virtual const QString nodeName() |
21 | { return tr("LAN card"); } | 21 | { return tr("LAN card"); } |
22 | 22 | ||
23 | virtual const QString nodeDescription() ; | 23 | virtual const QString nodeDescription() ; |
24 | 24 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 25 | virtual ANetNodeInstance * createInstance( void ); |
26 | 26 | ||
27 | virtual const char ** needs( void ); | 27 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 28 | virtual const char * provides( void ); |
29 | 29 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | virtual bool hasDataFor( const QString & S ); | 31 | virtual bool hasDataFor( const QString & S ); |
32 | virtual bool generateDeviceDataForCommonFile( | 32 | virtual bool generateDeviceDataForCommonFile( |
33 | SystemFile & SF, long DevNr ); | 33 | SystemFile & SF, long DevNr ); |
34 | 34 | ||
35 | virtual long instanceCount( void ) | 35 | virtual long instanceCount( void ) |
36 | { return 2; } | 36 | { return InstanceCount; } |
37 | 37 | ||
38 | virtual QString genNic( long ); | 38 | virtual QString genNic( long ); |
39 | 39 | ||
40 | private: | 40 | private: |
41 | 41 | ||
42 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | ||
43 | virtual void saveSpecificAttribute( QTextStream & TS ); | ||
44 | |||
45 | // number of interfaces for this device | ||
46 | long InstanceCount; | ||
47 | |||
42 | }; | 48 | }; |
43 | 49 | ||
44 | extern "C" | 50 | extern "C" |
45 | { | 51 | { |
46 | void create_plugin( QList<ANetNode> & PNN ); | 52 | void create_plugin( QList<ANetNode> & PNN ); |
47 | }; | 53 | }; |
48 | 54 | ||
49 | #endif | 55 | #endif |