summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/ppp
Unidiff
Diffstat (limited to 'noncore/settings/networksettings2/ppp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/ppp/PPPAuthedit.cpp4
-rw-r--r--noncore/settings/networksettings2/ppp/PPPAuthedit.h4
-rw-r--r--noncore/settings/networksettings2/ppp/PPPDNSedit.cpp4
-rw-r--r--noncore/settings/networksettings2/ppp/PPPDNSedit.h4
-rw-r--r--noncore/settings/networksettings2/ppp/PPPGUI.ui20
-rw-r--r--noncore/settings/networksettings2/ppp/PPPIPGUI.ui255
-rw-r--r--noncore/settings/networksettings2/ppp/PPPIPedit.cpp37
-rw-r--r--noncore/settings/networksettings2/ppp/PPPIPedit.h4
-rw-r--r--noncore/settings/networksettings2/ppp/PPPedit.cpp11
-rw-r--r--noncore/settings/networksettings2/ppp/PPPedit.h14
-rw-r--r--noncore/settings/networksettings2/ppp/opie-networksettings2plugin-ppp.control2
-rw-r--r--noncore/settings/networksettings2/ppp/ppp.pro11
-rw-r--r--noncore/settings/networksettings2/ppp/ppp_NN.cpp36
-rw-r--r--noncore/settings/networksettings2/ppp/ppp_NN.h6
-rw-r--r--noncore/settings/networksettings2/ppp/ppp_NNI.cpp154
-rw-r--r--noncore/settings/networksettings2/ppp/ppp_NNI.h12
-rw-r--r--noncore/settings/networksettings2/ppp/pppdata.h22
-rw-r--r--noncore/settings/networksettings2/ppp/ppprun.cpp56
-rw-r--r--noncore/settings/networksettings2/ppp/ppprun.h34
19 files changed, 327 insertions, 363 deletions
diff --git a/noncore/settings/networksettings2/ppp/PPPAuthedit.cpp b/noncore/settings/networksettings2/ppp/PPPAuthedit.cpp
index 450d560..9403694 100644
--- a/noncore/settings/networksettings2/ppp/PPPAuthedit.cpp
+++ b/noncore/settings/networksettings2/ppp/PPPAuthedit.cpp
@@ -34,13 +34,13 @@ QString PPPAuthEdit::acceptable( void ) {
34 if( Secret_LE->text().isEmpty() ) 34 if( Secret_LE->text().isEmpty() )
35 return tr("Pap/Chap/EAP secret id missing"); 35 return tr("Pap/Chap/EAP secret id missing");
36 } 36 }
37 return QString(); 37 return QString();
38} 38}
39 39
40bool PPPAuthEdit::commit( PPPData_t & D ) { 40bool PPPAuthEdit::commit( PPPData & D ) {
41 bool SM = 0; 41 bool SM = 0;
42 42
43 if( ( D.Auth.Mode == 0 && ! Login_RB->isChecked() ) || 43 if( ( D.Auth.Mode == 0 && ! Login_RB->isChecked() ) ||
44 ( D.Auth.Mode == 1 && ! PAP_Checked() ) || 44 ( D.Auth.Mode == 1 && ! PAP_Checked() ) ||
45 ( D.Auth.Mode == 2 && ! Terminal_RB->isChecked() ) ) { 45 ( D.Auth.Mode == 2 && ! Terminal_RB->isChecked() ) ) {
46 // mode modifed 46 // mode modifed
@@ -67,13 +67,13 @@ bool PPPAuthEdit::commit( PPPData_t & D ) {
67 D.Auth.PCEMode = 2; 67 D.Auth.PCEMode = 2;
68 } 68 }
69 } 69 }
70 return SM; 70 return SM;
71} 71}
72 72
73void PPPAuthEdit::showData( PPPData_t & D ) { 73void PPPAuthEdit::showData( PPPData & D ) {
74 74
75 switch( D.Auth.Mode ) { 75 switch( D.Auth.Mode ) {
76 case 0 : 76 case 0 :
77 Login_RB->setChecked( TRUE ); 77 Login_RB->setChecked( TRUE );
78 break; 78 break;
79 case 1 : 79 case 1 :
diff --git a/noncore/settings/networksettings2/ppp/PPPAuthedit.h b/noncore/settings/networksettings2/ppp/PPPAuthedit.h
index 2392569..7a06657 100644
--- a/noncore/settings/networksettings2/ppp/PPPAuthedit.h
+++ b/noncore/settings/networksettings2/ppp/PPPAuthedit.h
@@ -4,14 +4,14 @@
4class PPPAuthEdit : public PPPAuthGUI { 4class PPPAuthEdit : public PPPAuthGUI {
5 5
6public : 6public :
7 7
8 PPPAuthEdit( QWidget * parent ); 8 PPPAuthEdit( QWidget * parent );
9 QString acceptable( void ); 9 QString acceptable( void );
10 bool commit( PPPData_t & Data ); 10 bool commit( PPPData & Data );
11 void showData( PPPData_t & Data ); 11 void showData( PPPData & Data );
12 bool PAP_Checked( void ); 12 bool PAP_Checked( void );
13 13
14 14
15private : 15private :
16 16
17}; 17};
diff --git a/noncore/settings/networksettings2/ppp/PPPDNSedit.cpp b/noncore/settings/networksettings2/ppp/PPPDNSedit.cpp
index 22f8e59..270f695 100644
--- a/noncore/settings/networksettings2/ppp/PPPDNSedit.cpp
+++ b/noncore/settings/networksettings2/ppp/PPPDNSedit.cpp
@@ -20,13 +20,13 @@ QString PPPDNSEdit::acceptable( void ) {
20 if( Servers_LB->count() == 0 ) 20 if( Servers_LB->count() == 0 )
21 tr("DNS Servers needed"); 21 tr("DNS Servers needed");
22 } 22 }
23 return QString(); 23 return QString();
24} 24}
25 25
26bool PPPDNSEdit::commit( PPPData_t & D ) { 26bool PPPDNSEdit::commit( PPPData & D ) {
27 bool SM = 0; 27 bool SM = 0;
28 28
29 CBM( D.DNS.ServerAssigned, DNSServerAssigned_RB, SM ); 29 CBM( D.DNS.ServerAssigned, DNSServerAssigned_RB, SM );
30 TXTM( D.DNS.DomainName, DomainName_LE, SM ); 30 TXTM( D.DNS.DomainName, DomainName_LE, SM );
31 31
32 // new items in old ? 32 // new items in old ?
@@ -72,13 +72,13 @@ bool PPPDNSEdit::commit( PPPData_t & D ) {
72 D.DNS.Servers.resize( D.DNS.Servers.size()-1 ); 72 D.DNS.Servers.resize( D.DNS.Servers.size()-1 );
73 } 73 }
74 } 74 }
75 return SM; 75 return SM;
76} 76}
77 77
78void PPPDNSEdit::showData( PPPData_t & D) { 78void PPPDNSEdit::showData( PPPData & D) {
79 79
80 DNSServerAssigned_RB->setChecked( D.DNS.ServerAssigned ); 80 DNSServerAssigned_RB->setChecked( D.DNS.ServerAssigned );
81 81
82 DomainName_LE->setText( D.DNS.DomainName ); 82 DomainName_LE->setText( D.DNS.DomainName );
83 for( unsigned i = 0; i < D.DNS.Servers.size(); i ++ ) { 83 for( unsigned i = 0; i < D.DNS.Servers.size(); i ++ ) {
84 Servers_LB->insertItem( *(D.DNS.Servers[i]) ); 84 Servers_LB->insertItem( *(D.DNS.Servers[i]) );
diff --git a/noncore/settings/networksettings2/ppp/PPPDNSedit.h b/noncore/settings/networksettings2/ppp/PPPDNSedit.h
index 43e0067..1ca8c21 100644
--- a/noncore/settings/networksettings2/ppp/PPPDNSedit.h
+++ b/noncore/settings/networksettings2/ppp/PPPDNSedit.h
@@ -4,14 +4,14 @@
4class PPPDNSEdit : public PPPDNSGUI { 4class PPPDNSEdit : public PPPDNSGUI {
5 5
6public : 6public :
7 7
8 PPPDNSEdit( QWidget * parent ); 8 PPPDNSEdit( QWidget * parent );
9 QString acceptable( void ); 9 QString acceptable( void );
10 bool commit( PPPData_t & Data ); 10 bool commit( PPPData & Data );
11 void showData( PPPData_t & Data ); 11 void showData( PPPData & Data );
12 12
13public slots : 13public slots :
14 14
15 void SLOT_AddServer( void ); 15 void SLOT_AddServer( void );
16 void SLOT_RemoveServer( void ); 16 void SLOT_RemoveServer( void );
17 17
diff --git a/noncore/settings/networksettings2/ppp/PPPGUI.ui b/noncore/settings/networksettings2/ppp/PPPGUI.ui
index 777e4a9..4c79fe3 100644
--- a/noncore/settings/networksettings2/ppp/PPPGUI.ui
+++ b/noncore/settings/networksettings2/ppp/PPPGUI.ui
@@ -8,14 +8,14 @@
8 </property> 8 </property>
9 <property stdset="1"> 9 <property stdset="1">
10 <name>geometry</name> 10 <name>geometry</name>
11 <rect> 11 <rect>
12 <x>0</x> 12 <x>0</x>
13 <y>0</y> 13 <y>0</y>
14 <width>124</width> 14 <width>528</width>
15 <height>29</height> 15 <height>345</height>
16 </rect> 16 </rect>
17 </property> 17 </property>
18 <property stdset="1"> 18 <property stdset="1">
19 <name>caption</name> 19 <name>caption</name>
20 <string>PPP</string> 20 <string>PPP</string>
21 </property> 21 </property>
@@ -25,13 +25,13 @@
25 <property> 25 <property>
26 <name>layoutSpacing</name> 26 <name>layoutSpacing</name>
27 </property> 27 </property>
28 <vbox> 28 <vbox>
29 <property stdset="1"> 29 <property stdset="1">
30 <name>margin</name> 30 <name>margin</name>
31 <number>2</number> 31 <number>0</number>
32 </property> 32 </property>
33 <property stdset="1"> 33 <property stdset="1">
34 <name>spacing</name> 34 <name>spacing</name>
35 <number>2</number> 35 <number>2</number>
36 </property> 36 </property>
37 <widget> 37 <widget>
@@ -51,12 +51,24 @@
51 <item> 51 <item>
52 <property> 52 <property>
53 <name>text</name> 53 <name>text</name>
54 <string>DNS Settings</string> 54 <string>DNS Settings</string>
55 </property> 55 </property>
56 </item> 56 </item>
57 <item>
58 <property>
59 <name>text</name>
60 <string>Commands</string>
61 </property>
62 </item>
63 <item>
64 <property>
65 <name>text</name>
66 <string>Dialing</string>
67 </property>
68 </item>
57 <property stdset="1"> 69 <property stdset="1">
58 <name>name</name> 70 <name>name</name>
59 <cstring>PPPOptions_CB</cstring> 71 <cstring>PPPOptions_CB</cstring>
60 </property> 72 </property>
61 </widget> 73 </widget>
62 <widget> 74 <widget>
@@ -73,13 +85,13 @@
73 <class>QWidgetStack</class> 85 <class>QWidgetStack</class>
74 <header location="global">qwidgetstack.h</header> 86 <header location="global">qwidgetstack.h</header>
75 <sizehint> 87 <sizehint>
76 <width>-1</width> 88 <width>-1</width>
77 <height>-1</height> 89 <height>-1</height>
78 </sizehint> 90 </sizehint>
79 <container>0</container> 91 <container>1</container>
80 <sizepolicy> 92 <sizepolicy>
81 <hordata>7</hordata> 93 <hordata>7</hordata>
82 <verdata>7</verdata> 94 <verdata>7</verdata>
83 </sizepolicy> 95 </sizepolicy>
84 <pixmap>image0</pixmap> 96 <pixmap>image0</pixmap>
85 <slot access="public">raiseWidget( int )</slot> 97 <slot access="public">raiseWidget( int )</slot>
diff --git a/noncore/settings/networksettings2/ppp/PPPIPGUI.ui b/noncore/settings/networksettings2/ppp/PPPIPGUI.ui
index f3d5019..21bd29e 100644
--- a/noncore/settings/networksettings2/ppp/PPPIPGUI.ui
+++ b/noncore/settings/networksettings2/ppp/PPPIPGUI.ui
@@ -8,14 +8,14 @@
8 </property> 8 </property>
9 <property stdset="1"> 9 <property stdset="1">
10 <name>geometry</name> 10 <name>geometry</name>
11 <rect> 11 <rect>
12 <x>0</x> 12 <x>0</x>
13 <y>0</y> 13 <y>0</y>
14 <width>133</width> 14 <width>258</width>
15 <height>235</height> 15 <height>232</height>
16 </rect> 16 </rect>
17 </property> 17 </property>
18 <property stdset="1"> 18 <property stdset="1">
19 <name>caption</name> 19 <name>caption</name>
20 <string>PPPIP</string> 20 <string>PPPIP</string>
21 </property> 21 </property>
@@ -25,217 +25,146 @@
25 <property> 25 <property>
26 <name>layoutSpacing</name> 26 <name>layoutSpacing</name>
27 </property> 27 </property>
28 <vbox> 28 <vbox>
29 <property stdset="1"> 29 <property stdset="1">
30 <name>margin</name> 30 <name>margin</name>
31 <number>3</number> 31 <number>0</number>
32 </property> 32 </property>
33 <property stdset="1"> 33 <property stdset="1">
34 <name>spacing</name> 34 <name>spacing</name>
35 <number>2</number> 35 <number>1</number>
36 </property> 36 </property>
37 <widget> 37 <widget>
38 <class>QButtonGroup</class> 38 <class>QGroupBox</class>
39 <property stdset="1"> 39 <property stdset="1">
40 <name>name</name> 40 <name>name</name>
41 <cstring>ButtonGroup4</cstring> 41 <cstring>GroupBox1</cstring>
42 </property>
43 <property stdset="1">
44 <name>frameShape</name>
45 <enum>Box</enum>
46 </property> 42 </property>
47 <property stdset="1"> 43 <property stdset="1">
48 <name>title</name> 44 <name>title</name>
49 <string>IP</string> 45 <string>IP</string>
50 </property> 46 </property>
51 <property> 47 <property>
52 <name>layoutMargin</name> 48 <name>layoutMargin</name>
53 </property> 49 </property>
54 <property> 50 <property>
55 <name>layoutSpacing</name> 51 <name>layoutSpacing</name>
56 </property> 52 </property>
57 <vbox> 53 <grid>
58 <property stdset="1"> 54 <property stdset="1">
59 <name>margin</name> 55 <name>margin</name>
60 <number>2</number> 56 <number>3</number>
61 </property> 57 </property>
62 <property stdset="1"> 58 <property stdset="1">
63 <name>spacing</name> 59 <name>spacing</name>
64 <number>2</number> 60 <number>2</number>
65 </property> 61 </property>
66 <widget> 62 <widget row="0" column="0" >
67 <class>QRadioButton</class> 63 <class>QLabel</class>
68 <property stdset="1"> 64 <property stdset="1">
69 <name>name</name> 65 <name>name</name>
70 <cstring>IPServerAssigned_RB</cstring> 66 <cstring>TextLabel1</cstring>
67 </property>
68 <property stdset="1">
69 <name>enabled</name>
70 <bool>true</bool>
71 </property> 71 </property>
72 <property stdset="1"> 72 <property stdset="1">
73 <name>text</name> 73 <name>text</name>
74 <string>Server assigned</string> 74 <string>Local</string>
75 </property> 75 </property>
76 </widget>
77 <widget row="0" column="1" >
78 <class>QLineEdit</class>
76 <property stdset="1"> 79 <property stdset="1">
77 <name>checked</name> 80 <name>name</name>
81 <cstring>LocalAddress_LE</cstring>
82 </property>
83 <property stdset="1">
84 <name>enabled</name>
78 <bool>true</bool> 85 <bool>true</bool>
79 </property> 86 </property>
80 </widget> 87 </widget>
81 <widget> 88 <widget row="0" column="2" >
82 <class>QRadioButton</class> 89 <class>QCheckBox</class>
83 <property stdset="1"> 90 <property stdset="1">
84 <name>name</name> 91 <name>name</name>
85 <cstring>IPFixed_RB</cstring> 92 <cstring>ServerOverrulesLocal_CB</cstring>
86 </property> 93 </property>
87 <property stdset="1"> 94 <property stdset="1">
88 <name>text</name> 95 <name>text</name>
89 <string>Fixed</string> 96 <string>Server Overrules</string>
90 </property> 97 </property>
91 </widget> 98 </widget>
92 <widget> 99 <widget row="1" column="1" >
93 <class>QLayoutWidget</class> 100 <class>QLineEdit</class>
94 <property stdset="1"> 101 <property stdset="1">
95 <name>name</name> 102 <name>name</name>
96 <cstring>Layout11</cstring> 103 <cstring>RemoteAddress_LE</cstring>
104 </property>
105 <property stdset="1">
106 <name>enabled</name>
107 <bool>true</bool>
97 </property> 108 </property>
98 <hbox>
99 <property stdset="1">
100 <name>margin</name>
101 <number>0</number>
102 </property>
103 <property stdset="1">
104 <name>spacing</name>
105 <number>6</number>
106 </property>
107 <spacer>
108 <property>
109 <name>name</name>
110 <cstring>Spacer8</cstring>
111 </property>
112 <property stdset="1">
113 <name>orientation</name>
114 <enum>Horizontal</enum>
115 </property>
116 <property stdset="1">
117 <name>sizeType</name>
118 <enum>Fixed</enum>
119 </property>
120 <property>
121 <name>sizeHint</name>
122 <size>
123 <width>20</width>
124 <height>20</height>
125 </size>
126 </property>
127 <property>
128 <name>layoutMargin</name>
129 </property>
130 <property>
131 <name>layoutSpacing</name>
132 </property>
133 </spacer>
134 <widget>
135 <class>QFrame</class>
136 <property stdset="1">
137 <name>name</name>
138 <cstring>Frame8</cstring>
139 </property>
140 <property stdset="1">
141 <name>enabled</name>
142 <bool>false</bool>
143 </property>
144 <property stdset="1">
145 <name>sizePolicy</name>
146 <sizepolicy>
147 <hsizetype>7</hsizetype>
148 <vsizetype>5</vsizetype>
149 </sizepolicy>
150 </property>
151 <property stdset="1">
152 <name>frameShape</name>
153 <enum>NoFrame</enum>
154 </property>
155 <property stdset="1">
156 <name>frameShadow</name>
157 <enum>Raised</enum>
158 </property>
159 <property>
160 <name>layoutMargin</name>
161 </property>
162 <property>
163 <name>layoutSpacing</name>
164 </property>
165 <grid>
166 <property stdset="1">
167 <name>margin</name>
168 <number>2</number>
169 </property>
170 <property stdset="1">
171 <name>spacing</name>
172 <number>2</number>
173 </property>
174 <widget row="0" column="1" >
175 <class>QLineEdit</class>
176 <property stdset="1">
177 <name>name</name>
178 <cstring>IPAddress_LE</cstring>
179 </property>
180 </widget>
181 <widget row="1" column="0" >
182 <class>QLabel</class>
183 <property stdset="1">
184 <name>name</name>
185 <cstring>TextLabel3</cstring>
186 </property>
187 <property stdset="1">
188 <name>text</name>
189 <string>Subnetmask</string>
190 </property>
191 </widget>
192 <widget row="0" column="0" >
193 <class>QLabel</class>
194 <property stdset="1">
195 <name>name</name>
196 <cstring>TextLabel2</cstring>
197 </property>
198 <property stdset="1">
199 <name>text</name>
200 <string>Address</string>
201 </property>
202 </widget>
203 <widget row="1" column="1" >
204 <class>QLineEdit</class>
205 <property stdset="1">
206 <name>name</name>
207 <cstring>IPSubMask_LE</cstring>
208 </property>
209 </widget>
210 </grid>
211 </widget>
212 </hbox>
213 </widget> 109 </widget>
214 </vbox> 110 <widget row="1" column="2" >
111 <class>QCheckBox</class>
112 <property stdset="1">
113 <name>name</name>
114 <cstring>ServerOverrulesRemote_CB</cstring>
115 </property>
116 <property stdset="1">
117 <name>text</name>
118 <string>Server Overrules</string>
119 </property>
120 </widget>
121 <widget row="1" column="0" >
122 <class>QLabel</class>
123 <property stdset="1">
124 <name>name</name>
125 <cstring>TextLabel1_2</cstring>
126 </property>
127 <property stdset="1">
128 <name>enabled</name>
129 <bool>true</bool>
130 </property>
131 <property stdset="1">
132 <name>text</name>
133 <string>Remote</string>
134 </property>
135 </widget>
136 </grid>
215 </widget> 137 </widget>
216 <widget> 138 <widget>
217 <class>QButtonGroup</class> 139 <class>QButtonGroup</class>
218 <property stdset="1"> 140 <property stdset="1">
219 <name>name</name> 141 <name>name</name>
220 <cstring>ButtonGroup5</cstring> 142 <cstring>ButtonGroup5</cstring>
221 </property> 143 </property>
222 <property stdset="1"> 144 <property stdset="1">
145 <name>sizePolicy</name>
146 <sizepolicy>
147 <hsizetype>5</hsizetype>
148 <vsizetype>1</vsizetype>
149 </sizepolicy>
150 </property>
151 <property stdset="1">
223 <name>title</name> 152 <name>title</name>
224 <string>Gateway</string> 153 <string>Gateway</string>
225 </property> 154 </property>
226 <property> 155 <property>
227 <name>layoutMargin</name> 156 <name>layoutMargin</name>
228 </property> 157 </property>
229 <property> 158 <property>
230 <name>layoutSpacing</name> 159 <name>layoutSpacing</name>
231 </property> 160 </property>
232 <vbox> 161 <vbox>
233 <property stdset="1"> 162 <property stdset="1">
234 <name>margin</name> 163 <name>margin</name>
235 <number>2</number> 164 <number>3</number>
236 </property> 165 </property>
237 <property stdset="1"> 166 <property stdset="1">
238 <name>spacing</name> 167 <name>spacing</name>
239 <number>2</number> 168 <number>2</number>
240 </property> 169 </property>
241 <widget> 170 <widget>
@@ -375,23 +304,34 @@
375 </hbox> 304 </hbox>
376 </widget> 305 </widget>
377 <widget> 306 <widget>
378 <class>QLayoutWidget</class> 307 <class>QLayoutWidget</class>
379 <property stdset="1"> 308 <property stdset="1">
380 <name>name</name> 309 <name>name</name>
381 <cstring>Layout3</cstring> 310 <cstring>Layout4</cstring>
382 </property> 311 </property>
383 <hbox> 312 <hbox>
384 <property stdset="1"> 313 <property stdset="1">
385 <name>margin</name> 314 <name>margin</name>
386 <number>0</number> 315 <number>0</number>
387 </property> 316 </property>
388 <property stdset="1"> 317 <property stdset="1">
389 <name>spacing</name> 318 <name>spacing</name>
390 <number>6</number> 319 <number>6</number>
391 </property> 320 </property>
321 <widget>
322 <class>QCheckBox</class>
323 <property stdset="1">
324 <name>name</name>
325 <cstring>GWIsDefault_CB</cstring>
326 </property>
327 <property stdset="1">
328 <name>text</name>
329 <string>Set as default</string>
330 </property>
331 </widget>
392 <spacer> 332 <spacer>
393 <property> 333 <property>
394 <name>name</name> 334 <name>name</name>
395 <cstring>Spacer3</cstring> 335 <cstring>Spacer3</cstring>
396 </property> 336 </property>
397 <property stdset="1"> 337 <property stdset="1">
@@ -411,34 +351,49 @@
411 </property> 351 </property>
412 </spacer> 352 </spacer>
413 <widget> 353 <widget>
414 <class>QCheckBox</class> 354 <class>QCheckBox</class>
415 <property stdset="1"> 355 <property stdset="1">
416 <name>name</name> 356 <name>name</name>
417 <cstring>GWIsDefault_CB</cstring> 357 <cstring>GWIfNotSet_CB</cstring>
418 </property> 358 </property>
419 <property stdset="1"> 359 <property stdset="1">
420 <name>text</name> 360 <name>text</name>
421 <string>Set as default</string> 361 <string>Only if not yet set</string>
422 </property> 362 </property>
423 </widget> 363 </widget>
424 </hbox> 364 </hbox>
425 </widget> 365 </widget>
426 </vbox> 366 </vbox>
427 </widget> 367 </widget>
368 <spacer>
369 <property>
370 <name>name</name>
371 <cstring>Spacer4</cstring>
372 </property>
373 <property stdset="1">
374 <name>orientation</name>
375 <enum>Vertical</enum>
376 </property>
377 <property stdset="1">
378 <name>sizeType</name>
379 <enum>Expanding</enum>
380 </property>
381 <property>
382 <name>sizeHint</name>
383 <size>
384 <width>20</width>
385 <height>20</height>
386 </size>
387 </property>
388 </spacer>
428 </vbox> 389 </vbox>
429</widget> 390</widget>
430<connections> 391<connections>
431 <connection> 392 <connection>
432 <sender>GWFixed_RB</sender> 393 <sender>GWFixed_RB</sender>
433 <signal>toggled(bool)</signal> 394 <signal>toggled(bool)</signal>
434 <receiver>Frame9</receiver> 395 <receiver>Frame9</receiver>
435 <slot>setEnabled(bool)</slot> 396 <slot>setEnabled(bool)</slot>
436 </connection> 397 </connection>
437 <connection>
438 <sender>IPFixed_RB</sender>
439 <signal>toggled(bool)</signal>
440 <receiver>Frame8</receiver>
441 <slot>setEnabled(bool)</slot>
442 </connection>
443</connections> 398</connections>
444</UI> 399</UI>
diff --git a/noncore/settings/networksettings2/ppp/PPPIPedit.cpp b/noncore/settings/networksettings2/ppp/PPPIPedit.cpp
index 6965e5a..ef1b7c0 100644
--- a/noncore/settings/networksettings2/ppp/PPPIPedit.cpp
+++ b/noncore/settings/networksettings2/ppp/PPPIPedit.cpp
@@ -6,52 +6,49 @@
6#include "PPPIPedit.h" 6#include "PPPIPedit.h"
7 7
8PPPIPEdit::PPPIPEdit( QWidget * Parent ) : PPPIPGUI( Parent ){ 8PPPIPEdit::PPPIPEdit( QWidget * Parent ) : PPPIPGUI( Parent ){
9} 9}
10 10
11QString PPPIPEdit::acceptable( void ) { 11QString PPPIPEdit::acceptable( void ) {
12 if( IPFixed_RB->isChecked() ) { 12 if( GWFixed_RB->isChecked() ) {
13 if( IPAddress_LE->text().isEmpty() )
14 return tr("IPAddress needed" );
15 if( ! validIP( IPAddress_LE->text() ) )
16 return tr("IPAddress not valid" );
17 if( IPSubMask_LE->text().isEmpty() )
18 return tr("Subnet mask needed" );
19 if( ! validIP( IPSubMask_LE->text() ) )
20 return tr("Subnet mask not valid" );
21 } else if( GWFixed_RB->isChecked() ) {
22 if( GWAddress_LE->text().isEmpty() ) 13 if( GWAddress_LE->text().isEmpty() )
23 return tr("Gateway address needed" ); 14 return tr("Gateway address needed" );
24 if( ! validIP( GWAddress_LE->text() ) ) 15 if( ! validIP( GWAddress_LE->text() ) )
25 return tr("Gateway address not valid" ); 16 return tr("Gateway address not valid" );
26 }; 17 };
27 18
28 return QString(); 19 return QString();
29} 20}
30 21
31bool PPPIPEdit::commit( PPPData_t & D ) { 22bool PPPIPEdit::commit( PPPData & D ) {
32 23
33 bool SM = 0; 24 bool SM = 0;
34 25
35 CBM( D.IP.IPAutomatic, IPServerAssigned_RB, SM ); 26 CBM( D.IP.LocalOverrule, ServerOverrulesLocal_CB, SM );
36 if( ! D.IP.IPAutomatic ) { 27 CBM( D.IP.RemoteOverrule, ServerOverrulesRemote_CB, SM );
37 TXTM( D.IP.IPAddress, IPAddress_LE, SM ); 28
38 TXTM( D.IP.IPSubMask, IPSubMask_LE, SM ); 29 TXTM( D.IP.LocalAddress, LocalAddress_LE, SM );
39 } 30 TXTM( D.IP.RemoteAddress, RemoteAddress_LE, SM );
40 31
41 CBM( D.IP.GWAutomatic, GWServerAssigned_RB, SM ); 32 CBM( D.IP.GWAutomatic, GWServerAssigned_RB, SM );
33
42 if( ! D.IP.GWAutomatic ) { 34 if( ! D.IP.GWAutomatic ) {
43 TXTM( D.IP.GWAddress, GWAddress_LE, SM ); 35 TXTM( D.IP.GWAddress, GWAddress_LE, SM );
44 } 36 }
45 37
46 CBM( D.IP.GWIsDefault, GWIsDefault_CB, SM ); 38 CBM( D.IP.GWIsDefault, GWIsDefault_CB, SM );
39 CBM( D.IP.GWIfNotSet, GWIfNotSet_CB, SM );
40
47 return SM; 41 return SM;
48} 42}
49 43
50void PPPIPEdit::showData( PPPData_t & D ) { 44void PPPIPEdit::showData( PPPData & D ) {
51 IPServerAssigned_RB->setChecked( D.IP.IPAutomatic ); 45 ServerOverrulesLocal_CB->setChecked( D.IP.LocalOverrule );
52 IPAddress_LE->setText( D.IP.IPAddress ); 46 ServerOverrulesRemote_CB->setChecked( D.IP.RemoteOverrule );
53 IPSubMask_LE->setText( D.IP.IPSubMask ); 47 LocalAddress_LE->setText( D.IP.LocalAddress );
48 RemoteAddress_LE->setText( D.IP.RemoteAddress );
49
54 GWServerAssigned_RB->setChecked( D.IP.GWAutomatic ); 50 GWServerAssigned_RB->setChecked( D.IP.GWAutomatic );
55 GWAddress_LE->setText( D.IP.GWAddress ); 51 GWAddress_LE->setText( D.IP.GWAddress );
56 GWIsDefault_CB->setChecked( D.IP.GWIsDefault ); 52 GWIsDefault_CB->setChecked( D.IP.GWIsDefault );
53 GWIfNotSet_CB->setChecked( D.IP.GWIfNotSet );
57} 54}
diff --git a/noncore/settings/networksettings2/ppp/PPPIPedit.h b/noncore/settings/networksettings2/ppp/PPPIPedit.h
index 153ee68..5ca4326 100644
--- a/noncore/settings/networksettings2/ppp/PPPIPedit.h
+++ b/noncore/settings/networksettings2/ppp/PPPIPedit.h
@@ -4,12 +4,12 @@
4class PPPIPEdit : public PPPIPGUI { 4class PPPIPEdit : public PPPIPGUI {
5 5
6public : 6public :
7 7
8 PPPIPEdit( QWidget * parent ); 8 PPPIPEdit( QWidget * parent );
9 QString acceptable( void ); 9 QString acceptable( void );
10 bool commit( PPPData_t & Data ); 10 bool commit( PPPData & Data );
11 void showData( PPPData_t & Data ); 11 void showData( PPPData & Data );
12 12
13private : 13private :
14 14
15}; 15};
diff --git a/noncore/settings/networksettings2/ppp/PPPedit.cpp b/noncore/settings/networksettings2/ppp/PPPedit.cpp
index eb4fdbf..17889aa 100644
--- a/noncore/settings/networksettings2/ppp/PPPedit.cpp
+++ b/noncore/settings/networksettings2/ppp/PPPedit.cpp
@@ -1,21 +1,28 @@
1#include <qwidgetstack.h> 1#include <qwidgetstack.h>
2 2
3#include "PPPIPedit.h" 3#include "PPPIPedit.h"
4#include "PPPDNSedit.h" 4#include "PPPDNSedit.h"
5#include "PPPAuthedit.h" 5#include "PPPAuthedit.h"
6#include "PPPRunedit.h"
7#include "PPPDialingedit.h"
6#include "PPPedit.h" 8#include "PPPedit.h"
7 9
8PPPEdit::PPPEdit( QWidget * Parent ) : PPPGUI( Parent ){ 10PPPEdit::PPPEdit( QWidget * Parent ) : PPPGUI( Parent ){
9 11
10 Auth = new PPPAuthEdit( Options_WS ); 12 Auth = new PPPAuthEdit( Options_WS );
11 IP = new PPPIPEdit( Options_WS ); 13 IP = new PPPIPEdit( Options_WS );
12 DNS = new PPPDNSEdit( Options_WS ); 14 DNS = new PPPDNSEdit( Options_WS );
15 Run = new PPPRunEdit( Options_WS );
16 Dialing = new PPPDialingEdit( Options_WS );
17
13 Options_WS->addWidget( Auth, 0 ); 18 Options_WS->addWidget( Auth, 0 );
14 Options_WS->addWidget( IP, 1 ); 19 Options_WS->addWidget( IP, 1 );
15 Options_WS->addWidget( DNS, 2 ); 20 Options_WS->addWidget( DNS, 2 );
21 Options_WS->addWidget( Run, 3 );
22 Options_WS->addWidget( Dialing, 4 );
16 23
17 Options_WS->raiseWidget( 0 ); 24 Options_WS->raiseWidget( 0 );
18} 25}
19 26
20QString PPPEdit::acceptable( void ) { 27QString PPPEdit::acceptable( void ) {
21 QString S; 28 QString S;
@@ -26,21 +33,21 @@ QString PPPEdit::acceptable( void ) {
26 S = DNS->acceptable(); 33 S = DNS->acceptable();
27 } 34 }
28 } 35 }
29 return S; 36 return S;
30} 37}
31 38
32bool PPPEdit::commit( PPPData_t & Data ) { 39bool PPPEdit::commit( PPPData & Data ) {
33 bool SM ; 40 bool SM ;
34 SM = Auth->commit( Data ); 41 SM = Auth->commit( Data );
35 SM |= IP->commit( Data ); 42 SM |= IP->commit( Data );
36 SM |= DNS->commit( Data ); 43 SM |= DNS->commit( Data );
37 return SM; 44 return SM;
38} 45}
39 46
40void PPPEdit::showData( PPPData_t & Data ) { 47void PPPEdit::showData( PPPData & Data ) {
41 Auth->showData( Data ) ; 48 Auth->showData( Data ) ;
42 IP->showData( Data ); 49 IP->showData( Data );
43 DNS->showData( Data ); 50 DNS->showData( Data );
44} 51}
45 52
46void PPPEdit::SLOT_SelectTopic( int v ) { 53void PPPEdit::SLOT_SelectTopic( int v ) {
diff --git a/noncore/settings/networksettings2/ppp/PPPedit.h b/noncore/settings/networksettings2/ppp/PPPedit.h
index 57d38ee..f674b17 100644
--- a/noncore/settings/networksettings2/ppp/PPPedit.h
+++ b/noncore/settings/networksettings2/ppp/PPPedit.h
@@ -1,27 +1,31 @@
1#include "pppdata.h" 1#include "pppdata.h"
2#include "PPPGUI.h" 2#include "PPPGUI.h"
3 3
4class PPPAuthEdit; 4class PPPAuthEdit;
5class PPPIPEdit; 5class PPPIPEdit;
6class PPPDNSEdit; 6class PPPDNSEdit;
7class PPPRunEdit;
8class PPPDialingEdit;
7 9
8class PPPEdit : public PPPGUI { 10class PPPEdit : public PPPGUI {
9 11
10public : 12public :
11 13
12 PPPEdit( QWidget * parent ); 14 PPPEdit( QWidget * parent );
13 QString acceptable( void ); 15 QString acceptable( void );
14 bool commit( PPPData_t & Data ); 16 bool commit( PPPData & Data );
15 void showData( PPPData_t & Data ); 17 void showData( PPPData & Data );
16 18
17public slots : 19public slots :
18 20
19 void SLOT_SelectTopic( int ); 21 void SLOT_SelectTopic( int );
20 22
21private : 23private :
22 24
23 PPPAuthEdit * Auth; 25 PPPAuthEdit * Auth;
24 PPPDNSEdit * DNS; 26 PPPDNSEdit * DNS;
25 PPPIPEdit * IP; 27 PPPIPEdit * IP;
28 PPPRunEdit * Run;
29 PPPDialingEdit * Dialing;
26 30
27}; 31};
diff --git a/noncore/settings/networksettings2/ppp/opie-networksettings2plugin-ppp.control b/noncore/settings/networksettings2/ppp/opie-networksettings2plugin-ppp.control
index 7dfde38..19d1c89 100644
--- a/noncore/settings/networksettings2/ppp/opie-networksettings2plugin-ppp.control
+++ b/noncore/settings/networksettings2/ppp/opie-networksettings2plugin-ppp.control
@@ -1,7 +1,7 @@
1Package: opie-networksettingsplugin2-ppp 1Package: opie-networksettings2plugin-ppp
2Files: plugins/networksettings2/libppp.so* 2Files: plugins/networksettings2/libppp.so*
3Priority: optional 3Priority: optional
4Section: opie/settings 4Section: opie/settings
5Maintainer: Wim Delvaux <wimpie@handhelds.org> 5Maintainer: Wim Delvaux <wimpie@handhelds.org>
6Architecture: arm 6Architecture: arm
7Depends: opie-networksettings2, libopiecore2, libopienet2 7Depends: opie-networksettings2, libopiecore2, libopienet2
diff --git a/noncore/settings/networksettings2/ppp/ppp.pro b/noncore/settings/networksettings2/ppp/ppp.pro
index f866bee..dd3408c 100644
--- a/noncore/settings/networksettings2/ppp/ppp.pro
+++ b/noncore/settings/networksettings2/ppp/ppp.pro
@@ -3,22 +3,31 @@ CONFIG += qt warn_on release
3DESTDIR = $(OPIEDIR)/plugins/networksettings2 3DESTDIR = $(OPIEDIR)/plugins/networksettings2
4 HEADERS = ppp_NN.h \ 4 HEADERS = ppp_NN.h \
5 ppp_NNI.h \ 5 ppp_NNI.h \
6 PPPedit.h \ 6 PPPedit.h \
7 PPPAuthedit.h \ 7 PPPAuthedit.h \
8 PPPDNSedit.h \ 8 PPPDNSedit.h \
9 PPPRunedit.h \
10 PPPDialingedit.h \
9 PPPIPedit.h 11 PPPIPedit.h
10 SOURCES = ppp_NN.cpp \ 12 SOURCES = ppp_NN.cpp \
11 ppp_NNI.cpp \ 13 ppp_NNI.cpp \
12 PPPedit.cpp \ 14 PPPedit.cpp \
13 PPPDNSedit.cpp \ 15 PPPDNSedit.cpp \
16 PPPRunedit.cpp \
17 PPPDialingedit.cpp \
14 PPPAuthedit.cpp \ 18 PPPAuthedit.cpp \
15 ppprun.cpp \ 19 ppprun.cpp \
16 PPPIPedit.cpp 20 PPPIPedit.cpp
17 INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2 21 INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2
18 DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2 22 DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2
19LIBS += -lqpe 23LIBS += -lqpe
20 INTERFACES= PPPGUI.ui PPPAuthGUI.ui PPPIPGUI.ui PPPDNSGUI.ui 24 INTERFACES= PPPGUI.ui \
25 PPPAuthGUI.ui \
26 PPPIPGUI.ui \
27 PPPDNSGUI.ui \
28 PPPDialingGUI.ui \
29 PPPRunGUI.ui
21 TARGET = ppp 30 TARGET = ppp
22 VERSION = 1.0.0 31 VERSION = 1.0.0
23 32
24include( $(OPIEDIR)/include.pro ) 33include( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/networksettings2/ppp/ppp_NN.cpp b/noncore/settings/networksettings2/ppp/ppp_NN.cpp
index ff4465c..51ba27d 100644
--- a/noncore/settings/networksettings2/ppp/ppp_NN.cpp
+++ b/noncore/settings/networksettings2/ppp/ppp_NN.cpp
@@ -1,34 +1,33 @@
1#include <qfile.h> 1#include <qfile.h>
2#include <resources.h>
2#include <qtextstream.h> 3#include <qtextstream.h>
3#include "ppp_NN.h" 4#include "ppp_NN.h"
4#include "ppp_NNI.h" 5#include "ppp_NNI.h"
5 6
6QStringList * PPPNetNode::ProperFiles = 0; 7QStringList * PPPNetNode::ProperFiles = 0;
7 8
8static const char * PPPNeeds[] = 9static const char * PPPNeeds[] =
9 { "line", 10 { "modem",
10 "modem", 11 0
12 };
13
14static const char * PPPProvides[] =
15 { "connection",
11 0 16 0
12 }; 17 };
13 18
14/** 19/**
15 * Constructor, find all of the possible interfaces 20 * Constructor, find all of the possible interfaces
16 */ 21 */
17PPPNetNode::PPPNetNode() : ANetNode(tr("PPP Connection")) { 22PPPNetNode::PPPNetNode() : ANetNode(tr("PPP Connection")) {
18 23
19 // proper files : will leak
20 ProperFiles =new QStringList;
21 *ProperFiles << "peers";
22 *ProperFiles << "chatscript";
23
24 // system files
25 NSResources->addSystemFile( 24 NSResources->addSystemFile(
26 "pap-secrets", "/tmp/pap-secrets", 0 ); 25 "pap-secrets", "/etc/ppp/pap-secrets", 0 );
27 NSResources->addSystemFile( 26 NSResources->addSystemFile(
28 "chap-secrets", "/tmp/chap-secrets", 0 ); 27 "chap-secrets", "/etc/ppp/chap-secrets", 0 );
29} 28}
30 29
31/** 30/**
32 * Delete any interfaces that we own. 31 * Delete any interfaces that we own.
33 */ 32 */
34PPPNetNode::~PPPNetNode(){ 33PPPNetNode::~PPPNetNode(){
@@ -47,27 +46,28 @@ ANetNodeInstance * PPPNetNode::createInstance( void ) {
47} 46}
48 47
49const char ** PPPNetNode::needs( void ) { 48const char ** PPPNetNode::needs( void ) {
50 return PPPNeeds; 49 return PPPNeeds;
51} 50}
52 51
53const char * PPPNetNode::provides( void ) { 52const char ** PPPNetNode::provides( void ) {
54 return "connection"; 53 return PPPProvides;
55} 54}
56 55
57QStringList * PPPNetNode::properFiles( void ) { 56QStringList PPPNetNode::properFiles( void ) {
58 return ProperFiles; 57 QStringList SL;
59 58 SL << "peers" << "chatscripts";
59 return SL;
60} 60}
61 61
62// need to generate : 62// need to generate :
63// /etc/ppp/pap-secrets 63// /etc/ppp/pap-secrets
64// /etc/ppp/pap-secrets 64// /etc/ppp/pap-secrets
65bool PPPNetNode::hasDataForFile( const QString & S ) { 65bool PPPNetNode::hasDataForFile( SystemFile & S ) {
66 return S == "pap-secrets" || 66 return S.name() == "pap-secrets" ||
67 S == "chap-secrets" ; 67 S.name() == "chap-secrets" ;
68} 68}
69 69
70QString PPPNetNode::genNic( long NicNr ) { 70QString PPPNetNode::genNic( long NicNr ) {
71 QString S; 71 QString S;
72 return S.sprintf( "ppp%ld", NicNr ); 72 return S.sprintf( "ppp%ld", NicNr );
73} 73}
diff --git a/noncore/settings/networksettings2/ppp/ppp_NN.h b/noncore/settings/networksettings2/ppp/ppp_NN.h
index 249be5a..3ead10e 100644
--- a/noncore/settings/networksettings2/ppp/ppp_NN.h
+++ b/noncore/settings/networksettings2/ppp/ppp_NN.h
@@ -14,21 +14,21 @@ public:
14 PPPNetNode(); 14 PPPNetNode();
15 virtual ~PPPNetNode(); 15 virtual ~PPPNetNode();
16 16
17 virtual const QString pixmapName() 17 virtual const QString pixmapName()
18 { return "Devices/ppp"; } 18 { return "Devices/ppp"; }
19 19
20 virtual bool hasDataForFile( const QString & S ); 20 virtual bool hasDataForFile( SystemFile & S );
21 21
22 virtual const QString nodeDescription() ; 22 virtual const QString nodeDescription() ;
23 virtual ANetNodeInstance * createInstance( void ); 23 virtual ANetNodeInstance * createInstance( void );
24 virtual const char ** needs( void ); 24 virtual const char ** needs( void );
25 virtual const char * provides( void ); 25 virtual const char ** provides( void );
26 26
27 virtual QString genNic( long NicNr ); 27 virtual QString genNic( long NicNr );
28 virtual QStringList * properFiles( void ); 28 virtual QStringList properFiles( void );
29 29
30private: 30private:
31 31
32 virtual void setSpecificAttribute( QString & Attr, QString & Value ); 32 virtual void setSpecificAttribute( QString & Attr, QString & Value );
33 virtual void saveSpecificAttribute( QTextStream & TS ); 33 virtual void saveSpecificAttribute( QTextStream & TS );
34 34
diff --git a/noncore/settings/networksettings2/ppp/ppp_NNI.cpp b/noncore/settings/networksettings2/ppp/ppp_NNI.cpp
index ba639de..9e3bb64 100644
--- a/noncore/settings/networksettings2/ppp/ppp_NNI.cpp
+++ b/noncore/settings/networksettings2/ppp/ppp_NNI.cpp
@@ -13,18 +13,27 @@ APPP::APPP( PPPNetNode * PNN ) : ANetNodeInstance( PNN ) {
13 Data.Auth.Password.Expect = "assword:"; 13 Data.Auth.Password.Expect = "assword:";
14 Data.Auth.PCEMode = 0; 14 Data.Auth.PCEMode = 0;
15 Data.Auth.Client = "*"; 15 Data.Auth.Client = "*";
16 Data.Auth.Server = "*"; 16 Data.Auth.Server = "*";
17 Data.Auth.Secret = ""; 17 Data.Auth.Secret = "";
18 18
19 Data.IP.IPAutomatic = 1; 19 Data.IP.LocalAddress = "10.0.0.1";
20 Data.IP.IPAddress = ""; 20 Data.IP.RemoteAddress = "10.0.0.2";
21 Data.IP.IPSubMask = ""; 21 Data.IP.LocalOverrule = 1;
22 Data.IP.RemoteOverrule = 1;
23
22 Data.IP.GWAutomatic = 1; 24 Data.IP.GWAutomatic = 1;
23 Data.IP.GWAddress = ""; 25 Data.IP.GWAddress = "";
24 Data.IP.GWIsDefault = 1; 26 Data.IP.GWIsDefault = 1;
27 Data.IP.GWIfNotSet = 1;
28
29 Data.Run.PreConnect = "";
30 Data.Run.PostConnect = "";
31 Data.Run.PreDisconnect = "";
32 Data.Run.PostDisconnect = "";
33
25 GUI = 0; 34 GUI = 0;
26 RT = 0; 35 RT = 0;
27 36
28} 37}
29 38
30void APPP::setSpecificAttribute( QString & A, QString & V ) { 39void APPP::setSpecificAttribute( QString & A, QString & V ) {
@@ -56,25 +65,39 @@ void APPP::setSpecificAttribute( QString & A, QString & V ) {
56 } else if( A == "authserver" ) { 65 } else if( A == "authserver" ) {
57 Data.Auth.Server = V; 66 Data.Auth.Server = V;
58 } else if( A == "authsecret" ) { 67 } else if( A == "authsecret" ) {
59 Data.Auth.Secret = V; 68 Data.Auth.Secret = V;
60 } 69 }
61 } else if( A.startsWith( "ip" ) ) { 70 } else if( A.startsWith( "ip" ) ) {
62 if( A == "ipautomatic" ) { 71 if( A == "iplocaloverrule" ) {
63 Data.IP.IPAutomatic = (V == "yes"); 72 Data.IP.LocalOverrule = (V == "yes");
64 } else if( A == "gwautomatic" ) { 73 } else if( A == "ipremoteoverrule" ) {
74 Data.IP.RemoteOverrule = (V == "yes");
75 } else if( A == "ipgwautomatic" ) {
65 Data.IP.GWAutomatic = (V == "yes"); 76 Data.IP.GWAutomatic = (V == "yes");
66 } else if( A == "gwisdefault" ) { 77 } else if( A == "ipgwisdefault" ) {
67 Data.IP.GWIsDefault = (V == "yes"); 78 Data.IP.GWIsDefault = (V == "yes");
68 } else if( A == "ipaddress" ) { 79 } else if( A == "ipgwifnotset" ) {
69 Data.IP.IPAddress = V; 80 Data.IP.GWIfNotSet = (V == "yes");
70 } else if( A == "ipsubmask" ) { 81 } else if( A == "iplocaladdress" ) {
71 Data.IP.IPSubMask = V; 82 Data.IP.LocalAddress = V;
72 } else if( A == "gwaddress" ) { 83 } else if( A == "ipremoteaddress" ) {
84 Data.IP.RemoteAddress = V;
85 } else if( A == "ipgwaddress" ) {
73 Data.IP.GWAddress = V; 86 Data.IP.GWAddress = V;
74 } 87 }
88 } else if( A.startsWith( "run" ) ) {
89 if( A == "runpreconnect" ) {
90 Data.Run.PreConnect = V;
91 } else if( A == "runpostconnect" ) {
92 Data.Run.PostConnect = V;
93 } else if( A == "runpredisconnect" ) {
94 Data.Run.PreDisconnect = V;
95 } else if( A == "runpostdisconnect" ) {
96 Data.Run.PostDisconnect = V;
97 }
75 } 98 }
76} 99}
77 100
78void APPP::saveSpecificAttribute( QTextStream & TS ) { 101void APPP::saveSpecificAttribute( QTextStream & TS ) {
79 TS << "dnsserverassigned=" << 102 TS << "dnsserverassigned=" <<
80 ( ( Data.DNS.ServerAssigned ) ? "yes" : "no" ) << endl; 103 ( ( Data.DNS.ServerAssigned ) ? "yes" : "no" ) << endl;
@@ -88,18 +111,26 @@ void APPP::saveSpecificAttribute( QTextStream & TS ) {
88 TS << "authpasswordexpect=" << quote( Data.Auth.Password.Expect ) << endl; 111 TS << "authpasswordexpect=" << quote( Data.Auth.Password.Expect ) << endl;
89 TS << "authpasswordsend=" << quote( Data.Auth.Password.Send ) << endl; 112 TS << "authpasswordsend=" << quote( Data.Auth.Password.Send ) << endl;
90 TS << "authpcemode=" << Data.Auth.PCEMode << endl; 113 TS << "authpcemode=" << Data.Auth.PCEMode << endl;
91 TS << "authclient=" << Data.Auth.Client << endl; 114 TS << "authclient=" << Data.Auth.Client << endl;
92 TS << "authserver=" << Data.Auth.Server << endl; 115 TS << "authserver=" << Data.Auth.Server << endl;
93 TS << "authsecret=" << quote( Data.Auth.Secret ) << endl; 116 TS << "authsecret=" << quote( Data.Auth.Secret ) << endl;
94 TS << "ipautomatic=" << ( ( Data.IP.IPAutomatic ) ? "yes" : "no" ) << endl; 117 TS << "ipgwautomatic=" << ( ( Data.IP.GWAutomatic ) ? "yes" : "no" ) << endl;
95 TS << "gwautomatic=" << ( ( Data.IP.GWAutomatic ) ? "yes" : "no" ) << endl; 118 TS << "ipgwisdefault=" << ( ( Data.IP.GWIsDefault ) ? "yes" : "no" ) << endl;
96 TS << "gwisdefault=" << ( ( Data.IP.GWIsDefault ) ? "yes" : "no" ) << endl; 119 TS << "ipgwifnotset=" << ( ( Data.IP.GWIfNotSet ) ? "yes" : "no" ) << endl;
97 TS << "ipaddress=" << Data.IP.IPAddress << endl; 120 TS << "iplocaloverrule=" << ( ( Data.IP.LocalOverrule ) ? "yes" : "no" ) << endl;
98 TS << "ipsubmask=" << Data.IP.IPSubMask << endl; 121 TS << "ipremoteoverrule=" << ( ( Data.IP.RemoteOverrule ) ? "yes" : "no" ) << endl;
99 TS << "gwaddress=" << Data.IP.GWAddress << endl; 122 TS << "iplocaladdress=" << Data.IP.LocalAddress << endl;
123 TS << "ipremoteaddress=" << Data.IP.RemoteAddress << endl;
124 TS << "ipgwaddress=" << Data.IP.GWAddress << endl;
125
126 TS << "runpreconnect=" << Data.Run.PreConnect << endl;
127 TS << "runpostconnect=" << Data.Run.PostConnect << endl;
128 TS << "runpredisconnect=" << Data.Run.PreDisconnect << endl;
129 TS << "runpostdisconnect=" << Data.Run.PostDisconnect << endl;
130
100} 131}
101 132
102QWidget * APPP::edit( QWidget * parent ) { 133QWidget * APPP::edit( QWidget * parent ) {
103 GUI = new PPPEdit( parent ); 134 GUI = new PPPEdit( parent );
104 GUI->showData( Data ); 135 GUI->showData( Data );
105 return GUI; 136 return GUI;
@@ -112,110 +143,93 @@ QString APPP::acceptable( void ) {
112void APPP::commit( void ) { 143void APPP::commit( void ) {
113 if( GUI && GUI->commit( Data ) ) { 144 if( GUI && GUI->commit( Data ) ) {
114 setModified( 1 ); 145 setModified( 1 );
115 } 146 }
116} 147}
117 148
118QFile * APPP::openFile( const QString & ID ) { 149bool APPP::openFile( SystemFile & SF ) {
119 QFile * F = 0; 150 if( SF.name() == "peers" ) {
120 QString S; 151 SF.setPath( removeSpaces(
121 152 QString( "/tmp/ppp/peers/" ) + connection()->name() ) );
122 if( ID == "peers" ) { 153 return 1;
123 S = removeSpaces( QString("/tmp/") + connection()->name() ); 154 } else if ( SF.name() == "chatscripts" ) {
124 155 SF.setPath( removeSpaces(
125 F = new QFile( S ); 156 QString( "/tmp/chatscripts/" ) + connection()->name() ) );
126 157 return 1;
127 if( ! F->open( IO_WriteOnly ) ) {
128 Log(("Cannot open file %s\n", S.latin1() ));
129 return 0;
130 }
131 } else if ( ID == "chatscripts" ) {
132 S = removeSpaces( QString("/tmp/") + connection()->name() + ".chat" );
133 F = new QFile( S );
134
135 if( ! F->open( IO_WriteOnly ) ) {
136 Log(("Cannot open file %s\n", S.latin1() ));
137 return 0;
138 }
139 } 158 }
140 if( F ) { 159 return 0;
141 Log(("Generate proper file %s = %s\n",
142 ID.latin1(), F->name().latin1()));
143 }
144 return F;
145} 160}
146 161
147short APPP::generateFile( const QString & ID, 162short APPP::generateFile( SystemFile & SF, long DevNr ) {
148 const QString & Path,
149 QTextStream & TS,
150 long DevNr ) {
151 short rvl, rvd; 163 short rvl, rvd;
152 164
153 rvl = 1; 165 rvl = 1;
154 rvd = 1; 166 rvd = 1;
155 167
156 if( ID == "pap-secrets" ) { 168 if( SF.name() == "pap-secrets" ) {
157 Log(("Generate PPP for %s\n", ID.latin1() )); 169 Log(("Generate PPP for %s\n", SF.name().latin1() ));
170
158 if( Data.Auth.Mode == 1 && Data.Auth.PCEMode == 0 ) { 171 if( Data.Auth.Mode == 1 && Data.Auth.PCEMode == 0 ) {
159 TS << "# secrets for " 172 SF << "# secrets for "
160 << connection()->name().latin1() 173 << connection()->name().latin1()
161 << endl; 174 << endl;
162 TS << Data.Auth.Client 175 SF << Data.Auth.Client
163 << " " 176 << " "
164 << Data.Auth.Server 177 << Data.Auth.Server
165 << " " 178 << " "
166 << Data.Auth.Secret 179 << Data.Auth.Secret
167 << endl; 180 << endl;
168 rvl = 0; 181 rvl = 0;
169 rvd = connection()->getToplevel()->generateFileEmbedded( 182 rvd = connection()->getToplevel()->generateFileEmbedded(
170 ID, Path, TS, DevNr ); 183 SF, DevNr );
171 } 184 }
172 } else if( ID == "chap-secrets" ) { 185 } else if( SF.name() == "chap-secrets" ) {
173 Log(("Generate PPP for %s\n", ID.latin1() )); 186 Log(("Generate PPP for %s\n", SF.name().latin1() ));
174 if( Data.Auth.Mode == 1 && Data.Auth.PCEMode != 0 ) { 187 if( Data.Auth.Mode == 1 && Data.Auth.PCEMode != 0 ) {
175 // used for both EAP and Chap 188 // used for both EAP and Chap
176 TS << "# secrets for " 189 SF << "# secrets for "
177 << connection()->name().latin1() 190 << connection()->name().latin1()
178 << endl; 191 << endl;
179 TS << Data.Auth.Client 192 SF << Data.Auth.Client
180 << " " 193 << " "
181 << Data.Auth.Server 194 << Data.Auth.Server
182 << " " 195 << " "
183 << Data.Auth.Secret 196 << Data.Auth.Secret
184 << endl; 197 << endl;
185 198
186 rvl = 0; 199 rvl = 0;
187 rvd = connection()->getToplevel()->generateFileEmbedded( 200 rvd = connection()->getToplevel()->generateFileEmbedded(
188 ID, Path, TS, DevNr ); 201 SF, DevNr );
189 } 202 }
190 } else if ( ID == "peers" ) { 203 } else if ( SF.name() == "peers" ) {
191 QFileInfo FI(Path); 204
192 Log(("Generate PPP for %s\n", ID.latin1() )); 205 QFileInfo FI(SF.path());
206 Log(("Generate PPP for %s\n", SF.name().latin1() ));
193 207
194 TS << "connect \"/usr/sbin/chat -v -f /etc/ppp/" 208 SF << "connect \"/usr/sbin/chat -v -f /etc/chatscripts/"
195 << FI.baseName() 209 << FI.baseName()
196 << ".chat\"" 210 << "\""
197 << endl; 211 << endl;
198 212
199 if( Data.IP.GWIsDefault ) { 213 if( Data.IP.GWIsDefault ) {
200 TS << "defaultroute" 214 SF << "defaultroute"
201 << endl; 215 << endl;
202 } 216 }
203 217
204 TS << "linkname " 218 SF << "linkname "
205 << removeSpaces( ID.latin1() ) 219 << removeSpaces( SF.name().latin1() )
206 << endl; 220 << endl;
207 221
208 // insert other data here 222 // insert other data here
209 rvl = 0; 223 rvl = 0;
210 rvd = connection()->getToplevel()->generateFileEmbedded( 224 rvd = connection()->getToplevel()->generateFileEmbedded(
211 ID, Path, TS, DevNr ); 225 SF, DevNr );
212 } else if ( ID == "chatscripts" ) { 226 } else if ( SF.name() == "chatscripts" ) {
213 Log(("Generate PPP for %s\n", ID.latin1() )); 227 Log(("Generate PPP for %s\n", SF.name().latin1() ));
214 rvl = 0; 228 rvl = 0;
215 rvd = connection()->getToplevel()->generateFileEmbedded( 229 rvd = connection()->getToplevel()->generateFileEmbedded(
216 ID, Path, TS, DevNr ); 230 SF, DevNr );
217 } 231 }
218 232
219 return (rvd == 2 || rvl == 2 ) ? 2 : 233 return (rvd == 2 || rvl == 2 ) ? 2 :
220 (rvd == 0 || rvl == 0 ) ? 0 : 1; 234 (rvd == 0 || rvl == 0 ) ? 0 : 1;
221} 235}
diff --git a/noncore/settings/networksettings2/ppp/ppp_NNI.h b/noncore/settings/networksettings2/ppp/ppp_NNI.h
index 0bf8fa9..76afb21 100644
--- a/noncore/settings/networksettings2/ppp/ppp_NNI.h
+++ b/noncore/settings/networksettings2/ppp/ppp_NNI.h
@@ -13,29 +13,23 @@ class APPP : public ANetNodeInstance {
13 13
14public : 14public :
15 15
16 APPP( PPPNetNode * PNN ); 16 APPP( PPPNetNode * PNN );
17 17
18 RuntimeInfo * runtime( void ) 18 RuntimeInfo * runtime( void )
19 { if( RT == 0 ) { 19 { return (RT) ? RT : (RT = new PPPRun( this, Data ) ); }
20 RT = new PPPRun( this, Data );
21 }
22 return RT->runtimeInfo();
23 }
24 20
25 QWidget * edit( QWidget * parent ); 21 QWidget * edit( QWidget * parent );
26 QString acceptable( void ); 22 QString acceptable( void );
27 void commit( void ); 23 void commit( void );
28 24
29 virtual void * data( void ) 25 virtual void * data( void )
30 { return (void *)&Data; } 26 { return (void *)&Data; }
31 27
32 virtual QFile * openFile( const QString & ID ); 28 virtual bool openFile( SystemFile & Sf );
33 short generateFile( const QString & ID, 29 short generateFile( SystemFile & TS,
34 const QString & Path,
35 QTextStream & TS,
36 long DevNr ); 30 long DevNr );
37 31
38protected : 32protected :
39 33
40 virtual void setSpecificAttribute( QString & Attr, QString & Value ); 34 virtual void setSpecificAttribute( QString & Attr, QString & Value );
41 virtual void saveSpecificAttribute( QTextStream & TS ); 35 virtual void saveSpecificAttribute( QTextStream & TS );
diff --git a/noncore/settings/networksettings2/ppp/pppdata.h b/noncore/settings/networksettings2/ppp/pppdata.h
index 9e8543c..68666f8 100644
--- a/noncore/settings/networksettings2/ppp/pppdata.h
+++ b/noncore/settings/networksettings2/ppp/pppdata.h
@@ -1,21 +1,27 @@
1#ifndef PPP_DATA_H 1#ifndef PPP_DATA_H
2#define PPP_DATA_H 2#define PPP_DATA_H
3 3
4#include <qstring.h> 4#include <qstring.h>
5#include <qarray.h> 5#include <qarray.h>
6 6
7typedef struct PPPData { 7class PPPData {
8
9public :
10
8 struct { 11 struct {
9 bool IPAutomatic; 12 bool LocalOverrule;
10 QString IPAddress; 13 bool RemoteOverrule;
11 QString IPSubMask; 14 QString LocalAddress;
15 QString RemoteAddress;
12 bool GWAutomatic; 16 bool GWAutomatic;
13 QString GWAddress; 17 QString GWAddress;
14 bool GWIsDefault; 18 bool GWIsDefault;
19 bool GWIfNotSet;
15 } IP; 20 } IP;
21
16 struct { 22 struct {
17 short Mode; // 0 login, 1 chap/pap, 2 Terminal 23 short Mode; // 0 login, 1 chap/pap, 2 Terminal
18 struct { 24 struct {
19 QString Expect; 25 QString Expect;
20 QString Send; 26 QString Send;
21 } Login; 27 } Login;
@@ -30,9 +36,15 @@ typedef struct PPPData {
30 } Auth; 36 } Auth;
31 struct { 37 struct {
32 bool ServerAssigned; 38 bool ServerAssigned;
33 QString DomainName; 39 QString DomainName;
34 QArray<QString *> Servers; 40 QArray<QString *> Servers;
35 } DNS; 41 } DNS;
36} PPPData_t; 42 struct {
43 QString PreConnect;
44 QString PostConnect;
45 QString PreDisconnect;
46 QString PostDisconnect;
47 } Run;
48};
37 49
38#endif 50#endif
diff --git a/noncore/settings/networksettings2/ppp/ppprun.cpp b/noncore/settings/networksettings2/ppp/ppprun.cpp
index a8abc50..8403e6d 100644
--- a/noncore/settings/networksettings2/ppp/ppprun.cpp
+++ b/noncore/settings/networksettings2/ppp/ppprun.cpp
@@ -1,57 +1,23 @@
1#include <resources.h> 1#include <resources.h>
2#include "ppprun.h" 2#include "ppprun.h"
3 3
4PPPRun::PPPRun( ANetNodeInstance * NNI, PPPData & Data ) : 4PPPRun::PPPRun( ANetNodeInstance * NNI, PPPData & Data ) :
5 AsConnection( NNI ), AsDevice( NNI ), Pat( "eth[0-9]" ) { 5 RuntimeInfo( NNI ), Pat( "eth[0-9]" ) {
6 D = &Data; 6 D = &Data;
7} 7}
8 8
9void PPPRun::detectState( NodeCollection * NC ) { 9State_t PPPRun::detectState( void ) {
10 if( isMyPPPDRunning( ) ) { 10 if( isMyPPPDRunning( ) ) {
11 if( isMyPPPUp() ) { 11 return ( isMyPPPUp() ) ? IsUp : Available;
12 NC->setCurrentState( IsUp ); 12 }
13 } else { 13 return Off;
14 NC->setCurrentState( Available );
15 }
16 } else {
17 NC->setCurrentState( Off ); // at least this
18 // but could also be unavailable
19 AsDevice::netNode()->nextNode()->runtime()->detectState( NC );
20 }
21} 14}
22 15
23bool PPPRun::setState( NodeCollection * NC, Action_t A, bool ) { 16QString PPPRun::setMyState( NodeCollection * NC, Action_t A, bool ) {
24 switch( A ) { 17 return QString();
25 case Activate :
26 NC->setCurrentState( Available );
27 // no
28 break;
29 case Deactivate :
30 if( NC->currentState() == IsUp ) {
31 NC->state( Down );
32 }
33 // cannot really disable
34 NC->setCurrentState( Available );
35 break;
36 case Up :
37 if( NC->currentState() != IsUp ) {
38 // start my PPPD
39 NC->setCurrentState( IsUp );
40 }
41 break;
42 case Down :
43 if( NC->currentState() == IsUp ) {
44 // stop my PPPD
45 NC->setCurrentState( Available );
46 }
47 break;
48 default : // FT
49 break;
50 }
51 return 1;
52} 18}
53 19
54bool PPPRun::isMyPPPDRunning( void ) { 20bool PPPRun::isMyPPPDRunning( void ) {
55 return 0; 21 return 0;
56} 22}
57 23
@@ -65,18 +31,22 @@ bool PPPRun::isMyPPPUp( void ) {
65 ++It ) { 31 ++It ) {
66 Run = It.current(); 32 Run = It.current();
67 if( R.match( Run->Name ) >= 0 && 33 if( R.match( Run->Name ) >= 0 &&
68 Run->IsPointToPoint 34 Run->IsPointToPoint
69 ) { 35 ) {
70 // this is a LAN card 36 // this is a LAN card
71 if( Run->assignedNode() == AsDevice::netNode() ) { 37 if( Run->assignedConnection() == netNode()->connection() ) {
72 // assigned to us 38 // assigned to us
73 return 1; 39 return 1;
74 } 40 }
75 } 41 }
76 } 42 }
77 return 0; 43 return 0;
78} 44}
79 45
80bool PPPRun::handlesInterface( const QString & S ) { 46bool PPPRun::handlesInterface( const QString & S ) {
81 return Pat.match( S ) >= 0; 47 return Pat.match( S ) >= 0;
82} 48}
49
50bool PPPRun::handlesInterface( InterfaceInfo * I ) {
51 return handlesInterface( I->Name );
52}
diff --git a/noncore/settings/networksettings2/ppp/ppprun.h b/noncore/settings/networksettings2/ppp/ppprun.h
index 90a3f25..2990a96 100644
--- a/noncore/settings/networksettings2/ppp/ppprun.h
+++ b/noncore/settings/networksettings2/ppp/ppprun.h
@@ -1,47 +1,37 @@
1#ifndef PPPRUN_H 1#ifndef PPPRUN_H
2#define PPPRUN_H 2#define PPPRUN_H
3 3
4#include <qregexp.h> 4#include <qregexp.h>
5#include <asconnection.h> 5#include <netnode.h>
6#include <asdevice.h>
7#include "pppdata.h" 6#include "pppdata.h"
8 7
9class PPPRun : public AsConnection, public AsDevice { 8class PPPRun : public RuntimeInfo {
10 9
11public : 10public :
12 11
13 PPPRun( ANetNodeInstance * NNI, 12 PPPRun( ANetNodeInstance * NNI,
14 PPPData & Data ); 13 PPPData & Data );
15 14
16 virtual AsDevice * asDevice( void ) 15 bool handlesInterface( const QString & I );
17 { return (AsDevice *)this; } 16 bool handlesInterface( InterfaceInfo * );
18 virtual AsConnection * asConnection( void )
19 { return (AsConnection *)this; }
20
21 virtual AsDevice * device( void )
22 { return (AsDevice *)this; }
23 17
24 virtual RuntimeInfo * runtimeInfo( void ) 18 State_t detectState( void );
25 { return ( AsConnection *)this; } 19 virtual RuntimeInfo * device( void )
20 { return this; }
21 virtual RuntimeInfo * connection( void )
22 { return this; }
26 23
27 protected : 24protected :
28 25
29 void detectState( NodeCollection * NC ); 26 QString setMyState( NodeCollection * , Action_t, bool );
30 bool setState( NodeCollection * NC, Action_t A, bool );
31 bool canSetState( State_t S, Action_t A )
32 { return AsDevice::connection()->findNext(
33 AsDevice::netNode() )->runtime()->canSetState( S,A ); }
34
35 bool handlesInterface( const QString & I );
36 27
37private : 28private :
38 29
39 bool isMyPPPDRunning( void ); 30 bool isMyPPPDRunning( void );
40 bool isMyPPPUp( void ); 31 bool isMyPPPUp( void );
41 32
42 PPPData_t * D; 33 PPPData * D;
43 QRegExp Pat; 34 QRegExp Pat;
44
45}; 35};
46 36
47#endif 37#endif