summaryrefslogtreecommitdiff
path: root/noncore
authorwimpie <wimpie>2004-08-12 12:46:55 (UTC)
committer wimpie <wimpie>2004-08-12 12:46:55 (UTC)
commit8f215ba9ceb395f262517855a99d7d2d303ca760 (patch) (unidiff)
treeaa5f9b14c249217b4d3fc30f4771bdaf1c3545d3 /noncore
parentef64880308b5035cc8ca2e4e79325db613af525b (diff)
downloadopie-8f215ba9ceb395f262517855a99d7d2d303ca760.zip
opie-8f215ba9ceb395f262517855a99d7d2d303ca760.tar.gz
opie-8f215ba9ceb395f262517855a99d7d2d303ca760.tar.bz2
MANY changes
- now generates peers/pap-chap secrets files (no chatscript yet) (not all usefull ppp options included yet) - still not ready for prime time yet
Diffstat (limited to 'noncore') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NNI.cpp8
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NNI.h14
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.cpp8
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.h14
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h3
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp38
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetooth_NN.h23
-rw-r--r--noncore/settings/networksettings2/cable/cable_NN.cpp11
-rw-r--r--noncore/settings/networksettings2/cable/cable_NN.h8
-rw-r--r--noncore/settings/networksettings2/cable/cable_NNI.cpp30
-rw-r--r--noncore/settings/networksettings2/cable/cable_NNI.h20
-rw-r--r--noncore/settings/networksettings2/cable/cablerun.cpp6
-rw-r--r--noncore/settings/networksettings2/cable/cablerun.h8
-rw-r--r--noncore/settings/networksettings2/irda/irda_NN.cpp11
-rw-r--r--noncore/settings/networksettings2/irda/irda_NN.h8
-rw-r--r--noncore/settings/networksettings2/irda/irda_NNI.cpp6
-rw-r--r--noncore/settings/networksettings2/irda/irda_NNI.h16
-rw-r--r--noncore/settings/networksettings2/irda/irdarun.h3
-rw-r--r--noncore/settings/networksettings2/lancard/lancard_NN.cpp23
-rw-r--r--noncore/settings/networksettings2/lancard/lancard_NN.h17
-rw-r--r--noncore/settings/networksettings2/lancard/lancard_NNI.cpp6
-rw-r--r--noncore/settings/networksettings2/lancard/lancard_NNI.h15
-rw-r--r--noncore/settings/networksettings2/main.cpp16
-rw-r--r--noncore/settings/networksettings2/modem/modem_NN.cpp11
-rw-r--r--noncore/settings/networksettings2/modem/modem_NN.h8
-rw-r--r--noncore/settings/networksettings2/modem/modem_NNI.cpp6
-rw-r--r--noncore/settings/networksettings2/modem/modem_NNI.h16
-rw-r--r--noncore/settings/networksettings2/modem/modemrun.h3
-rw-r--r--noncore/settings/networksettings2/network/network_NN.cpp42
-rw-r--r--noncore/settings/networksettings2/network/network_NN.h15
-rw-r--r--noncore/settings/networksettings2/network/network_NNI.cpp68
-rw-r--r--noncore/settings/networksettings2/network/network_NNI.h19
-rw-r--r--noncore/settings/networksettings2/networksettings.cpp42
-rw-r--r--noncore/settings/networksettings2/networksettings.h3
-rw-r--r--noncore/settings/networksettings2/networksettings.pro3
-rw-r--r--noncore/settings/networksettings2/networksettings2/Utils.h1
-rw-r--r--noncore/settings/networksettings2/networksettings2/asline.h2
-rw-r--r--noncore/settings/networksettings2/networksettings2/netnode.cpp21
-rw-r--r--noncore/settings/networksettings2/networksettings2/netnode.h268
-rw-r--r--noncore/settings/networksettings2/networksettings2/resources.cpp13
-rw-r--r--noncore/settings/networksettings2/networksettings2/resources.h5
-rw-r--r--noncore/settings/networksettings2/networksettings2/system.cpp14
-rw-r--r--noncore/settings/networksettings2/networksettings2/systemfile.cpp30
-rw-r--r--noncore/settings/networksettings2/networksettings2/systemfile.h11
-rw-r--r--noncore/settings/networksettings2/nsdata.cpp416
-rw-r--r--noncore/settings/networksettings2/nsdata.h11
-rw-r--r--noncore/settings/networksettings2/ppp/PPPAuthGUI.ui150
-rw-r--r--noncore/settings/networksettings2/ppp/PPPAuthedit.cpp42
-rw-r--r--noncore/settings/networksettings2/ppp/PPPAuthedit.h2
-rw-r--r--noncore/settings/networksettings2/ppp/ppp_NN.cpp31
-rw-r--r--noncore/settings/networksettings2/ppp/ppp_NN.h13
-rw-r--r--noncore/settings/networksettings2/ppp/ppp_NNI.cpp108
-rw-r--r--noncore/settings/networksettings2/ppp/ppp_NNI.h21
-rw-r--r--noncore/settings/networksettings2/profile/profile_NN.cpp13
-rw-r--r--noncore/settings/networksettings2/profile/profile_NN.h8
-rw-r--r--noncore/settings/networksettings2/profile/profile_NNI.cpp27
-rw-r--r--noncore/settings/networksettings2/profile/profile_NNI.h23
-rw-r--r--noncore/settings/networksettings2/usb/usb_NN.cpp23
-rw-r--r--noncore/settings/networksettings2/usb/usb_NN.h7
-rw-r--r--noncore/settings/networksettings2/usb/usb_NNI.cpp23
-rw-r--r--noncore/settings/networksettings2/usb/usb_NNI.h18
-rw-r--r--noncore/settings/networksettings2/vpn/vpn_NN.cpp14
-rw-r--r--noncore/settings/networksettings2/vpn/vpn_NN.h8
-rw-r--r--noncore/settings/networksettings2/vpn/vpn_NNI.cpp6
-rw-r--r--noncore/settings/networksettings2/vpn/vpn_NNI.h16
-rw-r--r--noncore/settings/networksettings2/wlan/wlan_NN.cpp23
-rw-r--r--noncore/settings/networksettings2/wlan/wlan_NN.h9
-rw-r--r--noncore/settings/networksettings2/wlan/wlan_NNI.cpp35
-rw-r--r--noncore/settings/networksettings2/wlan/wlan_NNI.h20
69 files changed, 1049 insertions, 931 deletions
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NNI.cpp b/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NNI.cpp
index d8420b9..398dcdc 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NNI.cpp
+++ b/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NNI.cpp
@@ -42,9 +42 @@ void ABluetoothBNEP::commit( void ) {
42} }
43
44bool ABluetoothBNEP::hasDataFor( const QString & ) {
45 return 0;
46}
47
48bool ABluetoothBNEP::generateDataForCommonFile( SystemFile & , long ){
49 return 0;
50}
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NNI.h b/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NNI.h
index bb3e7e7..1bf0f48 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NNI.h
+++ b/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NNI.h
@@ -16,2 +16,7 @@ public :
16 16
17 RuntimeInfo * runtime( void )
18 { return
19 ( RT ) ? RT : ( RT = new BluetoothBNEPRun( this, Data ) );
20 }
21
17 QWidget * edit( QWidget * parent ); 22 QWidget * edit( QWidget * parent );
@@ -20,8 +25,2 @@ public :
20 25
21 RuntimeInfo * runtime( void )
22 { if( RT == 0 )
23 RT = new BluetoothBNEPRun( this, Data );
24 return RT;
25 }
26
27 virtual void * data( void ) 26 virtual void * data( void )
@@ -29,5 +28,2 @@ public :
29 28
30 virtual bool hasDataFor( const QString & S );
31 virtual bool generateDataForCommonFile( SystemFile & SF, long );
32
33protected : 29protected :
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.cpp b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.cpp
index cff2639..7ec8288 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.cpp
+++ b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.cpp
@@ -30,9 +30 @@ void ABluetoothRFCOMM::commit( void ) {
30} }
31
32bool ABluetoothRFCOMM::hasDataFor( const QString & ) {
33 return 0;
34}
35
36bool ABluetoothRFCOMM::generateDataForCommonFile( SystemFile & , long ){
37 return 0;
38}
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.h b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.h
index 97bd29c..820fc17 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.h
+++ b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.h
@@ -16,2 +16,7 @@ public :
16 16
17 RuntimeInfo * runtime( void )
18 { return
19 ( RT ) ? RT : ( RT = new BluetoothRFCOMMRun( this, Data ) );
20 }
21
17 QWidget * edit( QWidget * parent ); 22 QWidget * edit( QWidget * parent );
@@ -20,8 +25,2 @@ public :
20 25
21 RuntimeInfo * runtime( void )
22 { if( RT == 0 )
23 RT = new BluetoothRFCOMMRun( this, Data );
24 return RT;
25 }
26
27 virtual void * data( void ) 26 virtual void * data( void )
@@ -29,5 +28,2 @@ public :
29 28
30 virtual bool hasDataFor( const QString & S );
31 virtual bool generateDataForCommonFile( SystemFile & SF, long );
32
33protected : 29protected :
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h
index aff1f59..65fd686 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h
+++ b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h
@@ -14,2 +14,5 @@ public :
14 14
15 virtual QString deviceFile( void )
16 { return QString( "/dev/rfcomm..." ); }
17
15protected : 18protected :
diff --git a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp
index b59b4f0..443a627 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp
+++ b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp
@@ -48,25 +48,2 @@ const char * BluetoothBNEPNetNode::provides( void ) {
48 48
49bool BluetoothBNEPNetNode::generateProperFilesFor(
50 ANetNodeInstance * ) {
51 return 0;
52}
53
54bool BluetoothBNEPNetNode::hasDataFor( const QString & S ) {
55 return S == "interfaces";
56}
57
58bool BluetoothBNEPNetNode::generateDeviceDataForCommonFile(
59 SystemFile & S ,
60 long DevNr) {
61 QString NIC = genNic( DevNr );
62
63 if( S.name() == "interfaces" ) {
64 // generate mapping stanza for this interface
65 S << "# check if " << NIC << " can be brought UP" << endl;
66 S << "mapping " << NIC << endl;
67 S << " script networksettings2-request" << endl << endl;
68 }
69 return 0;
70}
71
72QString BluetoothBNEPNetNode::genNic( long nr ) { 49QString BluetoothBNEPNetNode::genNic( long nr ) {
@@ -126,17 +103,2 @@ const char * BluetoothRFCOMMNetNode::provides( void ) {
126 103
127bool BluetoothRFCOMMNetNode::generateProperFilesFor(
128 ANetNodeInstance * ) {
129 return 0;
130}
131
132bool BluetoothRFCOMMNetNode::hasDataFor( const QString & ) {
133 return 0;
134}
135
136bool BluetoothRFCOMMNetNode::generateDeviceDataForCommonFile(
137 SystemFile & ,
138 long ) {
139 return 0;
140}
141
142void BluetoothRFCOMMNetNode::setSpecificAttribute( QString &, QString & ) { 104void BluetoothRFCOMMNetNode::setSpecificAttribute( QString &, QString & ) {
diff --git a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h
index 2e5e1d2..4d6a3c1 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h
+++ b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h
@@ -16,2 +16,5 @@ public:
16 16
17 virtual QString genNic( long );
18 virtual long instanceCount( void )
19 { return InstanceCount; }
17 virtual const QString pixmapName() 20 virtual const QString pixmapName()
@@ -20,16 +23,5 @@ public:
20 virtual const QString nodeDescription() ; 23 virtual const QString nodeDescription() ;
21
22 virtual ANetNodeInstance * createInstance( void ); 24 virtual ANetNodeInstance * createInstance( void );
23
24 virtual const char ** needs( void );
25 virtual const char * provides( void ); 25 virtual const char * provides( void );
26 26 virtual const char ** needs( void );
27 virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
28 virtual bool hasDataFor( const QString & S );
29 virtual bool generateDeviceDataForCommonFile(
30 SystemFile & , long DevNr );
31
32 virtual long instanceCount( void )
33 { return InstanceCount; }
34 virtual QString genNic( long );
35 27
@@ -58,5 +50,3 @@ public:
58 virtual const QString nodeDescription() ; 50 virtual const QString nodeDescription() ;
59
60 virtual ANetNodeInstance * createInstance( void ); 51 virtual ANetNodeInstance * createInstance( void );
61
62 virtual const char ** needs( void ); 52 virtual const char ** needs( void );
@@ -64,7 +54,2 @@ public:
64 54
65 virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
66 virtual bool hasDataFor( const QString & S );
67 virtual bool generateDeviceDataForCommonFile(
68 SystemFile & , long );
69
70private: 55private:
diff --git a/noncore/settings/networksettings2/cable/cable_NN.cpp b/noncore/settings/networksettings2/cable/cable_NN.cpp
index b8c690b..38568df 100644
--- a/noncore/settings/networksettings2/cable/cable_NN.cpp
+++ b/noncore/settings/networksettings2/cable/cable_NN.cpp
@@ -38,13 +38,2 @@ const char * CableNetNode::provides( void ) {
38 38
39bool CableNetNode::generateProperFilesFor(
40 ANetNodeInstance * ) {
41 return 0;
42}
43
44bool CableNetNode::generateDeviceDataForCommonFile(
45 SystemFile & ,
46 long ) {
47 return 0;
48}
49
50void CableNetNode::setSpecificAttribute( QString & , QString & ) { 39void CableNetNode::setSpecificAttribute( QString & , QString & ) {
diff --git a/noncore/settings/networksettings2/cable/cable_NN.h b/noncore/settings/networksettings2/cable/cable_NN.h
index c48037a..5cc2b2d 100644
--- a/noncore/settings/networksettings2/cable/cable_NN.h
+++ b/noncore/settings/networksettings2/cable/cable_NN.h
@@ -20,5 +20,3 @@ public:
20 virtual const QString nodeDescription() ; 20 virtual const QString nodeDescription() ;
21
22 virtual ANetNodeInstance * createInstance( void ); 21 virtual ANetNodeInstance * createInstance( void );
23
24 virtual const char ** needs( void ); 22 virtual const char ** needs( void );
@@ -26,8 +24,2 @@ public:
26 24
27 virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
28 virtual bool hasDataFor( const QString & )
29 { return 0; }
30 virtual bool generateDeviceDataForCommonFile(
31 SystemFile & SF, long DevNr);
32
33private: 25private:
diff --git a/noncore/settings/networksettings2/cable/cable_NNI.cpp b/noncore/settings/networksettings2/cable/cable_NNI.cpp
index ca21135..4bd9421 100644
--- a/noncore/settings/networksettings2/cable/cable_NNI.cpp
+++ b/noncore/settings/networksettings2/cable/cable_NNI.cpp
@@ -51,2 +51,25 @@ void ACable::saveSpecificAttribute( QTextStream & TS ) {
51 51
52short ACable::generateFileEmbedded( const QString & ID,
53 const QString & Path,
54 QTextStream & TS,
55 long DevNr ) {
56 short rvl, rvd;
57
58 rvl = 1;
59 if( ID == "peers" ) {
60 TS << Data.Device
61 << endl;
62 TS << Data.Speed
63 << endl;
64 TS << "lock "
65 << Data.LockFile
66 << endl;
67 rvl = 0;
68 }
69
70 rvd = ANetNodeInstance::generateFileEmbedded( ID, Path, TS, DevNr );
71 return (rvd == 2 || rvl == 2 ) ? 2 :
72 (rvd == 0 || rvl == 0 ) ? 0 : 1;
73}
74
52QWidget * ACable::edit( QWidget * parent ) { 75QWidget * ACable::edit( QWidget * parent ) {
@@ -66,8 +89 @@ void ACable::commit( void ) {
66} }
67
68bool ACable::generateDataForCommonFile(
69 SystemFile & ,
70 long ) {
71 return 1;
72}
73
diff --git a/noncore/settings/networksettings2/cable/cable_NNI.h b/noncore/settings/networksettings2/cable/cable_NNI.h
index bf3e292..d06cbbe 100644
--- a/noncore/settings/networksettings2/cable/cable_NNI.h
+++ b/noncore/settings/networksettings2/cable/cable_NNI.h
@@ -16,2 +16,7 @@ public :
16 16
17 RuntimeInfo * runtime( void )
18 { return
19 ( RT ) ? RT : ( RT = new CableRun( this, Data ) );
20 }
21
17 QWidget * edit( QWidget * parent ); 22 QWidget * edit( QWidget * parent );
@@ -20,8 +25,2 @@ public :
20 25
21 RuntimeInfo * runtime( void )
22 { if( RT == 0 )
23 RT = new CableRun( this, Data );
24 return RT;
25 }
26
27 virtual void * data( void ) 26 virtual void * data( void )
@@ -29,7 +28,6 @@ public :
29 28
30 virtual bool hasDataFor( const QString & ) 29 short generateFileEmbedded( const QString & ID,
31 { return 0; } 30 const QString & Path,
32 virtual bool generateDataForCommonFile( 31 QTextStream & TS,
33 SystemFile & SF, long DevNr ); 32 long DevNr );
34
35protected : 33protected :
diff --git a/noncore/settings/networksettings2/cable/cablerun.cpp b/noncore/settings/networksettings2/cable/cablerun.cpp
index 5e99237..85660f6 100644
--- a/noncore/settings/networksettings2/cable/cablerun.cpp
+++ b/noncore/settings/networksettings2/cable/cablerun.cpp
@@ -6,3 +6,3 @@ void CableRun::detectState( NodeCollection * NC ) {
6 6
7 int fd = open( D->Device.latin1(), O_RDWR ); 7 int fd = open( Data->Device.latin1(), O_RDWR );
8 8
@@ -26 +26,5 @@ bool CableRun::canSetState( State_t , Action_t ) {
26} 26}
27
28QString CableRun::deviceFile( void ) {
29 return Data->Device;
30}
diff --git a/noncore/settings/networksettings2/cable/cablerun.h b/noncore/settings/networksettings2/cable/cablerun.h
index c5b59d5..20608f6 100644
--- a/noncore/settings/networksettings2/cable/cablerun.h
+++ b/noncore/settings/networksettings2/cable/cablerun.h
@@ -8,4 +8,4 @@ public :
8 CableRun( ANetNodeInstance * NNI, 8 CableRun( ANetNodeInstance * NNI,
9 CableData & Data ) : AsLine( NNI ) 9 CableData_t & D ) : AsLine( NNI )
10 { D = &Data; } 10 { Data = &D; }
11 11
@@ -14,2 +14,4 @@ public :
14 14
15 virtual QString deviceFile( void );
16
15protected : 17protected :
@@ -22,3 +24,3 @@ private :
22 24
23 CableData_t * D; 25 CableData_t * Data;
24}; 26};
diff --git a/noncore/settings/networksettings2/irda/irda_NN.cpp b/noncore/settings/networksettings2/irda/irda_NN.cpp
index 49bc06e..9483e22 100644
--- a/noncore/settings/networksettings2/irda/irda_NN.cpp
+++ b/noncore/settings/networksettings2/irda/irda_NN.cpp
@@ -38,13 +38,2 @@ const char * IRDANetNode::provides( void ) {
38 38
39bool IRDANetNode::generateProperFilesFor(
40 ANetNodeInstance * ) {
41 return 0;
42}
43
44bool IRDANetNode::generateDeviceDataForCommonFile(
45 SystemFile & ,
46 long ) {
47 return 0;
48}
49
50void IRDANetNode::setSpecificAttribute( QString & , QString & ) { 39void IRDANetNode::setSpecificAttribute( QString & , QString & ) {
diff --git a/noncore/settings/networksettings2/irda/irda_NN.h b/noncore/settings/networksettings2/irda/irda_NN.h
index fa6408d..900bbc6 100644
--- a/noncore/settings/networksettings2/irda/irda_NN.h
+++ b/noncore/settings/networksettings2/irda/irda_NN.h
@@ -20,5 +20,3 @@ public:
20 virtual const QString nodeDescription() ; 20 virtual const QString nodeDescription() ;
21
22 virtual ANetNodeInstance * createInstance( void ); 21 virtual ANetNodeInstance * createInstance( void );
23
24 virtual const char ** needs( void ); 22 virtual const char ** needs( void );
@@ -26,8 +24,2 @@ public:
26 24
27 virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
28 virtual bool hasDataFor( const QString & )
29 { return 0; }
30 virtual bool generateDeviceDataForCommonFile(
31 SystemFile & SF, long DevNr );
32
33private: 25private:
diff --git a/noncore/settings/networksettings2/irda/irda_NNI.cpp b/noncore/settings/networksettings2/irda/irda_NNI.cpp
index f00a1d5..9cf443b 100644
--- a/noncore/settings/networksettings2/irda/irda_NNI.cpp
+++ b/noncore/settings/networksettings2/irda/irda_NNI.cpp
@@ -31,7 +31 @@ void AIRDA::commit( void ) {
31
32bool AIRDA::generateDataForCommonFile(
33 SystemFile & ,
34 long ) {
35 return 1;
36}
37
diff --git a/noncore/settings/networksettings2/irda/irda_NNI.h b/noncore/settings/networksettings2/irda/irda_NNI.h
index 210d87d..e21b68f 100644
--- a/noncore/settings/networksettings2/irda/irda_NNI.h
+++ b/noncore/settings/networksettings2/irda/irda_NNI.h
@@ -16,2 +16,7 @@ public :
16 16
17 RuntimeInfo * runtime( void )
18 { return
19 ( RT ) ? RT : ( RT = new IRDARun( this, Data ) );
20 }
21
17 QWidget * edit( QWidget * parent ); 22 QWidget * edit( QWidget * parent );
@@ -20,8 +25,2 @@ public :
20 25
21 RuntimeInfo * runtime( void )
22 { if( RT == 0 )
23 RT = new IRDARun( this, Data );
24 return RT;
25 }
26
27 virtual void * data( void ) 26 virtual void * data( void )
@@ -29,7 +28,2 @@ public :
29 28
30 virtual bool hasDataFor( const QString & )
31 { return 0; }
32 virtual bool generateDataForCommonFile(
33 SystemFile & SF, long DevNr );
34
35protected : 29protected :
diff --git a/noncore/settings/networksettings2/irda/irdarun.h b/noncore/settings/networksettings2/irda/irdarun.h
index 4c903cc..4258aff 100644
--- a/noncore/settings/networksettings2/irda/irdarun.h
+++ b/noncore/settings/networksettings2/irda/irdarun.h
@@ -14,2 +14,5 @@ public :
14 14
15 virtual QString deviceFile( void )
16 { return QString( "/dev/irda" ); }
17
15protected : 18protected :
diff --git a/noncore/settings/networksettings2/lancard/lancard_NN.cpp b/noncore/settings/networksettings2/lancard/lancard_NN.cpp
index 05cd06d..20ae7f6 100644
--- a/noncore/settings/networksettings2/lancard/lancard_NN.cpp
+++ b/noncore/settings/networksettings2/lancard/lancard_NN.cpp
@@ -40,25 +40,2 @@ const char * LanCardNetNode::provides( void ) {
40 40
41bool LanCardNetNode::generateProperFilesFor(
42 ANetNodeInstance * ) {
43 return 0;
44}
45
46bool LanCardNetNode::hasDataFor( const QString & S ) {
47 return S == "interfaces";
48}
49
50bool LanCardNetNode::generateDeviceDataForCommonFile(
51 SystemFile & S ,
52 long DevNr ) {
53 QString NIC = genNic( DevNr );
54
55 if( S.name() == "interfaces" ) {
56 // generate mapping stanza for this interface
57 S << "# check if " << NIC << " can be brought UP" << endl;
58 S << "mapping " << NIC << endl;
59 S << " script networksettings2-request" << endl << endl;
60 }
61 return 0;
62}
63
64QString LanCardNetNode::genNic( long nr ) { 41QString LanCardNetNode::genNic( long nr ) {
diff --git a/noncore/settings/networksettings2/lancard/lancard_NN.h b/noncore/settings/networksettings2/lancard/lancard_NN.h
index d58823c..6882af7 100644
--- a/noncore/settings/networksettings2/lancard/lancard_NN.h
+++ b/noncore/settings/networksettings2/lancard/lancard_NN.h
@@ -20,6 +20,8 @@ public:
20 20
21 virtual const QString nodeDescription() ; 21 virtual QString genNic( long );
22 virtual long instanceCount( void )
23 { return InstanceCount; }
22 24
25 virtual const QString nodeDescription() ;
23 virtual ANetNodeInstance * createInstance( void ); 26 virtual ANetNodeInstance * createInstance( void );
24
25 virtual const char ** needs( void ); 27 virtual const char ** needs( void );
@@ -27,12 +29,3 @@ public:
27 29
28 virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); 30 QStringList & addressesOfNIC( void )
29 virtual bool hasDataFor( const QString & S );
30 virtual bool generateDeviceDataForCommonFile(
31 SystemFile & SF, long DevNr );
32
33 virtual long instanceCount( void )
34 { return InstanceCount; }
35
36 virtual QString genNic( long );
37 virtual QStringList & addressesOfNIC( void )
38 { return NICMACAddresses; } 31 { return NICMACAddresses; }
diff --git a/noncore/settings/networksettings2/lancard/lancard_NNI.cpp b/noncore/settings/networksettings2/lancard/lancard_NNI.cpp
index 99c033e..9fb05b9 100644
--- a/noncore/settings/networksettings2/lancard/lancard_NNI.cpp
+++ b/noncore/settings/networksettings2/lancard/lancard_NNI.cpp
@@ -45,7 +45 @@ void ALanCard::commit( void ) {
45
46bool ALanCard::generateDataForCommonFile(
47 SystemFile & ,
48 long ) {
49 return 1;
50}
51
diff --git a/noncore/settings/networksettings2/lancard/lancard_NNI.h b/noncore/settings/networksettings2/lancard/lancard_NNI.h
index 4e91523..8e55a19 100644
--- a/noncore/settings/networksettings2/lancard/lancard_NNI.h
+++ b/noncore/settings/networksettings2/lancard/lancard_NNI.h
@@ -16,2 +16,7 @@ public :
16 16
17 RuntimeInfo * runtime( void )
18 { return
19 ( RT ) ? RT : ( RT = new LanCardRun( this, Data ) );
20 }
21
17 QWidget * edit( QWidget * parent ); 22 QWidget * edit( QWidget * parent );
@@ -20,8 +25,2 @@ public :
20 25
21 RuntimeInfo * runtime( void )
22 { if( RT == 0 )
23 RT = new LanCardRun( this, Data );
24 return RT;
25 }
26
27 virtual void * data( void ) 26 virtual void * data( void )
@@ -29,6 +28,2 @@ public :
29 28
30 virtual bool hasDataFor( const QString & )
31 { return 0; }
32 virtual bool generateDataForCommonFile(
33 SystemFile & S, long DevNr );
34protected : 29protected :
diff --git a/noncore/settings/networksettings2/main.cpp b/noncore/settings/networksettings2/main.cpp
index 6c969fc..b32b323 100644
--- a/noncore/settings/networksettings2/main.cpp
+++ b/noncore/settings/networksettings2/main.cpp
@@ -2,2 +2,3 @@
2#include "activateprofile.h" 2#include "activateprofile.h"
3#include "activatevpn.h"
3#include "networksettings.h" 4#include "networksettings.h"
@@ -23,2 +24,4 @@ OPIE_EXPORT_APP( OApplicationFactory<NetworkSettings> )
23#define ACT_PROMPT 3 24#define ACT_PROMPT 3
25// used by interfaces to trigger VPN
26#define ACT_VPN 4
24 27
@@ -46,2 +49,5 @@ int main( int argc, char * argv[] ) {
46 rmv = 1; 49 rmv = 1;
50 } else if( strcmp( argv[i], "--triggervpn" ) == 0 ) {
51 Action = ACT_VPN;
52 rmv = 1;
47 } 53 }
@@ -80,6 +86,4 @@ int main( int argc, char * argv[] ) {
80 { NetworkSettingsData NS; 86 { NetworkSettingsData NS;
81 Log(("ACT_REQUEST\n"));
82 if( NS.canStart( argv[1] ) ) { 87 if( NS.canStart( argv[1] ) ) {
83 QString S; 88 QString S;
84 Log(("NEED FOR PROMPT\n" ));
85 S.sprintf( QPEApplication::qpeDir()+ 89 S.sprintf( QPEApplication::qpeDir()+
@@ -99,3 +103,2 @@ int main( int argc, char * argv[] ) {
99 { NetworkSettingsData NS; 103 { NetworkSettingsData NS;
100 Log(("REGEN\n" ));
101 // regen returns 0 if OK 104 // regen returns 0 if OK
@@ -106,3 +109,2 @@ int main( int argc, char * argv[] ) {
106 { ActivateProfile AP(argv[1]); 109 { ActivateProfile AP(argv[1]);
107 Log(("PROMPT\n" ));
108 if( AP.exec() == QDialog::Accepted ) { 110 if( AP.exec() == QDialog::Accepted ) {
@@ -114,5 +116,9 @@ int main( int argc, char * argv[] ) {
114 break; 116 break;
117 case ACT_VPN :
118 { ActivateVPN AVPN;
119 AVPN.exec();
120 }
121 break;
115 case ACT_GUI : 122 case ACT_GUI :
116 { QWidget * W = new NetworkSettings(0); 123 { QWidget * W = new NetworkSettings(0);
117 Log(("GUI\n" ));
118 TheApp->setMainWidget( W ); 124 TheApp->setMainWidget( W );
diff --git a/noncore/settings/networksettings2/modem/modem_NN.cpp b/noncore/settings/networksettings2/modem/modem_NN.cpp
index 18aa480..ee61b10 100644
--- a/noncore/settings/networksettings2/modem/modem_NN.cpp
+++ b/noncore/settings/networksettings2/modem/modem_NN.cpp
@@ -39,13 +39,2 @@ const char * ModemNetNode::provides( void ) {
39 39
40bool ModemNetNode::generateProperFilesFor(
41 ANetNodeInstance * ) {
42 return 0;
43}
44
45bool ModemNetNode::generateDeviceDataForCommonFile(
46 SystemFile & ,
47 long ) {
48 return 0;
49}
50
51void ModemNetNode::setSpecificAttribute( QString & , QString & ) { 40void ModemNetNode::setSpecificAttribute( QString & , QString & ) {
diff --git a/noncore/settings/networksettings2/modem/modem_NN.h b/noncore/settings/networksettings2/modem/modem_NN.h
index 2f496dd..a76525f 100644
--- a/noncore/settings/networksettings2/modem/modem_NN.h
+++ b/noncore/settings/networksettings2/modem/modem_NN.h
@@ -20,5 +20,3 @@ public:
20 virtual const QString nodeDescription() ; 20 virtual const QString nodeDescription() ;
21
22 virtual ANetNodeInstance * createInstance( void ); 21 virtual ANetNodeInstance * createInstance( void );
23
24 virtual const char ** needs( void ); 22 virtual const char ** needs( void );
@@ -26,8 +24,2 @@ public:
26 24
27 virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
28 virtual bool hasDataFor( const QString & )
29 { return 0; }
30 virtual bool generateDeviceDataForCommonFile(
31 SystemFile & SF, long DevNr );
32
33private: 25private:
diff --git a/noncore/settings/networksettings2/modem/modem_NNI.cpp b/noncore/settings/networksettings2/modem/modem_NNI.cpp
index 6c76b56..91df22b 100644
--- a/noncore/settings/networksettings2/modem/modem_NNI.cpp
+++ b/noncore/settings/networksettings2/modem/modem_NNI.cpp
@@ -31,7 +31 @@ void AModem::commit( void ) {
31
32bool AModem::generateDataForCommonFile(
33 SystemFile & ,
34 long ) {
35 return 1;
36}
37
diff --git a/noncore/settings/networksettings2/modem/modem_NNI.h b/noncore/settings/networksettings2/modem/modem_NNI.h
index a623704..ca7c279 100644
--- a/noncore/settings/networksettings2/modem/modem_NNI.h
+++ b/noncore/settings/networksettings2/modem/modem_NNI.h
@@ -16,2 +16,7 @@ public :
16 16
17 RuntimeInfo * runtime( void )
18 { return
19 ( RT ) ? RT : ( RT = new ModemRun( this, Data ) );
20 }
21
17 QWidget * edit( QWidget * parent ); 22 QWidget * edit( QWidget * parent );
@@ -20,8 +25,2 @@ public :
20 25
21 RuntimeInfo * runtime( void )
22 { if( RT == 0 )
23 RT = new ModemRun( this, Data );
24 return RT;
25 }
26
27 virtual void * data( void ) 26 virtual void * data( void )
@@ -29,7 +28,2 @@ public :
29 28
30 virtual bool hasDataFor( const QString & )
31 { return 0; }
32 virtual bool generateDataForCommonFile(
33 SystemFile & SF, long DevNr );
34
35protected : 29protected :
diff --git a/noncore/settings/networksettings2/modem/modemrun.h b/noncore/settings/networksettings2/modem/modemrun.h
index 336462e..491a677 100644
--- a/noncore/settings/networksettings2/modem/modemrun.h
+++ b/noncore/settings/networksettings2/modem/modemrun.h
@@ -14,2 +14,5 @@ public :
14 14
15 virtual QString deviceFile( void )
16 { return QString("/dev/modem"); }
17
15protected : 18protected :
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 +1,2 @@
1#include <asdevice.h>
1#include "network_NN.h" 2#include "network_NN.h"
@@ -32,19 +33,38 @@ ANetNodeInstance * NetworkNetNode::createInstance( void ) {
32 33
33const char ** NetworkNetNode::needs( void ) { 34bool NetworkNetNode::hasDataForFile( const QString & S ) {
34 return NetworkNeeds; 35 return S == "interfaces";
35} 36}
36 37
37const char * NetworkNetNode::provides( void ) { 38short NetworkNetNode::generateFile( const QString & ID,
38 return "connection"; 39 const QString & ,
39} 40 QTextStream & TS,
41 ANetNodeInstance * NNI,
42 long DevNr ) {
43
44 QString NIC = NNI->runtime()->device()->netNode()->nodeClass()->genNic( DevNr );
40 45
41bool NetworkNetNode::generateProperFilesFor( 46 if( ID == "interfaces" ) {
42 ANetNodeInstance * ) { 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;
43 return 0; 59 return 0;
44} 60}
61 return 1;
62}
45 63
46bool NetworkNetNode::generateDeviceDataForCommonFile( 64const char ** NetworkNetNode::needs( void ) {
47 SystemFile & , 65 return NetworkNeeds;
48 long ) { 66}
49 return 0; 67
68const char * NetworkNetNode::provides( void ) {
69 return "connection";
50} 70}
diff --git a/noncore/settings/networksettings2/network/network_NN.h b/noncore/settings/networksettings2/network/network_NN.h
index 6548c32..745d1a7 100644
--- a/noncore/settings/networksettings2/network/network_NN.h
+++ b/noncore/settings/networksettings2/network/network_NN.h
@@ -16,2 +16,9 @@ public:
16 16
17 virtual bool hasDataForFile( const QString & S );
18
19 virtual short generateFile( const QString & ID,
20 const QString & Path,
21 QTextStream & TS,
22 ANetNodeInstance * NNI,
23 long DevNr );
17 virtual const QString pixmapName() 24 virtual const QString pixmapName()
@@ -20,5 +27,3 @@ public:
20 virtual const QString nodeDescription() ; 27 virtual const QString nodeDescription() ;
21
22 virtual ANetNodeInstance * createInstance( void ); 28 virtual ANetNodeInstance * createInstance( void );
23
24 virtual const char ** needs( void ); 29 virtual const char ** needs( void );
@@ -26,8 +31,2 @@ public:
26 31
27 virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
28 virtual bool hasDataFor( const QString & )
29 { return 0; }
30 virtual bool generateDeviceDataForCommonFile(
31 SystemFile & SF, long DevNr );
32
33private: 32private:
diff --git a/noncore/settings/networksettings2/network/network_NNI.cpp b/noncore/settings/networksettings2/network/network_NNI.cpp
index 3e368a2..324c6e2 100644
--- a/noncore/settings/networksettings2/network/network_NNI.cpp
+++ b/noncore/settings/networksettings2/network/network_NNI.cpp
@@ -101,3 +101,3 @@ void ANetwork::commit( void ) {
101 101
102bool ANetwork::hasDataFor( const QString & S ) { 102bool ANetwork::hasDataForFile( const QString & S ) {
103 return S == "interfaces"; 103 return S == "interfaces";
@@ -105,9 +105,17 @@ bool ANetwork::hasDataFor( const QString & S ) {
105 105
106bool ANetwork::generateDataForCommonFile( SystemFile & S, long DevNr ) { 106short ANetwork::generateFile( const QString & ID,
107 const QString & Path,
108 QTextStream &TS,
109 long DevNr
110 ) {
111
112 short rvl, rvd ;
107 QString NIC = runtime()->device()->netNode()->nodeClass()->genNic( DevNr ); 113 QString NIC = runtime()->device()->netNode()->nodeClass()->genNic( DevNr );
108 114
109 if( S.name() == "interfaces" ) { 115 rvl = 1;
116 if( ID == "interfaces" ) {
117 Log(("Generate Network for %s\n", ID.latin1() ));
110 // we can safely call from here since device item is deeper 118 // we can safely call from here since device item is deeper
111 if( Data.UseDHCP ) { 119 if( Data.UseDHCP ) {
112 S << "iface " 120 TS << "iface "
113 << NIC 121 << NIC
@@ -117,3 +125,3 @@ bool ANetwork::generateDataForCommonFile( SystemFile & S, long DevNr ) {
117 << endl; 125 << endl;
118 S << " up echo \"" 126 TS << " up echo \""
119 << NIC 127 << NIC
@@ -124,3 +132,3 @@ bool ANetwork::generateDataForCommonFile( SystemFile & S, long DevNr ) {
124 if( Data.SendHostname ) { 132 if( Data.SendHostname ) {
125 S << " hostname " 133 TS << " hostname "
126 << Data.Hostname 134 << Data.Hostname
@@ -129,3 +137,3 @@ bool ANetwork::generateDataForCommonFile( SystemFile & S, long DevNr ) {
129 137
130 S << " down rm -f /tmp/profile-" 138 TS << " down rm -f /tmp/profile-"
131 << connection()->number() 139 << connection()->number()
@@ -134,3 +142,3 @@ bool ANetwork::generateDataForCommonFile( SystemFile & S, long DevNr ) {
134 } else { 142 } else {
135 S << "iface " 143 TS << "iface "
136 << NIC << "-c" 144 << NIC << "-c"
@@ -139,3 +147,3 @@ bool ANetwork::generateDataForCommonFile( SystemFile & S, long DevNr ) {
139 << endl; 147 << endl;
140 S << " up echo \"" 148 TS << " up echo \""
141 << NIC 149 << NIC
@@ -145,3 +153,3 @@ bool ANetwork::generateDataForCommonFile( SystemFile & S, long DevNr ) {
145 << endl; 153 << endl;
146 S << " down rm -f /tmp/profile-" 154 TS << " down rm -f /tmp/profile-"
147 << connection()->number() 155 << connection()->number()
@@ -149,5 +157,11 @@ bool ANetwork::generateDataForCommonFile( SystemFile & S, long DevNr ) {
149 << endl; 157 << endl;
150 S << " address " << Data.IPAddress << endl; 158 TS << " address "
151 S << " broadcast " << Data.Broadcast << endl; 159 << Data.IPAddress
152 S << " netmask " << Data.NetMask << endl; 160 << endl;
161 TS << " broadcast "
162 << Data.Broadcast
163 << endl;
164 TS << " netmask "
165 << Data.NetMask
166 << endl;
153 167
@@ -163,3 +177,5 @@ bool ANetwork::generateDataForCommonFile( SystemFile & S, long DevNr ) {
163 arg( ipal[3].toShort() & nmal[3].toShort() ); 177 arg( ipal[3].toShort() & nmal[3].toShort() );
164 S << " network " << NW << endl; 178 TS << " network "
179 << NW
180 << endl;
165 } 181 }
@@ -169,3 +185,5 @@ bool ANetwork::generateDataForCommonFile( SystemFile & S, long DevNr ) {
169 ++it ) { 185 ++it ) {
170 S << " pre-up " << (*it) << endl; 186 TS << " pre-up "
187 << (*it)
188 << endl;
171 } 189 }
@@ -174,3 +192,5 @@ bool ANetwork::generateDataForCommonFile( SystemFile & S, long DevNr ) {
174 ++it ) { 192 ++it ) {
175 S << " up " << (*it) << endl; 193 TS << " up "
194 << (*it)
195 << endl;
176 } 196 }
@@ -179,3 +199,5 @@ bool ANetwork::generateDataForCommonFile( SystemFile & S, long DevNr ) {
179 ++it ) { 199 ++it ) {
180 S << " down " << (*it) << endl; 200 TS << " down "
201 << (*it)
202 << endl;
181 } 203 }
@@ -184,6 +206,14 @@ bool ANetwork::generateDataForCommonFile( SystemFile & S, long DevNr ) {
184 ++it ) { 206 ++it ) {
185 S << " post-down " << (*it) << endl; 207 TS << " post-down "
208 << (*it)
209 << endl;
186 } 210 }
211 rvl = 0;
187 } 212 }
188 return 0; 213
214 // embed other info in it
215 rvd = connection()->getToplevel()->generateFileEmbedded( ID, Path, TS, DevNr );
216
217 return (rvd == 2 || rvl == 2 ) ? 2 :
218 (rvd == 0 || rvl == 0 ) ? 0 : 1;
189} 219}
diff --git a/noncore/settings/networksettings2/network/network_NNI.h b/noncore/settings/networksettings2/network/network_NNI.h
index 0058793..5e42503 100644
--- a/noncore/settings/networksettings2/network/network_NNI.h
+++ b/noncore/settings/networksettings2/network/network_NNI.h
@@ -17,2 +17,7 @@ public :
17 17
18 RuntimeInfo * runtime( void )
19 { return
20 ( RT ) ? RT : ( RT = new NetworkRun( this, Data ) );
21 }
22
18 QWidget * edit( QWidget * parent ); 23 QWidget * edit( QWidget * parent );
@@ -21,8 +26,2 @@ public :
21 26
22 RuntimeInfo * runtime( void )
23 { if( RT == 0 )
24 RT = new NetworkRun( this, Data );
25 return RT;
26 }
27
28 virtual void * data( void ) 27 virtual void * data( void )
@@ -30,5 +29,7 @@ public :
30 29
31 virtual bool hasDataFor( const QString & S ); 30 virtual bool hasDataForFile( const QString & S );
32 virtual bool generateDataForCommonFile( 31 virtual short generateFile( const QString & ID,
33 SystemFile & SF, long DevNr ); 32 const QString & Path,
33 QTextStream &TS,
34 long DevNr );
34 35
diff --git a/noncore/settings/networksettings2/networksettings.cpp b/noncore/settings/networksettings2/networksettings.cpp
index 6ee4106..ce0eabc 100644
--- a/noncore/settings/networksettings2/networksettings.cpp
+++ b/noncore/settings/networksettings2/networksettings.cpp
@@ -2,2 +2,3 @@
2#include <unistd.h> 2#include <unistd.h>
3#include <errno.h>
3 4
@@ -14,2 +15,3 @@
14#include <qtoolbutton.h> 15#include <qtoolbutton.h>
16#include <qevent.h>
15 17
@@ -43,2 +45,9 @@ NetworkSettings::NetworkSettings( QWidget *parent,
43 Profiles_LB->clear(); 45 Profiles_LB->clear();
46 QPEApplication::setStylusOperation(
47 Profiles_LB->viewport(), QPEApplication::RightOnHold );
48
49 connect( Profiles_LB,
50 SIGNAL(rightButtonPressed(QListBoxItem*,const QPoint&)),
51 this, SLOT(SLOT_EditNode(QListBoxItem*)) );
52
44 { Name2Connection_t & M = NSResources->connections(); 53 { Name2Connection_t & M = NSResources->connections();
@@ -80,11 +89,3 @@ NetworkSettings::~NetworkSettings() {
80 89
81 S = NSD.generateSettings(); 90 if( isModified() ) {
82 if( ! S.isEmpty() ) {
83 QMessageBox::warning(
84 0,
85 tr( "In System Config" ),
86 S
87 );
88 }
89
90 S = NSD.saveSettings(); 91 S = NSD.saveSettings();
@@ -96,2 +97,6 @@ NetworkSettings::~NetworkSettings() {
96 } 97 }
98
99 SLOT_GenerateConfig();
100 }
101
97} 102}
@@ -147,5 +152,2 @@ void NetworkSettings::SLOT_RefreshStates( void ) {
147 152
148void NetworkSettings::SLOT_NoLongerBusy( void ) {
149 NSResources->busy( FALSE );
150}
151void NetworkSettings::SLOT_AddNode( void ) { 153void NetworkSettings::SLOT_AddNode( void ) {
@@ -168,3 +170,2 @@ void NetworkSettings::SLOT_DeleteNode( void ) {
168 setModified( 1 ); 170 setModified( 1 );
169 NSD.forceGeneration(1);
170 } 171 }
@@ -174,2 +175,4 @@ void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) {
174 QString OldName = ""; 175 QString OldName = "";
176
177 printf( "------------------ Edit NOde\n" );
175 EditConnection EC( this ); 178 EditConnection EC( this );
@@ -188,4 +191,3 @@ void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) {
188 UpdateTimer->stop(); 191 UpdateTimer->stop();
189 NSResources->busy( TRUE ); 192
190 QTimer::singleShot( 1000, this, SLOT( SLOT_NoLongerBusy() ));
191 // we need to retry 193 // we need to retry
@@ -321,11 +323,3 @@ void NetworkSettings::updateProfileState( QListBoxItem * LBI ) {
321void NetworkSettings::SLOT_GenerateConfig( void ) { 323void NetworkSettings::SLOT_GenerateConfig( void ) {
322 QString S = NSD.generateSettings( TRUE ); 324 NSD.regenerate();
323
324 if( ! S.isEmpty() ) {
325 QMessageBox::warning(
326 0,
327 tr( "Generating system configuration" ),
328 S
329 );
330 }
331} 325}
diff --git a/noncore/settings/networksettings2/networksettings.h b/noncore/settings/networksettings2/networksettings.h
index 8ffde06..8ec5d08 100644
--- a/noncore/settings/networksettings2/networksettings.h
+++ b/noncore/settings/networksettings2/networksettings.h
@@ -8,2 +8,3 @@ class QTimer;
8class QListBoxItem; 8class QListBoxItem;
9class QEvent;
9 10
@@ -30,3 +31,2 @@ public slots :
30 31
31 void SLOT_NoLongerBusy( void );
32 void SLOT_AddNode( void ); 32 void SLOT_AddNode( void );
@@ -52,3 +52,2 @@ private :
52 NetworkSettingsData NSD; 52 NetworkSettingsData NSD;
53
54}; 53};
diff --git a/noncore/settings/networksettings2/networksettings.pro b/noncore/settings/networksettings2/networksettings.pro
index ff147b1..f04289b 100644
--- a/noncore/settings/networksettings2/networksettings.pro
+++ b/noncore/settings/networksettings2/networksettings.pro
@@ -5,2 +5,3 @@ HEADERS = networksettings.h \
5 activateprofile.h \ 5 activateprofile.h \
6 activatevpn.h \
6 editconnection.h 7 editconnection.h
@@ -10,2 +11,3 @@ SOURCES = main.cpp \
10 activateprofile.cpp \ 11 activateprofile.cpp \
12 activatevpn.cpp \
11 editconnection.cpp 13 editconnection.cpp
@@ -16,2 +18,3 @@ INTERFACES = networksettingsGUI.ui \
16 editconnectionGUI.ui \ 18 editconnectionGUI.ui \
19 activatevpnGUI.ui \
17 activateprofileGUI.ui 20 activateprofileGUI.ui
diff --git a/noncore/settings/networksettings2/networksettings2/Utils.h b/noncore/settings/networksettings2/networksettings2/Utils.h
index 63ef51c..739476e 100644
--- a/noncore/settings/networksettings2/networksettings2/Utils.h
+++ b/noncore/settings/networksettings2/networksettings2/Utils.h
@@ -6,2 +6,3 @@ extern void VLog( char * Format, ... );
6extern void LogClose( void ); 6extern void LogClose( void );
7extern QString removeSpaces( const QString & X );
7 8
diff --git a/noncore/settings/networksettings2/networksettings2/asline.h b/noncore/settings/networksettings2/networksettings2/asline.h
index 6bd93ec..ee4de38 100644
--- a/noncore/settings/networksettings2/networksettings2/asline.h
+++ b/noncore/settings/networksettings2/networksettings2/asline.h
@@ -15,2 +15,4 @@ public :
15 15
16 virtual QString deviceFile( void ) = 0;
17
16}; 18};
diff --git a/noncore/settings/networksettings2/networksettings2/netnode.cpp b/noncore/settings/networksettings2/networksettings2/netnode.cpp
index 8c80e0b..4a2440a 100644
--- a/noncore/settings/networksettings2/networksettings2/netnode.cpp
+++ b/noncore/settings/networksettings2/networksettings2/netnode.cpp
@@ -146,3 +146,3 @@ NodeCollection::NodeCollection( QTextStream & TS ) :
146 } else if( A == "number" ) { 146 } else if( A == "number" ) {
147 Log(( "read number %s\n", N.latin1() )); 147 Log(( "Profile number %s\n", N.latin1() ));
148 setNumber( N.toLong() ); 148 setNumber( N.toLong() );
@@ -299,2 +299,21 @@ bool NodeCollection::triggersVPN() {
299} 299}
300
301bool NodeCollection::hasDataForFile( const QString & S ) {
302 return ( firstWithDataForFile( S ) != 0 );
303}
304
305ANetNodeInstance * NodeCollection::firstWithDataForFile( const QString & S ) {
306 for( QListIterator<ANetNodeInstance> it(*this);
307 it.current();
308 ++it ) {
309 if( it.current()->hasDataForFile( S ) ) {
310 Log(( "Node %s has data for %s\n",
311 it.current()->nodeClass()->name(),
312 S.latin1() ));
313 return it.current();
314 }
315 }
316 return 0;
317}
318
300// 319//
diff --git a/noncore/settings/networksettings2/networksettings2/netnode.h b/noncore/settings/networksettings2/networksettings2/netnode.h
index ca35c27..d3d7b34 100644
--- a/noncore/settings/networksettings2/networksettings2/netnode.h
+++ b/noncore/settings/networksettings2/networksettings2/netnode.h
@@ -7,2 +7,3 @@
7#include <qpixmap.h> 7#include <qpixmap.h>
8#include <qstringlist.h>
8#include <qobject.h> 9#include <qobject.h>
@@ -79,28 +80,54 @@ public:
79 80
80 // pixmap needed for this NetNode 81 //
81 virtual const QString pixmapName() = 0; 82 //
83 // standard methods with sensible default
84 //
85 //
82 86
83 // description for this NetNode 87 inline int done( void )
84 virtual const QString nodeDescription() = 0; 88 { return Done; }
89 inline void setDone( int D )
90 { Done = D; }
85 91
86 // create a blank instance of a net node 92 // does this Node provide a Connection
87 virtual ANetNodeInstance * createInstance( void ) = 0; 93 inline bool isToplevel( void )
94 { return strcmp( provides(), "fullsetup") == 0 ; }
88 95
89 // return feature this NetNode provides 96 // set the value of an attribute
90 virtual const char * provides( void ) = 0; 97 void setAttribute( QString & Attr, QString & Value ) ;
91 virtual const char ** needs( void ) = 0; 98 void saveAttributes( QTextStream & TS ) ;
92 99
93 // generate files specific for this node (if any) 100 // compiled references to 'needed' NetNodes -> needs list
94 virtual bool generateProperFilesFor( ANetNodeInstance * NNI ) = 0; 101 inline void setAlternatives( NetNodeList * Alt )
95 // return TRUE if this node has data to be inserted in systemfile 102 { Alternatives = Alt; }
96 // with name S 103 inline NetNodeList & alternatives( void )
97 virtual bool hasDataFor( const QString & S ) = 0; 104 { return *Alternatives; }
98 // generate data specific for the device for the system file S 105
99 // called only IF data was needed 106 //
100 virtual bool generateDeviceDataForCommonFile( 107 //
101 SystemFile & SF, long DevNr ) = 0; 108 // Virtual methods with sensible default
109 //
110 //
111
112 // do instances of this noce class have data for this file
113 virtual bool hasDataForFile( const QString & )
114 { return 0; }
115
116 // generate instance independent stuff
117 // 0 : data output, 1 no data, 2 error
118 virtual short generateFile( const QString & ,
119 const QString & ,
120 QTextStream & ,
121 long )
122 { return 1; }
123
124 // generate instance dependent but profile common stuff
125 // 0 : data output, 1 no data, 2 error
126 virtual short generateFile( const QString & ,
127 const QString & ,
128 QTextStream & ,
129 ANetNodeInstance * ,
130 long )
131 { return 1; }
102 132
103 // does this Node provide a Connection
104 bool isToplevel( void )
105 { return strcmp( provides(), "fullsetup") == 0 ; }
106 133
@@ -116,11 +143,24 @@ public:
116 143
117 // set the value of an attribute 144 // return list of files that are specific for this node class
118 void setAttribute( QString & Attr, QString & Value ) ; 145 virtual QStringList * properFiles( void )
119 void saveAttributes( QTextStream & TS ) ; 146 { return 0; }
120 147
121 // compiled references to 'needed' NetNodes -> needs list 148 //
122 void setAlternatives( NetNodeList * Alt ) 149 //
123 { Alternatives = Alt; } 150 // pure virtual methods with sensible default
124 NetNodeList & alternatives( void ) 151 //
125 { return *Alternatives; } 152 //
153
154 // pixmap needed for this NetNode
155 virtual const QString pixmapName() = 0;
156
157 // description for this NetNode
158 virtual const QString nodeDescription() = 0;
159
160 // create a blank instance of a net node
161 virtual ANetNodeInstance * createInstance( void ) = 0;
162
163 // return feature this NetNode provides
164 virtual const char * provides( void ) = 0;
165 virtual const char ** needs( void ) = 0;
126 166
@@ -134,2 +174,3 @@ private :
134 virtual void saveSpecificAttribute( QTextStream & ) = 0; 174 virtual void saveSpecificAttribute( QTextStream & ) = 0;
175 int Done;
135 176
@@ -145,23 +186,13 @@ public:
145 186
146 virtual RuntimeInfo * runtime( void ) = 0; 187 inline int done( void )
147 188 { return Done; }
148 void setConnection( NodeCollection * NC ) 189 inline void setDone( int D )
149 { Connection = NC; } 190 { Done = D; }
150 NodeCollection * connection( void )
151 { return Connection; }
152
153 // create edit widget under parent
154 virtual QWidget * edit( QWidget * parent ) = 0;
155 // is given data acceptable
156 virtual QString acceptable( void ) = 0;
157 191
158 // return data was modified 192 // return data was modified
159 void setModified( bool M ) 193 inline void setModified( bool M )
160 { IsModified = M; } 194 { IsModified = M; }
161 bool isModified( void ) 195 inline bool isModified( void )
162 { return IsModified; } 196 { return IsModified; }
163 197
164 // get data from GUI and store in node
165 virtual void commit( void ) = 0;
166
167 // get next node 198 // get next node
@@ -180,5 +211,5 @@ public:
180 // return true if node isntance is NEW and not loaded 211 // return true if node isntance is NEW and not loaded
181 void setNew( bool IsN ) 212 inline void setNew( bool IsN )
182 { IsNew = IsN; } 213 { IsNew = IsN; }
183 bool isNew( void ) 214 inline bool isNew( void )
184 { return IsNew; } 215 { return IsNew; }
@@ -186,5 +217,5 @@ public:
186 // return description for this instance 217 // return description for this instance
187 QString & description( void ) 218 inline QString & description( void )
188 { return Description; } 219 { return Description; }
189 void setDescription( const QString & S ) 220 inline void setDescription( const QString & S )
190 { Description = S; } 221 { Description = S; }
@@ -192,22 +223,78 @@ public:
192 // pixmap for this instance -> from NetNode 223 // pixmap for this instance -> from NetNode
193 const QString pixmapName( void ) 224 inline const QString pixmapName( void )
194 { return NodeType->pixmapName(); } 225 { return NodeType->pixmapName(); }
195 226
196 const char * provides( void ) 227 inline const char * provides( void )
197 { return NodeType->provides(); } 228 { return NodeType->provides(); }
198 229
199 const char ** needs( void ) 230 inline const char ** needs( void )
200 { return NodeType->needs(); } 231 { return NodeType->needs(); }
201 232
202 // returns node specific data -> only useful for 'buddy' 233 inline void setConnection( NodeCollection * NC )
203 virtual void * data( void ) = 0; 234 { Connection = NC; }
235 inline NodeCollection * connection( void )
236 { return Connection; }
237
238 //
239 //
240 // Virtual methods with sensible defaults
241 //
242 //
204 243
205 // return TRUE if this node has data to be inserted in systemfile
206 // with name S
207 virtual bool hasDataFor( const QString & S ) = 0;
208 244
209 // generate data specific for a profile and for the system file S 245
210 // called only IF data was needed 246 // open proper file identified by S
211 virtual bool generateDataForCommonFile( 247 virtual QFile * openFile( const QString & )
212 SystemFile & SF, long DevNr ) = 0; 248 { return 0; }
249
250 // check if this node (or sub nodes) have data for this file
251 virtual bool hasDataForFile( const QString & S )
252 { return nodeClass()->hasDataForFile( S ); }
253
254 // generate code specific for this node but embedded
255 // in the section of the parent
256 // this is called within the code of the parent
257 virtual short generateFileEmbedded( const QString & ID,
258 const QString & Path,
259 QTextStream & TS,
260 long DevNr )
261 { ANetNodeInstance * NNI = nextNode();
262 return (NNI) ? NNI->generateFileEmbedded( ID, Path, TS, DevNr ) : 1;
263 }
264
265 // generate code specific for this node
266 // (or find the first node that does)
267 virtual short generateFile( const QString & ID,
268 const QString & Path,
269 QTextStream & TS,
270 long DevNr )
271 { ANetNodeInstance * NNI = nextNode();
272 return (NNI) ? NNI->generateFile( ID, Path, TS, DevNr ) : 1;
273 }
274
275 // return true if this node instance is triggered by this trigger
276 // could be delegated to deeper instances
277 virtual bool triggeredBy( const QString & )
278 { return 0; }
279
280 //
281 //
282 // Pure virtual functions
283 //
284 //
285
286 // return runtime information for this node
287 virtual RuntimeInfo * runtime( void ) = 0;
288
289 // create edit widget under parent
290 virtual QWidget * edit( QWidget * parent ) = 0;
291
292 // is given data acceptable
293 virtual QString acceptable( void ) = 0;
294
295 // get data from GUI and store in node
296 virtual void commit( void ) = 0;
297
298 // returns node specific data -> only useful for 'buddy'
299 virtual void * data( void ) = 0;
213 300
@@ -224,2 +311,3 @@ protected :
224 bool IsNew; 311 bool IsNew;
312 int Done;
225 313
@@ -284,16 +372,21 @@ public :
284 372
285 int number( void ) 373 inline int done( void )
374 { return Done; }
375 inline void setDone( int D )
376 { Done = D; }
377
378 inline int number( void )
286 { return Number; } 379 { return Number; }
287 void setNumber( int i ) 380 inline void setNumber( int i )
288 { Number = i; } 381 { Number = i; }
289 bool isNew( void ) 382 inline bool isNew( void )
290 { return IsNew; } 383 { return IsNew; }
291 void setNew( bool N ) 384 inline void setNew( bool N )
292 { IsNew = N ; } 385 { IsNew = N ; }
293 bool isModified( void ) 386 inline bool isModified( void )
294 { return IsModified; } 387 { return IsModified; }
295 void setModified( bool N ) 388 inline void setModified( bool N )
296 { IsModified = N ; } 389 { IsModified = N ; }
297 390
298 bool handlesInterface( const QString & S ) { 391 inline bool handlesInterface( const QString & S ) {
299 return getToplevel()->runtime()->handlesInterface( S ); 392 return getToplevel()->runtime()->handlesInterface( S );
@@ -301,3 +394,3 @@ public :
301 394
302 InterfaceInfo * assignedInterface( void ) { 395 inline InterfaceInfo * assignedInterface( void ) {
303 return getToplevel()->runtime()->assignedInterface(); 396 return getToplevel()->runtime()->assignedInterface();
@@ -305,3 +398,3 @@ public :
305 398
306 AsDevice * device() { 399 inline AsDevice * device() {
307 return getToplevel()->runtime()->device(); 400 return getToplevel()->runtime()->device();
@@ -311,3 +404,3 @@ public :
311 404
312 State_t state( bool Update = 0 ) 405 inline State_t state( bool Update = 0 )
313 { Log(( "%s state %d(=%d?)\n", Name.latin1(), CurrentState, 406 { Log(( "%s state %d(=%d?)\n", Name.latin1(), CurrentState,
@@ -327,11 +420,11 @@ public :
327 QPixmap statePixmap( State_t S ); 420 QPixmap statePixmap( State_t S );
328 QPixmap statePixmap( bool Update = 0 ) 421 inline QPixmap statePixmap( bool Update = 0 )
329 { return statePixmap( state(Update) ); } 422 { return statePixmap( state(Update) ); }
330 QString stateName( State_t ); 423 QString stateName( State_t );
331 QString stateName( bool Update = 0 ) 424 inline QString stateName( bool Update = 0 )
332 { return stateName( state(Update) ); } 425 { return stateName( state(Update) ); }
333 426
334 bool setState( Action_t A, bool Force =0 ) 427 inline bool setState( Action_t A, bool Force =0 )
335 { return getToplevel()->runtime()->setState( this, A, Force ); } 428 { return getToplevel()->runtime()->setState( this, A, Force ); }
336 bool canSetState( Action_t A ) 429 inline bool canSetState( Action_t A )
337 { return getToplevel()->runtime()->canSetState( CurrentState, A ); } 430 { return getToplevel()->runtime()->canSetState( CurrentState, A ); }
@@ -350,3 +443,3 @@ public :
350 443
351 const QString & name() 444 inline const QString & name()
352 { return Name; } 445 { return Name; }
@@ -355,10 +448,26 @@ public :
355 448
356 void setName( const QString & N) 449 inline void setName( const QString & N)
357 { Name = N; } 450 { Name = N; }
358 451
359 State_t currentState( void ) 452 inline State_t currentState( void )
360 { return CurrentState; } 453 { return CurrentState; }
361 void setCurrentState( State_t S ) 454 inline void setCurrentState( State_t S )
362 { CurrentState = S; } 455 { CurrentState = S; }
363 456
457 // return TRUE if this node can have data to be inserted in
458 // file identified by S
459 bool hasDataForFile( const QString & S );
460 ANetNodeInstance * firstWithDataForFile( const QString & S );
461
462 // generate items for this file -> toplevel call
463 short generateFile( const QString & FID, // identification of file
464 const QString & FName, // effective filename of file
465 QTextStream & TS, // stream to file
466 long DN // device number
467 )
468 { return getToplevel()->generateFile( FID, FName, TS, DN ); }
469
470 bool triggeredBy( const QString & Trigger )
471 { return getToplevel()->triggeredBy( Trigger ); }
472
364private : 473private :
@@ -380,2 +489,3 @@ private :
380 bool IsModified; 489 bool IsModified;
490 int Done;
381 491
diff --git a/noncore/settings/networksettings2/networksettings2/resources.cpp b/noncore/settings/networksettings2/networksettings2/resources.cpp
index 71e84cd..7ece817 100644
--- a/noncore/settings/networksettings2/networksettings2/resources.cpp
+++ b/noncore/settings/networksettings2/networksettings2/resources.cpp
@@ -79,3 +79,3 @@ TheNSResources::TheNSResources( void ) : NodeTypeNameMap(),
79 // define system files 79 // define system files
80 addSystemFile( new SystemFile( "interfaces", "./interfaces" ) ); 80 addSystemFile( "interfaces", "/tmp/interfaces", 1 );
81 81
@@ -90,3 +90,12 @@ TheNSResources::~TheNSResources( void ) {
90 90
91void TheNSResources::busy( bool B ) { 91void TheNSResources::addSystemFile( const QString & ID,
92 const QString & P,
93 bool KDI ) {
94 if( ! SystemFiles.find( ID ) ) {
95 // new system file
96 SystemFiles.insert( ID, new SystemFile( ID, P, KDI ) );
97 } // else existed
98}
99
100void TheNSResources::busy( bool ) {
92/* 101/*
diff --git a/noncore/settings/networksettings2/networksettings2/resources.h b/noncore/settings/networksettings2/networksettings2/resources.h
index 55d2f29..16355ba 100644
--- a/noncore/settings/networksettings2/networksettings2/resources.h
+++ b/noncore/settings/networksettings2/networksettings2/resources.h
@@ -68,4 +68,5 @@ public :
68 { return SystemFiles; } 68 { return SystemFiles; }
69 void addSystemFile( SystemFile * SF ) 69 void addSystemFile( const QString & ID,
70 { SystemFiles.insert( SF->name(), SF ); } 70 const QString & P,
71 bool KDI );
71 72
diff --git a/noncore/settings/networksettings2/networksettings2/system.cpp b/noncore/settings/networksettings2/networksettings2/system.cpp
index a579396..271e73d 100644
--- a/noncore/settings/networksettings2/networksettings2/system.cpp
+++ b/noncore/settings/networksettings2/networksettings2/system.cpp
@@ -392,4 +392,7 @@ void VLog( char * Format, ... ) {
392 if( logf == (FILE *)0 ) { 392 if( logf == (FILE *)0 ) {
393 // logf = fopen( "/tmp/ns2log", "a" ); 393 if( getenv("NS2STDERR") ) {
394 logf = stderr; 394 logf = stderr;
395 } else {
396 logf = fopen( "/tmp/ns2log", "a" );
397 }
395 if( ! logf ) { 398 if( ! logf ) {
@@ -413,3 +416,5 @@ void LogClose( void ) {
413 fprintf( logf, "____ CLOSE LOGFILE ____\n"); 416 fprintf( logf, "____ CLOSE LOGFILE ____\n");
417 if( logf != stderr ) {
414 fclose( logf ); 418 fclose( logf );
419 }
415 logf = 0; 420 logf = 0;
@@ -417 +422,8 @@ void LogClose( void ) {
417} 422}
423
424QString removeSpaces( const QString & X ) {
425 QStringList SL;
426
427 SL = QStringList::split( " ", X );
428 return SL.join( "_" );
429}
diff --git a/noncore/settings/networksettings2/networksettings2/systemfile.cpp b/noncore/settings/networksettings2/networksettings2/systemfile.cpp
index b3fc1a5..2b40834 100644
--- a/noncore/settings/networksettings2/networksettings2/systemfile.cpp
+++ b/noncore/settings/networksettings2/networksettings2/systemfile.cpp
@@ -13,3 +13,5 @@ QString TemplDir;
13 13
14SystemFile::SystemFile( const QString & N, const QString & P ){ 14SystemFile::SystemFile( const QString & N,
15 const QString & P,
16 bool KDI ){
15 Name = N; 17 Name = N;
@@ -59,2 +61,4 @@ SystemFile::SystemFile( const QString & N, const QString & P ){
59 } 61 }
62
63 KnowsDeviceInstances = KDI;
60} 64}
@@ -98,3 +102,3 @@ bool SystemFile::preSection( void ) {
98 if( ! Fl.open( IO_ReadOnly ) ) 102 if( ! Fl.open( IO_ReadOnly ) )
99 return 1; // error 103 return 0; // error
100 // copy file to this file 104 // copy file to this file
@@ -102,3 +106,3 @@ bool SystemFile::preSection( void ) {
102 } 106 }
103 return 0; 107 return 1;
104} 108}
@@ -109,3 +113,3 @@ bool SystemFile::postSection( void ) {
109 if( ! Fl.open( IO_ReadOnly ) ) 113 if( ! Fl.open( IO_ReadOnly ) )
110 return 1; // error 114 return 0; // error
111 // copy file to this file 115 // copy file to this file
@@ -113,3 +117,3 @@ bool SystemFile::postSection( void ) {
113 } 117 }
114 return 0; 118 return 1;
115} 119}
@@ -120,3 +124,3 @@ bool SystemFile::preNodeSection( ANetNodeInstance * NNI, long ) {
120 if( ! Fl.open( IO_ReadOnly ) ) 124 if( ! Fl.open( IO_ReadOnly ) )
121 return 1; // error 125 return 0; // error
122 QTextStream TX( &Fl ); 126 QTextStream TX( &Fl );
@@ -131,3 +135,3 @@ bool SystemFile::preNodeSection( ANetNodeInstance * NNI, long ) {
131 } 135 }
132 return 0; 136 return 1;
133} 137}
@@ -138,3 +142,3 @@ bool SystemFile::postNodeSection( ANetNodeInstance * NNI, long ) {
138 if( ! Fl.open( IO_ReadOnly ) ) 142 if( ! Fl.open( IO_ReadOnly ) )
139 return 1; // error 143 return 0; // error
140 QTextStream TX( &Fl ); 144 QTextStream TX( &Fl );
@@ -149,3 +153,3 @@ bool SystemFile::postNodeSection( ANetNodeInstance * NNI, long ) {
149 } 153 }
150 return 0; 154 return 1;
151} 155}
@@ -156,3 +160,3 @@ bool SystemFile::preDeviceSection( ANetNode * NN ) {
156 if( ! Fl.open( IO_ReadOnly ) ) 160 if( ! Fl.open( IO_ReadOnly ) )
157 return 1; // error 161 return 0; // error
158 QTextStream TX( &Fl ); 162 QTextStream TX( &Fl );
@@ -166,3 +170,3 @@ bool SystemFile::preDeviceSection( ANetNode * NN ) {
166 } 170 }
167 return 0; 171 return 1;
168} 172}
@@ -173,3 +177,3 @@ bool SystemFile::postDeviceSection( ANetNode * NN ) {
173 if( ! Fl.open( IO_ReadOnly ) ) 177 if( ! Fl.open( IO_ReadOnly ) )
174 return 1; // error 178 return 0; // error
175 QTextStream TX( &Fl ); 179 QTextStream TX( &Fl );
@@ -183,3 +187,3 @@ bool SystemFile::postDeviceSection( ANetNode * NN ) {
183 } 187 }
184 return 0; 188 return 1;
185} 189}
diff --git a/noncore/settings/networksettings2/networksettings2/systemfile.h b/noncore/settings/networksettings2/networksettings2/systemfile.h
index f57dab0..ceed605 100644
--- a/noncore/settings/networksettings2/networksettings2/systemfile.h
+++ b/noncore/settings/networksettings2/networksettings2/systemfile.h
@@ -13,7 +13,13 @@ public :
13 13
14 SystemFile( const QString & Name, const QString & Path ); 14 SystemFile( const QString & Name,
15 const QString & Path,
16 bool KnowsDevicesInstances );
15 ~SystemFile( void ); 17 ~SystemFile( void );
16 18
17 const QString & name( void ) 19 const QString & name( void ) const
18 { return Name; } 20 { return Name; }
21 const QString & path( void ) const
22 { return Path; }
23 bool knowsDeviceInstances( void ) const
24 { return KnowsDeviceInstances; }
19 25
@@ -40,2 +46,3 @@ private :
40 bool hasPostDeviceSection; 46 bool hasPostDeviceSection;
47 bool KnowsDeviceInstances;
41 48
diff --git a/noncore/settings/networksettings2/nsdata.cpp b/noncore/settings/networksettings2/nsdata.cpp
index 3b17548..d709c0a 100644
--- a/noncore/settings/networksettings2/nsdata.cpp
+++ b/noncore/settings/networksettings2/nsdata.cpp
@@ -22,3 +22,2 @@ NetworkSettingsData::NetworkSettingsData( void ) {
22 // load settings 22 // load settings
23 Force = 0;
24 IsModified = 0; 23 IsModified = 0;
@@ -220,16 +219,5 @@ QString NetworkSettingsData::saveSettings( void ) {
220 219
221QString NetworkSettingsData::generateSettings( bool ForceReq ) { 220QString NetworkSettingsData::generateSettings( void ) {
222 bool ForceIt;
223 QString S = ""; 221 QString S = "";
224 222 Name2SystemFile_t & SFM = NSResources->systemFiles();
225 // include own force flag
226 ForceIt = (Force) ? 1 : ForceReq;
227
228 if( ! ForceIt && ! isModified() )
229 return S;
230
231 // regenerate system files
232 Log( ( "Generating settings from %s\n", CfgFile.latin1() ));
233
234 { Name2SystemFile_t & SFM = NSResources->systemFiles();
235 Name2Connection_t & M = NSResources->connections(); 223 Name2Connection_t & M = NSResources->connections();
@@ -237,47 +225,12 @@ QString NetworkSettingsData::generateSettings( bool ForceReq ) {
237 ANetNodeInstance * NNI; 225 ANetNodeInstance * NNI;
226 ANetNodeInstance * FirstWithData;
238 SystemFile * SF; 227 SystemFile * SF;
239 AsDevice * CurDev; 228 AsDevice * CurDev;
240 ANetNode * CurDevNN; 229 ANetNode * NN, * CurDevNN = 0;
241 bool needToRegenerate = ForceIt; 230 long NoOfDevs;
231 long DevCtStart;
232 bool needToGenerate;
242 233
243 // 234 // regenerate system files
244 // check if we need to generate at least one of the system files 235 Log( ( "Generating settings from %s\n", CfgFile.latin1() ));
245 //
246 if( ! ForceIt ) {
247 for( QDictIterator<SystemFile> sfit(SFM);
248 sfit.current();
249 ++sfit ) {
250 SF = sfit.current();
251
252 // check if there are nodes that are modified and require
253 // data for this system file
254
255 // for all connections
256 for( QDictIterator<NodeCollection> ncit(M);
257 ncit.current();
258 ++ncit ) {
259 NC = ncit.current();
260
261 if( NC->isModified() ) {
262 // does this connection 'touch' this system file ?
263 for( QListIterator<ANetNodeInstance> cncit(*NC);
264 cncit.current();
265 ++cncit ) {
266 NNI = cncit.current();
267 if( ( NNI->nodeClass()->hasDataFor( SF->name() ) ||
268 NNI->hasDataFor( SF->name() )
269 ) &&
270 NNI->isModified() ) {
271 needToRegenerate = 1;
272 break;
273 }
274 }
275 }
276 if( needToRegenerate )
277 break;
278 }
279 if( needToRegenerate )
280 break;
281 }
282 }
283 236
@@ -290,4 +243,3 @@ QString NetworkSettingsData::generateSettings( bool ForceReq ) {
290 NNIIt.current(); 243 NNIIt.current();
291 ++NNIIt 244 ++NNIIt ) {
292 ){
293 // for all nodes find those that are modified 245 // for all nodes find those that are modified
@@ -295,4 +247,13 @@ QString NetworkSettingsData::generateSettings( bool ForceReq ) {
295 247
296 if( ForceIt || NNI->isModified() ) { 248 { // get list of proper files for this nodeclass (if any)
297 if( NNI->nodeClass()->generateProperFilesFor( NNI ) ) { 249 QStringList * PF = NNI->nodeClass()->properFiles();
250
251 if( PF ) {
252 for ( QStringList::Iterator it = PF->begin();
253 it != PF->end();
254 ++it ) {
255 QFile * F = NNI->openFile( (*it) );
256 if( F ) {
257 QTextStream TS( F );
258 if( NNI->generateFile( (*it), F->name(), TS, -1 ) == 2 ) {
298 // problem generating 259 // problem generating
@@ -301,4 +262,9 @@ QString NetworkSettingsData::generateSettings( bool ForceReq ) {
301 arg(NNI->nodeClass()->name()) ; 262 arg(NNI->nodeClass()->name()) ;
263 delete F;
302 return S; 264 return S;
303 } 265 }
266 delete F;
267 }
268 }
269 }
304 } 270 }
@@ -315,32 +281,47 @@ QString NetworkSettingsData::generateSettings( bool ForceReq ) {
315 281
316 Log( ( "Generating %s\n", SF->name().latin1() )); 282 // reset all
317 SF->open(); 283 for( QDictIterator<NetNode_t> nnit( NSResources->netNodes() );
284 nnit.current();
285 ++nnit ) {
286 nnit.current()->NetNode->setDone(0);
287 }
318 288
319 do { // so we can break; 289 for( QDictIterator<ANetNodeInstance> nniit(
290 NSResources->netNodeInstances() );
291 nniit.current();
292 ++nniit ) {
293 nniit.current()->setDone(0);
294 }
320 295
321 // global presection for this system file 296 for( QDictIterator<NodeCollection> ncit(M);
322 if( SF->preSection() ) { 297 ncit.current();
323 S = qApp->translate( "NetworkSettings", 298 ++ncit ) {
324 "<p>Error in preSection for file \"%1\"</p>" ). 299 ncit.current()->setDone(0);
325 arg( SF->name() );
326 return S;
327 } 300 }
328 301
329 // find all netnodes and figure out if 302 Log( ( "Generating %s\n", SF->name().latin1() ));
330 // for that node there are instances 303
331 for( QDictIterator<NetNode_t> nnit( 304 needToGenerate = 0;
332 NSResources->netNodes() ); 305
333 nnit.current(); 306 // are there netnodes that have instances and need
307 // to write data in this system file ?
308 for( QDictIterator<NetNode_t> nnit( NSResources->netNodes() );
309 ! needToGenerate && nnit.current();
334 ++nnit ) { 310 ++nnit ) {
335 311
336 CurDevNN = nnit.current()->NetNode; 312 NN = nnit.current()->NetNode;
313
314 if( NN->hasDataForFile( SF->name() ) ) {
315 // netnode can have data
337 316
338 // are there instances for this netnode ? 317 // are there instances of this node ?
339 NNI = 0;
340 for( QDictIterator<ANetNodeInstance> nniit( 318 for( QDictIterator<ANetNodeInstance> nniit(
341 NSResources->netNodeInstances() ); 319 NSResources->netNodeInstances() );
342 nniit.current(); 320 ! needToGenerate && nniit.current();
343 ++nniit ) { 321 ++nniit ) {
344 if( nniit.current()->nodeClass() == CurDevNN ) { 322 if( nniit.current()->nodeClass() == NN ) {
345 NNI = nniit.current(); 323 // yes
324 Log(("Node %s has data\n",
325 nniit.current()->name() ));
326 needToGenerate = 1;
346 break; 327 break;
@@ -348,25 +329,167 @@ QString NetworkSettingsData::generateSettings( bool ForceReq ) {
348 } 329 }
330 }
331 }
349 332
350 if( ! NNI ) 333 if( ! needToGenerate ) {
351 // no instances -> next netnode type 334 // no instances found that might need to write data
335 // in this systemfile
336 Log(("No nodes for systemfile %s\n", SF->name().latin1() ));
352 continue; 337 continue;
338 }
339
340 // ok generate this system file
341 SF->open();
353 342
354 // has this node data for this system file ? 343 // global presection for this system file
355 if( (CurDev = NNI->runtime()->asDevice() ) ) { 344 if( ! SF->preSection() ) {
356 // generate start for this nodetype for all possible devices of this type 345 S = qApp->translate( "NetworkSettings",
357 for( int i = 0; i < CurDevNN->instanceCount(); i ++ ) { 346 "<p>Error in section \"Preamble\" for file \"%1\"</p>" ).
358 S = generateSystemFileNode( *SF, CurDev, NNI, i ); 347 arg( SF->name() );
359 if( ! S.isEmpty() )
360 return S; 348 return S;
361 } 349 }
362 } else { 350
363 S = generateSystemFileNode( *SF, 0, NNI, -1 ); 351 // find connections that want to write to this file
364 if( ! S.isEmpty() ) 352 for( QDictIterator<NodeCollection> ncit(M);
353 ncit.current();
354 ++ncit ) {
355
356 NC = ncit.current();
357
358 if( NC->done() ) {
359 // already done
360 continue;
361 }
362
363 if( ! NC->hasDataForFile( SF->name() ) ) {
364 // no data
365 continue;
366 }
367
368 Log(("Generating %s for connection %s\n",
369 SF->name().latin1(), NC->name().latin1() ));
370 // find highest item that wants to write data to this file
371 FirstWithData = NC->firstWithDataForFile( SF->name() );
372
373 // find device on which this connection works
374 CurDev = NC->device();
375 // class of that node
376 CurDevNN = CurDev->netNode()->nodeClass();
377
378 Log(( "%s is done %d\n",
379 FirstWithData->nodeClass()->name(),
380 FirstWithData->nodeClass()->done() ));
381
382 if( ! FirstWithData->nodeClass()->done() ) {
383 // generate fixed part
384 if( ! SF->preDeviceSection( CurDevNN ) ) {
385 S = qApp->translate( "NetworkSettings",
386 "<p>Error in section \"Pre-Device\" for file \"%1\"</p>" ).
387 arg( SF->name() );
365 return S; 388 return S;
366 } 389 }
390
391 if( FirstWithData->nodeClass()->generateFile(
392 SF->name(), SF->path(), *SF, -1 ) == 2 ) {
393 S = qApp->translate( "NetworkSettings",
394 "<p>Error in section \"Common\" for file \"%1\" and node \"%2\"</p>" ).
395 arg( SF->name() ).
396 arg( CurDevNN->name() );
397 return S;
398 }
399 FirstWithData->nodeClass()->setDone( 1 );
400 }
401
402 NoOfDevs = 0;
403 DevCtStart = -1;
404
405 if( SF->knowsDeviceInstances() ) {
406 DevCtStart = 0;
407 NoOfDevs = CurDevNN->instanceCount();
367 } 408 }
368 409
369 if( SF->postSection() ) { 410 Log(( "Node %s is done %d\n",
411 CurDev->netNode()->nodeClass()->name(),
412 CurDev->netNode()->nodeClass()->done() ));
413
414 if( ! CurDev->netNode()->nodeClass()->done() ) {
415 // first time this device is handled
416 // generate common device specific part
417 for( int i = DevCtStart; i < NoOfDevs ; i ++ ) {
418
419 if( FirstWithData->nodeClass()->generateFile(
420 SF->name(), SF->path(), *SF, CurDev->netNode(), i ) == 2 ) {
370 S = qApp->translate( "NetworkSettings", 421 S = qApp->translate( "NetworkSettings",
371 "<p>Error in postSection for file \"%1\"</p>" ). 422 "<p>Error in section \"Device\" for file \"%1\" and node \"%2\"</p>" ).
423 arg( SF->name() ).
424 arg( CurDevNN->name() );
425 return S;
426 }
427 }
428 CurDev->netNode()->nodeClass()->setDone( 1 );
429 }
430
431 // generate profile specific info
432 // for all nodeconnections that work on the same device
433 for( QDictIterator<NodeCollection> ncit2(M);
434 ncit2.current();
435 ++ncit2 ) {
436
437 if( ncit2.current()->device() != CurDev ) {
438 // different device
439 continue;
440 }
441
442 Log(("Connection %s of same family\n", ncit2.current()->name().latin1() ));
443 // generate
444 NNI = ncit2.current()->firstWithDataForFile( SF->name() );
445 for( int i = DevCtStart; i < NoOfDevs ; i ++ ) {
446 if( ! SF->preNodeSection( NNI, i ) ) {
447 S = qApp->translate( "NetworkSettings",
448 "<p>Error in \"Pre-Node Part\" for file \"%1\" and node \"%2\"</p>" ).
449 arg( SF->name() ).
450 arg( CurDevNN->name() );
451 return S;
452 }
453
454 switch( NNI->generateFile(
455 SF->name(), SF->path(), *SF, i ) ) {
456 case 0 :
457 (*SF) << endl;
458 break;
459 case 1 :
460 break;
461 case 2 :
462 S = qApp->translate( "NetworkSettings",
463 "<p>Error in section \"Node\" for file \"%1\" and node \"%2\"</p>" ).
464 arg( SF->name() ).
465 arg( CurDevNN->name() );
466 return S;
467 }
468
469 if( ! SF->postNodeSection( NNI, i ) ) {
470 S = qApp->translate( "NetworkSettings",
471 "<p>Error in \"Post-Node Part\" for file \"%1\" and node \"%2\"</p>" ).
472 arg( SF->name() ).
473 arg( CurDevNN->name() );
474 return S;
475 }
476 }
477
478 ncit2.current()->setDone( 1 );
479
480 }
481 }
482
483 if( ! SF->postDeviceSection( CurDevNN ) ) {
484 S = qApp->translate( "NetworkSettings",
485 "<p>Error in section \"Post-Device\" for file \"%1\" and node \"%2\"</p>" ).
486 arg( SF->name() ).
487 arg( CurDevNN->name() );
488 return S;
489 }
490
491
492 if( ! SF->postSection() ) {
493 S = qApp->translate( "NetworkSettings",
494 "<p>Error in section \"Closure\" for file \"%1\"</p>" ).
372 arg( SF->name() ); 495 arg( SF->name() );
@@ -375,7 +498,5 @@ QString NetworkSettingsData::generateSettings( bool ForceReq ) {
375 498
376 } while( 0 ); 499 // end of file
377 SF->close(); 500 SF->close();
378 } 501 }
379 }
380 Force = 0;
381 return S; 502 return S;
@@ -465,5 +586,3 @@ bool NetworkSettingsData::canStart( const char * Interface ) {
465bool NetworkSettingsData::regenerate( void ) { 586bool NetworkSettingsData::regenerate( void ) {
466 QString S; 587 QString S = generateSettings();
467 // load situation
468 S = generateSettings( TRUE );
469 if( ! S.isEmpty() ) { 588 if( ! S.isEmpty() ) {
@@ -474,100 +593 @@ bool NetworkSettingsData::regenerate( void ) {
474} }
475
476QString NetworkSettingsData::generateSystemFileNode(
477 SystemFile &SF,
478 AsDevice * CurDev,
479 ANetNodeInstance * DevNNI,
480 long DevInstNr ) {
481
482 QString S="";
483 ANetNode * CurDevNN = DevNNI->nodeClass();
484 Name2Connection_t & M = NSResources->connections();
485
486 if( SF.preDeviceSection( CurDevNN ) ) {
487 S = qApp->translate( "NetworkSettings",
488 "<p>Error in \"Pre-Device Part\" for file \"%1\" and nodetype \"%2\"</p>" ).
489 arg( SF.name() ).
490 arg( CurDevNN->name() );
491 return S;
492 }
493
494 if( CurDevNN->hasDataFor( SF.name() ) ) {
495 if( CurDevNN->generateDeviceDataForCommonFile( SF, DevInstNr ) ) {
496 S = qApp->translate( "NetworkSettings",
497 "<p>Error in \"Device Part\" for file \"%1\" and node \"%2\"</p>" ).
498 arg( SF.name() ).
499 arg( CurDevNN->name() );
500 return S;
501 }
502 }
503
504 // now generate profile specific data for all
505 // connections working on a device of the current
506 // netnode type
507 for( QDictIterator<NodeCollection> ncit(M);
508 ncit.current();
509 ++ncit ) {
510 NodeCollection * NC = ncit.current();
511
512 // currenly only those connections that work on
513 // the current device (or on no device if no current)
514 AsDevice * Dev = NC->device();
515
516 if( CurDev ) {
517 if( CurDevNN != Dev->netNode()->nodeClass() ) {
518 // other device type -> later
519 continue;
520 }
521 } else {
522 if( Dev ) {
523 // other
524 continue;
525 }
526 }
527
528 // generate 'entry'
529 if( SF.preNodeSection( DevNNI, DevInstNr ) ) {
530 S = qApp->translate( "NetworkSettings",
531 "<p>Error in \"Pre-Node Part\" for file \"%1\" and node \"%2\"</p>" ).
532 arg( SF.name() ).
533 arg( CurDevNN->name() );
534 return S;
535 }
536
537 // ask all nodes in connection
538 for( QListIterator<ANetNodeInstance> cncit(*NC);
539 cncit.current();
540 ++cncit ) {
541 ANetNodeInstance * NNI = cncit.current();
542
543 if( NNI->hasDataFor( SF.name() ) ) {
544 if( NNI->generateDataForCommonFile(SF,DevInstNr) ) {
545 S = qApp->translate( "NetworkSettings",
546 "<p>Error in \"Node Part\" for file \"%1\" and node \"%2\"</p>" ).
547 arg( SF.name() ).
548 arg( NNI->nodeClass()->name() );
549 return S;
550 }
551 }
552 }
553
554 if( SF.postNodeSection( DevNNI, DevInstNr ) ) {
555 S = qApp->translate( "NetworkSettings",
556 "<p>Error in \"Post-Node Part\" for file \"%1\" and node \"%2\"</p>" ).
557 arg( SF.name() ).
558 arg( CurDevNN->name() );
559 return S;
560 }
561 SF << endl;
562 }
563
564 if( SF.postDeviceSection( CurDevNN ) ) {
565 S = qApp->translate( "NetworkSettings",
566 "<p>Error in \"Post-Device Part\" for file \"%1\" and node \"%2\"</p>" ).
567 arg( SF.name() ).
568 arg( CurDevNN->name() );
569 return S;
570 }
571
572 return S;
573}
diff --git a/noncore/settings/networksettings2/nsdata.h b/noncore/settings/networksettings2/nsdata.h
index 57eb722..507185e 100644
--- a/noncore/settings/networksettings2/nsdata.h
+++ b/noncore/settings/networksettings2/nsdata.h
@@ -15,3 +15,3 @@ public :
15 15
16 QString generateSettings( bool Force = FALSE ); 16 QString generateSettings( void );
17 17
@@ -27,14 +27,5 @@ public :
27 27
28 void forceGeneration( bool m )
29 { Force = m; }
30
31private : 28private :
32 29
33 QString NetworkSettingsData::generateSystemFileNode(
34 SystemFile & SF,
35 AsDevice * CurDev,
36 ANetNodeInstance * DevNNI,
37 long DevInstNr );
38 bool IsModified; 30 bool IsModified;
39 bool Force;
40 31
diff --git a/noncore/settings/networksettings2/ppp/PPPAuthGUI.ui b/noncore/settings/networksettings2/ppp/PPPAuthGUI.ui
index 826843a..0c5f4c8 100644
--- a/noncore/settings/networksettings2/ppp/PPPAuthGUI.ui
+++ b/noncore/settings/networksettings2/ppp/PPPAuthGUI.ui
@@ -13,3 +13,3 @@
13 <y>0</y> 13 <y>0</y>
14 <width>249</width> 14 <width>245</width>
15 <height>209</height> 15 <height>209</height>
@@ -59,3 +59,3 @@
59 <name>margin</name> 59 <name>margin</name>
60 <number>0</number> 60 <number>3</number>
61 </property> 61 </property>
@@ -63,3 +63,3 @@
63 <name>spacing</name> 63 <name>spacing</name>
64 <number>0</number> 64 <number>2</number>
65 </property> 65 </property>
@@ -193,2 +193,39 @@
193 <widget> 193 <widget>
194 <class>QLayoutWidget</class>
195 <property stdset="1">
196 <name>name</name>
197 <cstring>Layout3</cstring>
198 </property>
199 <hbox>
200 <property stdset="1">
201 <name>margin</name>
202 <number>0</number>
203 </property>
204 <property stdset="1">
205 <name>spacing</name>
206 <number>6</number>
207 </property>
208 <widget>
209 <class>QRadioButton</class>
210 <property stdset="1">
211 <name>name</name>
212 <cstring>Pap_RB</cstring>
213 </property>
214 <property stdset="1">
215 <name>text</name>
216 <string>Pap</string>
217 </property>
218 </widget>
219 <widget>
220 <class>QRadioButton</class>
221 <property stdset="1">
222 <name>name</name>
223 <cstring>Chap_RB</cstring>
224 </property>
225 <property stdset="1">
226 <name>text</name>
227 <string>Chap</string>
228 </property>
229 </widget>
230 <widget>
194 <class>QRadioButton</class> 231 <class>QRadioButton</class>
@@ -196,3 +233,3 @@
196 <name>name</name> 233 <name>name</name>
197 <cstring>PapChap_RB</cstring> 234 <cstring>EAP_RB</cstring>
198 </property> 235 </property>
@@ -200,5 +237,7 @@
200 <name>text</name> 237 <name>text</name>
201 <string>Pap/Chap/EAP</string> 238 <string>EAP</string>
202 </property> 239 </property>
203 </widget> 240 </widget>
241 </hbox>
242 </widget>
204 <widget> 243 <widget>
@@ -277,5 +316,5 @@
277 <name>spacing</name> 316 <name>spacing</name>
278 <number>1</number> 317 <number>2</number>
279 </property> 318 </property>
280 <widget row="2" column="0" > 319 <widget row="1" column="0" >
281 <class>QLabel</class> 320 <class>QLabel</class>
@@ -290,3 +329,3 @@
290 </widget> 329 </widget>
291 <widget row="3" column="0" > 330 <widget row="2" column="0" >
292 <class>QLabel</class> 331 <class>QLabel</class>
@@ -301,32 +340,7 @@
301 </widget> 340 </widget>
302 <widget row="0" column="1" > 341 <widget row="1" column="1" >
303 <class>QComboBox</class> 342 <class>QLineEdit</class>
304 <item>
305 <property>
306 <name>text</name>
307 <string>PAP</string>
308 </property>
309 </item>
310 <item>
311 <property>
312 <name>text</name>
313 <string>CHAP</string>
314 </property>
315 </item>
316 <item>
317 <property>
318 <name>text</name>
319 <string>EAP</string>
320 </property>
321 </item>
322 <property stdset="1">
323 <name>name</name>
324 <cstring>AuthMethod_CB</cstring>
325 </property>
326 </widget>
327 <widget row="1" column="0" >
328 <class>QLabel</class>
329 <property stdset="1"> 343 <property stdset="1">
330 <name>name</name> 344 <name>name</name>
331 <cstring>TextLabel1</cstring> 345 <cstring>Server_LE</cstring>
332 </property> 346 </property>
@@ -334,17 +348,13 @@
334 <name>text</name> 348 <name>text</name>
335 <string>Client</string> 349 <string>*</string>
336 </property> 350 </property>
337 </widget> 351 </widget>
338 <widget row="0" column="0" > 352 <widget row="2" column="1" >
339 <class>QLabel</class> 353 <class>QLineEdit</class>
340 <property stdset="1"> 354 <property stdset="1">
341 <name>name</name> 355 <name>name</name>
342 <cstring>TextLabel1_4</cstring> 356 <cstring>Secret_LE</cstring>
343 </property>
344 <property stdset="1">
345 <name>text</name>
346 <string>Method</string>
347 </property> 357 </property>
348 </widget> 358 </widget>
349 <widget row="1" column="1" rowspan="1" colspan="2" > 359 <widget row="0" column="1" >
350 <class>QLineEdit</class> 360 <class>QLineEdit</class>
@@ -359,7 +369,7 @@
359 </widget> 369 </widget>
360 <widget row="2" column="1" rowspan="1" colspan="2" > 370 <widget row="0" column="0" >
361 <class>QLineEdit</class> 371 <class>QLabel</class>
362 <property stdset="1"> 372 <property stdset="1">
363 <name>name</name> 373 <name>name</name>
364 <cstring>Server_LE</cstring> 374 <cstring>TextLabel1</cstring>
365 </property> 375 </property>
@@ -367,33 +377,5 @@
367 <name>text</name> 377 <name>text</name>
368 <string>*</string> 378 <string>Client</string>
369 </property>
370 </widget>
371 <widget row="3" column="1" rowspan="1" colspan="2" >
372 <class>QLineEdit</class>
373 <property stdset="1">
374 <name>name</name>
375 <cstring>Secret_LE</cstring>
376 </property> 379 </property>
377 </widget> 380 </widget>
378 <spacer row="0" column="2" >
379 <property>
380 <name>name</name>
381 <cstring>Spacer7</cstring>
382 </property>
383 <property stdset="1">
384 <name>orientation</name>
385 <enum>Horizontal</enum>
386 </property>
387 <property stdset="1">
388 <name>sizeType</name>
389 <enum>Expanding</enum>
390 </property>
391 <property>
392 <name>sizeHint</name>
393 <size>
394 <width>20</width>
395 <height>20</height>
396 </size>
397 </property>
398 </spacer>
399 </grid> 381 </grid>
@@ -419,3 +401,3 @@
419 <connection> 401 <connection>
420 <sender>PapChap_RB</sender> 402 <sender>Pap_RB</sender>
421 <signal>toggled(bool)</signal> 403 <signal>toggled(bool)</signal>
@@ -430,2 +412,14 @@
430 </connection> 412 </connection>
413 <connection>
414 <sender>Chap_RB</sender>
415 <signal>toggled(bool)</signal>
416 <receiver>GroupBox3</receiver>
417 <slot>setEnabled(bool)</slot>
418 </connection>
419 <connection>
420 <sender>EAP_RB</sender>
421 <signal>toggled(bool)</signal>
422 <receiver>GroupBox3</receiver>
423 <slot>setEnabled(bool)</slot>
424 </connection>
431</connections> 425</connections>
diff --git a/noncore/settings/networksettings2/ppp/PPPAuthedit.cpp b/noncore/settings/networksettings2/ppp/PPPAuthedit.cpp
index f305cc4..450d560 100644
--- a/noncore/settings/networksettings2/ppp/PPPAuthedit.cpp
+++ b/noncore/settings/networksettings2/ppp/PPPAuthedit.cpp
@@ -11,2 +11,9 @@ PPPAuthEdit::PPPAuthEdit( QWidget * Parent ) : PPPAuthGUI( Parent ){
11 11
12bool PPPAuthEdit::PAP_Checked( void ) {
13 return ( Pap_RB->isChecked() ||
14 Chap_RB->isChecked() ||
15 EAP_RB->isChecked()
16 );
17}
18
12QString PPPAuthEdit::acceptable( void ) { 19QString PPPAuthEdit::acceptable( void ) {
@@ -21,3 +28,3 @@ QString PPPAuthEdit::acceptable( void ) {
21 return tr("Password expect missing"); 28 return tr("Password expect missing");
22 } else if( PapChap_RB->isChecked() ) { 29 } else if( PAP_Checked() ) {
23 if( Client_LE->text().isEmpty() ) 30 if( Client_LE->text().isEmpty() )
@@ -36,3 +43,3 @@ bool PPPAuthEdit::commit( PPPData_t & D ) {
36 if( ( D.Auth.Mode == 0 && ! Login_RB->isChecked() ) || 43 if( ( D.Auth.Mode == 0 && ! Login_RB->isChecked() ) ||
37 ( D.Auth.Mode == 1 && ! PapChap_RB->isChecked() ) || 44 ( D.Auth.Mode == 1 && ! PAP_Checked() ) ||
38 ( D.Auth.Mode == 2 && ! Terminal_RB->isChecked() ) ) { 45 ( D.Auth.Mode == 2 && ! Terminal_RB->isChecked() ) ) {
@@ -42,4 +49,3 @@ bool PPPAuthEdit::commit( PPPData_t & D ) {
42 0 : 49 0 :
43 ( ( PapChap_RB->isChecked() ) ? 50 ( PAP_Checked() ) ? 1 : 2;
44 1 : 2 );
45 } 51 }
@@ -51,3 +57,3 @@ bool PPPAuthEdit::commit( PPPData_t & D ) {
51 TXTM( D.Auth.Password.Send, PasswordSend_LE, SM ); 57 TXTM( D.Auth.Password.Send, PasswordSend_LE, SM );
52 } else if( PapChap_RB->isChecked() ) { 58 } else if( PAP_Checked() ) {
53 TXTM( D.Auth.Client, Client_LE, SM ); 59 TXTM( D.Auth.Client, Client_LE, SM );
@@ -55,3 +61,9 @@ bool PPPAuthEdit::commit( PPPData_t & D ) {
55 TXTM( D.Auth.Secret, Secret_LE, SM ); 61 TXTM( D.Auth.Secret, Secret_LE, SM );
56 CIM( D.Auth.PCEMode, AuthMethod_CB, SM ); 62 if( Pap_RB->isChecked() ) {
63 D.Auth.PCEMode = 0;
64 } else if( Chap_RB->isChecked() ) {
65 D.Auth.PCEMode = 1;
66 } else if( EAP_RB->isChecked() ) {
67 D.Auth.PCEMode = 2;
68 }
57 } 69 }
@@ -64,9 +76,19 @@ void PPPAuthEdit::showData( PPPData_t & D ) {
64 case 0 : 76 case 0 :
65 Login_RB->isChecked(); 77 Login_RB->setChecked( TRUE );
78 break;
79 case 1 :
80 switch( D.Auth.PCEMode ) {
81 case 0 :
82 Pap_RB->setChecked( TRUE );
66 break; 83 break;
67 case 1 : 84 case 1 :
68 PapChap_RB->isChecked(); 85 Chap_RB->setChecked( TRUE );
69 break; 86 break;
70 case 2 : 87 case 2 :
71 Terminal_RB->isChecked(); 88 EAP_RB->setChecked( TRUE );
89 break;
90 }
91 break;
92 case 2 :
93 Terminal_RB->setChecked( TRUE );
72 break; 94 break;
@@ -82,4 +104,2 @@ void PPPAuthEdit::showData( PPPData_t & D ) {
82 Secret_LE->setText( D.Auth.Secret ); 104 Secret_LE->setText( D.Auth.Secret );
83
84 AuthMethod_CB->setCurrentItem( D.Auth.PCEMode );
85} 105}
diff --git a/noncore/settings/networksettings2/ppp/PPPAuthedit.h b/noncore/settings/networksettings2/ppp/PPPAuthedit.h
index cbd540e..2392569 100644
--- a/noncore/settings/networksettings2/ppp/PPPAuthedit.h
+++ b/noncore/settings/networksettings2/ppp/PPPAuthedit.h
@@ -11,2 +11,4 @@ public :
11 void showData( PPPData_t & Data ); 11 void showData( PPPData_t & Data );
12 bool PAP_Checked( void );
13
12 14
diff --git a/noncore/settings/networksettings2/ppp/ppp_NN.cpp b/noncore/settings/networksettings2/ppp/ppp_NN.cpp
index b7edf87..ff4465c 100644
--- a/noncore/settings/networksettings2/ppp/ppp_NN.cpp
+++ b/noncore/settings/networksettings2/ppp/ppp_NN.cpp
@@ -1 +1,3 @@
1#include <qfile.h>
2#include <qtextstream.h>
1#include "ppp_NN.h" 3#include "ppp_NN.h"
@@ -3,2 +5,4 @@
3 5
6QStringList * PPPNetNode::ProperFiles = 0;
7
4static const char * PPPNeeds[] = 8static const char * PPPNeeds[] =
@@ -13,2 +17,13 @@ static const char * PPPNeeds[] =
13PPPNetNode::PPPNetNode() : ANetNode(tr("PPP Connection")) { 17PPPNetNode::PPPNetNode() : ANetNode(tr("PPP Connection")) {
18
19 // proper files : will leak
20 ProperFiles =new QStringList;
21 *ProperFiles << "peers";
22 *ProperFiles << "chatscript";
23
24 // system files
25 NSResources->addSystemFile(
26 "pap-secrets", "/tmp/pap-secrets", 0 );
27 NSResources->addSystemFile(
28 "chap-secrets", "/tmp/chap-secrets", 0 );
14} 29}
@@ -41,11 +56,13 @@ const char * PPPNetNode::provides( void ) {
41 56
42bool PPPNetNode::generateProperFilesFor( 57QStringList * PPPNetNode::properFiles( void ) {
43 ANetNodeInstance * ) { 58 return ProperFiles;
44 return 0; 59
45} 60}
46 61
47bool PPPNetNode::generateDeviceDataForCommonFile( 62// need to generate :
48 SystemFile & , 63// /etc/ppp/pap-secrets
49 long ) { 64// /etc/ppp/pap-secrets
50 return 0; 65bool PPPNetNode::hasDataForFile( const QString & S ) {
66 return S == "pap-secrets" ||
67 S == "chap-secrets" ;
51} 68}
diff --git a/noncore/settings/networksettings2/ppp/ppp_NN.h b/noncore/settings/networksettings2/ppp/ppp_NN.h
index b1483c4..249be5a 100644
--- a/noncore/settings/networksettings2/ppp/ppp_NN.h
+++ b/noncore/settings/networksettings2/ppp/ppp_NN.h
@@ -19,6 +19,6 @@ public:
19 19
20 virtual const QString nodeDescription() ; 20 virtual bool hasDataForFile( const QString & S );
21 21
22 virtual const QString nodeDescription() ;
22 virtual ANetNodeInstance * createInstance( void ); 23 virtual ANetNodeInstance * createInstance( void );
23
24 virtual const char ** needs( void ); 24 virtual const char ** needs( void );
@@ -26,9 +26,4 @@ public:
26 26
27 virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
28 virtual bool hasDataFor( const QString & )
29 { return 0; }
30 virtual bool generateDeviceDataForCommonFile(
31 SystemFile & SF, long DevNr );
32
33 virtual QString genNic( long NicNr ); 27 virtual QString genNic( long NicNr );
28 virtual QStringList * properFiles( void );
34 29
@@ -38,2 +33,4 @@ private:
38 virtual void saveSpecificAttribute( QTextStream & TS ); 33 virtual void saveSpecificAttribute( QTextStream & TS );
34
35 static QStringList * ProperFiles;
39}; 36};
diff --git a/noncore/settings/networksettings2/ppp/ppp_NNI.cpp b/noncore/settings/networksettings2/ppp/ppp_NNI.cpp
index d0fd31c..ba639de 100644
--- a/noncore/settings/networksettings2/ppp/ppp_NNI.cpp
+++ b/noncore/settings/networksettings2/ppp/ppp_NNI.cpp
@@ -1 +1,3 @@
1#include <qfile.h>
2#include <qfileinfo.h>
1#include "PPPedit.h" 3#include "PPPedit.h"
@@ -115,7 +117,105 @@ void APPP::commit( void ) {
115 117
116bool APPP::generateDataForCommonFile( 118QFile * APPP::openFile( const QString & ID ) {
117 SystemFile & , 119 QFile * F = 0;
118 long) { 120 QString S;
119 return 1; 121
122 if( ID == "peers" ) {
123 S = removeSpaces( QString("/tmp/") + connection()->name() );
124
125 F = new QFile( S );
126
127 if( ! F->open( IO_WriteOnly ) ) {
128 Log(("Cannot open file %s\n", S.latin1() ));
129 return 0;
120} 130}
131 } else if ( ID == "chatscripts" ) {
132 S = removeSpaces( QString("/tmp/") + connection()->name() + ".chat" );
133 F = new QFile( S );
121 134
135 if( ! F->open( IO_WriteOnly ) ) {
136 Log(("Cannot open file %s\n", S.latin1() ));
137 return 0;
138 }
139 }
140 if( F ) {
141 Log(("Generate proper file %s = %s\n",
142 ID.latin1(), F->name().latin1()));
143 }
144 return F;
145}
146
147short APPP::generateFile( const QString & ID,
148 const QString & Path,
149 QTextStream & TS,
150 long DevNr ) {
151 short rvl, rvd;
152
153 rvl = 1;
154 rvd = 1;
155
156 if( ID == "pap-secrets" ) {
157 Log(("Generate PPP for %s\n", ID.latin1() ));
158 if( Data.Auth.Mode == 1 && Data.Auth.PCEMode == 0 ) {
159 TS << "# secrets for "
160 << connection()->name().latin1()
161 << endl;
162 TS << Data.Auth.Client
163 << " "
164 << Data.Auth.Server
165 << " "
166 << Data.Auth.Secret
167 << endl;
168 rvl = 0;
169 rvd = connection()->getToplevel()->generateFileEmbedded(
170 ID, Path, TS, DevNr );
171 }
172 } else if( ID == "chap-secrets" ) {
173 Log(("Generate PPP for %s\n", ID.latin1() ));
174 if( Data.Auth.Mode == 1 && Data.Auth.PCEMode != 0 ) {
175 // used for both EAP and Chap
176 TS << "# secrets for "
177 << connection()->name().latin1()
178 << endl;
179 TS << Data.Auth.Client
180 << " "
181 << Data.Auth.Server
182 << " "
183 << Data.Auth.Secret
184 << endl;
185
186 rvl = 0;
187 rvd = connection()->getToplevel()->generateFileEmbedded(
188 ID, Path, TS, DevNr );
189 }
190 } else if ( ID == "peers" ) {
191 QFileInfo FI(Path);
192 Log(("Generate PPP for %s\n", ID.latin1() ));
193
194 TS << "connect \"/usr/sbin/chat -v -f /etc/ppp/"
195 << FI.baseName()
196 << ".chat\""
197 << endl;
198
199 if( Data.IP.GWIsDefault ) {
200 TS << "defaultroute"
201 << endl;
202 }
203
204 TS << "linkname "
205 << removeSpaces( ID.latin1() )
206 << endl;
207
208 // insert other data here
209 rvl = 0;
210 rvd = connection()->getToplevel()->generateFileEmbedded(
211 ID, Path, TS, DevNr );
212 } else if ( ID == "chatscripts" ) {
213 Log(("Generate PPP for %s\n", ID.latin1() ));
214 rvl = 0;
215 rvd = connection()->getToplevel()->generateFileEmbedded(
216 ID, Path, TS, DevNr );
217 }
218
219 return (rvd == 2 || rvl == 2 ) ? 2 :
220 (rvd == 0 || rvl == 0 ) ? 0 : 1;
221}
diff --git a/noncore/settings/networksettings2/ppp/ppp_NNI.h b/noncore/settings/networksettings2/ppp/ppp_NNI.h
index 989c2f0..0bf8fa9 100644
--- a/noncore/settings/networksettings2/ppp/ppp_NNI.h
+++ b/noncore/settings/networksettings2/ppp/ppp_NNI.h
@@ -9,2 +9,3 @@ class PPPNetNode;
9class PPPEdit; 9class PPPEdit;
10class QTextStream;
10 11
@@ -16,9 +17,6 @@ public :
16 17
17 QWidget * edit( QWidget * parent );
18 QString acceptable( void );
19 void commit( void );
20
21 RuntimeInfo * runtime( void ) 18 RuntimeInfo * runtime( void )
22 { if( RT == 0 ) 19 { if( RT == 0 ) {
23 RT = new PPPRun( this, Data ); 20 RT = new PPPRun( this, Data );
21 }
24 return RT->runtimeInfo(); 22 return RT->runtimeInfo();
@@ -26,2 +24,6 @@ public :
26 24
25 QWidget * edit( QWidget * parent );
26 QString acceptable( void );
27 void commit( void );
28
27 virtual void * data( void ) 29 virtual void * data( void )
@@ -29,7 +31,8 @@ public :
29 31
30 virtual bool hasDataFor( const QString & ) 32 virtual QFile * openFile( const QString & ID );
31 { return 0; } 33 short generateFile( const QString & ID,
34 const QString & Path,
35 QTextStream & TS,
36 long DevNr );
32 37
33 virtual bool generateDataForCommonFile(
34 SystemFile & SF, long DevNr );
35protected : 38protected :
diff --git a/noncore/settings/networksettings2/profile/profile_NN.cpp b/noncore/settings/networksettings2/profile/profile_NN.cpp
index 59c34a3..945b48d 100644
--- a/noncore/settings/networksettings2/profile/profile_NN.cpp
+++ b/noncore/settings/networksettings2/profile/profile_NN.cpp
@@ -11,3 +11,3 @@ static const char * ProfileNeeds[] =
11 */ 11 */
12ProfileNetNode::ProfileNetNode() : ANetNode( tr("Regular profile")) { 12ProfileNetNode::ProfileNetNode() : ANetNode( tr("Regular connection profile")) {
13} 13}
@@ -40,13 +40,2 @@ const char * ProfileNetNode::provides( void ) {
40 40
41bool ProfileNetNode::generateProperFilesFor(
42 ANetNodeInstance * ) {
43 return 0;
44}
45
46bool ProfileNetNode::generateDeviceDataForCommonFile(
47 SystemFile & ,
48 long ) {
49 return 0;
50}
51
52void ProfileNetNode::setSpecificAttribute( QString & , QString & ) { 41void ProfileNetNode::setSpecificAttribute( QString & , QString & ) {
diff --git a/noncore/settings/networksettings2/profile/profile_NN.h b/noncore/settings/networksettings2/profile/profile_NN.h
index e602bd7..1f1ee2c 100644
--- a/noncore/settings/networksettings2/profile/profile_NN.h
+++ b/noncore/settings/networksettings2/profile/profile_NN.h
@@ -20,5 +20,3 @@ public:
20 virtual const QString nodeDescription() ; 20 virtual const QString nodeDescription() ;
21
22 virtual ANetNodeInstance * createInstance( void ); 21 virtual ANetNodeInstance * createInstance( void );
23
24 virtual const char ** needs( void ); 22 virtual const char ** needs( void );
@@ -26,8 +24,2 @@ public:
26 24
27 virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
28 virtual bool hasDataFor( const QString & )
29 { return 0; }
30 virtual bool generateDeviceDataForCommonFile(
31 SystemFile & SF, long DevNr);
32
33private: 25private:
diff --git a/noncore/settings/networksettings2/profile/profile_NNI.cpp b/noncore/settings/networksettings2/profile/profile_NNI.cpp
index cb52b2a..f0f0b97 100644
--- a/noncore/settings/networksettings2/profile/profile_NNI.cpp
+++ b/noncore/settings/networksettings2/profile/profile_NNI.cpp
@@ -52,7 +52,26 @@ void AProfile::commit( void ) {
52 52
53bool AProfile::generateDataForCommonFile( 53short AProfile::generateFileEmbedded( const QString & ID,
54 SystemFile & , 54 const QString & Path,
55 long) { 55 QTextStream & TS,
56 return 1; 56 long DevNr ) {
57
58 short rvl, rvd;
59
60 rvl = 1;
61
62 if( ID == "interfaces" ) {
63 Log(("Generate Profile for %s\n", ID.latin1() ));
64 if( Data.TriggerVPN ) {
65 // this profile triggers VPN -> insert trigger
66 TS << " up networksettings2 --triggervpn"
67 << endl;
68 rvl = 0;
69 }
57} 70}
71 rvd = ANetNodeInstance::generateFileEmbedded( ID, Path, TS, DevNr );
72 return (rvd == 2 || rvl == 2 ) ? 2 :
73 (rvd == 0 || rvl == 0 ) ? 0 : 1;
74}
75
76
58 77
diff --git a/noncore/settings/networksettings2/profile/profile_NNI.h b/noncore/settings/networksettings2/profile/profile_NNI.h
index 2c2db7f..957f4af 100644
--- a/noncore/settings/networksettings2/profile/profile_NNI.h
+++ b/noncore/settings/networksettings2/profile/profile_NNI.h
@@ -16,2 +16,7 @@ public :
16 16
17 RuntimeInfo * runtime( void )
18 { return
19 ( RT ) ? RT : ( RT = new ProfileRun( this, Data ) );
20 }
21
17 QWidget * edit( QWidget * parent ); 22 QWidget * edit( QWidget * parent );
@@ -20,10 +25,2 @@ public :
20 25
21 const QString & description( void )
22 { return Data.Description; }
23 RuntimeInfo * runtime( void )
24 { if( RT == 0 )
25 RT = new ProfileRun( this, Data );
26 return RT;
27 }
28
29 virtual void * data( void ) 26 virtual void * data( void )
@@ -31,7 +28,9 @@ public :
31 28
32 virtual bool hasDataFor( const QString & ) 29 virtual short generateFileEmbedded( const QString & ID,
33 { return 0; } 30 const QString & Path,
31 QTextStream & TS,
32 long DevNr );
34 33
35 virtual bool generateDataForCommonFile( 34 const QString & description( void )
36 SystemFile & SF, long DevNr); 35 { return Data.Description; }
37 36
diff --git a/noncore/settings/networksettings2/usb/usb_NN.cpp b/noncore/settings/networksettings2/usb/usb_NN.cpp
index c10a09c..14c479a 100644
--- a/noncore/settings/networksettings2/usb/usb_NN.cpp
+++ b/noncore/settings/networksettings2/usb/usb_NN.cpp
@@ -39,25 +39,2 @@ const char * USBNetNode::provides( void ) {
39 39
40bool USBNetNode::generateProperFilesFor(
41 ANetNodeInstance * ) {
42 return 0;
43}
44
45bool USBNetNode::hasDataFor( const QString & S ) {
46 return (S== "interfaces");
47}
48
49bool USBNetNode::generateDeviceDataForCommonFile(
50 SystemFile & S ,
51 long DevNr ) {
52 QString NIC = genNic( DevNr );
53
54 if( S.name() == "interfaces" ) {
55 // generate mapping stanza for this interface
56 S << "# check if " << NIC << " can be brought UP" << endl;
57 S << "mapping " << NIC << endl;
58 S << " script networksettings2-request" << endl << endl;
59 }
60 return 0;
61}
62
63QString USBNetNode::genNic( long ) { 40QString USBNetNode::genNic( long ) {
diff --git a/noncore/settings/networksettings2/usb/usb_NN.h b/noncore/settings/networksettings2/usb/usb_NN.h
index fea89f0..73da15a 100644
--- a/noncore/settings/networksettings2/usb/usb_NN.h
+++ b/noncore/settings/networksettings2/usb/usb_NN.h
@@ -20,5 +20,3 @@ public:
20 virtual const QString nodeDescription() ; 20 virtual const QString nodeDescription() ;
21
22 virtual ANetNodeInstance * createInstance( void ); 21 virtual ANetNodeInstance * createInstance( void );
23
24 virtual const char ** needs( void ); 22 virtual const char ** needs( void );
@@ -26,7 +24,2 @@ public:
26 24
27 virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
28 virtual bool hasDataFor( const QString & S);
29 virtual bool generateDeviceDataForCommonFile(
30 SystemFile & SF, long DevNr );
31
32 virtual QString genNic( long nr ); 25 virtual QString genNic( long nr );
diff --git a/noncore/settings/networksettings2/usb/usb_NNI.cpp b/noncore/settings/networksettings2/usb/usb_NNI.cpp
index e90204c..50c6e8d 100644
--- a/noncore/settings/networksettings2/usb/usb_NNI.cpp
+++ b/noncore/settings/networksettings2/usb/usb_NNI.cpp
@@ -34,12 +34,16 @@ void AUSB::commit( void ) {
34 34
35bool AUSB::hasDataFor( const QString & S ) { 35short AUSB::generateFileEmbedded( const QString & ID,
36 return (S== "interfaces"); 36 const QString & Path,
37} 37 QTextStream & TS,
38 long DevNr ) {
38 39
39bool AUSB::generateDataForCommonFile( SystemFile & S, long DevNr ) {
40 QString NIC = runtime()->device()->netNode()->nodeClass()->genNic( DevNr ); 40 QString NIC = runtime()->device()->netNode()->nodeClass()->genNic( DevNr );
41 short rvl, rvd;
42
43 rvl = 1;
41 44
42 if( S.name() == "interfaces" ) { 45 if( ID == "interfaces" ) {
46 Log(("Generate USB for %s\n", ID.latin1() ));
43 // generate mapping stanza for this interface 47 // generate mapping stanza for this interface
44 S << " pre-up " 48 TS << " pre-up "
45 << QPEApplication::qpeDir() 49 << QPEApplication::qpeDir()
@@ -49,4 +53,9 @@ bool AUSB::generateDataForCommonFile( SystemFile & S, long DevNr ) {
49 << endl; 53 << endl;
54 rvl = 0;
50 } 55 }
51 return 0; 56 rvd = ANetNodeInstance::generateFileEmbedded( ID, Path, TS, DevNr );
57
58 return (rvd == 2 || rvl == 2 ) ? 2 :
59 (rvd == 0 || rvl == 0 ) ? 0 : 1;
60
52} 61}
diff --git a/noncore/settings/networksettings2/usb/usb_NNI.h b/noncore/settings/networksettings2/usb/usb_NNI.h
index d2ee217..fcdfd91 100644
--- a/noncore/settings/networksettings2/usb/usb_NNI.h
+++ b/noncore/settings/networksettings2/usb/usb_NNI.h
@@ -16,2 +16,7 @@ public :
16 16
17 RuntimeInfo * runtime( void )
18 { return
19 ( RT ) ? RT : ( RT = new USBRun( this, Data ) );
20 }
21
17 QWidget * edit( QWidget * parent ); 22 QWidget * edit( QWidget * parent );
@@ -20,8 +25,2 @@ public :
20 25
21 RuntimeInfo * runtime( void )
22 { if( RT == 0 )
23 RT = new USBRun( this, Data );
24 return RT;
25 }
26
27 virtual void * data( void ) 26 virtual void * data( void )
@@ -29,5 +28,6 @@ public :
29 28
30 virtual bool hasDataFor( const QString & S); 29 virtual short generateFileEmbedded( const QString & ID,
31 virtual bool generateDataForCommonFile( 30 const QString & Path,
32 SystemFile & SF, long DevNr ); 31 QTextStream & TS,
32 long DevNr );
33 33
diff --git a/noncore/settings/networksettings2/vpn/vpn_NN.cpp b/noncore/settings/networksettings2/vpn/vpn_NN.cpp
index 6c7b308..9d3b6e7 100644
--- a/noncore/settings/networksettings2/vpn/vpn_NN.cpp
+++ b/noncore/settings/networksettings2/vpn/vpn_NN.cpp
@@ -4,4 +4,3 @@
4static const char * VPNNeeds[] = 4static const char * VPNNeeds[] =
5 { "connection", 5 { 0
6 0
7 }; 6 };
@@ -40,13 +39,2 @@ const char * VPNNetNode::provides( void ) {
40 39
41bool VPNNetNode::generateProperFilesFor(
42 ANetNodeInstance * ) {
43 return 0;
44}
45
46bool VPNNetNode::generateDeviceDataForCommonFile(
47 SystemFile & ,
48 long ) {
49 return 0;
50}
51
52void VPNNetNode::setSpecificAttribute( QString & , QString & ) { 40void VPNNetNode::setSpecificAttribute( QString & , QString & ) {
diff --git a/noncore/settings/networksettings2/vpn/vpn_NN.h b/noncore/settings/networksettings2/vpn/vpn_NN.h
index 5b6632e..3c7b5e0 100644
--- a/noncore/settings/networksettings2/vpn/vpn_NN.h
+++ b/noncore/settings/networksettings2/vpn/vpn_NN.h
@@ -20,5 +20,3 @@ public:
20 virtual const QString nodeDescription() ; 20 virtual const QString nodeDescription() ;
21
22 virtual ANetNodeInstance * createInstance( void ); 21 virtual ANetNodeInstance * createInstance( void );
23
24 virtual const char ** needs( void ); 22 virtual const char ** needs( void );
@@ -26,8 +24,2 @@ public:
26 24
27 virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
28 virtual bool hasDataFor( const QString & )
29 { return 0; }
30 virtual bool generateDeviceDataForCommonFile(
31 SystemFile & SF, long DevNr );
32
33private: 25private:
diff --git a/noncore/settings/networksettings2/vpn/vpn_NNI.cpp b/noncore/settings/networksettings2/vpn/vpn_NNI.cpp
index ee999e8..6c20aeb 100644
--- a/noncore/settings/networksettings2/vpn/vpn_NNI.cpp
+++ b/noncore/settings/networksettings2/vpn/vpn_NNI.cpp
@@ -30,7 +30 @@ void AVPN::commit( void ) {
30
31bool AVPN::generateDataForCommonFile(
32 SystemFile & ,
33 long) {
34 return 1;
35}
36
diff --git a/noncore/settings/networksettings2/vpn/vpn_NNI.h b/noncore/settings/networksettings2/vpn/vpn_NNI.h
index c3eb016..aee5891 100644
--- a/noncore/settings/networksettings2/vpn/vpn_NNI.h
+++ b/noncore/settings/networksettings2/vpn/vpn_NNI.h
@@ -16,2 +16,7 @@ public :
16 16
17 RuntimeInfo * runtime( void )
18 { return
19 ( RT ) ? RT : ( RT = new VPNRun( this, Data ) );
20 }
21
17 QWidget * edit( QWidget * parent ); 22 QWidget * edit( QWidget * parent );
@@ -20,8 +25,2 @@ public :
20 25
21 RuntimeInfo * runtime( void )
22 { if( RT == 0 )
23 RT = new VPNRun( this, Data );
24 return RT;
25 }
26
27 virtual void * data( void ) 26 virtual void * data( void )
@@ -29,6 +28,3 @@ public :
29 28
30 virtual bool hasDataFor( const QString & ) 29
31 { return 0; }
32 virtual bool generateDataForCommonFile(
33 SystemFile & SF, long DevNr );
34protected : 30protected :
diff --git a/noncore/settings/networksettings2/wlan/wlan_NN.cpp b/noncore/settings/networksettings2/wlan/wlan_NN.cpp
index ce8a734..e4c3f60 100644
--- a/noncore/settings/networksettings2/wlan/wlan_NN.cpp
+++ b/noncore/settings/networksettings2/wlan/wlan_NN.cpp
@@ -40,25 +40,2 @@ const char * WLanNetNode::provides( void ) {
40 40
41bool WLanNetNode::generateProperFilesFor(
42 ANetNodeInstance * ) {
43 return 0;
44}
45
46bool WLanNetNode::hasDataFor( const QString & S ) {
47 return S == "interfaces";
48}
49
50bool WLanNetNode::generateDeviceDataForCommonFile(
51 SystemFile & S,
52 long DevNr ) {
53 QString NIC = genNic( DevNr );
54
55 if( S.name() == "interfaces" ) {
56 // generate mapping stanza for this interface
57 S << "# check if " << NIC << " can be brought UP" << endl;
58 S << "mapping " << NIC << endl;
59 S << " script networksettings2-request" << endl << endl;
60 }
61 return 0;
62}
63
64QString WLanNetNode::genNic( long nr ) { 41QString WLanNetNode::genNic( long nr ) {
diff --git a/noncore/settings/networksettings2/wlan/wlan_NN.h b/noncore/settings/networksettings2/wlan/wlan_NN.h
index b5ff3fd..c13c05c 100644
--- a/noncore/settings/networksettings2/wlan/wlan_NN.h
+++ b/noncore/settings/networksettings2/wlan/wlan_NN.h
@@ -20,5 +20,3 @@ public:
20 virtual const QString nodeDescription() ; 20 virtual const QString nodeDescription() ;
21
22 virtual ANetNodeInstance * createInstance( void ); 21 virtual ANetNodeInstance * createInstance( void );
23
24 virtual const char ** needs( void ); 22 virtual const char ** needs( void );
@@ -26,11 +24,4 @@ public:
26 24
27 virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
28
29 virtual bool hasDataFor( const QString & S );
30 virtual bool generateDeviceDataForCommonFile(
31 SystemFile & SF, long DevNr );
32
33 virtual long instanceCount( void ) 25 virtual long instanceCount( void )
34 { return InstanceCount; } 26 { return InstanceCount; }
35
36 virtual QString genNic( long ); 27 virtual QString genNic( long );
diff --git a/noncore/settings/networksettings2/wlan/wlan_NNI.cpp b/noncore/settings/networksettings2/wlan/wlan_NNI.cpp
index 61969f2..0e4fc4c 100644
--- a/noncore/settings/networksettings2/wlan/wlan_NNI.cpp
+++ b/noncore/settings/networksettings2/wlan/wlan_NNI.cpp
@@ -81,7 +81,14 @@ void AWLan::commit( void ) {
81 81
82bool AWLan::generateDataForCommonFile( 82short AWLan::generateFileEmbedded( const QString & ID,
83 SystemFile & S, 83 const QString & Path,
84 long ) { 84 QTextStream & TS,
85 long DevNr ) {
85 86
86 S << " wireless_essid \"" 87 short rvl, rvd;
88
89 rvl = 1;
90
91 if( ID == "interfaces" ) {
92 Log(("Generate WLanNNI for %s\n", ID.latin1() ));
93 TS << " wireless_essid \""
87 << Data.ESSID 94 << Data.ESSID
@@ -95,3 +102,3 @@ bool AWLan::generateDataForCommonFile(
95 Buf[99] = '\0'; // just to make sure 102 Buf[99] = '\0'; // just to make sure
96 S << " wireless_nick " 103 TS << " wireless_nick "
97 << Buf 104 << Buf
@@ -100,3 +107,3 @@ bool AWLan::generateDataForCommonFile(
100 } else { 107 } else {
101 S << " wireless_nick \"" 108 TS << " wireless_nick \""
102 << Data.NodeName 109 << Data.NodeName
@@ -107,6 +114,5 @@ bool AWLan::generateDataForCommonFile(
107 114
108 char * M; 115 char * M = "Auto";
109 switch ( Data.Mode ) { 116 switch ( Data.Mode ) {
110 case 0 : 117 case 0 :
111 M = "Auto";
112 break; 118 break;
@@ -120,3 +126,3 @@ bool AWLan::generateDataForCommonFile(
120 126
121 S << " wireless_mode " 127 TS << " wireless_mode "
122 << M 128 << M
@@ -126,3 +132,3 @@ bool AWLan::generateDataForCommonFile(
126 if( ! Data.Key[i].isEmpty() ) { 132 if( ! Data.Key[i].isEmpty() ) {
127 S << " wireless_key" 133 TS << " wireless_key"
128 << i 134 << i
@@ -133,3 +139,3 @@ bool AWLan::generateDataForCommonFile(
133 } 139 }
134 S << " wireless_keymode " 140 TS << " wireless_keymode "
135 << ((Data.AcceptNonEncrypted) ? "open" : "restricted") 141 << ((Data.AcceptNonEncrypted) ? "open" : "restricted")
@@ -137,3 +143,8 @@ bool AWLan::generateDataForCommonFile(
137 } 143 }
138 return 0; 144 rvl = 0;
145 }
146 rvd = ANetNodeInstance::generateFileEmbedded( ID, Path, TS, DevNr);
147
148 return (rvd == 2 || rvl == 2 ) ? 2 :
149 (rvd == 0 || rvl == 0 ) ? 0 : 1;
139} 150}
diff --git a/noncore/settings/networksettings2/wlan/wlan_NNI.h b/noncore/settings/networksettings2/wlan/wlan_NNI.h
index 2211c47..a9be65f 100644
--- a/noncore/settings/networksettings2/wlan/wlan_NNI.h
+++ b/noncore/settings/networksettings2/wlan/wlan_NNI.h
@@ -16,2 +16,7 @@ public :
16 16
17 RuntimeInfo * runtime( void )
18 { return
19 ( RT ) ? RT : ( RT = new WLanRun( this, Data ) );
20 }
21
17 QWidget * edit( QWidget * parent ); 22 QWidget * edit( QWidget * parent );
@@ -20,8 +25,2 @@ public :
20 25
21 RuntimeInfo * runtime( void )
22 { if( RT == 0 )
23 RT = new WLanRun( this, Data );
24 return RT;
25 }
26
27 virtual void * data( void ) 26 virtual void * data( void )
@@ -29,6 +28,7 @@ public :
29 28
30 virtual bool hasDataFor( const QString & ) 29 virtual short generateFileEmbedded( const QString & ID,
31 { return 1; } 30 const QString & Path,
32 virtual bool generateDataForCommonFile( 31 QTextStream & TS,
33 SystemFile & SF, long DevNr ); 32 long DevNr );
33
34protected : 34protected :