-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 | |||
@@ -35,5 +35,5 @@ | |||
35 | 35 | ||
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 | { |
39 | valid=FALSE; | 39 | valid=FALSE; |
@@ -45,5 +45,6 @@ | |||
45 | int auth_peer = cfg.readNumEntry("auth_peer",0xc0a88100);//new default 192.168.129.0/24 | 45 | int auth_peer = cfg.readNumEntry("auth_peer",0xc0a88100);//new default 192.168.129.0/24 |
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&)), |
49 | this, SLOT(setSyncNet(const QString&))); | 50 | this, SLOT(setSyncNet(const QString&))); |
@@ -52,5 +53,4 @@ | |||
52 | QString sa = cfg.readEntry("syncapp","Qtopia"); | 53 | QString sa = cfg.readEntry("syncapp","Qtopia"); |
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++) { |
56 | if ( syncapp->text(i) == sa ) { | 56 | if ( syncapp->text(i) == sa ) { |
@@ -87,4 +87,8 @@ | |||
87 | int mode = cfg.readNumEntry("Mode",2); // Default to Sharp | 87 | int mode = cfg.readNumEntry("Mode",2); // Default to Sharp |
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 | ||
90 | connect(autologinToggle, SIGNAL(toggled(bool)), this, SLOT(toggleAutoLogin(bool))); | 94 | connect(autologinToggle, SIGNAL(toggled(bool)), this, SLOT(toggleAutoLogin(bool))); |
@@ -93,4 +97,6 @@ | |||
93 | connect(clearpasscode,SIGNAL(clicked()), this, SLOT(clearPassCode())); | 97 | connect(clearpasscode,SIGNAL(clicked()), this, SLOT(clearPassCode())); |
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 | ||
96 | loadUsers(); | 102 | loadUsers(); |
@@ -105,4 +111,38 @@ Security::~Security() | |||
105 | } | 111 | } |
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 | ||
108 | void Security::updateGUI() | 148 | void Security::updateGUI() |
@@ -159,5 +199,5 @@ void Security::done(int r) | |||
159 | } | 199 | } |
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 | { |
163 | QString sn; | 203 | QString sn; |
@@ -174,4 +214,42 @@ void Security::selectNet(int auth_peer,int auth_peer_bits) | |||
174 | + QString::number(auth_peer_bits); | 214 | + QString::number(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++) { |
177 | if ( syncnet->text(i).left(sn.length()) == sn ) { | 255 | if ( syncnet->text(i).left(sn.length()) == sn ) { |
@@ -243,5 +321,5 @@ void Security::setSyncNet(const QString& sn) | |||
243 | int auth_peer,auth_peer_bits; | 321 | int auth_peer,auth_peer_bits; |
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 | } |
247 | 325 | ||
@@ -258,6 +336,16 @@ void Security::applySecurity() | |||
258 | QString sn = syncnet->currentText(); | 336 | QString sn = syncnet->currentText(); |
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()); |
263 | 351 | ||
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 | |||
@@ -48,5 +48,7 @@ private slots: | |||
48 | void toggleAutoLogin(bool); | 48 | void toggleAutoLogin(bool); |
49 | void changeSyncApp(); | 49 | void changeSyncApp(); |
50 | 50 | void restoreDefaults(); | |
51 | void insertDefaultRanges(); | ||
52 | void deleteListEntry(); | ||
51 | 53 | ||
52 | private: | 54 | private: |
@@ -57,5 +59,6 @@ private: | |||
57 | 59 | ||
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 | ||
61 | QString enterPassCode(const QString&); | 64 | QString enterPassCode(const QString&); |
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 | |||
@@ -12,5 +12,5 @@ | |||
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>321</width> | 14 | <width>309</width> |
15 | <height>483</height> | 15 | <height>483</height> |
16 | </rect> | 16 | </rect> |
@@ -110,4 +110,10 @@ | |||
110 | <string>Change passcode</string> | 110 | <string>Change passcode</string> |
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> |
113 | <widget> | 119 | <widget> |
@@ -121,4 +127,9 @@ | |||
121 | <string>Clear passcode</string> | 127 | <string>Clear passcode</string> |
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> |
124 | </hbox> | 135 | </hbox> |
@@ -134,4 +145,8 @@ | |||
134 | <string>Require pass code at power-on</string> | 145 | <string>Require pass code at power-on</string> |
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> |
137 | <widget> | 152 | <widget> |
@@ -237,4 +252,10 @@ | |||
237 | <string>Login Automatically</string> | 252 | <string>Login Automatically</string> |
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> |
240 | <widget> | 261 | <widget> |
@@ -244,4 +265,11 @@ | |||
244 | <cstring>userlist</cstring> | 265 | <cstring>userlist</cstring> |
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> |
247 | </vbox> | 275 | </vbox> |
@@ -280,5 +308,5 @@ | |||
280 | <string>Sync</string> | 308 | <string>Sync</string> |
281 | </attribute> | 309 | </attribute> |
282 | <vbox> | 310 | <grid> |
283 | <property stdset="1"> | 311 | <property stdset="1"> |
284 | <name>margin</name> | 312 | <name>margin</name> |
@@ -289,5 +317,26 @@ | |||
289 | <number>6</number> | 317 | <number>6</number> |
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> |
293 | <property stdset="1"> | 342 | <property stdset="1"> |
@@ -325,52 +374,4 @@ | |||
325 | <widget> | 374 | <widget> |
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"> |
376 | <name>name</name> | 377 | <name>name</name> |
@@ -381,4 +382,72 @@ | |||
381 | <bool>true</bool> | 382 | <bool>true</bool> |
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> |
384 | <widget> | 453 | <widget> |
@@ -411,4 +480,12 @@ | |||
411 | <cstring>syncapp</cstring> | 480 | <cstring>syncapp</cstring> |
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> |
414 | <widget> | 491 | <widget> |
@@ -439,26 +516,5 @@ | |||
439 | </vbox> | 516 | </vbox> |
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> |
464 | </widget> | 520 | </widget> |