author | wimpie <wimpie> | 2004-04-02 18:30:55 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2004-04-02 18:30:55 (UTC) |
commit | 4ea2f227d3fb0d9591bb4f18555420ac47f3397d (patch) (unidiff) | |
tree | 4fdd216cf7af4a747e2ca71e35d15f3d9e646333 | |
parent | 5334b639c9f97793bcae4f50f7b47c7a2ada4e2f (diff) | |
download | opie-4ea2f227d3fb0d9591bb4f18555420ac47f3397d.zip opie-4ea2f227d3fb0d9591bb4f18555420ac47f3397d.tar.gz opie-4ea2f227d3fb0d9591bb4f18555420ac47f3397d.tar.bz2 |
first import of NS2 app
64 files changed, 3150 insertions, 0 deletions
diff --git a/noncore/settings/networksettings2/bluetooth/bluetooth.pro b/noncore/settings/networksettings2/bluetooth/bluetooth.pro new file mode 100644 index 0000000..180bda9 --- a/dev/null +++ b/noncore/settings/networksettings2/bluetooth/bluetooth.pro | |||
@@ -0,0 +1,21 @@ | |||
1 | TEMPLATE = lib | ||
2 | CONFIG += qt warn_on release | ||
3 | DESTDIR = $(OPIEDIR)/plugins/networksettings2 | ||
4 | HEADERS = bluetooth_NN.h \ | ||
5 | bluetoothBNEP_NNI.h \ | ||
6 | bluetoothRFCOMM_NNI.h \ | ||
7 | bluetoothBNEPedit.h \ | ||
8 | bluetoothRFCOMMedit.h | ||
9 | SOURCES = bluetooth_NN.cpp \ | ||
10 | bluetoothBNEP_NNI.cpp \ | ||
11 | bluetoothRFCOMM_NNI.cpp \ | ||
12 | bluetoothBNEPedit.cpp \ | ||
13 | bluetoothRFCOMMedit.cpp | ||
14 | INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2 | ||
15 | DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2 | ||
16 | LIBS += -lqpe | ||
17 | INTERFACES= bluetoothBNEPGUI.ui bluetoothRFCOMMGUI.ui | ||
18 | TARGET = bluetooth | ||
19 | VERSION = 1.0.0 | ||
20 | |||
21 | include ( $(OPIEDIR)/include.pro ) | ||
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothBNEPGUI.ui b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPGUI.ui new file mode 100644 index 0000000..ddb5ddd --- a/dev/null +++ b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPGUI.ui | |||
@@ -0,0 +1,131 @@ | |||
1 | <!DOCTYPE UI><UI> | ||
2 | <class>BluetoothBNEPGUI</class> | ||
3 | <widget> | ||
4 | <class>QWidget</class> | ||
5 | <property stdset="1"> | ||
6 | <name>name</name> | ||
7 | <cstring>BluetoothBNEP_FRM</cstring> | ||
8 | </property> | ||
9 | <property stdset="1"> | ||
10 | <name>geometry</name> | ||
11 | <rect> | ||
12 | <x>0</x> | ||
13 | <y>0</y> | ||
14 | <width>283</width> | ||
15 | <height>199</height> | ||
16 | </rect> | ||
17 | </property> | ||
18 | <property stdset="1"> | ||
19 | <name>caption</name> | ||
20 | <string>Bluetooth-bnep</string> | ||
21 | </property> | ||
22 | <property> | ||
23 | <name>layoutMargin</name> | ||
24 | </property> | ||
25 | <property> | ||
26 | <name>layoutSpacing</name> | ||
27 | </property> | ||
28 | <vbox> | ||
29 | <property stdset="1"> | ||
30 | <name>margin</name> | ||
31 | <number>2</number> | ||
32 | </property> | ||
33 | <property stdset="1"> | ||
34 | <name>spacing</name> | ||
35 | <number>2</number> | ||
36 | </property> | ||
37 | <widget> | ||
38 | <class>QLayoutWidget</class> | ||
39 | <property stdset="1"> | ||
40 | <name>name</name> | ||
41 | <cstring>Layout4</cstring> | ||
42 | </property> | ||
43 | <hbox> | ||
44 | <property stdset="1"> | ||
45 | <name>margin</name> | ||
46 | <number>0</number> | ||
47 | </property> | ||
48 | <property stdset="1"> | ||
49 | <name>spacing</name> | ||
50 | <number>6</number> | ||
51 | </property> | ||
52 | <widget> | ||
53 | <class>QLabel</class> | ||
54 | <property stdset="1"> | ||
55 | <name>name</name> | ||
56 | <cstring>TextLabel4</cstring> | ||
57 | </property> | ||
58 | <property stdset="1"> | ||
59 | <name>text</name> | ||
60 | <string>Name</string> | ||
61 | </property> | ||
62 | </widget> | ||
63 | <widget> | ||
64 | <class>QLineEdit</class> | ||
65 | <property stdset="1"> | ||
66 | <name>name</name> | ||
67 | <cstring>Name_LE</cstring> | ||
68 | </property> | ||
69 | </widget> | ||
70 | </hbox> | ||
71 | </widget> | ||
72 | <widget> | ||
73 | <class>QLabel</class> | ||
74 | <property stdset="1"> | ||
75 | <name>name</name> | ||
76 | <cstring>TextLabel3</cstring> | ||
77 | </property> | ||
78 | <property stdset="1"> | ||
79 | <name>text</name> | ||
80 | <string>Description</string> | ||
81 | </property> | ||
82 | </widget> | ||
83 | <widget> | ||
84 | <class>QMultiLineEdit</class> | ||
85 | <property stdset="1"> | ||
86 | <name>name</name> | ||
87 | <cstring>Description_LE</cstring> | ||
88 | </property> | ||
89 | </widget> | ||
90 | <widget> | ||
91 | <class>QLayoutWidget</class> | ||
92 | <property stdset="1"> | ||
93 | <name>name</name> | ||
94 | <cstring>Layout5</cstring> | ||
95 | </property> | ||
96 | <hbox> | ||
97 | <property stdset="1"> | ||
98 | <name>margin</name> | ||
99 | <number>0</number> | ||
100 | </property> | ||
101 | <property stdset="1"> | ||
102 | <name>spacing</name> | ||
103 | <number>6</number> | ||
104 | </property> | ||
105 | <widget> | ||
106 | <class>QCheckBox</class> | ||
107 | <property stdset="1"> | ||
108 | <name>name</name> | ||
109 | <cstring>Automatic_CB</cstring> | ||
110 | </property> | ||
111 | <property stdset="1"> | ||
112 | <name>text</name> | ||
113 | <string>Start automatically</string> | ||
114 | </property> | ||
115 | </widget> | ||
116 | <widget> | ||
117 | <class>QCheckBox</class> | ||
118 | <property stdset="1"> | ||
119 | <name>name</name> | ||
120 | <cstring>Confirm_CB</cstring> | ||
121 | </property> | ||
122 | <property stdset="1"> | ||
123 | <name>text</name> | ||
124 | <string>Confirm before start</string> | ||
125 | </property> | ||
126 | </widget> | ||
127 | </hbox> | ||
128 | </widget> | ||
129 | </vbox> | ||
130 | </widget> | ||
131 | </UI> | ||
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NNI.cpp b/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NNI.cpp new file mode 100644 index 0000000..1743c1d --- a/dev/null +++ b/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NNI.cpp | |||
@@ -0,0 +1,29 @@ | |||
1 | #include "bluetoothBNEPedit.h" | ||
2 | #include "bluetoothBNEP_NNI.h" | ||
3 | #include "bluetooth_NN.h" | ||
4 | |||
5 | ABluetoothBNEP::ABluetoothBNEP( BluetoothBNEPNetNode * PNN ) : ANetNodeInstance( PNN ) { | ||
6 | GUI = 0; | ||
7 | RT = 0; | ||
8 | } | ||
9 | |||
10 | void ABluetoothBNEP::setSpecificAttribute( QString & , QString & ) { | ||
11 | } | ||
12 | |||
13 | void ABluetoothBNEP::saveSpecificAttribute( QTextStream & ) { | ||
14 | } | ||
15 | |||
16 | QWidget * ABluetoothBNEP::edit( QWidget * parent ) { | ||
17 | GUI = new BluetoothBNEPEdit( parent ); | ||
18 | GUI->showData( Data ); | ||
19 | return GUI; | ||
20 | } | ||
21 | |||
22 | QString ABluetoothBNEP::acceptable( void ) { | ||
23 | return ( GUI ) ? GUI->acceptable( ) : QString(); | ||
24 | } | ||
25 | |||
26 | void ABluetoothBNEP::commit( void ) { | ||
27 | if( GUI && GUI->commit( Data ) ) | ||
28 | setModified( 1 ); | ||
29 | } | ||
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NNI.h b/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NNI.h new file mode 100644 index 0000000..a21f574 --- a/dev/null +++ b/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NNI.h | |||
@@ -0,0 +1,43 @@ | |||
1 | #ifndef BLUETOOTHBNEP_H | ||
2 | #define BLUETOOTHBNEP_H | ||
3 | |||
4 | #include <netnode.h> | ||
5 | #include "bluetoothBNEPdata.h" | ||
6 | #include "bluetoothBNEPrun.h" | ||
7 | |||
8 | class BluetoothBNEPNetNode; | ||
9 | class BluetoothBNEPEdit; | ||
10 | |||
11 | class ABluetoothBNEP : public ANetNodeInstance { | ||
12 | |||
13 | public : | ||
14 | |||
15 | ABluetoothBNEP( BluetoothBNEPNetNode * PNN ); | ||
16 | |||
17 | QWidget * edit( QWidget * parent ); | ||
18 | QString acceptable( void ); | ||
19 | void commit( void ); | ||
20 | |||
21 | RuntimeInfo * runtime( void ) | ||
22 | { if( RT == 0 ) | ||
23 | RT = new BluetoothBNEPRun( this, Data ); | ||
24 | return RT; | ||
25 | } | ||
26 | |||
27 | virtual void * data( void ) | ||
28 | { return (void *)&Data; } | ||
29 | |||
30 | protected : | ||
31 | |||
32 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | ||
33 | virtual void saveSpecificAttribute( QTextStream & TS ); | ||
34 | |||
35 | private : | ||
36 | |||
37 | BluetoothBNEPEdit * GUI; | ||
38 | BluetoothBNEPData Data; | ||
39 | BluetoothBNEPRun * RT; | ||
40 | |||
41 | }; | ||
42 | |||
43 | #endif | ||
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothBNEPdata.h b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPdata.h new file mode 100644 index 0000000..037b7b1 --- a/dev/null +++ b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPdata.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef BLUETOOTHBNEP_DATA_H | ||
2 | #define BLUETOOTHBNEP_DATA_H | ||
3 | |||
4 | typedef struct BluetoothBNEPData { | ||
5 | long x; | ||
6 | } BluetoothBNEPData_t; | ||
7 | |||
8 | #endif | ||
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothBNEPedit.cpp b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPedit.cpp new file mode 100644 index 0000000..a27f1a7 --- a/dev/null +++ b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPedit.cpp | |||
@@ -0,0 +1,18 @@ | |||
1 | #include <GUIUtils.h> | ||
2 | #include "bluetoothBNEPedit.h" | ||
3 | |||
4 | |||
5 | BluetoothBNEPEdit::BluetoothBNEPEdit( QWidget * Parent ) : BluetoothBNEPGUI( Parent ){ | ||
6 | |||
7 | } | ||
8 | |||
9 | QString BluetoothBNEPEdit::acceptable( void ) { | ||
10 | return QString(); | ||
11 | } | ||
12 | |||
13 | bool BluetoothBNEPEdit::commit( BluetoothBNEPData & Data ) { | ||
14 | return 0; | ||
15 | } | ||
16 | |||
17 | void BluetoothBNEPEdit::showData( BluetoothBNEPData & Data ) { | ||
18 | } | ||
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothBNEPedit.h b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPedit.h new file mode 100644 index 0000000..d546f1e --- a/dev/null +++ b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPedit.h | |||
@@ -0,0 +1,13 @@ | |||
1 | #include "bluetoothBNEPdata.h" | ||
2 | #include "bluetoothBNEPGUI.h" | ||
3 | |||
4 | class BluetoothBNEPEdit : public BluetoothBNEPGUI { | ||
5 | |||
6 | public : | ||
7 | |||
8 | BluetoothBNEPEdit( QWidget * parent ); | ||
9 | |||
10 | QString acceptable( void ); | ||
11 | bool commit( BluetoothBNEPData & Data ); | ||
12 | void showData( BluetoothBNEPData & Data ); | ||
13 | }; | ||
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h new file mode 100644 index 0000000..e65b378 --- a/dev/null +++ b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h | |||
@@ -0,0 +1,32 @@ | |||
1 | #include <asdevice.h> | ||
2 | #include "bluetoothBNEPdata.h" | ||
3 | |||
4 | class BluetoothBNEPRun : public AsDevice { | ||
5 | |||
6 | public : | ||
7 | |||
8 | BluetoothBNEPRun( ANetNodeInstance * NNI, | ||
9 | BluetoothBNEPData & Data ) : AsDevice( NNI ) | ||
10 | { } | ||
11 | |||
12 | virtual long count( void ) | ||
13 | { return 3; } | ||
14 | virtual QString genNic( long nr ) | ||
15 | { QString S; return S.sprintf( "bnep%ld", nr ); } | ||
16 | virtual AsDevice * device( void ) | ||
17 | { return asDevice(); } | ||
18 | |||
19 | protected : | ||
20 | |||
21 | void detectState( NodeCollection * ) | ||
22 | { } | ||
23 | |||
24 | bool setState( NodeCollection * , Action_t ) | ||
25 | { return 0; } | ||
26 | |||
27 | bool canSetState( State_t , Action_t ) | ||
28 | { return 0; } | ||
29 | |||
30 | bool handlesInterface( const QString & ) | ||
31 | { return 0; } | ||
32 | }; | ||
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMGUI.ui b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMGUI.ui new file mode 100644 index 0000000..2754a70 --- a/dev/null +++ b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMGUI.ui | |||
@@ -0,0 +1,131 @@ | |||
1 | <!DOCTYPE UI><UI> | ||
2 | <class>BluetoothRFCOMMGUI</class> | ||
3 | <widget> | ||
4 | <class>QWidget</class> | ||
5 | <property stdset="1"> | ||
6 | <name>name</name> | ||
7 | <cstring>BluetoothRFCOMM_FRM</cstring> | ||
8 | </property> | ||
9 | <property stdset="1"> | ||
10 | <name>geometry</name> | ||
11 | <rect> | ||
12 | <x>0</x> | ||
13 | <y>0</y> | ||
14 | <width>283</width> | ||
15 | <height>199</height> | ||
16 | </rect> | ||
17 | </property> | ||
18 | <property stdset="1"> | ||
19 | <name>caption</name> | ||
20 | <string>Bluetooth-rfcomm</string> | ||
21 | </property> | ||
22 | <property> | ||
23 | <name>layoutMargin</name> | ||
24 | </property> | ||
25 | <property> | ||
26 | <name>layoutSpacing</name> | ||
27 | </property> | ||
28 | <vbox> | ||
29 | <property stdset="1"> | ||
30 | <name>margin</name> | ||
31 | <number>2</number> | ||
32 | </property> | ||
33 | <property stdset="1"> | ||
34 | <name>spacing</name> | ||
35 | <number>2</number> | ||
36 | </property> | ||
37 | <widget> | ||
38 | <class>QLayoutWidget</class> | ||
39 | <property stdset="1"> | ||
40 | <name>name</name> | ||
41 | <cstring>Layout4</cstring> | ||
42 | </property> | ||
43 | <hbox> | ||
44 | <property stdset="1"> | ||
45 | <name>margin</name> | ||
46 | <number>0</number> | ||
47 | </property> | ||
48 | <property stdset="1"> | ||
49 | <name>spacing</name> | ||
50 | <number>6</number> | ||
51 | </property> | ||
52 | <widget> | ||
53 | <class>QLabel</class> | ||
54 | <property stdset="1"> | ||
55 | <name>name</name> | ||
56 | <cstring>TextLabel4</cstring> | ||
57 | </property> | ||
58 | <property stdset="1"> | ||
59 | <name>text</name> | ||
60 | <string>Name</string> | ||
61 | </property> | ||
62 | </widget> | ||
63 | <widget> | ||
64 | <class>QLineEdit</class> | ||
65 | <property stdset="1"> | ||
66 | <name>name</name> | ||
67 | <cstring>Name_LE</cstring> | ||
68 | </property> | ||
69 | </widget> | ||
70 | </hbox> | ||
71 | </widget> | ||
72 | <widget> | ||
73 | <class>QLabel</class> | ||
74 | <property stdset="1"> | ||
75 | <name>name</name> | ||
76 | <cstring>TextLabel3</cstring> | ||
77 | </property> | ||
78 | <property stdset="1"> | ||
79 | <name>text</name> | ||
80 | <string>Description</string> | ||
81 | </property> | ||
82 | </widget> | ||
83 | <widget> | ||
84 | <class>QMultiLineEdit</class> | ||
85 | <property stdset="1"> | ||
86 | <name>name</name> | ||
87 | <cstring>Description_LE</cstring> | ||
88 | </property> | ||
89 | </widget> | ||
90 | <widget> | ||
91 | <class>QLayoutWidget</class> | ||
92 | <property stdset="1"> | ||
93 | <name>name</name> | ||
94 | <cstring>Layout5</cstring> | ||
95 | </property> | ||
96 | <hbox> | ||
97 | <property stdset="1"> | ||
98 | <name>margin</name> | ||
99 | <number>0</number> | ||
100 | </property> | ||
101 | <property stdset="1"> | ||
102 | <name>spacing</name> | ||
103 | <number>6</number> | ||
104 | </property> | ||
105 | <widget> | ||
106 | <class>QCheckBox</class> | ||
107 | <property stdset="1"> | ||
108 | <name>name</name> | ||
109 | <cstring>Automatic_CB</cstring> | ||
110 | </property> | ||
111 | <property stdset="1"> | ||
112 | <name>text</name> | ||
113 | <string>Start automatically</string> | ||
114 | </property> | ||
115 | </widget> | ||
116 | <widget> | ||
117 | <class>QCheckBox</class> | ||
118 | <property stdset="1"> | ||
119 | <name>name</name> | ||
120 | <cstring>Confirm_CB</cstring> | ||
121 | </property> | ||
122 | <property stdset="1"> | ||
123 | <name>text</name> | ||
124 | <string>Confirm before start</string> | ||
125 | </property> | ||
126 | </widget> | ||
127 | </hbox> | ||
128 | </widget> | ||
129 | </vbox> | ||
130 | </widget> | ||
131 | </UI> | ||
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.cpp b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.cpp new file mode 100644 index 0000000..7ec8288 --- a/dev/null +++ b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.cpp | |||
@@ -0,0 +1,30 @@ | |||
1 | #include "bluetoothRFCOMMedit.h" | ||
2 | #include "bluetoothRFCOMM_NNI.h" | ||
3 | #include "bluetooth_NN.h" | ||
4 | |||
5 | ABluetoothRFCOMM::ABluetoothRFCOMM( BluetoothRFCOMMNetNode * PNN ) : ANetNodeInstance( PNN ) { | ||
6 | GUI = 0; | ||
7 | RT = 0; | ||
8 | } | ||
9 | |||
10 | void ABluetoothRFCOMM::setSpecificAttribute( QString & , QString & ) { | ||
11 | } | ||
12 | |||
13 | void ABluetoothRFCOMM::saveSpecificAttribute( QTextStream & ) { | ||
14 | } | ||
15 | |||
16 | |||
17 | QWidget * ABluetoothRFCOMM::edit( QWidget * parent ) { | ||
18 | GUI = new BluetoothRFCOMMEdit( parent ); | ||
19 | GUI->showData( Data ); | ||
20 | return GUI; | ||
21 | } | ||
22 | |||
23 | QString ABluetoothRFCOMM::acceptable( void ) { | ||
24 | return ( GUI ) ? GUI->acceptable( ) : QString(); | ||
25 | } | ||
26 | |||
27 | void ABluetoothRFCOMM::commit( void ) { | ||
28 | if( GUI->commit( Data ) ) | ||
29 | setModified( 1 ); | ||
30 | } | ||
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.h b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.h new file mode 100644 index 0000000..4dd508d --- a/dev/null +++ b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.h | |||
@@ -0,0 +1,42 @@ | |||
1 | #ifndef BLUETOOTHRFCOMM_H | ||
2 | #define BLUETOOTHRFCOMM_H | ||
3 | |||
4 | #include <netnode.h> | ||
5 | #include "bluetoothRFCOMMdata.h" | ||
6 | #include "bluetoothRFCOMMrun.h" | ||
7 | |||
8 | class BluetoothRFCOMMNetNode; | ||
9 | class BluetoothRFCOMMEdit; | ||
10 | |||
11 | class ABluetoothRFCOMM : public ANetNodeInstance { | ||
12 | |||
13 | public : | ||
14 | |||
15 | ABluetoothRFCOMM( BluetoothRFCOMMNetNode * PNN ); | ||
16 | |||
17 | QWidget * edit( QWidget * parent ); | ||
18 | QString acceptable( void ); | ||
19 | void commit( void ); | ||
20 | |||
21 | RuntimeInfo * runtime( void ) | ||
22 | { if( RT ) | ||
23 | RT = new BluetoothRFCOMMRun( this, Data ); | ||
24 | return RT; | ||
25 | } | ||
26 | |||
27 | virtual void * data( void ) | ||
28 | { return (void *)&Data; } | ||
29 | |||
30 | protected : | ||
31 | |||
32 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | ||
33 | virtual void saveSpecificAttribute( QTextStream & TS ); | ||
34 | |||
35 | private : | ||
36 | |||
37 | BluetoothRFCOMMEdit * GUI; | ||
38 | BluetoothRFCOMMData Data; | ||
39 | BluetoothRFCOMMRun * RT; | ||
40 | }; | ||
41 | |||
42 | #endif | ||
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMdata.h b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMdata.h new file mode 100644 index 0000000..18f0d38 --- a/dev/null +++ b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMdata.h | |||
@@ -0,0 +1,18 @@ | |||
1 | #ifndef BLUETOOTHRFCOMM_DATA_H | ||
2 | #define BLUETOOTHRFCOMM_DATA_H | ||
3 | |||
4 | #include <qstring.h> | ||
5 | |||
6 | typedef struct BluetoothRFCOMMData { | ||
7 | QString Device; | ||
8 | QString LockFile; | ||
9 | long Speed; | ||
10 | short Parity; | ||
11 | short DataBits; | ||
12 | short StopBits; | ||
13 | bool HardwareControl; | ||
14 | bool SoftwareControl; | ||
15 | |||
16 | } BluetoothRFCOMMData_t; | ||
17 | |||
18 | #endif | ||
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMedit.cpp b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMedit.cpp new file mode 100644 index 0000000..d3ddab4 --- a/dev/null +++ b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMedit.cpp | |||
@@ -0,0 +1,18 @@ | |||
1 | #include <GUIUtils.h> | ||
2 | #include "bluetoothRFCOMMedit.h" | ||
3 | |||
4 | BluetoothRFCOMMEdit::BluetoothRFCOMMEdit( QWidget * Parent ) : | ||
5 | BluetoothRFCOMMGUI( Parent ){ | ||
6 | |||
7 | } | ||
8 | |||
9 | QString BluetoothRFCOMMEdit::acceptable( void ) { | ||
10 | return QString(); | ||
11 | } | ||
12 | |||
13 | void BluetoothRFCOMMEdit::showData( BluetoothRFCOMMData & Data ) { | ||
14 | } | ||
15 | |||
16 | bool BluetoothRFCOMMEdit::commit( BluetoothRFCOMMData & Data ) { | ||
17 | return 0; | ||
18 | } | ||
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMedit.h b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMedit.h new file mode 100644 index 0000000..14a6d64 --- a/dev/null +++ b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMedit.h | |||
@@ -0,0 +1,13 @@ | |||
1 | #include "bluetoothRFCOMMdata.h" | ||
2 | #include "bluetoothRFCOMMGUI.h" | ||
3 | |||
4 | class BluetoothRFCOMMEdit : public BluetoothRFCOMMGUI { | ||
5 | |||
6 | public : | ||
7 | |||
8 | BluetoothRFCOMMEdit( QWidget * parent ); | ||
9 | |||
10 | QString acceptable( void ); | ||
11 | void showData( BluetoothRFCOMMData & Data ); | ||
12 | bool commit( BluetoothRFCOMMData & Data ); | ||
13 | }; | ||
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h new file mode 100644 index 0000000..87116e2 --- a/dev/null +++ b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h | |||
@@ -0,0 +1,22 @@ | |||
1 | #include <asline.h> | ||
2 | #include "bluetoothRFCOMMdata.h" | ||
3 | |||
4 | class BluetoothRFCOMMRun : public AsLine { | ||
5 | |||
6 | public : | ||
7 | |||
8 | BluetoothRFCOMMRun( ANetNodeInstance * NNI, | ||
9 | BluetoothRFCOMMData & Data ) : AsLine( NNI ) | ||
10 | { } | ||
11 | |||
12 | protected : | ||
13 | |||
14 | void detectState( NodeCollection * ) | ||
15 | { } | ||
16 | |||
17 | bool setState( NodeCollection * , Action_t ) | ||
18 | { return 0; } | ||
19 | |||
20 | bool canSetState( State_t , Action_t ) | ||
21 | { return 0; } | ||
22 | }; | ||
diff --git a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp new file mode 100644 index 0000000..91be153 --- a/dev/null +++ b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp | |||
@@ -0,0 +1,120 @@ | |||
1 | #include "bluetooth_NN.h" | ||
2 | #include "bluetoothBNEP_NNI.h" | ||
3 | #include "bluetoothRFCOMM_NNI.h" | ||
4 | |||
5 | // | ||
6 | // | ||
7 | // BLUETOOTH PAN/NAP node | ||
8 | // | ||
9 | // | ||
10 | |||
11 | static const char * BluetoothBNEPNeeds[] = | ||
12 | { 0 | ||
13 | }; | ||
14 | |||
15 | /** | ||
16 | * Constructor, find all of the possible interfaces | ||
17 | */ | ||
18 | BluetoothBNEPNetNode::BluetoothBNEPNetNode() : ANetNode() { | ||
19 | } | ||
20 | |||
21 | /** | ||
22 | * Delete any interfaces that we own. | ||
23 | */ | ||
24 | BluetoothBNEPNetNode::~BluetoothBNEPNetNode(){ | ||
25 | } | ||
26 | |||
27 | const QString BluetoothBNEPNetNode::nodeDescription(){ | ||
28 | return tr("\ | ||
29 | <p>Sets up a bluetooth link using the bluetooth Network profile.</p>\ | ||
30 | <p>Use this to connect two computing devices.</p>\ | ||
31 | " | ||
32 | ); | ||
33 | } | ||
34 | |||
35 | ANetNodeInstance * BluetoothBNEPNetNode::createInstance( void ) { | ||
36 | return new ABluetoothBNEP( this ); | ||
37 | } | ||
38 | |||
39 | const char ** BluetoothBNEPNetNode::needs( void ) { | ||
40 | return BluetoothBNEPNeeds; | ||
41 | } | ||
42 | |||
43 | const char * BluetoothBNEPNetNode::provides( void ) { | ||
44 | return "device"; | ||
45 | } | ||
46 | |||
47 | bool BluetoothBNEPNetNode::generateProperFilesFor( | ||
48 | ANetNodeInstance * ) { | ||
49 | return 1; | ||
50 | } | ||
51 | |||
52 | bool BluetoothBNEPNetNode::hasDataFor( const QString & ) { | ||
53 | return 0; | ||
54 | } | ||
55 | |||
56 | bool BluetoothBNEPNetNode::generateDataForCommonFile( | ||
57 | SystemFile & , | ||
58 | long , | ||
59 | ANetNodeInstance * ) { | ||
60 | return 1; | ||
61 | } | ||
62 | |||
63 | // | ||
64 | // | ||
65 | // BLUETOOTH PAN/NAP node | ||
66 | // | ||
67 | // | ||
68 | |||
69 | static const char * BluetoothRFCOMMNeeds[] = | ||
70 | { 0 | ||
71 | }; | ||
72 | |||
73 | BluetoothRFCOMMNetNode::BluetoothRFCOMMNetNode() : ANetNode() { | ||
74 | } | ||
75 | |||
76 | BluetoothRFCOMMNetNode::~BluetoothRFCOMMNetNode(){ | ||
77 | } | ||
78 | |||
79 | const QString BluetoothRFCOMMNetNode::nodeDescription(){ | ||
80 | return tr("\ | ||
81 | <p>Sets up a bluetooth link using the bluetooth serial profile.</p>\ | ||
82 | <p>Use this to connect to a GSM.</p>\ | ||
83 | " | ||
84 | ); | ||
85 | } | ||
86 | |||
87 | ANetNodeInstance * BluetoothRFCOMMNetNode::createInstance( void ) { | ||
88 | return new ABluetoothRFCOMM( this ); | ||
89 | } | ||
90 | |||
91 | const char ** BluetoothRFCOMMNetNode::needs( void ) { | ||
92 | return BluetoothRFCOMMNeeds; | ||
93 | } | ||
94 | |||
95 | const char * BluetoothRFCOMMNetNode::provides( void ) { | ||
96 | return "line"; | ||
97 | } | ||
98 | |||
99 | bool BluetoothRFCOMMNetNode::generateProperFilesFor( | ||
100 | ANetNodeInstance * ) { | ||
101 | return 0; | ||
102 | } | ||
103 | |||
104 | bool BluetoothRFCOMMNetNode::hasDataFor( const QString & ) { | ||
105 | return 0; | ||
106 | } | ||
107 | |||
108 | bool BluetoothRFCOMMNetNode::generateDataForCommonFile( | ||
109 | SystemFile & , | ||
110 | long, | ||
111 | ANetNodeInstance * ) { | ||
112 | return 0; | ||
113 | } | ||
114 | |||
115 | extern "C" { | ||
116 | void create_plugin( QList<ANetNode> & PNN ) { | ||
117 | PNN.append( new BluetoothBNEPNetNode() ); | ||
118 | PNN.append( new BluetoothRFCOMMNetNode() ); | ||
119 | } | ||
120 | } | ||
diff --git a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h new file mode 100644 index 0000000..ee346f0 --- a/dev/null +++ b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h | |||
@@ -0,0 +1,75 @@ | |||
1 | #ifndef BLUETOOTH_NETNODE_H | ||
2 | #define BLUETOOTH_NETNODE_H | ||
3 | |||
4 | #include "netnode.h" | ||
5 | |||
6 | class ABluetoothBNEP; | ||
7 | |||
8 | class BluetoothBNEPNetNode : public ANetNode { | ||
9 | |||
10 | Q_OBJECT | ||
11 | |||
12 | public: | ||
13 | |||
14 | BluetoothBNEPNetNode(); | ||
15 | virtual ~BluetoothBNEPNetNode(); | ||
16 | |||
17 | virtual const QString pixmapName() | ||
18 | { return "bluetooth"; } | ||
19 | |||
20 | virtual const QString nodeName() | ||
21 | { return tr("Bluetooth PAN/NAP"); } | ||
22 | |||
23 | virtual const QString nodeDescription() ; | ||
24 | |||
25 | virtual ANetNodeInstance * createInstance( void ); | ||
26 | |||
27 | virtual const char ** needs( void ); | ||
28 | virtual const char * provides( void ); | ||
29 | |||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | ||
31 | virtual bool hasDataFor( const QString & S ); | ||
32 | virtual bool generateDataForCommonFile( | ||
33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | ||
34 | |||
35 | private: | ||
36 | |||
37 | }; | ||
38 | |||
39 | class BluetoothRFCOMMNetNode : public ANetNode { | ||
40 | |||
41 | Q_OBJECT | ||
42 | |||
43 | public: | ||
44 | |||
45 | BluetoothRFCOMMNetNode(); | ||
46 | virtual ~BluetoothRFCOMMNetNode(); | ||
47 | |||
48 | virtual const QString pixmapName() | ||
49 | { return "bluetooth"; } | ||
50 | |||
51 | virtual const QString nodeName() | ||
52 | { return tr("Bluetooth serial link"); } | ||
53 | |||
54 | virtual const QString nodeDescription() ; | ||
55 | |||
56 | virtual ANetNodeInstance * createInstance( void ); | ||
57 | |||
58 | virtual const char ** needs( void ); | ||
59 | virtual const char * provides( void ); | ||
60 | |||
61 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | ||
62 | virtual bool hasDataFor( const QString & S ); | ||
63 | virtual bool generateDataForCommonFile( | ||
64 | SystemFile & SF, long, ANetNodeInstance * NNI ); | ||
65 | |||
66 | private: | ||
67 | |||
68 | }; | ||
69 | |||
70 | extern "C" | ||
71 | { | ||
72 | void create_plugin( QList<ANetNode> & PNN ); | ||
73 | }; | ||
74 | |||
75 | #endif | ||
diff --git a/noncore/settings/networksettings2/bluetooth/config.in b/noncore/settings/networksettings2/bluetooth/config.in new file mode 100644 index 0000000..2b527cc --- a/dev/null +++ b/noncore/settings/networksettings2/bluetooth/config.in | |||
@@ -0,0 +1,4 @@ | |||
1 | config NS2BT | ||
2 | boolean "opie-networksettings2plugin-bluetooth (set up BLUETOOTH)" | ||
3 | default "n" if NS2 | ||
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && NS2 && NS2CORE | ||
diff --git a/noncore/settings/networksettings2/cable/cable.pro b/noncore/settings/networksettings2/cable/cable.pro new file mode 100644 index 0000000..d902360 --- a/dev/null +++ b/noncore/settings/networksettings2/cable/cable.pro | |||
@@ -0,0 +1,18 @@ | |||
1 | TEMPLATE = lib | ||
2 | CONFIG += qt warn_on release | ||
3 | DESTDIR = $(OPIEDIR)/plugins/networksettings2 | ||
4 | HEADERS = cable_NN.h \ | ||
5 | cable_NNI.h \ | ||
6 | cableedit.h | ||
7 | SOURCES = cable_NN.cpp \ | ||
8 | cable_NNI.cpp \ | ||
9 | cableedit.cpp \ | ||
10 | cablerun.cpp | ||
11 | INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2 | ||
12 | DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2 | ||
13 | LIBS += -lqpe | ||
14 | INTERFACES= cableGUI.ui | ||
15 | TARGET = cable | ||
16 | VERSION = 1.0.0 | ||
17 | |||
18 | include ( $(OPIEDIR)/include.pro ) | ||
diff --git a/noncore/settings/networksettings2/cable/cableGUI.ui b/noncore/settings/networksettings2/cable/cableGUI.ui new file mode 100644 index 0000000..2431861 --- a/dev/null +++ b/noncore/settings/networksettings2/cable/cableGUI.ui | |||
@@ -0,0 +1,545 @@ | |||
1 | <!DOCTYPE UI><UI> | ||
2 | <class>CableGUI</class> | ||
3 | <widget> | ||
4 | <class>QWidget</class> | ||
5 | <property stdset="1"> | ||
6 | <name>name</name> | ||
7 | <cstring>Cable_FRM</cstring> | ||
8 | </property> | ||
9 | <property stdset="1"> | ||
10 | <name>geometry</name> | ||
11 | <rect> | ||
12 | <x>0</x> | ||
13 | <y>0</y> | ||
14 | <width>235</width> | ||
15 | <height>194</height> | ||
16 | </rect> | ||
17 | </property> | ||
18 | <property stdset="1"> | ||
19 | <name>caption</name> | ||
20 | <string>Cable</string> | ||
21 | </property> | ||
22 | <property> | ||
23 | <name>layoutMargin</name> | ||
24 | </property> | ||
25 | <property> | ||
26 | <name>layoutSpacing</name> | ||
27 | </property> | ||
28 | <vbox> | ||
29 | <property stdset="1"> | ||
30 | <name>margin</name> | ||
31 | <number>2</number> | ||
32 | </property> | ||
33 | <property stdset="1"> | ||
34 | <name>spacing</name> | ||
35 | <number>2</number> | ||
36 | </property> | ||
37 | <widget> | ||
38 | <class>QLayoutWidget</class> | ||
39 | <property stdset="1"> | ||
40 | <name>name</name> | ||
41 | <cstring>Layout3</cstring> | ||
42 | </property> | ||
43 | <grid> | ||
44 | <property stdset="1"> | ||
45 | <name>margin</name> | ||
46 | <number>0</number> | ||
47 | </property> | ||
48 | <property stdset="1"> | ||
49 | <name>spacing</name> | ||
50 | <number>6</number> | ||
51 | </property> | ||
52 | <widget row="1" column="0" > | ||
53 | <class>QLabel</class> | ||
54 | <property stdset="1"> | ||
55 | <name>name</name> | ||
56 | <cstring>TextLabel1_2</cstring> | ||
57 | </property> | ||
58 | <property stdset="1"> | ||
59 | <name>text</name> | ||
60 | <string>Lock file</string> | ||
61 | </property> | ||
62 | </widget> | ||
63 | <widget row="0" column="0" > | ||
64 | <class>QLabel</class> | ||
65 | <property stdset="1"> | ||
66 | <name>name</name> | ||
67 | <cstring>TextLabel1</cstring> | ||
68 | </property> | ||
69 | <property stdset="1"> | ||
70 | <name>text</name> | ||
71 | <string>Device</string> | ||
72 | </property> | ||
73 | </widget> | ||
74 | <widget row="1" column="1" > | ||
75 | <class>QLineEdit</class> | ||
76 | <property stdset="1"> | ||
77 | <name>name</name> | ||
78 | <cstring>LockFile_LE</cstring> | ||
79 | </property> | ||
80 | </widget> | ||
81 | <widget row="0" column="1" > | ||
82 | <class>QLineEdit</class> | ||
83 | <property stdset="1"> | ||
84 | <name>name</name> | ||
85 | <cstring>DeviceFile_LE</cstring> | ||
86 | </property> | ||
87 | </widget> | ||
88 | </grid> | ||
89 | </widget> | ||
90 | <widget> | ||
91 | <class>QGroupBox</class> | ||
92 | <property stdset="1"> | ||
93 | <name>name</name> | ||
94 | <cstring>GroupBox1</cstring> | ||
95 | </property> | ||
96 | <property stdset="1"> | ||
97 | <name>title</name> | ||
98 | <string>Serial settings</string> | ||
99 | </property> | ||
100 | <property> | ||
101 | <name>layoutMargin</name> | ||
102 | </property> | ||
103 | <property> | ||
104 | <name>layoutSpacing</name> | ||
105 | </property> | ||
106 | <vbox> | ||
107 | <property stdset="1"> | ||
108 | <name>margin</name> | ||
109 | <number>2</number> | ||
110 | </property> | ||
111 | <property stdset="1"> | ||
112 | <name>spacing</name> | ||
113 | <number>2</number> | ||
114 | </property> | ||
115 | <widget> | ||
116 | <class>QLayoutWidget</class> | ||
117 | <property stdset="1"> | ||
118 | <name>name</name> | ||
119 | <cstring>Layout13</cstring> | ||
120 | </property> | ||
121 | <property> | ||
122 | <name>layoutSpacing</name> | ||
123 | </property> | ||
124 | <grid> | ||
125 | <property stdset="1"> | ||
126 | <name>margin</name> | ||
127 | <number>0</number> | ||
128 | </property> | ||
129 | <property stdset="1"> | ||
130 | <name>spacing</name> | ||
131 | <number>2</number> | ||
132 | </property> | ||
133 | <widget row="0" column="1" > | ||
134 | <class>QComboBox</class> | ||
135 | <item> | ||
136 | <property> | ||
137 | <name>text</name> | ||
138 | <string>2400</string> | ||
139 | </property> | ||
140 | </item> | ||
141 | <item> | ||
142 | <property> | ||
143 | <name>text</name> | ||
144 | <string>9600</string> | ||
145 | </property> | ||
146 | </item> | ||
147 | <item> | ||
148 | <property> | ||
149 | <name>text</name> | ||
150 | <string>19200</string> | ||
151 | </property> | ||
152 | </item> | ||
153 | <item> | ||
154 | <property> | ||
155 | <name>text</name> | ||
156 | <string>38400</string> | ||
157 | </property> | ||
158 | </item> | ||
159 | <item> | ||
160 | <property> | ||
161 | <name>text</name> | ||
162 | <string>57600</string> | ||
163 | </property> | ||
164 | </item> | ||
165 | <item> | ||
166 | <property> | ||
167 | <name>text</name> | ||
168 | <string>115200</string> | ||
169 | </property> | ||
170 | </item> | ||
171 | <item> | ||
172 | <property> | ||
173 | <name>text</name> | ||
174 | <string>230400</string> | ||
175 | </property> | ||
176 | </item> | ||
177 | <item> | ||
178 | <property> | ||
179 | <name>text</name> | ||
180 | <string>460800</string> | ||
181 | </property> | ||
182 | </item> | ||
183 | <item> | ||
184 | <property> | ||
185 | <name>text</name> | ||
186 | <string>500000</string> | ||
187 | </property> | ||
188 | </item> | ||
189 | <item> | ||
190 | <property> | ||
191 | <name>text</name> | ||
192 | <string>921600</string> | ||
193 | </property> | ||
194 | </item> | ||
195 | <item> | ||
196 | <property> | ||
197 | <name>text</name> | ||
198 | <string>1000000</string> | ||
199 | </property> | ||
200 | </item> | ||
201 | <item> | ||
202 | <property> | ||
203 | <name>text</name> | ||
204 | <string>1152000</string> | ||
205 | </property> | ||
206 | </item> | ||
207 | <item> | ||
208 | <property> | ||
209 | <name>text</name> | ||
210 | <string>1500000</string> | ||
211 | </property> | ||
212 | </item> | ||
213 | <item> | ||
214 | <property> | ||
215 | <name>text</name> | ||
216 | <string>2000000</string> | ||
217 | </property> | ||
218 | </item> | ||
219 | <item> | ||
220 | <property> | ||
221 | <name>text</name> | ||
222 | <string>2500000</string> | ||
223 | </property> | ||
224 | </item> | ||
225 | <item> | ||
226 | <property> | ||
227 | <name>text</name> | ||
228 | <string>3000000</string> | ||
229 | </property> | ||
230 | </item> | ||
231 | <item> | ||
232 | <property> | ||
233 | <name>text</name> | ||
234 | <string>3500000</string> | ||
235 | </property> | ||
236 | </item> | ||
237 | <item> | ||
238 | <property> | ||
239 | <name>text</name> | ||
240 | <string>4000000</string> | ||
241 | </property> | ||
242 | </item> | ||
243 | <property stdset="1"> | ||
244 | <name>name</name> | ||
245 | <cstring>Speed_CB</cstring> | ||
246 | </property> | ||
247 | <property stdset="1"> | ||
248 | <name>currentItem</name> | ||
249 | <number>5</number> | ||
250 | </property> | ||
251 | </widget> | ||
252 | <widget row="1" column="0" > | ||
253 | <class>QLabel</class> | ||
254 | <property stdset="1"> | ||
255 | <name>name</name> | ||
256 | <cstring>TextLabel2_2</cstring> | ||
257 | </property> | ||
258 | <property stdset="1"> | ||
259 | <name>sizePolicy</name> | ||
260 | <sizepolicy> | ||
261 | <hsizetype>0</hsizetype> | ||
262 | <vsizetype>1</vsizetype> | ||
263 | </sizepolicy> | ||
264 | </property> | ||
265 | <property stdset="1"> | ||
266 | <name>text</name> | ||
267 | <string>Parity</string> | ||
268 | </property> | ||
269 | </widget> | ||
270 | <widget row="0" column="2" > | ||
271 | <class>QLabel</class> | ||
272 | <property stdset="1"> | ||
273 | <name>name</name> | ||
274 | <cstring>TextLabel2_2_3</cstring> | ||
275 | </property> | ||
276 | <property stdset="1"> | ||
277 | <name>sizePolicy</name> | ||
278 | <sizepolicy> | ||
279 | <hsizetype>0</hsizetype> | ||
280 | <vsizetype>1</vsizetype> | ||
281 | </sizepolicy> | ||
282 | </property> | ||
283 | <property stdset="1"> | ||
284 | <name>text</name> | ||
285 | <string>Data bits</string> | ||
286 | </property> | ||
287 | </widget> | ||
288 | <widget row="0" column="0" > | ||
289 | <class>QLabel</class> | ||
290 | <property stdset="1"> | ||
291 | <name>name</name> | ||
292 | <cstring>TextLabel2</cstring> | ||
293 | </property> | ||
294 | <property stdset="1"> | ||
295 | <name>text</name> | ||
296 | <string>Speed</string> | ||
297 | </property> | ||
298 | </widget> | ||
299 | <widget row="1" column="2" > | ||
300 | <class>QLabel</class> | ||
301 | <property stdset="1"> | ||
302 | <name>name</name> | ||
303 | <cstring>TextLabel2_2_3_2</cstring> | ||
304 | </property> | ||
305 | <property stdset="1"> | ||
306 | <name>sizePolicy</name> | ||
307 | <sizepolicy> | ||
308 | <hsizetype>0</hsizetype> | ||
309 | <vsizetype>1</vsizetype> | ||
310 | </sizepolicy> | ||
311 | </property> | ||
312 | <property stdset="1"> | ||
313 | <name>text</name> | ||
314 | <string>Stop bits</string> | ||
315 | </property> | ||
316 | </widget> | ||
317 | <widget row="1" column="1" > | ||
318 | <class>QComboBox</class> | ||
319 | <item> | ||
320 | <property> | ||
321 | <name>text</name> | ||
322 | <string>No</string> | ||
323 | </property> | ||
324 | </item> | ||
325 | <item> | ||
326 | <property> | ||
327 | <name>text</name> | ||
328 | <string>Even</string> | ||
329 | </property> | ||
330 | </item> | ||
331 | <item> | ||
332 | <property> | ||
333 | <name>text</name> | ||
334 | <string>Odd</string> | ||
335 | </property> | ||
336 | </item> | ||
337 | <item> | ||
338 | <property> | ||
339 | <name>text</name> | ||
340 | <string>Mark</string> | ||
341 | </property> | ||
342 | </item> | ||
343 | <item> | ||
344 | <property> | ||
345 | <name>text</name> | ||
346 | <string>Space</string> | ||
347 | </property> | ||
348 | </item> | ||
349 | <property stdset="1"> | ||
350 | <name>name</name> | ||
351 | <cstring>Parity_CB</cstring> | ||
352 | </property> | ||
353 | <property stdset="1"> | ||
354 | <name>sizePolicy</name> | ||
355 | <sizepolicy> | ||
356 | <hsizetype>7</hsizetype> | ||
357 | <vsizetype>0</vsizetype> | ||
358 | </sizepolicy> | ||
359 | </property> | ||
360 | <property stdset="1"> | ||
361 | <name>currentItem</name> | ||
362 | <number>0</number> | ||
363 | </property> | ||
364 | </widget> | ||
365 | <widget row="0" column="3" > | ||
366 | <class>QSpinBox</class> | ||
367 | <property stdset="1"> | ||
368 | <name>name</name> | ||
369 | <cstring>DataBits_SB</cstring> | ||
370 | </property> | ||
371 | <property stdset="1"> | ||
372 | <name>sizePolicy</name> | ||
373 | <sizepolicy> | ||
374 | <hsizetype>7</hsizetype> | ||
375 | <vsizetype>0</vsizetype> | ||
376 | </sizepolicy> | ||
377 | </property> | ||
378 | <property stdset="1"> | ||
379 | <name>maxValue</name> | ||
380 | <number>8</number> | ||
381 | </property> | ||
382 | <property stdset="1"> | ||
383 | <name>minValue</name> | ||
384 | <number>5</number> | ||
385 | </property> | ||
386 | <property stdset="1"> | ||
387 | <name>value</name> | ||
388 | <number>8</number> | ||
389 | </property> | ||
390 | </widget> | ||
391 | <widget row="1" column="3" > | ||
392 | <class>QComboBox</class> | ||
393 | <item> | ||
394 | <property> | ||
395 | <name>text</name> | ||
396 | <string>1</string> | ||
397 | </property> | ||
398 | </item> | ||
399 | <item> | ||
400 | <property> | ||
401 | <name>text</name> | ||
402 | <string>2</string> | ||
403 | </property> | ||
404 | </item> | ||
405 | <property stdset="1"> | ||
406 | <name>name</name> | ||
407 | <cstring>StopBits_CB</cstring> | ||
408 | </property> | ||
409 | <property stdset="1"> | ||
410 | <name>sizePolicy</name> | ||
411 | <sizepolicy> | ||
412 | <hsizetype>7</hsizetype> | ||
413 | <vsizetype>0</vsizetype> | ||
414 | </sizepolicy> | ||
415 | </property> | ||
416 | </widget> | ||
417 | </grid> | ||
418 | </widget> | ||
419 | <widget> | ||
420 | <class>QLayoutWidget</class> | ||
421 | <property stdset="1"> | ||
422 | <name>name</name> | ||
423 | <cstring>Layout17</cstring> | ||
424 | </property> | ||
425 | <property> | ||
426 | <name>layoutSpacing</name> | ||
427 | </property> | ||
428 | <hbox> | ||
429 | <property stdset="1"> | ||
430 | <name>margin</name> | ||
431 | <number>0</number> | ||
432 | </property> | ||
433 | <property stdset="1"> | ||
434 | <name>spacing</name> | ||
435 | <number>2</number> | ||
436 | </property> | ||
437 | <widget> | ||
438 | <class>QLabel</class> | ||
439 | <property stdset="1"> | ||
440 | <name>name</name> | ||
441 | <cstring>TextLabel3</cstring> | ||
442 | </property> | ||
443 | <property stdset="1"> | ||
444 | <name>sizePolicy</name> | ||
445 | <sizepolicy> | ||
446 | <hsizetype>0</hsizetype> | ||
447 | <vsizetype>1</vsizetype> | ||
448 | </sizepolicy> | ||
449 | </property> | ||
450 | <property stdset="1"> | ||
451 | <name>text</name> | ||
452 | <string>Flow control :</string> | ||
453 | </property> | ||
454 | <property stdset="1"> | ||
455 | <name>alignment</name> | ||
456 | <set>AlignTop|AlignLeft</set> | ||
457 | </property> | ||
458 | <property> | ||
459 | <name>vAlign</name> | ||
460 | </property> | ||
461 | </widget> | ||
462 | <widget> | ||
463 | <class>QLayoutWidget</class> | ||
464 | <property stdset="1"> | ||
465 | <name>name</name> | ||
466 | <cstring>Layout16</cstring> | ||
467 | </property> | ||
468 | <property> | ||
469 | <name>layoutSpacing</name> | ||
470 | </property> | ||
471 | <vbox> | ||
472 | <property stdset="1"> | ||
473 | <name>margin</name> | ||
474 | <number>0</number> | ||
475 | </property> | ||
476 | <property stdset="1"> | ||
477 | <name>spacing</name> | ||
478 | <number>2</number> | ||
479 | </property> | ||
480 | <widget> | ||
481 | <class>QCheckBox</class> | ||
482 | <property stdset="1"> | ||
483 | <name>name</name> | ||
484 | <cstring>HardwareFC_CB</cstring> | ||
485 | </property> | ||
486 | <property stdset="1"> | ||
487 | <name>sizePolicy</name> | ||
488 | <sizepolicy> | ||
489 | <hsizetype>7</hsizetype> | ||
490 | <vsizetype>0</vsizetype> | ||
491 | </sizepolicy> | ||
492 | </property> | ||
493 | <property stdset="1"> | ||
494 | <name>text</name> | ||
495 | <string>Hardware</string> | ||
496 | </property> | ||
497 | </widget> | ||
498 | <widget> | ||
499 | <class>QCheckBox</class> | ||
500 | <property stdset="1"> | ||
501 | <name>name</name> | ||
502 | <cstring>SoftwareFC_CB</cstring> | ||
503 | </property> | ||
504 | <property stdset="1"> | ||
505 | <name>sizePolicy</name> | ||
506 | <sizepolicy> | ||
507 | <hsizetype>7</hsizetype> | ||
508 | <vsizetype>0</vsizetype> | ||
509 | </sizepolicy> | ||
510 | </property> | ||
511 | <property stdset="1"> | ||
512 | <name>text</name> | ||
513 | <string>Software</string> | ||
514 | </property> | ||
515 | </widget> | ||
516 | </vbox> | ||
517 | </widget> | ||
518 | </hbox> | ||
519 | </widget> | ||
520 | </vbox> | ||
521 | </widget> | ||
522 | <spacer> | ||
523 | <property> | ||
524 | <name>name</name> | ||
525 | <cstring>Spacer6</cstring> | ||
526 | </property> | ||
527 | <property stdset="1"> | ||
528 | <name>orientation</name> | ||
529 | <enum>Vertical</enum> | ||
530 | </property> | ||
531 | <property stdset="1"> | ||
532 | <name>sizeType</name> | ||
533 | <enum>Expanding</enum> | ||
534 | </property> | ||
535 | <property> | ||
536 | <name>sizeHint</name> | ||
537 | <size> | ||
538 | <width>20</width> | ||
539 | <height>20</height> | ||
540 | </size> | ||
541 | </property> | ||
542 | </spacer> | ||
543 | </vbox> | ||
544 | </widget> | ||
545 | </UI> | ||
diff --git a/noncore/settings/networksettings2/cable/cable_NN.cpp b/noncore/settings/networksettings2/cable/cable_NN.cpp new file mode 100644 index 0000000..756903e --- a/dev/null +++ b/noncore/settings/networksettings2/cable/cable_NN.cpp | |||
@@ -0,0 +1,59 @@ | |||
1 | #include "cable_NN.h" | ||
2 | #include "cable_NNI.h" | ||
3 | |||
4 | static const char * CableNeeds[] = | ||
5 | { 0 | ||
6 | }; | ||
7 | |||
8 | /** | ||
9 | * Constructor, find all of the possible interfaces | ||
10 | */ | ||
11 | CableNetNode::CableNetNode() : ANetNode() { | ||
12 | } | ||
13 | |||
14 | /** | ||
15 | * Delete any interfaces that we own. | ||
16 | */ | ||
17 | CableNetNode::~CableNetNode(){ | ||
18 | } | ||
19 | |||
20 | const QString CableNetNode::nodeDescription(){ | ||
21 | return tr("\ | ||
22 | <p>Sets up a wired serial or parallel.</p>\ | ||
23 | " | ||
24 | ); | ||
25 | } | ||
26 | |||
27 | ANetNodeInstance * CableNetNode::createInstance( void ) { | ||
28 | return new ACable( this ); | ||
29 | } | ||
30 | |||
31 | const char ** CableNetNode::needs( void ) { | ||
32 | return CableNeeds; | ||
33 | } | ||
34 | |||
35 | const char * CableNetNode::provides( void ) { | ||
36 | return "line"; | ||
37 | } | ||
38 | |||
39 | bool CableNetNode::generateProperFilesFor( | ||
40 | ANetNodeInstance * ) { | ||
41 | return 1; | ||
42 | } | ||
43 | |||
44 | bool CableNetNode::hasDataFor( const QString & ) { | ||
45 | return 0; | ||
46 | } | ||
47 | |||
48 | bool CableNetNode::generateDataForCommonFile( | ||
49 | SystemFile & , | ||
50 | long , | ||
51 | ANetNodeInstance * ) { | ||
52 | return 1; | ||
53 | } | ||
54 | |||
55 | extern "C" { | ||
56 | void create_plugin( QList<ANetNode> & PNN ) { | ||
57 | PNN.append( new CableNetNode() ); | ||
58 | } | ||
59 | } | ||
diff --git a/noncore/settings/networksettings2/cable/cable_NN.h b/noncore/settings/networksettings2/cable/cable_NN.h new file mode 100644 index 0000000..401317b --- a/dev/null +++ b/noncore/settings/networksettings2/cable/cable_NN.h | |||
@@ -0,0 +1,44 @@ | |||
1 | #ifndef CABLE_NETNODE_H | ||
2 | #define CABLE_NETNODE_H | ||
3 | |||
4 | #include "netnode.h" | ||
5 | |||
6 | class ACable; | ||
7 | |||
8 | class CableNetNode : public ANetNode { | ||
9 | |||
10 | Q_OBJECT | ||
11 | |||
12 | public: | ||
13 | |||
14 | CableNetNode(); | ||
15 | virtual ~CableNetNode(); | ||
16 | |||
17 | virtual const QString pixmapName() | ||
18 | { return "cable"; } | ||
19 | |||
20 | virtual const QString nodeName() | ||
21 | { return tr("Cable Connection"); } | ||
22 | |||
23 | virtual const QString nodeDescription() ; | ||
24 | |||
25 | virtual ANetNodeInstance * createInstance( void ); | ||
26 | |||
27 | virtual const char ** needs( void ); | ||
28 | virtual const char * provides( void ); | ||
29 | |||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | ||
31 | virtual bool hasDataFor( const QString & S ); | ||
32 | virtual bool generateDataForCommonFile( | ||
33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | ||
34 | |||
35 | private: | ||
36 | |||
37 | }; | ||
38 | |||
39 | extern "C" | ||
40 | { | ||
41 | void create_plugin( QList<ANetNode> & PNN ); | ||
42 | }; | ||
43 | |||
44 | #endif | ||
diff --git a/noncore/settings/networksettings2/cable/cable_NNI.cpp b/noncore/settings/networksettings2/cable/cable_NNI.cpp new file mode 100644 index 0000000..d26afd1 --- a/dev/null +++ b/noncore/settings/networksettings2/cable/cable_NNI.cpp | |||
@@ -0,0 +1,66 @@ | |||
1 | #include "cableedit.h" | ||
2 | #include "cable_NNI.h" | ||
3 | #include "cable_NN.h" | ||
4 | |||
5 | ACable::ACable( CableNetNode * PNN ) : ANetNodeInstance( PNN ) { | ||
6 | // default values | ||
7 | Data.Device = "/dev/ttyS0"; | ||
8 | Data.LockFile = "/var/Lock"; | ||
9 | Data.Speed = 115200; | ||
10 | Data.DataBits = 8; | ||
11 | Data.Parity = 0; | ||
12 | Data.StopBits = 1; | ||
13 | Data.HardwareControl = 0; | ||
14 | Data.SoftwareControl = 0; | ||
15 | GUI = 0; | ||
16 | RT = 0; | ||
17 | } | ||
18 | |||
19 | void ACable::setSpecificAttribute( QString & A, QString & V) { | ||
20 | if( A == "device" ) { | ||
21 | Data.Device = V; | ||
22 | } else if ( A == "lockfile" ) { | ||
23 | Data.LockFile = V; | ||
24 | } else if ( A == "speed" ) { | ||
25 | Data.Speed = V.toLong(); | ||
26 | } else if ( A == "parity" ) { | ||
27 | Data.Parity = V.toShort(); | ||
28 | } else if ( A == "databits" ) { | ||
29 | Data.DataBits = V.toShort(); | ||
30 | } else if ( A == "stopbits" ) { | ||
31 | Data.StopBits = V.toShort(); | ||
32 | } else if ( A == "hardwarecontrol" ) { | ||
33 | Data.HardwareControl = ( V == "yes" ); | ||
34 | } else if ( A == "softwarecontrol" ) { | ||
35 | Data.SoftwareControl = ( V == "yes" ); | ||
36 | } | ||
37 | } | ||
38 | |||
39 | void ACable::saveSpecificAttribute( QTextStream & TS ) { | ||
40 | TS << "device=" << quote( Data.Device ) << endl; | ||
41 | TS << "lockfile=" << quote( Data.LockFile ) << endl; | ||
42 | TS << "speed=" << Data.Speed << endl; | ||
43 | TS << "parity=" << Data.Parity << endl; | ||
44 | TS << "databits=" << Data.DataBits << endl; | ||
45 | TS << "stopbits=" << Data.StopBits << endl; | ||
46 | TS << "hardwarecontrol=" << | ||
47 | ((Data.HardwareControl) ? "yes" : "no") << endl; | ||
48 | TS << "softwarecontrol=" << | ||
49 | ((Data.SoftwareControl) ? "yes" : "no") << endl; | ||
50 | } | ||
51 | |||
52 | QWidget * ACable::edit( QWidget * parent ) { | ||
53 | GUI = new CableEdit( parent ); | ||
54 | GUI->showData( Data ); | ||
55 | return GUI; | ||
56 | } | ||
57 | |||
58 | QString ACable::acceptable( void ) { | ||
59 | return ( GUI ) ? GUI->acceptable( ) : QString(); | ||
60 | } | ||
61 | |||
62 | void ACable::commit( void ) { | ||
63 | if( GUI && GUI->commit( Data ) ) { | ||
64 | setModified( 1 ); | ||
65 | } | ||
66 | } | ||
diff --git a/noncore/settings/networksettings2/cable/cable_NNI.h b/noncore/settings/networksettings2/cable/cable_NNI.h new file mode 100644 index 0000000..0654a5d --- a/dev/null +++ b/noncore/settings/networksettings2/cable/cable_NNI.h | |||
@@ -0,0 +1,43 @@ | |||
1 | #ifndef CABLE_H | ||
2 | #define CABLE_H | ||
3 | |||
4 | #include <netnode.h> | ||
5 | #include "cabledata.h" | ||
6 | #include "cablerun.h" | ||
7 | |||
8 | class CableNetNode; | ||
9 | class CableEdit; | ||
10 | |||
11 | class ACable : public ANetNodeInstance { | ||
12 | |||
13 | public : | ||
14 | |||
15 | ACable( CableNetNode * PNN ); | ||
16 | |||
17 | QWidget * edit( QWidget * parent ); | ||
18 | QString acceptable( void ); | ||
19 | void commit( void ); | ||
20 | |||
21 | RuntimeInfo * runtime( void ) | ||
22 | { if( RT == 0 ) | ||
23 | RT = new CableRun( this, Data ); | ||
24 | return RT; | ||
25 | } | ||
26 | |||
27 | virtual void * data( void ) | ||
28 | { return (void *)&Data; } | ||
29 | |||
30 | protected : | ||
31 | |||
32 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | ||
33 | virtual void saveSpecificAttribute( QTextStream & TS ); | ||
34 | |||
35 | private : | ||
36 | |||
37 | CableEdit * GUI; | ||
38 | CableData_t Data; | ||
39 | CableRun * RT; | ||
40 | |||
41 | }; | ||
42 | |||
43 | #endif | ||
diff --git a/noncore/settings/networksettings2/cable/cabledata.h b/noncore/settings/networksettings2/cable/cabledata.h new file mode 100644 index 0000000..c449d96 --- a/dev/null +++ b/noncore/settings/networksettings2/cable/cabledata.h | |||
@@ -0,0 +1,18 @@ | |||
1 | #ifndef CABLE_DATA_H | ||
2 | #define CABLE_DATA_H | ||
3 | |||
4 | #include <qstring.h> | ||
5 | |||
6 | typedef struct CableData { | ||
7 | QString Device; | ||
8 | QString LockFile; | ||
9 | long Speed; | ||
10 | short Parity; | ||
11 | short DataBits; | ||
12 | short StopBits; | ||
13 | bool HardwareControl; | ||
14 | bool SoftwareControl; | ||
15 | |||
16 | } CableData_t; | ||
17 | |||
18 | #endif | ||
diff --git a/noncore/settings/networksettings2/cable/cableedit.cpp b/noncore/settings/networksettings2/cable/cableedit.cpp new file mode 100644 index 0000000..6e1a13b --- a/dev/null +++ b/noncore/settings/networksettings2/cable/cableedit.cpp | |||
@@ -0,0 +1,68 @@ | |||
1 | #include <GUIUtils.h> | ||
2 | #include <stdio.h> | ||
3 | #include <qlineedit.h> | ||
4 | #include <qcombobox.h> | ||
5 | #include <qspinbox.h> | ||
6 | #include <qcheckbox.h> | ||
7 | #include "cabledata.h" | ||
8 | #include "cableedit.h" | ||
9 | |||
10 | static long SpeedTable[] = { | ||
11 | 2400, 9600, 19200, 38400, 57600, 115200, | ||
12 | 230400, 460800, 500000, 921600, 1000000, | ||
13 | 1152000, 1500000, 2000000, 2500000, 3000000, | ||
14 | 3500000, 4000000, -1 | ||
15 | }; | ||
16 | |||
17 | CableEdit::CableEdit( QWidget * Parent ) : CableGUI( Parent ) { | ||
18 | } | ||
19 | |||
20 | void CableEdit::showData( CableData_t & D ) { | ||
21 | DeviceFile_LE->setText( D.Device ); | ||
22 | LockFile_LE->setText( D.LockFile ); | ||
23 | for( long * Run = SpeedTable; *Run != -1; *Run ++ ) { | ||
24 | if( *Run == D.Speed ) { | ||
25 | Speed_CB->setCurrentItem( | ||
26 | ((long)(Run)-(long)(SpeedTable))/sizeof(long) ); | ||
27 | break; | ||
28 | } | ||
29 | } | ||
30 | Parity_CB->setCurrentItem( D.Parity ); | ||
31 | DataBits_SB->setValue( D.DataBits ); | ||
32 | StopBits_CB->setCurrentItem( D.StopBits ); | ||
33 | HardwareFC_CB->setChecked( D.HardwareControl ); | ||
34 | SoftwareFC_CB->setChecked( D.SoftwareControl ); | ||
35 | } | ||
36 | |||
37 | QString CableEdit::acceptable( void ) { | ||
38 | if( DeviceFile_LE->text().isEmpty() ) | ||
39 | return tr("Device filename needed"); | ||
40 | return QString(); | ||
41 | } | ||
42 | |||
43 | bool CableEdit::commit( CableData_t & D ) { | ||
44 | bool SM = 0; | ||
45 | |||
46 | TXTM( D.Device, DeviceFile_LE, SM ); | ||
47 | TXTM( D.LockFile, LockFile_LE, SM ); | ||
48 | |||
49 | for( long * Run = SpeedTable; *Run != -1; *Run ++ ) { | ||
50 | if( *Run == D.Speed ) { | ||
51 | if( D.Speed != Speed_CB->currentText().toLong() ) { | ||
52 | SM = 1; | ||
53 | D.Speed = Speed_CB->currentText().toLong(); | ||
54 | } | ||
55 | break; | ||
56 | } | ||
57 | } | ||
58 | |||
59 | CIM(D.Parity, Parity_CB, SM ); | ||
60 | |||
61 | SBM(D.DataBits, DataBits_SB, SM ); | ||
62 | CIM(D.StopBits, StopBits_CB, SM ); | ||
63 | |||
64 | CBM( D.HardwareControl, HardwareFC_CB, SM ); | ||
65 | CBM( D.SoftwareControl, SoftwareFC_CB, SM ); | ||
66 | |||
67 | return SM; | ||
68 | } | ||
diff --git a/noncore/settings/networksettings2/cable/cableedit.h b/noncore/settings/networksettings2/cable/cableedit.h new file mode 100644 index 0000000..ffacc61 --- a/dev/null +++ b/noncore/settings/networksettings2/cable/cableedit.h | |||
@@ -0,0 +1,12 @@ | |||
1 | #include "cabledata.h" | ||
2 | #include "cableGUI.h" | ||
3 | |||
4 | class CableEdit : public CableGUI { | ||
5 | |||
6 | public : | ||
7 | |||
8 | CableEdit( QWidget * parent ); | ||
9 | QString acceptable( void ); | ||
10 | bool commit( CableData_t & D ); | ||
11 | void showData( CableData_t & D ); | ||
12 | }; | ||
diff --git a/noncore/settings/networksettings2/cable/cablerun.cpp b/noncore/settings/networksettings2/cable/cablerun.cpp new file mode 100644 index 0000000..edb4b01 --- a/dev/null +++ b/noncore/settings/networksettings2/cable/cablerun.cpp | |||
@@ -0,0 +1,26 @@ | |||
1 | #include <fcntl.h> | ||
2 | #include <unistd.h> | ||
3 | #include "cablerun.h" | ||
4 | |||
5 | void CableRun::detectState( NodeCollection * NC ) { | ||
6 | |||
7 | int fd = open( D->Device.latin1(), O_RDWR ); | ||
8 | |||
9 | if( fd < 0 ) { | ||
10 | NC->setCurrentState( Unavailable ); | ||
11 | } | ||
12 | close( fd ); | ||
13 | NC->setCurrentState( Available ); | ||
14 | } | ||
15 | |||
16 | bool CableRun::setState( NodeCollection * NC, Action_t A ) { | ||
17 | if( A == Activate ) { | ||
18 | detectState(NC); | ||
19 | return (NC->currentState() == Available); | ||
20 | } | ||
21 | return 1; | ||
22 | } | ||
23 | |||
24 | bool CableRun::canSetState( State_t , Action_t ) { | ||
25 | return 1; | ||
26 | } | ||
diff --git a/noncore/settings/networksettings2/cable/cablerun.h b/noncore/settings/networksettings2/cable/cablerun.h new file mode 100644 index 0000000..36ee640 --- a/dev/null +++ b/noncore/settings/networksettings2/cable/cablerun.h | |||
@@ -0,0 +1,21 @@ | |||
1 | #include <asline.h> | ||
2 | #include "cabledata.h" | ||
3 | |||
4 | class CableRun : public AsLine { | ||
5 | |||
6 | public : | ||
7 | |||
8 | CableRun( ANetNodeInstance * NNI, | ||
9 | CableData & Data ) : AsLine( NNI ) | ||
10 | { D = &Data; } | ||
11 | |||
12 | protected : | ||
13 | |||
14 | void detectState( NodeCollection * NC ); | ||
15 | bool setState( NodeCollection * NC, Action_t A ); | ||
16 | bool canSetState( State_t Curr, Action_t A ); | ||
17 | |||
18 | private : | ||
19 | |||
20 | CableData_t * D; | ||
21 | }; | ||
diff --git a/noncore/settings/networksettings2/cable/config.in b/noncore/settings/networksettings2/cable/config.in new file mode 100644 index 0000000..4453107 --- a/dev/null +++ b/noncore/settings/networksettings2/cable/config.in | |||
@@ -0,0 +1,4 @@ | |||
1 | config NS2CABLE | ||
2 | boolean "opie-networksettings2plugin-cable (set up Cable)" | ||
3 | default "n" if NS2 | ||
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && NS2 && NS2CORE | ||
diff --git a/noncore/settings/networksettings2/irda/config.in b/noncore/settings/networksettings2/irda/config.in new file mode 100644 index 0000000..997cf55 --- a/dev/null +++ b/noncore/settings/networksettings2/irda/config.in | |||
@@ -0,0 +1,4 @@ | |||
1 | config NS2IRDA | ||
2 | boolean "opie-networksettings2plugin-irda (set up IRDA)" | ||
3 | default "n" if NS2 | ||
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && NS2 && NS2CORE | ||
diff --git a/noncore/settings/networksettings2/irda/irda.pro b/noncore/settings/networksettings2/irda/irda.pro new file mode 100644 index 0000000..a7573b8 --- a/dev/null +++ b/noncore/settings/networksettings2/irda/irda.pro | |||
@@ -0,0 +1,17 @@ | |||
1 | TEMPLATE = lib | ||
2 | CONFIG += qt warn_on release | ||
3 | DESTDIR = $(OPIEDIR)/plugins/networksettings2 | ||
4 | HEADERS = irda_NN.h \ | ||
5 | irda_NNI.h \ | ||
6 | irdaedit.h | ||
7 | SOURCES = irda_NN.cpp \ | ||
8 | irda_NNI.cpp \ | ||
9 | irdaedit.cpp | ||
10 | INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2 | ||
11 | DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2 | ||
12 | LIBS += -lqpe | ||
13 | INTERFACES= irdaGUI.ui | ||
14 | TARGET = irda | ||
15 | VERSION = 1.0.0 | ||
16 | |||
17 | include ( $(OPIEDIR)/include.pro ) | ||
diff --git a/noncore/settings/networksettings2/irda/irdaGUI.ui b/noncore/settings/networksettings2/irda/irdaGUI.ui new file mode 100644 index 0000000..f8a7020 --- a/dev/null +++ b/noncore/settings/networksettings2/irda/irdaGUI.ui | |||
@@ -0,0 +1,131 @@ | |||
1 | <!DOCTYPE UI><UI> | ||
2 | <class>IRDAGUI</class> | ||
3 | <widget> | ||
4 | <class>QWidget</class> | ||
5 | <property stdset="1"> | ||
6 | <name>name</name> | ||
7 | <cstring>IRDA_FRM</cstring> | ||
8 | </property> | ||
9 | <property stdset="1"> | ||
10 | <name>geometry</name> | ||
11 | <rect> | ||
12 | <x>0</x> | ||
13 | <y>0</y> | ||
14 | <width>283</width> | ||
15 | <height>199</height> | ||
16 | </rect> | ||
17 | </property> | ||
18 | <property stdset="1"> | ||
19 | <name>caption</name> | ||
20 | <string>IRDA</string> | ||
21 | </property> | ||
22 | <property> | ||
23 | <name>layoutMargin</name> | ||
24 | </property> | ||
25 | <property> | ||
26 | <name>layoutSpacing</name> | ||
27 | </property> | ||
28 | <vbox> | ||
29 | <property stdset="1"> | ||
30 | <name>margin</name> | ||
31 | <number>2</number> | ||
32 | </property> | ||
33 | <property stdset="1"> | ||
34 | <name>spacing</name> | ||
35 | <number>2</number> | ||
36 | </property> | ||
37 | <widget> | ||
38 | <class>QLayoutWidget</class> | ||
39 | <property stdset="1"> | ||
40 | <name>name</name> | ||
41 | <cstring>Layout4</cstring> | ||
42 | </property> | ||
43 | <hbox> | ||
44 | <property stdset="1"> | ||
45 | <name>margin</name> | ||
46 | <number>0</number> | ||
47 | </property> | ||
48 | <property stdset="1"> | ||
49 | <name>spacing</name> | ||
50 | <number>6</number> | ||
51 | </property> | ||
52 | <widget> | ||
53 | <class>QLabel</class> | ||
54 | <property stdset="1"> | ||
55 | <name>name</name> | ||
56 | <cstring>TextLabel4</cstring> | ||
57 | </property> | ||
58 | <property stdset="1"> | ||
59 | <name>text</name> | ||
60 | <string>Name</string> | ||
61 | </property> | ||
62 | </widget> | ||
63 | <widget> | ||
64 | <class>QLineEdit</class> | ||
65 | <property stdset="1"> | ||
66 | <name>name</name> | ||
67 | <cstring>Name_LE</cstring> | ||
68 | </property> | ||
69 | </widget> | ||
70 | </hbox> | ||
71 | </widget> | ||
72 | <widget> | ||
73 | <class>QLabel</class> | ||
74 | <property stdset="1"> | ||
75 | <name>name</name> | ||
76 | <cstring>TextLabel3</cstring> | ||
77 | </property> | ||
78 | <property stdset="1"> | ||
79 | <name>text</name> | ||
80 | <string>Description</string> | ||
81 | </property> | ||
82 | </widget> | ||
83 | <widget> | ||
84 | <class>QMultiLineEdit</class> | ||
85 | <property stdset="1"> | ||
86 | <name>name</name> | ||
87 | <cstring>Description_LE</cstring> | ||
88 | </property> | ||
89 | </widget> | ||
90 | <widget> | ||
91 | <class>QLayoutWidget</class> | ||
92 | <property stdset="1"> | ||
93 | <name>name</name> | ||
94 | <cstring>Layout5</cstring> | ||
95 | </property> | ||
96 | <hbox> | ||
97 | <property stdset="1"> | ||
98 | <name>margin</name> | ||
99 | <number>0</number> | ||
100 | </property> | ||
101 | <property stdset="1"> | ||
102 | <name>spacing</name> | ||
103 | <number>6</number> | ||
104 | </property> | ||
105 | <widget> | ||
106 | <class>QCheckBox</class> | ||
107 | <property stdset="1"> | ||
108 | <name>name</name> | ||
109 | <cstring>Automatic_CB</cstring> | ||
110 | </property> | ||
111 | <property stdset="1"> | ||
112 | <name>text</name> | ||
113 | <string>Start automatically</string> | ||
114 | </property> | ||
115 | </widget> | ||
116 | <widget> | ||
117 | <class>QCheckBox</class> | ||
118 | <property stdset="1"> | ||
119 | <name>name</name> | ||
120 | <cstring>Confirm_CB</cstring> | ||
121 | </property> | ||
122 | <property stdset="1"> | ||
123 | <name>text</name> | ||
124 | <string>Confirm before start</string> | ||
125 | </property> | ||
126 | </widget> | ||
127 | </hbox> | ||
128 | </widget> | ||
129 | </vbox> | ||
130 | </widget> | ||
131 | </UI> | ||
diff --git a/noncore/settings/networksettings2/irda/irda_NN.cpp b/noncore/settings/networksettings2/irda/irda_NN.cpp new file mode 100644 index 0000000..3b9c938 --- a/dev/null +++ b/noncore/settings/networksettings2/irda/irda_NN.cpp | |||
@@ -0,0 +1,59 @@ | |||
1 | #include "irda_NN.h" | ||
2 | #include "irda_NNI.h" | ||
3 | |||
4 | static const char * IRDANeeds[] = | ||
5 | { 0 | ||
6 | }; | ||
7 | |||
8 | /** | ||
9 | * Constructor, find all of the possible interfaces | ||
10 | */ | ||
11 | IRDANetNode::IRDANetNode() : ANetNode() { | ||
12 | } | ||
13 | |||
14 | /** | ||
15 | * Delete any interfaces that we own. | ||
16 | */ | ||
17 | IRDANetNode::~IRDANetNode(){ | ||
18 | } | ||
19 | |||
20 | const QString IRDANetNode::nodeDescription(){ | ||
21 | return tr("\ | ||
22 | <p>Sets up a infra red serial link.</p>\ | ||
23 | " | ||
24 | ); | ||
25 | } | ||
26 | |||
27 | ANetNodeInstance * IRDANetNode::createInstance( void ) { | ||
28 | return new AIRDA( this ); | ||
29 | } | ||
30 | |||
31 | const char ** IRDANetNode::needs( void ) { | ||
32 | return IRDANeeds; | ||
33 | } | ||
34 | |||
35 | const char * IRDANetNode::provides( void ) { | ||
36 | return "line"; | ||
37 | } | ||
38 | |||
39 | bool IRDANetNode::generateProperFilesFor( | ||
40 | ANetNodeInstance * ) { | ||
41 | return 1; | ||
42 | } | ||
43 | |||
44 | bool IRDANetNode::hasDataFor( const QString & ) { | ||
45 | return 0; | ||
46 | } | ||
47 | |||
48 | bool IRDANetNode::generateDataForCommonFile( | ||
49 | SystemFile & , | ||
50 | long , | ||
51 | ANetNodeInstance * ) { | ||
52 | return 1; | ||
53 | } | ||
54 | |||
55 | extern "C" { | ||
56 | void create_plugin( QList<ANetNode> & PNN ) { | ||
57 | PNN.append( new IRDANetNode() ); | ||
58 | } | ||
59 | } | ||
diff --git a/noncore/settings/networksettings2/irda/irda_NN.h b/noncore/settings/networksettings2/irda/irda_NN.h new file mode 100644 index 0000000..82811a4 --- a/dev/null +++ b/noncore/settings/networksettings2/irda/irda_NN.h | |||
@@ -0,0 +1,44 @@ | |||
1 | #ifndef IRDA_NETNODE_H | ||
2 | #define IRDA_NETNODE_H | ||
3 | |||
4 | #include "netnode.h" | ||
5 | |||
6 | class AIRDA; | ||
7 | |||
8 | class IRDANetNode : public ANetNode { | ||
9 | |||
10 | Q_OBJECT | ||
11 | |||
12 | public: | ||
13 | |||
14 | IRDANetNode(); | ||
15 | virtual ~IRDANetNode(); | ||
16 | |||
17 | virtual const QString pixmapName() | ||
18 | { return "irda"; } | ||
19 | |||
20 | virtual const QString nodeName() | ||
21 | { return tr("Infrared link"); } | ||
22 | |||
23 | virtual const QString nodeDescription() ; | ||
24 | |||
25 | virtual ANetNodeInstance * createInstance( void ); | ||
26 | |||
27 | virtual const char ** needs( void ); | ||
28 | virtual const char * provides( void ); | ||
29 | |||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | ||
31 | virtual bool hasDataFor( const QString & S ); | ||
32 | virtual bool generateDataForCommonFile( | ||
33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | ||
34 | |||
35 | private: | ||
36 | |||
37 | }; | ||
38 | |||
39 | extern "C" | ||
40 | { | ||
41 | void create_plugin( QList<ANetNode> & PNN ); | ||
42 | }; | ||
43 | |||
44 | #endif | ||
diff --git a/noncore/settings/networksettings2/irda/irda_NNI.cpp b/noncore/settings/networksettings2/irda/irda_NNI.cpp new file mode 100644 index 0000000..78d6ff9 --- a/dev/null +++ b/noncore/settings/networksettings2/irda/irda_NNI.cpp | |||
@@ -0,0 +1,30 @@ | |||
1 | #include "irdaedit.h" | ||
2 | #include "irda_NNI.h" | ||
3 | #include "irda_NN.h" | ||
4 | |||
5 | AIRDA::AIRDA( IRDANetNode * PNN ) : ANetNodeInstance( PNN ) { | ||
6 | |||
7 | GUI = 0; | ||
8 | RT = 0; | ||
9 | } | ||
10 | |||
11 | void AIRDA::setSpecificAttribute( QString & , QString & ) { | ||
12 | } | ||
13 | |||
14 | void AIRDA::saveSpecificAttribute( QTextStream & ) { | ||
15 | } | ||
16 | |||
17 | QWidget * AIRDA::edit( QWidget * parent ) { | ||
18 | GUI = new IRDAEdit( parent ); | ||
19 | GUI->showData( Data ); | ||
20 | return GUI; | ||
21 | } | ||
22 | |||
23 | QString AIRDA::acceptable( void ) { | ||
24 | return ( GUI ) ? GUI->acceptable( ) : QString(); | ||
25 | } | ||
26 | |||
27 | void AIRDA::commit( void ) { | ||
28 | if( GUI && GUI->commit( Data ) ) | ||
29 | setModified( 1 ); | ||
30 | } | ||
diff --git a/noncore/settings/networksettings2/irda/irda_NNI.h b/noncore/settings/networksettings2/irda/irda_NNI.h new file mode 100644 index 0000000..c2d6875 --- a/dev/null +++ b/noncore/settings/networksettings2/irda/irda_NNI.h | |||
@@ -0,0 +1,43 @@ | |||
1 | #ifndef IRDA_H | ||
2 | #define IRDA_H | ||
3 | |||
4 | #include <netnode.h> | ||
5 | #include "irdadata.h" | ||
6 | #include "irdarun.h" | ||
7 | |||
8 | class IRDANetNode; | ||
9 | class IRDAEdit; | ||
10 | |||
11 | class AIRDA : public ANetNodeInstance { | ||
12 | |||
13 | public : | ||
14 | |||
15 | AIRDA( IRDANetNode * PNN ); | ||
16 | |||
17 | QWidget * edit( QWidget * parent ); | ||
18 | QString acceptable( void ); | ||
19 | void commit( void ); | ||
20 | |||
21 | RuntimeInfo * runtime( void ) | ||
22 | { if( RT == 0 ) | ||
23 | RT = new IRDARun( this, Data ); | ||
24 | return RT; | ||
25 | } | ||
26 | |||
27 | virtual void * data( void ) | ||
28 | { return (void *)&Data; } | ||
29 | |||
30 | protected : | ||
31 | |||
32 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | ||
33 | virtual void saveSpecificAttribute( QTextStream & TS ); | ||
34 | |||
35 | private : | ||
36 | |||
37 | IRDAEdit * GUI; | ||
38 | IRDAData Data; | ||
39 | IRDARun * RT; | ||
40 | |||
41 | }; | ||
42 | |||
43 | #endif | ||
diff --git a/noncore/settings/networksettings2/irda/irdadata.h b/noncore/settings/networksettings2/irda/irdadata.h new file mode 100644 index 0000000..c3c683e --- a/dev/null +++ b/noncore/settings/networksettings2/irda/irdadata.h | |||
@@ -0,0 +1,18 @@ | |||
1 | #ifndef IRDA_DATA_H | ||
2 | #define IRDA_DATA_H | ||
3 | |||
4 | #include <qstring.h> | ||
5 | |||
6 | typedef struct IRDAData { | ||
7 | QString Device; | ||
8 | QString LockFile; | ||
9 | long Speed; | ||
10 | short Parity; | ||
11 | short DataBits; | ||
12 | short StopBits; | ||
13 | bool HardwareControl; | ||
14 | bool SoftwareControl; | ||
15 | |||
16 | } IRDAData_t; | ||
17 | |||
18 | #endif | ||
diff --git a/noncore/settings/networksettings2/irda/irdaedit.cpp b/noncore/settings/networksettings2/irda/irdaedit.cpp new file mode 100644 index 0000000..2dfdce5 --- a/dev/null +++ b/noncore/settings/networksettings2/irda/irdaedit.cpp | |||
@@ -0,0 +1,17 @@ | |||
1 | #include <GUIUtils.h> | ||
2 | #include "irdaedit.h" | ||
3 | |||
4 | IRDAEdit::IRDAEdit( QWidget * Parent ) : IRDAGUI( Parent ){ | ||
5 | |||
6 | } | ||
7 | |||
8 | QString IRDAEdit::acceptable( void ) { | ||
9 | return QString(); | ||
10 | } | ||
11 | |||
12 | bool IRDAEdit::commit( IRDAData & Data ) { | ||
13 | return 0; | ||
14 | } | ||
15 | |||
16 | void IRDAEdit::showData( IRDAData & Data ) { | ||
17 | } | ||
diff --git a/noncore/settings/networksettings2/irda/irdaedit.h b/noncore/settings/networksettings2/irda/irdaedit.h new file mode 100644 index 0000000..5131126 --- a/dev/null +++ b/noncore/settings/networksettings2/irda/irdaedit.h | |||
@@ -0,0 +1,12 @@ | |||
1 | #include "irdadata.h" | ||
2 | #include "irdaGUI.h" | ||
3 | |||
4 | class IRDAEdit : public IRDAGUI { | ||
5 | |||
6 | public : | ||
7 | |||
8 | IRDAEdit( QWidget * parent ); | ||
9 | QString acceptable( void ); | ||
10 | bool commit( IRDAData & Data ); | ||
11 | void showData( IRDAData & Data ); | ||
12 | }; | ||
diff --git a/noncore/settings/networksettings2/irda/irdarun.h b/noncore/settings/networksettings2/irda/irdarun.h new file mode 100644 index 0000000..adc9c24 --- a/dev/null +++ b/noncore/settings/networksettings2/irda/irdarun.h | |||
@@ -0,0 +1,22 @@ | |||
1 | #include <asline.h> | ||
2 | #include "irdadata.h" | ||
3 | |||
4 | class IRDARun : public AsLine { | ||
5 | |||
6 | public : | ||
7 | |||
8 | IRDARun( ANetNodeInstance * NNI, | ||
9 | IRDAData & Data ) : AsLine( NNI ) | ||
10 | { } | ||
11 | |||
12 | protected : | ||
13 | |||
14 | void detectState( NodeCollection * ) | ||
15 | { } | ||
16 | |||
17 | bool setState( NodeCollection * , Action_t ) | ||
18 | { return 0; } | ||
19 | |||
20 | bool canSetState( State_t , Action_t ) | ||
21 | { return 0; } | ||
22 | }; | ||
diff --git a/noncore/settings/networksettings2/lancard/config.in b/noncore/settings/networksettings2/lancard/config.in new file mode 100644 index 0000000..d190f6e --- a/dev/null +++ b/noncore/settings/networksettings2/lancard/config.in | |||
@@ -0,0 +1,4 @@ | |||
1 | config NS2LANCARD | ||
2 | boolean "opie-networksettings2plugin-lancard (regular wired lan card)" | ||
3 | default "n" if NS2 | ||
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && NS2 && NS2CORE | ||
diff --git a/noncore/settings/networksettings2/lancard/lancard.pro b/noncore/settings/networksettings2/lancard/lancard.pro new file mode 100644 index 0000000..f188d2b --- a/dev/null +++ b/noncore/settings/networksettings2/lancard/lancard.pro | |||
@@ -0,0 +1,18 @@ | |||
1 | TEMPLATE = lib | ||
2 | CONFIG += qt warn_on release | ||
3 | DESTDIR = $(OPIEDIR)/plugins/networksettings2 | ||
4 | HEADERS = lancard_NN.h \ | ||
5 | lancard_NNI.h \ | ||
6 | lancardedit.h | ||
7 | SOURCES = lancard_NN.cpp \ | ||
8 | lancard_NNI.cpp \ | ||
9 | lancardedit.cpp \ | ||
10 | lancardrun.cpp | ||
11 | INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2 | ||
12 | DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2 | ||
13 | LIBS += -lqpe | ||
14 | INTERFACES= lancardGUI.ui | ||
15 | TARGET = lancard | ||
16 | VERSION = 1.0.0 | ||
17 | |||
18 | include ( $(OPIEDIR)/include.pro ) | ||
diff --git a/noncore/settings/networksettings2/lancard/lancardGUI.ui b/noncore/settings/networksettings2/lancard/lancardGUI.ui new file mode 100644 index 0000000..8d94816 --- a/dev/null +++ b/noncore/settings/networksettings2/lancard/lancardGUI.ui | |||
@@ -0,0 +1,129 @@ | |||
1 | <!DOCTYPE UI><UI> | ||
2 | <class>LanCardGUI</class> | ||
3 | <widget> | ||
4 | <class>QWidget</class> | ||
5 | <property stdset="1"> | ||
6 | <name>name</name> | ||
7 | <cstring>Lancard_FRM</cstring> | ||
8 | </property> | ||
9 | <property stdset="1"> | ||
10 | <name>geometry</name> | ||
11 | <rect> | ||
12 | <x>0</x> | ||
13 | <y>0</y> | ||
14 | <width>362</width> | ||
15 | <height>359</height> | ||
16 | </rect> | ||
17 | </property> | ||
18 | <property stdset="1"> | ||
19 | <name>caption</name> | ||
20 | <string>LAN card</string> | ||
21 | </property> | ||
22 | <property> | ||
23 | <name>layoutMargin</name> | ||
24 | </property> | ||
25 | <property> | ||
26 | <name>layoutSpacing</name> | ||
27 | </property> | ||
28 | <vbox> | ||
29 | <property stdset="1"> | ||
30 | <name>margin</name> | ||
31 | <number>2</number> | ||
32 | </property> | ||
33 | <property stdset="1"> | ||
34 | <name>spacing</name> | ||
35 | <number>2</number> | ||
36 | </property> | ||
37 | <widget> | ||
38 | <class>QCheckBox</class> | ||
39 | <property stdset="1"> | ||
40 | <name>name</name> | ||
41 | <cstring>AnyCard_CB</cstring> | ||
42 | </property> | ||
43 | <property stdset="1"> | ||
44 | <name>text</name> | ||
45 | <string>Any available LAN card</string> | ||
46 | </property> | ||
47 | <property stdset="1"> | ||
48 | <name>checked</name> | ||
49 | <bool>true</bool> | ||
50 | </property> | ||
51 | </widget> | ||
52 | <widget> | ||
53 | <class>QGroupBox</class> | ||
54 | <property stdset="1"> | ||
55 | <name>name</name> | ||
56 | <cstring>GroupBox1</cstring> | ||
57 | </property> | ||
58 | <property stdset="1"> | ||
59 | <name>enabled</name> | ||
60 | <bool>false</bool> | ||
61 | </property> | ||
62 | <property stdset="1"> | ||
63 | <name>title</name> | ||
64 | <string>Select Card</string> | ||
65 | </property> | ||
66 | <property> | ||
67 | <name>layoutMargin</name> | ||
68 | </property> | ||
69 | <vbox> | ||
70 | <property stdset="1"> | ||
71 | <name>margin</name> | ||
72 | <number>11</number> | ||
73 | </property> | ||
74 | <property stdset="1"> | ||
75 | <name>spacing</name> | ||
76 | <number>6</number> | ||
77 | </property> | ||
78 | <widget> | ||
79 | <class>QListView</class> | ||
80 | <column> | ||
81 | <property> | ||
82 | <name>text</name> | ||
83 | <string>Name</string> | ||
84 | </property> | ||
85 | <property> | ||
86 | <name>clickable</name> | ||
87 | <bool>true</bool> | ||
88 | </property> | ||
89 | <property> | ||
90 | <name>resizeable</name> | ||
91 | <bool>true</bool> | ||
92 | </property> | ||
93 | </column> | ||
94 | <column> | ||
95 | <property> | ||
96 | <name>text</name> | ||
97 | <string>MACAddress</string> | ||
98 | </property> | ||
99 | <property> | ||
100 | <name>clickable</name> | ||
101 | <bool>true</bool> | ||
102 | </property> | ||
103 | <property> | ||
104 | <name>resizeable</name> | ||
105 | <bool>true</bool> | ||
106 | </property> | ||
107 | </column> | ||
108 | <property stdset="1"> | ||
109 | <name>name</name> | ||
110 | <cstring>LanCards_LV</cstring> | ||
111 | </property> | ||
112 | <property stdset="1"> | ||
113 | <name>allColumnsShowFocus</name> | ||
114 | <bool>true</bool> | ||
115 | </property> | ||
116 | </widget> | ||
117 | </vbox> | ||
118 | </widget> | ||
119 | </vbox> | ||
120 | </widget> | ||
121 | <connections> | ||
122 | <connection> | ||
123 | <sender>AnyCard_CB</sender> | ||
124 | <signal>toggled(bool)</signal> | ||
125 | <receiver>GroupBox1</receiver> | ||
126 | <slot>setDisabled(bool)</slot> | ||
127 | </connection> | ||
128 | </connections> | ||
129 | </UI> | ||
diff --git a/noncore/settings/networksettings2/lancard/lancard_NN.cpp b/noncore/settings/networksettings2/lancard/lancard_NN.cpp new file mode 100644 index 0000000..a45496d --- a/dev/null +++ b/noncore/settings/networksettings2/lancard/lancard_NN.cpp | |||
@@ -0,0 +1,60 @@ | |||
1 | #include "lancard_NN.h" | ||
2 | #include "lancard_NNI.h" | ||
3 | |||
4 | static const char * LanCardNeeds[] = | ||
5 | { 0 }; | ||
6 | |||
7 | /** | ||
8 | * Constructor, find all of the possible interfaces | ||
9 | */ | ||
10 | LanCardNetNode::LanCardNetNode() : ANetNode() { | ||
11 | } | ||
12 | |||
13 | /** | ||
14 | * Delete any interfaces that we own. | ||
15 | */ | ||
16 | LanCardNetNode::~LanCardNetNode(){ | ||
17 | } | ||
18 | |||
19 | const QString LanCardNetNode::nodeDescription(){ | ||
20 | return tr("\ | ||
21 | <p>Sets up a wired regular LAN card.</p>\ | ||
22 | <p>Use this to set up 10/100/1000 MBit LAN cards.</p>\ | ||
23 | " | ||
24 | ); | ||
25 | } | ||
26 | |||
27 | ANetNodeInstance * LanCardNetNode::createInstance( void ) { | ||
28 | return new ALanCard( this ); | ||
29 | } | ||
30 | |||
31 | |||
32 | const char ** LanCardNetNode::needs( void ) { | ||
33 | return LanCardNeeds; | ||
34 | } | ||
35 | |||
36 | const char * LanCardNetNode::provides( void ) { | ||
37 | return "device"; | ||
38 | } | ||
39 | |||
40 | bool LanCardNetNode::generateProperFilesFor( | ||
41 | ANetNodeInstance * ) { | ||
42 | return 1; | ||
43 | } | ||
44 | |||
45 | bool LanCardNetNode::hasDataFor( const QString & ) { | ||
46 | return 0; | ||
47 | } | ||
48 | |||
49 | bool LanCardNetNode::generateDataForCommonFile( | ||
50 | SystemFile & , | ||
51 | long , | ||
52 | ANetNodeInstance * ) { | ||
53 | return 1; | ||
54 | } | ||
55 | |||
56 | extern "C" { | ||
57 | void create_plugin( QList<ANetNode> & PNN ) { | ||
58 | PNN.append( new LanCardNetNode() ); | ||
59 | } | ||
60 | } | ||
diff --git a/noncore/settings/networksettings2/lancard/lancard_NN.h b/noncore/settings/networksettings2/lancard/lancard_NN.h new file mode 100644 index 0000000..576a6e0 --- a/dev/null +++ b/noncore/settings/networksettings2/lancard/lancard_NN.h | |||
@@ -0,0 +1,44 @@ | |||
1 | #ifndef LANCARD_NETNODE_H | ||
2 | #define LANCARD_NETNODE_H | ||
3 | |||
4 | #include "netnode.h" | ||
5 | |||
6 | class ALanCard; | ||
7 | |||
8 | class LanCardNetNode : public ANetNode{ | ||
9 | |||
10 | Q_OBJECT | ||
11 | |||
12 | public: | ||
13 | |||
14 | LanCardNetNode(); | ||
15 | virtual ~LanCardNetNode(); | ||
16 | |||
17 | virtual const QString pixmapName() | ||
18 | { return "card"; } | ||
19 | |||
20 | virtual const QString nodeName() | ||
21 | { return tr("LAN card"); } | ||
22 | |||
23 | virtual const QString nodeDescription() ; | ||
24 | |||
25 | virtual ANetNodeInstance * createInstance( void ); | ||
26 | |||
27 | virtual const char ** needs( void ); | ||
28 | virtual const char * provides( void ); | ||
29 | |||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | ||
31 | virtual bool hasDataFor( const QString & S ); | ||
32 | virtual bool generateDataForCommonFile( | ||
33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | ||
34 | |||
35 | private: | ||
36 | |||
37 | }; | ||
38 | |||
39 | extern "C" | ||
40 | { | ||
41 | void create_plugin( QList<ANetNode> & PNN ); | ||
42 | }; | ||
43 | |||
44 | #endif | ||
diff --git a/noncore/settings/networksettings2/lancard/lancard_NNI.cpp b/noncore/settings/networksettings2/lancard/lancard_NNI.cpp new file mode 100644 index 0000000..9595e2e --- a/dev/null +++ b/noncore/settings/networksettings2/lancard/lancard_NNI.cpp | |||
@@ -0,0 +1,44 @@ | |||
1 | #include "lancardedit.h" | ||
2 | #include "lancard_NNI.h" | ||
3 | #include "lancard_NN.h" | ||
4 | |||
5 | ALanCard::ALanCard( LanCardNetNode * PNN ) : ANetNodeInstance( PNN ) { | ||
6 | |||
7 | Data.AnyLanCard = 1; | ||
8 | Data.HWAddresses.clear(); | ||
9 | |||
10 | GUI = 0; | ||
11 | RT = 0; | ||
12 | } | ||
13 | |||
14 | void ALanCard::setSpecificAttribute( QString & A, QString & V ) { | ||
15 | if( A == "matchanycard" ) { | ||
16 | Data.AnyLanCard = (V == "yes" ); | ||
17 | } else if( A == "match" ) { | ||
18 | Data.HWAddresses.append( V ); | ||
19 | } | ||
20 | } | ||
21 | |||
22 | void ALanCard::saveSpecificAttribute( QTextStream & TS) { | ||
23 | TS << "matchanycard=" << | ||
24 | ((Data.AnyLanCard) ? "yes" : "no") << endl; | ||
25 | for( QStringList::Iterator it = Data.HWAddresses.begin(); | ||
26 | it != Data.HWAddresses.end(); ++it ) { | ||
27 | TS << "match=" << quote( *it ) << endl; | ||
28 | } | ||
29 | } | ||
30 | |||
31 | QWidget * ALanCard::edit( QWidget * parent ) { | ||
32 | GUI = new LanCardEdit( parent ); | ||
33 | GUI->showData( Data ); | ||
34 | return GUI; | ||
35 | } | ||
36 | |||
37 | QString ALanCard::acceptable( void ) { | ||
38 | return ( GUI ) ? GUI->acceptable( ) : QString(); | ||
39 | } | ||
40 | |||
41 | void ALanCard::commit( void ) { | ||
42 | if( GUI && GUI->commit( Data ) ) | ||
43 | setModified( 1 ); | ||
44 | } | ||
diff --git a/noncore/settings/networksettings2/lancard/lancard_NNI.h b/noncore/settings/networksettings2/lancard/lancard_NNI.h new file mode 100644 index 0000000..8fc8868 --- a/dev/null +++ b/noncore/settings/networksettings2/lancard/lancard_NNI.h | |||
@@ -0,0 +1,43 @@ | |||
1 | #ifndef LANCARD_H | ||
2 | #define LANCARD_H | ||
3 | |||
4 | #include <netnode.h> | ||
5 | #include "lancarddata.h" | ||
6 | #include "lancardrun.h" | ||
7 | |||
8 | class LanCardNetNode; | ||
9 | class LanCardEdit; | ||
10 | |||
11 | class ALanCard : public ANetNodeInstance { | ||
12 | |||
13 | public : | ||
14 | |||
15 | ALanCard( LanCardNetNode * PNN ); | ||
16 | |||
17 | QWidget * edit( QWidget * parent ); | ||
18 | QString acceptable( void ); | ||
19 | void commit( void ); | ||
20 | |||
21 | RuntimeInfo * runtime( void ) | ||
22 | { if( RT == 0 ) | ||
23 | RT = new LanCardRun( this, Data ); | ||
24 | return RT; | ||
25 | } | ||
26 | |||
27 | virtual void * data( void ) | ||
28 | { return (void *)&Data; } | ||
29 | |||
30 | protected : | ||
31 | |||
32 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | ||
33 | virtual void saveSpecificAttribute( QTextStream & TS ); | ||
34 | |||
35 | private : | ||
36 | |||
37 | LanCardEdit * GUI; | ||
38 | LanCardData Data; | ||
39 | LanCardRun * RT; | ||
40 | |||
41 | }; | ||
42 | |||
43 | #endif | ||
diff --git a/noncore/settings/networksettings2/lancard/lancarddata.h b/noncore/settings/networksettings2/lancard/lancarddata.h new file mode 100644 index 0000000..c76767f --- a/dev/null +++ b/noncore/settings/networksettings2/lancard/lancarddata.h | |||
@@ -0,0 +1,13 @@ | |||
1 | #ifndef LANCARD_DATA_H | ||
2 | #define LANCARD_DATA_H | ||
3 | |||
4 | #include <qstringlist.h> | ||
5 | #include <qstring.h> | ||
6 | |||
7 | typedef struct LanCardData { | ||
8 | bool AnyLanCard; | ||
9 | QStringList HWAddresses; | ||
10 | |||
11 | } LanCardData_t; | ||
12 | |||
13 | #endif | ||
diff --git a/noncore/settings/networksettings2/lancard/lancardedit.cpp b/noncore/settings/networksettings2/lancard/lancardedit.cpp new file mode 100644 index 0000000..fa7f6dc --- a/dev/null +++ b/noncore/settings/networksettings2/lancard/lancardedit.cpp | |||
@@ -0,0 +1,95 @@ | |||
1 | #include <GUIUtils.h> | ||
2 | #include <resources.h> | ||
3 | #include <qlistview.h> | ||
4 | #include <qcheckbox.h> | ||
5 | #include <qheader.h> | ||
6 | #include <qregexp.h> | ||
7 | #include "lancardedit.h" | ||
8 | |||
9 | LanCardEdit::LanCardEdit( QWidget * Parent ) : LanCardGUI( Parent ){ | ||
10 | System & S = NSResources->system(); | ||
11 | QRegExp R( "eth[0-9]" ); | ||
12 | QCheckListItem * CLI; | ||
13 | |||
14 | LanCards_LV->header()->hide(); | ||
15 | |||
16 | // populate with all lancards in system | ||
17 | for( QDictIterator<InterfaceInfo> It(S.interfaces()); | ||
18 | It.current(); | ||
19 | ++It ) { | ||
20 | if( R.match( It.current()->Name ) >= 0 && | ||
21 | It.current()->CardType == ARPHRD_ETHER | ||
22 | ) { | ||
23 | CLI = new QCheckListItem( LanCards_LV, It.current()->Name, | ||
24 | QCheckListItem::CheckBox ); | ||
25 | CLI->setText( 1, It.current()->MACAddress ); | ||
26 | } | ||
27 | } | ||
28 | } | ||
29 | |||
30 | QString LanCardEdit::acceptable( void ) { | ||
31 | return QString(); | ||
32 | } | ||
33 | |||
34 | |||
35 | bool LanCardEdit::commit( LanCardData & Data ) { | ||
36 | bool SM = 0; | ||
37 | CBM( Data.AnyLanCard, AnyCard_CB, SM ); | ||
38 | |||
39 | if( ! Data.AnyLanCard ) { | ||
40 | // collect set of lancards that match | ||
41 | int idx; | ||
42 | QCheckListItem * CLI = (QCheckListItem *)LanCards_LV->firstChild(); | ||
43 | while( CLI ) { | ||
44 | idx = Data.HWAddresses.findIndex(CLI->text(1)); | ||
45 | if( CLI->isOn() ) { | ||
46 | if( idx < 0 ) { | ||
47 | // should be in list | ||
48 | Data.HWAddresses.append( CLI->text(1) ); | ||
49 | SM = 1; | ||
50 | } | ||
51 | } else { | ||
52 | // should not be in list | ||
53 | if( idx >= 0 ) { | ||
54 | Data.HWAddresses.remove( Data.HWAddresses.at(idx) ); | ||
55 | SM = 1; | ||
56 | } | ||
57 | } | ||
58 | CLI = (QCheckListItem *)CLI->nextSibling(); | ||
59 | } | ||
60 | } | ||
61 | return SM || ContainedObsoleteMAC ; | ||
62 | } | ||
63 | |||
64 | void LanCardEdit::showData( LanCardData & Data ) { | ||
65 | AnyCard_CB->setChecked( Data.AnyLanCard ); | ||
66 | |||
67 | QCheckListItem * CLI = (QCheckListItem *)LanCards_LV->firstChild(); | ||
68 | |||
69 | ContainedObsoleteMAC = 0; | ||
70 | // remove obsolete address | ||
71 | for( QStringList::Iterator it=Data.HWAddresses.begin(); | ||
72 | it != Data.HWAddresses.end(); | ||
73 | ) { | ||
74 | CLI = (QCheckListItem *)LanCards_LV->firstChild(); | ||
75 | while( CLI ) { | ||
76 | if( CLI->text(1) == (*it) ) | ||
77 | // still valid | ||
78 | break; | ||
79 | CLI = (QCheckListItem *)CLI->nextSibling(); | ||
80 | } | ||
81 | if( CLI == 0 ) { | ||
82 | // address not found -> remove | ||
83 | ContainedObsoleteMAC = 1; | ||
84 | Data.HWAddresses.remove( it ); | ||
85 | } else { | ||
86 | ++ it; | ||
87 | } | ||
88 | } | ||
89 | |||
90 | // set checks | ||
91 | while( CLI ) { | ||
92 | CLI->setOn( Data.HWAddresses.findIndex(CLI->text(1)) >= 0 ); | ||
93 | CLI = (QCheckListItem *)CLI->nextSibling(); | ||
94 | } | ||
95 | } | ||
diff --git a/noncore/settings/networksettings2/lancard/lancardedit.h b/noncore/settings/networksettings2/lancard/lancardedit.h new file mode 100644 index 0000000..8def789 --- a/dev/null +++ b/noncore/settings/networksettings2/lancard/lancardedit.h | |||
@@ -0,0 +1,16 @@ | |||
1 | #include "lancarddata.h" | ||
2 | #include "lancardGUI.h" | ||
3 | |||
4 | class LanCardEdit : public LanCardGUI { | ||
5 | |||
6 | public : | ||
7 | |||
8 | LanCardEdit( QWidget * parent ); | ||
9 | QString acceptable( void ); | ||
10 | bool commit( LanCardData & Data ); | ||
11 | void showData( LanCardData & Data ); | ||
12 | |||
13 | private : | ||
14 | |||
15 | bool ContainedObsoleteMAC; | ||
16 | }; | ||
diff --git a/noncore/settings/networksettings2/lancard/lancardrun.cpp b/noncore/settings/networksettings2/lancard/lancardrun.cpp new file mode 100644 index 0000000..b3b592b --- a/dev/null +++ b/noncore/settings/networksettings2/lancard/lancardrun.cpp | |||
@@ -0,0 +1,158 @@ | |||
1 | #include <qfile.h> | ||
2 | #include <qtextstream.h> | ||
3 | #include <resources.h> | ||
4 | #include "lancardrun.h" | ||
5 | |||
6 | void LanCardRun::detectState( NodeCollection * NC ) { | ||
7 | |||
8 | // unavailable : no card found | ||
9 | // available : card found and assigned to us or free | ||
10 | // up : card found and assigned to us and up | ||
11 | |||
12 | QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number()); | ||
13 | System & Sys = NSResources->system(); | ||
14 | InterfaceInfo * Run; | ||
15 | |||
16 | QFile F( S ); | ||
17 | |||
18 | if( F.open( IO_ReadOnly ) ) { | ||
19 | // could open file -> read interface and assign | ||
20 | QString X; | ||
21 | QTextStream TS(&F); | ||
22 | X = TS.readLine(); | ||
23 | // find interface | ||
24 | if( handlesInterface( X ) ) { | ||
25 | for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); | ||
26 | It.current(); | ||
27 | ++It ) { | ||
28 | Run = It.current(); | ||
29 | if( X == Run->Name ) { | ||
30 | Run->assignNode( netNode() ); | ||
31 | assignInterface( Run ); | ||
32 | NC->setCurrentState( IsUp ); | ||
33 | return; | ||
34 | } | ||
35 | } | ||
36 | } | ||
37 | } | ||
38 | |||
39 | // we are certainly not UP | ||
40 | assignInterface( 0 ); | ||
41 | |||
42 | // find possible interface | ||
43 | for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); | ||
44 | It.current(); | ||
45 | ++It ) { | ||
46 | Run = It.current(); | ||
47 | if( handlesInterface( Run->Name ) && | ||
48 | Run->CardType == ARPHRD_ETHER && | ||
49 | ! Run->IsUp | ||
50 | ) { | ||
51 | // proper type, and Not UP -> free | ||
52 | NC->setCurrentState( Off ); | ||
53 | return; | ||
54 | } | ||
55 | } | ||
56 | // no free found | ||
57 | |||
58 | NC->setCurrentState( Unavailable ); | ||
59 | |||
60 | } | ||
61 | |||
62 | bool LanCardRun::setState( NodeCollection * NC, Action_t A ) { | ||
63 | |||
64 | // we only handle activate and deactivate | ||
65 | switch( A ) { | ||
66 | case Activate : | ||
67 | { | ||
68 | if( NC->currentState() != Off ) { | ||
69 | return 0; | ||
70 | } | ||
71 | InterfaceInfo * N = getInterface(); | ||
72 | if( ! N ) { | ||
73 | // no interface available | ||
74 | NC->setCurrentState( Unavailable ); | ||
75 | return 0; | ||
76 | } | ||
77 | // because we were OFF the interface | ||
78 | // we get back is NOT assigned | ||
79 | N->assignNode( netNode() ); | ||
80 | assignInterface( N ); | ||
81 | NC->setCurrentState( Available ); | ||
82 | return 1; | ||
83 | } | ||
84 | case Deactivate : | ||
85 | if( NC->currentState() == IsUp ) { | ||
86 | // bring down first | ||
87 | if( ! connection()->setState( Down ) ) | ||
88 | // could not ... | ||
89 | return 0; | ||
90 | } | ||
91 | if( NC->currentState() != Available ) { | ||
92 | return 1; | ||
93 | } | ||
94 | assignedInterface()->assignNode( 0 ); // release | ||
95 | assignInterface( 0 ); | ||
96 | NC->setCurrentState( Off ); | ||
97 | return 1; | ||
98 | default : | ||
99 | // FT | ||
100 | break; | ||
101 | } | ||
102 | return 0; | ||
103 | } | ||
104 | |||
105 | bool LanCardRun::canSetState( State_t Curr, Action_t A ) { | ||
106 | // we only handle up down activate and deactivate | ||
107 | switch( A ) { | ||
108 | case Activate : | ||
109 | { // at least available | ||
110 | if( Curr == Available ) { | ||
111 | return 1; | ||
112 | } | ||
113 | // or we can make one available | ||
114 | InterfaceInfo * N = getInterface(); | ||
115 | if( ! N || N->assignedNode() != 0 ) { | ||
116 | // non available or assigned | ||
117 | return 0; | ||
118 | } | ||
119 | return 1; | ||
120 | } | ||
121 | case Deactivate : | ||
122 | return ( Curr >= Available ); | ||
123 | default : | ||
124 | // FT | ||
125 | break; | ||
126 | } | ||
127 | return 0; | ||
128 | } | ||
129 | |||
130 | // get interface that is free or assigned to us | ||
131 | InterfaceInfo * LanCardRun::getInterface( void ) { | ||
132 | |||
133 | System & S = NSResources->system(); | ||
134 | InterfaceInfo * best = 0, * Run; | ||
135 | |||
136 | for( QDictIterator<InterfaceInfo> It(S.interfaces()); | ||
137 | It.current(); | ||
138 | ++It ) { | ||
139 | Run = It.current(); | ||
140 | if( handlesInterface( Run->Name ) && | ||
141 | Run->CardType == ARPHRD_ETHER | ||
142 | ) { | ||
143 | // this is a LAN card | ||
144 | if( Run->assignedNode() == netNode() ) { | ||
145 | // assigned to us | ||
146 | return Run; | ||
147 | } else if( Run->assignedNode() == 0 ) { | ||
148 | // free | ||
149 | best = Run; | ||
150 | } | ||
151 | } | ||
152 | } | ||
153 | return best; // can be 0 | ||
154 | } | ||
155 | |||
156 | bool LanCardRun::handlesInterface( const QString & S ) { | ||
157 | return Pat.match( S ) >= 0; | ||
158 | } | ||
diff --git a/noncore/settings/networksettings2/lancard/lancardrun.h b/noncore/settings/networksettings2/lancard/lancardrun.h new file mode 100644 index 0000000..5f004e0 --- a/dev/null +++ b/noncore/settings/networksettings2/lancard/lancardrun.h | |||
@@ -0,0 +1,38 @@ | |||
1 | #ifndef LANCARDRUN_H | ||
2 | #define LANCARDRUN_H | ||
3 | |||
4 | #include <asdevice.h> | ||
5 | #include <qregexp.h> | ||
6 | #include "lancarddata.h" | ||
7 | |||
8 | class LanCardRun : public AsDevice { | ||
9 | |||
10 | public : | ||
11 | |||
12 | LanCardRun( ANetNodeInstance * NNI, | ||
13 | LanCardData & Data ) : AsDevice( NNI ), | ||
14 | Pat( "eth[0-9]" ) | ||
15 | { } | ||
16 | |||
17 | virtual long count( void ) | ||
18 | { return 2; } | ||
19 | virtual QString genNic( long nr ) | ||
20 | { QString S; return S.sprintf( "eth%ld", nr ); } | ||
21 | virtual AsDevice * device( void ) | ||
22 | { return asDevice(); } | ||
23 | |||
24 | protected : | ||
25 | |||
26 | void detectState( NodeCollection * NC ); | ||
27 | bool setState( NodeCollection * NC, Action_t A ); | ||
28 | bool canSetState( State_t Curr, Action_t A ); | ||
29 | |||
30 | bool handlesInterface( const QString & I ); | ||
31 | |||
32 | private : | ||
33 | |||
34 | InterfaceInfo * getInterface( void ); | ||
35 | QRegExp Pat; | ||
36 | |||
37 | }; | ||
38 | #endif | ||
diff --git a/noncore/settings/networksettings2/modem/config.in b/noncore/settings/networksettings2/modem/config.in new file mode 100644 index 0000000..77a1c77 --- a/dev/null +++ b/noncore/settings/networksettings2/modem/config.in | |||
@@ -0,0 +1,4 @@ | |||
1 | config NS2MODEM | ||
2 | boolean "opie-networksettings2plugin-modem (set up DIALUP)" | ||
3 | default "n" if NS2 | ||
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && NS2 && NS2CORE | ||
diff --git a/noncore/settings/networksettings2/modem/modem.pro b/noncore/settings/networksettings2/modem/modem.pro new file mode 100644 index 0000000..945486b --- a/dev/null +++ b/noncore/settings/networksettings2/modem/modem.pro | |||
@@ -0,0 +1,17 @@ | |||
1 | TEMPLATE = lib | ||
2 | CONFIG += qt warn_on release | ||
3 | DESTDIR = $(OPIEDIR)/plugins/networksettings2 | ||
4 | HEADERS = modem_NN.h \ | ||
5 | modem_NNI.h \ | ||
6 | modemedit.h | ||
7 | SOURCES = modem_NN.cpp \ | ||
8 | modem_NNI.cpp \ | ||
9 | modemedit.cpp | ||
10 | INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2 | ||
11 | DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2 | ||
12 | LIBS += -lqpe | ||
13 | INTERFACES= modemGUI.ui | ||
14 | TARGET = modem | ||
15 | VERSION = 1.0.0 | ||
16 | |||
17 | include ( $(OPIEDIR)/include.pro ) | ||
diff --git a/noncore/settings/networksettings2/modem/modemGUI.ui b/noncore/settings/networksettings2/modem/modemGUI.ui new file mode 100644 index 0000000..328f95c --- a/dev/null +++ b/noncore/settings/networksettings2/modem/modemGUI.ui | |||
@@ -0,0 +1,131 @@ | |||
1 | <!DOCTYPE UI><UI> | ||
2 | <class>ModemGUI</class> | ||
3 | <widget> | ||
4 | <class>QWidget</class> | ||
5 | <property stdset="1"> | ||
6 | <name>name</name> | ||
7 | <cstring>Modem_FRM</cstring> | ||
8 | </property> | ||
9 | <property stdset="1"> | ||
10 | <name>geometry</name> | ||
11 | <rect> | ||
12 | <x>0</x> | ||
13 | <y>0</y> | ||
14 | <width>283</width> | ||
15 | <height>199</height> | ||
16 | </rect> | ||
17 | </property> | ||
18 | <property stdset="1"> | ||
19 | <name>caption</name> | ||
20 | <string>Modem</string> | ||
21 | </property> | ||
22 | <property> | ||
23 | <name>layoutMargin</name> | ||
24 | </property> | ||
25 | <property> | ||
26 | <name>layoutSpacing</name> | ||
27 | </property> | ||
28 | <vbox> | ||
29 | <property stdset="1"> | ||
30 | <name>margin</name> | ||
31 | <number>2</number> | ||
32 | </property> | ||
33 | <property stdset="1"> | ||
34 | <name>spacing</name> | ||
35 | <number>2</number> | ||
36 | </property> | ||
37 | <widget> | ||
38 | <class>QLayoutWidget</class> | ||
39 | <property stdset="1"> | ||
40 | <name>name</name> | ||
41 | <cstring>Layout4</cstring> | ||
42 | </property> | ||
43 | <hbox> | ||
44 | <property stdset="1"> | ||
45 | <name>margin</name> | ||
46 | <number>0</number> | ||
47 | </property> | ||
48 | <property stdset="1"> | ||
49 | <name>spacing</name> | ||
50 | <number>6</number> | ||
51 | </property> | ||
52 | <widget> | ||
53 | <class>QLabel</class> | ||
54 | <property stdset="1"> | ||
55 | <name>name</name> | ||
56 | <cstring>TextLabel4</cstring> | ||
57 | </property> | ||
58 | <property stdset="1"> | ||
59 | <name>text</name> | ||
60 | <string>Name</string> | ||
61 | </property> | ||
62 | </widget> | ||
63 | <widget> | ||
64 | <class>QLineEdit</class> | ||
65 | <property stdset="1"> | ||
66 | <name>name</name> | ||
67 | <cstring>Name_LE</cstring> | ||
68 | </property> | ||
69 | </widget> | ||
70 | </hbox> | ||
71 | </widget> | ||
72 | <widget> | ||
73 | <class>QLabel</class> | ||
74 | <property stdset="1"> | ||
75 | <name>name</name> | ||
76 | <cstring>TextLabel3</cstring> | ||
77 | </property> | ||
78 | <property stdset="1"> | ||
79 | <name>text</name> | ||
80 | <string>Description</string> | ||
81 | </property> | ||
82 | </widget> | ||
83 | <widget> | ||
84 | <class>QMultiLineEdit</class> | ||
85 | <property stdset="1"> | ||
86 | <name>name</name> | ||
87 | <cstring>Description_LE</cstring> | ||
88 | </property> | ||
89 | </widget> | ||
90 | <widget> | ||
91 | <class>QLayoutWidget</class> | ||
92 | <property stdset="1"> | ||
93 | <name>name</name> | ||
94 | <cstring>Layout5</cstring> | ||
95 | </property> | ||
96 | <hbox> | ||
97 | <property stdset="1"> | ||
98 | <name>margin</name> | ||
99 | <number>0</number> | ||
100 | </property> | ||
101 | <property stdset="1"> | ||
102 | <name>spacing</name> | ||
103 | <number>6</number> | ||
104 | </property> | ||
105 | <widget> | ||
106 | <class>QCheckBox</class> | ||
107 | <property stdset="1"> | ||
108 | <name>name</name> | ||
109 | <cstring>Automatic_CB</cstring> | ||
110 | </property> | ||
111 | <property stdset="1"> | ||
112 | <name>text</name> | ||
113 | <string>Start automatically</string> | ||
114 | </property> | ||
115 | </widget> | ||
116 | <widget> | ||
117 | <class>QCheckBox</class> | ||
118 | <property stdset="1"> | ||
119 | <name>name</name> | ||
120 | <cstring>Confirm_CB</cstring> | ||
121 | </property> | ||
122 | <property stdset="1"> | ||
123 | <name>text</name> | ||
124 | <string>Confirm before start</string> | ||
125 | </property> | ||
126 | </widget> | ||
127 | </hbox> | ||
128 | </widget> | ||
129 | </vbox> | ||
130 | </widget> | ||
131 | </UI> | ||
diff --git a/noncore/settings/networksettings2/modem/modem_NN.cpp b/noncore/settings/networksettings2/modem/modem_NN.cpp new file mode 100644 index 0000000..48e1ad8 --- a/dev/null +++ b/noncore/settings/networksettings2/modem/modem_NN.cpp | |||
@@ -0,0 +1,60 @@ | |||
1 | #include "modem_NN.h" | ||
2 | #include "modem_NNI.h" | ||
3 | |||
4 | static const char * ModemNeeds[] = | ||
5 | { "line" | ||
6 | }; | ||
7 | |||
8 | /** | ||
9 | * Constructor, find all of the possible interfaces | ||
10 | */ | ||
11 | ModemNetNode::ModemNetNode() : ANetNode() { | ||
12 | } | ||
13 | |||
14 | /** | ||
15 | * Delete any interfaces that we own. | ||
16 | */ | ||
17 | ModemNetNode::~ModemNetNode(){ | ||
18 | } | ||
19 | |||
20 | const QString ModemNetNode::nodeDescription(){ | ||
21 | return tr("\ | ||
22 | <p>Sets up a dialing procedures.</p>\ | ||
23 | <p>Use this to dial up over modems, ISDN, GSM, ...</p>\ | ||
24 | " | ||
25 | ); | ||
26 | } | ||
27 | |||
28 | ANetNodeInstance * ModemNetNode::createInstance( void ) { | ||
29 | return new AModem( this ); | ||
30 | } | ||
31 | |||
32 | const char ** ModemNetNode::needs( void ) { | ||
33 | return ModemNeeds; | ||
34 | } | ||
35 | |||
36 | const char * ModemNetNode::provides( void ) { | ||
37 | return "line"; | ||
38 | } | ||
39 | |||
40 | bool ModemNetNode::generateProperFilesFor( | ||
41 | ANetNodeInstance * ) { | ||
42 | return 1; | ||
43 | } | ||
44 | |||
45 | bool ModemNetNode::hasDataFor( const QString & ) { | ||
46 | return 0; | ||
47 | } | ||
48 | |||
49 | bool ModemNetNode::generateDataForCommonFile( | ||
50 | SystemFile & , | ||
51 | long , | ||
52 | ANetNodeInstance * ) { | ||
53 | return 1; | ||
54 | } | ||
55 | |||
56 | extern "C" { | ||
57 | void create_plugin( QList<ANetNode> & PNN ) { | ||
58 | PNN.append( new ModemNetNode() ); | ||
59 | } | ||
60 | } | ||
diff --git a/noncore/settings/networksettings2/modem/modem_NN.h b/noncore/settings/networksettings2/modem/modem_NN.h new file mode 100644 index 0000000..0f4c124 --- a/dev/null +++ b/noncore/settings/networksettings2/modem/modem_NN.h | |||
@@ -0,0 +1,44 @@ | |||
1 | #ifndef MODEM_NETNODE_H | ||
2 | #define MODEM_NETNODE_H | ||
3 | |||
4 | #include "netnode.h" | ||
5 | |||
6 | class AModem; | ||
7 | |||
8 | class ModemNetNode : public ANetNode{ | ||
9 | |||
10 | Q_OBJECT | ||
11 | |||
12 | public: | ||
13 | |||
14 | ModemNetNode(); | ||
15 | virtual ~ModemNetNode(); | ||
16 | |||
17 | virtual const QString pixmapName() | ||
18 | { return "modem"; } | ||
19 | |||
20 | virtual const QString nodeName() | ||
21 | { return tr("Dialup modem"); } | ||
22 | |||
23 | virtual const QString nodeDescription() ; | ||
24 | |||
25 | virtual ANetNodeInstance * createInstance( void ); | ||
26 | |||
27 | virtual const char ** needs( void ); | ||
28 | virtual const char * provides( void ); | ||
29 | |||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | ||
31 | virtual bool hasDataFor( const QString & S ); | ||
32 | virtual bool generateDataForCommonFile( | ||
33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | ||
34 | |||
35 | private: | ||
36 | |||
37 | }; | ||
38 | |||
39 | extern "C" | ||
40 | { | ||
41 | void create_plugin( QList<ANetNode> & PNN ); | ||
42 | }; | ||
43 | |||
44 | #endif | ||
diff --git a/noncore/settings/networksettings2/modem/modem_NNI.cpp b/noncore/settings/networksettings2/modem/modem_NNI.cpp new file mode 100644 index 0000000..91df22b --- a/dev/null +++ b/noncore/settings/networksettings2/modem/modem_NNI.cpp | |||
@@ -0,0 +1,31 @@ | |||
1 | #include "modemedit.h" | ||
2 | #include "modem_NNI.h" | ||
3 | #include "modem_NN.h" | ||
4 | |||
5 | AModem::AModem( ModemNetNode * PNN ) : ANetNodeInstance( PNN ) { | ||
6 | |||
7 | GUI = 0; | ||
8 | RT = 0; | ||
9 | } | ||
10 | |||
11 | void AModem::setSpecificAttribute( QString & , QString & ) { | ||
12 | } | ||
13 | |||
14 | void AModem::saveSpecificAttribute( QTextStream & ) { | ||
15 | } | ||
16 | |||
17 | QWidget * AModem::edit( QWidget * parent ) { | ||
18 | GUI = new ModemEdit( parent ); | ||
19 | GUI->showData( Data ); | ||
20 | return GUI; | ||
21 | } | ||
22 | |||
23 | QString AModem::acceptable( void ) { | ||
24 | return ( GUI ) ? GUI->acceptable( ) : QString(); | ||
25 | } | ||
26 | |||
27 | void AModem::commit( void ) { | ||
28 | if( GUI && GUI->commit( Data ) ) | ||
29 | setModified( 1 ); | ||
30 | } | ||
31 | |||
diff --git a/noncore/settings/networksettings2/modem/modem_NNI.h b/noncore/settings/networksettings2/modem/modem_NNI.h new file mode 100644 index 0000000..7543e7d --- a/dev/null +++ b/noncore/settings/networksettings2/modem/modem_NNI.h | |||
@@ -0,0 +1,43 @@ | |||
1 | #ifndef Modem_H | ||
2 | #define Modem_H | ||
3 | |||
4 | #include <netnode.h> | ||
5 | #include "modemdata.h" | ||
6 | #include "modemrun.h" | ||
7 | |||
8 | class ModemNetNode; | ||
9 | class ModemEdit; | ||
10 | |||
11 | class AModem : public ANetNodeInstance { | ||
12 | |||
13 | public : | ||
14 | |||
15 | AModem( ModemNetNode * PNN ); | ||
16 | |||
17 | QWidget * edit( QWidget * parent ); | ||
18 | QString acceptable( void ); | ||
19 | void commit( void ); | ||
20 | |||
21 | RuntimeInfo * runtime( void ) | ||
22 | { if( RT == 0 ) | ||
23 | RT = new ModemRun( this, Data ); | ||
24 | return RT; | ||
25 | } | ||
26 | |||
27 | virtual void * data( void ) | ||
28 | { return (void *)&Data; } | ||
29 | |||
30 | protected : | ||
31 | |||
32 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | ||
33 | virtual void saveSpecificAttribute( QTextStream & TS ); | ||
34 | |||
35 | private : | ||
36 | |||
37 | ModemEdit * GUI; | ||
38 | ModemData Data; | ||
39 | ModemRun * RT; | ||
40 | |||
41 | }; | ||
42 | |||
43 | #endif | ||
diff --git a/noncore/settings/networksettings2/modem/modemdata.h b/noncore/settings/networksettings2/modem/modemdata.h new file mode 100644 index 0000000..773cb77 --- a/dev/null +++ b/noncore/settings/networksettings2/modem/modemdata.h | |||
@@ -0,0 +1,17 @@ | |||
1 | #ifndef MODEM_DATA_H | ||
2 | #define MODEM_DATA_H | ||
3 | |||
4 | #include <qstring.h> | ||
5 | typedef struct ModemData { | ||
6 | QString Device; | ||
7 | QString LockFile; | ||
8 | long Speed; | ||
9 | short Parity; | ||
10 | short DataBits; | ||
11 | short StopBits; | ||
12 | bool HardwareControl; | ||
13 | bool SoftwareControl; | ||
14 | |||
15 | } ModemData_t; | ||
16 | |||
17 | #endif | ||
diff --git a/noncore/settings/networksettings2/modem/modemedit.cpp b/noncore/settings/networksettings2/modem/modemedit.cpp new file mode 100644 index 0000000..fd3d694 --- a/dev/null +++ b/noncore/settings/networksettings2/modem/modemedit.cpp | |||
@@ -0,0 +1,18 @@ | |||
1 | #include <GUIUtils.h> | ||
2 | #include "modemedit.h" | ||
3 | |||
4 | ModemEdit::ModemEdit( QWidget * Parent ) : ModemGUI( Parent ){ | ||
5 | |||
6 | } | ||
7 | |||
8 | QString ModemEdit::acceptable( void ) { | ||
9 | return QString(); | ||
10 | } | ||
11 | |||
12 | bool ModemEdit::commit( ModemData_t & Data ) { | ||
13 | return 0; | ||
14 | } | ||
15 | |||
16 | void ModemEdit::showData( ModemData_t & Data ) { | ||
17 | } | ||
18 | |||
diff --git a/noncore/settings/networksettings2/modem/modemedit.h b/noncore/settings/networksettings2/modem/modemedit.h new file mode 100644 index 0000000..56e2a82 --- a/dev/null +++ b/noncore/settings/networksettings2/modem/modemedit.h | |||
@@ -0,0 +1,12 @@ | |||
1 | #include "modemdata.h" | ||
2 | #include "modemGUI.h" | ||
3 | |||
4 | class ModemEdit : public ModemGUI { | ||
5 | |||
6 | public : | ||
7 | |||
8 | ModemEdit( QWidget * parent ); | ||
9 | QString acceptable( void ); | ||
10 | bool commit( ModemData_t & Data ); | ||
11 | void showData( ModemData_t & Data ); | ||
12 | }; | ||
diff --git a/noncore/settings/networksettings2/modem/modemrun.h b/noncore/settings/networksettings2/modem/modemrun.h new file mode 100644 index 0000000..719ab2f --- a/dev/null +++ b/noncore/settings/networksettings2/modem/modemrun.h | |||
@@ -0,0 +1,22 @@ | |||
1 | #include <asline.h> | ||
2 | #include "modemdata.h" | ||
3 | |||
4 | class ModemRun : public AsLine { | ||
5 | |||
6 | public : | ||
7 | |||
8 | ModemRun( ANetNodeInstance * NNI, | ||
9 | ModemData & Data ) : AsLine ( NNI ) | ||
10 | { } | ||
11 | |||
12 | protected : | ||
13 | |||
14 | void detectState( NodeCollection * ) | ||
15 | { } | ||
16 | |||
17 | bool setState( NodeCollection *, Action_t ) | ||
18 | { return 0; } | ||
19 | |||
20 | bool canSetState( State_t, Action_t ) | ||
21 | { return 0; } | ||
22 | }; | ||