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) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/cable/cable_NN.cpp11
-rw-r--r--noncore/settings/networksettings2/cable/cable_NN.h26
-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, 51 insertions, 50 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
@@ -36,17 +36,6 @@ const 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
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
@@ -7,28 +7,20 @@ class ACable;
7 7
8class CableNetNode : public ANetNode { 8class CableNetNode : public ANetNode {
9 9
10 Q_OBJECT 10 Q_OBJECT
11 11
12public: 12public:
13 13
14 CableNetNode(); 14 CableNetNode();
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 21 virtual ANetNodeInstance * createInstance( void );
22 virtual ANetNodeInstance * createInstance( void ); 22 virtual const char ** needs( void );
23 23 virtual const char * provides( void );
24 virtual const char ** needs( void );
25 virtual const char * provides( void );
26
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 24
33private: 25private:
34 26
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
@@ -49,6 +49,29 @@ void ACable::saveSpecificAttribute( QTextStream & TS ) {
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 );
@@ -64,10 +87,3 @@ void ACable::commit( void ) {
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
@@ -14,24 +14,22 @@ public :
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 );
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
@@ -4,7 +4,7 @@
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 );
@@ -24,3 +24,7 @@ bool CableRun::setState( NodeCollection * NC, Action_t A, bool ) {
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
@@ -6,12 +6,14 @@ class CableRun : public AsLine {
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 );
@@ -20,5 +22,5 @@ protected :
20 22
21private : 23private :
22 24
23 CableData_t * D; 25 CableData_t * Data;
24}; 26};