summaryrefslogtreecommitdiff
authorwimpie <wimpie>2004-04-04 11:42:05 (UTC)
committer wimpie <wimpie>2004-04-04 11:42:05 (UTC)
commit8d2d2664e5f544b8292806e617deb7a0e4170dc0 (patch) (unidiff)
tree3e3764f82d52f8c32b0ed9d92c13ec483dc34114
parent321f82bb3d43cbab358434fef52fe76f17e7d1e3 (diff)
downloadopie-8d2d2664e5f544b8292806e617deb7a0e4170dc0.zip
opie-8d2d2664e5f544b8292806e617deb7a0e4170dc0.tar.gz
opie-8d2d2664e5f544b8292806e617deb7a0e4170dc0.tar.bz2
Error in generation of files
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h4
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h3
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp13
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetooth_NN.h8
-rw-r--r--noncore/settings/networksettings2/cable/cable_NN.cpp9
-rw-r--r--noncore/settings/networksettings2/cable/cable_NN.h4
-rw-r--r--noncore/settings/networksettings2/cable/cablerun.h3
-rw-r--r--noncore/settings/networksettings2/irda/irda_NN.cpp9
-rw-r--r--noncore/settings/networksettings2/irda/irda_NN.h4
-rw-r--r--noncore/settings/networksettings2/irda/irdarun.h3
-rw-r--r--noncore/settings/networksettings2/lancard/lancard_NN.cpp11
-rw-r--r--noncore/settings/networksettings2/lancard/lancard_NN.h4
-rw-r--r--noncore/settings/networksettings2/lancard/lancard_NNI.cpp14
-rw-r--r--noncore/settings/networksettings2/lancard/lancard_NNI.h2
-rw-r--r--noncore/settings/networksettings2/lancard/lancardrun.cpp14
-rw-r--r--noncore/settings/networksettings2/lancard/lancardrun.h6
-rw-r--r--noncore/settings/networksettings2/modem/modem_NN.cpp9
-rw-r--r--noncore/settings/networksettings2/modem/modem_NN.h4
-rw-r--r--noncore/settings/networksettings2/modem/modemrun.h3
-rw-r--r--noncore/settings/networksettings2/network/network_NN.cpp11
-rw-r--r--noncore/settings/networksettings2/network/network_NN.h4
-rw-r--r--noncore/settings/networksettings2/network/network_NNI.cpp5
-rw-r--r--noncore/settings/networksettings2/network/networkedit.cpp6
-rw-r--r--noncore/settings/networksettings2/network/networkrun.cpp10
-rw-r--r--noncore/settings/networksettings2/network/networkrun.h3
-rw-r--r--noncore/settings/networksettings2/networksettings.cpp86
-rw-r--r--noncore/settings/networksettings2/networksettings2/netnode.h23
-rw-r--r--noncore/settings/networksettings2/networksettings2/system.cpp5
-rw-r--r--noncore/settings/networksettings2/networksettings2/systemfile.cpp49
-rw-r--r--noncore/settings/networksettings2/networksettings2/systemfile.h6
-rw-r--r--noncore/settings/networksettings2/nsdata.cpp206
-rw-r--r--noncore/settings/networksettings2/ppp/ppp_NN.cpp9
-rw-r--r--noncore/settings/networksettings2/ppp/ppp_NN.h4
-rw-r--r--noncore/settings/networksettings2/ppp/ppprun.cpp10
-rw-r--r--noncore/settings/networksettings2/ppp/ppprun.h8
-rw-r--r--noncore/settings/networksettings2/profile/profile_NN.cpp9
-rw-r--r--noncore/settings/networksettings2/profile/profile_NN.h4
-rw-r--r--noncore/settings/networksettings2/profile/profilerun.cpp22
-rw-r--r--noncore/settings/networksettings2/profile/profilerun.h3
-rw-r--r--noncore/settings/networksettings2/usb/usb_NN.cpp9
-rw-r--r--noncore/settings/networksettings2/usb/usb_NN.h4
-rw-r--r--noncore/settings/networksettings2/usb/usb_NNI.cpp11
-rw-r--r--noncore/settings/networksettings2/usb/usb_NNI.h1
-rw-r--r--noncore/settings/networksettings2/usb/usbrun.cpp29
-rw-r--r--noncore/settings/networksettings2/usb/usbrun.h5
-rw-r--r--noncore/settings/networksettings2/vpn/vpn_NN.cpp9
-rw-r--r--noncore/settings/networksettings2/vpn/vpn_NN.h4
-rw-r--r--noncore/settings/networksettings2/vpn/vpnrun.h2
-rw-r--r--noncore/settings/networksettings2/wlan/wlan_NN.cpp15
-rw-r--r--noncore/settings/networksettings2/wlan/wlan_NN.h4
-rw-r--r--noncore/settings/networksettings2/wlan/wlan_NNI.cpp12
-rw-r--r--noncore/settings/networksettings2/wlan/wlan_NNI.h2
-rw-r--r--noncore/settings/networksettings2/wlan/wlanrun.h4
53 files changed, 564 insertions, 157 deletions
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h
index e65b378..347da0c 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h
+++ b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h
@@ -15,2 +15,6 @@ public :
15 { QString S; return S.sprintf( "bnep%ld", nr ); } 15 { QString S; return S.sprintf( "bnep%ld", nr ); }
16
17 virtual AsDevice * asDevice( void )
18 { return (AsDevice *)this; }
19
16 virtual AsDevice * device( void ) 20 virtual AsDevice * device( void )
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h
index 87116e2..6a7902a 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h
+++ b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h
@@ -11,2 +11,5 @@ public :
11 11
12 virtual AsLine * asLine( void )
13 { return (AsLine *)this; }
14
12protected : 15protected :
diff --git a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp
index 91be153..47272c4 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp
+++ b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp
@@ -51,4 +51,4 @@ bool BluetoothBNEPNetNode::generateProperFilesFor(
51 51
52bool BluetoothBNEPNetNode::hasDataFor( const QString & ) { 52bool BluetoothBNEPNetNode::hasDataFor( const QString & S, bool DS ) {
53 return 0; 53 return DS && S == "interfaces";
54} 54}
@@ -62,2 +62,9 @@ bool BluetoothBNEPNetNode::generateDataForCommonFile(
62 62
63bool BluetoothBNEPNetNode::generateDeviceDataForCommonFile(
64 SystemFile & ,
65 long ,
66 ANetNodeInstance * ) {
67 return 1;
68}
69
63// 70//
@@ -103,3 +110,3 @@ bool BluetoothRFCOMMNetNode::generateProperFilesFor(
103 110
104bool BluetoothRFCOMMNetNode::hasDataFor( const QString & ) { 111bool BluetoothRFCOMMNetNode::hasDataFor( const QString &, bool ) {
105 return 0; 112 return 0;
diff --git a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h
index 705201c..d72b0d4 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h
+++ b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h
@@ -30,5 +30,7 @@ public:
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, bool DS );
32 virtual bool generateDataForCommonFile( 32 virtual bool generateDataForCommonFile(
33 SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); 33 SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
34 virtual bool generateDeviceDataForCommonFile(
35 SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
34 36
@@ -61,5 +63,7 @@ public:
61 virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); 63 virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
62 virtual bool hasDataFor( const QString & S ); 64 virtual bool hasDataFor( const QString & S, bool );
63 virtual bool generateDataForCommonFile( 65 virtual bool generateDataForCommonFile(
64 SystemFile & SF, long, ANetNodeInstance * NNI ); 66 SystemFile & SF, long, ANetNodeInstance * NNI );
67 virtual bool generateDeviceDataForCommonFile(
68 SystemFile & SF, long, ANetNodeInstance * NNI );
65 69
diff --git a/noncore/settings/networksettings2/cable/cable_NN.cpp b/noncore/settings/networksettings2/cable/cable_NN.cpp
index 756903e..6f62772 100644
--- a/noncore/settings/networksettings2/cable/cable_NN.cpp
+++ b/noncore/settings/networksettings2/cable/cable_NN.cpp
@@ -43,3 +43,3 @@ bool CableNetNode::generateProperFilesFor(
43 43
44bool CableNetNode::hasDataFor( const QString & ) { 44bool CableNetNode::hasDataFor( const QString &, bool ) {
45 return 0; 45 return 0;
@@ -54,2 +54,9 @@ bool CableNetNode::generateDataForCommonFile(
54 54
55bool CableNetNode::generateDeviceDataForCommonFile(
56 SystemFile & ,
57 long ,
58 ANetNodeInstance * ) {
59 return 1;
60}
61
55extern "C" { 62extern "C" {
diff --git a/noncore/settings/networksettings2/cable/cable_NN.h b/noncore/settings/networksettings2/cable/cable_NN.h
index da99c1c..3875af6 100644
--- a/noncore/settings/networksettings2/cable/cable_NN.h
+++ b/noncore/settings/networksettings2/cable/cable_NN.h
@@ -30,5 +30,7 @@ public:
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, bool DS );
32 virtual bool generateDataForCommonFile( 32 virtual bool generateDataForCommonFile(
33 SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); 33 SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
34 virtual bool generateDeviceDataForCommonFile(
35 SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
34 36
diff --git a/noncore/settings/networksettings2/cable/cablerun.h b/noncore/settings/networksettings2/cable/cablerun.h
index 36ee640..7b341c4 100644
--- a/noncore/settings/networksettings2/cable/cablerun.h
+++ b/noncore/settings/networksettings2/cable/cablerun.h
@@ -11,2 +11,5 @@ public :
11 11
12 virtual AsLine * asLine( void )
13 { return (AsLine *)this; }
14
12protected : 15protected :
diff --git a/noncore/settings/networksettings2/irda/irda_NN.cpp b/noncore/settings/networksettings2/irda/irda_NN.cpp
index 3b9c938..4347191 100644
--- a/noncore/settings/networksettings2/irda/irda_NN.cpp
+++ b/noncore/settings/networksettings2/irda/irda_NN.cpp
@@ -43,3 +43,3 @@ bool IRDANetNode::generateProperFilesFor(
43 43
44bool IRDANetNode::hasDataFor( const QString & ) { 44bool IRDANetNode::hasDataFor( const QString &, bool ) {
45 return 0; 45 return 0;
@@ -54,2 +54,9 @@ bool IRDANetNode::generateDataForCommonFile(
54 54
55bool IRDANetNode::generateDeviceDataForCommonFile(
56 SystemFile & ,
57 long ,
58 ANetNodeInstance * ) {
59 return 1;
60}
61
55extern "C" { 62extern "C" {
diff --git a/noncore/settings/networksettings2/irda/irda_NN.h b/noncore/settings/networksettings2/irda/irda_NN.h
index 6574c17..a772f69 100644
--- a/noncore/settings/networksettings2/irda/irda_NN.h
+++ b/noncore/settings/networksettings2/irda/irda_NN.h
@@ -30,5 +30,7 @@ public:
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, bool DS );
32 virtual bool generateDataForCommonFile( 32 virtual bool generateDataForCommonFile(
33 SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); 33 SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
34 virtual bool generateDeviceDataForCommonFile(
35 SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
34 36
diff --git a/noncore/settings/networksettings2/irda/irdarun.h b/noncore/settings/networksettings2/irda/irdarun.h
index adc9c24..d9fe5e8 100644
--- a/noncore/settings/networksettings2/irda/irdarun.h
+++ b/noncore/settings/networksettings2/irda/irdarun.h
@@ -11,2 +11,5 @@ public :
11 11
12 virtual AsLine * asLine( void )
13 { return (AsLine *)this; }
14
12protected : 15protected :
diff --git a/noncore/settings/networksettings2/lancard/lancard_NN.cpp b/noncore/settings/networksettings2/lancard/lancard_NN.cpp
index a45496d..7d36918 100644
--- a/noncore/settings/networksettings2/lancard/lancard_NN.cpp
+++ b/noncore/settings/networksettings2/lancard/lancard_NN.cpp
@@ -44,4 +44,4 @@ bool LanCardNetNode::generateProperFilesFor(
44 44
45bool LanCardNetNode::hasDataFor( const QString & ) { 45bool LanCardNetNode::hasDataFor( const QString & S, bool DS ) {
46 return 0; 46 return DS && S == "interfaces";
47} 47}
@@ -55,2 +55,9 @@ bool LanCardNetNode::generateDataForCommonFile(
55 55
56bool LanCardNetNode::generateDeviceDataForCommonFile(
57 SystemFile & S ,
58 long DevNr ,
59 ANetNodeInstance * NNI ) {
60 return ((ALanCard *)NNI)->generateDeviceDataForCommonFile(S, DevNr);
61}
62
56extern "C" { 63extern "C" {
diff --git a/noncore/settings/networksettings2/lancard/lancard_NN.h b/noncore/settings/networksettings2/lancard/lancard_NN.h
index 71b49d0..9690c76 100644
--- a/noncore/settings/networksettings2/lancard/lancard_NN.h
+++ b/noncore/settings/networksettings2/lancard/lancard_NN.h
@@ -30,5 +30,7 @@ public:
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, bool DS );
32 virtual bool generateDataForCommonFile( 32 virtual bool generateDataForCommonFile(
33 SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); 33 SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
34 virtual bool generateDeviceDataForCommonFile(
35 SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
34 36
diff --git a/noncore/settings/networksettings2/lancard/lancard_NNI.cpp b/noncore/settings/networksettings2/lancard/lancard_NNI.cpp
index 9595e2e..a6401db 100644
--- a/noncore/settings/networksettings2/lancard/lancard_NNI.cpp
+++ b/noncore/settings/networksettings2/lancard/lancard_NNI.cpp
@@ -44 +44,15 @@ void ALanCard::commit( void ) {
44} 44}
45
46bool ALanCard::generateDeviceDataForCommonFile( SystemFile & S, long DevNr ) {
47 AsDevice * Dev = runtime()->device();
48 QString NIC = Dev->genNic( DevNr );
49
50 if( S.name() == "interfaces" ) {
51 // generate mapping stanza for this interface
52 S << "# check if " << NIC << " can be brought UP" << endl;
53 S << "mapping " << NIC << endl;
54 S << " script networksettings2-request" << endl << endl;
55 }
56 return 0;
57}
58
diff --git a/noncore/settings/networksettings2/lancard/lancard_NNI.h b/noncore/settings/networksettings2/lancard/lancard_NNI.h
index 8fc8868..16f5f56 100644
--- a/noncore/settings/networksettings2/lancard/lancard_NNI.h
+++ b/noncore/settings/networksettings2/lancard/lancard_NNI.h
@@ -29,2 +29,4 @@ public :
29 29
30 bool generateDeviceDataForCommonFile( SystemFile & S, long DevNr );
31
30protected : 32protected :
diff --git a/noncore/settings/networksettings2/lancard/lancardrun.cpp b/noncore/settings/networksettings2/lancard/lancardrun.cpp
index b3b592b..951756d 100644
--- a/noncore/settings/networksettings2/lancard/lancardrun.cpp
+++ b/noncore/settings/networksettings2/lancard/lancardrun.cpp
@@ -38,3 +38,12 @@ void LanCardRun::detectState( NodeCollection * NC ) {
38 38
39 // we are certainly not UP 39 if( ( Run = assignedInterface() ) ) {
40 // we already have an interface assigned -> still present ?
41 if( ! Run->IsUp ) {
42 // usb is still free -> keep assignment
43 NC->setCurrentState( Available );
44 return;
45 } // else interface is up but NOT us -> some other profile
46 }
47
48 // nothing (valid) assigned to us
40 assignInterface( 0 ); 49 assignInterface( 0 );
@@ -89,4 +98,3 @@ bool LanCardRun::setState( NodeCollection * NC, Action_t A ) {
89 return 0; 98 return 0;
90 } 99 } else if( NC->currentState() != Available ) {
91 if( NC->currentState() != Available ) {
92 return 1; 100 return 1;
diff --git a/noncore/settings/networksettings2/lancard/lancardrun.h b/noncore/settings/networksettings2/lancard/lancardrun.h
index 5f004e0..8dbd1b1 100644
--- a/noncore/settings/networksettings2/lancard/lancardrun.h
+++ b/noncore/settings/networksettings2/lancard/lancardrun.h
@@ -20,4 +20,8 @@ public :
20 { QString S; return S.sprintf( "eth%ld", nr ); } 20 { QString S; return S.sprintf( "eth%ld", nr ); }
21
21 virtual AsDevice * device( void ) 22 virtual AsDevice * device( void )
22 { return asDevice(); } 23 { return (AsDevice *)this; }
24
25 virtual AsDevice * asDevice( void )
26 { return (AsDevice *)this; }
23 27
diff --git a/noncore/settings/networksettings2/modem/modem_NN.cpp b/noncore/settings/networksettings2/modem/modem_NN.cpp
index 48e1ad8..2807963 100644
--- a/noncore/settings/networksettings2/modem/modem_NN.cpp
+++ b/noncore/settings/networksettings2/modem/modem_NN.cpp
@@ -44,3 +44,3 @@ bool ModemNetNode::generateProperFilesFor(
44 44
45bool ModemNetNode::hasDataFor( const QString & ) { 45bool ModemNetNode::hasDataFor( const QString &, bool ) {
46 return 0; 46 return 0;
@@ -55,2 +55,9 @@ bool ModemNetNode::generateDataForCommonFile(
55 55
56bool ModemNetNode::generateDeviceDataForCommonFile(
57 SystemFile & ,
58 long ,
59 ANetNodeInstance * ) {
60 return 1;
61}
62
56extern "C" { 63extern "C" {
diff --git a/noncore/settings/networksettings2/modem/modem_NN.h b/noncore/settings/networksettings2/modem/modem_NN.h
index 5eceed2..bd921c6 100644
--- a/noncore/settings/networksettings2/modem/modem_NN.h
+++ b/noncore/settings/networksettings2/modem/modem_NN.h
@@ -30,5 +30,7 @@ public:
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, bool DS );
32 virtual bool generateDataForCommonFile( 32 virtual bool generateDataForCommonFile(
33 SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); 33 SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
34 virtual bool generateDeviceDataForCommonFile(
35 SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
34 36
diff --git a/noncore/settings/networksettings2/modem/modemrun.h b/noncore/settings/networksettings2/modem/modemrun.h
index 719ab2f..6d1662b 100644
--- a/noncore/settings/networksettings2/modem/modemrun.h
+++ b/noncore/settings/networksettings2/modem/modemrun.h
@@ -11,2 +11,5 @@ public :
11 11
12 virtual AsLine * asLine( void )
13 { return (AsLine *)this; }
14
12protected : 15protected :
diff --git a/noncore/settings/networksettings2/network/network_NN.cpp b/noncore/settings/networksettings2/network/network_NN.cpp
index bb371ad..a6b15c6 100644
--- a/noncore/settings/networksettings2/network/network_NN.cpp
+++ b/noncore/settings/networksettings2/network/network_NN.cpp
@@ -45,4 +45,4 @@ bool NetworkNetNode::generateProperFilesFor(
45 45
46bool NetworkNetNode::hasDataFor( const QString & S ) { 46bool NetworkNetNode::hasDataFor( const QString & S, bool DS ) {
47 if( S == "interfaces" ) { 47 if( ! DS && S == "interfaces" ) {
48 return 1; 48 return 1;
@@ -59,2 +59,9 @@ bool NetworkNetNode::generateDataForCommonFile(
59 59
60bool NetworkNetNode::generateDeviceDataForCommonFile(
61 SystemFile & ,
62 long ,
63 ANetNodeInstance * ) {
64 return 1;
65}
66
60extern "C" { 67extern "C" {
diff --git a/noncore/settings/networksettings2/network/network_NN.h b/noncore/settings/networksettings2/network/network_NN.h
index 220e00f..62a3f10 100644
--- a/noncore/settings/networksettings2/network/network_NN.h
+++ b/noncore/settings/networksettings2/network/network_NN.h
@@ -30,5 +30,7 @@ public:
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, bool DS );
32 virtual bool generateDataForCommonFile( 32 virtual bool generateDataForCommonFile(
33 SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); 33 SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
34 virtual bool generateDeviceDataForCommonFile(
35 SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
34 36
diff --git a/noncore/settings/networksettings2/network/network_NNI.cpp b/noncore/settings/networksettings2/network/network_NNI.cpp
index 7130764..eac2d66 100644
--- a/noncore/settings/networksettings2/network/network_NNI.cpp
+++ b/noncore/settings/networksettings2/network/network_NNI.cpp
@@ -106,7 +106,2 @@ bool ANetwork::generateDataForCommonFile( SystemFile & S, long DevNr ) {
106 if( S.name() == "interfaces" ) { 106 if( S.name() == "interfaces" ) {
107 // generate mapping stanza for this interface
108 S << "# check if " << NIC << " can be brought UP" << endl;
109 S << "mapping " << NIC << endl;
110 S << " script networksettings2-request" << endl << endl;
111
112 // we can safely call from here since device item is deeper 107 // we can safely call from here since device item is deeper
diff --git a/noncore/settings/networksettings2/network/networkedit.cpp b/noncore/settings/networksettings2/network/networkedit.cpp
index b17d745..182213b 100644
--- a/noncore/settings/networksettings2/network/networkedit.cpp
+++ b/noncore/settings/networksettings2/network/networkedit.cpp
@@ -54,9 +54,9 @@ QString NetworkEdit::acceptable( void ) {
54 return tr("Broadcast address not valid"); 54 return tr("Broadcast address not valid");
55 if( Gateway_LE->text().isEmpty() && 55 if( Gateway_LE->text().isEmpty() ||
56 ! validIP( Gateway_LE->text() ) ) 56 ! validIP( Gateway_LE->text() ) )
57 return tr("Gateway address not valid"); 57 return tr("Gateway address not valid");
58 if( DNS1_LE->text().isEmpty() && 58 if( ! DNS1_LE->text().isEmpty() &&
59 ! validIP( DNS1_LE->text() ) ) 59 ! validIP( DNS1_LE->text() ) )
60 return tr("DNS1 address not valid"); 60 return tr("DNS1 address not valid");
61 if( DNS2_LE->text().isEmpty() && 61 if( ! DNS2_LE->text().isEmpty() &&
62 ! validIP( DNS2_LE->text() ) ) 62 ! validIP( DNS2_LE->text() ) )
diff --git a/noncore/settings/networksettings2/network/networkrun.cpp b/noncore/settings/networksettings2/network/networkrun.cpp
index 8deca14..f34fdbf 100644
--- a/noncore/settings/networksettings2/network/networkrun.cpp
+++ b/noncore/settings/networksettings2/network/networkrun.cpp
@@ -28,5 +28,6 @@ bool NetworkRun::setState( NodeCollection * NC, Action_t A ) {
28 QString S; 28 QString S;
29 S.sprintf( "ifup %s", II->Name.latin1() ); 29 S.sprintf( "ifup %s=%s-c%d-allowed",
30 II->Name.latin1(), II->Name.latin1(),
31 connection()->number() );
30 NSResources->system().execute( S ); 32 NSResources->system().execute( S );
31 NC->setCurrentState( IsUp );
32 } 33 }
@@ -36,5 +37,6 @@ bool NetworkRun::setState( NodeCollection * NC, Action_t A ) {
36 QString S; 37 QString S;
37 S.sprintf( "ifdown %s", II->Name.latin1() ); 38 S.sprintf( "ifdown %s=%s-c%d-allowed",
39 II->Name.latin1(), II->Name.latin1(),
40 connection()->number() );
38 NSResources->system().execute( S ); 41 NSResources->system().execute( S );
39 NC->setCurrentState( Available );
40 } 42 }
diff --git a/noncore/settings/networksettings2/network/networkrun.h b/noncore/settings/networksettings2/network/networkrun.h
index f3d840e..fa16365 100644
--- a/noncore/settings/networksettings2/network/networkrun.h
+++ b/noncore/settings/networksettings2/network/networkrun.h
@@ -11,2 +11,5 @@ public :
11 11
12 virtual AsConnection * asConnection( void )
13 { return (AsConnection *)this; }
14
12protected : 15protected :
diff --git a/noncore/settings/networksettings2/networksettings.cpp b/noncore/settings/networksettings2/networksettings.cpp
index e1110e2..c3e6572 100644
--- a/noncore/settings/networksettings2/networksettings.cpp
+++ b/noncore/settings/networksettings2/networksettings.cpp
@@ -170,32 +170,50 @@ void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) {
170 UpdateTimer->stop(); 170 UpdateTimer->stop();
171 if( EC.exec() == QDialog::Accepted ) { 171 // we need to retry
172 // toplevel item -> store 172 while( 1 ) {
173 NodeCollection * NC = EC.connection(); 173 if( EC.exec() == QDialog::Accepted ) {
174 if( NC->isModified() ) { 174 // toplevel item -> store
175 setModified( 1 ); 175 NodeCollection * NC = EC.connection();
176 if( NC->isModified() ) {
177 setModified( 1 );
178 if( LBI ) {
179 if( NC->name() != OldName ) {
180 // find if new name is free
181 NodeCollection * LCN = NSResources->findConnection(
182 NC->name() );
183 if( LCN ) {
184 QMessageBox::warning(
185 0,
186 tr( "Generating system configuration" ),
187 tr( "Name %1 already exists" ).arg(NC->name())
188 );
189 continue; // restart exec
190 } // else new name
191 // new name -> remove item
192 NSResources->removeConnection( OldName );
193 NSResources->addConnection( NC );
194 } // else not changed
195
196 // must add it here since change will trigger event
197 Profiles_LB->changeItem( NC->devicePixmap(),
198 NC->name(),
199 Profiles_LB->index( LBI )
200 );
201 } else {
202 // new item
203 int ci = Profiles_LB->count();
204 NSResources->addConnection( NC );
205 NC->setNumber( NC->maxConnectionNumber()+1 );
206 Profiles_LB->insertItem( NC->devicePixmap(), NC->name() );
207 Profiles_LB->setSelected( ci, TRUE );
208 }
209 updateProfileState( LBI );
210 }
211 } else {
212 // cancelled : reset connection
176 if( LBI ) { 213 if( LBI ) {
177 // new name -> remove item 214 NodeCollection * NC = NSResources->findConnection( LBI->text() );
178 NSResources->removeConnection( OldName ); 215 NC->reassign();
179 // must add it here since change will trigger event
180 NSResources->addConnection( NC );
181 Profiles_LB->changeItem( NC->devicePixmap(),
182 NC->name(),
183 Profiles_LB->index( LBI )
184 );
185 } else {
186 // new item
187 int ci = Profiles_LB->count();
188 NSResources->addConnection( NC );
189 NC->setNumber( NC->maxConnectionNumber()+1 );
190 Profiles_LB->insertItem( NC->devicePixmap(), NC->name() );
191 Profiles_LB->setSelected( ci, TRUE );
192 } 216 }
193 updateProfileState( LBI );
194 }
195 } else {
196 // cancelled : reset connection
197 if( LBI ) {
198 NodeCollection * NC = NSResources->findConnection( LBI->text() );
199 NC->reassign();
200 } 217 }
218 break;
201 } 219 }
@@ -335,11 +353,6 @@ void NetworkSettings::SLOT_On( void ) {
335 break; 353 break;
336 case Available : 354 case Available : // deactivate
337 // deactivate 355 case IsUp : // deactivate (will also bring down if needed)
338 rv = NC->setState( Deactivate ); 356 rv = NC->setState( Deactivate );
339 break; 357 break;
340 case IsUp :
341 // bring down and deactivate
342 rv = ( NC->setState( Down ) &&
343 NC->setState( Deactivate ) );
344 break;
345 default : 358 default :
@@ -368,3 +381,3 @@ void NetworkSettings::SLOT_Connect( void ) {
368 381
369 bool rv; 382 bool rv = 1 ;
370 switch( NC->state() ) { 383 switch( NC->state() ) {
@@ -385,3 +398,3 @@ void NetworkSettings::SLOT_Connect( void ) {
385 // others no change 398 // others no change
386 return; 399 break;
387 } 400 }
@@ -393,3 +406,2 @@ void NetworkSettings::SLOT_Connect( void ) {
393 tr( "Cannot enable profile" ) ); 406 tr( "Cannot enable profile" ) );
394 return;
395 } 407 }
diff --git a/noncore/settings/networksettings2/networksettings2/netnode.h b/noncore/settings/networksettings2/networksettings2/netnode.h
index 56333c5..f4a5e30 100644
--- a/noncore/settings/networksettings2/networksettings2/netnode.h
+++ b/noncore/settings/networksettings2/networksettings2/netnode.h
@@ -97,4 +97,4 @@ public:
97 // with name S 97 // with name S
98 virtual bool hasDataFor( const QString & S ) = 0; 98 virtual bool hasDataFor( const QString & S, bool DeviceSpecific ) = 0;
99 // generate data specific for the system file S 99 // generate data specific for a profile and for the system file S
100 // called only IF data was needed 100 // called only IF data was needed
@@ -102,2 +102,6 @@ public:
102 SystemFile & SF, long DevNr, ANetNodeInstance * NNI ) = 0; 102 SystemFile & SF, long DevNr, ANetNodeInstance * NNI ) = 0;
103 // generate data specific for the device for the system file S
104 // called only IF data was needed
105 virtual bool generateDeviceDataForCommonFile(
106 SystemFile & SF, long DevNr, ANetNodeInstance * NNI ) = 0;
103 107
@@ -217,11 +221,11 @@ public :
217 221
218 // downcast 222 // downcast implemented by specify runtime classes
219 AsDevice * asDevice( void ) 223 AsDevice * asDevice( void )
220 { return (AsDevice *)this; } 224 { return 0; }
221 AsConnection * asConnection( void ) 225 AsConnection * asConnection( void )
222 { return (AsConnection *)this; } 226 { return 0; }
223 AsLine * asLine( void ) 227 AsLine * asLine( void )
224 { return (AsLine *)this; } 228 { return 0; }
225 AsFullSetup * asFullSetup( void ) 229 AsFullSetup * asFullSetup( void )
226 { return (AsFullSetup *)this; } 230 { return 0; }
227 231
@@ -386,3 +390,3 @@ public:
386 { return 0; } 390 { return 0; }
387 virtual bool hasDataFor( const QString & ) 391 virtual bool hasDataFor( const QString &, bool DS )
388 { return 0; } 392 { return 0; }
@@ -391,2 +395,5 @@ public:
391 {return 1; } 395 {return 1; }
396 virtual bool generateDeviceDataForCommonFile(
397 SystemFile & , long , ANetNodeInstance * )
398 {return 1; }
392 399
diff --git a/noncore/settings/networksettings2/networksettings2/system.cpp b/noncore/settings/networksettings2/networksettings2/system.cpp
index 85dcd7d..a68f3c0 100644
--- a/noncore/settings/networksettings2/networksettings2/system.cpp
+++ b/noncore/settings/networksettings2/networksettings2/system.cpp
@@ -40,2 +40,3 @@ int System::execute( const QString & S ) {
40 QString MyS = S; 40 QString MyS = S;
41 char * usr = getenv("USER");
41 int rv; 42 int rv;
@@ -46,4 +47,4 @@ int System::execute( const QString & S ) {
46 } 47 }
47 if( getenv("USER") != "root" ) { 48 if( usr == 0 || strcmp( usr, "root" ) ) {
48 // use SUDO 49 // unknown or non-root user -> use SUDO
49 MyS.prepend( "sudo " ); 50 MyS.prepend( "sudo " );
diff --git a/noncore/settings/networksettings2/networksettings2/systemfile.cpp b/noncore/settings/networksettings2/networksettings2/systemfile.cpp
index 7249976..394ff52 100644
--- a/noncore/settings/networksettings2/networksettings2/systemfile.cpp
+++ b/noncore/settings/networksettings2/networksettings2/systemfile.cpp
@@ -32,3 +32,5 @@ SystemFile::SystemFile( const QString & N, const QString & P ){
32 hasPreNodeSection = 32 hasPreNodeSection =
33 hasPostNodeSection = 0; 33 hasPostNodeSection =
34 hasPreDeviceSection =
35 hasPostDeviceSection = 0;
34 return; 36 return;
@@ -50,2 +52,8 @@ SystemFile::SystemFile( const QString & N, const QString & P ){
50 hasPostNodeSection = ( FI.exists() && FI.isReadable() ); 52 hasPostNodeSection = ( FI.exists() && FI.isReadable() );
53 S = TemplDir + Name + "/predevicesection";
54 FI.setFile( S );
55 hasPreDeviceSection = ( FI.exists() && FI.isReadable() );
56 S = TemplDir + Name + "/postdevicesection";
57 FI.setFile( S );
58 hasPostDeviceSection = ( FI.exists() && FI.isReadable() );
51 } 59 }
@@ -110,3 +118,3 @@ bool SystemFile::preNodeSection( ANetNodeInstance * NNI, long ) {
110 if( hasPreNodeSection ) { 118 if( hasPreNodeSection ) {
111 QFile Fl( TemplDir + Name + "/prenodesectoin" ); 119 QFile Fl( TemplDir + Name + "/prenodesection" );
112 if( ! Fl.open( IO_ReadOnly ) ) 120 if( ! Fl.open( IO_ReadOnly ) )
@@ -128,3 +136,3 @@ bool SystemFile::postNodeSection( ANetNodeInstance * NNI, long DevNr ) {
128 if( hasPostNodeSection ) { 136 if( hasPostNodeSection ) {
129 QFile Fl( TemplDir + Name + "/postnodesectoin" ); 137 QFile Fl( TemplDir + Name + "/postnodesection" );
130 if( ! Fl.open( IO_ReadOnly ) ) 138 if( ! Fl.open( IO_ReadOnly ) )
@@ -144 +152,36 @@ bool SystemFile::postNodeSection( ANetNodeInstance * NNI, long DevNr ) {
144 152
153bool SystemFile::preDeviceSection( ANetNodeInstance * NNI, long ) {
154 if( hasPreDeviceSection ) {
155 QFile Fl( TemplDir + Name + "/predevicesection" );
156 if( ! Fl.open( IO_ReadOnly ) )
157 return 1; // error
158 QTextStream TX( &Fl );
159 QString Out;
160 QString S = TX.readLine();
161 while( ! TX.eof() ) {
162 Out = S.
163 arg(NNI->netNode()->nodeName());
164 (*this) << Out << endl;
165 S = TX.readLine();
166 }
167 }
168 return 0;
169}
170
171bool SystemFile::postDeviceSection( ANetNodeInstance * NNI, long DevNr ) {
172 if( hasPostDeviceSection ) {
173 QFile Fl( TemplDir + Name + "/postdevicesection" );
174 if( ! Fl.open( IO_ReadOnly ) )
175 return 1; // error
176 QTextStream TX( &Fl );
177 QString Out;
178 QString S = TX.readLine();
179 while( ! TX.eof() ) {
180 Out = S.
181 arg(NNI->nodeName());
182 (*this) << Out << endl;
183 S = TX.readLine();
184 }
185 }
186 return 0;
187}
diff --git a/noncore/settings/networksettings2/networksettings2/systemfile.h b/noncore/settings/networksettings2/networksettings2/systemfile.h
index 8b6bcb9..35e0dfc 100644
--- a/noncore/settings/networksettings2/networksettings2/systemfile.h
+++ b/noncore/settings/networksettings2/networksettings2/systemfile.h
@@ -26,2 +26,4 @@ public :
26 bool postNodeSection( ANetNodeInstance * NNI, long DevNr ); 26 bool postNodeSection( ANetNodeInstance * NNI, long DevNr );
27 bool preDeviceSection( ANetNodeInstance * NNI, long DevNr );
28 bool postDeviceSection( ANetNodeInstance * NNI, long DevNr );
27 29
@@ -33,5 +35,7 @@ private :
33 bool hasPreSection; 35 bool hasPreSection;
34 bool hasPreNodeSection;
35 bool hasPostSection; 36 bool hasPostSection;
37 bool hasPreNodeSection;
36 bool hasPostNodeSection; 38 bool hasPostNodeSection;
39 bool hasPreDeviceSection;
40 bool hasPostDeviceSection;
37 41
diff --git a/noncore/settings/networksettings2/nsdata.cpp b/noncore/settings/networksettings2/nsdata.cpp
index 3f5e958..6541596 100644
--- a/noncore/settings/networksettings2/nsdata.cpp
+++ b/noncore/settings/networksettings2/nsdata.cpp
@@ -190,2 +190,3 @@ QString NetworkSettingsData::generateSettings( bool ForceReq ) {
190 SystemFile * SF; 190 SystemFile * SF;
191 AsDevice * CurDev;
191 bool needToRegenerate = ForceIt; 192 bool needToRegenerate = ForceIt;
@@ -216,3 +217,5 @@ QString NetworkSettingsData::generateSettings( bool ForceReq ) {
216 NNI = cncit.current(); 217 NNI = cncit.current();
217 if( NNI->netNode()->hasDataFor( SF->name() ) && 218 if( ( NNI->netNode()->hasDataFor( SF->name(), 1 ) ||
219 NNI->netNode()->hasDataFor( SF->name(), 0 )
220 ) &&
218 NNI->isModified() ) { 221 NNI->isModified() ) {
@@ -243,3 +246,2 @@ QString NetworkSettingsData::generateSettings( bool ForceReq ) {
243 { Name2Instance_t & NNIs = NSResources->netNodeInstances(); 246 { Name2Instance_t & NNIs = NSResources->netNodeInstances();
244 ANetNodeInstance * NNI;
245 247
@@ -265,3 +267,3 @@ QString NetworkSettingsData::generateSettings( bool ForceReq ) {
265 // 267 //
266 // generate system files 268 // generate all system files
267 // 269 //
@@ -272,5 +274,2 @@ QString NetworkSettingsData::generateSettings( bool ForceReq ) {
272 274
273 //
274 // regenerate current file
275 //
276 printf( "Generating %s\n", SF->name().latin1() ); 275 printf( "Generating %s\n", SF->name().latin1() );
@@ -280,2 +279,3 @@ QString NetworkSettingsData::generateSettings( bool ForceReq ) {
280 279
280 // global presection for this system file
281 if( SF->preSection() ) { 281 if( SF->preSection() ) {
@@ -287,30 +287,101 @@ QString NetworkSettingsData::generateSettings( bool ForceReq ) {
287 287
288 for( QDictIterator<NodeCollection> ncit(M); 288 // find all netnodes and figure out if
289 ncit.current(); 289 // for that node there are instances
290 ++ncit ) { 290 for( QDictIterator<NetNode_t> nnit(
291 NC = ncit.current(); 291 NSResources->netNodes() );
292 292 nnit.current();
293 // get the netnode that serves as the device for this 293 ++nnit ) {
294 // connection 294 ANetNode * NN;
295 AsDevice * Dev = NC->device(); 295
296 NN = nnit.current()->NetNode;
297
298 // are there instances ?
299 NNI = 0;
300 for( QDictIterator<ANetNodeInstance> nniit(
301 NSResources->netNodeInstances() );
302 nniit.current();
303 ++nniit ) {
304 if( nniit.current()->netNode() == NN ) {
305 NNI = nniit.current();
306 break;
307 }
308 }
296 309
297 // generate 'entry' for every possible device this profile handles 310 if( ! NNI )
311 // no instances
312 continue;
313
314 // has this node data for this system file ?
315 if( (CurDev = NNI->runtime()->asDevice() ) ) {
316 // generate start for this nodetype for all possible devices of this type
317 for( int i = 0; i < CurDev->count(); i ++ ) {
318 if( SF->preDeviceSection( NNI, i ) ) {
319 S = qApp->translate( "NetworkSettings",
320 "<p>Error in preDeviceSection for file %1 and node %2</p>" ).
321 arg( SF->name() ).
322 arg( NN->nodeName() );
323 return S;
324 }
298 325
299 for( QListIterator<ANetNodeInstance> cncit(*NC); 326 if( ! NN->hasDataFor( SF->name(), 1 ) ) {
300 cncit.current(); 327 if( NN->generateDeviceDataForCommonFile( *SF, i, NNI ) ) {
301 ++cncit ) {
302 NNI = cncit.current();
303 for( int i = 0; i < Dev->count(); i ++ ) {
304 if( NNI->netNode()->hasDataFor( SF->name() ) ) {
305 if( SF->preNodeSection( NNI, i ) ) {
306 S = qApp->translate( "NetworkSettings", 328 S = qApp->translate( "NetworkSettings",
307 "<p>Error in preNodeSection for file %1 and node %2</p>" ). 329 "<p>Error in node part for file %1 and node %2</p>" ).
308 arg( SF->name() ). 330 arg( SF->name() ).
309 arg( NNI->netNode()->nodeName() ); 331 arg( NN->nodeName() );
310 return S; 332 return S;
311 } 333 }
334 }
335 }
336 } else {
337 // just request this once
338 if( SF->preDeviceSection( NNI, -1 ) ) {
339 S = qApp->translate( "NetworkSettings",
340 "<p>Error in preDeviceSection for file %1 and node %2</p>" ).
341 arg( SF->name() ).
342 arg( NN->nodeName() );
343 return S;
344 }
345
346 if( ! NN->hasDataFor( SF->name(), 1 ) ) {
347 if( NN->generateDeviceDataForCommonFile( *SF, -1, NNI ) ) {
348 S = qApp->translate( "NetworkSettings",
349 "<p>Error in node part for file %1 and node %2</p>" ).
350 arg( SF->name() ).
351 arg( NN->nodeName() );
352 return S;
353 }
354 }
355 }
356
357 // now generate profile specific data for all
358 // connections working on a device of the current
359 // netnode type
360 for( QDictIterator<NodeCollection> ncit(M);
361 ncit.current();
362 ++ncit ) {
363 NC = ncit.current();
312 364
313 if( NNI->netNode()->generateDataForCommonFile(*SF,i,NNI) ) { 365 NNI = NC->getToplevel();
366
367 // no output needed
368 if( ! NNI->netNode()->hasDataFor( SF->name(), 0 ) )
369 continue;
370
371 // get the netnode that serves as the device for this
372 // connection
373 AsDevice * Dev = NC->device();
374
375 if( CurDev ) {
376 if( CurDev != Dev ) {
377 // other device -> later
378 continue;
379 }
380
381 // generate 'entry' for every combination of device and profile
382 // each node delegates to deeper level
383 for( int i = 0; i < CurDev->count(); i ++ ) {
384 if( SF->preNodeSection( NNI, i ) ) {
314 S = qApp->translate( "NetworkSettings", 385 S = qApp->translate( "NetworkSettings",
315 "<p>Error in node part for file %1 and node %2</p>" ). 386 "<p>Error in preNodeSection for file %1 and node %2</p>" ).
316 arg( SF->name() ). 387 arg( SF->name() ).
@@ -320,2 +391,20 @@ QString NetworkSettingsData::generateSettings( bool ForceReq ) {
320 391
392 // ask all nodes in connection
393
394 for( QListIterator<ANetNodeInstance> cncit(*NC);
395 cncit.current();
396 ++cncit ) {
397 NNI = cncit.current();
398
399 if( NNI->netNode()->hasDataFor( SF->name(), 0 ) ) {
400 if( NNI->netNode()->generateDataForCommonFile(*SF,i,NNI) ) {
401 S = qApp->translate( "NetworkSettings",
402 "<p>Error in node part for file %1 and node %2</p>" ).
403 arg( SF->name() ).
404 arg( NNI->netNode()->nodeName() );
405 return S;
406 }
407 }
408 }
409
321 if( SF->postNodeSection( NNI, i ) ) { 410 if( SF->postNodeSection( NNI, i ) ) {
@@ -328,5 +417,67 @@ QString NetworkSettingsData::generateSettings( bool ForceReq ) {
328 } 417 }
418
419 } else {
420 if( Dev ) {
421 // other
422 continue;
423 }
424
425 // one entry to generate
426 if( SF->preNodeSection( NNI, -1 ) ) {
427 S = qApp->translate( "NetworkSettings",
428 "<p>Error in preNodeSection for file %1 and node %2</p>" ).
429 arg( SF->name() ).
430 arg( NNI->netNode()->nodeName() );
431 return S;
432 }
433
434 if( NNI->netNode()->generateDataForCommonFile(*SF,-1,NNI) ) {
435 S = qApp->translate( "NetworkSettings",
436 "<p>Error in node part for file %1 and node %2</p>" ).
437 arg( SF->name() ).
438 arg( NNI->netNode()->nodeName() );
439 return S;
440 }
441
442 if( SF->postNodeSection( NNI, -1 ) ) {
443 S = qApp->translate( "NetworkSettings",
444 "<p>Error in postNodeSection for file %1 and node %2</p>" ).
445 arg( SF->name() ).
446 arg( NNI->netNode()->nodeName() );
447 return S;
448 }
449 }
450
451 // generated some data
452 if( SF->postNodeSection( NNI, -1 ) ) {
453 S = qApp->translate( "NetworkSettings",
454 "<p>Error in postNodeSection for file %1 and node %2</p>" ).
455 arg( SF->name() ).
456 arg( NNI->netNode()->nodeName() );
457 return S;
458 }
459 *SF << endl;
460 }
461
462 if( CurDev ) {
463 // generate 'entry' for every combination of device and profile
464 // each node delegates to deeper level
465 for( int i = 0; i < CurDev->count(); i ++ ) {
466 if( SF->postDeviceSection( NNI, i ) ) {
467 S = qApp->translate( "NetworkSettings",
468 "<p>Error in postDeviceSection for file %1 and node %2</p>" ).
469 arg( SF->name() ).
470 arg( NNI->netNode()->nodeName() );
471 return S;
472 }
473 }
474 } else {
475 if( SF->postDeviceSection( NNI, -1 ) ) {
476 S = qApp->translate( "NetworkSettings",
477 "<p>Error in postDeviceSection for file %1 and node %2</p>" ).
478 arg( SF->name() ).
479 arg( NNI->netNode()->nodeName() );
480 return S;
329 } 481 }
330 } 482 }
331 *SF << endl;
332 } 483 }
@@ -339,2 +490,3 @@ QString NetworkSettingsData::generateSettings( bool ForceReq ) {
339 } 490 }
491
340 } while( 0 ); 492 } while( 0 );
diff --git a/noncore/settings/networksettings2/ppp/ppp_NN.cpp b/noncore/settings/networksettings2/ppp/ppp_NN.cpp
index 309c9a1..51d17ec 100644
--- a/noncore/settings/networksettings2/ppp/ppp_NN.cpp
+++ b/noncore/settings/networksettings2/ppp/ppp_NN.cpp
@@ -46,3 +46,3 @@ bool PPPNetNode::generateProperFilesFor(
46 46
47bool PPPNetNode::hasDataFor( const QString & ) { 47bool PPPNetNode::hasDataFor( const QString &, bool ) {
48 return 0; 48 return 0;
@@ -57,2 +57,9 @@ bool PPPNetNode::generateDataForCommonFile(
57 57
58bool PPPNetNode::generateDeviceDataForCommonFile(
59 SystemFile & ,
60 long ,
61 ANetNodeInstance * ) {
62 return 1;
63}
64
58extern "C" { 65extern "C" {
diff --git a/noncore/settings/networksettings2/ppp/ppp_NN.h b/noncore/settings/networksettings2/ppp/ppp_NN.h
index 3f9a338..8d56e7f 100644
--- a/noncore/settings/networksettings2/ppp/ppp_NN.h
+++ b/noncore/settings/networksettings2/ppp/ppp_NN.h
@@ -30,5 +30,7 @@ public:
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, bool DS );
32 virtual bool generateDataForCommonFile( 32 virtual bool generateDataForCommonFile(
33 SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); 33 SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
34 virtual bool generateDeviceDataForCommonFile(
35 SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
34 36
diff --git a/noncore/settings/networksettings2/ppp/ppprun.cpp b/noncore/settings/networksettings2/ppp/ppprun.cpp
index 4ac0c5a..8c75df3 100644
--- a/noncore/settings/networksettings2/ppp/ppprun.cpp
+++ b/noncore/settings/networksettings2/ppp/ppprun.cpp
@@ -18,11 +18,3 @@ void PPPRun::detectState( NodeCollection * NC ) {
18 // but could also be unavailable 18 // but could also be unavailable
19 ANetNodeInstance * NNI; 19 AsDevice::netNode()->nextNode()->runtime()->detectState( NC );
20 RuntimeInfo * RI;
21 NNI = AsDevice::netNode();
22 printf( "%p\n", NNI );
23 NNI = NNI->nextNode();
24 printf( "%p\n", NNI );
25 RI = NNI->runtime();
26 printf( "%p\n", RI );
27 RI->detectState( NC );
28 } 20 }
diff --git a/noncore/settings/networksettings2/ppp/ppprun.h b/noncore/settings/networksettings2/ppp/ppprun.h
index abb9176..765aff2 100644
--- a/noncore/settings/networksettings2/ppp/ppprun.h
+++ b/noncore/settings/networksettings2/ppp/ppprun.h
@@ -17,4 +17,10 @@ public :
17 17
18 virtual AsDevice * asDevice( void )
19 { return (AsDevice *)this; }
20 virtual AsConnection * asConnection( void )
21 { return (AsConnection *)this; }
22
18 virtual AsDevice * device( void ) 23 virtual AsDevice * device( void )
19 { return AsDevice::asDevice(); } 24 { return (AsDevice *)this; }
25
20 virtual RuntimeInfo * runtimeInfo( void ) 26 virtual RuntimeInfo * runtimeInfo( void )
diff --git a/noncore/settings/networksettings2/profile/profile_NN.cpp b/noncore/settings/networksettings2/profile/profile_NN.cpp
index c39b86f..fcf1ca6 100644
--- a/noncore/settings/networksettings2/profile/profile_NN.cpp
+++ b/noncore/settings/networksettings2/profile/profile_NN.cpp
@@ -45,3 +45,3 @@ bool ProfileNetNode::generateProperFilesFor(
45 45
46bool ProfileNetNode::hasDataFor( const QString & ) { 46bool ProfileNetNode::hasDataFor( const QString &, bool ) {
47 return 0; 47 return 0;
@@ -56,2 +56,9 @@ bool ProfileNetNode::generateDataForCommonFile(
56 56
57bool ProfileNetNode::generateDeviceDataForCommonFile(
58 SystemFile & ,
59 long ,
60 ANetNodeInstance * ) {
61 return 1;
62}
63
57extern "C" { 64extern "C" {
diff --git a/noncore/settings/networksettings2/profile/profile_NN.h b/noncore/settings/networksettings2/profile/profile_NN.h
index 3c06947..b64a6dd 100644
--- a/noncore/settings/networksettings2/profile/profile_NN.h
+++ b/noncore/settings/networksettings2/profile/profile_NN.h
@@ -30,5 +30,7 @@ public:
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, bool DS );
32 virtual bool generateDataForCommonFile( 32 virtual bool generateDataForCommonFile(
33 SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); 33 SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
34 virtual bool generateDeviceDataForCommonFile(
35 SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
34 36
diff --git a/noncore/settings/networksettings2/profile/profilerun.cpp b/noncore/settings/networksettings2/profile/profilerun.cpp
index 90c37ed..feebf86 100644
--- a/noncore/settings/networksettings2/profile/profilerun.cpp
+++ b/noncore/settings/networksettings2/profile/profilerun.cpp
@@ -21,2 +21,3 @@ bool ProfileRun::setState( NodeCollection * NC, Action_t A ) {
21 if( NC->currentState() == Disabled ) { 21 if( NC->currentState() == Disabled ) {
22 Data->Disabled = 0;
22 NC->setCurrentState( Off ); // at least 23 NC->setCurrentState( Off ); // at least
@@ -24,3 +25,2 @@ bool ProfileRun::setState( NodeCollection * NC, Action_t A ) {
24 NNNI->runtime()->detectState(NC); 25 NNNI->runtime()->detectState(NC);
25 return 1;
26 } 26 }
@@ -28,14 +28,12 @@ bool ProfileRun::setState( NodeCollection * NC, Action_t A ) {
28 case Disable : 28 case Disable :
29 if( NC->currentState() == IsUp ) { 29 switch( NC->currentState() ) {
30 // bring down -> make available 30 case IsUp :
31 NNNI->runtime()->setState(NC, Down); 31 case Available :
32 } 32 // bring Deactivate (will bring down)
33 if( NC->currentState() == Available ) { 33 if( ! NNNI->runtime()->setState(NC, Deactivate) )
34 // make unavailable 34 return 0;
35 NNNI->runtime()->setState(NC, Deactivate); 35 default :
36 } 36 break;
37 if( NC->currentState() > Available ) {
38 // could not disable
39 return 0;
40 } 37 }
38 Data->Disabled = 1;
41 NC->setCurrentState( Disabled ); 39 NC->setCurrentState( Disabled );
diff --git a/noncore/settings/networksettings2/profile/profilerun.h b/noncore/settings/networksettings2/profile/profilerun.h
index d3797b5..6e8385c 100644
--- a/noncore/settings/networksettings2/profile/profilerun.h
+++ b/noncore/settings/networksettings2/profile/profilerun.h
@@ -22,2 +22,5 @@ public :
22 { return Data->Description; } 22 { return Data->Description; }
23
24 virtual AsFullSetup * asFullSetup( void )
25 { return (AsFullSetup *)this; }
23private : 26private :
diff --git a/noncore/settings/networksettings2/usb/usb_NN.cpp b/noncore/settings/networksettings2/usb/usb_NN.cpp
index c65771d..be4a2bc 100644
--- a/noncore/settings/networksettings2/usb/usb_NN.cpp
+++ b/noncore/settings/networksettings2/usb/usb_NN.cpp
@@ -44,3 +44,3 @@ bool USBNetNode::generateProperFilesFor(
44 44
45bool USBNetNode::hasDataFor( const QString & S ) { 45bool USBNetNode::hasDataFor( const QString & S, bool ) {
46 return (S== "interfaces"); 46 return (S== "interfaces");
@@ -55,2 +55,9 @@ bool USBNetNode::generateDataForCommonFile(
55 55
56bool USBNetNode::generateDeviceDataForCommonFile(
57 SystemFile & S ,
58 long DevNr,
59 ANetNodeInstance * NNI) {
60 return ((AUSB *)NNI)->generateDeviceDataForCommonFile(S, DevNr);
61}
62
56extern "C" { 63extern "C" {
diff --git a/noncore/settings/networksettings2/usb/usb_NN.h b/noncore/settings/networksettings2/usb/usb_NN.h
index 8b97452..8ff5289 100644
--- a/noncore/settings/networksettings2/usb/usb_NN.h
+++ b/noncore/settings/networksettings2/usb/usb_NN.h
@@ -30,5 +30,7 @@ public:
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, bool DeviceSpec );
32 virtual bool generateDataForCommonFile( 32 virtual bool generateDataForCommonFile(
33 SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); 33 SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
34 virtual bool generateDeviceDataForCommonFile(
35 SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
34 36
diff --git a/noncore/settings/networksettings2/usb/usb_NNI.cpp b/noncore/settings/networksettings2/usb/usb_NNI.cpp
index 4729416..6fcd6d5 100644
--- a/noncore/settings/networksettings2/usb/usb_NNI.cpp
+++ b/noncore/settings/networksettings2/usb/usb_NNI.cpp
@@ -45,2 +45,13 @@ bool AUSB::generateDataForCommonFile( SystemFile & S, long DevNr ) {
45 45
46bool AUSB::generateDeviceDataForCommonFile( SystemFile & S, long DevNr ) {
47 AsDevice * Dev = runtime()->device();
48 QString NIC = Dev->genNic( DevNr );
46 49
50 if( S.name() == "interfaces" ) {
51 // generate mapping stanza for this interface
52 S << "# check if " << NIC << " can be brought UP" << endl;
53 S << "mapping " << NIC << endl;
54 S << " script networksettings2-request" << endl << endl;
55 }
56 return 0;
57}
diff --git a/noncore/settings/networksettings2/usb/usb_NNI.h b/noncore/settings/networksettings2/usb/usb_NNI.h
index b09f17a..5dead36 100644
--- a/noncore/settings/networksettings2/usb/usb_NNI.h
+++ b/noncore/settings/networksettings2/usb/usb_NNI.h
@@ -30,2 +30,3 @@ public :
30 bool generateDataForCommonFile( SystemFile & S, long DevNr ); 30 bool generateDataForCommonFile( SystemFile & S, long DevNr );
31 bool generateDeviceDataForCommonFile( SystemFile & S, long DevNr );
31 32
diff --git a/noncore/settings/networksettings2/usb/usbrun.cpp b/noncore/settings/networksettings2/usb/usbrun.cpp
index 49b5a77..3007e79 100644
--- a/noncore/settings/networksettings2/usb/usbrun.cpp
+++ b/noncore/settings/networksettings2/usb/usbrun.cpp
@@ -36,4 +36,13 @@ void USBRun::detectState( NodeCollection * NC ) {
36 36
37 fprintf( stderr, "NUP\n" ); 37 fprintf( stderr, "Assigned %p\n", assignedInterface() );
38 // definitively not up 38 if( ( Run = assignedInterface() ) ) {
39 // we already have an interface assigned -> still present ?
40 if( ! Run->IsUp ) {
41 // usb is still free -> keep assignment
42 NC->setCurrentState( Available );
43 return;
44 } // else interface is up but NOT us -> some other profile
45 }
46
47 // nothing (valid) assigned to us
39 assignInterface( 0 ); 48 assignInterface( 0 );
@@ -45,7 +54,9 @@ void USBRun::detectState( NodeCollection * NC ) {
45 Run = It.current(); 54 Run = It.current();
55
46 fprintf( stderr, "%s %d %d=%d %d\n", 56 fprintf( stderr, "%s %d %d=%d %d\n",
47 Run->Name.latin1(), 57 Run->Name.latin1(),
48 handlesInterface( Run->Name ), 58 handlesInterface( Run->Name ),
49 Run->CardType, ARPHRD_ETHER, 59 Run->CardType, ARPHRD_ETHER,
50 ! Run->IsUp ); 60 ! Run->IsUp );
61
51 if( handlesInterface( Run->Name ) && 62 if( handlesInterface( Run->Name ) &&
@@ -54,3 +65,3 @@ void USBRun::detectState( NodeCollection * NC ) {
54 ) { 65 ) {
55 fprintf( stderr, "OFF\n" ); 66 fprintf( stderr, "Released(OFF)\n" );
56 // proper type, and Not UP -> free 67 // proper type, and Not UP -> free
@@ -85,2 +96,3 @@ bool USBRun::setState( NodeCollection * NC, Action_t A ) {
85 assignInterface( N ); 96 assignInterface( N );
97 fprintf( stderr, "Assing %p\n", N );
86 NC->setCurrentState( Available ); 98 NC->setCurrentState( Available );
@@ -94,4 +106,3 @@ bool USBRun::setState( NodeCollection * NC, Action_t A ) {
94 return 0; 106 return 0;
95 } 107 } else if( NC->currentState() != Available ) {
96 if( NC->currentState() != Available ) {
97 return 1; 108 return 1;
diff --git a/noncore/settings/networksettings2/usb/usbrun.h b/noncore/settings/networksettings2/usb/usbrun.h
index c9c9121..60f9fe8 100644
--- a/noncore/settings/networksettings2/usb/usbrun.h
+++ b/noncore/settings/networksettings2/usb/usbrun.h
@@ -20,5 +20,8 @@ public :
20 virtual QString genNic( long nr ); 20 virtual QString genNic( long nr );
21
21 virtual AsDevice * device( void ) 22 virtual AsDevice * device( void )
22 { return asDevice(); } 23 { return (AsDevice *)this; }
23 24
25 virtual AsDevice * asDevice( void )
26 { return (AsDevice *)this; }
24protected : 27protected :
diff --git a/noncore/settings/networksettings2/vpn/vpn_NN.cpp b/noncore/settings/networksettings2/vpn/vpn_NN.cpp
index c800929..f570fb2 100644
--- a/noncore/settings/networksettings2/vpn/vpn_NN.cpp
+++ b/noncore/settings/networksettings2/vpn/vpn_NN.cpp
@@ -45,3 +45,3 @@ bool VPNNetNode::generateProperFilesFor(
45 45
46bool VPNNetNode::hasDataFor( const QString & ) { 46bool VPNNetNode::hasDataFor( const QString &, bool ) {
47 return 0; 47 return 0;
@@ -56,2 +56,9 @@ bool VPNNetNode::generateDataForCommonFile(
56 56
57bool VPNNetNode::generateDeviceDataForCommonFile(
58 SystemFile & ,
59 long ,
60 ANetNodeInstance * ) {
61 return 1;
62}
63
57extern "C" { 64extern "C" {
diff --git a/noncore/settings/networksettings2/vpn/vpn_NN.h b/noncore/settings/networksettings2/vpn/vpn_NN.h
index a113ab9..cdb5117 100644
--- a/noncore/settings/networksettings2/vpn/vpn_NN.h
+++ b/noncore/settings/networksettings2/vpn/vpn_NN.h
@@ -30,5 +30,7 @@ public:
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, bool DS );
32 virtual bool generateDataForCommonFile( 32 virtual bool generateDataForCommonFile(
33 SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); 33 SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
34 virtual bool generateDeviceDataForCommonFile(
35 SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
34 36
diff --git a/noncore/settings/networksettings2/vpn/vpnrun.h b/noncore/settings/networksettings2/vpn/vpnrun.h
index c221fd0..4d26298 100644
--- a/noncore/settings/networksettings2/vpn/vpnrun.h
+++ b/noncore/settings/networksettings2/vpn/vpnrun.h
@@ -14,2 +14,4 @@ public :
14 14
15 virtual AsConnection * asConnection( void )
16 { return (AsConnection *)this; }
15protected : 17protected :
diff --git a/noncore/settings/networksettings2/wlan/wlan_NN.cpp b/noncore/settings/networksettings2/wlan/wlan_NN.cpp
index 5a26e41..e1e20c0 100644
--- a/noncore/settings/networksettings2/wlan/wlan_NN.cpp
+++ b/noncore/settings/networksettings2/wlan/wlan_NN.cpp
@@ -44,4 +44,4 @@ bool WLanNetNode::generateProperFilesFor(
44 44
45bool WLanNetNode::hasDataFor( const QString & ) { 45bool WLanNetNode::hasDataFor( const QString & S, bool DS ) {
46 return 0; 46 return DS && S == "interfaces";
47} 47}
@@ -49,4 +49,4 @@ bool WLanNetNode::hasDataFor( const QString & ) {
49bool WLanNetNode::generateDataForCommonFile( 49bool WLanNetNode::generateDataForCommonFile(
50 SystemFile & , 50 SystemFile &,
51 long, 51 long ,
52 ANetNodeInstance * ) { 52 ANetNodeInstance * ) {
@@ -55,2 +55,9 @@ bool WLanNetNode::generateDataForCommonFile(
55 55
56bool WLanNetNode::generateDeviceDataForCommonFile(
57 SystemFile & S,
58 long DevNr,
59 ANetNodeInstance * NNI ) {
60 return ((AWLan *)NNI)->generateDeviceDataForCommonFile(S, DevNr);
61}
62
56extern "C" { 63extern "C" {
diff --git a/noncore/settings/networksettings2/wlan/wlan_NN.h b/noncore/settings/networksettings2/wlan/wlan_NN.h
index 0728a79..9111995 100644
--- a/noncore/settings/networksettings2/wlan/wlan_NN.h
+++ b/noncore/settings/networksettings2/wlan/wlan_NN.h
@@ -30,5 +30,7 @@ public:
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, bool DS );
32 virtual bool generateDataForCommonFile( 32 virtual bool generateDataForCommonFile(
33 SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); 33 SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
34 virtual bool generateDeviceDataForCommonFile(
35 SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
34 36
diff --git a/noncore/settings/networksettings2/wlan/wlan_NNI.cpp b/noncore/settings/networksettings2/wlan/wlan_NNI.cpp
index 92f3457..8b948e0 100644
--- a/noncore/settings/networksettings2/wlan/wlan_NNI.cpp
+++ b/noncore/settings/networksettings2/wlan/wlan_NNI.cpp
@@ -30 +30,13 @@ void AWLan::commit( void ) {
30 30
31bool AWLan::generateDeviceDataForCommonFile( SystemFile & S, long DevNr ) {
32 AsDevice * Dev = runtime()->device();
33 QString NIC = Dev->genNic( DevNr );
34
35 if( S.name() == "interfaces" ) {
36 // generate mapping stanza for this interface
37 S << "# check if " << NIC << " can be brought UP" << endl;
38 S << "mapping " << NIC << endl;
39 S << " script networksettings2-request" << endl << endl;
40 }
41 return 0;
42}
diff --git a/noncore/settings/networksettings2/wlan/wlan_NNI.h b/noncore/settings/networksettings2/wlan/wlan_NNI.h
index 8b695b5..e464c84 100644
--- a/noncore/settings/networksettings2/wlan/wlan_NNI.h
+++ b/noncore/settings/networksettings2/wlan/wlan_NNI.h
@@ -29,2 +29,4 @@ public :
29 29
30 bool generateDeviceDataForCommonFile( SystemFile & S, long DevNr );
31
30protected : 32protected :
diff --git a/noncore/settings/networksettings2/wlan/wlanrun.h b/noncore/settings/networksettings2/wlan/wlanrun.h
index 4cbb059..b853262 100644
--- a/noncore/settings/networksettings2/wlan/wlanrun.h
+++ b/noncore/settings/networksettings2/wlan/wlanrun.h
@@ -21,3 +21,5 @@ public :
21 virtual AsDevice * device( void ) 21 virtual AsDevice * device( void )
22 { return asDevice(); } 22 { return (AsDevice *)this; }
23 virtual AsDevice * asDevice( void )
24 { return (AsDevice *)this; }
23 25