summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/cable
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/cable
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/cable') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/networksettings2/cable/cable_NN.cpp11
-rw-r--r--noncore/settings/networksettings2/cable/cable_NN.h8
-rw-r--r--noncore/settings/networksettings2/cable/cable_NNI.cpp30
-rw-r--r--noncore/settings/networksettings2/cable/cable_NNI.h20
-rw-r--r--noncore/settings/networksettings2/cable/cablerun.cpp6
-rw-r--r--noncore/settings/networksettings2/cable/cablerun.h8
6 files changed, 42 insertions, 41 deletions
diff --git a/noncore/settings/networksettings2/cable/cable_NN.cpp b/noncore/settings/networksettings2/cable/cable_NN.cpp
index b8c690b..38568df 100644
--- a/noncore/settings/networksettings2/cable/cable_NN.cpp
+++ b/noncore/settings/networksettings2/cable/cable_NN.cpp
@@ -33,23 +33,12 @@ const char ** CableNetNode::needs( void ) {
33} 33}
34 34
35const char * CableNetNode::provides( void ) { 35const char * CableNetNode::provides( void ) {
36 return "line"; 36 return "line";
37} 37}
38 38
39bool CableNetNode::generateProperFilesFor(
40 ANetNodeInstance * ) {
41 return 0;
42}
43
44bool CableNetNode::generateDeviceDataForCommonFile(
45 SystemFile & ,
46 long ) {
47 return 0;
48}
49
50void CableNetNode::setSpecificAttribute( QString & , QString & ) { 39void CableNetNode::setSpecificAttribute( QString & , QString & ) {
51} 40}
52 41
53void CableNetNode::saveSpecificAttribute( QTextStream & ) { 42void CableNetNode::saveSpecificAttribute( QTextStream & ) {
54} 43}
55 44
diff --git a/noncore/settings/networksettings2/cable/cable_NN.h b/noncore/settings/networksettings2/cable/cable_NN.h
index c48037a..5cc2b2d 100644
--- a/noncore/settings/networksettings2/cable/cable_NN.h
+++ b/noncore/settings/networksettings2/cable/cable_NN.h
@@ -15,24 +15,16 @@ public:
15 virtual ~CableNetNode(); 15 virtual ~CableNetNode();
16 16
17 virtual const QString pixmapName() 17 virtual const QString pixmapName()
18 { return "Devices/cable"; } 18 { return "Devices/cable"; }
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
diff --git a/noncore/settings/networksettings2/cable/cable_NNI.cpp b/noncore/settings/networksettings2/cable/cable_NNI.cpp
index ca21135..4bd9421 100644
--- a/noncore/settings/networksettings2/cable/cable_NNI.cpp
+++ b/noncore/settings/networksettings2/cable/cable_NNI.cpp
@@ -46,12 +46,35 @@ void ACable::saveSpecificAttribute( QTextStream & TS ) {
46 TS << "hardwarecontrol=" << 46 TS << "hardwarecontrol=" <<
47 ((Data.HardwareControl) ? "yes" : "no") << endl; 47 ((Data.HardwareControl) ? "yes" : "no") << endl;
48 TS << "softwarecontrol=" << 48 TS << "softwarecontrol=" <<
49 ((Data.SoftwareControl) ? "yes" : "no") << endl; 49 ((Data.SoftwareControl) ? "yes" : "no") << endl;
50} 50}
51 51
52short ACable::generateFileEmbedded( const QString & ID,
53 const QString & Path,
54 QTextStream & TS,
55 long DevNr ) {
56 short rvl, rvd;
57
58 rvl = 1;
59 if( ID == "peers" ) {
60 TS << Data.Device
61 << endl;
62 TS << Data.Speed
63 << endl;
64 TS << "lock "
65 << Data.LockFile
66 << endl;
67 rvl = 0;
68 }
69
70 rvd = ANetNodeInstance::generateFileEmbedded( ID, Path, TS, DevNr );
71 return (rvd == 2 || rvl == 2 ) ? 2 :
72 (rvd == 0 || rvl == 0 ) ? 0 : 1;
73}
74
52QWidget * ACable::edit( QWidget * parent ) { 75QWidget * ACable::edit( QWidget * parent ) {
53 GUI = new CableEdit( parent ); 76 GUI = new CableEdit( parent );
54 GUI->showData( Data ); 77 GUI->showData( Data );
55 return GUI; 78 return GUI;
56} 79}
57 80
@@ -61,13 +84,6 @@ QString ACable::acceptable( void ) {
61 84
62void ACable::commit( void ) { 85void ACable::commit( void ) {
63 if( GUI && GUI->commit( Data ) ) { 86 if( GUI && GUI->commit( Data ) ) {
64 setModified( 1 ); 87 setModified( 1 );
65 } 88 }
66} 89}
67
68bool ACable::generateDataForCommonFile(
69 SystemFile & ,
70 long ) {
71 return 1;
72}
73
diff --git a/noncore/settings/networksettings2/cable/cable_NNI.h b/noncore/settings/networksettings2/cable/cable_NNI.h
index bf3e292..d06cbbe 100644
--- a/noncore/settings/networksettings2/cable/cable_NNI.h
+++ b/noncore/settings/networksettings2/cable/cable_NNI.h
@@ -11,30 +11,28 @@ class CableEdit;
11class ACable : public ANetNodeInstance { 11class ACable : public ANetNodeInstance {
12 12
13public : 13public :
14 14
15 ACable( CableNetNode * PNN ); 15 ACable( CableNetNode * PNN );
16 16
17 RuntimeInfo * runtime( void )
18 { return
19 ( RT ) ? RT : ( RT = new CableRun( 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 RuntimeInfo * runtime( void )
22 { if( RT == 0 )
23 RT = new CableRun( this, Data );
24 return RT;
25 }
26
27 virtual void * data( void ) 26 virtual void * data( void )
28 { return (void *)&Data; } 27 { return (void *)&Data; }
29 28
30 virtual bool hasDataFor( const QString & ) 29 short generateFileEmbedded( const QString & ID,
31 { return 0; } 30 const QString & Path,
32 virtual bool generateDataForCommonFile( 31 QTextStream & TS,
33 SystemFile & SF, long DevNr ); 32 long DevNr );
34
35protected : 33protected :
36 34
37 virtual void setSpecificAttribute( QString & Attr, QString & Value ); 35 virtual void setSpecificAttribute( QString & Attr, QString & Value );
38 virtual void saveSpecificAttribute( QTextStream & TS ); 36 virtual void saveSpecificAttribute( QTextStream & TS );
39 37
40private : 38private :
diff --git a/noncore/settings/networksettings2/cable/cablerun.cpp b/noncore/settings/networksettings2/cable/cablerun.cpp
index 5e99237..85660f6 100644
--- a/noncore/settings/networksettings2/cable/cablerun.cpp
+++ b/noncore/settings/networksettings2/cable/cablerun.cpp
@@ -1,13 +1,13 @@
1#include <fcntl.h> 1#include <fcntl.h>
2#include <unistd.h> 2#include <unistd.h>
3#include "cablerun.h" 3#include "cablerun.h"
4 4
5void CableRun::detectState( NodeCollection * NC ) { 5void CableRun::detectState( NodeCollection * NC ) {
6 6
7 int fd = open( D->Device.latin1(), O_RDWR ); 7 int fd = open( Data->Device.latin1(), O_RDWR );
8 8
9 if( fd < 0 ) { 9 if( fd < 0 ) {
10 NC->setCurrentState( Unavailable ); 10 NC->setCurrentState( Unavailable );
11 } 11 }
12 close( fd ); 12 close( fd );
13 NC->setCurrentState( Available ); 13 NC->setCurrentState( Available );
@@ -21,6 +21,10 @@ bool CableRun::setState( NodeCollection * NC, Action_t A, bool ) {
21 return 1; 21 return 1;
22} 22}
23 23
24bool CableRun::canSetState( State_t , Action_t ) { 24bool CableRun::canSetState( State_t , Action_t ) {
25 return 1; 25 return 1;
26} 26}
27
28QString CableRun::deviceFile( void ) {
29 return Data->Device;
30}
diff --git a/noncore/settings/networksettings2/cable/cablerun.h b/noncore/settings/networksettings2/cable/cablerun.h
index c5b59d5..20608f6 100644
--- a/noncore/settings/networksettings2/cable/cablerun.h
+++ b/noncore/settings/networksettings2/cable/cablerun.h
@@ -3,22 +3,24 @@
3 3
4class CableRun : public AsLine { 4class CableRun : public AsLine {
5 5
6public : 6public :
7 7
8 CableRun( ANetNodeInstance * NNI, 8 CableRun( ANetNodeInstance * NNI,
9 CableData & Data ) : AsLine( NNI ) 9 CableData_t & D ) : AsLine( NNI )
10 { D = &Data; } 10 { Data = &D; }
11 11
12 virtual AsLine * asLine( void ) 12 virtual AsLine * asLine( void )
13 { return (AsLine *)this; } 13 { return (AsLine *)this; }
14 14
15 virtual QString deviceFile( void );
16
15protected : 17protected :
16 18
17 void detectState( NodeCollection * NC ); 19 void detectState( NodeCollection * NC );
18 bool setState( NodeCollection * NC, Action_t A, bool Force ); 20 bool setState( NodeCollection * NC, Action_t A, bool Force );
19 bool canSetState( State_t Curr, Action_t A ); 21 bool canSetState( State_t Curr, Action_t A );
20 22
21private : 23private :
22 24
23 CableData_t * D; 25 CableData_t * Data;
24}; 26};