summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/usb
Side-by-side diff
Diffstat (limited to 'noncore/settings/networksettings2/usb') (more/less context) (ignore whitespace changes)
-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
6 files changed, 31 insertions, 41 deletions
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
@@ -39,28 +39,32 @@ const char * USBNetNode::provides( void ) {
bool USBNetNode::generateProperFilesFor(
ANetNodeInstance * ) {
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" {
void create_plugin( QList<ANetNode> & PNN ) {
PNN.append( new USBNetNode() );
}
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
@@ -25,17 +25,17 @@ public:
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, 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:
};
extern "C"
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
@@ -29,29 +29,24 @@ QString AUSB::acceptable( void ) {
void AUSB::commit( void ) {
if( GUI && GUI->commit( Data ) ) {
setModified( 1 );
}
}
-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
@@ -24,14 +24,15 @@ public :
return RT;
}
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 :
virtual void setSpecificAttribute( QString & Attr, QString & Value );
virtual void saveSpecificAttribute( QTextStream & TS );
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
@@ -171,12 +171,6 @@ InterfaceInfo * USBRun::getInterface( void ) {
}
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
@@ -12,16 +12,12 @@ public :
USBRun( ANetNodeInstance * NNI,
USBData & Data ) :
AsDevice( NNI ),
Pat( "usb[0-9abcdef]" )
{ }
- virtual long count( void )
- { return 1; }
- virtual QString genNic( long nr );
-
virtual AsDevice * device( void )
{ return (AsDevice *)this; }
virtual AsDevice * asDevice( void )
{ return (AsDevice *)this; }
protected :