summaryrefslogtreecommitdiff
authorwimpie <wimpie>2004-04-04 15:23:16 (UTC)
committer wimpie <wimpie>2004-04-04 15:23:16 (UTC)
commitfd9146de7698a796659b68606429da490f817138 (patch) (side-by-side diff)
treef026bf2a7adcaaa3a0dd0429e7474f536787253d
parent5b52572e2ec9f0f6f39706aceb9ec1e98440fd3d (diff)
downloadopie-fd9146de7698a796659b68606429da490f817138.zip
opie-fd9146de7698a796659b68606429da490f817138.tar.gz
opie-fd9146de7698a796659b68606429da490f817138.tar.bz2
Many changes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NNI.h3
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h5
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.h3
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp24
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetooth_NN.h16
-rw-r--r--noncore/settings/networksettings2/cable/cable_NN.cpp14
-rw-r--r--noncore/settings/networksettings2/cable/cable_NN.h7
-rw-r--r--noncore/settings/networksettings2/cable/cable_NNI.cpp7
-rw-r--r--noncore/settings/networksettings2/cable/cable_NNI.h5
-rw-r--r--noncore/settings/networksettings2/editconnection.cpp35
-rw-r--r--noncore/settings/networksettings2/irda/irda_NN.cpp14
-rw-r--r--noncore/settings/networksettings2/irda/irda_NN.h7
-rw-r--r--noncore/settings/networksettings2/irda/irda_NNI.cpp7
-rw-r--r--noncore/settings/networksettings2/irda/irda_NNI.h5
-rw-r--r--noncore/settings/networksettings2/lancard/lancard_NN.cpp29
-rw-r--r--noncore/settings/networksettings2/lancard/lancard_NN.h11
-rw-r--r--noncore/settings/networksettings2/lancard/lancard_NNI.cpp15
-rw-r--r--noncore/settings/networksettings2/lancard/lancard_NNI.h6
-rw-r--r--noncore/settings/networksettings2/lancard/lancardrun.h5
-rw-r--r--noncore/settings/networksettings2/modem/modem_NN.cpp14
-rw-r--r--noncore/settings/networksettings2/modem/modem_NN.h7
-rw-r--r--noncore/settings/networksettings2/modem/modem_NNI.cpp6
-rw-r--r--noncore/settings/networksettings2/modem/modem_NNI.h5
-rw-r--r--noncore/settings/networksettings2/network/network_NN.cpp17
-rw-r--r--noncore/settings/networksettings2/network/network_NN.h7
-rw-r--r--noncore/settings/networksettings2/network/network_NNI.cpp7
-rw-r--r--noncore/settings/networksettings2/network/network_NNI.h4
-rw-r--r--noncore/settings/networksettings2/network/networkrun.cpp1
-rw-r--r--noncore/settings/networksettings2/networksettings.cpp4
-rw-r--r--noncore/settings/networksettings2/networksettings2/asdevice.h6
-rw-r--r--noncore/settings/networksettings2/networksettings2/netnode.cpp2
-rw-r--r--noncore/settings/networksettings2/networksettings2/netnode.h50
-rw-r--r--noncore/settings/networksettings2/networksettings2/systemfile.cpp14
-rw-r--r--noncore/settings/networksettings2/networksettings2/systemfile.h4
-rw-r--r--noncore/settings/networksettings2/nsdata.cpp327
-rw-r--r--noncore/settings/networksettings2/nsdata.h5
-rw-r--r--noncore/settings/networksettings2/ppp/ppp_NN.cpp17
-rw-r--r--noncore/settings/networksettings2/ppp/ppp_NN.h9
-rw-r--r--noncore/settings/networksettings2/ppp/ppp_NNI.cpp6
-rw-r--r--noncore/settings/networksettings2/ppp/ppp_NNI.h5
-rw-r--r--noncore/settings/networksettings2/ppp/ppprun.h2
-rw-r--r--noncore/settings/networksettings2/profile/profile_NN.cpp14
-rw-r--r--noncore/settings/networksettings2/profile/profile_NN.h7
-rw-r--r--noncore/settings/networksettings2/profile/profile_NNI.cpp6
-rw-r--r--noncore/settings/networksettings2/profile/profile_NNI.h6
-rw-r--r--noncore/settings/networksettings2/usb/usb_NN.cpp24
-rw-r--r--noncore/settings/networksettings2/usb/usb_NN.h8
-rw-r--r--noncore/settings/networksettings2/usb/usb_NNI.cpp25
-rw-r--r--noncore/settings/networksettings2/usb/usb_NNI.h5
-rw-r--r--noncore/settings/networksettings2/usb/usbrun.cpp6
-rw-r--r--noncore/settings/networksettings2/usb/usbrun.h4
-rw-r--r--noncore/settings/networksettings2/vpn/vpn_NN.cpp14
-rw-r--r--noncore/settings/networksettings2/vpn/vpn_NN.h7
-rw-r--r--noncore/settings/networksettings2/vpn/vpn_NNI.cpp6
-rw-r--r--noncore/settings/networksettings2/vpn/vpn_NNI.h4
-rw-r--r--noncore/settings/networksettings2/wlan/wlan_NN.cpp29
-rw-r--r--noncore/settings/networksettings2/wlan/wlan_NN.h12
-rw-r--r--noncore/settings/networksettings2/wlan/wlan_NNI.cpp16
-rw-r--r--noncore/settings/networksettings2/wlan/wlan_NNI.h6
-rw-r--r--noncore/settings/networksettings2/wlan/wlanrun.h4
60 files changed, 435 insertions, 505 deletions
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NNI.h b/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NNI.h
index a21f574..bb3e7e7 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NNI.h
+++ b/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NNI.h
@@ -27,6 +27,9 @@ public :
virtual void * data( void )
{ return (void *)&Data; }
+ virtual bool hasDataFor( const QString & S );
+ virtual bool generateDataForCommonFile( SystemFile & SF, long );
+
protected :
virtual void setSpecificAttribute( QString & Attr, QString & Value );
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h
index 347da0c..4a773cd 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h
+++ b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h
@@ -9,11 +9,6 @@ public :
BluetoothBNEPData & Data ) : AsDevice( NNI )
{ }
- virtual long count( void )
- { return 3; }
- virtual QString genNic( long nr )
- { QString S; return S.sprintf( "bnep%ld", nr ); }
-
virtual AsDevice * asDevice( void )
{ return (AsDevice *)this; }
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.h b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.h
index 57ff95e..97bd29c 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.h
+++ b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.h
@@ -27,6 +27,9 @@ public :
virtual void * data( void )
{ return (void *)&Data; }
+ virtual bool hasDataFor( const QString & S );
+ virtual bool generateDataForCommonFile( SystemFile & SF, long );
+
protected :
virtual void setSpecificAttribute( QString & Attr, QString & Value );
diff --git a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp
index 47272c4..3d1aa69 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp
+++ b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp
@@ -49,22 +49,19 @@ bool BluetoothBNEPNetNode::generateProperFilesFor(
return 1;
}
-bool BluetoothBNEPNetNode::hasDataFor( const QString & S, bool DS ) {
- return DS && S == "interfaces";
+bool BluetoothBNEPNetNode::hasDataFor( const QString & S ) {
+ return S == "interfaces";
}
-bool BluetoothBNEPNetNode::generateDataForCommonFile(
+bool BluetoothBNEPNetNode::generateDeviceDataForCommonFile(
SystemFile & ,
- long ,
- ANetNodeInstance * ) {
+ long ) {
return 1;
}
-bool BluetoothBNEPNetNode::generateDeviceDataForCommonFile(
- SystemFile & ,
- long ,
- ANetNodeInstance * ) {
- return 1;
+QString BluetoothBNEPNetNode::genNic( long nr ) {
+ QString S;
+ return S.sprintf( "bnep%ld", nr );
}
//
@@ -108,14 +105,13 @@ bool BluetoothRFCOMMNetNode::generateProperFilesFor(
return 0;
}
-bool BluetoothRFCOMMNetNode::hasDataFor( const QString &, bool ) {
+bool BluetoothRFCOMMNetNode::hasDataFor( const QString & ) {
return 0;
}
-bool BluetoothRFCOMMNetNode::generateDataForCommonFile(
+bool BluetoothRFCOMMNetNode::generateDeviceDataForCommonFile(
SystemFile & ,
- long,
- ANetNodeInstance * ) {
+ long ) {
return 0;
}
diff --git a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h
index d72b0d4..5cd6c52 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h
+++ b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h
@@ -28,11 +28,13 @@ public:
virtual const char * provides( void );
virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
- virtual bool hasDataFor( const QString & S, bool DS );
- virtual bool generateDataForCommonFile(
- SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
+ virtual bool hasDataFor( const QString & S );
virtual bool generateDeviceDataForCommonFile(
- SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
+ SystemFile & , long DevNr );
+
+ virtual long instanceCount( void )
+ { return 7; }
+ virtual QString genNic( long );
private:
@@ -61,11 +63,9 @@ public:
virtual const char * provides( void );
virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
- virtual bool hasDataFor( const QString & S, bool );
- virtual bool generateDataForCommonFile(
- SystemFile & SF, long, ANetNodeInstance * NNI );
+ virtual bool hasDataFor( const QString & S );
virtual bool generateDeviceDataForCommonFile(
- SystemFile & SF, long, ANetNodeInstance * NNI );
+ SystemFile & , long );
private:
diff --git a/noncore/settings/networksettings2/cable/cable_NN.cpp b/noncore/settings/networksettings2/cable/cable_NN.cpp
index 6f62772..a6be4d5 100644
--- a/noncore/settings/networksettings2/cable/cable_NN.cpp
+++ b/noncore/settings/networksettings2/cable/cable_NN.cpp
@@ -41,21 +41,9 @@ bool CableNetNode::generateProperFilesFor(
return 1;
}
-bool CableNetNode::hasDataFor( const QString &, bool ) {
- return 0;
-}
-
-bool CableNetNode::generateDataForCommonFile(
- SystemFile & ,
- long ,
- ANetNodeInstance * ) {
- return 1;
-}
-
bool CableNetNode::generateDeviceDataForCommonFile(
SystemFile & ,
- long ,
- ANetNodeInstance * ) {
+ long ) {
return 1;
}
diff --git a/noncore/settings/networksettings2/cable/cable_NN.h b/noncore/settings/networksettings2/cable/cable_NN.h
index 3875af6..83b98e0 100644
--- a/noncore/settings/networksettings2/cable/cable_NN.h
+++ b/noncore/settings/networksettings2/cable/cable_NN.h
@@ -28,11 +28,10 @@ public:
virtual const char * provides( void );
virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
- virtual bool hasDataFor( const QString & S, bool DS );
- virtual bool generateDataForCommonFile(
- SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
+ virtual bool hasDataFor( const QString & )
+ { return 0; }
virtual bool generateDeviceDataForCommonFile(
- SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
+ SystemFile & SF, long DevNr);
private:
diff --git a/noncore/settings/networksettings2/cable/cable_NNI.cpp b/noncore/settings/networksettings2/cable/cable_NNI.cpp
index d26afd1..ca21135 100644
--- a/noncore/settings/networksettings2/cable/cable_NNI.cpp
+++ b/noncore/settings/networksettings2/cable/cable_NNI.cpp
@@ -64,3 +64,10 @@ void ACable::commit( void ) {
setModified( 1 );
}
}
+
+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 0654a5d..bf3e292 100644
--- a/noncore/settings/networksettings2/cable/cable_NNI.h
+++ b/noncore/settings/networksettings2/cable/cable_NNI.h
@@ -27,6 +27,11 @@ public :
virtual void * data( void )
{ return (void *)&Data; }
+ virtual bool hasDataFor( const QString & )
+ { return 0; }
+ virtual bool generateDataForCommonFile(
+ SystemFile & SF, long DevNr );
+
protected :
virtual void setSpecificAttribute( QString & Attr, QString & Value );
diff --git a/noncore/settings/networksettings2/editconnection.cpp b/noncore/settings/networksettings2/editconnection.cpp
index ce13573..4bbe502 100644
--- a/noncore/settings/networksettings2/editconnection.cpp
+++ b/noncore/settings/networksettings2/editconnection.cpp
@@ -104,16 +104,14 @@ NodeCollection * EditConnection::getTmpCollection( void ) {
return &(TmpCollection);
// reset collection -> delete all NEW NetNodes
- { ANetNodeInstance * NNI;
- for( QListIterator<ANetNodeInstance> it(TmpCollection);
- it.current();
- ++it ) {
- if( it.current()->isNew() ) {
- delete it.current();
- }
+ for( QListIterator<ANetNodeInstance> it(TmpCollection);
+ it.current();
+ ++it ) {
+ if( it.current()->isNew() ) {
+ delete it.current();
}
- TmpCollection.clear();
}
+ TmpCollection.clear();
// update content
QListViewItem * it = Nodes_LV->firstChild();
@@ -135,7 +133,7 @@ NodeCollection * EditConnection::getTmpCollection( void ) {
// this radio is selected -> go deeper
if( SelectedNodes == 0 ||
NNI == 0 ||
- NNI->netNode()->nodeName() != it->text(0) ) {
+ NNI->nodeClass()->nodeName() != it->text(0) ) {
// new item not in previous collection
ANetNodeInstance * NNI = (*Mapping)[it]->createInstance();
NNI->initialize();
@@ -198,10 +196,10 @@ void EditConnection::setConnection( NodeCollection * NC ) {
it = it->firstChild();
Found = 0;
while( it ) {
- if( NNI && NNI->netNode()->nodeName() == it->text(0) ) {
+ if( NNI && NNI->nodeClass()->nodeName() == it->text(0) ) {
// this radio is part of the collection
((QCheckListItem *)it)->setOn( 1 );
- updateGUI( it, NNI->netNode() );
+ updateGUI( it, NNI->nodeClass() );
// check its children
Found = 1;
it = it->firstChild();
@@ -240,13 +238,10 @@ NodeCollection * EditConnection::connection( void ) {
SelectedNodes->clear();
// transfer
- { ANetNodeInstance * NNI;
-
- for( QListIterator<ANetNodeInstance> it(TmpCollection);
- it.current();
- ++it ) {
- SelectedNodes->append( it.current() );
- }
+ for( QListIterator<ANetNodeInstance> it(TmpCollection);
+ it.current();
+ ++it ) {
+ SelectedNodes->append( it.current() );
}
if( TmpCollection.isModified() )
@@ -448,8 +443,8 @@ void EditConnection::SLOT_AlterTab( const QString & S ) {
for ( ; it.current(); ++it ) {
NNI = it.current();
Devices_CB->insertItem(
- NSResources->getPixmap( NNI->netNode()->pixmapName() ),
- NNI->netNode()->nodeName()
+ NSResources->getPixmap( NNI->nodeClass()->pixmapName() ),
+ NNI->nodeClass()->nodeName()
);
// add edit widget
diff --git a/noncore/settings/networksettings2/irda/irda_NN.cpp b/noncore/settings/networksettings2/irda/irda_NN.cpp
index 4347191..96327a5 100644
--- a/noncore/settings/networksettings2/irda/irda_NN.cpp
+++ b/noncore/settings/networksettings2/irda/irda_NN.cpp
@@ -41,21 +41,9 @@ bool IRDANetNode::generateProperFilesFor(
return 1;
}
-bool IRDANetNode::hasDataFor( const QString &, bool ) {
- return 0;
-}
-
-bool IRDANetNode::generateDataForCommonFile(
- SystemFile & ,
- long ,
- ANetNodeInstance * ) {
- return 1;
-}
-
bool IRDANetNode::generateDeviceDataForCommonFile(
SystemFile & ,
- long ,
- ANetNodeInstance * ) {
+ long ) {
return 1;
}
diff --git a/noncore/settings/networksettings2/irda/irda_NN.h b/noncore/settings/networksettings2/irda/irda_NN.h
index a772f69..a5b6cc5 100644
--- a/noncore/settings/networksettings2/irda/irda_NN.h
+++ b/noncore/settings/networksettings2/irda/irda_NN.h
@@ -28,11 +28,10 @@ public:
virtual const char * provides( void );
virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
- virtual bool hasDataFor( const QString & S, bool DS );
- virtual bool generateDataForCommonFile(
- SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
+ virtual bool hasDataFor( const QString & )
+ { return 0; }
virtual bool generateDeviceDataForCommonFile(
- SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
+ SystemFile & SF, long DevNr );
private:
diff --git a/noncore/settings/networksettings2/irda/irda_NNI.cpp b/noncore/settings/networksettings2/irda/irda_NNI.cpp
index 78d6ff9..f00a1d5 100644
--- a/noncore/settings/networksettings2/irda/irda_NNI.cpp
+++ b/noncore/settings/networksettings2/irda/irda_NNI.cpp
@@ -28,3 +28,10 @@ void AIRDA::commit( void ) {
if( GUI && GUI->commit( Data ) )
setModified( 1 );
}
+
+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 c2d6875..210d87d 100644
--- a/noncore/settings/networksettings2/irda/irda_NNI.h
+++ b/noncore/settings/networksettings2/irda/irda_NNI.h
@@ -27,6 +27,11 @@ public :
virtual void * data( void )
{ return (void *)&Data; }
+ virtual bool hasDataFor( const QString & )
+ { return 0; }
+ virtual bool generateDataForCommonFile(
+ SystemFile & SF, long DevNr );
+
protected :
virtual void setSpecificAttribute( QString & Attr, QString & Value );
diff --git a/noncore/settings/networksettings2/lancard/lancard_NN.cpp b/noncore/settings/networksettings2/lancard/lancard_NN.cpp
index 7d36918..480ddf9 100644
--- a/noncore/settings/networksettings2/lancard/lancard_NN.cpp
+++ b/noncore/settings/networksettings2/lancard/lancard_NN.cpp
@@ -42,22 +42,27 @@ bool LanCardNetNode::generateProperFilesFor(
return 1;
}
-bool LanCardNetNode::hasDataFor( const QString & S, bool DS ) {
- return DS && S == "interfaces";
-}
-
-bool LanCardNetNode::generateDataForCommonFile(
- SystemFile & ,
- long ,
- ANetNodeInstance * ) {
- return 1;
+bool LanCardNetNode::hasDataFor( const QString & S ) {
+ return S == "interfaces";
}
bool LanCardNetNode::generateDeviceDataForCommonFile(
SystemFile & S ,
- long DevNr ,
- ANetNodeInstance * NNI ) {
- return ((ALanCard *)NNI)->generateDeviceDataForCommonFile(S, DevNr);
+ 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 ) {
+ QString S;
+ return S.sprintf( "eth%ld", nr );
}
extern "C" {
diff --git a/noncore/settings/networksettings2/lancard/lancard_NN.h b/noncore/settings/networksettings2/lancard/lancard_NN.h
index 9690c76..dcdd0da 100644
--- a/noncore/settings/networksettings2/lancard/lancard_NN.h
+++ b/noncore/settings/networksettings2/lancard/lancard_NN.h
@@ -28,11 +28,14 @@ public:
virtual const char * provides( void );
virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
- virtual bool hasDataFor( const QString & S, bool DS );
- virtual bool generateDataForCommonFile(
- SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
+ virtual bool hasDataFor( const QString & S );
virtual bool generateDeviceDataForCommonFile(
- SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
+ SystemFile & SF, long DevNr );
+
+ virtual long instanceCount( void )
+ { return 2; }
+
+ virtual QString genNic( long );
private:
diff --git a/noncore/settings/networksettings2/lancard/lancard_NNI.cpp b/noncore/settings/networksettings2/lancard/lancard_NNI.cpp
index a6401db..5962d52 100644
--- a/noncore/settings/networksettings2/lancard/lancard_NNI.cpp
+++ b/noncore/settings/networksettings2/lancard/lancard_NNI.cpp
@@ -43,16 +43,9 @@ void ALanCard::commit( void ) {
setModified( 1 );
}
-bool ALanCard::generateDeviceDataForCommonFile( SystemFile & S, long DevNr ) {
- AsDevice * Dev = runtime()->device();
- QString NIC = Dev->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;
+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 16f5f56..4e91523 100644
--- a/noncore/settings/networksettings2/lancard/lancard_NNI.h
+++ b/noncore/settings/networksettings2/lancard/lancard_NNI.h
@@ -27,8 +27,10 @@ public :
virtual void * data( void )
{ return (void *)&Data; }
- bool generateDeviceDataForCommonFile( SystemFile & S, long DevNr );
-
+ virtual bool hasDataFor( const QString & )
+ { return 0; }
+ virtual bool generateDataForCommonFile(
+ SystemFile & S, long DevNr );
protected :
virtual void setSpecificAttribute( QString & Attr, QString & Value );
diff --git a/noncore/settings/networksettings2/lancard/lancardrun.h b/noncore/settings/networksettings2/lancard/lancardrun.h
index 8dbd1b1..499b417 100644
--- a/noncore/settings/networksettings2/lancard/lancardrun.h
+++ b/noncore/settings/networksettings2/lancard/lancardrun.h
@@ -14,11 +14,6 @@ public :
Pat( "eth[0-9]" )
{ }
- virtual long count( void )
- { return 2; }
- virtual QString genNic( long nr )
- { QString S; return S.sprintf( "eth%ld", nr ); }
-
virtual AsDevice * device( void )
{ return (AsDevice *)this; }
diff --git a/noncore/settings/networksettings2/modem/modem_NN.cpp b/noncore/settings/networksettings2/modem/modem_NN.cpp
index 2807963..65b06ee 100644
--- a/noncore/settings/networksettings2/modem/modem_NN.cpp
+++ b/noncore/settings/networksettings2/modem/modem_NN.cpp
@@ -42,21 +42,9 @@ bool ModemNetNode::generateProperFilesFor(
return 1;
}
-bool ModemNetNode::hasDataFor( const QString &, bool ) {
- return 0;
-}
-
-bool ModemNetNode::generateDataForCommonFile(
- SystemFile & ,
- long ,
- ANetNodeInstance * ) {
- return 1;
-}
-
bool ModemNetNode::generateDeviceDataForCommonFile(
SystemFile & ,
- long ,
- ANetNodeInstance * ) {
+ long ) {
return 1;
}
diff --git a/noncore/settings/networksettings2/modem/modem_NN.h b/noncore/settings/networksettings2/modem/modem_NN.h
index bd921c6..49244b2 100644
--- a/noncore/settings/networksettings2/modem/modem_NN.h
+++ b/noncore/settings/networksettings2/modem/modem_NN.h
@@ -28,11 +28,10 @@ public:
virtual const char * provides( void );
virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
- virtual bool hasDataFor( const QString & S, bool DS );
- virtual bool generateDataForCommonFile(
- SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
+ virtual bool hasDataFor( const QString & )
+ { return 0; }
virtual bool generateDeviceDataForCommonFile(
- SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
+ SystemFile & SF, long DevNr );
private:
diff --git a/noncore/settings/networksettings2/modem/modem_NNI.cpp b/noncore/settings/networksettings2/modem/modem_NNI.cpp
index 91df22b..6c76b56 100644
--- a/noncore/settings/networksettings2/modem/modem_NNI.cpp
+++ b/noncore/settings/networksettings2/modem/modem_NNI.cpp
@@ -29,3 +29,9 @@ void AModem::commit( void ) {
setModified( 1 );
}
+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 7543e7d..a623704 100644
--- a/noncore/settings/networksettings2/modem/modem_NNI.h
+++ b/noncore/settings/networksettings2/modem/modem_NNI.h
@@ -27,6 +27,11 @@ public :
virtual void * data( void )
{ return (void *)&Data; }
+ virtual bool hasDataFor( const QString & )
+ { return 0; }
+ virtual bool generateDataForCommonFile(
+ SystemFile & SF, long DevNr );
+
protected :
virtual void setSpecificAttribute( QString & Attr, QString & Value );
diff --git a/noncore/settings/networksettings2/network/network_NN.cpp b/noncore/settings/networksettings2/network/network_NN.cpp
index a6b15c6..4a77e6a 100644
--- a/noncore/settings/networksettings2/network/network_NN.cpp
+++ b/noncore/settings/networksettings2/network/network_NN.cpp
@@ -43,24 +43,9 @@ bool NetworkNetNode::generateProperFilesFor(
return 1;
}
-bool NetworkNetNode::hasDataFor( const QString & S, bool DS ) {
- if( ! DS && S == "interfaces" ) {
- return 1;
- }
- return 0;
-}
-
-bool NetworkNetNode::generateDataForCommonFile(
- SystemFile & S,
- long DevNr,
- ANetNodeInstance * NNI ) {
- return ((ANetwork *)NNI)->generateDataForCommonFile(S, DevNr);
-}
-
bool NetworkNetNode::generateDeviceDataForCommonFile(
SystemFile & ,
- long ,
- ANetNodeInstance * ) {
+ long ) {
return 1;
}
diff --git a/noncore/settings/networksettings2/network/network_NN.h b/noncore/settings/networksettings2/network/network_NN.h
index 62a3f10..59f0526 100644
--- a/noncore/settings/networksettings2/network/network_NN.h
+++ b/noncore/settings/networksettings2/network/network_NN.h
@@ -28,11 +28,10 @@ public:
virtual const char * provides( void );
virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
- virtual bool hasDataFor( const QString & S, bool DS );
- virtual bool generateDataForCommonFile(
- SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
+ virtual bool hasDataFor( const QString & )
+ { return 0; }
virtual bool generateDeviceDataForCommonFile(
- SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
+ SystemFile & SF, long DevNr );
private:
diff --git a/noncore/settings/networksettings2/network/network_NNI.cpp b/noncore/settings/networksettings2/network/network_NNI.cpp
index eac2d66..054385a 100644
--- a/noncore/settings/networksettings2/network/network_NNI.cpp
+++ b/noncore/settings/networksettings2/network/network_NNI.cpp
@@ -99,9 +99,12 @@ void ANetwork::commit( void ) {
setModified( 1 );
}
+bool ANetwork::hasDataFor( const QString & S ) {
+ return S == "interfaces";
+}
+
bool ANetwork::generateDataForCommonFile( SystemFile & S, long DevNr ) {
- AsDevice * Dev = runtime()->device();
- QString NIC = Dev->genNic( DevNr );
+ QString NIC = runtime()->device()->netNode()->nodeClass()->genNic( DevNr );
if( S.name() == "interfaces" ) {
// we can safely call from here since device item is deeper
diff --git a/noncore/settings/networksettings2/network/network_NNI.h b/noncore/settings/networksettings2/network/network_NNI.h
index b98ff6e..0058793 100644
--- a/noncore/settings/networksettings2/network/network_NNI.h
+++ b/noncore/settings/networksettings2/network/network_NNI.h
@@ -28,7 +28,9 @@ public :
virtual void * data( void )
{ return (void *)&Data; }
- bool generateDataForCommonFile( SystemFile & S, long DevNr );
+ virtual bool hasDataFor( const QString & S );
+ virtual bool generateDataForCommonFile(
+ SystemFile & SF, long DevNr );
protected :
diff --git a/noncore/settings/networksettings2/network/networkrun.cpp b/noncore/settings/networksettings2/network/networkrun.cpp
index f34fdbf..ddb9a5f 100644
--- a/noncore/settings/networksettings2/network/networkrun.cpp
+++ b/noncore/settings/networksettings2/network/networkrun.cpp
@@ -10,6 +10,7 @@ void NetworkRun::detectState( NodeCollection * NC ) {
if( II ) {
// device has assigned interface
NC->setCurrentState( (( II->IsUp ) ? IsUp : Available) );
+ return;
}
// has no interface -> delegate
diff --git a/noncore/settings/networksettings2/networksettings.cpp b/noncore/settings/networksettings2/networksettings.cpp
index c3e6572..3ddcbde 100644
--- a/noncore/settings/networksettings2/networksettings.cpp
+++ b/noncore/settings/networksettings2/networksettings.cpp
@@ -73,7 +73,7 @@ NetworkSettings::~NetworkSettings() {
if( ! S.isEmpty() ) {
QMessageBox::warning(
0,
- tr( "Generating system configuration" ),
+ tr( "In System Config" ),
S
);
}
@@ -183,7 +183,7 @@ void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) {
if( LCN ) {
QMessageBox::warning(
0,
- tr( "Generating system configuration" ),
+ tr( "In System Config" ),
tr( "Name %1 already exists" ).arg(NC->name())
);
continue; // restart exec
diff --git a/noncore/settings/networksettings2/networksettings2/asdevice.h b/noncore/settings/networksettings2/networksettings2/asdevice.h
index 058fc4c..19241c1 100644
--- a/noncore/settings/networksettings2/networksettings2/asdevice.h
+++ b/noncore/settings/networksettings2/networksettings2/asdevice.h
@@ -22,12 +22,6 @@ public :
virtual void assignInterface( InterfaceInfo * NI )
{ AssignedInterface = NI; }
- // number of device to configure for this Device type
- virtual long count( void )
- { return 1; }
- // generate NIC name of device number ...
- virtual QString genNic( long NicNr ) = 0;
-
private :
InterfaceInfo * AssignedInterface;
diff --git a/noncore/settings/networksettings2/networksettings2/netnode.cpp b/noncore/settings/networksettings2/networksettings2/netnode.cpp
index f040c99..fcc6044 100644
--- a/noncore/settings/networksettings2/networksettings2/netnode.cpp
+++ b/noncore/settings/networksettings2/networksettings2/netnode.cpp
@@ -177,7 +177,7 @@ ANetNodeInstance * NodeCollection::getToplevel( void ) {
it.current();
++it ) {
NNI = it.current();
- if( NNI->netNode()->isToplevel() )
+ if( NNI->nodeClass()->isToplevel() )
break;
}
return NNI;
diff --git a/noncore/settings/networksettings2/networksettings2/netnode.h b/noncore/settings/networksettings2/networksettings2/netnode.h
index f4a5e30..9681c6e 100644
--- a/noncore/settings/networksettings2/networksettings2/netnode.h
+++ b/noncore/settings/networksettings2/networksettings2/netnode.h
@@ -95,20 +95,26 @@ public:
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, bool DeviceSpecific ) = 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, ANetNodeInstance * NNI ) = 0;
+ 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, ANetNodeInstance * NNI ) = 0;
+ SystemFile & SF, long DevNr ) = 0;
// does this Node provide a Connection
bool isToplevel( void )
{ return strcmp( provides(), "fullsetup") == 0 ; }
+ // generate NIC name based on instance nr
+ // only relevant if node instances are devices
+ virtual QString genNic( long )
+ { return QString(""); }
+
+ // max number of instances for this node type
+ // only relevant if node instances are devices
+ virtual long instanceCount( void )
+ { return 1; }
+
// compiled references to 'needed' NetNodes -> needs list
void setAlternatives( NetNodeList * Alt )
{ Alternatives = Alt; }
@@ -154,7 +160,7 @@ public:
// get next node
ANetNodeInstance * nextNode();
// return NetNode this is an instance of
- ANetNode * netNode( void )
+ ANetNode * nodeClass( void )
{ return NodeType; }
// intialize am instance of a net node
@@ -194,6 +200,15 @@ public:
// returns node specific data -> only useful for 'buddy'
virtual void * data( void ) = 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 a profile and for the system file S
+ // called only IF data was needed
+ virtual bool generateDataForCommonFile(
+ SystemFile & SF, long DevNr ) = 0;
+
protected :
virtual void setSpecificAttribute( QString & , QString & ) = 0;
@@ -220,13 +235,13 @@ public :
{ NNI = TheNNI; }
// downcast implemented by specify runtime classes
- AsDevice * asDevice( void )
+ virtual AsDevice * asDevice( void )
{ return 0; }
- AsConnection * asConnection( void )
+ virtual AsConnection * asConnection( void )
{ return 0; }
- AsLine * asLine( void )
+ virtual AsLine * asLine( void )
{ return 0; }
- AsFullSetup * asFullSetup( void )
+ virtual AsFullSetup * asFullSetup( void )
{ return 0; }
// does this node handles this interface e.g.eth0
@@ -388,13 +403,10 @@ public:
{ return 0; }
virtual bool generateProperFilesFor( ANetNodeInstance * )
{ return 0; }
- virtual bool hasDataFor( const QString &, bool DS )
+ virtual bool hasDataFor( const QString & )
{ return 0; }
- virtual bool generateDataForCommonFile(
- SystemFile & , long , ANetNodeInstance * )
- {return 1; }
virtual bool generateDeviceDataForCommonFile(
- SystemFile & , long , ANetNodeInstance * )
+ SystemFile & , long )
{return 1; }
private :
@@ -434,6 +446,12 @@ public:
virtual void * data( void )
{ return 0; }
+ virtual bool hasDataFor( const QString & )
+ { return 0; }
+
+ virtual bool generateDataForCommonFile( SystemFile & , long )
+ { return 1; }
+
protected :
virtual void setSpecificAttribute( QString & , QString & );
diff --git a/noncore/settings/networksettings2/networksettings2/systemfile.cpp b/noncore/settings/networksettings2/networksettings2/systemfile.cpp
index 394ff52..62bb6af 100644
--- a/noncore/settings/networksettings2/networksettings2/systemfile.cpp
+++ b/noncore/settings/networksettings2/networksettings2/systemfile.cpp
@@ -124,7 +124,7 @@ bool SystemFile::preNodeSection( ANetNodeInstance * NNI, long ) {
QString S = TX.readLine();
while( ! TX.eof() ) {
Out = S.
- arg(NNI->netNode()->nodeName());
+ arg(NNI->nodeClass()->nodeName());
(*this) << Out << endl;
S = TX.readLine();
}
@@ -132,7 +132,7 @@ bool SystemFile::preNodeSection( ANetNodeInstance * NNI, long ) {
return 0;
}
-bool SystemFile::postNodeSection( ANetNodeInstance * NNI, long DevNr ) {
+bool SystemFile::postNodeSection( ANetNodeInstance * NNI, long ) {
if( hasPostNodeSection ) {
QFile Fl( TemplDir + Name + "/postnodesection" );
if( ! Fl.open( IO_ReadOnly ) )
@@ -150,7 +150,7 @@ bool SystemFile::postNodeSection( ANetNodeInstance * NNI, long DevNr ) {
return 0;
}
-bool SystemFile::preDeviceSection( ANetNodeInstance * NNI, long ) {
+bool SystemFile::preDeviceSection( ANetNode * NN ) {
if( hasPreDeviceSection ) {
QFile Fl( TemplDir + Name + "/predevicesection" );
if( ! Fl.open( IO_ReadOnly ) )
@@ -159,8 +159,7 @@ bool SystemFile::preDeviceSection( ANetNodeInstance * NNI, long ) {
QString Out;
QString S = TX.readLine();
while( ! TX.eof() ) {
- Out = S.
- arg(NNI->netNode()->nodeName());
+ Out = S.arg(NN->nodeName());
(*this) << Out << endl;
S = TX.readLine();
}
@@ -168,7 +167,7 @@ bool SystemFile::preDeviceSection( ANetNodeInstance * NNI, long ) {
return 0;
}
-bool SystemFile::postDeviceSection( ANetNodeInstance * NNI, long DevNr ) {
+bool SystemFile::postDeviceSection( ANetNode * NN ) {
if( hasPostDeviceSection ) {
QFile Fl( TemplDir + Name + "/postdevicesection" );
if( ! Fl.open( IO_ReadOnly ) )
@@ -177,8 +176,7 @@ bool SystemFile::postDeviceSection( ANetNodeInstance * NNI, long DevNr ) {
QString Out;
QString S = TX.readLine();
while( ! TX.eof() ) {
- Out = S.
- arg(NNI->nodeName());
+ Out = S.arg(NN->nodeName());
(*this) << Out << endl;
S = TX.readLine();
}
diff --git a/noncore/settings/networksettings2/networksettings2/systemfile.h b/noncore/settings/networksettings2/networksettings2/systemfile.h
index 35e0dfc..f57dab0 100644
--- a/noncore/settings/networksettings2/networksettings2/systemfile.h
+++ b/noncore/settings/networksettings2/networksettings2/systemfile.h
@@ -24,8 +24,8 @@ public :
bool postSection( void );
bool preNodeSection( ANetNodeInstance * NNI, long DevNr );
bool postNodeSection( ANetNodeInstance * NNI, long DevNr );
- bool preDeviceSection( ANetNodeInstance * NNI, long DevNr );
- bool postDeviceSection( ANetNodeInstance * NNI, long DevNr );
+ bool preDeviceSection( ANetNode * NN );
+ bool postDeviceSection( ANetNode * NN );
private :
diff --git a/noncore/settings/networksettings2/nsdata.cpp b/noncore/settings/networksettings2/nsdata.cpp
index 6541596..eb63e02 100644
--- a/noncore/settings/networksettings2/nsdata.cpp
+++ b/noncore/settings/networksettings2/nsdata.cpp
@@ -129,7 +129,7 @@ QString NetworkSettingsData::saveSettings( void ) {
printf( "Saving settings to %s\n", CfgFile.latin1() );
if( ! F.open( IO_WriteOnly | IO_Truncate ) ) {
ErrS = qApp->translate( "NetworkSettings",
- "<p>Could not save setup to %1 !</p>" ).
+ "<p>Could not save setup to \"%1\" !</p>" ).
arg(CfgFile);
// problem
return ErrS;
@@ -149,7 +149,7 @@ QString NetworkSettingsData::saveSettings( void ) {
++nit ) {
// header
NNI = nit.current();
- TS << '[' <<NNI->netNode()->nodeName() << ']' << endl;
+ TS << '[' <<NNI->nodeClass()->nodeName() << ']' << endl;
NNI->saveAttributes( TS );
TS << endl;
}
@@ -181,7 +181,7 @@ QString NetworkSettingsData::generateSettings( bool ForceReq ) {
return S;
// regenerate system files
- printf( "Generating settings from %s\n", CfgFile.latin1() );
+ fprintf( stderr, "Generating settings from %s\n", CfgFile.latin1() );
{ Name2SystemFile_t & SFM = NSResources->systemFiles();
Name2Connection_t & M = NSResources->connections();
@@ -189,6 +189,7 @@ QString NetworkSettingsData::generateSettings( bool ForceReq ) {
ANetNodeInstance * NNI;
SystemFile * SF;
AsDevice * CurDev;
+ ANetNode * CurDevNN;
bool needToRegenerate = ForceIt;
//
@@ -215,8 +216,8 @@ QString NetworkSettingsData::generateSettings( bool ForceReq ) {
cncit.current();
++cncit ) {
NNI = cncit.current();
- if( ( NNI->netNode()->hasDataFor( SF->name(), 1 ) ||
- NNI->netNode()->hasDataFor( SF->name(), 0 )
+ if( ( NNI->nodeClass()->hasDataFor( SF->name() ) ||
+ NNI->hasDataFor( SF->name() )
) &&
NNI->isModified() ) {
needToRegenerate = 1;
@@ -253,11 +254,11 @@ QString NetworkSettingsData::generateSettings( bool ForceReq ) {
NNI = NNIIt.current();
if( ForceIt || NNI->isModified() ) {
- if( ! NNI->netNode()->generateProperFilesFor( NNI ) ) {
+ if( ! NNI->nodeClass()->generateProperFilesFor( NNI ) ) {
// problem generating
S = qApp->translate( "NetworkSettings",
- "<p>Cannot generate files proper to %1</p>" ).
- arg(NNI->netNode()->nodeName()) ;
+ "<p>Cannot generate files proper to \"%1\"</p>" ).
+ arg(NNI->nodeClass()->nodeName()) ;
return S;
}
}
@@ -272,7 +273,7 @@ QString NetworkSettingsData::generateSettings( bool ForceReq ) {
++sfit ) {
SF = sfit.current();
- printf( "Generating %s\n", SF->name().latin1() );
+ fprintf( stderr, "Generating %s\n", SF->name().latin1() );
SF->open();
do { // so we can break;
@@ -280,7 +281,7 @@ QString NetworkSettingsData::generateSettings( bool ForceReq ) {
// global presection for this system file
if( SF->preSection() ) {
S = qApp->translate( "NetworkSettings",
- "<p>Error in preSection for file %1</p>" ).
+ "<p>Error in preSection for file \"%1\"</p>" ).
arg( SF->name() );
return S;
}
@@ -291,200 +292,43 @@ QString NetworkSettingsData::generateSettings( bool ForceReq ) {
NSResources->netNodes() );
nnit.current();
++nnit ) {
- ANetNode * NN;
-
- NN = nnit.current()->NetNode;
-
- // are there instances ?
- NNI = 0;
- for( QDictIterator<ANetNodeInstance> nniit(
- NSResources->netNodeInstances() );
- nniit.current();
- ++nniit ) {
- if( nniit.current()->netNode() == NN ) {
- NNI = nniit.current();
- break;
- }
+
+ CurDevNN = nnit.current()->NetNode;
+
+ // are there instances for this netnode ?
+ NNI = 0;
+ for( QDictIterator<ANetNodeInstance> nniit(
+ NSResources->netNodeInstances() );
+ nniit.current();
+ ++nniit ) {
+ if( nniit.current()->nodeClass() == CurDevNN ) {
+ NNI = nniit.current();
+ break;
}
+ }
- if( ! NNI )
- // no instances
- continue;
+ if( ! NNI )
+ // no instances -> next netnode type
+ continue;
// 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 < CurDev->count(); i ++ ) {
- if( SF->preDeviceSection( NNI, i ) ) {
- S = qApp->translate( "NetworkSettings",
- "<p>Error in preDeviceSection for file %1 and node %2</p>" ).
- arg( SF->name() ).
- arg( NN->nodeName() );
- return S;
- }
-
- if( ! NN->hasDataFor( SF->name(), 1 ) ) {
- if( NN->generateDeviceDataForCommonFile( *SF, i, NNI ) ) {
- S = qApp->translate( "NetworkSettings",
- "<p>Error in node part for file %1 and node %2</p>" ).
- arg( SF->name() ).
- arg( NN->nodeName() );
- return S;
- }
- }
- }
- } else {
- // just request this once
- if( SF->preDeviceSection( NNI, -1 ) ) {
- S = qApp->translate( "NetworkSettings",
- "<p>Error in preDeviceSection for file %1 and node %2</p>" ).
- arg( SF->name() ).
- arg( NN->nodeName() );
- return S;
- }
-
- if( ! NN->hasDataFor( SF->name(), 1 ) ) {
- if( NN->generateDeviceDataForCommonFile( *SF, -1, NNI ) ) {
- S = qApp->translate( "NetworkSettings",
- "<p>Error in node part for file %1 and node %2</p>" ).
- arg( SF->name() ).
- arg( NN->nodeName() );
- 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 ) {
- NC = ncit.current();
-
- NNI = NC->getToplevel();
-
- // no output needed
- if( ! NNI->netNode()->hasDataFor( SF->name(), 0 ) )
- continue;
-
- // get the netnode that serves as the device for this
- // connection
- AsDevice * Dev = NC->device();
-
- if( CurDev ) {
- if( CurDev != Dev ) {
- // other device -> later
- continue;
- }
-
- // generate 'entry' for every combination of device and profile
- // each node delegates to deeper level
- for( int i = 0; i < CurDev->count(); i ++ ) {
- if( SF->preNodeSection( NNI, i ) ) {
- S = qApp->translate( "NetworkSettings",
- "<p>Error in preNodeSection for file %1 and node %2</p>" ).
- arg( SF->name() ).
- arg( NNI->netNode()->nodeName() );
- return S;
- }
-
- // ask all nodes in connection
-
- for( QListIterator<ANetNodeInstance> cncit(*NC);
- cncit.current();
- ++cncit ) {
- NNI = cncit.current();
-
- if( NNI->netNode()->hasDataFor( SF->name(), 0 ) ) {
- if( NNI->netNode()->generateDataForCommonFile(*SF,i,NNI) ) {
- S = qApp->translate( "NetworkSettings",
- "<p>Error in node part for file %1 and node %2</p>" ).
- arg( SF->name() ).
- arg( NNI->netNode()->nodeName() );
- return S;
- }
- }
- }
-
- if( SF->postNodeSection( NNI, i ) ) {
- S = qApp->translate( "NetworkSettings",
- "<p>Error in postNodeSection for file %1 and node %2</p>" ).
- arg( SF->name() ).
- arg( NNI->netNode()->nodeName() );
- return S;
- }
- }
-
- } else {
- if( Dev ) {
- // other
- continue;
- }
-
- // one entry to generate
- if( SF->preNodeSection( NNI, -1 ) ) {
- S = qApp->translate( "NetworkSettings",
- "<p>Error in preNodeSection for file %1 and node %2</p>" ).
- arg( SF->name() ).
- arg( NNI->netNode()->nodeName() );
- return S;
- }
-
- if( NNI->netNode()->generateDataForCommonFile(*SF,-1,NNI) ) {
- S = qApp->translate( "NetworkSettings",
- "<p>Error in node part for file %1 and node %2</p>" ).
- arg( SF->name() ).
- arg( NNI->netNode()->nodeName() );
- return S;
- }
-
- if( SF->postNodeSection( NNI, -1 ) ) {
- S = qApp->translate( "NetworkSettings",
- "<p>Error in postNodeSection for file %1 and node %2</p>" ).
- arg( SF->name() ).
- arg( NNI->netNode()->nodeName() );
- return S;
- }
- }
-
- // generated some data
- if( SF->postNodeSection( NNI, -1 ) ) {
- S = qApp->translate( "NetworkSettings",
- "<p>Error in postNodeSection for file %1 and node %2</p>" ).
- arg( SF->name() ).
- arg( NNI->netNode()->nodeName() );
- return S;
- }
- *SF << endl;
- }
-
- if( CurDev ) {
- // generate 'entry' for every combination of device and profile
- // each node delegates to deeper level
- for( int i = 0; i < CurDev->count(); i ++ ) {
- if( SF->postDeviceSection( NNI, i ) ) {
- S = qApp->translate( "NetworkSettings",
- "<p>Error in postDeviceSection for file %1 and node %2</p>" ).
- arg( SF->name() ).
- arg( NNI->netNode()->nodeName() );
+ for( int i = 0; i < CurDevNN->instanceCount(); i ++ ) {
+ S = generateSystemFileNode( *SF, CurDev, NNI, i );
+ if( ! S.isEmpty() )
return S;
- }
}
} else {
- if( SF->postDeviceSection( NNI, -1 ) ) {
- S = qApp->translate( "NetworkSettings",
- "<p>Error in postDeviceSection for file %1 and node %2</p>" ).
- arg( SF->name() ).
- arg( NNI->netNode()->nodeName() );
+ S = generateSystemFileNode( *SF, 0, NNI, -1 );
+ if( ! S.isEmpty() )
return S;
- }
}
}
if( SF->postSection() ) {
S = qApp->translate( "NetworkSettings",
- "<p>Error in postSection for file %1</p>" ).
+ "<p>Error in postSection for file \"%1\"</p>" ).
arg( SF->name() );
return S;
}
@@ -589,3 +433,108 @@ bool NetworkSettingsData::regenerate( void ) {
return 0;
}
+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 preDeviceSection for file \"%1\" and nodetype \"%2\"</p>" ).
+ arg( SF.name() ).
+ arg( CurDevNN->nodeName() );
+ return S;
+ }
+
+ if( CurDevNN->hasDataFor( SF.name() ) ) {
+ if( CurDevNN->generateDeviceDataForCommonFile( SF, DevInstNr ) ) {
+ S = qApp->translate( "NetworkSettings",
+ "<p>Error in node Device part for file \"%1\" and node \"%2\"</p>" ).
+ arg( SF.name() ).
+ arg( CurDevNN->nodeName() );
+ return S;
+ }
+ }
+
+ if( CurDev )
+ fprintf( stderr, "Cur %s\n", CurDevNN->nodeName().latin1() );
+ else
+ fprintf( stderr, "Cur NO\n" );
+
+ // 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();
+
+ fprintf( stderr, "%s\n", Dev->netNode()->nodeName().latin1() );
+ if( CurDev ) {
+ if( CurDevNN != Dev->netNode()->nodeClass() ) {
+ // other device type -> later
+ fprintf( stderr, "Other Dev type\n" );
+ continue;
+ }
+ } else {
+ if( Dev ) {
+ // other
+ continue;
+ }
+ }
+
+ // generate 'entry'
+ if( SF.preNodeSection( DevNNI, DevInstNr ) ) {
+ S = qApp->translate( "NetworkSettings",
+ "<p>Error in preNodeSection for file \"%1\" and node \"%2\"</p>" ).
+ arg( SF.name() ).
+ arg( CurDevNN->nodeName() );
+ 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()->nodeName() );
+ return S;
+ }
+ }
+ }
+
+ if( SF.postNodeSection( DevNNI, DevInstNr ) ) {
+ S = qApp->translate( "NetworkSettings",
+ "<p>Error in postNodeSection for file \"%1\" and node \"%2\"</p>" ).
+ arg( SF.name() ).
+ arg( CurDevNN->nodeName() );
+ return S;
+ }
+ SF << endl;
+ }
+
+ if( SF.postDeviceSection( CurDevNN ) ) {
+ S = qApp->translate( "NetworkSettings",
+ "<p>Error in postDeviceSection for file \"%1\" and node \"%2\"</p>" ).
+ arg( SF.name() ).
+ arg( CurDevNN->nodeName() );
+ return S;
+ }
+
+ return S;
+}
diff --git a/noncore/settings/networksettings2/nsdata.h b/noncore/settings/networksettings2/nsdata.h
index 55f8c71..b54df24 100644
--- a/noncore/settings/networksettings2/nsdata.h
+++ b/noncore/settings/networksettings2/nsdata.h
@@ -29,6 +29,11 @@ public :
private :
+ QString NetworkSettingsData::generateSystemFileNode(
+ SystemFile & SF,
+ AsDevice * CurDev,
+ ANetNodeInstance * DevNNI,
+ long DevInstNr );
bool IsModified;
bool Force;
diff --git a/noncore/settings/networksettings2/ppp/ppp_NN.cpp b/noncore/settings/networksettings2/ppp/ppp_NN.cpp
index 51d17ec..b3f70c5 100644
--- a/noncore/settings/networksettings2/ppp/ppp_NN.cpp
+++ b/noncore/settings/networksettings2/ppp/ppp_NN.cpp
@@ -44,22 +44,15 @@ bool PPPNetNode::generateProperFilesFor(
return 1;
}
-bool PPPNetNode::hasDataFor( const QString &, bool ) {
- return 0;
-}
-
-bool PPPNetNode::generateDataForCommonFile(
+bool PPPNetNode::generateDeviceDataForCommonFile(
SystemFile & ,
- long,
- ANetNodeInstance * ) {
+ long ) {
return 1;
}
-bool PPPNetNode::generateDeviceDataForCommonFile(
- SystemFile & ,
- long ,
- ANetNodeInstance * ) {
- return 1;
+QString PPPNetNode::genNic( long NicNr ) {
+ QString S;
+ return S.sprintf( "ppp%ld", NicNr );
}
extern "C" {
diff --git a/noncore/settings/networksettings2/ppp/ppp_NN.h b/noncore/settings/networksettings2/ppp/ppp_NN.h
index 8d56e7f..c33f281 100644
--- a/noncore/settings/networksettings2/ppp/ppp_NN.h
+++ b/noncore/settings/networksettings2/ppp/ppp_NN.h
@@ -28,11 +28,12 @@ public:
virtual const char * provides( void );
virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
- virtual bool hasDataFor( const QString & S, bool DS );
- virtual bool generateDataForCommonFile(
- SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
+ virtual bool hasDataFor( const QString & )
+ { return 0; }
virtual bool generateDeviceDataForCommonFile(
- SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
+ SystemFile & SF, long DevNr );
+
+ virtual QString genNic( long NicNr );
private:
diff --git a/noncore/settings/networksettings2/ppp/ppp_NNI.cpp b/noncore/settings/networksettings2/ppp/ppp_NNI.cpp
index d09ecf9..d0fd31c 100644
--- a/noncore/settings/networksettings2/ppp/ppp_NNI.cpp
+++ b/noncore/settings/networksettings2/ppp/ppp_NNI.cpp
@@ -113,3 +113,9 @@ void APPP::commit( void ) {
}
}
+bool APPP::generateDataForCommonFile(
+ SystemFile & ,
+ long) {
+ return 1;
+}
+
diff --git a/noncore/settings/networksettings2/ppp/ppp_NNI.h b/noncore/settings/networksettings2/ppp/ppp_NNI.h
index a17721a..989c2f0 100644
--- a/noncore/settings/networksettings2/ppp/ppp_NNI.h
+++ b/noncore/settings/networksettings2/ppp/ppp_NNI.h
@@ -27,6 +27,11 @@ public :
virtual void * data( void )
{ return (void *)&Data; }
+ virtual bool hasDataFor( const QString & )
+ { return 0; }
+
+ virtual bool generateDataForCommonFile(
+ SystemFile & SF, long DevNr );
protected :
virtual void setSpecificAttribute( QString & Attr, QString & Value );
diff --git a/noncore/settings/networksettings2/ppp/ppprun.h b/noncore/settings/networksettings2/ppp/ppprun.h
index 765aff2..af51fbe 100644
--- a/noncore/settings/networksettings2/ppp/ppprun.h
+++ b/noncore/settings/networksettings2/ppp/ppprun.h
@@ -12,8 +12,6 @@ public :
PPPRun( ANetNodeInstance * NNI,
PPPData & Data );
- virtual QString genNic( long NicNr )
- { QString S; return S.sprintf( "ppp%ld", NicNr ); }
virtual AsDevice * asDevice( void )
{ return (AsDevice *)this; }
diff --git a/noncore/settings/networksettings2/profile/profile_NN.cpp b/noncore/settings/networksettings2/profile/profile_NN.cpp
index fcf1ca6..7609cdc 100644
--- a/noncore/settings/networksettings2/profile/profile_NN.cpp
+++ b/noncore/settings/networksettings2/profile/profile_NN.cpp
@@ -43,21 +43,9 @@ bool ProfileNetNode::generateProperFilesFor(
return 1;
}
-bool ProfileNetNode::hasDataFor( const QString &, bool ) {
- return 0;
-}
-
-bool ProfileNetNode::generateDataForCommonFile(
- SystemFile & ,
- long,
- ANetNodeInstance * ) {
- return 1;
-}
-
bool ProfileNetNode::generateDeviceDataForCommonFile(
SystemFile & ,
- long ,
- ANetNodeInstance * ) {
+ long ) {
return 1;
}
diff --git a/noncore/settings/networksettings2/profile/profile_NN.h b/noncore/settings/networksettings2/profile/profile_NN.h
index b64a6dd..f7c2b22 100644
--- a/noncore/settings/networksettings2/profile/profile_NN.h
+++ b/noncore/settings/networksettings2/profile/profile_NN.h
@@ -28,11 +28,10 @@ public:
virtual const char * provides( void );
virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
- virtual bool hasDataFor( const QString & S, bool DS );
- virtual bool generateDataForCommonFile(
- SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
+ virtual bool hasDataFor( const QString & )
+ { return 0; }
virtual bool generateDeviceDataForCommonFile(
- SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
+ SystemFile & SF, long DevNr);
private:
diff --git a/noncore/settings/networksettings2/profile/profile_NNI.cpp b/noncore/settings/networksettings2/profile/profile_NNI.cpp
index bc0118e..5b54aa4 100644
--- a/noncore/settings/networksettings2/profile/profile_NNI.cpp
+++ b/noncore/settings/networksettings2/profile/profile_NNI.cpp
@@ -46,3 +46,9 @@ void AProfile::commit( void ) {
setModified( 1 );
}
+bool AProfile::generateDataForCommonFile(
+ SystemFile & ,
+ long) {
+ return 1;
+}
+
diff --git a/noncore/settings/networksettings2/profile/profile_NNI.h b/noncore/settings/networksettings2/profile/profile_NNI.h
index dfeb178..2c2db7f 100644
--- a/noncore/settings/networksettings2/profile/profile_NNI.h
+++ b/noncore/settings/networksettings2/profile/profile_NNI.h
@@ -29,6 +29,12 @@ public :
virtual void * data( void )
{ return (void *)&Data; }
+ virtual bool hasDataFor( const QString & )
+ { return 0; }
+
+ virtual bool generateDataForCommonFile(
+ SystemFile & SF, long DevNr);
+
protected :
virtual void setSpecificAttribute( QString & Attr, QString & Value );
diff --git a/noncore/settings/networksettings2/usb/usb_NN.cpp b/noncore/settings/networksettings2/usb/usb_NN.cpp
index be4a2bc..30c72db 100644
--- a/noncore/settings/networksettings2/usb/usb_NN.cpp
+++ b/noncore/settings/networksettings2/usb/usb_NN.cpp
@@ -42,22 +42,26 @@ bool USBNetNode::generateProperFilesFor(
return 1;
}
-bool USBNetNode::hasDataFor( const QString & S, bool ) {
+bool USBNetNode::hasDataFor( const QString & S ) {
return (S== "interfaces");
}
-bool USBNetNode::generateDataForCommonFile(
+bool USBNetNode::generateDeviceDataForCommonFile(
SystemFile & S ,
- long DevNr,
- ANetNodeInstance * NNI) {
- return ((AUSB *)NNI)->generateDataForCommonFile(S, DevNr);
+ 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;
}
-bool USBNetNode::generateDeviceDataForCommonFile(
- SystemFile & S ,
- long DevNr,
- ANetNodeInstance * NNI) {
- return ((AUSB *)NNI)->generateDeviceDataForCommonFile(S, DevNr);
+QString USBNetNode::genNic( long ) {
+ return QString( "usbf" );
}
extern "C" {
diff --git a/noncore/settings/networksettings2/usb/usb_NN.h b/noncore/settings/networksettings2/usb/usb_NN.h
index 8ff5289..ba22b1c 100644
--- a/noncore/settings/networksettings2/usb/usb_NN.h
+++ b/noncore/settings/networksettings2/usb/usb_NN.h
@@ -28,11 +28,11 @@ public:
virtual const char * provides( void );
virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
- virtual bool hasDataFor( const QString & S, bool DeviceSpec );
- virtual bool generateDataForCommonFile(
- SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
+ virtual bool hasDataFor( const QString & S);
virtual bool generateDeviceDataForCommonFile(
- SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
+ SystemFile & SF, long DevNr );
+
+ virtual QString genNic( long nr );
private:
diff --git a/noncore/settings/networksettings2/usb/usb_NNI.cpp b/noncore/settings/networksettings2/usb/usb_NNI.cpp
index 6fcd6d5..e90204c 100644
--- a/noncore/settings/networksettings2/usb/usb_NNI.cpp
+++ b/noncore/settings/networksettings2/usb/usb_NNI.cpp
@@ -32,26 +32,21 @@ void AUSB::commit( void ) {
}
}
-bool AUSB::generateDataForCommonFile( SystemFile & S, long DevNr ) {
- AsDevice * Dev = runtime()->device();
- QString NIC = Dev->genNic( DevNr );
-
- if( S.name() == "interfaces" ) {
- // generate mapping stanza for this interface
- S << " pre-up " << QPEApplication::qpeDir() << "bin/setmacaddress.sh " << NIC << " || true" << endl;
- }
- return 0;
+bool AUSB::hasDataFor( const QString & S ) {
+ return (S== "interfaces");
}
-bool AUSB::generateDeviceDataForCommonFile( SystemFile & S, long DevNr ) {
- AsDevice * Dev = runtime()->device();
- QString NIC = Dev->genNic( DevNr );
+bool AUSB::generateDataForCommonFile( SystemFile & S, long DevNr ) {
+ QString NIC = runtime()->device()->netNode()->nodeClass()->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;
+ S << " pre-up "
+ << QPEApplication::qpeDir()
+ << "bin/setmacaddress.sh "
+ << NIC
+ << " || true"
+ << endl;
}
return 0;
}
diff --git a/noncore/settings/networksettings2/usb/usb_NNI.h b/noncore/settings/networksettings2/usb/usb_NNI.h
index 5dead36..d2ee217 100644
--- a/noncore/settings/networksettings2/usb/usb_NNI.h
+++ b/noncore/settings/networksettings2/usb/usb_NNI.h
@@ -27,8 +27,9 @@ public :
virtual void * data( void )
{ return (void *)&Data; }
- bool generateDataForCommonFile( SystemFile & S, long DevNr );
- bool generateDeviceDataForCommonFile( SystemFile & S, long DevNr );
+ virtual bool hasDataFor( const QString & S);
+ virtual bool generateDataForCommonFile(
+ SystemFile & SF, long DevNr );
protected :
diff --git a/noncore/settings/networksettings2/usb/usbrun.cpp b/noncore/settings/networksettings2/usb/usbrun.cpp
index 3007e79..4ce6721 100644
--- a/noncore/settings/networksettings2/usb/usbrun.cpp
+++ b/noncore/settings/networksettings2/usb/usbrun.cpp
@@ -174,9 +174,3 @@ bool USBRun::handlesInterface( const QString & S ) {
return Pat.match( S ) >= 0;
}
-QString USBRun::genNic( long nr ) {
- QString S;
- S.sprintf( "usbf" );
- return S;
-}
-
diff --git a/noncore/settings/networksettings2/usb/usbrun.h b/noncore/settings/networksettings2/usb/usbrun.h
index 60f9fe8..6c6e4e4 100644
--- a/noncore/settings/networksettings2/usb/usbrun.h
+++ b/noncore/settings/networksettings2/usb/usbrun.h
@@ -15,10 +15,6 @@ public :
Pat( "usb[0-9abcdef]" )
{ }
- virtual long count( void )
- { return 1; }
- virtual QString genNic( long nr );
-
virtual AsDevice * device( void )
{ return (AsDevice *)this; }
diff --git a/noncore/settings/networksettings2/vpn/vpn_NN.cpp b/noncore/settings/networksettings2/vpn/vpn_NN.cpp
index f570fb2..d9aa892 100644
--- a/noncore/settings/networksettings2/vpn/vpn_NN.cpp
+++ b/noncore/settings/networksettings2/vpn/vpn_NN.cpp
@@ -43,21 +43,9 @@ bool VPNNetNode::generateProperFilesFor(
return 1;
}
-bool VPNNetNode::hasDataFor( const QString &, bool ) {
- return 0;
-}
-
-bool VPNNetNode::generateDataForCommonFile(
- SystemFile & ,
- long,
- ANetNodeInstance * ) {
- return 1;
-}
-
bool VPNNetNode::generateDeviceDataForCommonFile(
SystemFile & ,
- long ,
- ANetNodeInstance * ) {
+ long ) {
return 1;
}
diff --git a/noncore/settings/networksettings2/vpn/vpn_NN.h b/noncore/settings/networksettings2/vpn/vpn_NN.h
index cdb5117..7ce8e3a 100644
--- a/noncore/settings/networksettings2/vpn/vpn_NN.h
+++ b/noncore/settings/networksettings2/vpn/vpn_NN.h
@@ -28,11 +28,10 @@ public:
virtual const char * provides( void );
virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
- virtual bool hasDataFor( const QString & S, bool DS );
- virtual bool generateDataForCommonFile(
- SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
+ virtual bool hasDataFor( const QString & )
+ { return 0; }
virtual bool generateDeviceDataForCommonFile(
- SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
+ SystemFile & SF, long DevNr );
private:
diff --git a/noncore/settings/networksettings2/vpn/vpn_NNI.cpp b/noncore/settings/networksettings2/vpn/vpn_NNI.cpp
index 6c20aeb..ee999e8 100644
--- a/noncore/settings/networksettings2/vpn/vpn_NNI.cpp
+++ b/noncore/settings/networksettings2/vpn/vpn_NNI.cpp
@@ -28,3 +28,9 @@ void AVPN::commit( void ) {
setModified( 1 );
}
+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 31ce0d6..c3eb016 100644
--- a/noncore/settings/networksettings2/vpn/vpn_NNI.h
+++ b/noncore/settings/networksettings2/vpn/vpn_NNI.h
@@ -27,6 +27,10 @@ public :
virtual void * data( void )
{ return (void *)&Data; }
+ virtual bool hasDataFor( const QString & )
+ { return 0; }
+ virtual bool generateDataForCommonFile(
+ SystemFile & SF, long DevNr );
protected :
virtual void setSpecificAttribute( QString & Attr, QString & Value );
diff --git a/noncore/settings/networksettings2/wlan/wlan_NN.cpp b/noncore/settings/networksettings2/wlan/wlan_NN.cpp
index e1e20c0..4e59ac1 100644
--- a/noncore/settings/networksettings2/wlan/wlan_NN.cpp
+++ b/noncore/settings/networksettings2/wlan/wlan_NN.cpp
@@ -42,22 +42,27 @@ bool WLanNetNode::generateProperFilesFor(
return 1;
}
-bool WLanNetNode::hasDataFor( const QString & S, bool DS ) {
- return DS && S == "interfaces";
-}
-
-bool WLanNetNode::generateDataForCommonFile(
- SystemFile &,
- long ,
- ANetNodeInstance * ) {
- return 1;
+bool WLanNetNode::hasDataFor( const QString & S ) {
+ return S == "interfaces";
}
bool WLanNetNode::generateDeviceDataForCommonFile(
SystemFile & S,
- long DevNr,
- ANetNodeInstance * NNI ) {
- return ((AWLan *)NNI)->generateDeviceDataForCommonFile(S, DevNr);
+ 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 ) {
+ QString S;
+ return S.sprintf( "wlan%ld", nr );
}
extern "C" {
diff --git a/noncore/settings/networksettings2/wlan/wlan_NN.h b/noncore/settings/networksettings2/wlan/wlan_NN.h
index 9111995..f27e71c 100644
--- a/noncore/settings/networksettings2/wlan/wlan_NN.h
+++ b/noncore/settings/networksettings2/wlan/wlan_NN.h
@@ -28,11 +28,15 @@ public:
virtual const char * provides( void );
virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
- virtual bool hasDataFor( const QString & S, bool DS );
- virtual bool generateDataForCommonFile(
- SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
+
+ virtual bool hasDataFor( const QString & S );
virtual bool generateDeviceDataForCommonFile(
- SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
+ SystemFile & SF, long DevNr );
+
+ virtual long instanceCount( void )
+ { return 2; }
+
+ virtual QString genNic( long );
private:
diff --git a/noncore/settings/networksettings2/wlan/wlan_NNI.cpp b/noncore/settings/networksettings2/wlan/wlan_NNI.cpp
index 8b948e0..78e756c 100644
--- a/noncore/settings/networksettings2/wlan/wlan_NNI.cpp
+++ b/noncore/settings/networksettings2/wlan/wlan_NNI.cpp
@@ -28,15 +28,9 @@ void AWLan::commit( void ) {
setModified( 1 );
}
-bool AWLan::generateDeviceDataForCommonFile( SystemFile & S, long DevNr ) {
- AsDevice * Dev = runtime()->device();
- QString NIC = Dev->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;
+bool AWLan::generateDataForCommonFile(
+ SystemFile &,
+ long ) {
+ return 1;
}
+
diff --git a/noncore/settings/networksettings2/wlan/wlan_NNI.h b/noncore/settings/networksettings2/wlan/wlan_NNI.h
index e464c84..d861d13 100644
--- a/noncore/settings/networksettings2/wlan/wlan_NNI.h
+++ b/noncore/settings/networksettings2/wlan/wlan_NNI.h
@@ -27,8 +27,10 @@ public :
virtual void * data( void )
{ return (void *)&Data; }
- bool generateDeviceDataForCommonFile( SystemFile & S, long DevNr );
-
+ virtual bool hasDataFor( const QString & )
+ { return 0; }
+ virtual bool generateDataForCommonFile(
+ SystemFile & SF, long DevNr );
protected :
virtual void setSpecificAttribute( QString & Attr, QString & Value );
diff --git a/noncore/settings/networksettings2/wlan/wlanrun.h b/noncore/settings/networksettings2/wlan/wlanrun.h
index b853262..f46bcb7 100644
--- a/noncore/settings/networksettings2/wlan/wlanrun.h
+++ b/noncore/settings/networksettings2/wlan/wlanrun.h
@@ -14,10 +14,6 @@ public :
Pat( "wlan[0-9]" )
{ }
- virtual long count( void )
- { return 2; }
- virtual QString genNic( long nr )
- { QString S; return S.sprintf( "wlan%ld", nr ); }
virtual AsDevice * device( void )
{ return (AsDevice *)this; }
virtual AsDevice * asDevice( void )