Diffstat (limited to 'noncore/settings/networksettings2/network/network_NN.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/network/network_NN.cpp | 42 |
1 files changed, 31 insertions, 11 deletions
diff --git a/noncore/settings/networksettings2/network/network_NN.cpp b/noncore/settings/networksettings2/network/network_NN.cpp index b4313c4..1feffdb 100644 --- a/noncore/settings/networksettings2/network/network_NN.cpp +++ b/noncore/settings/networksettings2/network/network_NN.cpp | |||
@@ -1,12 +1,13 @@ | |||
1 | #include <asdevice.h> | ||
1 | #include "network_NN.h" | 2 | #include "network_NN.h" |
2 | #include "network_NNI.h" | 3 | #include "network_NNI.h" |
3 | 4 | ||
4 | static const char * NetworkNeeds[] = | 5 | static const char * NetworkNeeds[] = |
5 | { "device", | 6 | { "device", |
6 | 0 | 7 | 0 |
7 | }; | 8 | }; |
8 | 9 | ||
9 | /** | 10 | /** |
10 | * Constructor, find all of the possible interfaces | 11 | * Constructor, find all of the possible interfaces |
11 | */ | 12 | */ |
12 | NetworkNetNode::NetworkNetNode() : ANetNode(tr("IP Configuration")) { | 13 | NetworkNetNode::NetworkNetNode() : ANetNode(tr("IP Configuration")) { |
@@ -21,41 +22,60 @@ NetworkNetNode::~NetworkNetNode(){ | |||
21 | const QString NetworkNetNode::nodeDescription(){ | 22 | const QString NetworkNetNode::nodeDescription(){ |
22 | return tr("\ | 23 | return tr("\ |
23 | <p>Sets up TCP/IP options.</p>\ | 24 | <p>Sets up TCP/IP options.</p>\ |
24 | <p>Use this to configure the TCP/IP protocol</p>\ | 25 | <p>Use this to configure the TCP/IP protocol</p>\ |
25 | " | 26 | " |
26 | ); | 27 | ); |
27 | } | 28 | } |
28 | 29 | ||
29 | ANetNodeInstance * NetworkNetNode::createInstance( void ) { | 30 | ANetNodeInstance * NetworkNetNode::createInstance( void ) { |
30 | return new ANetwork( this ); | 31 | return new ANetwork( this ); |
31 | } | 32 | } |
32 | 33 | ||
33 | const char ** NetworkNetNode::needs( void ) { | 34 | bool NetworkNetNode::hasDataForFile( const QString & S ) { |
34 | return NetworkNeeds; | 35 | return S == "interfaces"; |
35 | } | 36 | } |
36 | 37 | ||
37 | const char * NetworkNetNode::provides( void ) { | 38 | short NetworkNetNode::generateFile( const QString & ID, |
38 | return "connection"; | 39 | const QString & , |
40 | QTextStream & TS, | ||
41 | ANetNodeInstance * NNI, | ||
42 | long DevNr ) { | ||
43 | |||
44 | QString NIC = NNI->runtime()->device()->netNode()->nodeClass()->genNic( DevNr ); | ||
45 | |||
46 | if( ID == "interfaces" ) { | ||
47 | Log(("Generate entry for %s in %s\n", NIC.latin1(), ID.latin1() )); | ||
48 | // generate mapping stanza for this interface | ||
49 | TS << "# check if " | ||
50 | << NIC | ||
51 | << " can be brought UP" | ||
52 | << endl; | ||
53 | TS << "mapping " | ||
54 | << NIC | ||
55 | << endl; | ||
56 | TS << " script networksettings2-request" | ||
57 | << endl | ||
58 | << endl; | ||
59 | return 0; | ||
60 | } | ||
61 | return 1; | ||
39 | } | 62 | } |
40 | 63 | ||
41 | bool NetworkNetNode::generateProperFilesFor( | 64 | const char ** NetworkNetNode::needs( void ) { |
42 | ANetNodeInstance * ) { | 65 | return NetworkNeeds; |
43 | return 0; | ||
44 | } | 66 | } |
45 | 67 | ||
46 | bool NetworkNetNode::generateDeviceDataForCommonFile( | 68 | const char * NetworkNetNode::provides( void ) { |
47 | SystemFile & , | 69 | return "connection"; |
48 | long ) { | ||
49 | return 0; | ||
50 | } | 70 | } |
51 | 71 | ||
52 | void NetworkNetNode::setSpecificAttribute( QString & , QString & ) { | 72 | void NetworkNetNode::setSpecificAttribute( QString & , QString & ) { |
53 | } | 73 | } |
54 | 74 | ||
55 | void NetworkNetNode::saveSpecificAttribute( QTextStream & ) { | 75 | void NetworkNetNode::saveSpecificAttribute( QTextStream & ) { |
56 | } | 76 | } |
57 | 77 | ||
58 | extern "C" { | 78 | extern "C" { |
59 | void create_plugin( QList<ANetNode> & PNN ) { | 79 | void create_plugin( QList<ANetNode> & PNN ) { |
60 | PNN.append( new NetworkNetNode() ); | 80 | PNN.append( new NetworkNetNode() ); |
61 | } | 81 | } |