summaryrefslogtreecommitdiff
authorzecke <zecke>2004-02-21 13:08:34 (UTC)
committer zecke <zecke>2004-02-21 13:08:34 (UTC)
commitaa11789fc4d735a04fac09063851753d8a57027b (patch) (unidiff)
tree45a4de1ff38a8a5df0838bc5ebb021e297d669d8
parent6155f1be5c19fc51a4929c9e173f9e5a24d193e6 (diff)
downloadopie-aa11789fc4d735a04fac09063851753d8a57027b.zip
opie-aa11789fc4d735a04fac09063851753d8a57027b.tar.gz
opie-aa11789fc4d735a04fac09063851753d8a57027b.tar.bz2
Yeah baby yeah remove IntelliSync support
and add it to the SyncMode... as it should have been done Keep compatible with the old ored meaning... Now we can have IntelliSync plain text transfer, ask for pw less on connect Opie 1.0 plain text transfer, need pw and allow for syncing Qtopia 1.7 base64 transter , need pw and allow for syncing
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/settings/security/security.cpp106
-rw-r--r--core/settings/security/security.h5
-rw-r--r--core/settings/security/securitybase.ui39
3 files changed, 66 insertions, 84 deletions
diff --git a/core/settings/security/security.cpp b/core/settings/security/security.cpp
index 34f7e50..4eddb55 100644
--- a/core/settings/security/security.cpp
+++ b/core/settings/security/security.cpp
@@ -1,438 +1,440 @@
1/********************************************************************** 1/**********************************************************************
2 ** Copyright (C) 2000 Trolltech AS. All rights reserved. 2 ** Copyright (C) 2000 Trolltech AS. All rights reserved.
3 ** 3 **
4 ** This file is part of Qtopia Environment. 4 ** This file is part of Qtopia Environment.
5 ** 5 **
6 ** This file may be distributed and/or modified under the terms of the 6 ** This file may be distributed and/or modified under the terms of the
7 ** GNU General Public License version 2 as published by the Free Software 7 ** GNU General Public License version 2 as published by the Free Software
8 ** Foundation and appearing in the file LICENSE.GPL included in the 8 ** Foundation and appearing in the file LICENSE.GPL included in the
9 ** packaging of this file. 9 ** packaging of this file.
10 ** 10 **
11 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13 ** 13 **
14 ** See http://www.trolltech.com/gpl/ for GPL licensing information. 14 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
15 ** 15 **
16 ** Contact info@trolltech.com if any conditions of this licensing are 16 ** Contact info@trolltech.com if any conditions of this licensing are
17 ** not clear to you. 17 ** not clear to you.
18 ** 18 **
19 **********************************************************************/ 19 **********************************************************************/
20#include "security.h" 20#include "security.h"
21 21
22#include <qpe/qpeapplication.h> 22#include <qpe/qpeapplication.h>
23#include <qpe/config.h> 23#include <qpe/config.h>
24#include <qpe/password.h> 24#include <qpe/password.h>
25#include <qpe/qpedialog.h> 25#include <qpe/qpedialog.h>
26#include <qpe/qcopenvelope_qws.h> 26#include <qpe/qcopenvelope_qws.h>
27 27
28#include <qcheckbox.h> 28#include <qcheckbox.h>
29#include <qpushbutton.h> 29#include <qpushbutton.h>
30#include <qcombobox.h> 30#include <qcombobox.h>
31#include <qmessagebox.h> 31#include <qmessagebox.h>
32#include <qfile.h> 32#include <qfile.h>
33#include <qtextstream.h> 33#include <qtextstream.h>
34 34
35 Security::Security( QWidget* parent, const char* name, WFlags fl ) 35 Security::Security( QWidget* parent, const char* name, WFlags fl )
36: SecurityBase( parent, name, TRUE, WStyle_ContextHelp ) 36: SecurityBase( parent, name, TRUE, WStyle_ContextHelp )
37{ 37{
38 valid=FALSE; 38 valid=FALSE;
39 Config cfg("Security"); 39 Config cfg("Security");
40 cfg.setGroup("Passcode"); 40 cfg.setGroup("Passcode");
41 passcode = cfg.readEntry("passcode"); 41 passcode = cfg.readEntry("passcode");
42 passcode_poweron->setChecked(cfg.readBoolEntry("passcode_poweron",FALSE)); 42 passcode_poweron->setChecked(cfg.readBoolEntry("passcode_poweron",FALSE));
43 cfg.setGroup("Sync"); 43 cfg.setGroup("Sync");
44 int auth_peer = cfg.readNumEntry("auth_peer",0xc0a88100);//new default 192.168.129.0/24 44 int auth_peer = cfg.readNumEntry("auth_peer",0xc0a88100);//new default 192.168.129.0/24
45 int auth_peer_bits = cfg.readNumEntry("auth_peer_bits",24); 45 int auth_peer_bits = cfg.readNumEntry("auth_peer_bits",24);
46 selectNet(auth_peer,auth_peer_bits,TRUE); 46 selectNet(auth_peer,auth_peer_bits,TRUE);
47 47
48 connect(syncnet, SIGNAL(textChanged(const QString&)), 48 connect(syncnet, SIGNAL(textChanged(const QString&)),
49 this, SLOT(setSyncNet(const QString&))); 49 this, SLOT(setSyncNet(const QString&)));
50 50
51 cfg.setGroup("Sync");
52 QString sa = cfg.readEntry("syncapp","Qtopia");
53 51
54 for (int i=0; i<syncapp->count(); i++) { 52
55 if ( syncapp->text(i) == sa ) {
56 syncapp->setCurrentItem(i);
57 }
58 }
59
60 /* 53 /*
61 cfg.setGroup("Remote"); 54 cfg.setGroup("Remote");
62 if ( telnetAvailable() ) 55 if ( telnetAvailable() )
63 telnet->setChecked(cfg.readEntry("allow_telnet")); 56 telnet->setChecked(cfg.readEntry("allow_telnet"));
64 else 57 else
65 telnet->hide(); 58 telnet->hide();
66 59
67 if ( sshAvailable() ) 60 if ( sshAvailable() )
68 ssh->setChecked(cfg.readEntry("allow_ssh")); 61 ssh->setChecked(cfg.readEntry("allow_ssh"));
69 else 62 else
70 ssh->hide(); 63 ssh->hide();
71 */ 64 */
72 65
73 QString configFile = QPEApplication::qpeDir() + "/etc/opie-login.conf"; 66 QString configFile = QPEApplication::qpeDir() + "/etc/opie-login.conf";
74 Config loginCfg(configFile,Config::File); 67 Config loginCfg(configFile,Config::File);
75 68
76 loginCfg.setGroup("General"); 69 loginCfg.setGroup("General");
77 autoLoginName=loginCfg.readEntry("AutoLogin",""); 70 autoLoginName=loginCfg.readEntry("AutoLogin","");
78 71
79 if (autoLoginName.stripWhiteSpace().isEmpty()) { 72 if (autoLoginName.stripWhiteSpace().isEmpty()) {
80 autoLogin=false; 73 autoLogin=false;
81 } else { 74 } else {
82 autoLogin=true; 75 autoLogin=true;
83 } 76 }
84 77
85 cfg.setGroup("SyncMode"); 78 cfg.setGroup("SyncMode");
86 int mode = cfg.readNumEntry("Mode",2); // Default to Sharp 79 int mode = cfg.readNumEntry("Mode",2); // Default to Sharp
87 syncModeCombo->setCurrentItem( mode - 1 ); 80 switch( mode ) {
88 81 case 0x01:
89 //since nobody knows what this is and it doesn't do anything, i'll hide it # CoreDump 82 syncModeCombo->setCurrentItem( 0 );
90 // is this work-in-progress or can it be removed? 83 break;
91 syncModeCombo->hide(); 84 case 0x02:
85 default:
86 syncModeCombo->setCurrentItem( 1 );
87 break;
88 case 0x04:
89 syncModeCombo->setCurrentItem( 2 );
90 break;
91 }
92
92 93
93 connect(autologinToggle, SIGNAL(toggled(bool)), this, SLOT(toggleAutoLogin(bool))); 94 connect(autologinToggle, SIGNAL(toggled(bool)), this, SLOT(toggleAutoLogin(bool)));
94 connect(userlist, SIGNAL(activated(int)), this, SLOT(changeLoginName(int))); 95 connect(userlist, SIGNAL(activated(int)), this, SLOT(changeLoginName(int)));
95 connect(changepasscode,SIGNAL(clicked()), this, SLOT(changePassCode())); 96 connect(changepasscode,SIGNAL(clicked()), this, SLOT(changePassCode()));
96 connect(clearpasscode,SIGNAL(clicked()), this, SLOT(clearPassCode())); 97 connect(clearpasscode,SIGNAL(clicked()), this, SLOT(clearPassCode()));
97 connect(syncapp,SIGNAL(activated(int)), this, SLOT(changeSyncApp())); 98 connect(restoredefaults,SIGNAL(clicked()), this, SLOT(restoreDefaults()));
98 connect(restoredefaults,SIGNAL(clicked()), this, SLOT(restoreDefaults()));
99 connect(deleteentry,SIGNAL(clicked()), this, SLOT(deleteListEntry())); 99 connect(deleteentry,SIGNAL(clicked()), this, SLOT(deleteListEntry()));
100 100
101 loadUsers(); 101 loadUsers();
102 updateGUI(); 102 updateGUI();
103 103
104 dl = new QPEDialogListener(this); 104 dl = new QPEDialogListener(this);
105 QPEApplication::showDialog( this ); 105 QPEApplication::showDialog( this );
106} 106}
107 107
108Security::~Security() 108Security::~Security()
109{ 109{
110} 110}
111 111
112void Security::deleteListEntry() 112void Security::deleteListEntry()
113{ 113{
114 syncnet->removeItem(syncnet->currentItem()); 114 syncnet->removeItem(syncnet->currentItem());
115} 115}
116 116
117void Security::restoreDefaults() 117void Security::restoreDefaults()
118 { 118{
119 QMessageBox unrecbox( 119 QMessageBox unrecbox(
120 tr("Attention"), 120 tr("Attention"),
121 tr("<p>All user-defined net ranges will be lost."), 121 tr("<p>All user-defined net ranges will be lost."),
122 QMessageBox::Warning, 122 QMessageBox::Warning,
123 QMessageBox::Cancel, QMessageBox::Yes, QMessageBox::NoButton, 123 QMessageBox::Cancel, QMessageBox::Yes, QMessageBox::NoButton,
124 0, QString::null, TRUE, WStyle_StaysOnTop); 124 0, QString::null, TRUE, WStyle_StaysOnTop);
125 unrecbox.setButtonText(QMessageBox::Cancel, tr("Cancel")); 125 unrecbox.setButtonText(QMessageBox::Cancel, tr("Cancel"));
126 unrecbox.setButtonText(QMessageBox::Yes, tr("Ok")); 126 unrecbox.setButtonText(QMessageBox::Yes, tr("Ok"));
127 127
128 if ( unrecbox.exec() == QMessageBox::Yes) 128 if ( unrecbox.exec() == QMessageBox::Yes)
129 { 129 {
130 syncnet->clear(); 130 syncnet->clear();
131 insertDefaultRanges(); 131 insertDefaultRanges();
132 } 132 }
133 syncModeCombo->setCurrentItem( 2 );
133} 134}
134 135
135void Security::insertDefaultRanges() 136void Security::insertDefaultRanges()
136{ 137{
137 syncnet->insertItem( tr( "192.168.129.0/24" ) ); 138 syncnet->insertItem( tr( "192.168.129.0/24" ) );
138 syncnet->insertItem( tr( "192.168.1.0/24" ) ); 139 syncnet->insertItem( tr( "192.168.1.0/24" ) );
139 syncnet->insertItem( tr( "192.168.0.0/16" ) ); 140 syncnet->insertItem( tr( "192.168.0.0/16" ) );
140 syncnet->insertItem( tr( "172.16.0.0/12" ) ); 141 syncnet->insertItem( tr( "172.16.0.0/12" ) );
141 syncnet->insertItem( tr( "10.0.0.0/8" ) ); 142 syncnet->insertItem( tr( "10.0.0.0/8" ) );
142 syncnet->insertItem( tr( "1.0.0.0/8" ) ); 143 syncnet->insertItem( tr( "1.0.0.0/8" ) );
143 syncnet->insertItem( tr( "Any" ) ); 144 syncnet->insertItem( tr( "Any" ) );
144 syncnet->insertItem( tr( "None" ) ); 145 syncnet->insertItem( tr( "None" ) );
145} 146}
146 147
147void Security::updateGUI() 148void Security::updateGUI()
148{ 149{
149 bool empty = passcode.isEmpty(); 150 bool empty = passcode.isEmpty();
150 151
151 changepasscode->setText( empty ? tr("Set passcode" ) 152 changepasscode->setText( empty ? tr("Set passcode" )
152 : tr("Change passcode" ) ); 153 : tr("Change passcode" ) );
153 passcode_poweron->setEnabled( !empty ); 154 passcode_poweron->setEnabled( !empty );
154 clearpasscode->setEnabled( !empty ); 155 clearpasscode->setEnabled( !empty );
155 156
156 autologinToggle->setChecked(autoLogin); 157 autologinToggle->setChecked(autoLogin);
157 userlist->setEnabled(autoLogin); 158 userlist->setEnabled(autoLogin);
158} 159}
159 160
160 161
161void Security::show() 162void Security::show()
162{ 163{
163 //valid=FALSE; 164 //valid=FALSE;
164 setEnabled(FALSE); 165 setEnabled(FALSE);
165 SecurityBase::show(); 166 SecurityBase::show();
166 if ( passcode.isEmpty() ) { 167 if ( passcode.isEmpty() ) {
167 // could insist... 168 // could insist...
168 //changePassCode(); 169 //changePassCode();
169 //if ( passcode.isEmpty() ) 170 //if ( passcode.isEmpty() )
170 //reject(); 171 //reject();
171 } else { 172 } else {
172 if (!valid) // security passcode was not asked yet, so ask now 173 if (!valid) // security passcode was not asked yet, so ask now
173 { 174 {
174 QString pc = enterPassCode(tr("Enter passcode")); 175 QString pc = enterPassCode(tr("Enter passcode"));
175 if ( pc != passcode ) { 176 if ( pc != passcode ) {
176 QMessageBox::critical(this, tr("Passcode incorrect"), 177 QMessageBox::critical(this, tr("Passcode incorrect"),
177 tr("The passcode entered is incorrect.\nAccess denied")); 178 tr("The passcode entered is incorrect.\nAccess denied"));
178 reject(); 179 reject();
179 return; 180 return;
180 } 181 }
181 } 182 }
182 } 183 }
183 setEnabled(TRUE); 184 setEnabled(TRUE);
184 valid=TRUE; 185 valid=TRUE;
185} 186}
186 187
187void Security::accept() 188void Security::accept()
188{ 189{
189 applySecurity(); 190 applySecurity();
190 QDialog::accept(); 191 QDialog::accept();
191 QCopEnvelope env("QPE/System", "securityChanged()" ); 192 QCopEnvelope env("QPE/System", "securityChanged()" );
192} 193}
193 194
194void Security::done(int r) 195void Security::done(int r)
195{ 196{
196 QDialog::done(r); 197 QDialog::done(r);
197 close(); 198 close();
198} 199}
199 200
200void Security::selectNet(int auth_peer,int auth_peer_bits, bool update) 201void Security::selectNet(int auth_peer,int auth_peer_bits, bool update)
201{ 202{
202 QString sn; 203 QString sn;
203 if ( auth_peer_bits == 0 && auth_peer == 0 ) { 204 if ( auth_peer_bits == 0 && auth_peer == 0 ) {
204 sn = tr("Any"); 205 sn = tr("Any");
205 } else if ( auth_peer_bits == 32 && auth_peer == 0 ) { 206 } else if ( auth_peer_bits == 32 && auth_peer == 0 ) {
206 sn = tr("None"); 207 sn = tr("None");
207 } else { 208 } else {
208 sn = 209 sn =
209 QString::number((auth_peer>>24)&0xff) + "." 210 QString::number((auth_peer>>24)&0xff) + "."
210 + QString::number((auth_peer>>16)&0xff) + "." 211 + QString::number((auth_peer>>16)&0xff) + "."
211 + QString::number((auth_peer>>8)&0xff) + "." 212 + QString::number((auth_peer>>8)&0xff) + "."
212 + QString::number((auth_peer>>0)&0xff) + "/" 213 + QString::number((auth_peer>>0)&0xff) + "/"
213 + QString::number(auth_peer_bits); 214 + QString::number(auth_peer_bits);
214 } 215 }
215 216
216 //insert user-defined list of netranges upon start 217 //insert user-defined list of netranges upon start
217 if (update) { 218 if (update) {
218 //User selected/active netrange first 219 //User selected/active netrange first
219 syncnet->insertItem( tr( sn ) ); 220 syncnet->insertItem( tr( sn ) );
220 221
221 Config cfg("Security"); 222 Config cfg("Security");
222 cfg.setGroup("Sync"); 223 cfg.setGroup("Sync");
223 224
224 //set up defaults if needed, if someone manually deletes net0 he'll get a suprise hehe 225 //set up defaults if needed, if someone manually deletes net0 he'll get a suprise hehe
225 QString test = cfg.readEntry("net0",""); 226 QString test = cfg.readEntry("net0","");
226 if (test.isEmpty()) { 227 if (test.isEmpty()) {
227 insertDefaultRanges(); 228 insertDefaultRanges();
228 } else { 229 } else {
229 // 10 ought to be enough for everybody... :) 230 // 10 ought to be enough for everybody... :)
230 // If you need more, don't forget to edit applySecurity() as well 231 // If you need more, don't forget to edit applySecurity() as well
231 bool already_there=FALSE; 232 bool already_there=FALSE;
232 for (int i=0; i<10; i++) { 233 for (int i=0; i<10; i++) {
233 QString target, netrange; 234 QString target, netrange;
234 target.sprintf("net%d", i); 235 target.sprintf("net%d", i);
235 netrange = cfg.readEntry(target,""); 236 netrange = cfg.readEntry(target,"");
236 if (! netrange.isEmpty()){ 237 if (! netrange.isEmpty()){
237 //make sure we have no "twin" entries 238 //make sure we have no "twin" entries
238 for (int i=0; i<syncnet->count(); i++) { 239 for (int i=0; i<syncnet->count(); i++) {
239 if ( syncnet->text(i) == netrange ) { 240 if ( syncnet->text(i) == netrange ) {
240 already_there=TRUE; 241 already_there=TRUE;
241 } 242 }
242 } 243 }
243 if (! already_there) { 244 if (! already_there) {
244 syncnet->insertItem( tr( netrange ) ); 245 syncnet->insertItem( tr( netrange ) );
245 } else { 246 } else {
246 already_there=FALSE; 247 already_there=FALSE;
247 } 248 }
248 } 249 }
249 } 250 }
250 } 251 }
251 } 252 }
252 253
253 for (int i=0; i<syncnet->count(); i++) { 254 for (int i=0; i<syncnet->count(); i++) {
254 if ( syncnet->text(i).left(sn.length()) == sn ) { 255 if ( syncnet->text(i).left(sn.length()) == sn ) {
255 syncnet->setCurrentItem(i); 256 syncnet->setCurrentItem(i);
256 return; 257 return;
257 } 258 }
258 } 259 }
259 qDebug("No match for \"%s\"",sn.latin1()); 260 qDebug("No match for \"%s\"",sn.latin1());
260} 261}
261 262
262void Security::parseNet(const QString& sn,int& auth_peer,int& auth_peer_bits) 263void Security::parseNet(const QString& sn,int& auth_peer,int& auth_peer_bits)
263{ 264{
264 auth_peer=0; 265 auth_peer=0;
265 if ( sn == tr("Any") ) { 266 if ( sn == tr("Any") ) {
266 auth_peer = 0; 267 auth_peer = 0;
267 auth_peer_bits = 0; 268 auth_peer_bits = 0;
268 } else if ( sn == tr("None") ) { 269 } else if ( sn == tr("None") ) {
269 auth_peer = 0; 270 auth_peer = 0;
270 auth_peer_bits = 32; 271 auth_peer_bits = 32;
271 } else { 272 } else {
272 int x=0; 273 int x=0;
273 for (int i=0; i<4; i++) { 274 for (int i=0; i<4; i++) {
274 int nx = sn.find(QChar(i==3 ? '/' : '.'),x); 275 int nx = sn.find(QChar(i==3 ? '/' : '.'),x);
275 auth_peer = (auth_peer<<8)|sn.mid(x,nx-x).toInt(); 276 auth_peer = (auth_peer<<8)|sn.mid(x,nx-x).toInt();
276 x = nx+1; 277 x = nx+1;
277 } 278 }
278 uint n = (uint)sn.find(' ',x)-x; 279 uint n = (uint)sn.find(' ',x)-x;
279 auth_peer_bits = sn.mid(x,n).toInt(); 280 auth_peer_bits = sn.mid(x,n).toInt();
280 } 281 }
281} 282}
282 283
283void Security::loadUsers ( void ) 284void Security::loadUsers ( void )
284{ 285{
285 QFile passwd("/etc/passwd"); 286 QFile passwd("/etc/passwd");
286 if ( passwd.open(IO_ReadOnly) ) { 287 if ( passwd.open(IO_ReadOnly) ) {
287 QTextStream t( &passwd ); 288 QTextStream t( &passwd );
288 QString s; 289 QString s;
289 QStringList account; 290 QStringList account;
290 while ( !t.eof() ) { 291 while ( !t.eof() ) {
291 account = QStringList::split(':',t.readLine()); 292 account = QStringList::split(':',t.readLine());
292 293
293 // Hide disabled accounts 294 // Hide disabled accounts
294 if (*account.at(1)!="*") { 295 if (*account.at(1)!="*") {
295 296
296 userlist->insertItem(*account.at(0)); 297 userlist->insertItem(*account.at(0));
297 // Highlight this item if it is set to autologinToggle 298 // Highlight this item if it is set to autologinToggle
298 if ( *account.at(0) == autoLoginName) 299 if ( *account.at(0) == autoLoginName)
299 userlist->setCurrentItem(userlist->count()-1); 300 userlist->setCurrentItem(userlist->count()-1);
300 } 301 }
301 } 302 }
302 passwd.close(); 303 passwd.close();
303 } 304 }
304 305
305} 306}
306 307
307void Security::toggleAutoLogin(bool val) 308void Security::toggleAutoLogin(bool val)
308{ 309{
309 autoLogin=val; 310 autoLogin=val;
310 userlist->setEnabled(val); 311 userlist->setEnabled(val);
311 if (!autoLogin) 312 if (!autoLogin)
312 autoLoginName=userlist->currentText(); 313 autoLoginName=userlist->currentText();
313} 314}
314 315
315 316
316 317
317 318
318void Security::setSyncNet(const QString& sn) 319void Security::setSyncNet(const QString& sn)
319{ 320{
320 int auth_peer,auth_peer_bits; 321 int auth_peer,auth_peer_bits;
321 parseNet(sn,auth_peer,auth_peer_bits); 322 parseNet(sn,auth_peer,auth_peer_bits);
322 selectNet(auth_peer,auth_peer_bits,FALSE); 323 selectNet(auth_peer,auth_peer_bits,FALSE);
323} 324}
324 325
325void Security::applySecurity() 326void Security::applySecurity()
326{ 327{
327 if ( valid ) { 328 if ( valid ) {
328 Config cfg("Security"); 329 Config cfg("Security");
329 cfg.setGroup("Passcode"); 330 cfg.setGroup("Passcode");
330 cfg.writeEntry("passcode",passcode); 331 cfg.writeEntry("passcode",passcode);
331 cfg.writeEntry("passcode_poweron",passcode_poweron->isChecked()); 332 cfg.writeEntry("passcode_poweron",passcode_poweron->isChecked());
332 cfg.setGroup("Sync"); 333 cfg.setGroup("Sync");
333 int auth_peer=0; 334 int auth_peer=0;
334 int auth_peer_bits; 335 int auth_peer_bits;
335 QString sn = syncnet->currentText(); 336 QString sn = syncnet->currentText();
336 parseNet(sn,auth_peer,auth_peer_bits); 337 parseNet(sn,auth_peer,auth_peer_bits);
337 338
338 //this is the *selected* (active) net range 339 //this is the *selected* (active) net range
339 cfg.writeEntry("auth_peer",auth_peer); 340 cfg.writeEntry("auth_peer",auth_peer);
340 cfg.writeEntry("auth_peer_bits",auth_peer_bits); 341 cfg.writeEntry("auth_peer_bits",auth_peer_bits);
341 342
342 //write back all other net ranges in *cleartext* 343 //write back all other net ranges in *cleartext*
343 for (int i=0; i<10; i++) { 344 for (int i=0; i<10; i++) {
344 QString target; 345 QString target;
345 target.sprintf("net%d", i); 346 target.sprintf("net%d", i);
346 cfg.writeEntry(target,syncnet->text(i)); 347 cfg.writeEntry(target,syncnet->text(i));
347 } 348 }
348 349
349 cfg.writeEntry("syncapp",syncapp->currentText()); 350#ifdef ODP
350 351 #error "Use 0,1,2 and use Launcher"
352#endif
353 /* keep the old code so we don't use currentItem directly */
354 int value = 0x02;
355 switch( syncModeCombo->currentItem() ) {
356 case 0:
357 value = 0x01;
358 break;
359 case 1:
360 value = 0x02;
361 break;
362 case 2:
363 value = 0x04;
364 break;
365 }
366 cfg.setGroup("SyncMode");
367 cfg.writeEntry( "Mode", value );
368
351 /* 369 /*
352 cfg.setGroup("Remote"); 370 cfg.setGroup("Remote");
353 if ( telnetAvailable() ) 371 if ( telnetAvailable() )
354 cfg.writeEntry("allow_telnet",telnet->isChecked()); 372 cfg.writeEntry("allow_telnet",telnet->isChecked());
355 if ( sshAvailable() ) 373 if ( sshAvailable() )
356 cfg.writeEntry("allow_ssh",ssh->isChecked()); 374 cfg.writeEntry("allow_ssh",ssh->isChecked());
357 // ### write ssh/telnet sys config files 375 // ### write ssh/telnet sys config files
358 */ 376 */
359 377
360 QString configFile = QPEApplication::qpeDir() + "/etc/opie-login.conf"; 378 QString configFile = QPEApplication::qpeDir() + "/etc/opie-login.conf";
361 Config loginCfg(configFile,Config::File); 379 Config loginCfg(configFile,Config::File);
362 loginCfg.setGroup("General"); 380 loginCfg.setGroup("General");
363 381
364 if (autoLogin) { 382 if (autoLogin) {
365 loginCfg.writeEntry("AutoLogin",autoLoginName); 383 loginCfg.writeEntry("AutoLogin",autoLoginName);
366 } else { 384 } else {
367 loginCfg.removeEntry("AutoLogin"); 385 loginCfg.removeEntry("AutoLogin");
368 } 386 }
369 387
370 } 388 }
371} 389}
372void Security::changeSyncApp() 390
373{
374 // Don't say i didn't tell ya
375 if (syncapp->currentText() == "IntelliSync") {
376 QMessageBox attn(
377 tr("WARNING"),
378 tr("<p>Selecting IntelliSync here will disable the FTP password."
379 "<p>Every machine in your netrange will be able to sync with "
380 "your Zaurus!"),
381 QMessageBox::Warning,
382 QMessageBox::Cancel, QMessageBox::NoButton, QMessageBox::NoButton,
383 0, QString::null, TRUE, WStyle_StaysOnTop);
384 attn.setButtonText(QMessageBox::Cancel, tr("Ok"));
385 attn.exec();
386 }
387 updateGUI();
388}
389 391
390 392
391 393
392void Security::changeLoginName( int idx ) 394void Security::changeLoginName( int idx )
393{ 395{
394 autoLoginName = userlist->text(idx);; 396 autoLoginName = userlist->text(idx);;
395 updateGUI(); 397 updateGUI();
396} 398}
397 399
398void Security::changePassCode() 400void Security::changePassCode()
399{ 401{
400 QString new1; 402 QString new1;
401 QString new2; 403 QString new2;
402 404
403 do { 405 do {
404 new1 = enterPassCode(tr("Enter new passcode")); 406 new1 = enterPassCode(tr("Enter new passcode"));
405 if ( new1.isNull() ) 407 if ( new1.isNull() )
406 return; 408 return;
407 new2 = enterPassCode(tr("Re-enter new passcode")); 409 new2 = enterPassCode(tr("Re-enter new passcode"));
408 if ( new2.isNull() ) 410 if ( new2.isNull() )
409 return; 411 return;
410 } while (new1 != new2); 412 } while (new1 != new2);
411 413
412 passcode = new1; 414 passcode = new1;
413 updateGUI(); 415 updateGUI();
414} 416}
415 417
416void Security::clearPassCode() 418void Security::clearPassCode()
417{ 419{
418 passcode = QString::null; 420 passcode = QString::null;
419 updateGUI(); 421 updateGUI();
420} 422}
421 423
422 424
423QString Security::enterPassCode(const QString& prompt) 425QString Security::enterPassCode(const QString& prompt)
424{ 426{
425 return Password::getPassword(prompt); 427 return Password::getPassword(prompt);
426} 428}
427 429
428bool Security::telnetAvailable() const 430bool Security::telnetAvailable() const
429{ 431{
430 // ### not implemented 432 // ### not implemented
431 return FALSE; 433 return FALSE;
432} 434}
433 435
434bool Security::sshAvailable() const 436bool Security::sshAvailable() const
435{ 437{
436 // ### not implemented 438 // ### not implemented
437 return FALSE; 439 return FALSE;
438} 440}
diff --git a/core/settings/security/security.h b/core/settings/security/security.h
index 72aa352..ed25ce1 100644
--- a/core/settings/security/security.h
+++ b/core/settings/security/security.h
@@ -1,75 +1,74 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#ifndef SECURITY_H 20#ifndef SECURITY_H
21#define SECURITY_H 21#define SECURITY_H
22 22
23#include "securitybase.h" 23#include "securitybase.h"
24 24
25class QPEDialogListener; 25class QPEDialogListener;
26 26
27class Security : public SecurityBase 27class Security : public SecurityBase
28{ 28{
29 Q_OBJECT 29 Q_OBJECT
30 30
31public: 31public:
32 static QString appName() { return QString::fromLatin1("security"); } 32 static QString appName() { return QString::fromLatin1("security"); }
33 Security( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 33 Security( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
34 ~Security(); 34 ~Security();
35 35
36 void show(); 36 void show();
37 37
38protected: 38protected:
39 void accept(); 39 void accept();
40 void applySecurity(); 40 void applySecurity();
41 void done(int); 41 void done(int);
42 42
43private slots: 43private slots:
44 void changePassCode(); 44 void changePassCode();
45 void clearPassCode(); 45 void clearPassCode();
46 void setSyncNet(const QString&); 46 void setSyncNet(const QString&);
47 void changeLoginName(int); 47 void changeLoginName(int);
48 void toggleAutoLogin(bool); 48 void toggleAutoLogin(bool);
49 void changeSyncApp();
50 void restoreDefaults(); 49 void restoreDefaults();
51 void insertDefaultRanges(); 50 void insertDefaultRanges();
52 void deleteListEntry(); 51 void deleteListEntry();
53 52
54private: 53private:
55 void loadUsers(void); 54 void loadUsers(void);
56 bool telnetAvailable() const; 55 bool telnetAvailable() const;
57 bool sshAvailable() const; 56 bool sshAvailable() const;
58 void updateGUI(); 57 void updateGUI();
59 58
60 static void parseNet(const QString& sn,int& auth_peer,int& auth_peer_bits); 59 static void parseNet(const QString& sn,int& auth_peer,int& auth_peer_bits);
61 void selectNet(int auth_peer,int auth_peer_bits,bool update); 60 void selectNet(int auth_peer,int auth_peer_bits,bool update);
62 61
63 62
64 QString enterPassCode(const QString&); 63 QString enterPassCode(const QString&);
65 QString passcode; 64 QString passcode;
66 bool valid; 65 bool valid;
67 bool autoLogin; 66 bool autoLogin;
68 QString autoLoginName; 67 QString autoLoginName;
69 68
70 QPEDialogListener *dl; 69 QPEDialogListener *dl;
71}; 70};
72 71
73 72
74#endif // SECURITY_H 73#endif // SECURITY_H
75 74
diff --git a/core/settings/security/securitybase.ui b/core/settings/security/securitybase.ui
index 1769ae1..dcf1d6b 100644
--- a/core/settings/security/securitybase.ui
+++ b/core/settings/security/securitybase.ui
@@ -1,110 +1,110 @@
1<!DOCTYPE UI><UI> 1<!DOCTYPE UI><UI>
2<class>SecurityBase</class> 2<class>SecurityBase</class>
3<widget> 3<widget>
4 <class>QDialog</class> 4 <class>QDialog</class>
5 <property stdset="1"> 5 <property stdset="1">
6 <name>name</name> 6 <name>name</name>
7 <cstring>SecurityBase</cstring> 7 <cstring>SecurityBase</cstring>
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>309</width> 14 <width>327</width>
15 <height>483</height> 15 <height>483</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>Security Settings</string> 20 <string>Security Settings</string>
21 </property> 21 </property>
22 <property> 22 <property>
23 <name>layoutMargin</name> 23 <name>layoutMargin</name>
24 </property> 24 </property>
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>0</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>0</number> 35 <number>0</number>
36 </property> 36 </property>
37 <widget> 37 <widget>
38 <class>QTabWidget</class> 38 <class>QTabWidget</class>
39 <property stdset="1"> 39 <property stdset="1">
40 <name>name</name> 40 <name>name</name>
41 <cstring>TabWidget2</cstring> 41 <cstring>TabWidget2</cstring>
42 </property> 42 </property>
43 <property> 43 <property>
44 <name>layoutMargin</name> 44 <name>layoutMargin</name>
45 </property> 45 </property>
46 <widget> 46 <widget>
47 <class>QWidget</class> 47 <class>QWidget</class>
48 <property stdset="1"> 48 <property stdset="1">
49 <name>name</name> 49 <name>name</name>
50 <cstring>tab</cstring> 50 <cstring>tab</cstring>
51 </property> 51 </property>
52 <attribute> 52 <attribute>
53 <name>title</name> 53 <name>title</name>
54 <string>Passcode</string> 54 <string>Passcode</string>
55 </attribute> 55 </attribute>
56 <vbox> 56 <vbox>
57 <property stdset="1"> 57 <property stdset="1">
58 <name>margin</name> 58 <name>margin</name>
59 <number>6</number> 59 <number>6</number>
60 </property> 60 </property>
61 <property stdset="1"> 61 <property stdset="1">
62 <name>spacing</name> 62 <name>spacing</name>
63 <number>6</number> 63 <number>6</number>
64 </property> 64 </property>
65 <widget> 65 <widget>
66 <class>QGroupBox</class> 66 <class>QGroupBox</class>
67 <property stdset="1"> 67 <property stdset="1">
68 <name>name</name> 68 <name>name</name>
69 <cstring>GroupBox4</cstring> 69 <cstring>GroupBox4</cstring>
70 </property> 70 </property>
71 <property stdset="1"> 71 <property stdset="1">
72 <name>title</name> 72 <name>title</name>
73 <string>Passcode</string> 73 <string>Passcode</string>
74 </property> 74 </property>
75 <vbox> 75 <vbox>
76 <property stdset="1"> 76 <property stdset="1">
77 <name>margin</name> 77 <name>margin</name>
78 <number>11</number> 78 <number>11</number>
79 </property> 79 </property>
80 <property stdset="1"> 80 <property stdset="1">
81 <name>spacing</name> 81 <name>spacing</name>
82 <number>6</number> 82 <number>6</number>
83 </property> 83 </property>
84 <widget> 84 <widget>
85 <class>QLayoutWidget</class> 85 <class>QLayoutWidget</class>
86 <property stdset="1"> 86 <property stdset="1">
87 <name>name</name> 87 <name>name</name>
88 <cstring>Layout1</cstring> 88 <cstring>Layout1</cstring>
89 </property> 89 </property>
90 <property> 90 <property>
91 <name>layoutSpacing</name> 91 <name>layoutSpacing</name>
92 </property> 92 </property>
93 <hbox> 93 <hbox>
94 <property stdset="1"> 94 <property stdset="1">
95 <name>margin</name> 95 <name>margin</name>
96 <number>0</number> 96 <number>0</number>
97 </property> 97 </property>
98 <property stdset="1"> 98 <property stdset="1">
99 <name>spacing</name> 99 <name>spacing</name>
100 <number>-1</number> 100 <number>-1</number>
101 </property> 101 </property>
102 <widget> 102 <widget>
103 <class>QPushButton</class> 103 <class>QPushButton</class>
104 <property stdset="1"> 104 <property stdset="1">
105 <name>name</name> 105 <name>name</name>
106 <cstring>changepasscode</cstring> 106 <cstring>changepasscode</cstring>
107 </property> 107 </property>
108 <property stdset="1"> 108 <property stdset="1">
109 <name>text</name> 109 <name>text</name>
110 <string>Change passcode</string> 110 <string>Change passcode</string>
@@ -373,151 +373,132 @@ You can only select an actually configured user.</string>
373 </widget> 373 </widget>
374 <widget> 374 <widget>
375 <class>QComboBox</class> 375 <class>QComboBox</class>
376 <property stdset="1"> 376 <property stdset="1">
377 <name>name</name> 377 <name>name</name>
378 <cstring>syncnet</cstring> 378 <cstring>syncnet</cstring>
379 </property> 379 </property>
380 <property stdset="1"> 380 <property stdset="1">
381 <name>editable</name> 381 <name>editable</name>
382 <bool>true</bool> 382 <bool>true</bool>
383 </property> 383 </property>
384 <property> 384 <property>
385 <name>whatsThis</name> 385 <name>whatsThis</name>
386 <string>Select a net-range or enter a new one. 386 <string>Select a net-range or enter a new one.
387 387
388This drop-down list lets you select a net range which is allowed to connect to your Zaurus. 388This drop-down list lets you select a net range which is allowed to connect to your Zaurus.
389 389
390For 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. 390For 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 391
392The entry "All" will allow *any* IP to connect. 392The entry "All" will allow *any* IP to connect.
393The entry "None" will *deny* any connection. 393The entry "None" will *deny* any connection.
394 394
395If unsure, select "Any".</string> 395If unsure, select "Any".</string>
396 </property> 396 </property>
397 </widget> 397 </widget>
398 <widget> 398 <widget>
399 <class>QLayoutWidget</class> 399 <class>QLayoutWidget</class>
400 <property stdset="1"> 400 <property stdset="1">
401 <name>name</name> 401 <name>name</name>
402 <cstring>Layout4</cstring> 402 <cstring>Layout4</cstring>
403 </property> 403 </property>
404 <hbox> 404 <hbox>
405 <property stdset="1"> 405 <property stdset="1">
406 <name>margin</name> 406 <name>margin</name>
407 <number>0</number> 407 <number>0</number>
408 </property> 408 </property>
409 <property stdset="1"> 409 <property stdset="1">
410 <name>spacing</name> 410 <name>spacing</name>
411 <number>6</number> 411 <number>6</number>
412 </property> 412 </property>
413 <widget> 413 <widget>
414 <class>QPushButton</class> 414 <class>QPushButton</class>
415 <property stdset="1"> 415 <property stdset="1">
416 <name>name</name> 416 <name>name</name>
417 <cstring>deleteentry</cstring> 417 <cstring>deleteentry</cstring>
418 </property> 418 </property>
419 <property stdset="1"> 419 <property stdset="1">
420 <name>text</name> 420 <name>text</name>
421 <string>Delete Entry</string> 421 <string>Delete Entry</string>
422 </property> 422 </property>
423 <property> 423 <property>
424 <name>whatsThis</name> 424 <name>whatsThis</name>
425 <string>Delete the selected net range from the list 425 <string>Delete the selected net range from the list
426 426
427If you press this button, the currently selected net range will be deleted from the list of net ranges. 427If you press this button, the currently selected net range will be deleted from the list of net ranges.
428 428
429If you hit this button in error, the button "Restore Defaults" will restore 429If you hit this button in error, the button "Restore Defaults" will restore
430the list to the state it has been when you initially booted your Zaurus.</string> 430the list to the state it has been when you initially booted your Zaurus.</string>
431 </property> 431 </property>
432 </widget> 432 </widget>
433 <widget> 433 <widget>
434 <class>QPushButton</class> 434 <class>QPushButton</class>
435 <property stdset="1"> 435 <property stdset="1">
436 <name>name</name> 436 <name>name</name>
437 <cstring>restoredefaults</cstring> 437 <cstring>restoredefaults</cstring>
438 </property> 438 </property>
439 <property stdset="1"> 439 <property stdset="1">
440 <name>text</name> 440 <name>text</name>
441 <string>Restore Defaults</string> 441 <string>Restore Defaults</string>
442 </property> 442 </property>
443 <property> 443 <property>
444 <name>whatsThis</name> 444 <name>whatsThis</name>
445 <string>This button will restore the list of net ranges 445 <string>This button will restore the list of net ranges
446to the defaults. 446to the defaults.
447 447
448Beware that all manually entered net ranges will be lost!</string> 448Beware that all manually entered net ranges will be lost!</string>
449 </property> 449 </property>
450 </widget> 450 </widget>
451 </hbox> 451 </hbox>
452 </widget> 452 </widget>
453 <widget> 453 <widget>
454 <class>QLabel</class> 454 <class>QLabel</class>
455 <property stdset="1"> 455 <property stdset="1">
456 <name>name</name> 456 <name>name</name>
457 <cstring>TextLabel2</cstring> 457 <cstring>TextLabel2</cstring>
458 </property> 458 </property>
459 <property stdset="1"> 459 <property stdset="1">
460 <name>text</name> 460 <name>text</name>
461 <string>Select your sync software</string> 461 <string>Select your sync software</string>
462 </property> 462 </property>
463 </widget> 463 </widget>
464 <widget> 464 <widget>
465 <class>QComboBox</class> 465 <class>QComboBox</class>
466 <item> 466 <item>
467 <property> 467 <property>
468 <name>text</name> 468 <name>text</name>
469 <string>QTopia</string>
470 </property>
471 </item>
472 <item>
473 <property>
474 <name>text</name>
475 <string>IntelliSync</string>
476 </property>
477 </item>
478 <property stdset="1">
479 <name>name</name>
480 <cstring>syncapp</cstring>
481 </property>
482 <property>
483 <name>whatsThis</name>
484 <string>This option changes the login behaviour of the internal FTP server.
485
486If you have problems syncing, try the "IntelliSync" setting, which will accept any password you throw at the sync (FTP) port.
487
488The default is Qtopia. It will let you log in with username "root" and password "Qtopia". The password is CaSeSeNsItIvE.</string>
489 </property>
490 </widget>
491 <widget>
492 <class>QComboBox</class>
493 <item>
494 <property>
495 <name>text</name>
496 <string>Qtopia 1.7</string> 469 <string>Qtopia 1.7</string>
497 </property> 470 </property>
498 </item> 471 </item>
499 <item> 472 <item>
500 <property> 473 <property>
501 <name>text</name> 474 <name>text</name>
502 <string>Opie 1.0</string> 475 <string>Opie 1.0</string>
503 </property> 476 </property>
504 </item> 477 </item>
505 <item> 478 <item>
506 <property> 479 <property>
507 <name>text</name> 480 <name>text</name>
508 <string>Both</string> 481 <string>IntelliSync</string>
509 </property> 482 </property>
510 </item> 483 </item>
511 <property stdset="1"> 484 <property stdset="1">
512 <name>name</name> 485 <name>name</name>
513 <cstring>syncModeCombo</cstring> 486 <cstring>syncModeCombo</cstring>
514 </property> 487 </property>
488 <property>
489 <name>whatsThis</name>
490 <string>Alter the Sync Protocol to tweak for the different devices.
491 IntelliSync will disable the password check but you'll be prompted to accept the connection.
492 Opie1.0 will be compatible with QtopiaDesktop, MultiSync and KitchenSync
493 Qtopia1.7 will alter the way data is send to the client and will not work with older clients.
494 </string>
495 </property>
515 </widget> 496 </widget>
516 </vbox> 497 </vbox>
517 </widget> 498 </widget>
518 </grid> 499 </grid>
519 </widget> 500 </widget>
520 </widget> 501 </widget>
521 </vbox> 502 </vbox>
522</widget> 503</widget>
523</UI> 504</UI>