summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/network/network_NN.cpp
Unidiff
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.cpp40
1 files changed, 26 insertions, 14 deletions
diff --git a/noncore/settings/networksettings2/network/network_NN.cpp b/noncore/settings/networksettings2/network/network_NN.cpp
index b5c41bf..23b3d44 100644
--- a/noncore/settings/networksettings2/network/network_NN.cpp
+++ b/noncore/settings/networksettings2/network/network_NN.cpp
@@ -1,84 +1,96 @@
1#include <qpe/qpeapplication.h> 1#include <qpe/qpeapplication.h>
2#include <asdevice.h> 2#include <resources.h>
3#include <netnode.h>
3#include "network_NN.h" 4#include "network_NN.h"
4#include "network_NNI.h" 5#include "network_NNI.h"
5 6
6static const char * NetworkNeeds[] = 7static const char * NetworkNeeds[] =
7 { "device", 8 { "device",
8 0 9 0
9 }; 10 };
10 11
12static const char * NetworkProvides[] =
13 { "connection",
14 0
15 };
16
11/** 17/**
12 * Constructor, find all of the possible interfaces 18 * Constructor, find all of the possible interfaces
13 */ 19 */
14NetworkNetNode::NetworkNetNode() : ANetNode(tr("IP Configuration")) { 20NetworkNetNode::NetworkNetNode() : ANetNode(tr("IP Configuration")) {
21
22 NSResources->addSystemFile(
23 "interfaces", "/etc/network/interfaces", 1 );
15} 24}
16 25
17/** 26/**
18 * Delete any interfaces that we own. 27 * Delete any interfaces that we own.
19 */ 28 */
20NetworkNetNode::~NetworkNetNode(){ 29NetworkNetNode::~NetworkNetNode(){
21} 30}
22 31
23const QString NetworkNetNode::nodeDescription(){ 32const QString NetworkNetNode::nodeDescription(){
24 return tr("\ 33 return tr("\
25<p>Sets up TCP/IP options.</p>\ 34<p>Sets up TCP/IP options.</p>\
26<p>Use this to configure the TCP/IP protocol</p>\ 35<p>Use this to configure the TCP/IP protocol</p>\
27" 36"
28); 37);
29} 38}
30 39
31ANetNodeInstance * NetworkNetNode::createInstance( void ) { 40ANetNodeInstance * NetworkNetNode::createInstance( void ) {
32 return new ANetwork( this ); 41 return new ANetwork( this );
33} 42}
34 43
35bool NetworkNetNode::hasDataForFile( const QString & S ) { 44bool NetworkNetNode::hasDataForFile( SystemFile & S ) {
36 return S == "interfaces"; 45 return S.name() == "interfaces";
37} 46}
38 47
39short NetworkNetNode::generateFile( const QString & ID, 48short NetworkNetNode::generateFile( SystemFile & SF,
40 const QString & ,
41 QTextStream & TS,
42 ANetNodeInstance * NNI, 49 ANetNodeInstance * NNI,
43 long DevNr ) { 50 long DevNr ) {
44 51
52 if( DevNr < 0 ) {
53 // generate device specific but common part
54 return 1;
55 }
56
45 QString NIC = NNI->runtime()->device()->netNode()->nodeClass()->genNic( DevNr ); 57 QString NIC = NNI->runtime()->device()->netNode()->nodeClass()->genNic( DevNr );
46 58
47 if( ID == "interfaces" ) { 59 if( SF.name() == "interfaces" ) {
48 Log(("Generate entry for %s in %s\n", NIC.latin1(), ID.latin1() )); 60 Log(("Generate entry for %s in %s\n", NIC.latin1(), SF.name().latin1() ));
49 // generate mapping stanza for this interface 61 // generate mapping stanza for this interface
50 TS << "# check if " 62 SF << "# check if "
51 << NIC 63 << NIC
52 << " can be brought UP" 64 << " can be brought UP"
53 << endl; 65 << endl;
54 TS << "mapping " 66 SF << "mapping "
55 << NIC 67 << NIC
56 << endl; 68 << endl;
57 TS << " script " 69 SF << " script "
58 << QPEApplication::qpeDir() 70 << QPEApplication::qpeDir()
59 << "/bin/networksettings2-request" 71 << "bin/networksettings2-request"
60 << endl 72 << endl
61 << endl; 73 << endl;
62 return 0; 74 return 0;
63 } 75 }
64 return 1; 76 return 1;
65} 77}
66 78
67const char ** NetworkNetNode::needs( void ) { 79const char ** NetworkNetNode::needs( void ) {
68 return NetworkNeeds; 80 return NetworkNeeds;
69} 81}
70 82
71const char * NetworkNetNode::provides( void ) { 83const char ** NetworkNetNode::provides( void ) {
72 return "connection"; 84 return NetworkProvides;
73} 85}
74 86
75void NetworkNetNode::setSpecificAttribute( QString & , QString & ) { 87void NetworkNetNode::setSpecificAttribute( QString & , QString & ) {
76} 88}
77 89
78void NetworkNetNode::saveSpecificAttribute( QTextStream & ) { 90void NetworkNetNode::saveSpecificAttribute( QTextStream & ) {
79} 91}
80 92
81extern "C" { 93extern "C" {
82void create_plugin( QList<ANetNode> & PNN ) { 94void create_plugin( QList<ANetNode> & PNN ) {
83 PNN.append( new NetworkNetNode() ); 95 PNN.append( new NetworkNetNode() );
84} 96}