summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (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 ) {
}
-
-bool ABluetoothBNEP::hasDataFor( const QString & ) {
- return 0;
-}
-
-bool ABluetoothBNEP::generateDataForCommonFile( SystemFile & , long ){
- return 0;
-}
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 :
+ RuntimeInfo * runtime( void )
+ { return
+ ( RT ) ? RT : ( RT = new BluetoothBNEPRun( this, Data ) );
+ }
+
QWidget * edit( QWidget * parent );
@@ -20,8 +25,2 @@ public :
- RuntimeInfo * runtime( void )
- { if( RT == 0 )
- RT = new BluetoothBNEPRun( this, Data );
- return RT;
- }
-
virtual void * data( void )
@@ -29,5 +28,2 @@ public :
- virtual bool hasDataFor( const QString & S );
- virtual bool generateDataForCommonFile( SystemFile & SF, long );
-
protected :
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 ) {
}
-
-bool ABluetoothRFCOMM::hasDataFor( const QString & ) {
- return 0;
-}
-
-bool ABluetoothRFCOMM::generateDataForCommonFile( SystemFile & , long ){
- return 0;
-}
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 :
+ RuntimeInfo * runtime( void )
+ { return
+ ( RT ) ? RT : ( RT = new BluetoothRFCOMMRun( this, Data ) );
+ }
+
QWidget * edit( QWidget * parent );
@@ -20,8 +25,2 @@ public :
- RuntimeInfo * runtime( void )
- { if( RT == 0 )
- RT = new BluetoothRFCOMMRun( this, Data );
- return RT;
- }
-
virtual void * data( void )
@@ -29,5 +28,2 @@ public :
- virtual bool hasDataFor( const QString & S );
- virtual bool generateDataForCommonFile( SystemFile & SF, long );
-
protected :
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 :
+ virtual QString deviceFile( void )
+ { return QString( "/dev/rfcomm..." ); }
+
protected :
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 ) {
-bool BluetoothBNEPNetNode::generateProperFilesFor(
- ANetNodeInstance * ) {
- return 0;
-}
-
-bool BluetoothBNEPNetNode::hasDataFor( const QString & S ) {
- return S == "interfaces";
-}
-
-bool BluetoothBNEPNetNode::generateDeviceDataForCommonFile(
- SystemFile & S ,
- long DevNr) {
- QString NIC = genNic( DevNr );
-
- if( S.name() == "interfaces" ) {
- // generate mapping stanza for this interface
- S << "# check if " << NIC << " can be brought UP" << endl;
- S << "mapping " << NIC << endl;
- S << " script networksettings2-request" << endl << endl;
- }
- return 0;
-}
-
QString BluetoothBNEPNetNode::genNic( long nr ) {
@@ -126,17 +103,2 @@ const char * BluetoothRFCOMMNetNode::provides( void ) {
-bool BluetoothRFCOMMNetNode::generateProperFilesFor(
- ANetNodeInstance * ) {
- return 0;
-}
-
-bool BluetoothRFCOMMNetNode::hasDataFor( const QString & ) {
- return 0;
-}
-
-bool BluetoothRFCOMMNetNode::generateDeviceDataForCommonFile(
- SystemFile & ,
- long ) {
- return 0;
-}
-
void 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:
+ virtual QString genNic( long );
+ virtual long instanceCount( void )
+ { return InstanceCount; }
virtual const QString pixmapName()
@@ -20,16 +23,5 @@ public:
virtual const QString nodeDescription() ;
-
virtual ANetNodeInstance * createInstance( void );
-
- virtual const char ** needs( void );
virtual const char * provides( void );
-
- virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
- virtual bool hasDataFor( const QString & S );
- virtual bool generateDeviceDataForCommonFile(
- SystemFile & , long DevNr );
-
- virtual long instanceCount( void )
- { return InstanceCount; }
- virtual QString genNic( long );
+ virtual const char ** needs( void );
@@ -58,5 +50,3 @@ public:
virtual const QString nodeDescription() ;
-
virtual ANetNodeInstance * createInstance( void );
-
virtual const char ** needs( void );
@@ -64,7 +54,2 @@ public:
- virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
- virtual bool hasDataFor( const QString & S );
- virtual bool generateDeviceDataForCommonFile(
- SystemFile & , long );
-
private:
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 ) {
-bool CableNetNode::generateProperFilesFor(
- ANetNodeInstance * ) {
- return 0;
-}
-
-bool CableNetNode::generateDeviceDataForCommonFile(
- SystemFile & ,
- long ) {
- return 0;
-}
-
void 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:
virtual const QString nodeDescription() ;
-
virtual ANetNodeInstance * createInstance( void );
-
virtual const char ** needs( void );
@@ -26,8 +24,2 @@ public:
- virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
- virtual bool hasDataFor( const QString & )
- { return 0; }
- virtual bool generateDeviceDataForCommonFile(
- SystemFile & SF, long DevNr);
-
private:
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 ) {
+short ACable::generateFileEmbedded( const QString & ID,
+ const QString & Path,
+ QTextStream & TS,
+ long DevNr ) {
+ short rvl, rvd;
+
+ rvl = 1;
+ if( ID == "peers" ) {
+ TS << Data.Device
+ << endl;
+ TS << Data.Speed
+ << endl;
+ TS << "lock "
+ << Data.LockFile
+ << endl;
+ rvl = 0;
+ }
+
+ rvd = ANetNodeInstance::generateFileEmbedded( ID, Path, TS, DevNr );
+ return (rvd == 2 || rvl == 2 ) ? 2 :
+ (rvd == 0 || rvl == 0 ) ? 0 : 1;
+}
+
QWidget * ACable::edit( QWidget * parent ) {
@@ -66,8 +89 @@ void ACable::commit( void ) {
}
-
-bool ACable::generateDataForCommonFile(
- SystemFile & ,
- long ) {
- return 1;
-}
-
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 :
+ RuntimeInfo * runtime( void )
+ { return
+ ( RT ) ? RT : ( RT = new CableRun( this, Data ) );
+ }
+
QWidget * edit( QWidget * parent );
@@ -20,8 +25,2 @@ public :
- RuntimeInfo * runtime( void )
- { if( RT == 0 )
- RT = new CableRun( this, Data );
- return RT;
- }
-
virtual void * data( void )
@@ -29,7 +28,6 @@ public :
- virtual bool hasDataFor( const QString & )
- { return 0; }
- virtual bool generateDataForCommonFile(
- SystemFile & SF, long DevNr );
-
+ short generateFileEmbedded( const QString & ID,
+ const QString & Path,
+ QTextStream & TS,
+ long DevNr );
protected :
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 ) {
- int fd = open( D->Device.latin1(), O_RDWR );
+ int fd = open( Data->Device.latin1(), O_RDWR );
@@ -26 +26,5 @@ bool CableRun::canSetState( State_t , Action_t ) {
}
+
+QString CableRun::deviceFile( void ) {
+ return Data->Device;
+}
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 :
CableRun( ANetNodeInstance * NNI,
- CableData & Data ) : AsLine( NNI )
- { D = &Data; }
+ CableData_t & D ) : AsLine( NNI )
+ { Data = &D; }
@@ -14,2 +14,4 @@ public :
+ virtual QString deviceFile( void );
+
protected :
@@ -22,3 +24,3 @@ private :
- CableData_t * D;
+ CableData_t * Data;
};
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 ) {
-bool IRDANetNode::generateProperFilesFor(
- ANetNodeInstance * ) {
- return 0;
-}
-
-bool IRDANetNode::generateDeviceDataForCommonFile(
- SystemFile & ,
- long ) {
- return 0;
-}
-
void 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:
virtual const QString nodeDescription() ;
-
virtual ANetNodeInstance * createInstance( void );
-
virtual const char ** needs( void );
@@ -26,8 +24,2 @@ public:
- virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
- virtual bool hasDataFor( const QString & )
- { return 0; }
- virtual bool generateDeviceDataForCommonFile(
- SystemFile & SF, long DevNr );
-
private:
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 ) {
-bool AIRDA::generateDataForCommonFile(
- SystemFile & ,
- long ) {
- return 1;
-}
-
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 :
+ RuntimeInfo * runtime( void )
+ { return
+ ( RT ) ? RT : ( RT = new IRDARun( this, Data ) );
+ }
+
QWidget * edit( QWidget * parent );
@@ -20,8 +25,2 @@ public :
- RuntimeInfo * runtime( void )
- { if( RT == 0 )
- RT = new IRDARun( this, Data );
- return RT;
- }
-
virtual void * data( void )
@@ -29,7 +28,2 @@ public :
- virtual bool hasDataFor( const QString & )
- { return 0; }
- virtual bool generateDataForCommonFile(
- SystemFile & SF, long DevNr );
-
protected :
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 :
+ virtual QString deviceFile( void )
+ { return QString( "/dev/irda" ); }
+
protected :
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 ) {
-bool LanCardNetNode::generateProperFilesFor(
- ANetNodeInstance * ) {
- return 0;
-}
-
-bool LanCardNetNode::hasDataFor( const QString & S ) {
- return S == "interfaces";
-}
-
-bool LanCardNetNode::generateDeviceDataForCommonFile(
- SystemFile & S ,
- long DevNr ) {
- QString NIC = genNic( DevNr );
-
- if( S.name() == "interfaces" ) {
- // generate mapping stanza for this interface
- S << "# check if " << NIC << " can be brought UP" << endl;
- S << "mapping " << NIC << endl;
- S << " script networksettings2-request" << endl << endl;
- }
- return 0;
-}
-
QString 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:
- virtual const QString nodeDescription() ;
+ virtual QString genNic( long );
+ virtual long instanceCount( void )
+ { return InstanceCount; }
+ virtual const QString nodeDescription() ;
virtual ANetNodeInstance * createInstance( void );
-
virtual const char ** needs( void );
@@ -27,12 +29,3 @@ public:
- virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
- virtual bool hasDataFor( const QString & S );
- virtual bool generateDeviceDataForCommonFile(
- SystemFile & SF, long DevNr );
-
- virtual long instanceCount( void )
- { return InstanceCount; }
-
- virtual QString genNic( long );
- virtual QStringList & addressesOfNIC( void )
+ QStringList & addressesOfNIC( void )
{ 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 ) {
-bool ALanCard::generateDataForCommonFile(
- SystemFile & ,
- long ) {
- return 1;
-}
-
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 :
+ RuntimeInfo * runtime( void )
+ { return
+ ( RT ) ? RT : ( RT = new LanCardRun( this, Data ) );
+ }
+
QWidget * edit( QWidget * parent );
@@ -20,8 +25,2 @@ public :
- RuntimeInfo * runtime( void )
- { if( RT == 0 )
- RT = new LanCardRun( this, Data );
- return RT;
- }
-
virtual void * data( void )
@@ -29,6 +28,2 @@ public :
- virtual bool hasDataFor( const QString & )
- { return 0; }
- virtual bool generateDataForCommonFile(
- SystemFile & S, long DevNr );
protected :
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 @@
#include "activateprofile.h"
+#include "activatevpn.h"
#include "networksettings.h"
@@ -23,2 +24,4 @@ OPIE_EXPORT_APP( OApplicationFactory<NetworkSettings> )
#define ACT_PROMPT 3
+// used by interfaces to trigger VPN
+#define ACT_VPN 4
@@ -46,2 +49,5 @@ int main( int argc, char * argv[] ) {
rmv = 1;
+ } else if( strcmp( argv[i], "--triggervpn" ) == 0 ) {
+ Action = ACT_VPN;
+ rmv = 1;
}
@@ -80,6 +86,4 @@ int main( int argc, char * argv[] ) {
{ NetworkSettingsData NS;
- Log(("ACT_REQUEST\n"));
if( NS.canStart( argv[1] ) ) {
QString S;
- Log(("NEED FOR PROMPT\n" ));
S.sprintf( QPEApplication::qpeDir()+
@@ -99,3 +103,2 @@ int main( int argc, char * argv[] ) {
{ NetworkSettingsData NS;
- Log(("REGEN\n" ));
// regen returns 0 if OK
@@ -106,3 +109,2 @@ int main( int argc, char * argv[] ) {
{ ActivateProfile AP(argv[1]);
- Log(("PROMPT\n" ));
if( AP.exec() == QDialog::Accepted ) {
@@ -114,5 +116,9 @@ int main( int argc, char * argv[] ) {
break;
+ case ACT_VPN :
+ { ActivateVPN AVPN;
+ AVPN.exec();
+ }
+ break;
case ACT_GUI :
{ QWidget * W = new NetworkSettings(0);
- Log(("GUI\n" ));
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 ) {
-bool ModemNetNode::generateProperFilesFor(
- ANetNodeInstance * ) {
- return 0;
-}
-
-bool ModemNetNode::generateDeviceDataForCommonFile(
- SystemFile & ,
- long ) {
- return 0;
-}
-
void 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:
virtual const QString nodeDescription() ;
-
virtual ANetNodeInstance * createInstance( void );
-
virtual const char ** needs( void );
@@ -26,8 +24,2 @@ public:
- virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
- virtual bool hasDataFor( const QString & )
- { return 0; }
- virtual bool generateDeviceDataForCommonFile(
- SystemFile & SF, long DevNr );
-
private:
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 ) {
-bool AModem::generateDataForCommonFile(
- SystemFile & ,
- long ) {
- return 1;
-}
-
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 :
+ RuntimeInfo * runtime( void )
+ { return
+ ( RT ) ? RT : ( RT = new ModemRun( this, Data ) );
+ }
+
QWidget * edit( QWidget * parent );
@@ -20,8 +25,2 @@ public :
- RuntimeInfo * runtime( void )
- { if( RT == 0 )
- RT = new ModemRun( this, Data );
- return RT;
- }
-
virtual void * data( void )
@@ -29,7 +28,2 @@ public :
- virtual bool hasDataFor( const QString & )
- { return 0; }
- virtual bool generateDataForCommonFile(
- SystemFile & SF, long DevNr );
-
protected :
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 :
+ virtual QString deviceFile( void )
+ { return QString("/dev/modem"); }
+
protected :
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 @@
+#include <asdevice.h>
#include "network_NN.h"
@@ -32,19 +33,38 @@ ANetNodeInstance * NetworkNetNode::createInstance( void ) {
-const char ** NetworkNetNode::needs( void ) {
- return NetworkNeeds;
+bool NetworkNetNode::hasDataForFile( const QString & S ) {
+ return S == "interfaces";
}
-const char * NetworkNetNode::provides( void ) {
- return "connection";
-}
+short NetworkNetNode::generateFile( const QString & ID,
+ const QString & ,
+ QTextStream & TS,
+ ANetNodeInstance * NNI,
+ long DevNr ) {
+
+ QString NIC = NNI->runtime()->device()->netNode()->nodeClass()->genNic( DevNr );
-bool NetworkNetNode::generateProperFilesFor(
- ANetNodeInstance * ) {
+ if( ID == "interfaces" ) {
+ Log(("Generate entry for %s in %s\n", NIC.latin1(), ID.latin1() ));
+ // generate mapping stanza for this interface
+ TS << "# check if "
+ << NIC
+ << " can be brought UP"
+ << endl;
+ TS << "mapping "
+ << NIC
+ << endl;
+ TS << " script networksettings2-request"
+ << endl
+ << endl;
return 0;
}
+ return 1;
+}
-bool NetworkNetNode::generateDeviceDataForCommonFile(
- SystemFile & ,
- long ) {
- return 0;
+const char ** NetworkNetNode::needs( void ) {
+ return NetworkNeeds;
+}
+
+const char * NetworkNetNode::provides( void ) {
+ return "connection";
}
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:
+ virtual bool hasDataForFile( const QString & S );
+
+ virtual short generateFile( const QString & ID,
+ const QString & Path,
+ QTextStream & TS,
+ ANetNodeInstance * NNI,
+ long DevNr );
virtual const QString pixmapName()
@@ -20,5 +27,3 @@ public:
virtual const QString nodeDescription() ;
-
virtual ANetNodeInstance * createInstance( void );
-
virtual const char ** needs( void );
@@ -26,8 +31,2 @@ public:
- virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
- virtual bool hasDataFor( const QString & )
- { return 0; }
- virtual bool generateDeviceDataForCommonFile(
- SystemFile & SF, long DevNr );
-
private:
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 ) {
-bool ANetwork::hasDataFor( const QString & S ) {
+bool ANetwork::hasDataForFile( const QString & S ) {
return S == "interfaces";
@@ -105,9 +105,17 @@ bool ANetwork::hasDataFor( const QString & S ) {
-bool ANetwork::generateDataForCommonFile( SystemFile & S, long DevNr ) {
+short ANetwork::generateFile( const QString & ID,
+ const QString & Path,
+ QTextStream &TS,
+ long DevNr
+ ) {
+
+ short rvl, rvd ;
QString NIC = runtime()->device()->netNode()->nodeClass()->genNic( DevNr );
- if( S.name() == "interfaces" ) {
+ rvl = 1;
+ if( ID == "interfaces" ) {
+ Log(("Generate Network for %s\n", ID.latin1() ));
// we can safely call from here since device item is deeper
if( Data.UseDHCP ) {
- S << "iface "
+ TS << "iface "
<< NIC
@@ -117,3 +125,3 @@ bool ANetwork::generateDataForCommonFile( SystemFile & S, long DevNr ) {
<< endl;
- S << " up echo \""
+ TS << " up echo \""
<< NIC
@@ -124,3 +132,3 @@ bool ANetwork::generateDataForCommonFile( SystemFile & S, long DevNr ) {
if( Data.SendHostname ) {
- S << " hostname "
+ TS << " hostname "
<< Data.Hostname
@@ -129,3 +137,3 @@ bool ANetwork::generateDataForCommonFile( SystemFile & S, long DevNr ) {
- S << " down rm -f /tmp/profile-"
+ TS << " down rm -f /tmp/profile-"
<< connection()->number()
@@ -134,3 +142,3 @@ bool ANetwork::generateDataForCommonFile( SystemFile & S, long DevNr ) {
} else {
- S << "iface "
+ TS << "iface "
<< NIC << "-c"
@@ -139,3 +147,3 @@ bool ANetwork::generateDataForCommonFile( SystemFile & S, long DevNr ) {
<< endl;
- S << " up echo \""
+ TS << " up echo \""
<< NIC
@@ -145,3 +153,3 @@ bool ANetwork::generateDataForCommonFile( SystemFile & S, long DevNr ) {
<< endl;
- S << " down rm -f /tmp/profile-"
+ TS << " down rm -f /tmp/profile-"
<< connection()->number()
@@ -149,5 +157,11 @@ bool ANetwork::generateDataForCommonFile( SystemFile & S, long DevNr ) {
<< endl;
- S << " address " << Data.IPAddress << endl;
- S << " broadcast " << Data.Broadcast << endl;
- S << " netmask " << Data.NetMask << endl;
+ TS << " address "
+ << Data.IPAddress
+ << endl;
+ TS << " broadcast "
+ << Data.Broadcast
+ << endl;
+ TS << " netmask "
+ << Data.NetMask
+ << endl;
@@ -163,3 +177,5 @@ bool ANetwork::generateDataForCommonFile( SystemFile & S, long DevNr ) {
arg( ipal[3].toShort() & nmal[3].toShort() );
- S << " network " << NW << endl;
+ TS << " network "
+ << NW
+ << endl;
}
@@ -169,3 +185,5 @@ bool ANetwork::generateDataForCommonFile( SystemFile & S, long DevNr ) {
++it ) {
- S << " pre-up " << (*it) << endl;
+ TS << " pre-up "
+ << (*it)
+ << endl;
}
@@ -174,3 +192,5 @@ bool ANetwork::generateDataForCommonFile( SystemFile & S, long DevNr ) {
++it ) {
- S << " up " << (*it) << endl;
+ TS << " up "
+ << (*it)
+ << endl;
}
@@ -179,3 +199,5 @@ bool ANetwork::generateDataForCommonFile( SystemFile & S, long DevNr ) {
++it ) {
- S << " down " << (*it) << endl;
+ TS << " down "
+ << (*it)
+ << endl;
}
@@ -184,6 +206,14 @@ bool ANetwork::generateDataForCommonFile( SystemFile & S, long DevNr ) {
++it ) {
- S << " post-down " << (*it) << endl;
+ TS << " post-down "
+ << (*it)
+ << endl;
}
+ rvl = 0;
}
- return 0;
+
+ // embed other info in it
+ rvd = connection()->getToplevel()->generateFileEmbedded( ID, Path, TS, DevNr );
+
+ return (rvd == 2 || rvl == 2 ) ? 2 :
+ (rvd == 0 || rvl == 0 ) ? 0 : 1;
}
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 :
+ RuntimeInfo * runtime( void )
+ { return
+ ( RT ) ? RT : ( RT = new NetworkRun( this, Data ) );
+ }
+
QWidget * edit( QWidget * parent );
@@ -21,8 +26,2 @@ public :
- RuntimeInfo * runtime( void )
- { if( RT == 0 )
- RT = new NetworkRun( this, Data );
- return RT;
- }
-
virtual void * data( void )
@@ -30,5 +29,7 @@ public :
- virtual bool hasDataFor( const QString & S );
- virtual bool generateDataForCommonFile(
- SystemFile & SF, long DevNr );
+ virtual bool hasDataForFile( const QString & S );
+ virtual short generateFile( const QString & ID,
+ const QString & Path,
+ QTextStream &TS,
+ long DevNr );
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 @@
#include <unistd.h>
+#include <errno.h>
@@ -14,2 +15,3 @@
#include <qtoolbutton.h>
+#include <qevent.h>
@@ -43,2 +45,9 @@ NetworkSettings::NetworkSettings( QWidget *parent,
Profiles_LB->clear();
+ QPEApplication::setStylusOperation(
+ Profiles_LB->viewport(), QPEApplication::RightOnHold );
+
+ connect( Profiles_LB,
+ SIGNAL(rightButtonPressed(QListBoxItem*,const QPoint&)),
+ this, SLOT(SLOT_EditNode(QListBoxItem*)) );
+
{ Name2Connection_t & M = NSResources->connections();
@@ -80,11 +89,3 @@ NetworkSettings::~NetworkSettings() {
- S = NSD.generateSettings();
- if( ! S.isEmpty() ) {
- QMessageBox::warning(
- 0,
- tr( "In System Config" ),
- S
- );
- }
-
+ if( isModified() ) {
S = NSD.saveSettings();
@@ -96,2 +97,6 @@ NetworkSettings::~NetworkSettings() {
}
+
+ SLOT_GenerateConfig();
+ }
+
}
@@ -147,5 +152,2 @@ void NetworkSettings::SLOT_RefreshStates( void ) {
-void NetworkSettings::SLOT_NoLongerBusy( void ) {
- NSResources->busy( FALSE );
-}
void NetworkSettings::SLOT_AddNode( void ) {
@@ -168,3 +170,2 @@ void NetworkSettings::SLOT_DeleteNode( void ) {
setModified( 1 );
- NSD.forceGeneration(1);
}
@@ -174,2 +175,4 @@ void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) {
QString OldName = "";
+
+ printf( "------------------ Edit NOde\n" );
EditConnection EC( this );
@@ -188,4 +191,3 @@ void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) {
UpdateTimer->stop();
- NSResources->busy( TRUE );
- QTimer::singleShot( 1000, this, SLOT( SLOT_NoLongerBusy() ));
+
// we need to retry
@@ -321,11 +323,3 @@ void NetworkSettings::updateProfileState( QListBoxItem * LBI ) {
void NetworkSettings::SLOT_GenerateConfig( void ) {
- QString S = NSD.generateSettings( TRUE );
-
- if( ! S.isEmpty() ) {
- QMessageBox::warning(
- 0,
- tr( "Generating system configuration" ),
- S
- );
- }
+ NSD.regenerate();
}
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;
class QListBoxItem;
+class QEvent;
@@ -30,3 +31,2 @@ public slots :
- void SLOT_NoLongerBusy( void );
void SLOT_AddNode( void );
@@ -52,3 +52,2 @@ private :
NetworkSettingsData NSD;
-
};
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 \
activateprofile.h \
+ activatevpn.h \
editconnection.h
@@ -10,2 +11,3 @@ SOURCES = main.cpp \
activateprofile.cpp \
+ activatevpn.cpp \
editconnection.cpp
@@ -16,2 +18,3 @@ INTERFACES = networksettingsGUI.ui \
editconnectionGUI.ui \
+ activatevpnGUI.ui \
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, ... );
extern void LogClose( void );
+extern QString removeSpaces( const QString & X );
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 :
+ virtual QString deviceFile( void ) = 0;
+
};
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 ) :
} else if( A == "number" ) {
- Log(( "read number %s\n", N.latin1() ));
+ Log(( "Profile number %s\n", N.latin1() ));
setNumber( N.toLong() );
@@ -299,2 +299,21 @@ bool NodeCollection::triggersVPN() {
}
+
+bool NodeCollection::hasDataForFile( const QString & S ) {
+ return ( firstWithDataForFile( S ) != 0 );
+}
+
+ANetNodeInstance * NodeCollection::firstWithDataForFile( const QString & S ) {
+ for( QListIterator<ANetNodeInstance> it(*this);
+ it.current();
+ ++it ) {
+ if( it.current()->hasDataForFile( S ) ) {
+ Log(( "Node %s has data for %s\n",
+ it.current()->nodeClass()->name(),
+ S.latin1() ));
+ return it.current();
+ }
+ }
+ return 0;
+}
+
//
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 @@
#include <qpixmap.h>
+#include <qstringlist.h>
#include <qobject.h>
@@ -79,28 +80,54 @@ public:
- // pixmap needed for this NetNode
- virtual const QString pixmapName() = 0;
+ //
+ //
+ // standard methods with sensible default
+ //
+ //
- // description for this NetNode
- virtual const QString nodeDescription() = 0;
+ inline int done( void )
+ { return Done; }
+ inline void setDone( int D )
+ { Done = D; }
- // create a blank instance of a net node
- virtual ANetNodeInstance * createInstance( void ) = 0;
+ // does this Node provide a Connection
+ inline bool isToplevel( void )
+ { return strcmp( provides(), "fullsetup") == 0 ; }
- // return feature this NetNode provides
- virtual const char * provides( void ) = 0;
- virtual const char ** needs( void ) = 0;
+ // set the value of an attribute
+ void setAttribute( QString & Attr, QString & Value ) ;
+ void saveAttributes( QTextStream & TS ) ;
- // generate files specific for this node (if any)
- virtual bool generateProperFilesFor( ANetNodeInstance * NNI ) = 0;
- // return TRUE if this node has data to be inserted in systemfile
- // with name S
- virtual bool hasDataFor( const QString & S ) = 0;
- // generate data specific for the device for the system file S
- // called only IF data was needed
- virtual bool generateDeviceDataForCommonFile(
- SystemFile & SF, long DevNr ) = 0;
+ // compiled references to 'needed' NetNodes -> needs list
+ inline void setAlternatives( NetNodeList * Alt )
+ { Alternatives = Alt; }
+ inline NetNodeList & alternatives( void )
+ { return *Alternatives; }
+
+ //
+ //
+ // Virtual methods with sensible default
+ //
+ //
+
+ // do instances of this noce class have data for this file
+ virtual bool hasDataForFile( const QString & )
+ { return 0; }
+
+ // generate instance independent stuff
+ // 0 : data output, 1 no data, 2 error
+ virtual short generateFile( const QString & ,
+ const QString & ,
+ QTextStream & ,
+ long )
+ { return 1; }
+
+ // generate instance dependent but profile common stuff
+ // 0 : data output, 1 no data, 2 error
+ virtual short generateFile( const QString & ,
+ const QString & ,
+ QTextStream & ,
+ ANetNodeInstance * ,
+ long )
+ { return 1; }
- // does this Node provide a Connection
- bool isToplevel( void )
- { return strcmp( provides(), "fullsetup") == 0 ; }
@@ -116,11 +143,24 @@ public:
- // set the value of an attribute
- void setAttribute( QString & Attr, QString & Value ) ;
- void saveAttributes( QTextStream & TS ) ;
+ // return list of files that are specific for this node class
+ virtual QStringList * properFiles( void )
+ { return 0; }
- // compiled references to 'needed' NetNodes -> needs list
- void setAlternatives( NetNodeList * Alt )
- { Alternatives = Alt; }
- NetNodeList & alternatives( void )
- { return *Alternatives; }
+ //
+ //
+ // pure virtual methods with sensible default
+ //
+ //
+
+ // pixmap needed for this NetNode
+ virtual const QString pixmapName() = 0;
+
+ // description for this NetNode
+ virtual const QString nodeDescription() = 0;
+
+ // create a blank instance of a net node
+ virtual ANetNodeInstance * createInstance( void ) = 0;
+
+ // return feature this NetNode provides
+ virtual const char * provides( void ) = 0;
+ virtual const char ** needs( void ) = 0;
@@ -134,2 +174,3 @@ private :
virtual void saveSpecificAttribute( QTextStream & ) = 0;
+ int Done;
@@ -145,23 +186,13 @@ public:
- virtual RuntimeInfo * runtime( void ) = 0;
-
- void setConnection( NodeCollection * NC )
- { Connection = NC; }
- NodeCollection * connection( void )
- { return Connection; }
-
- // create edit widget under parent
- virtual QWidget * edit( QWidget * parent ) = 0;
- // is given data acceptable
- virtual QString acceptable( void ) = 0;
+ inline int done( void )
+ { return Done; }
+ inline void setDone( int D )
+ { Done = D; }
// return data was modified
- void setModified( bool M )
+ inline void setModified( bool M )
{ IsModified = M; }
- bool isModified( void )
+ inline bool isModified( void )
{ return IsModified; }
- // get data from GUI and store in node
- virtual void commit( void ) = 0;
-
// get next node
@@ -180,5 +211,5 @@ public:
// return true if node isntance is NEW and not loaded
- void setNew( bool IsN )
+ inline void setNew( bool IsN )
{ IsNew = IsN; }
- bool isNew( void )
+ inline bool isNew( void )
{ return IsNew; }
@@ -186,5 +217,5 @@ public:
// return description for this instance
- QString & description( void )
+ inline QString & description( void )
{ return Description; }
- void setDescription( const QString & S )
+ inline void setDescription( const QString & S )
{ Description = S; }
@@ -192,22 +223,78 @@ public:
// pixmap for this instance -> from NetNode
- const QString pixmapName( void )
+ inline const QString pixmapName( void )
{ return NodeType->pixmapName(); }
- const char * provides( void )
+ inline const char * provides( void )
{ return NodeType->provides(); }
- const char ** needs( void )
+ inline const char ** needs( void )
{ return NodeType->needs(); }
- // returns node specific data -> only useful for 'buddy'
- virtual void * data( void ) = 0;
+ inline void setConnection( NodeCollection * NC )
+ { Connection = NC; }
+ inline NodeCollection * connection( void )
+ { return Connection; }
+
+ //
+ //
+ // Virtual methods with sensible defaults
+ //
+ //
- // return TRUE if this node has data to be inserted in systemfile
- // with name S
- virtual bool hasDataFor( const QString & S ) = 0;
- // generate data specific for a profile and for the system file S
- // called only IF data was needed
- virtual bool generateDataForCommonFile(
- SystemFile & SF, long DevNr ) = 0;
+
+ // open proper file identified by S
+ virtual QFile * openFile( const QString & )
+ { return 0; }
+
+ // check if this node (or sub nodes) have data for this file
+ virtual bool hasDataForFile( const QString & S )
+ { return nodeClass()->hasDataForFile( S ); }
+
+ // generate code specific for this node but embedded
+ // in the section of the parent
+ // this is called within the code of the parent
+ virtual short generateFileEmbedded( const QString & ID,
+ const QString & Path,
+ QTextStream & TS,
+ long DevNr )
+ { ANetNodeInstance * NNI = nextNode();
+ return (NNI) ? NNI->generateFileEmbedded( ID, Path, TS, DevNr ) : 1;
+ }
+
+ // generate code specific for this node
+ // (or find the first node that does)
+ virtual short generateFile( const QString & ID,
+ const QString & Path,
+ QTextStream & TS,
+ long DevNr )
+ { ANetNodeInstance * NNI = nextNode();
+ return (NNI) ? NNI->generateFile( ID, Path, TS, DevNr ) : 1;
+ }
+
+ // return true if this node instance is triggered by this trigger
+ // could be delegated to deeper instances
+ virtual bool triggeredBy( const QString & )
+ { return 0; }
+
+ //
+ //
+ // Pure virtual functions
+ //
+ //
+
+ // return runtime information for this node
+ virtual RuntimeInfo * runtime( void ) = 0;
+
+ // create edit widget under parent
+ virtual QWidget * edit( QWidget * parent ) = 0;
+
+ // is given data acceptable
+ virtual QString acceptable( void ) = 0;
+
+ // get data from GUI and store in node
+ virtual void commit( void ) = 0;
+
+ // returns node specific data -> only useful for 'buddy'
+ virtual void * data( void ) = 0;
@@ -224,2 +311,3 @@ protected :
bool IsNew;
+ int Done;
@@ -284,16 +372,21 @@ public :
- int number( void )
+ inline int done( void )
+ { return Done; }
+ inline void setDone( int D )
+ { Done = D; }
+
+ inline int number( void )
{ return Number; }
- void setNumber( int i )
+ inline void setNumber( int i )
{ Number = i; }
- bool isNew( void )
+ inline bool isNew( void )
{ return IsNew; }
- void setNew( bool N )
+ inline void setNew( bool N )
{ IsNew = N ; }
- bool isModified( void )
+ inline bool isModified( void )
{ return IsModified; }
- void setModified( bool N )
+ inline void setModified( bool N )
{ IsModified = N ; }
- bool handlesInterface( const QString & S ) {
+ inline bool handlesInterface( const QString & S ) {
return getToplevel()->runtime()->handlesInterface( S );
@@ -301,3 +394,3 @@ public :
- InterfaceInfo * assignedInterface( void ) {
+ inline InterfaceInfo * assignedInterface( void ) {
return getToplevel()->runtime()->assignedInterface();
@@ -305,3 +398,3 @@ public :
- AsDevice * device() {
+ inline AsDevice * device() {
return getToplevel()->runtime()->device();
@@ -311,3 +404,3 @@ public :
- State_t state( bool Update = 0 )
+ inline State_t state( bool Update = 0 )
{ Log(( "%s state %d(=%d?)\n", Name.latin1(), CurrentState,
@@ -327,11 +420,11 @@ public :
QPixmap statePixmap( State_t S );
- QPixmap statePixmap( bool Update = 0 )
+ inline QPixmap statePixmap( bool Update = 0 )
{ return statePixmap( state(Update) ); }
QString stateName( State_t );
- QString stateName( bool Update = 0 )
+ inline QString stateName( bool Update = 0 )
{ return stateName( state(Update) ); }
- bool setState( Action_t A, bool Force =0 )
+ inline bool setState( Action_t A, bool Force =0 )
{ return getToplevel()->runtime()->setState( this, A, Force ); }
- bool canSetState( Action_t A )
+ inline bool canSetState( Action_t A )
{ return getToplevel()->runtime()->canSetState( CurrentState, A ); }
@@ -350,3 +443,3 @@ public :
- const QString & name()
+ inline const QString & name()
{ return Name; }
@@ -355,10 +448,26 @@ public :
- void setName( const QString & N)
+ inline void setName( const QString & N)
{ Name = N; }
- State_t currentState( void )
+ inline State_t currentState( void )
{ return CurrentState; }
- void setCurrentState( State_t S )
+ inline void setCurrentState( State_t S )
{ CurrentState = S; }
+ // return TRUE if this node can have data to be inserted in
+ // file identified by S
+ bool hasDataForFile( const QString & S );
+ ANetNodeInstance * firstWithDataForFile( const QString & S );
+
+ // generate items for this file -> toplevel call
+ short generateFile( const QString & FID, // identification of file
+ const QString & FName, // effective filename of file
+ QTextStream & TS, // stream to file
+ long DN // device number
+ )
+ { return getToplevel()->generateFile( FID, FName, TS, DN ); }
+
+ bool triggeredBy( const QString & Trigger )
+ { return getToplevel()->triggeredBy( Trigger ); }
+
private :
@@ -380,2 +489,3 @@ private :
bool IsModified;
+ int Done;
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(),
// define system files
- addSystemFile( new SystemFile( "interfaces", "./interfaces" ) );
+ addSystemFile( "interfaces", "/tmp/interfaces", 1 );
@@ -90,3 +90,12 @@ TheNSResources::~TheNSResources( void ) {
-void TheNSResources::busy( bool B ) {
+void TheNSResources::addSystemFile( const QString & ID,
+ const QString & P,
+ bool KDI ) {
+ if( ! SystemFiles.find( ID ) ) {
+ // new system file
+ SystemFiles.insert( ID, new SystemFile( ID, P, KDI ) );
+ } // else existed
+}
+
+void TheNSResources::busy( bool ) {
/*
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 :
{ return SystemFiles; }
- void addSystemFile( SystemFile * SF )
- { SystemFiles.insert( SF->name(), SF ); }
+ void addSystemFile( const QString & ID,
+ const QString & P,
+ bool KDI );
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, ... ) {
if( logf == (FILE *)0 ) {
- // logf = fopen( "/tmp/ns2log", "a" );
+ if( getenv("NS2STDERR") ) {
logf = stderr;
+ } else {
+ logf = fopen( "/tmp/ns2log", "a" );
+ }
if( ! logf ) {
@@ -413,3 +416,5 @@ void LogClose( void ) {
fprintf( logf, "____ CLOSE LOGFILE ____\n");
+ if( logf != stderr ) {
fclose( logf );
+ }
logf = 0;
@@ -417 +422,8 @@ void LogClose( void ) {
}
+
+QString removeSpaces( const QString & X ) {
+ QStringList SL;
+
+ SL = QStringList::split( " ", X );
+ return SL.join( "_" );
+}
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;
-SystemFile::SystemFile( const QString & N, const QString & P ){
+SystemFile::SystemFile( const QString & N,
+ const QString & P,
+ bool KDI ){
Name = N;
@@ -59,2 +61,4 @@ SystemFile::SystemFile( const QString & N, const QString & P ){
}
+
+ KnowsDeviceInstances = KDI;
}
@@ -98,3 +102,3 @@ bool SystemFile::preSection( void ) {
if( ! Fl.open( IO_ReadOnly ) )
- return 1; // error
+ return 0; // error
// copy file to this file
@@ -102,3 +106,3 @@ bool SystemFile::preSection( void ) {
}
- return 0;
+ return 1;
}
@@ -109,3 +113,3 @@ bool SystemFile::postSection( void ) {
if( ! Fl.open( IO_ReadOnly ) )
- return 1; // error
+ return 0; // error
// copy file to this file
@@ -113,3 +117,3 @@ bool SystemFile::postSection( void ) {
}
- return 0;
+ return 1;
}
@@ -120,3 +124,3 @@ bool SystemFile::preNodeSection( ANetNodeInstance * NNI, long ) {
if( ! Fl.open( IO_ReadOnly ) )
- return 1; // error
+ return 0; // error
QTextStream TX( &Fl );
@@ -131,3 +135,3 @@ bool SystemFile::preNodeSection( ANetNodeInstance * NNI, long ) {
}
- return 0;
+ return 1;
}
@@ -138,3 +142,3 @@ bool SystemFile::postNodeSection( ANetNodeInstance * NNI, long ) {
if( ! Fl.open( IO_ReadOnly ) )
- return 1; // error
+ return 0; // error
QTextStream TX( &Fl );
@@ -149,3 +153,3 @@ bool SystemFile::postNodeSection( ANetNodeInstance * NNI, long ) {
}
- return 0;
+ return 1;
}
@@ -156,3 +160,3 @@ bool SystemFile::preDeviceSection( ANetNode * NN ) {
if( ! Fl.open( IO_ReadOnly ) )
- return 1; // error
+ return 0; // error
QTextStream TX( &Fl );
@@ -166,3 +170,3 @@ bool SystemFile::preDeviceSection( ANetNode * NN ) {
}
- return 0;
+ return 1;
}
@@ -173,3 +177,3 @@ bool SystemFile::postDeviceSection( ANetNode * NN ) {
if( ! Fl.open( IO_ReadOnly ) )
- return 1; // error
+ return 0; // error
QTextStream TX( &Fl );
@@ -183,3 +187,3 @@ bool SystemFile::postDeviceSection( ANetNode * NN ) {
}
- return 0;
+ return 1;
}
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 :
- SystemFile( const QString & Name, const QString & Path );
+ SystemFile( const QString & Name,
+ const QString & Path,
+ bool KnowsDevicesInstances );
~SystemFile( void );
- const QString & name( void )
+ const QString & name( void ) const
{ return Name; }
+ const QString & path( void ) const
+ { return Path; }
+ bool knowsDeviceInstances( void ) const
+ { return KnowsDeviceInstances; }
@@ -40,2 +46,3 @@ private :
bool hasPostDeviceSection;
+ bool KnowsDeviceInstances;
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 ) {
// load settings
- Force = 0;
IsModified = 0;
@@ -220,16 +219,5 @@ QString NetworkSettingsData::saveSettings( void ) {
-QString NetworkSettingsData::generateSettings( bool ForceReq ) {
- bool ForceIt;
+QString NetworkSettingsData::generateSettings( void ) {
QString S = "";
-
- // include own force flag
- ForceIt = (Force) ? 1 : ForceReq;
-
- if( ! ForceIt && ! isModified() )
- return S;
-
- // regenerate system files
- Log( ( "Generating settings from %s\n", CfgFile.latin1() ));
-
- { Name2SystemFile_t & SFM = NSResources->systemFiles();
+ Name2SystemFile_t & SFM = NSResources->systemFiles();
Name2Connection_t & M = NSResources->connections();
@@ -237,47 +225,12 @@ QString NetworkSettingsData::generateSettings( bool ForceReq ) {
ANetNodeInstance * NNI;
+ ANetNodeInstance * FirstWithData;
SystemFile * SF;
AsDevice * CurDev;
- ANetNode * CurDevNN;
- bool needToRegenerate = ForceIt;
+ ANetNode * NN, * CurDevNN = 0;
+ long NoOfDevs;
+ long DevCtStart;
+ bool needToGenerate;
- //
- // check if we need to generate at least one of the system files
- //
- if( ! ForceIt ) {
- for( QDictIterator<SystemFile> sfit(SFM);
- sfit.current();
- ++sfit ) {
- SF = sfit.current();
-
- // check if there are nodes that are modified and require
- // data for this system file
-
- // for all connections
- for( QDictIterator<NodeCollection> ncit(M);
- ncit.current();
- ++ncit ) {
- NC = ncit.current();
-
- if( NC->isModified() ) {
- // does this connection 'touch' this system file ?
- for( QListIterator<ANetNodeInstance> cncit(*NC);
- cncit.current();
- ++cncit ) {
- NNI = cncit.current();
- if( ( NNI->nodeClass()->hasDataFor( SF->name() ) ||
- NNI->hasDataFor( SF->name() )
- ) &&
- NNI->isModified() ) {
- needToRegenerate = 1;
- break;
- }
- }
- }
- if( needToRegenerate )
- break;
- }
- if( needToRegenerate )
- break;
- }
- }
+ // regenerate system files
+ Log( ( "Generating settings from %s\n", CfgFile.latin1() ));
@@ -290,4 +243,3 @@ QString NetworkSettingsData::generateSettings( bool ForceReq ) {
NNIIt.current();
- ++NNIIt
- ){
+ ++NNIIt ) {
// for all nodes find those that are modified
@@ -295,4 +247,13 @@ QString NetworkSettingsData::generateSettings( bool ForceReq ) {
- if( ForceIt || NNI->isModified() ) {
- if( NNI->nodeClass()->generateProperFilesFor( NNI ) ) {
+ { // get list of proper files for this nodeclass (if any)
+ QStringList * PF = NNI->nodeClass()->properFiles();
+
+ if( PF ) {
+ for ( QStringList::Iterator it = PF->begin();
+ it != PF->end();
+ ++it ) {
+ QFile * F = NNI->openFile( (*it) );
+ if( F ) {
+ QTextStream TS( F );
+ if( NNI->generateFile( (*it), F->name(), TS, -1 ) == 2 ) {
// problem generating
@@ -301,4 +262,9 @@ QString NetworkSettingsData::generateSettings( bool ForceReq ) {
arg(NNI->nodeClass()->name()) ;
+ delete F;
return S;
}
+ delete F;
+ }
+ }
+ }
}
@@ -315,32 +281,47 @@ QString NetworkSettingsData::generateSettings( bool ForceReq ) {
- Log( ( "Generating %s\n", SF->name().latin1() ));
- SF->open();
+ // reset all
+ for( QDictIterator<NetNode_t> nnit( NSResources->netNodes() );
+ nnit.current();
+ ++nnit ) {
+ nnit.current()->NetNode->setDone(0);
+ }
- do { // so we can break;
+ for( QDictIterator<ANetNodeInstance> nniit(
+ NSResources->netNodeInstances() );
+ nniit.current();
+ ++nniit ) {
+ nniit.current()->setDone(0);
+ }
- // global presection for this system file
- if( SF->preSection() ) {
- S = qApp->translate( "NetworkSettings",
- "<p>Error in preSection for file \"%1\"</p>" ).
- arg( SF->name() );
- return S;
+ for( QDictIterator<NodeCollection> ncit(M);
+ ncit.current();
+ ++ncit ) {
+ ncit.current()->setDone(0);
}
- // find all netnodes and figure out if
- // for that node there are instances
- for( QDictIterator<NetNode_t> nnit(
- NSResources->netNodes() );
- nnit.current();
+ Log( ( "Generating %s\n", SF->name().latin1() ));
+
+ needToGenerate = 0;
+
+ // are there netnodes that have instances and need
+ // to write data in this system file ?
+ for( QDictIterator<NetNode_t> nnit( NSResources->netNodes() );
+ ! needToGenerate && nnit.current();
++nnit ) {
- CurDevNN = nnit.current()->NetNode;
+ NN = nnit.current()->NetNode;
+
+ if( NN->hasDataForFile( SF->name() ) ) {
+ // netnode can have data
- // are there instances for this netnode ?
- NNI = 0;
+ // are there instances of this node ?
for( QDictIterator<ANetNodeInstance> nniit(
NSResources->netNodeInstances() );
- nniit.current();
+ ! needToGenerate && nniit.current();
++nniit ) {
- if( nniit.current()->nodeClass() == CurDevNN ) {
- NNI = nniit.current();
+ if( nniit.current()->nodeClass() == NN ) {
+ // yes
+ Log(("Node %s has data\n",
+ nniit.current()->name() ));
+ needToGenerate = 1;
break;
@@ -348,25 +329,167 @@ QString NetworkSettingsData::generateSettings( bool ForceReq ) {
}
+ }
+ }
- if( ! NNI )
- // no instances -> next netnode type
+ if( ! needToGenerate ) {
+ // no instances found that might need to write data
+ // in this systemfile
+ Log(("No nodes for systemfile %s\n", SF->name().latin1() ));
continue;
+ }
+
+ // ok generate this system file
+ SF->open();
- // has this node data for this system file ?
- if( (CurDev = NNI->runtime()->asDevice() ) ) {
- // generate start for this nodetype for all possible devices of this type
- for( int i = 0; i < CurDevNN->instanceCount(); i ++ ) {
- S = generateSystemFileNode( *SF, CurDev, NNI, i );
- if( ! S.isEmpty() )
+ // global presection for this system file
+ if( ! SF->preSection() ) {
+ S = qApp->translate( "NetworkSettings",
+ "<p>Error in section \"Preamble\" for file \"%1\"</p>" ).
+ arg( SF->name() );
return S;
}
- } else {
- S = generateSystemFileNode( *SF, 0, NNI, -1 );
- if( ! S.isEmpty() )
+
+ // find connections that want to write to this file
+ for( QDictIterator<NodeCollection> ncit(M);
+ ncit.current();
+ ++ncit ) {
+
+ NC = ncit.current();
+
+ if( NC->done() ) {
+ // already done
+ continue;
+ }
+
+ if( ! NC->hasDataForFile( SF->name() ) ) {
+ // no data
+ continue;
+ }
+
+ Log(("Generating %s for connection %s\n",
+ SF->name().latin1(), NC->name().latin1() ));
+ // find highest item that wants to write data to this file
+ FirstWithData = NC->firstWithDataForFile( SF->name() );
+
+ // find device on which this connection works
+ CurDev = NC->device();
+ // class of that node
+ CurDevNN = CurDev->netNode()->nodeClass();
+
+ Log(( "%s is done %d\n",
+ FirstWithData->nodeClass()->name(),
+ FirstWithData->nodeClass()->done() ));
+
+ if( ! FirstWithData->nodeClass()->done() ) {
+ // generate fixed part
+ if( ! SF->preDeviceSection( CurDevNN ) ) {
+ S = qApp->translate( "NetworkSettings",
+ "<p>Error in section \"Pre-Device\" for file \"%1\"</p>" ).
+ arg( SF->name() );
return S;
}
+
+ if( FirstWithData->nodeClass()->generateFile(
+ SF->name(), SF->path(), *SF, -1 ) == 2 ) {
+ S = qApp->translate( "NetworkSettings",
+ "<p>Error in section \"Common\" for file \"%1\" and node \"%2\"</p>" ).
+ arg( SF->name() ).
+ arg( CurDevNN->name() );
+ return S;
+ }
+ FirstWithData->nodeClass()->setDone( 1 );
+ }
+
+ NoOfDevs = 0;
+ DevCtStart = -1;
+
+ if( SF->knowsDeviceInstances() ) {
+ DevCtStart = 0;
+ NoOfDevs = CurDevNN->instanceCount();
}
- if( SF->postSection() ) {
+ Log(( "Node %s is done %d\n",
+ CurDev->netNode()->nodeClass()->name(),
+ CurDev->netNode()->nodeClass()->done() ));
+
+ if( ! CurDev->netNode()->nodeClass()->done() ) {
+ // first time this device is handled
+ // generate common device specific part
+ for( int i = DevCtStart; i < NoOfDevs ; i ++ ) {
+
+ if( FirstWithData->nodeClass()->generateFile(
+ SF->name(), SF->path(), *SF, CurDev->netNode(), i ) == 2 ) {
S = qApp->translate( "NetworkSettings",
- "<p>Error in postSection for file \"%1\"</p>" ).
+ "<p>Error in section \"Device\" for file \"%1\" and node \"%2\"</p>" ).
+ arg( SF->name() ).
+ arg( CurDevNN->name() );
+ return S;
+ }
+ }
+ CurDev->netNode()->nodeClass()->setDone( 1 );
+ }
+
+ // generate profile specific info
+ // for all nodeconnections that work on the same device
+ for( QDictIterator<NodeCollection> ncit2(M);
+ ncit2.current();
+ ++ncit2 ) {
+
+ if( ncit2.current()->device() != CurDev ) {
+ // different device
+ continue;
+ }
+
+ Log(("Connection %s of same family\n", ncit2.current()->name().latin1() ));
+ // generate
+ NNI = ncit2.current()->firstWithDataForFile( SF->name() );
+ for( int i = DevCtStart; i < NoOfDevs ; i ++ ) {
+ if( ! SF->preNodeSection( NNI, i ) ) {
+ S = qApp->translate( "NetworkSettings",
+ "<p>Error in \"Pre-Node Part\" for file \"%1\" and node \"%2\"</p>" ).
+ arg( SF->name() ).
+ arg( CurDevNN->name() );
+ return S;
+ }
+
+ switch( NNI->generateFile(
+ SF->name(), SF->path(), *SF, i ) ) {
+ case 0 :
+ (*SF) << endl;
+ break;
+ case 1 :
+ break;
+ case 2 :
+ S = qApp->translate( "NetworkSettings",
+ "<p>Error in section \"Node\" for file \"%1\" and node \"%2\"</p>" ).
+ arg( SF->name() ).
+ arg( CurDevNN->name() );
+ return S;
+ }
+
+ if( ! SF->postNodeSection( NNI, i ) ) {
+ S = qApp->translate( "NetworkSettings",
+ "<p>Error in \"Post-Node Part\" for file \"%1\" and node \"%2\"</p>" ).
+ arg( SF->name() ).
+ arg( CurDevNN->name() );
+ return S;
+ }
+ }
+
+ ncit2.current()->setDone( 1 );
+
+ }
+ }
+
+ if( ! SF->postDeviceSection( CurDevNN ) ) {
+ S = qApp->translate( "NetworkSettings",
+ "<p>Error in section \"Post-Device\" for file \"%1\" and node \"%2\"</p>" ).
+ arg( SF->name() ).
+ arg( CurDevNN->name() );
+ return S;
+ }
+
+
+ if( ! SF->postSection() ) {
+ S = qApp->translate( "NetworkSettings",
+ "<p>Error in section \"Closure\" for file \"%1\"</p>" ).
arg( SF->name() );
@@ -375,7 +498,5 @@ QString NetworkSettingsData::generateSettings( bool ForceReq ) {
- } while( 0 );
+ // end of file
SF->close();
}
- }
- Force = 0;
return S;
@@ -465,5 +586,3 @@ bool NetworkSettingsData::canStart( const char * Interface ) {
bool NetworkSettingsData::regenerate( void ) {
- QString S;
- // load situation
- S = generateSettings( TRUE );
+ QString S = generateSettings();
if( ! S.isEmpty() ) {
@@ -474,100 +593 @@ bool NetworkSettingsData::regenerate( void ) {
}
-
-QString NetworkSettingsData::generateSystemFileNode(
- SystemFile &SF,
- AsDevice * CurDev,
- ANetNodeInstance * DevNNI,
- long DevInstNr ) {
-
- QString S="";
- ANetNode * CurDevNN = DevNNI->nodeClass();
- Name2Connection_t & M = NSResources->connections();
-
- if( SF.preDeviceSection( CurDevNN ) ) {
- S = qApp->translate( "NetworkSettings",
- "<p>Error in \"Pre-Device Part\" for file \"%1\" and nodetype \"%2\"</p>" ).
- arg( SF.name() ).
- arg( CurDevNN->name() );
- return S;
- }
-
- if( CurDevNN->hasDataFor( SF.name() ) ) {
- if( CurDevNN->generateDeviceDataForCommonFile( SF, DevInstNr ) ) {
- S = qApp->translate( "NetworkSettings",
- "<p>Error in \"Device Part\" for file \"%1\" and node \"%2\"</p>" ).
- arg( SF.name() ).
- arg( CurDevNN->name() );
- return S;
- }
- }
-
- // now generate profile specific data for all
- // connections working on a device of the current
- // netnode type
- for( QDictIterator<NodeCollection> ncit(M);
- ncit.current();
- ++ncit ) {
- NodeCollection * NC = ncit.current();
-
- // currenly only those connections that work on
- // the current device (or on no device if no current)
- AsDevice * Dev = NC->device();
-
- if( CurDev ) {
- if( CurDevNN != Dev->netNode()->nodeClass() ) {
- // other device type -> later
- continue;
- }
- } else {
- if( Dev ) {
- // other
- continue;
- }
- }
-
- // generate 'entry'
- if( SF.preNodeSection( DevNNI, DevInstNr ) ) {
- S = qApp->translate( "NetworkSettings",
- "<p>Error in \"Pre-Node Part\" for file \"%1\" and node \"%2\"</p>" ).
- arg( SF.name() ).
- arg( CurDevNN->name() );
- return S;
- }
-
- // ask all nodes in connection
- for( QListIterator<ANetNodeInstance> cncit(*NC);
- cncit.current();
- ++cncit ) {
- ANetNodeInstance * NNI = cncit.current();
-
- if( NNI->hasDataFor( SF.name() ) ) {
- if( NNI->generateDataForCommonFile(SF,DevInstNr) ) {
- S = qApp->translate( "NetworkSettings",
- "<p>Error in \"Node Part\" for file \"%1\" and node \"%2\"</p>" ).
- arg( SF.name() ).
- arg( NNI->nodeClass()->name() );
- return S;
- }
- }
- }
-
- if( SF.postNodeSection( DevNNI, DevInstNr ) ) {
- S = qApp->translate( "NetworkSettings",
- "<p>Error in \"Post-Node Part\" for file \"%1\" and node \"%2\"</p>" ).
- arg( SF.name() ).
- arg( CurDevNN->name() );
- return S;
- }
- SF << endl;
- }
-
- if( SF.postDeviceSection( CurDevNN ) ) {
- S = qApp->translate( "NetworkSettings",
- "<p>Error in \"Post-Device Part\" for file \"%1\" and node \"%2\"</p>" ).
- arg( SF.name() ).
- arg( CurDevNN->name() );
- return S;
- }
-
- return S;
-}
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 :
- QString generateSettings( bool Force = FALSE );
+ QString generateSettings( void );
@@ -27,14 +27,5 @@ public :
- void forceGeneration( bool m )
- { Force = m; }
-
private :
- QString NetworkSettingsData::generateSystemFileNode(
- SystemFile & SF,
- AsDevice * CurDev,
- ANetNodeInstance * DevNNI,
- long DevInstNr );
bool IsModified;
- bool Force;
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 @@
<y>0</y>
- <width>249</width>
+ <width>245</width>
<height>209</height>
@@ -59,3 +59,3 @@
<name>margin</name>
- <number>0</number>
+ <number>3</number>
</property>
@@ -63,3 +63,3 @@
<name>spacing</name>
- <number>0</number>
+ <number>2</number>
</property>
@@ -193,2 +193,39 @@
<widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout3</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QRadioButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Pap_RB</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Pap</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QRadioButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Chap_RB</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Chap</string>
+ </property>
+ </widget>
+ <widget>
<class>QRadioButton</class>
@@ -196,3 +233,3 @@
<name>name</name>
- <cstring>PapChap_RB</cstring>
+ <cstring>EAP_RB</cstring>
</property>
@@ -200,5 +237,7 @@
<name>text</name>
- <string>Pap/Chap/EAP</string>
+ <string>EAP</string>
</property>
</widget>
+ </hbox>
+ </widget>
<widget>
@@ -277,5 +316,5 @@
<name>spacing</name>
- <number>1</number>
+ <number>2</number>
</property>
- <widget row="2" column="0" >
+ <widget row="1" column="0" >
<class>QLabel</class>
@@ -290,3 +329,3 @@
</widget>
- <widget row="3" column="0" >
+ <widget row="2" column="0" >
<class>QLabel</class>
@@ -301,32 +340,7 @@
</widget>
- <widget row="0" column="1" >
- <class>QComboBox</class>
- <item>
- <property>
- <name>text</name>
- <string>PAP</string>
- </property>
- </item>
- <item>
- <property>
- <name>text</name>
- <string>CHAP</string>
- </property>
- </item>
- <item>
- <property>
- <name>text</name>
- <string>EAP</string>
- </property>
- </item>
- <property stdset="1">
- <name>name</name>
- <cstring>AuthMethod_CB</cstring>
- </property>
- </widget>
- <widget row="1" column="0" >
- <class>QLabel</class>
+ <widget row="1" column="1" >
+ <class>QLineEdit</class>
<property stdset="1">
<name>name</name>
- <cstring>TextLabel1</cstring>
+ <cstring>Server_LE</cstring>
</property>
@@ -334,17 +348,13 @@
<name>text</name>
- <string>Client</string>
+ <string>*</string>
</property>
</widget>
- <widget row="0" column="0" >
- <class>QLabel</class>
+ <widget row="2" column="1" >
+ <class>QLineEdit</class>
<property stdset="1">
<name>name</name>
- <cstring>TextLabel1_4</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Method</string>
+ <cstring>Secret_LE</cstring>
</property>
</widget>
- <widget row="1" column="1" rowspan="1" colspan="2" >
+ <widget row="0" column="1" >
<class>QLineEdit</class>
@@ -359,7 +369,7 @@
</widget>
- <widget row="2" column="1" rowspan="1" colspan="2" >
- <class>QLineEdit</class>
+ <widget row="0" column="0" >
+ <class>QLabel</class>
<property stdset="1">
<name>name</name>
- <cstring>Server_LE</cstring>
+ <cstring>TextLabel1</cstring>
</property>
@@ -367,33 +377,5 @@
<name>text</name>
- <string>*</string>
- </property>
- </widget>
- <widget row="3" column="1" rowspan="1" colspan="2" >
- <class>QLineEdit</class>
- <property stdset="1">
- <name>name</name>
- <cstring>Secret_LE</cstring>
+ <string>Client</string>
</property>
</widget>
- <spacer row="0" column="2" >
- <property>
- <name>name</name>
- <cstring>Spacer7</cstring>
- </property>
- <property stdset="1">
- <name>orientation</name>
- <enum>Horizontal</enum>
- </property>
- <property stdset="1">
- <name>sizeType</name>
- <enum>Expanding</enum>
- </property>
- <property>
- <name>sizeHint</name>
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
</grid>
@@ -419,3 +401,3 @@
<connection>
- <sender>PapChap_RB</sender>
+ <sender>Pap_RB</sender>
<signal>toggled(bool)</signal>
@@ -430,2 +412,14 @@
</connection>
+ <connection>
+ <sender>Chap_RB</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>GroupBox3</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>EAP_RB</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>GroupBox3</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
</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 ){
+bool PPPAuthEdit::PAP_Checked( void ) {
+ return ( Pap_RB->isChecked() ||
+ Chap_RB->isChecked() ||
+ EAP_RB->isChecked()
+ );
+}
+
QString PPPAuthEdit::acceptable( void ) {
@@ -21,3 +28,3 @@ QString PPPAuthEdit::acceptable( void ) {
return tr("Password expect missing");
- } else if( PapChap_RB->isChecked() ) {
+ } else if( PAP_Checked() ) {
if( Client_LE->text().isEmpty() )
@@ -36,3 +43,3 @@ bool PPPAuthEdit::commit( PPPData_t & D ) {
if( ( D.Auth.Mode == 0 && ! Login_RB->isChecked() ) ||
- ( D.Auth.Mode == 1 && ! PapChap_RB->isChecked() ) ||
+ ( D.Auth.Mode == 1 && ! PAP_Checked() ) ||
( D.Auth.Mode == 2 && ! Terminal_RB->isChecked() ) ) {
@@ -42,4 +49,3 @@ bool PPPAuthEdit::commit( PPPData_t & D ) {
0 :
- ( ( PapChap_RB->isChecked() ) ?
- 1 : 2 );
+ ( PAP_Checked() ) ? 1 : 2;
}
@@ -51,3 +57,3 @@ bool PPPAuthEdit::commit( PPPData_t & D ) {
TXTM( D.Auth.Password.Send, PasswordSend_LE, SM );
- } else if( PapChap_RB->isChecked() ) {
+ } else if( PAP_Checked() ) {
TXTM( D.Auth.Client, Client_LE, SM );
@@ -55,3 +61,9 @@ bool PPPAuthEdit::commit( PPPData_t & D ) {
TXTM( D.Auth.Secret, Secret_LE, SM );
- CIM( D.Auth.PCEMode, AuthMethod_CB, SM );
+ if( Pap_RB->isChecked() ) {
+ D.Auth.PCEMode = 0;
+ } else if( Chap_RB->isChecked() ) {
+ D.Auth.PCEMode = 1;
+ } else if( EAP_RB->isChecked() ) {
+ D.Auth.PCEMode = 2;
+ }
}
@@ -64,9 +76,19 @@ void PPPAuthEdit::showData( PPPData_t & D ) {
case 0 :
- Login_RB->isChecked();
+ Login_RB->setChecked( TRUE );
+ break;
+ case 1 :
+ switch( D.Auth.PCEMode ) {
+ case 0 :
+ Pap_RB->setChecked( TRUE );
break;
case 1 :
- PapChap_RB->isChecked();
+ Chap_RB->setChecked( TRUE );
break;
case 2 :
- Terminal_RB->isChecked();
+ EAP_RB->setChecked( TRUE );
+ break;
+ }
+ break;
+ case 2 :
+ Terminal_RB->setChecked( TRUE );
break;
@@ -82,4 +104,2 @@ void PPPAuthEdit::showData( PPPData_t & D ) {
Secret_LE->setText( D.Auth.Secret );
-
- AuthMethod_CB->setCurrentItem( D.Auth.PCEMode );
}
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 :
void showData( PPPData_t & Data );
+ bool PAP_Checked( void );
+
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 @@
+#include <qfile.h>
+#include <qtextstream.h>
#include "ppp_NN.h"
@@ -3,2 +5,4 @@
+QStringList * PPPNetNode::ProperFiles = 0;
+
static const char * PPPNeeds[] =
@@ -13,2 +17,13 @@ static const char * PPPNeeds[] =
PPPNetNode::PPPNetNode() : ANetNode(tr("PPP Connection")) {
+
+ // proper files : will leak
+ ProperFiles =new QStringList;
+ *ProperFiles << "peers";
+ *ProperFiles << "chatscript";
+
+ // system files
+ NSResources->addSystemFile(
+ "pap-secrets", "/tmp/pap-secrets", 0 );
+ NSResources->addSystemFile(
+ "chap-secrets", "/tmp/chap-secrets", 0 );
}
@@ -41,11 +56,13 @@ const char * PPPNetNode::provides( void ) {
-bool PPPNetNode::generateProperFilesFor(
- ANetNodeInstance * ) {
- return 0;
+QStringList * PPPNetNode::properFiles( void ) {
+ return ProperFiles;
+
}
-bool PPPNetNode::generateDeviceDataForCommonFile(
- SystemFile & ,
- long ) {
- return 0;
+// need to generate :
+// /etc/ppp/pap-secrets
+// /etc/ppp/pap-secrets
+bool PPPNetNode::hasDataForFile( const QString & S ) {
+ return S == "pap-secrets" ||
+ S == "chap-secrets" ;
}
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:
- virtual const QString nodeDescription() ;
+ virtual bool hasDataForFile( const QString & S );
+ virtual const QString nodeDescription() ;
virtual ANetNodeInstance * createInstance( void );
-
virtual const char ** needs( void );
@@ -26,9 +26,4 @@ public:
- virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
- virtual bool hasDataFor( const QString & )
- { return 0; }
- virtual bool generateDeviceDataForCommonFile(
- SystemFile & SF, long DevNr );
-
virtual QString genNic( long NicNr );
+ virtual QStringList * properFiles( void );
@@ -38,2 +33,4 @@ private:
virtual void saveSpecificAttribute( QTextStream & TS );
+
+ static QStringList * ProperFiles;
};
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 @@
+#include <qfile.h>
+#include <qfileinfo.h>
#include "PPPedit.h"
@@ -115,7 +117,105 @@ void APPP::commit( void ) {
-bool APPP::generateDataForCommonFile(
- SystemFile & ,
- long) {
- return 1;
+QFile * APPP::openFile( const QString & ID ) {
+ QFile * F = 0;
+ QString S;
+
+ if( ID == "peers" ) {
+ S = removeSpaces( QString("/tmp/") + connection()->name() );
+
+ F = new QFile( S );
+
+ if( ! F->open( IO_WriteOnly ) ) {
+ Log(("Cannot open file %s\n", S.latin1() ));
+ return 0;
}
+ } else if ( ID == "chatscripts" ) {
+ S = removeSpaces( QString("/tmp/") + connection()->name() + ".chat" );
+ F = new QFile( S );
+ if( ! F->open( IO_WriteOnly ) ) {
+ Log(("Cannot open file %s\n", S.latin1() ));
+ return 0;
+ }
+ }
+ if( F ) {
+ Log(("Generate proper file %s = %s\n",
+ ID.latin1(), F->name().latin1()));
+ }
+ return F;
+}
+
+short APPP::generateFile( const QString & ID,
+ const QString & Path,
+ QTextStream & TS,
+ long DevNr ) {
+ short rvl, rvd;
+
+ rvl = 1;
+ rvd = 1;
+
+ if( ID == "pap-secrets" ) {
+ Log(("Generate PPP for %s\n", ID.latin1() ));
+ if( Data.Auth.Mode == 1 && Data.Auth.PCEMode == 0 ) {
+ TS << "# secrets for "
+ << connection()->name().latin1()
+ << endl;
+ TS << Data.Auth.Client
+ << " "
+ << Data.Auth.Server
+ << " "
+ << Data.Auth.Secret
+ << endl;
+ rvl = 0;
+ rvd = connection()->getToplevel()->generateFileEmbedded(
+ ID, Path, TS, DevNr );
+ }
+ } else if( ID == "chap-secrets" ) {
+ Log(("Generate PPP for %s\n", ID.latin1() ));
+ if( Data.Auth.Mode == 1 && Data.Auth.PCEMode != 0 ) {
+ // used for both EAP and Chap
+ TS << "# secrets for "
+ << connection()->name().latin1()
+ << endl;
+ TS << Data.Auth.Client
+ << " "
+ << Data.Auth.Server
+ << " "
+ << Data.Auth.Secret
+ << endl;
+
+ rvl = 0;
+ rvd = connection()->getToplevel()->generateFileEmbedded(
+ ID, Path, TS, DevNr );
+ }
+ } else if ( ID == "peers" ) {
+ QFileInfo FI(Path);
+ Log(("Generate PPP for %s\n", ID.latin1() ));
+
+ TS << "connect \"/usr/sbin/chat -v -f /etc/ppp/"
+ << FI.baseName()
+ << ".chat\""
+ << endl;
+
+ if( Data.IP.GWIsDefault ) {
+ TS << "defaultroute"
+ << endl;
+ }
+
+ TS << "linkname "
+ << removeSpaces( ID.latin1() )
+ << endl;
+
+ // insert other data here
+ rvl = 0;
+ rvd = connection()->getToplevel()->generateFileEmbedded(
+ ID, Path, TS, DevNr );
+ } else if ( ID == "chatscripts" ) {
+ Log(("Generate PPP for %s\n", ID.latin1() ));
+ rvl = 0;
+ rvd = connection()->getToplevel()->generateFileEmbedded(
+ ID, Path, TS, DevNr );
+ }
+
+ return (rvd == 2 || rvl == 2 ) ? 2 :
+ (rvd == 0 || rvl == 0 ) ? 0 : 1;
+}
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;
class PPPEdit;
+class QTextStream;
@@ -16,9 +17,6 @@ public :
- QWidget * edit( QWidget * parent );
- QString acceptable( void );
- void commit( void );
-
RuntimeInfo * runtime( void )
- { if( RT == 0 )
+ { if( RT == 0 ) {
RT = new PPPRun( this, Data );
+ }
return RT->runtimeInfo();
@@ -26,2 +24,6 @@ public :
+ QWidget * edit( QWidget * parent );
+ QString acceptable( void );
+ void commit( void );
+
virtual void * data( void )
@@ -29,7 +31,8 @@ public :
- virtual bool hasDataFor( const QString & )
- { return 0; }
+ virtual QFile * openFile( const QString & ID );
+ short generateFile( const QString & ID,
+ const QString & Path,
+ QTextStream & TS,
+ long DevNr );
- virtual bool generateDataForCommonFile(
- SystemFile & SF, long DevNr );
protected :
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[] =
*/
-ProfileNetNode::ProfileNetNode() : ANetNode( tr("Regular profile")) {
+ProfileNetNode::ProfileNetNode() : ANetNode( tr("Regular connection profile")) {
}
@@ -40,13 +40,2 @@ const char * ProfileNetNode::provides( void ) {
-bool ProfileNetNode::generateProperFilesFor(
- ANetNodeInstance * ) {
- return 0;
-}
-
-bool ProfileNetNode::generateDeviceDataForCommonFile(
- SystemFile & ,
- long ) {
- return 0;
-}
-
void 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:
virtual const QString nodeDescription() ;
-
virtual ANetNodeInstance * createInstance( void );
-
virtual const char ** needs( void );
@@ -26,8 +24,2 @@ public:
- virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
- virtual bool hasDataFor( const QString & )
- { return 0; }
- virtual bool generateDeviceDataForCommonFile(
- SystemFile & SF, long DevNr);
-
private:
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 ) {
-bool AProfile::generateDataForCommonFile(
- SystemFile & ,
- long) {
- return 1;
+short AProfile::generateFileEmbedded( const QString & ID,
+ const QString & Path,
+ QTextStream & TS,
+ long DevNr ) {
+
+ short rvl, rvd;
+
+ rvl = 1;
+
+ if( ID == "interfaces" ) {
+ Log(("Generate Profile for %s\n", ID.latin1() ));
+ if( Data.TriggerVPN ) {
+ // this profile triggers VPN -> insert trigger
+ TS << " up networksettings2 --triggervpn"
+ << endl;
+ rvl = 0;
+ }
}
+ rvd = ANetNodeInstance::generateFileEmbedded( ID, Path, TS, DevNr );
+ return (rvd == 2 || rvl == 2 ) ? 2 :
+ (rvd == 0 || rvl == 0 ) ? 0 : 1;
+}
+
+
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 :
+ RuntimeInfo * runtime( void )
+ { return
+ ( RT ) ? RT : ( RT = new ProfileRun( this, Data ) );
+ }
+
QWidget * edit( QWidget * parent );
@@ -20,10 +25,2 @@ public :
- const QString & description( void )
- { return Data.Description; }
- RuntimeInfo * runtime( void )
- { if( RT == 0 )
- RT = new ProfileRun( this, Data );
- return RT;
- }
-
virtual void * data( void )
@@ -31,7 +28,9 @@ public :
- virtual bool hasDataFor( const QString & )
- { return 0; }
+ virtual short generateFileEmbedded( const QString & ID,
+ const QString & Path,
+ QTextStream & TS,
+ long DevNr );
- virtual bool generateDataForCommonFile(
- SystemFile & SF, long DevNr);
+ const QString & description( void )
+ { return Data.Description; }
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 ) {
-bool USBNetNode::generateProperFilesFor(
- ANetNodeInstance * ) {
- return 0;
-}
-
-bool USBNetNode::hasDataFor( const QString & S ) {
- return (S== "interfaces");
-}
-
-bool USBNetNode::generateDeviceDataForCommonFile(
- SystemFile & S ,
- long DevNr ) {
- QString NIC = genNic( DevNr );
-
- if( S.name() == "interfaces" ) {
- // generate mapping stanza for this interface
- S << "# check if " << NIC << " can be brought UP" << endl;
- S << "mapping " << NIC << endl;
- S << " script networksettings2-request" << endl << endl;
- }
- return 0;
-}
-
QString 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:
virtual const QString nodeDescription() ;
-
virtual ANetNodeInstance * createInstance( void );
-
virtual const char ** needs( void );
@@ -26,7 +24,2 @@ public:
- virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
- virtual bool hasDataFor( const QString & S);
- virtual bool generateDeviceDataForCommonFile(
- SystemFile & SF, long DevNr );
-
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 ) {
-bool AUSB::hasDataFor( const QString & S ) {
- return (S== "interfaces");
-}
+short AUSB::generateFileEmbedded( const QString & ID,
+ const QString & Path,
+ QTextStream & TS,
+ long DevNr ) {
-bool AUSB::generateDataForCommonFile( SystemFile & S, long DevNr ) {
QString NIC = runtime()->device()->netNode()->nodeClass()->genNic( DevNr );
+ short rvl, rvd;
+
+ rvl = 1;
- if( S.name() == "interfaces" ) {
+ if( ID == "interfaces" ) {
+ Log(("Generate USB for %s\n", ID.latin1() ));
// generate mapping stanza for this interface
- S << " pre-up "
+ TS << " pre-up "
<< QPEApplication::qpeDir()
@@ -49,4 +53,9 @@ bool AUSB::generateDataForCommonFile( SystemFile & S, long DevNr ) {
<< endl;
+ rvl = 0;
}
- return 0;
+ rvd = ANetNodeInstance::generateFileEmbedded( ID, Path, TS, DevNr );
+
+ return (rvd == 2 || rvl == 2 ) ? 2 :
+ (rvd == 0 || rvl == 0 ) ? 0 : 1;
+
}
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 :
+ RuntimeInfo * runtime( void )
+ { return
+ ( RT ) ? RT : ( RT = new USBRun( this, Data ) );
+ }
+
QWidget * edit( QWidget * parent );
@@ -20,8 +25,2 @@ public :
- RuntimeInfo * runtime( void )
- { if( RT == 0 )
- RT = new USBRun( this, Data );
- return RT;
- }
-
virtual void * data( void )
@@ -29,5 +28,6 @@ public :
- virtual bool hasDataFor( const QString & S);
- virtual bool generateDataForCommonFile(
- SystemFile & SF, long DevNr );
+ virtual short generateFileEmbedded( const QString & ID,
+ const QString & Path,
+ QTextStream & TS,
+ long DevNr );
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 @@
static const char * VPNNeeds[] =
- { "connection",
- 0
+ { 0
};
@@ -40,13 +39,2 @@ const char * VPNNetNode::provides( void ) {
-bool VPNNetNode::generateProperFilesFor(
- ANetNodeInstance * ) {
- return 0;
-}
-
-bool VPNNetNode::generateDeviceDataForCommonFile(
- SystemFile & ,
- long ) {
- return 0;
-}
-
void 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:
virtual const QString nodeDescription() ;
-
virtual ANetNodeInstance * createInstance( void );
-
virtual const char ** needs( void );
@@ -26,8 +24,2 @@ public:
- virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
- virtual bool hasDataFor( const QString & )
- { return 0; }
- virtual bool generateDeviceDataForCommonFile(
- SystemFile & SF, long DevNr );
-
private:
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 ) {
-bool AVPN::generateDataForCommonFile(
- SystemFile & ,
- long) {
- return 1;
-}
-
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 :
+ RuntimeInfo * runtime( void )
+ { return
+ ( RT ) ? RT : ( RT = new VPNRun( this, Data ) );
+ }
+
QWidget * edit( QWidget * parent );
@@ -20,8 +25,2 @@ public :
- RuntimeInfo * runtime( void )
- { if( RT == 0 )
- RT = new VPNRun( this, Data );
- return RT;
- }
-
virtual void * data( void )
@@ -29,6 +28,3 @@ public :
- virtual bool hasDataFor( const QString & )
- { return 0; }
- virtual bool generateDataForCommonFile(
- SystemFile & SF, long DevNr );
+
protected :
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 ) {
-bool WLanNetNode::generateProperFilesFor(
- ANetNodeInstance * ) {
- return 0;
-}
-
-bool WLanNetNode::hasDataFor( const QString & S ) {
- return S == "interfaces";
-}
-
-bool WLanNetNode::generateDeviceDataForCommonFile(
- SystemFile & S,
- long DevNr ) {
- QString NIC = genNic( DevNr );
-
- if( S.name() == "interfaces" ) {
- // generate mapping stanza for this interface
- S << "# check if " << NIC << " can be brought UP" << endl;
- S << "mapping " << NIC << endl;
- S << " script networksettings2-request" << endl << endl;
- }
- return 0;
-}
-
QString 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:
virtual const QString nodeDescription() ;
-
virtual ANetNodeInstance * createInstance( void );
-
virtual const char ** needs( void );
@@ -26,11 +24,4 @@ public:
- virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
-
- virtual bool hasDataFor( const QString & S );
- virtual bool generateDeviceDataForCommonFile(
- SystemFile & SF, long DevNr );
-
virtual long instanceCount( void )
{ return InstanceCount; }
-
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 ) {
-bool AWLan::generateDataForCommonFile(
- SystemFile & S,
- long ) {
+short AWLan::generateFileEmbedded( const QString & ID,
+ const QString & Path,
+ QTextStream & TS,
+ long DevNr ) {
- S << " wireless_essid \""
+ short rvl, rvd;
+
+ rvl = 1;
+
+ if( ID == "interfaces" ) {
+ Log(("Generate WLanNNI for %s\n", ID.latin1() ));
+ TS << " wireless_essid \""
<< Data.ESSID
@@ -95,3 +102,3 @@ bool AWLan::generateDataForCommonFile(
Buf[99] = '\0'; // just to make sure
- S << " wireless_nick "
+ TS << " wireless_nick "
<< Buf
@@ -100,3 +107,3 @@ bool AWLan::generateDataForCommonFile(
} else {
- S << " wireless_nick \""
+ TS << " wireless_nick \""
<< Data.NodeName
@@ -107,6 +114,5 @@ bool AWLan::generateDataForCommonFile(
- char * M;
+ char * M = "Auto";
switch ( Data.Mode ) {
case 0 :
- M = "Auto";
break;
@@ -120,3 +126,3 @@ bool AWLan::generateDataForCommonFile(
- S << " wireless_mode "
+ TS << " wireless_mode "
<< M
@@ -126,3 +132,3 @@ bool AWLan::generateDataForCommonFile(
if( ! Data.Key[i].isEmpty() ) {
- S << " wireless_key"
+ TS << " wireless_key"
<< i
@@ -133,3 +139,3 @@ bool AWLan::generateDataForCommonFile(
}
- S << " wireless_keymode "
+ TS << " wireless_keymode "
<< ((Data.AcceptNonEncrypted) ? "open" : "restricted")
@@ -137,3 +143,8 @@ bool AWLan::generateDataForCommonFile(
}
- return 0;
+ rvl = 0;
+ }
+ rvd = ANetNodeInstance::generateFileEmbedded( ID, Path, TS, DevNr);
+
+ return (rvd == 2 || rvl == 2 ) ? 2 :
+ (rvd == 0 || rvl == 0 ) ? 0 : 1;
}
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 :
+ RuntimeInfo * runtime( void )
+ { return
+ ( RT ) ? RT : ( RT = new WLanRun( this, Data ) );
+ }
+
QWidget * edit( QWidget * parent );
@@ -20,8 +25,2 @@ public :
- RuntimeInfo * runtime( void )
- { if( RT == 0 )
- RT = new WLanRun( this, Data );
- return RT;
- }
-
virtual void * data( void )
@@ -29,6 +28,7 @@ public :
- virtual bool hasDataFor( const QString & )
- { return 1; }
- virtual bool generateDataForCommonFile(
- SystemFile & SF, long DevNr );
+ virtual short generateFileEmbedded( const QString & ID,
+ const QString & Path,
+ QTextStream & TS,
+ long DevNr );
+
protected :