author | coredump <coredump> | 2003-11-27 12:26:07 (UTC) |
---|---|---|
committer | coredump <coredump> | 2003-11-27 12:26:07 (UTC) |
commit | 51ca35ecb7e22fc564ffe62184d4a75aa8537b1d (patch) (unidiff) | |
tree | 49bffaeeec6e8dba3b5d2dd5614ef77d50045c9e | |
parent | afe4e5bcfdd3d67166cdbf28f4514783ada1d290 (diff) | |
download | opie-51ca35ecb7e22fc564ffe62184d4a75aa8537b1d.zip opie-51ca35ecb7e22fc564ffe62184d4a75aa8537b1d.tar.gz opie-51ca35ecb7e22fc564ffe62184d4a75aa8537b1d.tar.bz2 |
Added: Default net-ranges are no longer hard-coded and can be edited
Bugfix: Show user-defined net-range upon application restart in
drop-down list
-rw-r--r-- | core/settings/security/security.cpp | 100 | ||||
-rw-r--r-- | core/settings/security/security.h | 7 | ||||
-rw-r--r-- | core/settings/security/securitybase.ui | 202 |
3 files changed, 228 insertions, 81 deletions
diff --git a/core/settings/security/security.cpp b/core/settings/security/security.cpp index 1b90121..d7871b3 100644 --- a/core/settings/security/security.cpp +++ b/core/settings/security/security.cpp | |||
@@ -36,3 +36,3 @@ | |||
36 | Security::Security( QWidget* parent, const char* name, WFlags fl ) | 36 | Security::Security( QWidget* parent, const char* name, WFlags fl ) |
37 | : SecurityBase( parent, name, TRUE, fl ) | 37 | : SecurityBase( parent, name, TRUE, WStyle_ContextHelp ) |
38 | { | 38 | { |
@@ -46,3 +46,4 @@ | |||
46 | int auth_peer_bits = cfg.readNumEntry("auth_peer_bits",24); | 46 | int auth_peer_bits = cfg.readNumEntry("auth_peer_bits",24); |
47 | selectNet(auth_peer,auth_peer_bits); | 47 | selectNet(auth_peer,auth_peer_bits,TRUE); |
48 | |||
48 | connect(syncnet, SIGNAL(textChanged(const QString&)), | 49 | connect(syncnet, SIGNAL(textChanged(const QString&)), |
@@ -53,3 +54,2 @@ | |||
53 | 54 | ||
54 | //There must be a better way to do that... | ||
55 | for (int i=0; i<syncapp->count(); i++) { | 55 | for (int i=0; i<syncapp->count(); i++) { |
@@ -88,2 +88,6 @@ | |||
88 | syncModeCombo->setCurrentItem( mode - 1 ); | 88 | syncModeCombo->setCurrentItem( mode - 1 ); |
89 | |||
90 | //since nobody knows what this is and it doesn't do anything, i'll hide it # CoreDump | ||
91 | // is this work-in-progress or can it be removed? | ||
92 | syncModeCombo->hide(); | ||
89 | 93 | ||
@@ -94,2 +98,4 @@ | |||
94 | connect(syncapp,SIGNAL(activated(int)), this, SLOT(changeSyncApp())); | 98 | connect(syncapp,SIGNAL(activated(int)), this, SLOT(changeSyncApp())); |
99 | connect(restoredefaults,SIGNAL(clicked()), this, SLOT(restoreDefaults())); | ||
100 | connect(deleteentry,SIGNAL(clicked()), this, SLOT(deleteListEntry())); | ||
95 | 101 | ||
@@ -106,2 +112,36 @@ Security::~Security() | |||
106 | 112 | ||
113 | void Security::deleteListEntry() | ||
114 | { | ||
115 | syncnet->removeItem(syncnet->currentItem()); | ||
116 | } | ||
117 | |||
118 | void Security::restoreDefaults() | ||
119 | { | ||
120 | QMessageBox unrecbox( | ||
121 | tr("Attention"), | ||
122 | tr("<p>All user-defined net ranges will be lost."), | ||
123 | QMessageBox::Warning, | ||
124 | QMessageBox::Cancel, QMessageBox::Yes, QMessageBox::NoButton, | ||
125 | 0, QString::null, TRUE, WStyle_StaysOnTop); | ||
126 | unrecbox.setButtonText(QMessageBox::Cancel, tr("Cancel")); | ||
127 | unrecbox.setButtonText(QMessageBox::Yes, tr("Ok")); | ||
128 | |||
129 | if ( unrecbox.exec() == QMessageBox::Yes) | ||
130 | { | ||
131 | syncnet->clear(); | ||
132 | insertDefaultRanges(); | ||
133 | } | ||
134 | } | ||
135 | |||
136 | void Security::insertDefaultRanges() | ||
137 | { | ||
138 | syncnet->insertItem( tr( "192.168.129.0/24" ) ); | ||
139 | syncnet->insertItem( tr( "192.168.1.0/24" ) ); | ||
140 | syncnet->insertItem( tr( "192.168.0.0/16" ) ); | ||
141 | syncnet->insertItem( tr( "172.16.0.0/12" ) ); | ||
142 | syncnet->insertItem( tr( "10.0.0.0/8" ) ); | ||
143 | syncnet->insertItem( tr( "1.0.0.0/8" ) ); | ||
144 | syncnet->insertItem( tr( "Any" ) ); | ||
145 | syncnet->insertItem( tr( "None" ) ); | ||
146 | } | ||
107 | 147 | ||
@@ -160,3 +200,3 @@ void Security::done(int r) | |||
160 | 200 | ||
161 | void Security::selectNet(int auth_peer,int auth_peer_bits) | 201 | void Security::selectNet(int auth_peer,int auth_peer_bits, bool update) |
162 | { | 202 | { |
@@ -175,2 +215,40 @@ void Security::selectNet(int auth_peer,int auth_peer_bits) | |||
175 | } | 215 | } |
216 | |||
217 | //insert user-defined list of netranges upon start | ||
218 | if (update) { | ||
219 | //User selected/active netrange first | ||
220 | syncnet->insertItem( tr( sn ) ); | ||
221 | |||
222 | Config cfg("Security"); | ||
223 | cfg.setGroup("Sync"); | ||
224 | |||
225 | //set up defaults if needed, if someone manually deletes net0 he'll get a suprise hehe | ||
226 | QString test = cfg.readEntry("net0",""); | ||
227 | if (test.isEmpty()) { | ||
228 | insertDefaultRanges(); | ||
229 | } else { | ||
230 | // 10 ought to be enough for everybody... :) | ||
231 | // If you need more, don't forget to edit applySecurity() as well | ||
232 | bool already_there=FALSE; | ||
233 | for (int i=0; i<10; i++) { | ||
234 | QString target, netrange; | ||
235 | target.sprintf("net%d", i); | ||
236 | netrange = cfg.readEntry(target,""); | ||
237 | if (! netrange.isEmpty()){ | ||
238 | //make sure we have no "twin" entries | ||
239 | for (int i=0; i<syncnet->count(); i++) { | ||
240 | if ( syncnet->text(i) == netrange ) { | ||
241 | already_there=TRUE; | ||
242 | } | ||
243 | } | ||
244 | if (! already_there) { | ||
245 | syncnet->insertItem( tr( netrange ) ); | ||
246 | } else { | ||
247 | already_there=FALSE; | ||
248 | } | ||
249 | } | ||
250 | } | ||
251 | } | ||
252 | } | ||
253 | |||
176 | for (int i=0; i<syncnet->count(); i++) { | 254 | for (int i=0; i<syncnet->count(); i++) { |
@@ -244,3 +322,3 @@ void Security::setSyncNet(const QString& sn) | |||
244 | parseNet(sn,auth_peer,auth_peer_bits); | 322 | parseNet(sn,auth_peer,auth_peer_bits); |
245 | selectNet(auth_peer,auth_peer_bits); | 323 | selectNet(auth_peer,auth_peer_bits,FALSE); |
246 | } | 324 | } |
@@ -259,4 +337,14 @@ void Security::applySecurity() | |||
259 | parseNet(sn,auth_peer,auth_peer_bits); | 337 | parseNet(sn,auth_peer,auth_peer_bits); |
338 | |||
339 | //this is the *selected* (active) net range | ||
260 | cfg.writeEntry("auth_peer",auth_peer); | 340 | cfg.writeEntry("auth_peer",auth_peer); |
261 | cfg.writeEntry("auth_peer_bits",auth_peer_bits); | 341 | cfg.writeEntry("auth_peer_bits",auth_peer_bits); |
342 | |||
343 | //write back all other net ranges in *cleartext* | ||
344 | for (int i=0; i<10; i++) { | ||
345 | QString target; | ||
346 | target.sprintf("net%d", i); | ||
347 | cfg.writeEntry(target,syncnet->text(i)); | ||
348 | } | ||
349 | |||
262 | cfg.writeEntry("syncapp",syncapp->currentText()); | 350 | cfg.writeEntry("syncapp",syncapp->currentText()); |
diff --git a/core/settings/security/security.h b/core/settings/security/security.h index b1a3eca..72aa352 100644 --- a/core/settings/security/security.h +++ b/core/settings/security/security.h | |||
@@ -49,3 +49,5 @@ private slots: | |||
49 | void changeSyncApp(); | 49 | void changeSyncApp(); |
50 | 50 | void restoreDefaults(); | |
51 | void insertDefaultRanges(); | ||
52 | void deleteListEntry(); | ||
51 | 53 | ||
@@ -58,3 +60,4 @@ private: | |||
58 | static void parseNet(const QString& sn,int& auth_peer,int& auth_peer_bits); | 60 | static void parseNet(const QString& sn,int& auth_peer,int& auth_peer_bits); |
59 | void selectNet(int auth_peer,int auth_peer_bits); | 61 | void selectNet(int auth_peer,int auth_peer_bits,bool update); |
62 | |||
60 | 63 | ||
diff --git a/core/settings/security/securitybase.ui b/core/settings/security/securitybase.ui index 934111e..1769ae1 100644 --- a/core/settings/security/securitybase.ui +++ b/core/settings/security/securitybase.ui | |||
@@ -13,3 +13,3 @@ | |||
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>321</width> | 14 | <width>309</width> |
15 | <height>483</height> | 15 | <height>483</height> |
@@ -111,2 +111,8 @@ | |||
111 | </property> | 111 | </property> |
112 | <property> | ||
113 | <name>whatsThis</name> | ||
114 | <string>This button will let you change the security passcode. | ||
115 | |||
116 | Note: This is *not* the sync password.</string> | ||
117 | </property> | ||
112 | </widget> | 118 | </widget> |
@@ -122,2 +128,7 @@ | |||
122 | </property> | 128 | </property> |
129 | <property> | ||
130 | <name>whatsThis</name> | ||
131 | <string>Delete the current passcode. | ||
132 | You can enter a new one at any time.</string> | ||
133 | </property> | ||
123 | </widget> | 134 | </widget> |
@@ -135,2 +146,6 @@ | |||
135 | </property> | 146 | </property> |
147 | <property> | ||
148 | <name>whatsThis</name> | ||
149 | <string>If you enable this option, a passcode must be entered after every resume event of your Zaurus.</string> | ||
150 | </property> | ||
136 | </widget> | 151 | </widget> |
@@ -238,2 +253,8 @@ | |||
238 | </property> | 253 | </property> |
254 | <property> | ||
255 | <name>whatsThis</name> | ||
256 | <string>If you select this option, opie-login will automagically log you in with the user you have selected in the drop-down list. | ||
257 | |||
258 | For the Zaurus 5x00 this is always the user "root".</string> | ||
259 | </property> | ||
239 | </widget> | 260 | </widget> |
@@ -245,2 +266,9 @@ | |||
245 | </property> | 266 | </property> |
267 | <property> | ||
268 | <name>whatsThis</name> | ||
269 | <string>This drop-down list allows you to select the user for auto-login | ||
270 | (if enabled above). | ||
271 | |||
272 | You can only select an actually configured user.</string> | ||
273 | </property> | ||
246 | </widget> | 274 | </widget> |
@@ -281,3 +309,3 @@ | |||
281 | </attribute> | 309 | </attribute> |
282 | <vbox> | 310 | <grid> |
283 | <property stdset="1"> | 311 | <property stdset="1"> |
@@ -290,3 +318,24 @@ | |||
290 | </property> | 318 | </property> |
291 | <widget> | 319 | <spacer row="1" column="0" > |
320 | <property> | ||
321 | <name>name</name> | ||
322 | <cstring>Spacer1</cstring> | ||
323 | </property> | ||
324 | <property stdset="1"> | ||
325 | <name>orientation</name> | ||
326 | <enum>Vertical</enum> | ||
327 | </property> | ||
328 | <property stdset="1"> | ||
329 | <name>sizeType</name> | ||
330 | <enum>Expanding</enum> | ||
331 | </property> | ||
332 | <property> | ||
333 | <name>sizeHint</name> | ||
334 | <size> | ||
335 | <width>20</width> | ||
336 | <height>20</height> | ||
337 | </size> | ||
338 | </property> | ||
339 | </spacer> | ||
340 | <widget row="0" column="0" > | ||
292 | <class>QGroupBox</class> | 341 | <class>QGroupBox</class> |
@@ -326,50 +375,2 @@ | |||
326 | <class>QComboBox</class> | 375 | <class>QComboBox</class> |
327 | <item> | ||
328 | <property> | ||
329 | <name>text</name> | ||
330 | <string>192.168.129.0/24 (default)</string> | ||
331 | </property> | ||
332 | </item> | ||
333 | <item> | ||
334 | <property> | ||
335 | <name>text</name> | ||
336 | <string>192.168.1.0/24</string> | ||
337 | </property> | ||
338 | </item> | ||
339 | <item> | ||
340 | <property> | ||
341 | <name>text</name> | ||
342 | <string>192.168.0.0/16</string> | ||
343 | </property> | ||
344 | </item> | ||
345 | <item> | ||
346 | <property> | ||
347 | <name>text</name> | ||
348 | <string>172.16.0.0/12</string> | ||
349 | </property> | ||
350 | </item> | ||
351 | <item> | ||
352 | <property> | ||
353 | <name>text</name> | ||
354 | <string>10.0.0.0/8</string> | ||
355 | </property> | ||
356 | </item> | ||
357 | <item> | ||
358 | <property> | ||
359 | <name>text</name> | ||
360 | <string>1.0.0.0/8</string> | ||
361 | </property> | ||
362 | </item> | ||
363 | <item> | ||
364 | <property> | ||
365 | <name>text</name> | ||
366 | <string>Any</string> | ||
367 | </property> | ||
368 | </item> | ||
369 | <item> | ||
370 | <property> | ||
371 | <name>text</name> | ||
372 | <string>None</string> | ||
373 | </property> | ||
374 | </item> | ||
375 | <property stdset="1"> | 376 | <property stdset="1"> |
@@ -382,2 +383,70 @@ | |||
382 | </property> | 383 | </property> |
384 | <property> | ||
385 | <name>whatsThis</name> | ||
386 | <string>Select a net-range or enter a new one. | ||
387 | |||
388 | This drop-down list lets you select a net range which is allowed to connect to your Zaurus. | ||
389 | |||
390 | For example, a net range of 192.168.1.0/24 will allow any machine with an IP between 192.168.1.1 and 192.168.1.254 to connect to (and sync with) your Zaurus. | ||
391 | |||
392 | The entry "All" will allow *any* IP to connect. | ||
393 | The entry "None" will *deny* any connection. | ||
394 | |||
395 | If unsure, select "Any".</string> | ||
396 | </property> | ||
397 | </widget> | ||
398 | <widget> | ||
399 | <class>QLayoutWidget</class> | ||
400 | <property stdset="1"> | ||
401 | <name>name</name> | ||
402 | <cstring>Layout4</cstring> | ||
403 | </property> | ||
404 | <hbox> | ||
405 | <property stdset="1"> | ||
406 | <name>margin</name> | ||
407 | <number>0</number> | ||
408 | </property> | ||
409 | <property stdset="1"> | ||
410 | <name>spacing</name> | ||
411 | <number>6</number> | ||
412 | </property> | ||
413 | <widget> | ||
414 | <class>QPushButton</class> | ||
415 | <property stdset="1"> | ||
416 | <name>name</name> | ||
417 | <cstring>deleteentry</cstring> | ||
418 | </property> | ||
419 | <property stdset="1"> | ||
420 | <name>text</name> | ||
421 | <string>Delete Entry</string> | ||
422 | </property> | ||
423 | <property> | ||
424 | <name>whatsThis</name> | ||
425 | <string>Delete the selected net range from the list | ||
426 | |||
427 | If you press this button, the currently selected net range will be deleted from the list of net ranges. | ||
428 | |||
429 | If you hit this button in error, the button "Restore Defaults" will restore | ||
430 | the list to the state it has been when you initially booted your Zaurus.</string> | ||
431 | </property> | ||
432 | </widget> | ||
433 | <widget> | ||
434 | <class>QPushButton</class> | ||
435 | <property stdset="1"> | ||
436 | <name>name</name> | ||
437 | <cstring>restoredefaults</cstring> | ||
438 | </property> | ||
439 | <property stdset="1"> | ||
440 | <name>text</name> | ||
441 | <string>Restore Defaults</string> | ||
442 | </property> | ||
443 | <property> | ||
444 | <name>whatsThis</name> | ||
445 | <string>This button will restore the list of net ranges | ||
446 | to the defaults. | ||
447 | |||
448 | Beware that all manually entered net ranges will be lost!</string> | ||
449 | </property> | ||
450 | </widget> | ||
451 | </hbox> | ||
383 | </widget> | 452 | </widget> |
@@ -412,2 +481,10 @@ | |||
412 | </property> | 481 | </property> |
482 | <property> | ||
483 | <name>whatsThis</name> | ||
484 | <string>This option changes the login behaviour of the internal FTP server. | ||
485 | |||
486 | If you have problems syncing, try the "IntelliSync" setting, which will accept any password you throw at the sync (FTP) port. | ||
487 | |||
488 | The default is Qtopia. It will let you log in with username "root" and password "Qtopia". The password is CaSeSeNsItIvE.</string> | ||
489 | </property> | ||
413 | </widget> | 490 | </widget> |
@@ -440,24 +517,3 @@ | |||
440 | </widget> | 517 | </widget> |
441 | <spacer> | 518 | </grid> |
442 | <property> | ||
443 | <name>name</name> | ||
444 | <cstring>Spacer1</cstring> | ||
445 | </property> | ||
446 | <property stdset="1"> | ||
447 | <name>orientation</name> | ||
448 | <enum>Vertical</enum> | ||
449 | </property> | ||
450 | <property stdset="1"> | ||
451 | <name>sizeType</name> | ||
452 | <enum>Expanding</enum> | ||
453 | </property> | ||
454 | <property> | ||
455 | <name>sizeHint</name> | ||
456 | <size> | ||
457 | <width>20</width> | ||
458 | <height>20</height> | ||
459 | </size> | ||
460 | </property> | ||
461 | </spacer> | ||
462 | </vbox> | ||
463 | </widget> | 519 | </widget> |