summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/profile
Side-by-side diff
Diffstat (limited to 'noncore/settings/networksettings2/profile') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/networksettings2/profile/profile_NN.cpp13
-rw-r--r--noncore/settings/networksettings2/profile/profile_NN.h8
-rw-r--r--noncore/settings/networksettings2/profile/profile_NNI.cpp27
-rw-r--r--noncore/settings/networksettings2/profile/profile_NNI.h23
4 files changed, 35 insertions, 36 deletions
diff --git a/noncore/settings/networksettings2/profile/profile_NN.cpp b/noncore/settings/networksettings2/profile/profile_NN.cpp
index 59c34a3..945b48d 100644
--- a/noncore/settings/networksettings2/profile/profile_NN.cpp
+++ b/noncore/settings/networksettings2/profile/profile_NN.cpp
@@ -1,24 +1,24 @@
#include "profile_NN.h"
#include "profile_NNI.h"
static const char * ProfileNeeds[] =
{ "connection",
0
};
/**
* Constructor, find all of the possible interfaces
*/
-ProfileNetNode::ProfileNetNode() : ANetNode( tr("Regular profile")) {
+ProfileNetNode::ProfileNetNode() : ANetNode( tr("Regular connection profile")) {
}
/**
* 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>\
@@ -29,34 +29,23 @@ const QString ProfileNetNode::nodeDescription(){
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 0;
-}
-
-bool ProfileNetNode::generateDeviceDataForCommonFile(
- SystemFile & ,
- long ) {
- return 0;
-}
-
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 e602bd7..1f1ee2c 100644
--- a/noncore/settings/networksettings2/profile/profile_NN.h
+++ b/noncore/settings/networksettings2/profile/profile_NN.h
@@ -9,36 +9,28 @@ class ProfileNetNode : public ANetNode{
Q_OBJECT
public:
ProfileNetNode();
virtual ~ProfileNetNode();
virtual const QString pixmapName()
{ return "Devices/commprofile"; }
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/profile/profile_NNI.cpp b/noncore/settings/networksettings2/profile/profile_NNI.cpp
index cb52b2a..f0f0b97 100644
--- a/noncore/settings/networksettings2/profile/profile_NNI.cpp
+++ b/noncore/settings/networksettings2/profile/profile_NNI.cpp
@@ -41,18 +41,37 @@ QWidget * AProfile::edit( QWidget * parent ) {
return GUI;
}
QString AProfile::acceptable( void ) {
return ( GUI ) ? GUI->acceptable( ) : QString();
}
void AProfile::commit( void ) {
if( GUI && GUI->commit( Data ) )
setModified( 1 );
}
-bool AProfile::generateDataForCommonFile(
- SystemFile & ,
- long) {
- return 1;
+short AProfile::generateFileEmbedded( const QString & ID,
+ const QString & Path,
+ QTextStream & TS,
+ long DevNr ) {
+
+ short rvl, rvd;
+
+ rvl = 1;
+
+ if( ID == "interfaces" ) {
+ Log(("Generate Profile for %s\n", ID.latin1() ));
+ if( Data.TriggerVPN ) {
+ // this profile triggers VPN -> insert trigger
+ TS << " up networksettings2 --triggervpn"
+ << endl;
+ rvl = 0;
+ }
}
+ rvd = ANetNodeInstance::generateFileEmbedded( ID, Path, TS, DevNr );
+ return (rvd == 2 || rvl == 2 ) ? 2 :
+ (rvd == 0 || rvl == 0 ) ? 0 : 1;
+}
+
+
diff --git a/noncore/settings/networksettings2/profile/profile_NNI.h b/noncore/settings/networksettings2/profile/profile_NNI.h
index 2c2db7f..957f4af 100644
--- a/noncore/settings/networksettings2/profile/profile_NNI.h
+++ b/noncore/settings/networksettings2/profile/profile_NNI.h
@@ -5,44 +5,43 @@
#include "profiledata.h"
#include "profilerun.h"
class ProfileNetNode;
class ProfileEdit;
class AProfile : public ANetNodeInstance {
public :
AProfile( ProfileNetNode * PNN );
+ RuntimeInfo * runtime( void )
+ { return
+ ( RT ) ? RT : ( RT = new ProfileRun( this, Data ) );
+ }
+
QWidget * edit( QWidget * parent );
QString acceptable( void );
void commit( void );
- const QString & description( void )
- { return Data.Description; }
- RuntimeInfo * runtime( void )
- { if( RT == 0 )
- RT = new ProfileRun( this, Data );
- return RT;
- }
-
virtual void * data( void )
{ return (void *)&Data; }
- virtual bool hasDataFor( const QString & )
- { return 0; }
+ virtual short generateFileEmbedded( const QString & ID,
+ const QString & Path,
+ QTextStream & TS,
+ long DevNr );
- virtual bool generateDataForCommonFile(
- SystemFile & SF, long DevNr);
+ const QString & description( void )
+ { return Data.Description; }
protected :
virtual void setSpecificAttribute( QString & Attr, QString & Value );
virtual void saveSpecificAttribute( QTextStream & TS );
private :
ProfileEdit * GUI;
ProfileData Data;
ProfileRun * RT;