summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp22
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetooth_NN.h10
-rw-r--r--noncore/settings/networksettings2/cable/cable_NN.cpp6
-rw-r--r--noncore/settings/networksettings2/cable/cable_NN.h2
-rw-r--r--noncore/settings/networksettings2/irda/irda_NN.cpp6
-rw-r--r--noncore/settings/networksettings2/irda/irda_NN.h2
-rw-r--r--noncore/settings/networksettings2/lancard/lancard_NN.cpp13
-rw-r--r--noncore/settings/networksettings2/lancard/lancard_NN.h8
-rw-r--r--noncore/settings/networksettings2/modem/modem_NN.cpp6
-rw-r--r--noncore/settings/networksettings2/modem/modem_NN.h2
-rw-r--r--noncore/settings/networksettings2/network/network_NN.cpp6
-rw-r--r--noncore/settings/networksettings2/network/network_NN.h2
-rw-r--r--noncore/settings/networksettings2/networksettings2/netnode.cpp47
-rw-r--r--noncore/settings/networksettings2/networksettings2/netnode.h92
-rw-r--r--noncore/settings/networksettings2/networksettings2/resources.h12
-rw-r--r--noncore/settings/networksettings2/nsdata.cpp67
-rw-r--r--noncore/settings/networksettings2/nsdata.h3
-rw-r--r--noncore/settings/networksettings2/ppp/ppp_NN.cpp6
-rw-r--r--noncore/settings/networksettings2/ppp/ppp_NN.h2
-rw-r--r--noncore/settings/networksettings2/profile/profile_NN.cpp6
-rw-r--r--noncore/settings/networksettings2/profile/profile_NN.h2
-rw-r--r--noncore/settings/networksettings2/usb/usb_NN.cpp6
-rw-r--r--noncore/settings/networksettings2/usb/usb_NN.h2
-rw-r--r--noncore/settings/networksettings2/vpn/vpn_NN.cpp6
-rw-r--r--noncore/settings/networksettings2/vpn/vpn_NN.h2
-rw-r--r--noncore/settings/networksettings2/wlan/wlan_NN.cpp13
-rw-r--r--noncore/settings/networksettings2/wlan/wlan_NN.h8
27 files changed, 224 insertions, 135 deletions
diff --git a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp
index 3d1aa69..4579e37 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp
+++ b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp
@@ -1,123 +1,143 @@
#include "bluetooth_NN.h"
#include "bluetoothBNEP_NNI.h"
#include "bluetoothRFCOMM_NNI.h"
//
//
// BLUETOOTH PAN/NAP node
//
//
static const char * BluetoothBNEPNeeds[] =
{ 0
};
/**
* Constructor, find all of the possible interfaces
*/
BluetoothBNEPNetNode::BluetoothBNEPNetNode() : ANetNode() {
+ InstanceCount = 7; // default
}
/**
* Delete any interfaces that we own.
*/
BluetoothBNEPNetNode::~BluetoothBNEPNetNode(){
}
const QString BluetoothBNEPNetNode::nodeDescription(){
return tr("\
<p>Sets up a bluetooth link using the bluetooth Network profile.</p>\
<p>Use this to connect two computing devices.</p>\
"
);
}
ANetNodeInstance * BluetoothBNEPNetNode::createInstance( void ) {
return new ABluetoothBNEP( this );
}
const char ** BluetoothBNEPNetNode::needs( void ) {
return BluetoothBNEPNeeds;
}
const char * BluetoothBNEPNetNode::provides( void ) {
return "device";
}
bool BluetoothBNEPNetNode::generateProperFilesFor(
ANetNodeInstance * ) {
return 1;
}
bool BluetoothBNEPNetNode::hasDataFor( const QString & S ) {
return S == "interfaces";
}
bool BluetoothBNEPNetNode::generateDeviceDataForCommonFile(
SystemFile & ,
long ) {
return 1;
}
QString BluetoothBNEPNetNode::genNic( long nr ) {
QString S;
return S.sprintf( "bnep%ld", nr );
}
+
+void BluetoothBNEPNetNode::setSpecificAttribute( QString & A, QString & V ) {
+ if( A == "interfacecount" ) {
+ InstanceCount = V.toLong();
+ }
+}
+
+void BluetoothBNEPNetNode::saveSpecificAttribute( QTextStream & TS) {
+ TS << "interfacecount="
+ << InstanceCount
+ << endl;
+}
+
//
//
-// BLUETOOTH PAN/NAP node
+// BLUETOOTH RFCOMM
//
//
static const char * BluetoothRFCOMMNeeds[] =
{ 0
};
BluetoothRFCOMMNetNode::BluetoothRFCOMMNetNode() : ANetNode() {
}
BluetoothRFCOMMNetNode::~BluetoothRFCOMMNetNode(){
}
const QString BluetoothRFCOMMNetNode::nodeDescription(){
return tr("\
<p>Sets up a bluetooth link using the bluetooth serial profile.</p>\
<p>Use this to connect to a GSM.</p>\
"
);
}
ANetNodeInstance * BluetoothRFCOMMNetNode::createInstance( void ) {
return new ABluetoothRFCOMM( this );
}
const char ** BluetoothRFCOMMNetNode::needs( void ) {
return BluetoothRFCOMMNeeds;
}
const char * BluetoothRFCOMMNetNode::provides( void ) {
return "line";
}
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 & ) {
+}
+
+void BluetoothRFCOMMNetNode::saveSpecificAttribute( QTextStream & ) {
+}
+
extern "C" {
void create_plugin( QList<ANetNode> & PNN ) {
PNN.append( new BluetoothBNEPNetNode() );
PNN.append( new BluetoothRFCOMMNetNode() );
}
}
diff --git a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h
index 5cd6c52..882d2e3 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h
+++ b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h
@@ -1,79 +1,87 @@
#ifndef BLUETOOTH_NETNODE_H
#define BLUETOOTH_NETNODE_H
#include "netnode.h"
class ABluetoothBNEP;
class BluetoothBNEPNetNode : public ANetNode {
Q_OBJECT
public:
BluetoothBNEPNetNode();
virtual ~BluetoothBNEPNetNode();
virtual const QString pixmapName()
{ return "Devices/bluetooth"; }
virtual const QString nodeName()
{ return tr("Bluetooth PAN/NAP"); }
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 7; }
+ { return InstanceCount; }
virtual QString genNic( long );
private:
+ virtual void setSpecificAttribute( QString & Attr, QString & Value );
+ virtual void saveSpecificAttribute( QTextStream & TS );
+
+ // number of interfaces for this device
+ long InstanceCount;
+
};
class BluetoothRFCOMMNetNode : public ANetNode {
Q_OBJECT
public:
BluetoothRFCOMMNetNode();
virtual ~BluetoothRFCOMMNetNode();
virtual const QString pixmapName()
{ return "Devices/bluetooth"; }
virtual const QString nodeName()
{ return tr("Bluetooth serial link"); }
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 );
private:
+ virtual void setSpecificAttribute( QString & Attr, QString & Value );
+ virtual void saveSpecificAttribute( QTextStream & TS );
};
extern "C"
{
void create_plugin( QList<ANetNode> & PNN );
};
#endif
diff --git a/noncore/settings/networksettings2/cable/cable_NN.cpp b/noncore/settings/networksettings2/cable/cable_NN.cpp
index a6be4d5..dd41c1f 100644
--- a/noncore/settings/networksettings2/cable/cable_NN.cpp
+++ b/noncore/settings/networksettings2/cable/cable_NN.cpp
@@ -2,53 +2,59 @@
#include "cable_NNI.h"
static const char * CableNeeds[] =
{ 0
};
/**
* Constructor, find all of the possible interfaces
*/
CableNetNode::CableNetNode() : ANetNode() {
}
/**
* Delete any interfaces that we own.
*/
CableNetNode::~CableNetNode(){
}
const QString CableNetNode::nodeDescription(){
return tr("\
<p>Sets up a wired serial or parallel.</p>\
"
);
}
ANetNodeInstance * CableNetNode::createInstance( void ) {
return new ACable( this );
}
const char ** CableNetNode::needs( void ) {
return CableNeeds;
}
const char * CableNetNode::provides( void ) {
return "line";
}
bool CableNetNode::generateProperFilesFor(
ANetNodeInstance * ) {
return 1;
}
bool CableNetNode::generateDeviceDataForCommonFile(
SystemFile & ,
long ) {
return 1;
}
+void CableNetNode::setSpecificAttribute( QString & , QString & ) {
+}
+
+void CableNetNode::saveSpecificAttribute( QTextStream & ) {
+}
+
extern "C" {
void create_plugin( QList<ANetNode> & PNN ) {
PNN.append( new CableNetNode() );
}
}
diff --git a/noncore/settings/networksettings2/cable/cable_NN.h b/noncore/settings/networksettings2/cable/cable_NN.h
index 83b98e0..b37f31a 100644
--- a/noncore/settings/networksettings2/cable/cable_NN.h
+++ b/noncore/settings/networksettings2/cable/cable_NN.h
@@ -1,45 +1,47 @@
#ifndef CABLE_NETNODE_H
#define CABLE_NETNODE_H
#include "netnode.h"
class ACable;
class CableNetNode : public ANetNode {
Q_OBJECT
public:
CableNetNode();
virtual ~CableNetNode();
virtual const QString pixmapName()
{ return "Devices/cable"; }
virtual const QString nodeName()
{ return tr("Cable Connection"); }
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 & )
{ return 0; }
virtual bool generateDeviceDataForCommonFile(
SystemFile & SF, long DevNr);
private:
+ virtual void setSpecificAttribute( QString & Attr, QString & Value );
+ virtual void saveSpecificAttribute( QTextStream & TS );
};
extern "C"
{
void create_plugin( QList<ANetNode> & PNN );
};
#endif
diff --git a/noncore/settings/networksettings2/irda/irda_NN.cpp b/noncore/settings/networksettings2/irda/irda_NN.cpp
index 96327a5..49b7707 100644
--- a/noncore/settings/networksettings2/irda/irda_NN.cpp
+++ b/noncore/settings/networksettings2/irda/irda_NN.cpp
@@ -2,53 +2,59 @@
#include "irda_NNI.h"
static const char * IRDANeeds[] =
{ 0
};
/**
* Constructor, find all of the possible interfaces
*/
IRDANetNode::IRDANetNode() : ANetNode() {
}
/**
* Delete any interfaces that we own.
*/
IRDANetNode::~IRDANetNode(){
}
const QString IRDANetNode::nodeDescription(){
return tr("\
<p>Sets up a infra red serial link.</p>\
"
);
}
ANetNodeInstance * IRDANetNode::createInstance( void ) {
return new AIRDA( this );
}
const char ** IRDANetNode::needs( void ) {
return IRDANeeds;
}
const char * IRDANetNode::provides( void ) {
return "line";
}
bool IRDANetNode::generateProperFilesFor(
ANetNodeInstance * ) {
return 1;
}
bool IRDANetNode::generateDeviceDataForCommonFile(
SystemFile & ,
long ) {
return 1;
}
+void IRDANetNode::setSpecificAttribute( QString & , QString & ) {
+}
+
+void IRDANetNode::saveSpecificAttribute( QTextStream & ) {
+}
+
extern "C" {
void create_plugin( QList<ANetNode> & PNN ) {
PNN.append( new IRDANetNode() );
}
}
diff --git a/noncore/settings/networksettings2/irda/irda_NN.h b/noncore/settings/networksettings2/irda/irda_NN.h
index a5b6cc5..2dcef74 100644
--- a/noncore/settings/networksettings2/irda/irda_NN.h
+++ b/noncore/settings/networksettings2/irda/irda_NN.h
@@ -1,45 +1,47 @@
#ifndef IRDA_NETNODE_H
#define IRDA_NETNODE_H
#include "netnode.h"
class AIRDA;
class IRDANetNode : public ANetNode {
Q_OBJECT
public:
IRDANetNode();
virtual ~IRDANetNode();
virtual const QString pixmapName()
{ return "Devices/irda"; }
virtual const QString nodeName()
{ return tr("Infrared link"); }
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 & )
{ return 0; }
virtual bool generateDeviceDataForCommonFile(
SystemFile & SF, long DevNr );
private:
+ virtual void setSpecificAttribute( QString & Attr, QString & Value );
+ virtual void saveSpecificAttribute( QTextStream & TS );
};
extern "C"
{
void create_plugin( QList<ANetNode> & PNN );
};
#endif
diff --git a/noncore/settings/networksettings2/lancard/lancard_NN.cpp b/noncore/settings/networksettings2/lancard/lancard_NN.cpp
index 480ddf9..ba1c1f8 100644
--- a/noncore/settings/networksettings2/lancard/lancard_NN.cpp
+++ b/noncore/settings/networksettings2/lancard/lancard_NN.cpp
@@ -1,72 +1,85 @@
#include "lancard_NN.h"
#include "lancard_NNI.h"
static const char * LanCardNeeds[] =
{ 0 };
/**
* Constructor, find all of the possible interfaces
*/
LanCardNetNode::LanCardNetNode() : ANetNode() {
+ InstanceCount = 2;
}
/**
* Delete any interfaces that we own.
*/
LanCardNetNode::~LanCardNetNode(){
}
const QString LanCardNetNode::nodeDescription(){
return tr("\
<p>Sets up a wired regular LAN card.</p>\
<p>Use this to set up 10/100/1000 MBit LAN cards.</p>\
"
);
}
ANetNodeInstance * LanCardNetNode::createInstance( void ) {
return new ALanCard( this );
}
const char ** LanCardNetNode::needs( void ) {
return LanCardNeeds;
}
const char * LanCardNetNode::provides( void ) {
return "device";
}
bool LanCardNetNode::generateProperFilesFor(
ANetNodeInstance * ) {
return 1;
}
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 ) {
QString S;
return S.sprintf( "eth%ld", nr );
}
+void LanCardNetNode::setSpecificAttribute( QString & A, QString & V ) {
+ if( A == "interfacecount" ) {
+ InstanceCount = V.toLong();
+ }
+}
+
+void LanCardNetNode::saveSpecificAttribute( QTextStream & TS) {
+ TS << "interfacecount="
+ << InstanceCount
+ << endl;
+}
+
extern "C" {
void create_plugin( QList<ANetNode> & PNN ) {
PNN.append( new LanCardNetNode() );
}
}
diff --git a/noncore/settings/networksettings2/lancard/lancard_NN.h b/noncore/settings/networksettings2/lancard/lancard_NN.h
index dcdd0da..5f2b25d 100644
--- a/noncore/settings/networksettings2/lancard/lancard_NN.h
+++ b/noncore/settings/networksettings2/lancard/lancard_NN.h
@@ -1,49 +1,55 @@
#ifndef LANCARD_NETNODE_H
#define LANCARD_NETNODE_H
#include "netnode.h"
class ALanCard;
class LanCardNetNode : public ANetNode{
Q_OBJECT
public:
LanCardNetNode();
virtual ~LanCardNetNode();
virtual const QString pixmapName()
{ return "Devices/card"; }
virtual const QString nodeName()
{ return tr("LAN card"); }
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 & SF, long DevNr );
virtual long instanceCount( void )
- { return 2; }
+ { return InstanceCount; }
virtual QString genNic( long );
private:
+ virtual void setSpecificAttribute( QString & Attr, QString & Value );
+ virtual void saveSpecificAttribute( QTextStream & TS );
+
+ // number of interfaces for this device
+ long InstanceCount;
+
};
extern "C"
{
void create_plugin( QList<ANetNode> & PNN );
};
#endif
diff --git a/noncore/settings/networksettings2/modem/modem_NN.cpp b/noncore/settings/networksettings2/modem/modem_NN.cpp
index 65b06ee..1cc8524 100644
--- a/noncore/settings/networksettings2/modem/modem_NN.cpp
+++ b/noncore/settings/networksettings2/modem/modem_NN.cpp
@@ -3,53 +3,59 @@
static const char * ModemNeeds[] =
{ "line"
};
/**
* Constructor, find all of the possible interfaces
*/
ModemNetNode::ModemNetNode() : ANetNode() {
}
/**
* Delete any interfaces that we own.
*/
ModemNetNode::~ModemNetNode(){
}
const QString ModemNetNode::nodeDescription(){
return tr("\
<p>Sets up a dialing procedures.</p>\
<p>Use this to dial up over modems, ISDN, GSM, ...</p>\
"
);
}
ANetNodeInstance * ModemNetNode::createInstance( void ) {
return new AModem( this );
}
const char ** ModemNetNode::needs( void ) {
return ModemNeeds;
}
const char * ModemNetNode::provides( void ) {
return "line";
}
bool ModemNetNode::generateProperFilesFor(
ANetNodeInstance * ) {
return 1;
}
bool ModemNetNode::generateDeviceDataForCommonFile(
SystemFile & ,
long ) {
return 1;
}
+void ModemNetNode::setSpecificAttribute( QString & , QString & ) {
+}
+
+void ModemNetNode::saveSpecificAttribute( QTextStream & ) {
+}
+
extern "C" {
void create_plugin( QList<ANetNode> & PNN ) {
PNN.append( new ModemNetNode() );
}
}
diff --git a/noncore/settings/networksettings2/modem/modem_NN.h b/noncore/settings/networksettings2/modem/modem_NN.h
index 49244b2..849f928 100644
--- a/noncore/settings/networksettings2/modem/modem_NN.h
+++ b/noncore/settings/networksettings2/modem/modem_NN.h
@@ -1,45 +1,47 @@
#ifndef MODEM_NETNODE_H
#define MODEM_NETNODE_H
#include "netnode.h"
class AModem;
class ModemNetNode : public ANetNode{
Q_OBJECT
public:
ModemNetNode();
virtual ~ModemNetNode();
virtual const QString pixmapName()
{ return "Devices/modem"; }
virtual const QString nodeName()
{ return tr("Dialup modem"); }
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 & )
{ return 0; }
virtual bool generateDeviceDataForCommonFile(
SystemFile & SF, long DevNr );
private:
+ virtual void setSpecificAttribute( QString & Attr, QString & Value );
+ virtual void saveSpecificAttribute( QTextStream & TS );
};
extern "C"
{
void create_plugin( QList<ANetNode> & PNN );
};
#endif
diff --git a/noncore/settings/networksettings2/network/network_NN.cpp b/noncore/settings/networksettings2/network/network_NN.cpp
index 4a77e6a..d27d54a 100644
--- a/noncore/settings/networksettings2/network/network_NN.cpp
+++ b/noncore/settings/networksettings2/network/network_NN.cpp
@@ -4,53 +4,59 @@
static const char * NetworkNeeds[] =
{ "device",
0
};
/**
* Constructor, find all of the possible interfaces
*/
NetworkNetNode::NetworkNetNode() : ANetNode() {
}
/**
* Delete any interfaces that we own.
*/
NetworkNetNode::~NetworkNetNode(){
}
const QString NetworkNetNode::nodeDescription(){
return tr("\
<p>Sets up TCP/IP options.</p>\
<p>Use this to configure the TCP/IP protocol</p>\
"
);
}
ANetNodeInstance * NetworkNetNode::createInstance( void ) {
return new ANetwork( this );
}
const char ** NetworkNetNode::needs( void ) {
return NetworkNeeds;
}
const char * NetworkNetNode::provides( void ) {
return "connection";
}
bool NetworkNetNode::generateProperFilesFor(
ANetNodeInstance * ) {
return 1;
}
bool NetworkNetNode::generateDeviceDataForCommonFile(
SystemFile & ,
long ) {
return 1;
}
+void NetworkNetNode::setSpecificAttribute( QString & , QString & ) {
+}
+
+void NetworkNetNode::saveSpecificAttribute( QTextStream & ) {
+}
+
extern "C" {
void create_plugin( QList<ANetNode> & PNN ) {
PNN.append( new NetworkNetNode() );
}
}
diff --git a/noncore/settings/networksettings2/network/network_NN.h b/noncore/settings/networksettings2/network/network_NN.h
index 59f0526..0f87e1b 100644
--- a/noncore/settings/networksettings2/network/network_NN.h
+++ b/noncore/settings/networksettings2/network/network_NN.h
@@ -1,45 +1,47 @@
#ifndef NETWORK_NETNODE_H
#define NETWORK_NETNODE_H
#include "netnode.h"
class ANetwork;
class NetworkNetNode : public ANetNode{
Q_OBJECT
public:
NetworkNetNode();
virtual ~NetworkNetNode();
virtual const QString pixmapName()
{ return "Devices/tcpip"; }
virtual const QString nodeName()
{ return tr("IP Configuration"); }
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 & )
{ return 0; }
virtual bool generateDeviceDataForCommonFile(
SystemFile & SF, long DevNr );
private:
+ virtual void setSpecificAttribute( QString & Attr, QString & Value );
+ virtual void saveSpecificAttribute( QTextStream & TS );
};
extern "C"
{
void create_plugin( QList<ANetNode> & PNN );
};
#endif
diff --git a/noncore/settings/networksettings2/networksettings2/netnode.cpp b/noncore/settings/networksettings2/networksettings2/netnode.cpp
index fcc6044..3691e5a 100644
--- a/noncore/settings/networksettings2/networksettings2/netnode.cpp
+++ b/noncore/settings/networksettings2/networksettings2/netnode.cpp
@@ -1,133 +1,148 @@
#include <qpe/qpeapplication.h>
#include <time.h>
#include <qtextstream.h>
#include <qpixmap.h>
#include "resources.h"
#include "netnode.h"
#include "asdevice.h"
#include "asline.h"
#include "asconnection.h"
#include "asfullsetup.h"
QString & deQuote( QString & X ) {
if( X[0] == '"' ) {
// remove end and trailing "" and \x -> x
QChar R;
long idx;
idx = X.length()-1;
X = X.mid( 1, idx );
idx = 0;
while( ( idx = X.find( '\\', idx ) ) >= 0 ) {
R = X[idx+1];
X.replace( idx, 2, &R, 1 );
}
X = X.left( X.length()-1 );
}
return X;
}
QString quote( QString X ) {
if( X.find( QRegExp( "[ \n\"\\\t]" ) ) >= 0 ) {
// need to quote this
QString OutString = "\"";
X.replace( QRegExp("\""), "\\\"" );
X.replace( QRegExp("\\"), "\\\\" );
X.replace( QRegExp(" "), "\\ " );
OutString += X;
OutString += "\"";
X = OutString;
}
return X;
}
+
+//
+//
+// ANETNODE
//
//
+
+void ANetNode::saveAttributes( QTextStream & TS ) {
+ saveSpecificAttribute( TS );
+}
+
+void ANetNode::setAttribute( QString & Attr, QString & Value ){
+ setSpecificAttribute( Attr, Value );
+}
+
+//
//
+// ANETNODEINSTANCE
//
//
long ANetNodeInstance::InstanceCounter = -1;
void ANetNodeInstance::initialize( void ) {
if( InstanceCounter == -1 )
InstanceCounter = time(0);
// set name
QString N;
N.sprintf( "-%ld", InstanceCounter++ );
N.prepend( NodeType->nodeName() );
setNodeName( N );
}
void ANetNodeInstance::setAttribute( QString & Attr, QString & Value ){
if( Attr == "name" ) {
NodeName = Value;
} else {
setSpecificAttribute( Attr, Value );
}
}
void ANetNodeInstance::saveAttributes( QTextStream & TS ) {
TS << "name=" << quote( NodeName ) << endl;
saveSpecificAttribute( TS );
}
ANetNodeInstance * ANetNodeInstance::nextNode( void ) {
return connection()->findNext( this );
}
//
//
-//
+// NODECOLLECTION
//
//
long NodeCollection::MaxNr = -1;
NodeCollection::NodeCollection( void ) : QList<ANetNodeInstance>() {
IsModified = 0;
Index = -1;
Name="";
IsNew = 1;
CurrentState = Unchecked;
}
NodeCollection::NodeCollection( QTextStream & TS ) :
QList<ANetNodeInstance>() {
long idx;
bool InError = 0;
QString S, A, N;
IsModified = 0;
Index = -1;
Name="";
IsNew = 0;
CurrentState = Unchecked;
do {
S = TS.readLine();
if( S.isEmpty() ) {
if( InError ) {
// remove all nodes
clear();
}
// empty line
break;
}
idx = S.find('=');
S.stripWhiteSpace();
A = S.left( idx );
A.lower();
N = S.mid( idx+1, S.length() );
N.stripWhiteSpace();
N = deQuote( N );
if( A == "name" ) {
Name = N;
} else if( A == "number" ) {
setNumber( N.toLong() );
} else if( A == "node" ) {
@@ -224,79 +239,61 @@ int NodeCollection::compareItems( QCollection::Item I1,
static char * State2PixmapTbl[] = {
"NULL", // Unchecked : no pixmap
"check", // Unknown
"delete", // unavailable
"disabled", // disabled
"off", // off
"disconnected", // available
"connected" // up
};
QPixmap NodeCollection::devicePixmap( void ) {
return NSResources->getPixmap(
device()->netNode()->pixmapName()+"-large" );
}
QPixmap NodeCollection::statePixmap( State_t S) {
return NSResources->getPixmap( State2PixmapTbl[S] );
}
QString NodeCollection::stateName( State_t S) {
switch( S ) {
case Unknown :
return qApp->translate( "networksettings2", "Unknown");
case Unavailable :
return qApp->translate( "networksettings2", "Unavailable");
case Disabled :
return qApp->translate( "networksettings2", "Disabled");
case Off :
return qApp->translate( "networksettings2", "Off");
case Available :
return qApp->translate( "networksettings2", "Available");
case IsUp :
return qApp->translate( "networksettings2", "IsUp");
case Unchecked : /* FT */
default :
break;
}
return QString("");
}
void NodeCollection::reassign( void ) {
for( QListIterator<ANetNodeInstance> it(*this);
it.current();
++it ) {
it.current()->setConnection( this );
}
}
+//
+//
+// RUNTIMEINFO
+//
+//
+
InterfaceInfo * RuntimeInfo::assignedInterface( void ) {
return netNode()->nextNode()->runtime()->assignedInterface();
}
AsDevice * RuntimeInfo::device( void ) {
return netNode()->nextNode()->runtime()->device();
}
-
-ANetNodeInstance * FakeNetNode::createInstance( void ) {
- return new FakeNetNodeInstance( this );
-}
-
-void FakeNetNodeInstance::setSpecificAttribute(
- QString & A, QString & V ) {
- ValAttrPairs.insert( A, new QString(V) );
-}
-
-void FakeNetNodeInstance::saveSpecificAttribute( QTextStream &TS ) {
- for( QDictIterator<QString> it( ValAttrPairs );
- it.current();
- ++ it ) {
- TS << it.currentKey().latin1()
- << "="
- << quote( *(it.current()))
- << endl ;
- ++it;
- }
-}
-
-// collects all info that no plugin acceps
-FakeNetNode * FakeNode = 0;
diff --git a/noncore/settings/networksettings2/networksettings2/netnode.h b/noncore/settings/networksettings2/networksettings2/netnode.h
index 9681c6e..6ec9ef6 100644
--- a/noncore/settings/networksettings2/networksettings2/netnode.h
+++ b/noncore/settings/networksettings2/networksettings2/netnode.h
@@ -70,107 +70,115 @@ class ANetNode : public QObject{
public:
typedef QArray<ANetNode *> NetNodeList;
ANetNode(){};
virtual ~ANetNode(){};
// pixmap needed for this NetNode
virtual const QString pixmapName() = 0;
// name of this NetNode
virtual const QString nodeName() = 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;
// 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;
// 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; }
+ // set the value of an attribute
+ void setAttribute( QString & Attr, QString & Value ) ;
+ void saveAttributes( QTextStream & TS ) ;
+
// compiled references to 'needed' NetNodes -> needs list
void setAlternatives( NetNodeList * Alt )
{ Alternatives = Alt; }
NetNodeList & alternatives( void )
{ return *Alternatives; }
protected :
NetNodeList * Alternatives;
private :
+
+ virtual void setSpecificAttribute( QString & , QString & ) = 0;
+ virtual void saveSpecificAttribute( QTextStream & ) = 0;
+
};
class ANetNodeInstance : public QObject {
public:
ANetNodeInstance( ANetNode * NN ) : QObject()
{ IsModified=0; NodeType = NN; IsNew = TRUE; }
virtual ~ANetNodeInstance( void ) { }
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;
// return data was modified
void setModified( bool M )
{ IsModified = M; }
bool isModified( void )
{ return IsModified; }
// get data from GUI and store in node
virtual void commit( void ) = 0;
// get next node
ANetNodeInstance * nextNode();
// return NetNode this is an instance of
ANetNode * nodeClass( void )
{ return NodeType; }
// intialize am instance of a net node
void initialize( void );
// set the value of an attribute
void setAttribute( QString & Attr, QString & Value ) ;
void saveAttributes( QTextStream & TS ) ;
// return true if node isntance is NEW and not loaded
void setNew( bool IsN )
{ IsNew = IsN; }
bool isNew( void )
@@ -333,133 +341,49 @@ public :
// makes sure that all items in the connection point to
// that connectoin
void reassign( void );
ANetNodeInstance * getToplevel( void );
ANetNodeInstance * findNext( ANetNodeInstance * NNI );
ANetNodeInstance * findByName( const QString & S );
const QString & name()
{ return Name; }
const QString & description( void );
void setName( const QString & N)
{ Name = N; }
State_t currentState( void )
{ return CurrentState; }
void setCurrentState( State_t S )
{ CurrentState = S; }
long maxConnectionNumber( void )
{ return MaxNr; }
static void resetMaxNr( void )
{ MaxNr = -1; }
private :
int compareItems ( QCollection::Item item1,
QCollection::Item item2 );
static long MaxNr;
long Number;
// state of this connection
State_t CurrentState;
QString Name;
// true if this collection was just created (and not
// loaded from file
bool IsNew;
// index in listbox
int Index;
bool IsModified;
};
-//
-// special node that is used to remember entries for plugins
-// that seem missing. This way we never loose data
-//
-
-class FakeNetNode : public ANetNode {
-
-public:
-
- FakeNetNode( ) { };
- virtual ~FakeNetNode(){};
-
- const QString pixmapName()
- { return QString(""); }
- const QString nodeName()
- { return QString("Fake node" ); }
- const QString nodeDescription()
- { return QString("Fake node" ); }
- ANetNodeInstance * createInstance( void );
- const char * provides( void )
- { return ""; }
- virtual const char ** needs( void )
- { return 0; }
- virtual bool generateProperFilesFor( ANetNodeInstance * )
- { return 0; }
- virtual bool hasDataFor( const QString & )
- { return 0; }
- virtual bool generateDeviceDataForCommonFile(
- SystemFile & , long )
- {return 1; }
-
-private :
-
-};
-
-class FakeNetNodeInstance : public ANetNodeInstance {
-
-public:
-
- FakeNetNodeInstance( ANetNode * NN ) :
- ANetNodeInstance( NN ), ValAttrPairs() { }
- virtual ~FakeNetNodeInstance( void ) { }
-
- virtual RuntimeInfo * runtime( void )
- { return 0; }
-
- // create edit widget under parent
- virtual QWidget * edit( QWidget * )
- { return 0; }
- // is given data acceptable
- virtual QString acceptable( void )
- { return QString(""); }
-
- // get data from GUI and store in node
- virtual void commit( void ) {}
-
- // get next node
- ANetNodeInstance * nextNode()
- { return 0; }
- // return NetNode this is an instance of
-
- // intialize am instance of a net node
- void initialize( void ){}
-
- // returns node specific data -> only useful for 'buddy'
- 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 & );
- virtual void saveSpecificAttribute( QTextStream & );
-
- QDict<QString> ValAttrPairs;
-};
-
-extern FakeNetNode * FakeNode;
-
#endif
diff --git a/noncore/settings/networksettings2/networksettings2/resources.h b/noncore/settings/networksettings2/networksettings2/resources.h
index 3048fb3..7050f10 100644
--- a/noncore/settings/networksettings2/networksettings2/resources.h
+++ b/noncore/settings/networksettings2/networksettings2/resources.h
@@ -10,113 +10,113 @@
#include "system.h"
class QLibrary;
class QPixmap;
class ANetNode;
class ANetNodeInstance;
typedef void (*GetNetNodeListFt_t)(QList<ANetNode>& PNN );
typedef struct NetNode_S {
ANetNode * NetNode;
QLibrary * TheLibrary;
long NodeCountInLib;
} NetNode_t;
class CurrentQPEUser {
public :
CurrentQPEUser() : UserName(), HomeDir(), EnvList() {}
QString UserName;
QString HomeDir;
int Uid;
int Gid;
QArray<char *> EnvList;
};
typedef QDict<NetNode_t> Name2NetNode_t;
typedef QDict<ANetNodeInstance > Name2Instance_t;
typedef QDict<NodeCollection> Name2Connection_t;
typedef QDict<SystemFile> Name2SystemFile_t;
class TheNSResources {
public :
TheNSResources( void );
~TheNSResources( );
System & system()
{ return *TheSystem; }
QPixmap getPixmap( const QString & Name );
Name2NetNode_t & netNodes( void )
{ return AllNodeTypes; }
bool netNodeExists( const QString & X )
{ return AllNodeTypes.find(X)!=0; }
+ ANetNode * findNetNode( const QString & N )
+ { NetNode_t * NNT = AllNodeTypes.find(N);
+ return (NNT) ? NNT->NetNode : 0;
+ }
Name2SystemFile_t & systemFiles( void )
{ return SystemFiles; }
void addSystemFile( SystemFile * SF )
{ SystemFiles.insert( SF->name(), SF ); }
ANetNodeInstance * createNodeInstance( const QString & S )
{ ANetNodeInstance * NNI = 0;
NetNode_t * NNT = AllNodeTypes[S];
- ANetNode * NN;
if( ! NNT ) {
- NN = FakeNode =
- ( FakeNode ) ? FakeNode : new FakeNetNode();
- } else {
- NN = NNT->NetNode;
+ return 0;
}
- NNI = NN->createInstance();
+ NNI = NNT->NetNode->createInstance();
NNI->initialize();
return NNI;
}
Name2Instance_t & netNodeInstances( void )
{ return AllNodes; }
void addNodeInstance( ANetNodeInstance * I )
{ AllNodes.insert( I->nodeName(), I ); }
void removeNodeInstance( const QString & N )
{ AllNodes.remove( N );}
ANetNodeInstance * findNodeInstance( const QString & S )
{ return (AllNodes.find(S)!=0) ? AllNodes[S] : 0; }
const QString & netNode2Name( const char * Type );
const QString & netNode2Description( const char * Type );
void renumberConnections( void );
void addConnection( NodeCollection * NC );
void removeConnection( const QString & N );
NodeCollection * findConnection( const QString & N );
Name2Connection_t & connections( void )
{ return ConnectionsMap; }
CurrentQPEUser & currentUser( void )
{ return CurrentUser; }
private :
void detectCurrentUser( void );
QString tr( const char * path );
void findAvailableNetNodes( const QString &path );
bool loadNetNode(
const QString &pluginFileName,
const QString &resolveString = "create_plugin");
QMap< QString, QString> NodeTypeNameMap;
QMap< QString, QString> NodeTypeDescriptionMap;
Name2Connection_t ConnectionsMap;
System * TheSystem;
Name2SystemFile_t SystemFiles;
// all node type classes
Name2NetNode_t AllNodeTypes;
// all nodes
Name2Instance_t AllNodes;
CurrentQPEUser CurrentUser;
diff --git a/noncore/settings/networksettings2/nsdata.cpp b/noncore/settings/networksettings2/nsdata.cpp
index b4d9aaa..13979ce 100644
--- a/noncore/settings/networksettings2/nsdata.cpp
+++ b/noncore/settings/networksettings2/nsdata.cpp
@@ -1,188 +1,223 @@
#include <stdlib.h>
#include <qpe/qpeapplication.h>
#include <qtextstream.h>
#include <qdir.h>
#include <qfile.h>
#include <qfileinfo.h>
#include "nsdata.h"
#include <asdevice.h>
#include <resources.h>
static QString CfgFile;
NetworkSettingsData::NetworkSettingsData( void ) {
// init global resources structure
new TheNSResources();
CfgFile.sprintf( "%s/NETCONFIG",
NSResources->currentUser().HomeDir.latin1() );
fprintf( stderr, "Cfg from %s\n", CfgFile.latin1() );
// load settings
Force = 0;
IsModified = 0;
loadSettings();
}
// saving is done by caller
NetworkSettingsData::~NetworkSettingsData( void ) {
delete NSResources;
}
void NetworkSettingsData::loadSettings( void ) {
- QString S;
- ANetNodeInstance* NNI;
+ QString Line, S;
QString Attr, Value;
long idx;
QFile F( CfgFile );
QTextStream TS( &F );
do {
if( ! F.open(IO_ReadOnly) )
break;
/* load the file ->
FORMAT :
[NETNODETYPE]
Entries ...
<EMPTYLINE>
[connection]
Name=Name
Node=Name
<EMPTYLINE>
*/
while( ! TS.atEnd() ) {
- S = TS.readLine();
+ S = Line = TS.readLine();
if ( S.isEmpty() || S[0] != '[' )
continue;
S = S.mid( 1, S.length()-2 );
if( ! NSResources ) {
continue;
}
if( S == "connection" ) {
// load connections -> collections of nodes
NodeCollection * NC = new NodeCollection( TS );
NSResources->addConnection( NC );
} else {
- // load nodes
- NNI = NSResources->createNodeInstance( S );
- if( ! NNI ) {
- printf( "SKIPPING %s\n", S.latin1() );
+ ANetNode * NN = 0;
+ ANetNodeInstance* NNI = 0;
+ if( S.startsWith( "nodetype " ) ) {
+ S = S.mid( 9, S.length()-9-1 );
+ fprintf( stderr, "Node %s\n", S.latin1() );
+ // try to find netnode
+ NN = NSResources->findNetNode( S );
+ } else {
+ // try to find instance
+ NNI = NSResources->createNodeInstance( S );
}
do {
S = TS.readLine();
- if( S.isEmpty() ) {
- // empty line
- break;
- }
- // node found ?
- if( NNI ) {
+
+ if( NN || NNI ) {
+ if( S.isEmpty() ) {
+ // empty line
+ break;
+ }
idx = S.find( '=' );
if( idx > 0 ) {
Attr = S.left( idx );
Value = S.mid( idx+1, S.length() );
} else {
Value="";
Attr = S;
}
Value.stripWhiteSpace();
Attr.stripWhiteSpace();
Attr.lower();
// dequote Attr
Value = deQuote(Value);
- // set the attribute
- NNI->setAttribute( Attr, Value );
+ if( NN ) {
+ // set the attribute
+ NNI->setAttribute( Attr, Value );
+ } else {
+ // set the attribute
+ NNI->setAttribute( Attr, Value );
+ }
+ } else {
+ LeftOvers.append( Line );
+ // add empty line too as delimiter
+ if( S.isEmpty() ) {
+ // empty line
+ break;
+ }
}
-
} while( 1 );
if( NNI ) {
// loading from file -> exists
NNI->setNew( FALSE );
NSResources->addNodeInstance( NNI );
}
}
}
} while( 0 );
}
QString NetworkSettingsData::saveSettings( void ) {
QString ErrS = "";
if( ! isModified() )
return ErrS;
QString S;
QFile F( CfgFile + ".bup" );
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>" ).
arg(CfgFile);
// problem
return ErrS;
}
QTextStream TS( &F );
+
+ // save leftovers
+ for ( QStringList::Iterator it = LeftOvers.begin();
+ it != LeftOvers.end(); ++it ) {
+ TS << (*it) << endl;
+ }
+
+ // save global configs
+ for( QDictIterator<NetNode_t> it( NSResources->netNodes() );
+ it.current();
+ ++it ) {
+ TS << "[nodetype "
+ << it.current()->NetNode->name()
+ << "]"
+ << endl;
+
+ it.current()->NetNode->saveAttributes( TS );
+ }
+
{ Name2Connection_t & M = NSResources->connections();
ANetNodeInstance * NNI;
// for all connections
for( QDictIterator<NodeCollection> it(M);
it.current();
++it ) {
// all nodes in those connections
for( QListIterator<ANetNodeInstance> nit(*(it.current()));
nit.current();
++nit ) {
// header
NNI = nit.current();
TS << '[' <<NNI->nodeClass()->nodeName() << ']' << endl;
NNI->saveAttributes( TS );
TS << endl;
}
TS << "[connection]" << endl;
it.current()->save(TS);
}
}
QDir D(".");
D.rename( CfgFile + ".bup", CfgFile );
//
// proper files AND system files regenerated
//
setModified( 0 );
return ErrS;
}
QString NetworkSettingsData::generateSettings( bool ForceReq ) {
bool ForceIt;
QString S = "";
// include own force flag
ForceIt = (Force) ? 1 : ForceReq;
if( ! ForceIt && ! isModified() )
return S;
// regenerate system files
fprintf( stderr, "Generating settings from %s\n", CfgFile.latin1() );
{ Name2SystemFile_t & SFM = NSResources->systemFiles();
diff --git a/noncore/settings/networksettings2/nsdata.h b/noncore/settings/networksettings2/nsdata.h
index eb96930..57eb722 100644
--- a/noncore/settings/networksettings2/nsdata.h
+++ b/noncore/settings/networksettings2/nsdata.h
@@ -1,43 +1,46 @@
#ifndef __NSDATA_H
#define __NSDATA_H
#include "netnode.h"
class NetworkSettingsData {
public :
NetworkSettingsData( void );
~NetworkSettingsData( void );
void loadSettings( void );
QString saveSettings( void );
QString generateSettings( bool Force = FALSE );
bool isModified( void )
{ return IsModified; }
void setModified( bool m )
{ IsModified = m; }
QList<NodeCollection> collectPossible( const char * Interface );
// return TRUE if we need gui to decide
bool canStart( const char * Interface );
bool regenerate( void );
void forceGeneration( bool m )
{ Force = m; }
private :
QString NetworkSettingsData::generateSystemFileNode(
SystemFile & SF,
AsDevice * CurDev,
ANetNodeInstance * DevNNI,
long DevInstNr );
bool IsModified;
bool Force;
+ // collect strings in config file nobody wants
+ QStringList LeftOvers;
+
};
#endif
diff --git a/noncore/settings/networksettings2/ppp/ppp_NN.cpp b/noncore/settings/networksettings2/ppp/ppp_NN.cpp
index b3f70c5..0bf415b 100644
--- a/noncore/settings/networksettings2/ppp/ppp_NN.cpp
+++ b/noncore/settings/networksettings2/ppp/ppp_NN.cpp
@@ -10,53 +10,59 @@ static const char * PPPNeeds[] =
/**
* Constructor, find all of the possible interfaces
*/
PPPNetNode::PPPNetNode() : ANetNode() {
}
/**
* Delete any interfaces that we own.
*/
PPPNetNode::~PPPNetNode(){
}
const QString PPPNetNode::nodeDescription(){
return tr("\
<p>Sets up IP using PPP.</p>\
<p>Use this for dialup devices or serial setups</p>\
"
);
}
ANetNodeInstance * PPPNetNode::createInstance( void ) {
return new APPP( this );
}
const char ** PPPNetNode::needs( void ) {
return PPPNeeds;
}
const char * PPPNetNode::provides( void ) {
return "connection";
}
bool PPPNetNode::generateProperFilesFor(
ANetNodeInstance * ) {
return 1;
}
bool PPPNetNode::generateDeviceDataForCommonFile(
SystemFile & ,
long ) {
return 1;
}
QString PPPNetNode::genNic( long NicNr ) {
QString S;
return S.sprintf( "ppp%ld", NicNr );
}
+void PPPNetNode::setSpecificAttribute( QString & , QString & ) {
+}
+
+void PPPNetNode::saveSpecificAttribute( QTextStream & ) {
+}
+
extern "C" {
void create_plugin( QList<ANetNode> & PNN ) {
PNN.append( new PPPNetNode() );
}
}
diff --git a/noncore/settings/networksettings2/ppp/ppp_NN.h b/noncore/settings/networksettings2/ppp/ppp_NN.h
index c33f281..fbbbbe1 100644
--- a/noncore/settings/networksettings2/ppp/ppp_NN.h
+++ b/noncore/settings/networksettings2/ppp/ppp_NN.h
@@ -1,47 +1,49 @@
#ifndef PPP_NETNODE_H
#define PPP_NETNODE_H
#include "netnode.h"
class APPP;
class PPPNetNode : public ANetNode{
Q_OBJECT
public:
PPPNetNode();
virtual ~PPPNetNode();
virtual const QString pixmapName()
{ return "Devices/ppp"; }
virtual const QString nodeName()
{ return tr("PPP Connection"); }
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 & )
{ return 0; }
virtual bool generateDeviceDataForCommonFile(
SystemFile & SF, long DevNr );
virtual QString genNic( long NicNr );
private:
+ virtual void setSpecificAttribute( QString & Attr, QString & Value );
+ virtual void saveSpecificAttribute( QTextStream & TS );
};
extern "C"
{
void create_plugin( QList<ANetNode> & PNN );
};
#endif
diff --git a/noncore/settings/networksettings2/profile/profile_NN.cpp b/noncore/settings/networksettings2/profile/profile_NN.cpp
index 7609cdc..0f71dc7 100644
--- a/noncore/settings/networksettings2/profile/profile_NN.cpp
+++ b/noncore/settings/networksettings2/profile/profile_NN.cpp
@@ -4,53 +4,59 @@
static const char * ProfileNeeds[] =
{ "connection",
0
};
/**
* Constructor, find all of the possible interfaces
*/
ProfileNetNode::ProfileNetNode() : ANetNode() {
}
/**
* Delete any interfaces that we own.
*/
ProfileNetNode::~ProfileNetNode(){
}
const QString ProfileNetNode::nodeDescription(){
return tr("\
<p>Define use of an IP connection.</p>\
<p>Configure if and when this connection needs to be established</p>\
"
);
}
ANetNodeInstance * ProfileNetNode::createInstance( void ) {
return new AProfile( this );
}
const char ** ProfileNetNode::needs( void ) {
return ProfileNeeds;
}
const char * ProfileNetNode::provides( void ) {
return "fullsetup";
}
bool ProfileNetNode::generateProperFilesFor(
ANetNodeInstance * ) {
return 1;
}
bool ProfileNetNode::generateDeviceDataForCommonFile(
SystemFile & ,
long ) {
return 1;
}
+void ProfileNetNode::setSpecificAttribute( QString & , QString & ) {
+}
+
+void ProfileNetNode::saveSpecificAttribute( QTextStream & ) {
+}
+
extern "C" {
void create_plugin( QList<ANetNode> & PNN ) {
PNN.append( new ProfileNetNode() );
}
}
diff --git a/noncore/settings/networksettings2/profile/profile_NN.h b/noncore/settings/networksettings2/profile/profile_NN.h
index f7c2b22..1313ab2 100644
--- a/noncore/settings/networksettings2/profile/profile_NN.h
+++ b/noncore/settings/networksettings2/profile/profile_NN.h
@@ -1,45 +1,47 @@
#ifndef PROFILE_NETNODE_H
#define PROFILE_NETNODE_H
#include "netnode.h"
class AProfile;
class ProfileNetNode : public ANetNode{
Q_OBJECT
public:
ProfileNetNode();
virtual ~ProfileNetNode();
virtual const QString pixmapName()
{ return "Devices/commprofile"; }
virtual const QString nodeName()
{ return tr("Regular profile"); }
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 & )
{ return 0; }
virtual bool generateDeviceDataForCommonFile(
SystemFile & SF, long DevNr);
private:
+ virtual void setSpecificAttribute( QString & Attr, QString & Value );
+ virtual void saveSpecificAttribute( QTextStream & TS );
};
extern "C"
{
void create_plugin( QList<ANetNode> & PNN );
};
#endif
diff --git a/noncore/settings/networksettings2/usb/usb_NN.cpp b/noncore/settings/networksettings2/usb/usb_NN.cpp
index 30c72db..d5971cf 100644
--- a/noncore/settings/networksettings2/usb/usb_NN.cpp
+++ b/noncore/settings/networksettings2/usb/usb_NN.cpp
@@ -19,53 +19,59 @@ USBNetNode::~USBNetNode(){
const QString USBNetNode::nodeDescription(){
return tr("\
<p>Configure Ethernet over USB.</p>\
<p>Use this for a computer to computer USB cable connection</p>\
"
);
}
ANetNodeInstance * USBNetNode::createInstance( void ) {
return new AUSB( this );
}
const char ** USBNetNode::needs( void ) {
return USBNeeds;
}
const char * USBNetNode::provides( void ) {
return "device";
}
bool USBNetNode::generateProperFilesFor(
ANetNodeInstance * ) {
return 1;
}
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 ) {
return QString( "usbf" );
}
+void USBNetNode::setSpecificAttribute( QString & , QString & ) {
+}
+
+void USBNetNode::saveSpecificAttribute( QTextStream & ) {
+}
+
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 ba22b1c..0b83ea6 100644
--- a/noncore/settings/networksettings2/usb/usb_NN.h
+++ b/noncore/settings/networksettings2/usb/usb_NN.h
@@ -1,46 +1,48 @@
#ifndef USB_NETNODE_H
#define USB_NETNODE_H
#include "netnode.h"
class AUSB;
class USBNetNode : public ANetNode{
Q_OBJECT
public:
USBNetNode();
virtual ~USBNetNode();
virtual const QString pixmapName()
{ return "Devices/usb"; }
virtual const QString nodeName()
{ return tr("USB Cable Connect"); }
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 & SF, long DevNr );
virtual QString genNic( long nr );
private:
+ virtual void setSpecificAttribute( QString & Attr, QString & Value );
+ virtual void saveSpecificAttribute( QTextStream & TS );
};
extern "C"
{
void create_plugin( QList<ANetNode> & PNN );
};
#endif
diff --git a/noncore/settings/networksettings2/vpn/vpn_NN.cpp b/noncore/settings/networksettings2/vpn/vpn_NN.cpp
index d9aa892..307e9dd 100644
--- a/noncore/settings/networksettings2/vpn/vpn_NN.cpp
+++ b/noncore/settings/networksettings2/vpn/vpn_NN.cpp
@@ -4,53 +4,59 @@
static const char * VPNNeeds[] =
{ "connection",
0
};
/**
* Constructor, find all of the possible interfaces
*/
VPNNetNode::VPNNetNode() : ANetNode() {
}
/**
* Delete any interfaces that we own.
*/
VPNNetNode::~VPNNetNode(){
}
const QString VPNNetNode::nodeDescription(){
return tr("\
<p>Configure private IP connection.</p>\
<p>Defines Secure tunnels over non secure IP sessions</p>\
"
);
}
ANetNodeInstance * VPNNetNode::createInstance( void ) {
return new AVPN( this );
}
const char ** VPNNetNode::needs( void ) {
return VPNNeeds;
}
const char * VPNNetNode::provides( void ) {
return "connection";
}
bool VPNNetNode::generateProperFilesFor(
ANetNodeInstance * ) {
return 1;
}
bool VPNNetNode::generateDeviceDataForCommonFile(
SystemFile & ,
long ) {
return 1;
}
+void VPNNetNode::setSpecificAttribute( QString & , QString & ) {
+}
+
+void VPNNetNode::saveSpecificAttribute( QTextStream & ) {
+}
+
extern "C" {
void create_plugin( QList<ANetNode> & PNN ) {
PNN.append( new VPNNetNode() );
}
}
diff --git a/noncore/settings/networksettings2/vpn/vpn_NN.h b/noncore/settings/networksettings2/vpn/vpn_NN.h
index 7ce8e3a..1cd3fcc 100644
--- a/noncore/settings/networksettings2/vpn/vpn_NN.h
+++ b/noncore/settings/networksettings2/vpn/vpn_NN.h
@@ -1,45 +1,47 @@
#ifndef VPN_NETNODE_H
#define VPN_NETNODE_H
#include "netnode.h"
class AVPN;
class VPNNetNode : public ANetNode{
Q_OBJECT
public:
VPNNetNode();
virtual ~VPNNetNode();
virtual const QString pixmapName()
{ return "Devices/vpn"; }
virtual const QString nodeName()
{ return tr("VPN Connection"); }
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 & )
{ return 0; }
virtual bool generateDeviceDataForCommonFile(
SystemFile & SF, long DevNr );
private:
+ virtual void setSpecificAttribute( QString & Attr, QString & Value );
+ virtual void saveSpecificAttribute( QTextStream & TS );
};
extern "C"
{
void create_plugin( QList<ANetNode> & PNN );
};
#endif
diff --git a/noncore/settings/networksettings2/wlan/wlan_NN.cpp b/noncore/settings/networksettings2/wlan/wlan_NN.cpp
index 4e59ac1..e0c4db2 100644
--- a/noncore/settings/networksettings2/wlan/wlan_NN.cpp
+++ b/noncore/settings/networksettings2/wlan/wlan_NN.cpp
@@ -1,72 +1,85 @@
#include "wlan_NN.h"
#include "wlan_NNI.h"
static const char * WLanNeeds[] =
{ 0
};
/**
* Constructor, find all of the possible interfaces
*/
WLanNetNode::WLanNetNode() : ANetNode() {
+ InstanceCount = 2;
}
/**
* Delete any interfaces that we own.
*/
WLanNetNode::~WLanNetNode(){
}
const QString WLanNetNode::nodeDescription(){
return tr("\
<p>Configure Wi/Fi or WLan network cards.</p>\
<p>Defines Wireless options for those cards</p>\
"
);
}
ANetNodeInstance * WLanNetNode::createInstance( void ) {
return new AWLan( this );
}
const char ** WLanNetNode::needs( void ) {
return WLanNeeds;
}
const char * WLanNetNode::provides( void ) {
return "device";
}
bool WLanNetNode::generateProperFilesFor(
ANetNodeInstance * ) {
return 1;
}
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 ) {
QString S;
return S.sprintf( "wlan%ld", nr );
}
+void WLanNetNode::setSpecificAttribute( QString & A, QString & V ) {
+ if( A == "interfacecount" ) {
+ InstanceCount = V.toLong();
+ }
+}
+
+void WLanNetNode::saveSpecificAttribute( QTextStream & TS ) {
+ TS << "interfacecount="
+ << InstanceCount
+ << endl;
+}
+
extern "C" {
void create_plugin( QList<ANetNode> & PNN ) {
PNN.append( new WLanNetNode() );
}
}
diff --git a/noncore/settings/networksettings2/wlan/wlan_NN.h b/noncore/settings/networksettings2/wlan/wlan_NN.h
index f27e71c..e93a89a 100644
--- a/noncore/settings/networksettings2/wlan/wlan_NN.h
+++ b/noncore/settings/networksettings2/wlan/wlan_NN.h
@@ -1,50 +1,56 @@
#ifndef WLAN_NETNODE_H
#define WLAN_NETNODE_H
#include "netnode.h"
class AWLan;
class WLanNetNode : public ANetNode{
Q_OBJECT
public:
WLanNetNode();
virtual ~WLanNetNode();
virtual const QString pixmapName()
{ return "Devices/wlan"; }
virtual const QString nodeName()
{ return tr("WLan Device"); }
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 & SF, long DevNr );
virtual long instanceCount( void )
- { return 2; }
+ { return InstanceCount; }
virtual QString genNic( long );
private:
+ virtual void setSpecificAttribute( QString & Attr, QString & Value );
+ virtual void saveSpecificAttribute( QTextStream & TS );
+
+ // number of interfaces for this device
+ long InstanceCount;
+
};
extern "C"
{
void create_plugin( QList<ANetNode> & PNN );
};
#endif