summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/profile
authorwimpie <wimpie>2004-08-12 12:46:55 (UTC)
committer wimpie <wimpie>2004-08-12 12:46:55 (UTC)
commit8f215ba9ceb395f262517855a99d7d2d303ca760 (patch) (unidiff)
treeaa5f9b14c249217b4d3fc30f4771bdaf1c3545d3 /noncore/settings/networksettings2/profile
parentef64880308b5035cc8ca2e4e79325db613af525b (diff)
downloadopie-8f215ba9ceb395f262517855a99d7d2d303ca760.zip
opie-8f215ba9ceb395f262517855a99d7d2d303ca760.tar.gz
opie-8f215ba9ceb395f262517855a99d7d2d303ca760.tar.bz2
MANY changes
- now generates peers/pap-chap secrets files (no chatscript yet) (not all usefull ppp options included yet) - still not ready for prime time yet
Diffstat (limited to 'noncore/settings/networksettings2/profile') (more/less context) (ignore 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 @@
1#include "profile_NN.h" 1#include "profile_NN.h"
2#include "profile_NNI.h" 2#include "profile_NNI.h"
3 3
4static const char * ProfileNeeds[] = 4static const char * ProfileNeeds[] =
5 { "connection", 5 { "connection",
6 0 6 0
7 }; 7 };
8 8
9/** 9/**
10 * Constructor, find all of the possible interfaces 10 * Constructor, find all of the possible interfaces
11 */ 11 */
12ProfileNetNode::ProfileNetNode() : ANetNode( tr("Regular profile")) { 12ProfileNetNode::ProfileNetNode() : ANetNode( tr("Regular connection profile")) {
13} 13}
14 14
15/** 15/**
16 * Delete any interfaces that we own. 16 * Delete any interfaces that we own.
17 */ 17 */
18ProfileNetNode::~ProfileNetNode(){ 18ProfileNetNode::~ProfileNetNode(){
19} 19}
20 20
21const QString ProfileNetNode::nodeDescription(){ 21const QString ProfileNetNode::nodeDescription(){
22 return tr("\ 22 return tr("\
23<p>Define use of an IP connection.</p>\ 23<p>Define use of an IP connection.</p>\
24<p>Configure if and when this connection needs to be established</p>\ 24<p>Configure if and when this connection needs to be established</p>\
@@ -29,34 +29,23 @@ const QString ProfileNetNode::nodeDescription(){
29ANetNodeInstance * ProfileNetNode::createInstance( void ) { 29ANetNodeInstance * ProfileNetNode::createInstance( void ) {
30 return new AProfile( this ); 30 return new AProfile( this );
31} 31}
32 32
33const char ** ProfileNetNode::needs( void ) { 33const char ** ProfileNetNode::needs( void ) {
34 return ProfileNeeds; 34 return ProfileNeeds;
35} 35}
36 36
37const char * ProfileNetNode::provides( void ) { 37const char * ProfileNetNode::provides( void ) {
38 return "fullsetup"; 38 return "fullsetup";
39} 39}
40 40
41bool ProfileNetNode::generateProperFilesFor(
42 ANetNodeInstance * ) {
43 return 0;
44}
45
46bool ProfileNetNode::generateDeviceDataForCommonFile(
47 SystemFile & ,
48 long ) {
49 return 0;
50}
51
52void ProfileNetNode::setSpecificAttribute( QString & , QString & ) { 41void ProfileNetNode::setSpecificAttribute( QString & , QString & ) {
53} 42}
54 43
55void ProfileNetNode::saveSpecificAttribute( QTextStream & ) { 44void ProfileNetNode::saveSpecificAttribute( QTextStream & ) {
56} 45}
57 46
58extern "C" { 47extern "C" {
59void create_plugin( QList<ANetNode> & PNN ) { 48void create_plugin( QList<ANetNode> & PNN ) {
60 PNN.append( new ProfileNetNode() ); 49 PNN.append( new ProfileNetNode() );
61} 50}
62} 51}
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{
9 9
10 Q_OBJECT 10 Q_OBJECT
11 11
12public: 12public:
13 13
14 ProfileNetNode(); 14 ProfileNetNode();
15 virtual ~ProfileNetNode(); 15 virtual ~ProfileNetNode();
16 16
17 virtual const QString pixmapName() 17 virtual const QString pixmapName()
18 { return "Devices/commprofile"; } 18 { return "Devices/commprofile"; }
19 19
20 virtual const QString nodeDescription() ; 20 virtual const QString nodeDescription() ;
21
22 virtual ANetNodeInstance * createInstance( void ); 21 virtual ANetNodeInstance * createInstance( void );
23
24 virtual const char ** needs( void ); 22 virtual const char ** needs( void );
25 virtual const char * provides( void ); 23 virtual const char * provides( void );
26 24
27 virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
28 virtual bool hasDataFor( const QString & )
29 { return 0; }
30 virtual bool generateDeviceDataForCommonFile(
31 SystemFile & SF, long DevNr);
32
33private: 25private:
34 26
35 virtual void setSpecificAttribute( QString & Attr, QString & Value ); 27 virtual void setSpecificAttribute( QString & Attr, QString & Value );
36 virtual void saveSpecificAttribute( QTextStream & TS ); 28 virtual void saveSpecificAttribute( QTextStream & TS );
37}; 29};
38 30
39extern "C" 31extern "C"
40{ 32{
41 void create_plugin( QList<ANetNode> & PNN ); 33 void create_plugin( QList<ANetNode> & PNN );
42}; 34};
43 35
44#endif 36#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 ) {
41 return GUI; 41 return GUI;
42} 42}
43 43
44QString AProfile::acceptable( void ) { 44QString AProfile::acceptable( void ) {
45 return ( GUI ) ? GUI->acceptable( ) : QString(); 45 return ( GUI ) ? GUI->acceptable( ) : QString();
46} 46}
47 47
48void AProfile::commit( void ) { 48void AProfile::commit( void ) {
49 if( GUI && GUI->commit( Data ) ) 49 if( GUI && GUI->commit( Data ) )
50 setModified( 1 ); 50 setModified( 1 );
51} 51}
52 52
53bool AProfile::generateDataForCommonFile( 53short AProfile::generateFileEmbedded( const QString & ID,
54 SystemFile & , 54 const QString & Path,
55 long) { 55 QTextStream & TS,
56 return 1; 56 long DevNr ) {
57
58 short rvl, rvd;
59
60 rvl = 1;
61
62 if( ID == "interfaces" ) {
63 Log(("Generate Profile for %s\n", ID.latin1() ));
64 if( Data.TriggerVPN ) {
65 // this profile triggers VPN -> insert trigger
66 TS << " up networksettings2 --triggervpn"
67 << endl;
68 rvl = 0;
69 }
70 }
71 rvd = ANetNodeInstance::generateFileEmbedded( ID, Path, TS, DevNr );
72 return (rvd == 2 || rvl == 2 ) ? 2 :
73 (rvd == 0 || rvl == 0 ) ? 0 : 1;
57} 74}
58 75
76
77
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 @@
5#include "profiledata.h" 5#include "profiledata.h"
6#include "profilerun.h" 6#include "profilerun.h"
7 7
8class ProfileNetNode; 8class ProfileNetNode;
9class ProfileEdit; 9class ProfileEdit;
10 10
11class AProfile : public ANetNodeInstance { 11class AProfile : public ANetNodeInstance {
12 12
13public : 13public :
14 14
15 AProfile( ProfileNetNode * PNN ); 15 AProfile( ProfileNetNode * PNN );
16 16
17 RuntimeInfo * runtime( void )
18 { return
19 ( RT ) ? RT : ( RT = new ProfileRun( this, Data ) );
20 }
21
17 QWidget * edit( QWidget * parent ); 22 QWidget * edit( QWidget * parent );
18 QString acceptable( void ); 23 QString acceptable( void );
19 void commit( void ); 24 void commit( void );
20 25
21 const QString & description( void )
22 { return Data.Description; }
23 RuntimeInfo * runtime( void )
24 { if( RT == 0 )
25 RT = new ProfileRun( this, Data );
26 return RT;
27 }
28
29 virtual void * data( void ) 26 virtual void * data( void )
30 { return (void *)&Data; } 27 { return (void *)&Data; }
31 28
32 virtual bool hasDataFor( const QString & ) 29 virtual short generateFileEmbedded( const QString & ID,
33 { return 0; } 30 const QString & Path,
31 QTextStream & TS,
32 long DevNr );
34 33
35 virtual bool generateDataForCommonFile( 34 const QString & description( void )
36 SystemFile & SF, long DevNr); 35 { return Data.Description; }
37 36
38protected : 37protected :
39 38
40 virtual void setSpecificAttribute( QString & Attr, QString & Value ); 39 virtual void setSpecificAttribute( QString & Attr, QString & Value );
41 virtual void saveSpecificAttribute( QTextStream & TS ); 40 virtual void saveSpecificAttribute( QTextStream & TS );
42 41
43private : 42private :
44 43
45 ProfileEdit * GUI; 44 ProfileEdit * GUI;
46 ProfileData Data; 45 ProfileData Data;
47 ProfileRun * RT; 46 ProfileRun * RT;
48 47