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,5 +1,6 @@
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
@@ -8,10 +9,18 @@ static const char * NetworkNeeds[] =
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/**
@@ -32,31 +41,34 @@ ANetNodeInstance * 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;
@@ -68,8 +80,8 @@ const 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 & ) {