Diffstat (limited to 'noncore/settings/networksettings2/wlan/wlan_NN.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/wlan/wlan_NN.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/noncore/settings/networksettings2/wlan/wlan_NN.cpp b/noncore/settings/networksettings2/wlan/wlan_NN.cpp index 4e59ac1..e0c4db2 100644 --- a/noncore/settings/networksettings2/wlan/wlan_NN.cpp +++ b/noncore/settings/networksettings2/wlan/wlan_NN.cpp | |||
@@ -1,72 +1,85 @@ | |||
1 | #include "wlan_NN.h" | 1 | #include "wlan_NN.h" |
2 | #include "wlan_NNI.h" | 2 | #include "wlan_NNI.h" |
3 | 3 | ||
4 | static const char * WLanNeeds[] = | 4 | static const char * WLanNeeds[] = |
5 | { 0 | 5 | { 0 |
6 | }; | 6 | }; |
7 | 7 | ||
8 | /** | 8 | /** |
9 | * Constructor, find all of the possible interfaces | 9 | * Constructor, find all of the possible interfaces |
10 | */ | 10 | */ |
11 | WLanNetNode::WLanNetNode() : ANetNode() { | 11 | WLanNetNode::WLanNetNode() : ANetNode() { |
12 | InstanceCount = 2; | ||
12 | } | 13 | } |
13 | 14 | ||
14 | /** | 15 | /** |
15 | * Delete any interfaces that we own. | 16 | * Delete any interfaces that we own. |
16 | */ | 17 | */ |
17 | WLanNetNode::~WLanNetNode(){ | 18 | WLanNetNode::~WLanNetNode(){ |
18 | } | 19 | } |
19 | 20 | ||
20 | const QString WLanNetNode::nodeDescription(){ | 21 | const QString WLanNetNode::nodeDescription(){ |
21 | return tr("\ | 22 | return tr("\ |
22 | <p>Configure Wi/Fi or WLan network cards.</p>\ | 23 | <p>Configure Wi/Fi or WLan network cards.</p>\ |
23 | <p>Defines Wireless options for those cards</p>\ | 24 | <p>Defines Wireless options for those cards</p>\ |
24 | " | 25 | " |
25 | ); | 26 | ); |
26 | } | 27 | } |
27 | 28 | ||
28 | ANetNodeInstance * WLanNetNode::createInstance( void ) { | 29 | ANetNodeInstance * WLanNetNode::createInstance( void ) { |
29 | return new AWLan( this ); | 30 | return new AWLan( this ); |
30 | } | 31 | } |
31 | 32 | ||
32 | const char ** WLanNetNode::needs( void ) { | 33 | const char ** WLanNetNode::needs( void ) { |
33 | return WLanNeeds; | 34 | return WLanNeeds; |
34 | } | 35 | } |
35 | 36 | ||
36 | const char * WLanNetNode::provides( void ) { | 37 | const char * WLanNetNode::provides( void ) { |
37 | return "device"; | 38 | return "device"; |
38 | } | 39 | } |
39 | 40 | ||
40 | bool WLanNetNode::generateProperFilesFor( | 41 | bool WLanNetNode::generateProperFilesFor( |
41 | ANetNodeInstance * ) { | 42 | ANetNodeInstance * ) { |
42 | return 1; | 43 | return 1; |
43 | } | 44 | } |
44 | 45 | ||
45 | bool WLanNetNode::hasDataFor( const QString & S ) { | 46 | bool WLanNetNode::hasDataFor( const QString & S ) { |
46 | return S == "interfaces"; | 47 | return S == "interfaces"; |
47 | } | 48 | } |
48 | 49 | ||
49 | bool WLanNetNode::generateDeviceDataForCommonFile( | 50 | bool WLanNetNode::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 WLanNetNode::genNic( long nr ) { | 64 | QString WLanNetNode::genNic( long nr ) { |
64 | QString S; | 65 | QString S; |
65 | return S.sprintf( "wlan%ld", nr ); | 66 | return S.sprintf( "wlan%ld", nr ); |
66 | } | 67 | } |
67 | 68 | ||
69 | void WLanNetNode::setSpecificAttribute( QString & A, QString & V ) { | ||
70 | if( A == "interfacecount" ) { | ||
71 | InstanceCount = V.toLong(); | ||
72 | } | ||
73 | } | ||
74 | |||
75 | void WLanNetNode::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 WLanNetNode() ); | 83 | PNN.append( new WLanNetNode() ); |
71 | } | 84 | } |
72 | } | 85 | } |