30 files changed, 284 insertions, 281 deletions
diff --git a/noncore/settings/backup/backuprestore.cpp b/noncore/settings/backup/backuprestore.cpp index 58e5c71..2eccdfe 100644 --- a/noncore/settings/backup/backuprestore.cpp +++ b/noncore/settings/backup/backuprestore.cpp | |||
@@ -1,19 +1,20 @@ | |||
1 | |||
2 | #include "backuprestore.h" | 1 | #include "backuprestore.h" |
3 | #include "errordialog.h" | 2 | #include "errordialog.h" |
4 | 3 | ||
5 | /* OPIE */ | 4 | /* OPIE */ |
5 | #include <opie2/odebug.h> | ||
6 | #include <opie2/ostorageinfo.h> | 6 | #include <opie2/ostorageinfo.h> |
7 | #include <qpe/qpeapplication.h> | 7 | #include <qpe/qpeapplication.h> |
8 | using namespace Opie::Core; | ||
8 | 9 | ||
9 | /* QT */ | 10 | /* QT */ |
10 | #include <qapplication.h> | 11 | #include <qapplication.h> |
11 | #include <qmultilineedit.h> | 12 | #include <qmultilineedit.h> |
12 | #include <qdir.h> | 13 | #include <qdir.h> |
13 | #include <qfile.h> | 14 | #include <qfile.h> |
14 | #include <qfileinfo.h> | 15 | #include <qfileinfo.h> |
15 | #include <qlistview.h> | 16 | #include <qlistview.h> |
16 | #include <qpushbutton.h> | 17 | #include <qpushbutton.h> |
17 | #include <qheader.h> | 18 | #include <qheader.h> |
18 | #include <qpe/resource.h> | 19 | #include <qpe/resource.h> |
19 | #include <qpe/config.h> | 20 | #include <qpe/config.h> |
@@ -31,25 +32,24 @@ | |||
31 | #include <unistd.h> | 32 | #include <unistd.h> |
32 | #include <sys/stat.h> | 33 | #include <sys/stat.h> |
33 | #include <dirent.h> | 34 | #include <dirent.h> |
34 | 35 | ||
35 | #define HEADER_NAME 0 | 36 | #define HEADER_NAME 0 |
36 | #define HEADER_BACKUP 1 | 37 | #define HEADER_BACKUP 1 |
37 | #define BACKUP_LOCATION 2 | 38 | #define BACKUP_LOCATION 2 |
38 | 39 | ||
39 | #define EXTENSION ".bck" | 40 | #define EXTENSION ".bck" |
40 | 41 | ||
41 | const QString tempFileName = "/tmp/backup.err"; | 42 | const QString tempFileName = "/tmp/backup.err"; |
42 | 43 | ||
43 | |||
44 | BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name, WFlags fl) | 44 | BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name, WFlags fl) |
45 | : BackupAndRestoreBase(parent, name, fl) | 45 | : BackupAndRestoreBase(parent, name, fl) |
46 | { | 46 | { |
47 | backupList->header()->hide(); | 47 | backupList->header()->hide(); |
48 | restoreList->header()->hide(); | 48 | restoreList->header()->hide(); |
49 | connect(backupButton, SIGNAL(clicked()), | 49 | connect(backupButton, SIGNAL(clicked()), |
50 | this, SLOT(backup())); | 50 | this, SLOT(backup())); |
51 | connect(restoreButton, SIGNAL(clicked()), | 51 | connect(restoreButton, SIGNAL(clicked()), |
52 | this, SLOT(restore())); | 52 | this, SLOT(restore())); |
53 | connect(backupList, SIGNAL(clicked(QListViewItem*)), | 53 | connect(backupList, SIGNAL(clicked(QListViewItem*)), |
54 | this, SLOT(selectItem(QListViewItem*))); | 54 | this, SLOT(selectItem(QListViewItem*))); |
55 | connect(restoreSource, SIGNAL(activated(int)), | 55 | connect(restoreSource, SIGNAL(activated(int)), |
@@ -64,35 +64,35 @@ BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name, WFlags f | |||
64 | selectItem(applicationSettings); | 64 | selectItem(applicationSettings); |
65 | documents= new QListViewItem(backupList, "Documents", "", "Documents/"); | 65 | documents= new QListViewItem(backupList, "Documents", "", "Documents/"); |
66 | selectItem(documents); | 66 | selectItem(documents); |
67 | 67 | ||
68 | scanForApplicationSettings(); | 68 | scanForApplicationSettings(); |
69 | 69 | ||
70 | Opie::Core::OStorageInfo storage; | 70 | Opie::Core::OStorageInfo storage; |
71 | 71 | ||
72 | backupLocations.insert( "Documents", QDir::homeDirPath() + "/Documents" ); | 72 | backupLocations.insert( "Documents", QDir::homeDirPath() + "/Documents" ); |
73 | if ( storage.hasCf() ) | 73 | if ( storage.hasCf() ) |
74 | { | 74 | { |
75 | backupLocations.insert( "CF", storage.cfPath() ); | 75 | backupLocations.insert( "CF", storage.cfPath() ); |
76 | qDebug( "Cf Path: " + storage.cfPath() ); | 76 | odebug << "Cf Path: " + storage.cfPath() << oendl; |
77 | } | 77 | } |
78 | if ( storage.hasSd() ) | 78 | if ( storage.hasSd() ) |
79 | { | 79 | { |
80 | backupLocations.insert( "SD", storage.sdPath() ); | 80 | backupLocations.insert( "SD", storage.sdPath() ); |
81 | qDebug( " Sd Path: " + storage.sdPath() ); | 81 | odebug << " Sd Path: " + storage.sdPath() << oendl; |
82 | } | 82 | } |
83 | if ( storage.hasMmc() ) | 83 | if ( storage.hasMmc() ) |
84 | { | 84 | { |
85 | backupLocations.insert( "MMC", storage.mmcPath() ); | 85 | backupLocations.insert( "MMC", storage.mmcPath() ); |
86 | qDebug( "Mmc Path: " + storage.mmcPath() ); | 86 | odebug << "Mmc Path: " + storage.mmcPath() << oendl; |
87 | } | 87 | } |
88 | 88 | ||
89 | Config config("BackupAndRestore"); | 89 | Config config("BackupAndRestore"); |
90 | //read last locations | 90 | //read last locations |
91 | config.setGroup("LastLocation"); | 91 | config.setGroup("LastLocation"); |
92 | QString lastStoreLocation = config.readEntry( "LastStoreLocation", "" ); | 92 | QString lastStoreLocation = config.readEntry( "LastStoreLocation", "" ); |
93 | QString lastRestoreLocation = config.readEntry( "LastRestoreLocation", "" ); | 93 | QString lastRestoreLocation = config.readEntry( "LastRestoreLocation", "" ); |
94 | int locationIndex = 0; | 94 | int locationIndex = 0; |
95 | 95 | ||
96 | QMap<QString, QString>::Iterator it; | 96 | QMap<QString, QString>::Iterator it; |
97 | for( it = backupLocations.begin(); it != backupLocations.end(); ++it ) | 97 | for( it = backupLocations.begin(); it != backupLocations.end(); ++it ) |
98 | { | 98 | { |
@@ -194,25 +194,25 @@ void BackupAndRestore::selectItem(QListViewItem *currentItem) | |||
194 | } | 194 | } |
195 | } | 195 | } |
196 | 196 | ||
197 | void BackupAndRestore::scanForApplicationSettings() | 197 | void BackupAndRestore::scanForApplicationSettings() |
198 | { | 198 | { |
199 | QDir d( QDir::homeDirPath() + "/" + QString( applicationSettings->text(BACKUP_LOCATION) ) ); | 199 | QDir d( QDir::homeDirPath() + "/" + QString( applicationSettings->text(BACKUP_LOCATION) ) ); |
200 | d.setFilter( QDir::Dirs | QDir::Files | QDir::NoSymLinks ); | 200 | d.setFilter( QDir::Dirs | QDir::Files | QDir::NoSymLinks ); |
201 | const QFileInfoList *list = d.entryInfoList(); | 201 | const QFileInfoList *list = d.entryInfoList(); |
202 | QFileInfoListIterator it( *list ); | 202 | QFileInfoListIterator it( *list ); |
203 | QFileInfo *fi; | 203 | QFileInfo *fi; |
204 | while ( (fi=it.current()) ) | 204 | while ( (fi=it.current()) ) |
205 | { | 205 | { |
206 | //qDebug((d.path()+"/"+fi->fileName()).latin1()); | 206 | //odebug << (d.path()+"/"+fi->fileName()).latin1() << oendl; |
207 | if ( ( fi->fileName() != "." ) && ( fi->fileName() != ".." ) ) | 207 | if ( ( fi->fileName() != "." ) && ( fi->fileName() != ".." ) ) |
208 | { | 208 | { |
209 | QListViewItem *newItem = new QListViewItem(applicationSettings, fi->fileName()); | 209 | QListViewItem *newItem = new QListViewItem(applicationSettings, fi->fileName()); |
210 | selectItem(newItem); | 210 | selectItem(newItem); |
211 | } | 211 | } |
212 | ++it; | 212 | ++it; |
213 | } | 213 | } |
214 | } | 214 | } |
215 | 215 | ||
216 | /** | 216 | /** |
217 | * The "Backup" button has been pressed. Get a list of all of the files that | 217 | * The "Backup" button has been pressed. Get a list of all of the files that |
218 | * should be backed up. If there are no files, emit and error and exit. | 218 | * should be backed up. If there are no files, emit and error and exit. |
@@ -240,48 +240,48 @@ void BackupAndRestore::backup() | |||
240 | 240 | ||
241 | QString t = outputFile; | 241 | QString t = outputFile; |
242 | int c = 1; | 242 | int c = 1; |
243 | while(QFile::exists(outputFile + EXTENSION)) | 243 | while(QFile::exists(outputFile + EXTENSION)) |
244 | { | 244 | { |
245 | outputFile = t + QString("%1").arg(c); | 245 | outputFile = t + QString("%1").arg(c); |
246 | c++; | 246 | c++; |
247 | } | 247 | } |
248 | 248 | ||
249 | // We execute tar and compressing its output with gzip.. | 249 | // We execute tar and compressing its output with gzip.. |
250 | // The error output will be written into a temp-file which could be provided | 250 | // The error output will be written into a temp-file which could be provided |
251 | // for debugging.. | 251 | // for debugging.. |
252 | qDebug( "Storing file: %s", outputFile.latin1() ); | 252 | odebug << "Storing file: " << outputFile.latin1() << "" << oendl; |
253 | outputFile += EXTENSION; | 253 | outputFile += EXTENSION; |
254 | 254 | ||
255 | QString commandLine = QString( "cd %1 && (tar -X %1 -cz %2 Applications/backup/exclude -f %3 ) 2> %4" ).arg( QDir::homeDirPath() ) | 255 | QString commandLine = QString( "cd %1 && (tar -X %1 -cz %2 Applications/backup/exclude -f %3 ) 2> %4" ).arg( QDir::homeDirPath() ) |
256 | .arg( getExcludeFile() ) | 256 | .arg( getExcludeFile() ) |
257 | .arg( backupFiles ) | 257 | .arg( backupFiles ) |
258 | .arg( outputFile.latin1() ) | 258 | .arg( outputFile.latin1() ) |
259 | .arg( tempFileName.latin1() ); | 259 | .arg( tempFileName.latin1() ); |
260 | 260 | ||
261 | qDebug( commandLine ); | 261 | odebug << commandLine << oendl; |
262 | 262 | ||
263 | int r = system( commandLine ); | 263 | int r = system( commandLine ); |
264 | 264 | ||
265 | if(r != 0) | 265 | if(r != 0) |
266 | { | 266 | { |
267 | perror("Error: "); | 267 | perror("Error: "); |
268 | QString errorMsg= tr( "Error from System:\n" ) + (QString)strerror( errno ); | 268 | QString errorMsg= tr( "Error from System:\n" ) + (QString)strerror( errno ); |
269 | 269 | ||
270 | switch( QMessageBox::critical(this, tr( "Message" ), tr( "Backup Failed!" ) + "\n" | 270 | switch( QMessageBox::critical(this, tr( "Message" ), tr( "Backup Failed!" ) + "\n" |
271 | + errorMsg, QString( tr( "Ok" ) ), QString( tr( "Details" ) ) ) ) | 271 | + errorMsg, QString( tr( "Ok" ) ), QString( tr( "Details" ) ) ) ) |
272 | { | 272 | { |
273 | 273 | ||
274 | case 1: | 274 | case 1: |
275 | qWarning("Details pressed !"); | 275 | owarn << "Details pressed !" << oendl; |
276 | ErrorDialog* pErrDialog = new ErrorDialog( this, NULL, true ); | 276 | ErrorDialog* pErrDialog = new ErrorDialog( this, NULL, true ); |
277 | QFile errorFile( tempFileName ); | 277 | QFile errorFile( tempFileName ); |
278 | if ( errorFile.open(IO_ReadOnly) ) | 278 | if ( errorFile.open(IO_ReadOnly) ) |
279 | { | 279 | { |
280 | QTextStream t( &errorFile ); | 280 | QTextStream t( &errorFile ); |
281 | QString s; | 281 | QString s; |
282 | while ( !t.eof() ) | 282 | while ( !t.eof() ) |
283 | { // until end of file... | 283 | { // until end of file... |
284 | s += t.readLine(); // line of text excluding '\n' | 284 | s += t.readLine(); // line of text excluding '\n' |
285 | } | 285 | } |
286 | errorFile.close(); | 286 | errorFile.close(); |
287 | 287 | ||
@@ -350,37 +350,37 @@ int BackupAndRestore::getBackupFiles(QString &backupFiles, QListViewItem *parent | |||
350 | } | 350 | } |
351 | return count; | 351 | return count; |
352 | } | 352 | } |
353 | 353 | ||
354 | void BackupAndRestore::sourceDirChanged(int selection) | 354 | void BackupAndRestore::sourceDirChanged(int selection) |
355 | { | 355 | { |
356 | restoreList->clear(); | 356 | restoreList->clear(); |
357 | rescanFolder(backupLocations[restoreSource->text(selection)]); | 357 | rescanFolder(backupLocations[restoreSource->text(selection)]); |
358 | } | 358 | } |
359 | 359 | ||
360 | void BackupAndRestore::fileListUpdate() | 360 | void BackupAndRestore::fileListUpdate() |
361 | { | 361 | { |
362 | qWarning("void BackupAndRestore::fileListUpdate()"); | 362 | owarn << "void BackupAndRestore::fileListUpdate()" << oendl; |
363 | restoreList->clear(); | 363 | restoreList->clear(); |
364 | rescanFolder( backupLocations[restoreSource->currentText()] ); | 364 | rescanFolder( backupLocations[restoreSource->currentText()] ); |
365 | } | 365 | } |
366 | 366 | ||
367 | /** | 367 | /** |
368 | * Scans directory for any backup files. Will recursivly go down, | 368 | * Scans directory for any backup files. Will recursivly go down, |
369 | * but will not follow symlinks. | 369 | * but will not follow symlinks. |
370 | * @param directory - the directory to look in. | 370 | * @param directory - the directory to look in. |
371 | */ | 371 | */ |
372 | void BackupAndRestore::rescanFolder(QString directory) | 372 | void BackupAndRestore::rescanFolder(QString directory) |
373 | { | 373 | { |
374 | //qDebug(QString("rescanFolder: ") + directory.latin1()); | 374 | //odebug << QString("rescanFolder: ") + directory.latin1() << oendl; |
375 | QDir d(directory); | 375 | QDir d(directory); |
376 | if(!d.exists()) | 376 | if(!d.exists()) |
377 | return; | 377 | return; |
378 | 378 | ||
379 | d.setFilter( QDir::Files | QDir::Hidden | QDir::Dirs); | 379 | d.setFilter( QDir::Files | QDir::Hidden | QDir::Dirs); |
380 | const QFileInfoList *list = d.entryInfoList(); | 380 | const QFileInfoList *list = d.entryInfoList(); |
381 | QFileInfoListIterator it( *list ); | 381 | QFileInfoListIterator it( *list ); |
382 | QFileInfo *file; | 382 | QFileInfo *file; |
383 | while ( (file=it.current()) ) | 383 | while ( (file=it.current()) ) |
384 | { // for each file... | 384 | { // for each file... |
385 | // If it is a dir and not .. or . then add it as a tab and go down. | 385 | // If it is a dir and not .. or . then add it as a tab and go down. |
386 | if(file->isDir()) | 386 | if(file->isDir()) |
@@ -410,60 +410,60 @@ void BackupAndRestore::restore() | |||
410 | if(!restoreItem) | 410 | if(!restoreItem) |
411 | { | 411 | { |
412 | QMessageBox::critical(this, tr( "Message" ), | 412 | QMessageBox::critical(this, tr( "Message" ), |
413 | tr( "Please select something to restore." ),QString( tr( "Ok") ) ); | 413 | tr( "Please select something to restore." ),QString( tr( "Ok") ) ); |
414 | return; | 414 | return; |
415 | } | 415 | } |
416 | setCaption(tr("Backup and Restore... working...")); | 416 | setCaption(tr("Backup and Restore... working...")); |
417 | 417 | ||
418 | QString restoreFile = backupLocations[restoreSource->currentText()]; | 418 | QString restoreFile = backupLocations[restoreSource->currentText()]; |
419 | 419 | ||
420 | restoreFile += "/" + restoreItem->text(0); | 420 | restoreFile += "/" + restoreItem->text(0); |
421 | 421 | ||
422 | qDebug( restoreFile ); | 422 | odebug << restoreFile << oendl; |
423 | 423 | ||
424 | //check if backup file come from opie 1.0.x | 424 | //check if backup file come from opie 1.0.x |
425 | 425 | ||
426 | QString commandLine = QString( "tar -tzf %1 | grep Applications/backup/exclude" ).arg( restoreFile.latin1() ); | 426 | QString commandLine = QString( "tar -tzf %1 | grep Applications/backup/exclude" ).arg( restoreFile.latin1() ); |
427 | 427 | ||
428 | int r = system( commandLine ); | 428 | int r = system( commandLine ); |
429 | 429 | ||
430 | QString startDir; | 430 | QString startDir; |
431 | 431 | ||
432 | if( r != 0 ) //Applications/backup/exclude not found - old backup file | 432 | if( r != 0 ) //Applications/backup/exclude not found - old backup file |
433 | { | 433 | { |
434 | startDir = QString( "/" ); | 434 | startDir = QString( "/" ); |
435 | } else | 435 | } else |
436 | { | 436 | { |
437 | startDir = QDir::homeDirPath(); | 437 | startDir = QDir::homeDirPath(); |
438 | } | 438 | } |
439 | 439 | ||
440 | //unpack backup file | 440 | //unpack backup file |
441 | commandLine = QString( "cd %1 && tar -zxf %2 2> %3" ).arg( startDir ) | 441 | commandLine = QString( "cd %1 && tar -zxf %2 2> %3" ).arg( startDir ) |
442 | .arg( restoreFile.latin1() ) | 442 | .arg( restoreFile.latin1() ) |
443 | .arg( tempFileName.latin1() ); | 443 | .arg( tempFileName.latin1() ); |
444 | 444 | ||
445 | qDebug( commandLine ); | 445 | odebug << commandLine << oendl; |
446 | 446 | ||
447 | r = system( commandLine ); | 447 | r = system( commandLine ); |
448 | 448 | ||
449 | //error handling | 449 | //error handling |
450 | if(r != 0) | 450 | if(r != 0) |
451 | { | 451 | { |
452 | QString errorMsg= tr( "Error from System:\n" ) + (QString)strerror( errno ); | 452 | QString errorMsg= tr( "Error from System:\n" ) + (QString)strerror( errno ); |
453 | switch( QMessageBox::critical(this, tr( "Message" ), tr( "Restore Failed." ) + "\n" | 453 | switch( QMessageBox::critical(this, tr( "Message" ), tr( "Restore Failed." ) + "\n" |
454 | + errorMsg, QString( tr( "Ok") ), QString( tr( "Details" ) ) ) ) | 454 | + errorMsg, QString( tr( "Ok") ), QString( tr( "Details" ) ) ) ) |
455 | { | 455 | { |
456 | case 1: | 456 | case 1: |
457 | qWarning("Details pressed !"); | 457 | owarn << "Details pressed !" << oendl; |
458 | ErrorDialog* pErrDialog = new ErrorDialog( this, NULL, true ); | 458 | ErrorDialog* pErrDialog = new ErrorDialog( this, NULL, true ); |
459 | QFile errorFile( tempFileName ); | 459 | QFile errorFile( tempFileName ); |
460 | if ( errorFile.open(IO_ReadOnly) ) | 460 | if ( errorFile.open(IO_ReadOnly) ) |
461 | { | 461 | { |
462 | QTextStream t( &errorFile ); | 462 | QTextStream t( &errorFile ); |
463 | QString s; | 463 | QString s; |
464 | while ( !t.eof() ) | 464 | while ( !t.eof() ) |
465 | { // until end of file... | 465 | { // until end of file... |
466 | s += t.readLine(); // line of text excluding '\n' | 466 | s += t.readLine(); // line of text excluding '\n' |
467 | } | 467 | } |
468 | errorFile.close(); | 468 | errorFile.close(); |
469 | 469 | ||
diff --git a/noncore/settings/netsystemtime/settingstabwidget.cpp b/noncore/settings/netsystemtime/settingstabwidget.cpp index ad80e05..1307082 100644 --- a/noncore/settings/netsystemtime/settingstabwidget.cpp +++ b/noncore/settings/netsystemtime/settingstabwidget.cpp | |||
@@ -130,25 +130,25 @@ void SettingsTabWidget::saveSettings() | |||
130 | if ( serversChanged ) | 130 | if ( serversChanged ) |
131 | { | 131 | { |
132 | QString ntpSrvsFile = QPEApplication::qpeDir(); | 132 | QString ntpSrvsFile = QPEApplication::qpeDir(); |
133 | ntpSrvsFile.append( "etc/ntpservers" ); | 133 | ntpSrvsFile.append( "etc/ntpservers" ); |
134 | Config ntpSrvs( ntpSrvsFile, Config::File ); | 134 | Config ntpSrvs( ntpSrvsFile, Config::File ); |
135 | ntpSrvs.setGroup( "servers" ); | 135 | ntpSrvs.setGroup( "servers" ); |
136 | ntpSrvs.writeEntry( "count", ++srvCount ); | 136 | ntpSrvs.writeEntry( "count", ++srvCount ); |
137 | ntpSrvs.setGroup( "0" ); | 137 | ntpSrvs.setGroup( "0" ); |
138 | ntpSrvs.writeEntry( "name", edit ); | 138 | ntpSrvs.writeEntry( "name", edit ); |
139 | curSrv = 0; | 139 | curSrv = 0; |
140 | for ( int i = 1; i < srvCount; i++ ) | 140 | for ( int i = 1; i < srvCount; i++ ) |
141 | { | 141 | { |
142 | // qDebug( "ntpSrvs[%i/%i]=%s", i, srvCount, cbTimeServer->text( i ).latin1() ); | 142 | // odebug << "ntpSrvs[" << i << "/" << srvCount << "]=" << cbTimeServer->text( i ).latin1() << "" << oendl; |
143 | ntpSrvs.setGroup( QString::number( i ) ); | 143 | ntpSrvs.setGroup( QString::number( i ) ); |
144 | ntpSrvs.writeEntry( "name", cbTimeServer->text( i-1 ) ); | 144 | ntpSrvs.writeEntry( "name", cbTimeServer->text( i-1 ) ); |
145 | } | 145 | } |
146 | } | 146 | } |
147 | Config config( "ntp", Config::User ); | 147 | Config config( "ntp", Config::User ); |
148 | config.setGroup( "settings" ); | 148 | config.setGroup( "settings" ); |
149 | config.writeEntry( "ntpServer", curSrv ); | 149 | config.writeEntry( "ntpServer", curSrv ); |
150 | config.writeEntry( "minLookupDiff", sbPredictDelay->value() ); | 150 | config.writeEntry( "minLookupDiff", sbPredictDelay->value() ); |
151 | config.writeEntry( "ntpRefreshFreq", sbNtpDelay->value() ); | 151 | config.writeEntry( "ntpRefreshFreq", sbNtpDelay->value() ); |
152 | config.writeEntry( "displayNtpTab", chNtpTab->isChecked() ); | 152 | config.writeEntry( "displayNtpTab", chNtpTab->isChecked() ); |
153 | config.writeEntry( "displayPredictTab", chPredictTab->isChecked() ); | 153 | config.writeEntry( "displayPredictTab", chPredictTab->isChecked() ); |
154 | } | 154 | } |
diff --git a/noncore/settings/networksettings/interfaces/interface.cpp b/noncore/settings/networksettings/interfaces/interface.cpp index b00b899..d2b106a 100644 --- a/noncore/settings/networksettings/interfaces/interface.cpp +++ b/noncore/settings/networksettings/interfaces/interface.cpp | |||
@@ -128,31 +128,31 @@ bool Interface::refresh(){ | |||
128 | broadcast = ""; | 128 | broadcast = ""; |
129 | dhcp = false; | 129 | dhcp = false; |
130 | dhcpServerIp = ""; | 130 | dhcpServerIp = ""; |
131 | leaseObtained = ""; | 131 | leaseObtained = ""; |
132 | leaseExpires = ""; | 132 | leaseExpires = ""; |
133 | emit(updateInterface(this)); | 133 | emit(updateInterface(this)); |
134 | return true; | 134 | return true; |
135 | } | 135 | } |
136 | 136 | ||
137 | QString fileName = QString("/tmp/%1_ifconfig_info").arg(this->name()); | 137 | QString fileName = QString("/tmp/%1_ifconfig_info").arg(this->name()); |
138 | int ret = system(QString("LANG=C %1 %2 > %3").arg(IFCONFIG).arg(this->name()).arg(fileName).latin1()); | 138 | int ret = system(QString("LANG=C %1 %2 > %3").arg(IFCONFIG).arg(this->name()).arg(fileName).latin1()); |
139 | if(ret != 0){ | 139 | if(ret != 0){ |
140 | qDebug(QString("Interface: Ifconfig return value: %1, is not 0").arg(ret).latin1()); | 140 | odebug << QString("Interface: Ifconfig return value: %1, is not 0").arg(ret).latin1() << oendl; |
141 | return false; | 141 | return false; |
142 | } | 142 | } |
143 | 143 | ||
144 | QFile file(fileName); | 144 | QFile file(fileName); |
145 | if (!file.open(IO_ReadOnly)){ | 145 | if (!file.open(IO_ReadOnly)){ |
146 | qDebug(QString("Interface: Can't open file: %1").arg(fileName).latin1()); | 146 | odebug << QString("Interface: Can't open file: %1").arg(fileName).latin1() << oendl; |
147 | return false; | 147 | return false; |
148 | } | 148 | } |
149 | 149 | ||
150 | // Set to the defaults | 150 | // Set to the defaults |
151 | macAddress = ""; | 151 | macAddress = ""; |
152 | ip = "0.0.0.0"; | 152 | ip = "0.0.0.0"; |
153 | subnetMask = "0.0.0.0"; | 153 | subnetMask = "0.0.0.0"; |
154 | broadcast = ""; | 154 | broadcast = ""; |
155 | 155 | ||
156 | QTextStream stream( &file ); | 156 | QTextStream stream( &file ); |
157 | QString line; | 157 | QString line; |
158 | while ( !stream.eof() ) { | 158 | while ( !stream.eof() ) { |
@@ -192,73 +192,73 @@ bool Interface::refresh(){ | |||
192 | dhcpDirectory = "/var/run"; | 192 | dhcpDirectory = "/var/run"; |
193 | 193 | ||
194 | // See if we have | 194 | // See if we have |
195 | QString dhcpFile(QString(dhcpDirectory+"/dhcpcd-%1.info").arg(this->name())); | 195 | QString dhcpFile(QString(dhcpDirectory+"/dhcpcd-%1.info").arg(this->name())); |
196 | // If there is no DHCP information then exit now with no errors. | 196 | // If there is no DHCP information then exit now with no errors. |
197 | if(!QFile::exists(dhcpFile)){ | 197 | if(!QFile::exists(dhcpFile)){ |
198 | emit(updateInterface(this)); | 198 | emit(updateInterface(this)); |
199 | return true; | 199 | return true; |
200 | } | 200 | } |
201 | 201 | ||
202 | file.setName(dhcpFile); | 202 | file.setName(dhcpFile); |
203 | if (!file.open(IO_ReadOnly)){ | 203 | if (!file.open(IO_ReadOnly)){ |
204 | qDebug(QString("Interface: Can't open file: %1").arg(dhcpFile).latin1()); | 204 | odebug << QString("Interface: Can't open file: %1").arg(dhcpFile).latin1() << oendl; |
205 | return false; | 205 | return false; |
206 | } | 206 | } |
207 | 207 | ||
208 | // leaseTime and renewalTime and used if pid and deamon exe can be accessed. | 208 | // leaseTime and renewalTime and used if pid and deamon exe can be accessed. |
209 | int leaseTime = 0; | 209 | int leaseTime = 0; |
210 | int renewalTime = 0; | 210 | int renewalTime = 0; |
211 | 211 | ||
212 | stream.setDevice( &file ); | 212 | stream.setDevice( &file ); |
213 | while ( !stream.eof() ) { | 213 | while ( !stream.eof() ) { |
214 | line = stream.readLine(); | 214 | line = stream.readLine(); |
215 | if(line.contains("DHCPSIADDR=")) | 215 | if(line.contains("DHCPSIADDR=")) |
216 | dhcpServerIp = line.mid(11, line.length()); | 216 | dhcpServerIp = line.mid(11, line.length()); |
217 | if(line.contains("LEASETIME=")) | 217 | if(line.contains("LEASETIME=")) |
218 | leaseTime = line.mid(10, line.length()).toInt(); | 218 | leaseTime = line.mid(10, line.length()).toInt(); |
219 | if(line.contains("RENEWALTIME=")) | 219 | if(line.contains("RENEWALTIME=")) |
220 | renewalTime = line.mid(12, line.length()).toInt(); | 220 | renewalTime = line.mid(12, line.length()).toInt(); |
221 | } | 221 | } |
222 | file.close(); | 222 | file.close(); |
223 | //qDebug(QString("Interface: leaseTime: %1").arg(leaseTime).latin1()); | 223 | //odebug << QString("Interface: leaseTime: %1").arg(leaseTime).latin1() << oendl; |
224 | //qDebug(QString("Interface: renewalTime: %1").arg(renewalTime).latin1()); | 224 | //odebug << QString("Interface: renewalTime: %1").arg(renewalTime).latin1() << oendl; |
225 | 225 | ||
226 | // Get the pid of the deamond | 226 | // Get the pid of the deamond |
227 | dhcpFile = (QString(dhcpDirectory+"/dhcpcd-%1.pid").arg(this->name())); | 227 | dhcpFile = (QString(dhcpDirectory+"/dhcpcd-%1.pid").arg(this->name())); |
228 | file.setName(dhcpFile); | 228 | file.setName(dhcpFile); |
229 | if (!file.open(IO_ReadOnly)){ | 229 | if (!file.open(IO_ReadOnly)){ |
230 | qDebug(QString("Interface: Can't open file: %1").arg(dhcpFile).latin1()); | 230 | odebug << QString("Interface: Can't open file: %1").arg(dhcpFile).latin1() << oendl; |
231 | return false; | 231 | return false; |
232 | } | 232 | } |
233 | 233 | ||
234 | int pid = -1; | 234 | int pid = -1; |
235 | stream.setDevice( &file ); | 235 | stream.setDevice( &file ); |
236 | while ( !stream.eof() ) { | 236 | while ( !stream.eof() ) { |
237 | line = stream.readLine(); | 237 | line = stream.readLine(); |
238 | pid = line.toInt(); | 238 | pid = line.toInt(); |
239 | } | 239 | } |
240 | file.close(); | 240 | file.close(); |
241 | 241 | ||
242 | if( pid == -1){ | 242 | if( pid == -1){ |
243 | qDebug("Interface: Could not get pid of dhcpc deamon."); | 243 | odebug << "Interface: Could not get pid of dhcpc deamon." << oendl; |
244 | return false; | 244 | return false; |
245 | } | 245 | } |
246 | 246 | ||
247 | // Get the start running time of the deamon | 247 | // Get the start running time of the deamon |
248 | fileName = (QString("/proc/%1/stat").arg(pid)); | 248 | fileName = (QString("/proc/%1/stat").arg(pid)); |
249 | file.setName(fileName); | 249 | file.setName(fileName); |
250 | stream.setDevice( &file ); | 250 | stream.setDevice( &file ); |
251 | if (!file.open(IO_ReadOnly)){ | 251 | if (!file.open(IO_ReadOnly)){ |
252 | qDebug(QString("Interface: Can't open file: %1").arg(fileName).latin1()); | 252 | odebug << QString("Interface: Can't open file: %1").arg(fileName).latin1() << oendl; |
253 | return false; | 253 | return false; |
254 | } | 254 | } |
255 | while ( !stream.eof() ) { | 255 | while ( !stream.eof() ) { |
256 | line = stream.readLine(); | 256 | line = stream.readLine(); |
257 | } | 257 | } |
258 | file.close(); | 258 | file.close(); |
259 | long time = 0; | 259 | long time = 0; |
260 | // Grab the start time | 260 | // Grab the start time |
261 | // pid com state ppid pgrp session tty_nr tpgid flags | 261 | // pid com state ppid pgrp session tty_nr tpgid flags |
262 | sscanf(line.latin1(), "%*d %*s %*c %*d %*d %*d %*d %*d %*u " | 262 | sscanf(line.latin1(), "%*d %*s %*c %*d %*d %*d %*d %*d %*u " |
263 | // minflt cminflt majflt cmajflt utime stime cutime cstime priority | 263 | // minflt cminflt majflt cmajflt utime stime cutime cstime priority |
264 | "%*u %*u %*u %*u %*u %*u %*d %*d %*d " | 264 | "%*u %*u %*u %*u %*u %*u %*d %*d %*d " |
@@ -269,30 +269,30 @@ bool Interface::refresh(){ | |||
269 | QDateTime datetime(QDateTime::currentDateTime()); | 269 | QDateTime datetime(QDateTime::currentDateTime()); |
270 | 270 | ||
271 | // Get the uptime of the computer. | 271 | // Get the uptime of the computer. |
272 | QFile f("/proc/uptime"); | 272 | QFile f("/proc/uptime"); |
273 | if ( f.open(IO_ReadOnly) ) { // file opened successfully | 273 | if ( f.open(IO_ReadOnly) ) { // file opened successfully |
274 | QTextStream t( &f ); // use a text stream | 274 | QTextStream t( &f ); // use a text stream |
275 | int sec = 0; | 275 | int sec = 0; |
276 | t >> sec; | 276 | t >> sec; |
277 | datetime = datetime.addSecs((-1*sec)); | 277 | datetime = datetime.addSecs((-1*sec)); |
278 | f.close(); | 278 | f.close(); |
279 | } | 279 | } |
280 | else{ | 280 | else{ |
281 | qDebug("Interface: Can't open /proc/uptime to retrive uptime."); | 281 | odebug << "Interface: Can't open /proc/uptime to retrive uptime." << oendl; |
282 | return false; | 282 | return false; |
283 | } | 283 | } |
284 | 284 | ||
285 | datetime = datetime.addSecs(time); | 285 | datetime = datetime.addSecs(time); |
286 | //qDebug(QString("Interface: %1 %2").arg(datetime.toString()).arg(pid).latin1()); | 286 | //odebug << QString("Interface: %1 %2").arg(datetime.toString()).arg(pid).latin1() << oendl; |
287 | 287 | ||
288 | // Calculate the start and renew times | 288 | // Calculate the start and renew times |
289 | leaseObtained= datetime.toString(); | 289 | leaseObtained= datetime.toString(); |
290 | 290 | ||
291 | // Calculate the start and renew times | 291 | // Calculate the start and renew times |
292 | datetime = datetime.addSecs(leaseTime); | 292 | datetime = datetime.addSecs(leaseTime); |
293 | leaseExpires = datetime.toString(); | 293 | leaseExpires = datetime.toString(); |
294 | 294 | ||
295 | dhcp = true; | 295 | dhcp = true; |
296 | 296 | ||
297 | emit(updateInterface(this)); | 297 | emit(updateInterface(this)); |
298 | return true; | 298 | return true; |
diff --git a/noncore/settings/networksettings/interfaces/interfaces.cpp b/noncore/settings/networksettings/interfaces/interfaces.cpp index 6b161ae..e283926 100644 --- a/noncore/settings/networksettings/interfaces/interfaces.cpp +++ b/noncore/settings/networksettings/interfaces/interfaces.cpp | |||
@@ -15,25 +15,25 @@ | |||
15 | * the \n for interfaces variable. | 15 | * the \n for interfaces variable. |
16 | * @param useInterfacesFile if an interface file other then the default is | 16 | * @param useInterfacesFile if an interface file other then the default is |
17 | * desired to be used it should be passed in. | 17 | * desired to be used it should be passed in. |
18 | */ | 18 | */ |
19 | Interfaces::Interfaces(QString useInterfacesFile){ | 19 | Interfaces::Interfaces(QString useInterfacesFile){ |
20 | acceptedFamily.append(INTERFACES_FAMILY_INET); | 20 | acceptedFamily.append(INTERFACES_FAMILY_INET); |
21 | acceptedFamily.append(INTERFACES_FAMILY_IPX); | 21 | acceptedFamily.append(INTERFACES_FAMILY_IPX); |
22 | acceptedFamily.append(INTERFACES_FAMILY_INET6); | 22 | acceptedFamily.append(INTERFACES_FAMILY_INET6); |
23 | 23 | ||
24 | interfacesFile = useInterfacesFile; | 24 | interfacesFile = useInterfacesFile; |
25 | QFile file(interfacesFile); | 25 | QFile file(interfacesFile); |
26 | if (!file.open(IO_ReadOnly)){ | 26 | if (!file.open(IO_ReadOnly)){ |
27 | qDebug("Interfaces: Can't open file: %s for reading.", interfacesFile.latin1() ); | 27 | odebug << "Interfaces: Can't open file: " << interfacesFile.latin1() << " for reading." << oendl; |
28 | currentIface = interfaces.end(); | 28 | currentIface = interfaces.end(); |
29 | currentMapping = interfaces.end(); | 29 | currentMapping = interfaces.end(); |
30 | return; | 30 | return; |
31 | } | 31 | } |
32 | QTextStream stream( &file ); | 32 | QTextStream stream( &file ); |
33 | QString line; | 33 | QString line; |
34 | while ( !stream.eof() ) { | 34 | while ( !stream.eof() ) { |
35 | line += stream.readLine(); | 35 | line += stream.readLine(); |
36 | line += "\n"; | 36 | line += "\n"; |
37 | } | 37 | } |
38 | file.close(); | 38 | file.close(); |
39 | interfaces = QStringList::split("\n", line, true); | 39 | interfaces = QStringList::split("\n", line, true); |
@@ -67,25 +67,25 @@ QStringList Interfaces::getInterfaceList(){ | |||
67 | } | 67 | } |
68 | 68 | ||
69 | /** | 69 | /** |
70 | * Find out if interface is in an "auto" group or not. | 70 | * Find out if interface is in an "auto" group or not. |
71 | * Report any duplicates such as eth0 being in two differnt auto's | 71 | * Report any duplicates such as eth0 being in two differnt auto's |
72 | * @param interface interface to check to see if it is on or not. | 72 | * @param interface interface to check to see if it is on or not. |
73 | * @return true is interface is in auto | 73 | * @return true is interface is in auto |
74 | */ | 74 | */ |
75 | bool Interfaces::isAuto(const QString &interface) const { | 75 | bool Interfaces::isAuto(const QString &interface) const { |
76 | QStringList autoLines = interfaces.grep(QRegExp(AUTO)); | 76 | QStringList autoLines = interfaces.grep(QRegExp(AUTO)); |
77 | QStringList awi = autoLines.grep(QRegExp(interface)); | 77 | QStringList awi = autoLines.grep(QRegExp(interface)); |
78 | if(awi.count() > 1) | 78 | if(awi.count() > 1) |
79 | qDebug(QString("Interfaces: Found more then auto group with interface: %1.").arg(interface).latin1()); | 79 | odebug << QString("Interfaces: Found more then auto group with interface: %1.").arg(interface).latin1() << oendl; |
80 | return awi.count() > 0; | 80 | return awi.count() > 0; |
81 | } | 81 | } |
82 | 82 | ||
83 | /** | 83 | /** |
84 | * Attempt to set the auto option for interface to setAuto. | 84 | * Attempt to set the auto option for interface to setAuto. |
85 | * @param interface the interface to set | 85 | * @param interface the interface to set |
86 | * @param setAuto the value to set interface to. | 86 | * @param setAuto the value to set interface to. |
87 | * @return false if already set to setAuto. | 87 | * @return false if already set to setAuto. |
88 | * */ | 88 | * */ |
89 | bool Interfaces::setAuto(const QString &interface, bool setAuto){ | 89 | bool Interfaces::setAuto(const QString &interface, bool setAuto){ |
90 | // Don't need to set it if it is already set. | 90 | // Don't need to set it if it is already set. |
91 | if(isAuto(interface) == setAuto) | 91 | if(isAuto(interface) == setAuto) |
@@ -143,41 +143,41 @@ bool Interfaces::isInterfaceSet() const { | |||
143 | } | 143 | } |
144 | 144 | ||
145 | /** | 145 | /** |
146 | * Add a new interface of with the settings - family and method | 146 | * Add a new interface of with the settings - family and method |
147 | * @param interface the name of the interface to set. All whitespace is | 147 | * @param interface the name of the interface to set. All whitespace is |
148 | * removed from the interface name. | 148 | * removed from the interface name. |
149 | * @param family the family of this interface inet or inet, ipx or inet6 | 149 | * @param family the family of this interface inet or inet, ipx or inet6 |
150 | * Must of one of the families defined in interfaces.h | 150 | * Must of one of the families defined in interfaces.h |
151 | * @param method for the family. see interfaces man page for family methods. | 151 | * @param method for the family. see interfaces man page for family methods. |
152 | * @return true if successful. | 152 | * @return true if successful. |
153 | */ | 153 | */ |
154 | bool Interfaces::addInterface(const QString &interface, const QString &family, const QString &method){ | 154 | bool Interfaces::addInterface(const QString &interface, const QString &family, const QString &method){ |
155 | qDebug("Interfaces::addInterface(%s)",interface.latin1()); | 155 | odebug << "Interfaces::addInterface(" << interface.latin1() << ")" << oendl; |
156 | if(0 == acceptedFamily.contains(family)) | 156 | if(0 == acceptedFamily.contains(family)) |
157 | return false; | 157 | return false; |
158 | QString newInterface = interface.simplifyWhiteSpace(); | 158 | QString newInterface = interface.simplifyWhiteSpace(); |
159 | newInterface = newInterface.replace(QRegExp(" "), ""); | 159 | newInterface = newInterface.replace(QRegExp(" "), ""); |
160 | interfaces.append(""); | 160 | interfaces.append(""); |
161 | interfaces.append(QString(IFACE " %1 %2 %3").arg(newInterface).arg(family).arg(method)); | 161 | interfaces.append(QString(IFACE " %1 %2 %3").arg(newInterface).arg(family).arg(method)); |
162 | return true; | 162 | return true; |
163 | } | 163 | } |
164 | 164 | ||
165 | /** | 165 | /** |
166 | * Copies interface with name interface to name newInterface | 166 | * Copies interface with name interface to name newInterface |
167 | * @param newInterface name of the new interface. | 167 | * @param newInterface name of the new interface. |
168 | * @return bool true if successful | 168 | * @return bool true if successful |
169 | */ | 169 | */ |
170 | bool Interfaces::copyInterface(const QString &interface, const QString &newInterface){ | 170 | bool Interfaces::copyInterface(const QString &interface, const QString &newInterface){ |
171 | qDebug("copy interface %s to %s", interface.latin1(), newInterface.latin1()); | 171 | odebug << "copy interface " << interface.latin1() << " to " << newInterface.latin1() << "" << oendl; |
172 | if(!setInterface(interface)) | 172 | if(!setInterface(interface)) |
173 | return false; | 173 | return false; |
174 | 174 | ||
175 | // Store the old interface and bump past the stanza line. | 175 | // Store the old interface and bump past the stanza line. |
176 | QStringList::Iterator it = currentIface; | 176 | QStringList::Iterator it = currentIface; |
177 | it++; | 177 | it++; |
178 | 178 | ||
179 | // Add the new interface | 179 | // Add the new interface |
180 | bool error; | 180 | bool error; |
181 | addInterface(newInterface, getInterfaceFamily(error), getInterfaceMethod(error)); | 181 | addInterface(newInterface, getInterfaceFamily(error), getInterfaceMethod(error)); |
182 | if(!setInterface(newInterface)) | 182 | if(!setInterface(newInterface)) |
183 | return false; | 183 | return false; |
@@ -266,32 +266,32 @@ QString Interfaces::getInterfaceMethod(bool &error){ | |||
266 | line = line.mid(family.length()+1, line.length()); | 266 | line = line.mid(family.length()+1, line.length()); |
267 | line = line.simplifyWhiteSpace(); | 267 | line = line.simplifyWhiteSpace(); |
268 | error = false; | 268 | error = false; |
269 | return line; | 269 | return line; |
270 | } | 270 | } |
271 | 271 | ||
272 | /** | 272 | /** |
273 | * Sets the interface name to newName. | 273 | * Sets the interface name to newName. |
274 | * @param newName the new name of the interface. All whitespace is removed. | 274 | * @param newName the new name of the interface. All whitespace is removed. |
275 | * @return bool true if successful. | 275 | * @return bool true if successful. |
276 | */ | 276 | */ |
277 | bool Interfaces::setInterfaceName(const QString &newName){ | 277 | bool Interfaces::setInterfaceName(const QString &newName){ |
278 | qDebug("setInterfaceName %s", newName.latin1()); | 278 | odebug << "setInterfaceName " << newName.latin1() << "" << oendl; |
279 | if(currentIface == interfaces.end()) | 279 | if(currentIface == interfaces.end()) |
280 | return false; | 280 | return false; |
281 | QString name = newName.simplifyWhiteSpace(); | 281 | QString name = newName.simplifyWhiteSpace(); |
282 | name = name.replace(QRegExp(" "), ""); | 282 | name = name.replace(QRegExp(" "), ""); |
283 | bool returnValue = false; | 283 | bool returnValue = false; |
284 | QString tmp = QString("iface %1 %2 %3").arg(name).arg(getInterfaceFamily(returnValue)).arg(getInterfaceMethod(returnValue)); | 284 | QString tmp = QString("iface %1 %2 %3").arg(name).arg(getInterfaceFamily(returnValue)).arg(getInterfaceMethod(returnValue)); |
285 | qDebug("setting %s",tmp.latin1()); | 285 | odebug << "setting " << tmp.latin1() << "" << oendl; |
286 | 286 | ||
287 | (*currentIface) = tmp; | 287 | (*currentIface) = tmp; |
288 | return !returnValue; | 288 | return !returnValue; |
289 | } | 289 | } |
290 | 290 | ||
291 | /** | 291 | /** |
292 | * Sets the interface family to newName. | 292 | * Sets the interface family to newName. |
293 | * @param newName the new name of the interface. Must be one of the families | 293 | * @param newName the new name of the interface. Must be one of the families |
294 | * defined in the interfaces.h file. | 294 | * defined in the interfaces.h file. |
295 | * @return bool true if successful. | 295 | * @return bool true if successful. |
296 | */ | 296 | */ |
297 | bool Interfaces::setInterfaceFamily(const QString &newName){ | 297 | bool Interfaces::setInterfaceFamily(const QString &newName){ |
@@ -336,25 +336,25 @@ QString Interfaces::getInterfaceOption(const QString &option, bool &error){ | |||
336 | * doesn't exist then it is added along with the value. | 336 | * doesn't exist then it is added along with the value. |
337 | * If value isEmpty() then we will remove the option | 337 | * If value isEmpty() then we will remove the option |
338 | * | 338 | * |
339 | * @param option the options to set the value. | 339 | * @param option the options to set the value. |
340 | * @param value the value that option should be set to. | 340 | * @param value the value that option should be set to. |
341 | * @param error set to true if any error occurs, false otherwise. | 341 | * @param error set to true if any error occurs, false otherwise. |
342 | * @return QString the options value. QString::null if error == true | 342 | * @return QString the options value. QString::null if error == true |
343 | */ | 343 | */ |
344 | bool Interfaces::setInterfaceOption(const QString &option, const QString &value){ | 344 | bool Interfaces::setInterfaceOption(const QString &option, const QString &value){ |
345 | if( value.stripWhiteSpace().isEmpty() ) | 345 | if( value.stripWhiteSpace().isEmpty() ) |
346 | return removeInterfaceOption( option ); | 346 | return removeInterfaceOption( option ); |
347 | 347 | ||
348 | qDebug("iface >%s< option >%s< value >%s<", (*currentIface).latin1(), option.latin1(),value.latin1()); | 348 | odebug << "iface >" << (*currentIface).latin1() << "< option >" << option.latin1() << "< value >" << value.latin1() << "<" << oendl; |
349 | return setOption(currentIface, option, value); | 349 | return setOption(currentIface, option, value); |
350 | } | 350 | } |
351 | 351 | ||
352 | /** | 352 | /** |
353 | * Removes a value for an option in the currently selected interface. | 353 | * Removes a value for an option in the currently selected interface. |
354 | * @param option the options to set the value. | 354 | * @param option the options to set the value. |
355 | * @param error set to true if any error occurs, false otherwise. | 355 | * @param error set to true if any error occurs, false otherwise. |
356 | * @return QString the options value. QString::null if error == true | 356 | * @return QString the options value. QString::null if error == true |
357 | */ | 357 | */ |
358 | bool Interfaces::removeInterfaceOption(const QString &option){ | 358 | bool Interfaces::removeInterfaceOption(const QString &option){ |
359 | return removeOption(currentIface, option); | 359 | return removeOption(currentIface, option); |
360 | } | 360 | } |
@@ -477,84 +477,84 @@ bool Interfaces::setStanza(const QString &stanza, const QString &option, QString | |||
477 | // There are more chars in the line. check +1 | 477 | // There are more chars in the line. check +1 |
478 | if(line.at(point-1) != ' ') | 478 | if(line.at(point-1) != ' ') |
479 | valid = false; | 479 | valid = false; |
480 | } | 480 | } |
481 | point += option.length(); | 481 | point += option.length(); |
482 | if(point < line.length()-1){ | 482 | if(point < line.length()-1){ |
483 | // There are more chars in the line. check -1 | 483 | // There are more chars in the line. check -1 |
484 | if(line.at(point) != ' ') | 484 | if(line.at(point) != ' ') |
485 | valid = false; | 485 | valid = false; |
486 | } | 486 | } |
487 | if(valid){ | 487 | if(valid){ |
488 | if(found == true){ | 488 | if(found == true){ |
489 | qDebug(QString("Interfaces: Found multiple stanza's for search: %1 %2").arg(stanza).arg(option).latin1()); | 489 | odebug << QString("Interfaces: Found multiple stanza's for search: %1 %2").arg(stanza).arg(option).latin1() << oendl; |
490 | } | 490 | } |
491 | found = true; | 491 | found = true; |
492 | iterator = it; | 492 | iterator = it; |
493 | } | 493 | } |
494 | } | 494 | } |
495 | } | 495 | } |
496 | return found; | 496 | return found; |
497 | } | 497 | } |
498 | 498 | ||
499 | /** | 499 | /** |
500 | * Sets a value of an option in a stanza | 500 | * Sets a value of an option in a stanza |
501 | * @param start the start of the stanza | 501 | * @param start the start of the stanza |
502 | * @param option the option to use when setting value. | 502 | * @param option the option to use when setting value. |
503 | * @return bool true if successful, false otherwise. | 503 | * @return bool true if successful, false otherwise. |
504 | */ | 504 | */ |
505 | bool Interfaces::setOption(const QStringList::Iterator &start, const QString &option, const QString &value){ | 505 | bool Interfaces::setOption(const QStringList::Iterator &start, const QString &option, const QString &value){ |
506 | if(start == interfaces.end()) | 506 | if(start == interfaces.end()) |
507 | return false; | 507 | return false; |
508 | qDebug("setting option"); | 508 | odebug << "setting option" << oendl; |
509 | bool found = false; | 509 | bool found = false; |
510 | bool replaced = false; | 510 | bool replaced = false; |
511 | QStringList::Iterator insertAt = NULL; | 511 | QStringList::Iterator insertAt = NULL; |
512 | for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) { | 512 | for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) { |
513 | qDebug(" Interfaces::setOption got line >%s<",(*it).latin1()); | 513 | odebug << " Interfaces::setOption got line >" << (*it).latin1() << "<" << oendl; |
514 | // FIXME: was not completly stupid just wrong sice all options got inserted bevore the iface line | 514 | // FIXME: was not completly stupid just wrong sice all options got inserted bevore the iface line |
515 | // but since it works with an empty interfaces file I (tille) will not do anything more | 515 | // but since it works with an empty interfaces file I (tille) will not do anything more |
516 | if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) ){ | 516 | if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) ){ |
517 | if (found) break; | 517 | if (found) break; |
518 | // && it != start){ | 518 | // && it != start){ |
519 | // if(!found && value != ""){ | 519 | // if(!found && value != ""){ |
520 | // // Got to the end of the stanza without finding it, so append it. | 520 | // // Got to the end of the stanza without finding it, so append it. |
521 | // qDebug(" Got to the end of the stanza without finding it, so append it."); | 521 | // odebug << " Got to the end of the stanza without finding it, so append it." << oendl; |
522 | // interfaces.insert(--it, QString("\t%1 %2").arg(option).arg(value)); | 522 | // interfaces.insert(--it, QString("\t%1 %2").arg(option).arg(value)); |
523 | // } | 523 | // } |
524 | qDebug("found 1"); | 524 | odebug << "found 1" << oendl; |
525 | // interfaces.insert(++it, QString("\t%1 %2").arg(option).arg(value)); | 525 | // interfaces.insert(++it, QString("\t%1 %2").arg(option).arg(value)); |
526 | found = true; | 526 | found = true; |
527 | insertAt = it; | 527 | insertAt = it; |
528 | 528 | ||
529 | } | 529 | } |
530 | if((*it).contains(option) && it != start && (*it).at(0) != '#'){ | 530 | if((*it).contains(option) && it != start && (*it).at(0) != '#'){ |
531 | // Found it in stanza so replace it. | 531 | // Found it in stanza so replace it. |
532 | qDebug("found 2"); | 532 | odebug << "found 2" << oendl; |
533 | if(found) | 533 | if(found) |
534 | qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1()); | 534 | odebug << QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1() << oendl; |
535 | found = true; | 535 | found = true; |
536 | replaced = true; | 536 | replaced = true; |
537 | (*it) = QString("\t%1 %2").arg(option).arg(value); | 537 | (*it) = QString("\t%1 %2").arg(option).arg(value); |
538 | } | 538 | } |
539 | } | 539 | } |
540 | if(!found){ | 540 | if(!found){ |
541 | qDebug("! found insert anyway"); | 541 | odebug << "! found insert anyway" << oendl; |
542 | QStringList::Iterator p = start; | 542 | QStringList::Iterator p = start; |
543 | interfaces.insert(++p, QString("\t%1 %2").arg(option).arg(value)); | 543 | interfaces.insert(++p, QString("\t%1 %2").arg(option).arg(value)); |
544 | found = true; | 544 | found = true; |
545 | } | 545 | } |
546 | 546 | ||
547 | if(found && !replaced){ | 547 | if(found && !replaced){ |
548 | qDebug("found iface but not the option so insert it here..."); | 548 | odebug << "found iface but not the option so insert it here..." << oendl; |
549 | interfaces.insert(++insertAt, QString("\t%1 %2").arg(option).arg(value)); | 549 | interfaces.insert(++insertAt, QString("\t%1 %2").arg(option).arg(value)); |
550 | } | 550 | } |
551 | return found; | 551 | return found; |
552 | } | 552 | } |
553 | 553 | ||
554 | /** | 554 | /** |
555 | * Removes a stanza and all of its options | 555 | * Removes a stanza and all of its options |
556 | * @param stanza the stanza to remove | 556 | * @param stanza the stanza to remove |
557 | * @return bool true if successful. | 557 | * @return bool true if successful. |
558 | */ | 558 | */ |
559 | bool Interfaces::removeStanza(QStringList::Iterator &stanza){ | 559 | bool Interfaces::removeStanza(QStringList::Iterator &stanza){ |
560 | if(stanza == interfaces.end()) | 560 | if(stanza == interfaces.end()) |
@@ -573,25 +573,25 @@ bool Interfaces::removeOption(const QStringList::Iterator &start, const QString | |||
573 | if(start == interfaces.end()) | 573 | if(start == interfaces.end()) |
574 | return false; | 574 | return false; |
575 | 575 | ||
576 | bool found = false; | 576 | bool found = false; |
577 | for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) { | 577 | for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) { |
578 | if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){ | 578 | if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){ |
579 | // got to the end without finding it | 579 | // got to the end without finding it |
580 | break; | 580 | break; |
581 | } | 581 | } |
582 | if((*it).contains(option) && it != start && (*it).at(0) != '#'){ | 582 | if((*it).contains(option) && it != start && (*it).at(0) != '#'){ |
583 | // Found it in stanza so replace it. | 583 | // Found it in stanza so replace it. |
584 | if(found) | 584 | if(found) |
585 | qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1()); | 585 | odebug << QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1() << oendl; |
586 | found = true; | 586 | found = true; |
587 | it = interfaces.remove( it ); // we really want to remove the line | 587 | it = interfaces.remove( it ); // we really want to remove the line |
588 | --it; // we do ++it later in the head of the for loop | 588 | --it; // we do ++it later in the head of the for loop |
589 | } | 589 | } |
590 | } | 590 | } |
591 | return found; | 591 | return found; |
592 | } | 592 | } |
593 | 593 | ||
594 | /** | 594 | /** |
595 | * Removes a option in a stanza | 595 | * Removes a option in a stanza |
596 | * @param start the start of the stanza | 596 | * @param start the start of the stanza |
597 | * @param option the option to use when setting value. | 597 | * @param option the option to use when setting value. |
@@ -601,25 +601,25 @@ bool Interfaces::removeOption(const QStringList::Iterator &start, const QString | |||
601 | if(start == interfaces.end()) | 601 | if(start == interfaces.end()) |
602 | return false; | 602 | return false; |
603 | 603 | ||
604 | bool found = false; | 604 | bool found = false; |
605 | for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) { | 605 | for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) { |
606 | if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){ | 606 | if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){ |
607 | // got to the end without finding it | 607 | // got to the end without finding it |
608 | break; | 608 | break; |
609 | } | 609 | } |
610 | if((*it).contains(option) && (*it).contains(value) && it != start && (*it).at(0) != '#'){ | 610 | if((*it).contains(option) && (*it).contains(value) && it != start && (*it).at(0) != '#'){ |
611 | // Found it in stanza so replace it. | 611 | // Found it in stanza so replace it. |
612 | if(found) | 612 | if(found) |
613 | qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1()); | 613 | odebug << QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1() << oendl; |
614 | found = true; | 614 | found = true; |
615 | it = interfaces.remove( it ); // we really want to remove the line | 615 | it = interfaces.remove( it ); // we really want to remove the line |
616 | --it; // we do ++it later in the head of the for loop | 616 | --it; // we do ++it later in the head of the for loop |
617 | } | 617 | } |
618 | } | 618 | } |
619 | return found; | 619 | return found; |
620 | } | 620 | } |
621 | 621 | ||
622 | /** | 622 | /** |
623 | * Removes all options in a stanza | 623 | * Removes all options in a stanza |
624 | * @param start the start of the stanza | 624 | * @param start the start of the stanza |
625 | * @return bool true if successful, false otherwise. | 625 | * @return bool true if successful, false otherwise. |
@@ -654,59 +654,59 @@ QString Interfaces::getOption(const QStringList::Iterator &start, const QString | |||
654 | error = false; | 654 | error = false; |
655 | return QString(); | 655 | return QString(); |
656 | } | 656 | } |
657 | 657 | ||
658 | QString value; | 658 | QString value; |
659 | bool found = false; | 659 | bool found = false; |
660 | for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) { | 660 | for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) { |
661 | if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){ | 661 | if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){ |
662 | break; | 662 | break; |
663 | } | 663 | } |
664 | if((*it).contains(option) && (*it).at(0) != '#'){ | 664 | if((*it).contains(option) && (*it).at(0) != '#'){ |
665 | if(found) | 665 | if(found) |
666 | qDebug(QString("Interfaces: getOption found more then one value: %1 for option: %2 in stanza %3").arg((*it)).arg(option).arg((*start)).latin1()); | 666 | odebug << QString("Interfaces: getOption found more then one value: %1 for option: %2 in stanza %3").arg((*it)).arg(option).arg((*start)).latin1() << oendl; |
667 | found = true; | 667 | found = true; |
668 | QString line = (*it).simplifyWhiteSpace(); | 668 | QString line = (*it).simplifyWhiteSpace(); |
669 | int space = line.find(" ", option.length()); | 669 | int space = line.find(" ", option.length()); |
670 | if(space != -1){ | 670 | if(space != -1){ |
671 | value = line.mid(space+1, line.length()); | 671 | value = line.mid(space+1, line.length()); |
672 | break; | 672 | break; |
673 | } | 673 | } |
674 | } | 674 | } |
675 | } | 675 | } |
676 | error = !found; | 676 | error = !found; |
677 | return value; | 677 | return value; |
678 | } | 678 | } |
679 | 679 | ||
680 | /** | 680 | /** |
681 | * Write out the interfaces file to the file passed into the constructor. | 681 | * Write out the interfaces file to the file passed into the constructor. |
682 | * Removes any excess blank lines over 1 line long. | 682 | * Removes any excess blank lines over 1 line long. |
683 | * @return bool true if successful, false if not. | 683 | * @return bool true if successful, false if not. |
684 | */ | 684 | */ |
685 | bool Interfaces::write(){ | 685 | bool Interfaces::write(){ |
686 | QFile::remove(interfacesFile); | 686 | QFile::remove(interfacesFile); |
687 | QFile file(interfacesFile); | 687 | QFile file(interfacesFile); |
688 | 688 | ||
689 | if (!file.open(IO_ReadWrite)){ | 689 | if (!file.open(IO_ReadWrite)){ |
690 | qDebug(QString("Interfaces: Can't open file: %1 for writing.").arg(interfacesFile).latin1()); | 690 | odebug << QString("Interfaces: Can't open file: %1 for writing.").arg(interfacesFile).latin1() << oendl; |
691 | return false; | 691 | return false; |
692 | } | 692 | } |
693 | QTextStream stream( &file ); | 693 | QTextStream stream( &file ); |
694 | int whiteSpaceCount = 0; | 694 | int whiteSpaceCount = 0; |
695 | for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) { | 695 | for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) { |
696 | QString line = (*it).simplifyWhiteSpace(); | 696 | QString line = (*it).simplifyWhiteSpace(); |
697 | line = line.replace(QRegExp(" "),""); | 697 | line = line.replace(QRegExp(" "),""); |
698 | if(line.length() == 0) | 698 | if(line.length() == 0) |
699 | whiteSpaceCount++; | 699 | whiteSpaceCount++; |
700 | else | 700 | else |
701 | whiteSpaceCount = 0; | 701 | whiteSpaceCount = 0; |
702 | if(whiteSpaceCount < 2){ | 702 | if(whiteSpaceCount < 2){ |
703 | qDebug((*it).latin1()); | 703 | odebug << (*it).latin1() << oendl; |
704 | stream << (*it) << '\n'; | 704 | stream << (*it) << '\n'; |
705 | } | 705 | } |
706 | } | 706 | } |
707 | file.close(); | 707 | file.close(); |
708 | return true; | 708 | return true; |
709 | } | 709 | } |
710 | 710 | ||
711 | // interfaces.cpp | 711 | // interfaces.cpp |
712 | 712 | ||
diff --git a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp index 7c2f85c..ec3bad3 100644 --- a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp +++ b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp | |||
@@ -37,25 +37,25 @@ InterfaceSetupImp::InterfaceSetupImp(QWidget* parent, const char* name, Interfac | |||
37 | InterfaceSetupImp::~InterfaceSetupImp(){ | 37 | InterfaceSetupImp::~InterfaceSetupImp(){ |
38 | if(delInterfaces) { | 38 | if(delInterfaces) { |
39 | delete interfaces; | 39 | delete interfaces; |
40 | } | 40 | } |
41 | } | 41 | } |
42 | 42 | ||
43 | /** | 43 | /** |
44 | * Save the current settings, then write out the interfaces file and close. | 44 | * Save the current settings, then write out the interfaces file and close. |
45 | */ | 45 | */ |
46 | bool InterfaceSetupImp::saveChanges(){ | 46 | bool InterfaceSetupImp::saveChanges(){ |
47 | bool error; | 47 | bool error; |
48 | QString iface = interfaces->getInterfaceName(error); | 48 | QString iface = interfaces->getInterfaceName(error); |
49 | qDebug("InterfaceSetupImp::saveChanges saves interface %s", iface.latin1() ); | 49 | odebug << "InterfaceSetupImp::saveChanges saves interface " << iface.latin1() << "" << oendl; |
50 | if(!saveSettings()) | 50 | if(!saveSettings()) |
51 | return false; | 51 | return false; |
52 | 52 | ||
53 | interfaces->write(); | 53 | interfaces->write(); |
54 | 54 | ||
55 | if (interface->getStatus()) { | 55 | if (interface->getStatus()) { |
56 | QString ifup; | 56 | QString ifup; |
57 | ifup += "ifdown "; | 57 | ifup += "ifdown "; |
58 | ifup += iface; | 58 | ifup += iface; |
59 | ifup += "; ifup "; | 59 | ifup += "; ifup "; |
60 | ifup += iface; | 60 | ifup += iface; |
61 | ifup += ";"; | 61 | ifup += ";"; |
@@ -63,25 +63,25 @@ bool InterfaceSetupImp::saveChanges(){ | |||
63 | OProcess restart; | 63 | OProcess restart; |
64 | restart << "sh"; | 64 | restart << "sh"; |
65 | restart << "-c"; | 65 | restart << "-c"; |
66 | restart << ifup; | 66 | restart << ifup; |
67 | 67 | ||
68 | OWait *owait = new OWait(); | 68 | OWait *owait = new OWait(); |
69 | Global::statusMessage( tr( "Restarting interface" ) ); | 69 | Global::statusMessage( tr( "Restarting interface" ) ); |
70 | 70 | ||
71 | owait->show(); | 71 | owait->show(); |
72 | qApp->processEvents(); | 72 | qApp->processEvents(); |
73 | 73 | ||
74 | if (!restart.start(OProcess::Block, OProcess::NoCommunication) ) { | 74 | if (!restart.start(OProcess::Block, OProcess::NoCommunication) ) { |
75 | qWarning("unstable to spawn ifdown/ifup"); | 75 | owarn << "unstable to spawn ifdown/ifup" << oendl; |
76 | } | 76 | } |
77 | 77 | ||
78 | owait->hide(); | 78 | owait->hide(); |
79 | delete owait; | 79 | delete owait; |
80 | 80 | ||
81 | interface->refresh(); | 81 | interface->refresh(); |
82 | } | 82 | } |
83 | return true; | 83 | return true; |
84 | } | 84 | } |
85 | 85 | ||
86 | /** | 86 | /** |
87 | * Save the settings for the current Interface. | 87 | * Save the settings for the current Interface. |
@@ -148,61 +148,61 @@ void InterfaceSetupImp::setProfile(const QString &profile){ | |||
148 | 148 | ||
149 | QString newInterfaceName = interface->getInterfaceName(); | 149 | QString newInterfaceName = interface->getInterfaceName(); |
150 | if(profile.length() > 0) | 150 | if(profile.length() > 0) |
151 | newInterfaceName += "_" + profile; | 151 | newInterfaceName += "_" + profile; |
152 | // See if we have to make a interface. | 152 | // See if we have to make a interface. |
153 | if(!interfaces->setInterface(newInterfaceName)){ | 153 | if(!interfaces->setInterface(newInterfaceName)){ |
154 | // Add making for this new interface if need too | 154 | // Add making for this new interface if need too |
155 | if(profile != ""){ | 155 | if(profile != ""){ |
156 | interfaces->copyInterface(interface->getInterfaceName(), newInterfaceName); | 156 | interfaces->copyInterface(interface->getInterfaceName(), newInterfaceName); |
157 | if(!interfaces->setMapping(interface->getInterfaceName())){ | 157 | if(!interfaces->setMapping(interface->getInterfaceName())){ |
158 | interfaces->addMapping(interface->getInterfaceName()); | 158 | interfaces->addMapping(interface->getInterfaceName()); |
159 | if(!interfaces->setMapping(interface->getInterfaceName())){ | 159 | if(!interfaces->setMapping(interface->getInterfaceName())){ |
160 | qDebug("InterfaceSetupImp: Added Mapping, but still can't setInterface."); | 160 | odebug << "InterfaceSetupImp: Added Mapping, but still can't setInterface." << oendl; |
161 | return; | 161 | return; |
162 | } | 162 | } |
163 | } | 163 | } |
164 | interfaces->setMap("map", newInterfaceName); | 164 | interfaces->setMap("map", newInterfaceName); |
165 | interfaces->setScript("getprofile.sh"); | 165 | interfaces->setScript("getprofile.sh"); |
166 | } | 166 | } |
167 | else{ | 167 | else{ |
168 | interfaces->addInterface(newInterfaceName, INTERFACES_FAMILY_INET, INTERFACES_METHOD_DHCP); | 168 | interfaces->addInterface(newInterfaceName, INTERFACES_FAMILY_INET, INTERFACES_METHOD_DHCP); |
169 | if(!interfaces->setInterface(newInterfaceName)){ | 169 | if(!interfaces->setInterface(newInterfaceName)){ |
170 | qDebug("InterfaceSetupImp: Added interface, but still can't setInterface."); | 170 | odebug << "InterfaceSetupImp: Added interface, but still can't setInterface." << oendl; |
171 | return; | 171 | return; |
172 | } | 172 | } |
173 | } | 173 | } |
174 | } | 174 | } |
175 | 175 | ||
176 | // We must have a valid interface to get this far so read some settings. | 176 | // We must have a valid interface to get this far so read some settings. |
177 | 177 | ||
178 | // DHCP | 178 | // DHCP |
179 | bool error = false; | 179 | bool error = false; |
180 | if(interfaces->getInterfaceMethod(error) == INTERFACES_METHOD_DHCP) | 180 | if(interfaces->getInterfaceMethod(error) == INTERFACES_METHOD_DHCP) |
181 | dhcpCheckBox->setChecked(true); | 181 | dhcpCheckBox->setChecked(true); |
182 | else | 182 | else |
183 | dhcpCheckBox->setChecked(false); | 183 | dhcpCheckBox->setChecked(false); |
184 | 184 | ||
185 | // IP Information | 185 | // IP Information |
186 | autoStart->setChecked(interfaces->isAuto(interface->getInterfaceName())); | 186 | autoStart->setChecked(interfaces->isAuto(interface->getInterfaceName())); |
187 | QString dns = interfaces->getInterfaceOption("up "DNSSCRIPT" -a", error); | 187 | QString dns = interfaces->getInterfaceOption("up "DNSSCRIPT" -a", error); |
188 | qDebug("dns >%s<",dns.latin1()); | 188 | odebug << "dns >" << dns.latin1() << "<" << oendl; |
189 | if(dns.contains(" ")){ | 189 | if(dns.contains(" ")){ |
190 | firstDNSLineEdit->setText(dns.mid(0, dns.find(" "))); | 190 | firstDNSLineEdit->setText(dns.mid(0, dns.find(" "))); |
191 | secondDNSLineEdit->setText(dns.mid(dns.find(" ")+1, dns.length())); | 191 | secondDNSLineEdit->setText(dns.mid(dns.find(" ")+1, dns.length())); |
192 | }else firstDNSLineEdit->setText(dns); | 192 | }else firstDNSLineEdit->setText(dns); |
193 | 193 | ||
194 | ipAddressEdit->setText(interfaces->getInterfaceOption("address", error)); | 194 | ipAddressEdit->setText(interfaces->getInterfaceOption("address", error)); |
195 | subnetMaskEdit->setText(interfaces->getInterfaceOption("netmask", error)); | 195 | subnetMaskEdit->setText(interfaces->getInterfaceOption("netmask", error)); |
196 | if (subnetMaskEdit->text().isEmpty()) | 196 | if (subnetMaskEdit->text().isEmpty()) |
197 | subnetMaskEdit->setText( "255.255.255.0" ); | 197 | subnetMaskEdit->setText( "255.255.255.0" ); |
198 | gatewayEdit->setText(interfaces->getInterfaceOption("gateway", error)); | 198 | gatewayEdit->setText(interfaces->getInterfaceOption("gateway", error)); |
199 | 199 | ||
200 | 200 | ||
201 | 201 | ||
202 | qWarning("InterfaceSetupImp::setProfile(%s)\n", profile.latin1()); | 202 | owarn << "InterfaceSetupImp::setProfile(" << profile.latin1() << ")\n" << oendl; |
203 | qWarning("InterfaceSetupImp::setProfile: iface is %s\n", interfaces->getInterfaceName(error).latin1()); | 203 | owarn << "InterfaceSetupImp::setProfile: iface is " << interfaces->getInterfaceName(error).latin1() << "\n" << oendl; |
204 | 204 | ||
205 | } | 205 | } |
206 | 206 | ||
207 | // interfacesetup.cpp | 207 | // interfacesetup.cpp |
208 | 208 | ||
diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp index 1e16b97..3e1a650 100644 --- a/noncore/settings/networksettings/mainwindowimp.cpp +++ b/noncore/settings/networksettings/mainwindowimp.cpp | |||
@@ -70,25 +70,25 @@ MainWindowImp::MainWindowImp(QWidget *parent, const char *name, WFlags) : MainWi | |||
70 | 70 | ||
71 | Interfaces i; | 71 | Interfaces i; |
72 | QStringList list = i.getInterfaceList(); | 72 | QStringList list = i.getInterfaceList(); |
73 | QMap<QString, Interface*>::Iterator it; | 73 | QMap<QString, Interface*>::Iterator it; |
74 | for ( QStringList::Iterator ni = list.begin(); ni != list.end(); ++ni ) | 74 | for ( QStringList::Iterator ni = list.begin(); ni != list.end(); ++ni ) |
75 | { | 75 | { |
76 | /* | 76 | /* |
77 | * we skipped it in getAllInterfaces now | 77 | * we skipped it in getAllInterfaces now |
78 | * we need to ignore it as well | 78 | * we need to ignore it as well |
79 | */ | 79 | */ |
80 | if (m_handledIfaces.contains( *ni) ) | 80 | if (m_handledIfaces.contains( *ni) ) |
81 | { | 81 | { |
82 | qDebug("Not up iface handled by module"); | 82 | odebug << "Not up iface handled by module" << oendl; |
83 | continue; | 83 | continue; |
84 | } | 84 | } |
85 | bool found = false; | 85 | bool found = false; |
86 | for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it ) | 86 | for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it ) |
87 | { | 87 | { |
88 | if(it.key() == (*ni)) | 88 | if(it.key() == (*ni)) |
89 | found = true; | 89 | found = true; |
90 | } | 90 | } |
91 | if(!found) | 91 | if(!found) |
92 | { | 92 | { |
93 | if(!(*ni).contains("_")) | 93 | if(!(*ni).contains("_")) |
94 | { | 94 | { |
@@ -210,25 +210,25 @@ void MainWindowImp::getAllInterfaces() | |||
210 | if((loc = line.find(":")) != -1) | 210 | if((loc = line.find(":")) != -1) |
211 | { | 211 | { |
212 | ifaces += line.left(loc); | 212 | ifaces += line.left(loc); |
213 | } | 213 | } |
214 | } | 214 | } |
215 | } | 215 | } |
216 | 216 | ||
217 | for (QStringList::Iterator it = ifaces.begin(); it != ifaces.end(); ++it) | 217 | for (QStringList::Iterator it = ifaces.begin(); it != ifaces.end(); ++it) |
218 | { | 218 | { |
219 | int flags = 0; | 219 | int flags = 0; |
220 | if ( m_handledIfaces.contains( (*it) ) ) | 220 | if ( m_handledIfaces.contains( (*it) ) ) |
221 | { | 221 | { |
222 | qDebug(" %s is handled by a module", (*it).latin1() ); | 222 | odebug << " " << (*it).latin1() << " is handled by a module" << oendl; |
223 | continue; | 223 | continue; |
224 | } | 224 | } |
225 | // int family; | 225 | // int family; |
226 | i = NULL; | 226 | i = NULL; |
227 | 227 | ||
228 | strcpy(ifr.ifr_name, (*it).latin1()); | 228 | strcpy(ifr.ifr_name, (*it).latin1()); |
229 | 229 | ||
230 | struct ifreq ifcopy; | 230 | struct ifreq ifcopy; |
231 | ifcopy = ifr; | 231 | ifcopy = ifr; |
232 | result = ioctl(sockfd, SIOCGIFFLAGS, &ifcopy); | 232 | result = ioctl(sockfd, SIOCGIFFLAGS, &ifcopy); |
233 | flags = ifcopy.ifr_flags; | 233 | flags = ifcopy.ifr_flags; |
234 | i = new Interface(this, ifr.ifr_name, false); | 234 | i = new Interface(this, ifr.ifr_name, false); |
@@ -240,141 +240,141 @@ void MainWindowImp::getAllInterfaces() | |||
240 | 240 | ||
241 | if ((flags & IFF_BROADCAST) == IFF_BROADCAST) | 241 | if ((flags & IFF_BROADCAST) == IFF_BROADCAST) |
242 | i->setHardwareName("Ethernet"); | 242 | i->setHardwareName("Ethernet"); |
243 | else if ((flags & IFF_POINTOPOINT) == IFF_POINTOPOINT) | 243 | else if ((flags & IFF_POINTOPOINT) == IFF_POINTOPOINT) |
244 | i->setHardwareName("Point to Point"); | 244 | i->setHardwareName("Point to Point"); |
245 | else if ((flags & IFF_MULTICAST) == IFF_MULTICAST) | 245 | else if ((flags & IFF_MULTICAST) == IFF_MULTICAST) |
246 | i->setHardwareName("Multicast"); | 246 | i->setHardwareName("Multicast"); |
247 | else if ((flags & IFF_LOOPBACK) == IFF_LOOPBACK) | 247 | else if ((flags & IFF_LOOPBACK) == IFF_LOOPBACK) |
248 | i->setHardwareName("Loopback"); | 248 | i->setHardwareName("Loopback"); |
249 | else | 249 | else |
250 | i->setHardwareName("Unknown"); | 250 | i->setHardwareName("Unknown"); |
251 | 251 | ||
252 | qWarning("Adding interface %s to interfaceNames\n", ifr.ifr_name); | 252 | owarn << "Adding interface " << ifr.ifr_name << " to interfaceNames\n" << oendl; |
253 | interfaceNames.insert(i->getInterfaceName(), i); | 253 | interfaceNames.insert(i->getInterfaceName(), i); |
254 | updateInterface(i); | 254 | updateInterface(i); |
255 | connect(i, SIGNAL(updateInterface(Interface*)), | 255 | connect(i, SIGNAL(updateInterface(Interface*)), |
256 | this, SLOT(updateInterface(Interface*))); | 256 | this, SLOT(updateInterface(Interface*))); |
257 | } | 257 | } |
258 | // now lets ask the plugins too ;) | 258 | // now lets ask the plugins too ;) |
259 | QMap<Module*, QLibrary*>::Iterator it; | 259 | QMap<Module*, QLibrary*>::Iterator it; |
260 | QList<Interface> ilist; | 260 | QList<Interface> ilist; |
261 | for( it = libraries.begin(); it != libraries.end(); ++it ) | 261 | for( it = libraries.begin(); it != libraries.end(); ++it ) |
262 | { | 262 | { |
263 | if(it.key()) | 263 | if(it.key()) |
264 | { | 264 | { |
265 | ilist = it.key()->getInterfaces(); | 265 | ilist = it.key()->getInterfaces(); |
266 | for( i = ilist.first(); i != 0; i = ilist.next() ) | 266 | for( i = ilist.first(); i != 0; i = ilist.next() ) |
267 | { | 267 | { |
268 | qWarning("Adding interface %s to interfaceNames\n", i->getInterfaceName().latin1() ); | 268 | owarn << "Adding interface " << i->getInterfaceName().latin1() << " to interfaceNames\n" << oendl; |
269 | interfaceNames.insert(i->getInterfaceName(), i); | 269 | interfaceNames.insert(i->getInterfaceName(), i); |
270 | updateInterface(i); | 270 | updateInterface(i); |
271 | connect(i, SIGNAL(updateInterface(Interface*)), | 271 | connect(i, SIGNAL(updateInterface(Interface*)), |
272 | this, SLOT(updateInterface(Interface*))); | 272 | this, SLOT(updateInterface(Interface*))); |
273 | } | 273 | } |
274 | } | 274 | } |
275 | } | 275 | } |
276 | } | 276 | } |
277 | 277 | ||
278 | /** | 278 | /** |
279 | * Load all modules that are found in the path | 279 | * Load all modules that are found in the path |
280 | * @param path a directory that is scaned for any plugins that can be loaded | 280 | * @param path a directory that is scaned for any plugins that can be loaded |
281 | * and attempts to load them | 281 | * and attempts to load them |
282 | */ | 282 | */ |
283 | void MainWindowImp::loadModules(const QString &path) | 283 | void MainWindowImp::loadModules(const QString &path) |
284 | { | 284 | { |
285 | #ifdef DEBUG | 285 | #ifdef DEBUG |
286 | qDebug("MainWindowImp::loadModules: %s", path.latin1()); | 286 | odebug << "MainWindowImp::loadModules: " << path.latin1() << "" << oendl; |
287 | #endif | 287 | #endif |
288 | QDir d(path); | 288 | QDir d(path); |
289 | if(!d.exists()) | 289 | if(!d.exists()) |
290 | return; | 290 | return; |
291 | 291 | ||
292 | // Don't want sym links | 292 | // Don't want sym links |
293 | d.setFilter( QDir::Files | QDir::NoSymLinks ); | 293 | d.setFilter( QDir::Files | QDir::NoSymLinks ); |
294 | const QFileInfoList *list = d.entryInfoList(); | 294 | const QFileInfoList *list = d.entryInfoList(); |
295 | QFileInfoListIterator it( *list ); | 295 | QFileInfoListIterator it( *list ); |
296 | QFileInfo *fi; | 296 | QFileInfo *fi; |
297 | while ( (fi=it.current()) ) | 297 | while ( (fi=it.current()) ) |
298 | { | 298 | { |
299 | #ifdef QWS | 299 | #ifdef QWS |
300 | if(fi->fileName().contains(".so")) | 300 | if(fi->fileName().contains(".so")) |
301 | { | 301 | { |
302 | #else | 302 | #else |
303 | if(fi->fileName().contains(".so") && fi->fileName().contains("networksettings_")) | 303 | if(fi->fileName().contains(".so") && fi->fileName().contains("networksettings_")) |
304 | { | 304 | { |
305 | #endif | 305 | #endif |
306 | loadPlugin(path + "/" + fi->fileName()); | 306 | loadPlugin(path + "/" + fi->fileName()); |
307 | qDebug("loaded plugin: >%s< ",QString(path + "/" + fi->fileName()).latin1()); | 307 | odebug << "loaded plugin: >" << QString(path + "/" + fi->fileName()).latin1() << "< " << oendl; |
308 | } | 308 | } |
309 | ++it; | 309 | ++it; |
310 | } | 310 | } |
311 | } | 311 | } |
312 | 312 | ||
313 | /** | 313 | /** |
314 | * Attempt to load a function and resolve a function. | 314 | * Attempt to load a function and resolve a function. |
315 | * @param pluginFileName - the name of the file in which to attempt to load | 315 | * @param pluginFileName - the name of the file in which to attempt to load |
316 | * @param resolveString - function pointer to resolve | 316 | * @param resolveString - function pointer to resolve |
317 | * @return pointer to the function with name resolveString or NULL | 317 | * @return pointer to the function with name resolveString or NULL |
318 | */ | 318 | */ |
319 | Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString &resolveString) | 319 | Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString &resolveString) |
320 | { | 320 | { |
321 | #ifdef DEBUG | 321 | #ifdef DEBUG |
322 | qDebug("MainWindowImp::loadPlugin: %s: resolving %s", pluginFileName.latin1(), resolveString.latin1()); | 322 | odebug << "MainWindowImp::loadPlugin: " << pluginFileName.latin1() << ": resolving " << resolveString.latin1() << "" << oendl; |
323 | #endif | 323 | #endif |
324 | #ifdef QWS | 324 | #ifdef QWS |
325 | QLibrary *lib = new QLibrary(pluginFileName); | 325 | QLibrary *lib = new QLibrary(pluginFileName); |
326 | void *functionPointer = lib->resolve(resolveString); | 326 | void *functionPointer = lib->resolve(resolveString); |
327 | if( !functionPointer ) | 327 | if( !functionPointer ) |
328 | { | 328 | { |
329 | #ifdef DEBUG | 329 | #ifdef DEBUG |
330 | qDebug("MainWindowImp::loadPlugin: Warning: %s is not a plugin", pluginFileName.latin1()); | 330 | odebug << "MainWindowImp::loadPlugin: Warning: " << pluginFileName.latin1() << " is not a plugin" << oendl; |
331 | #endif | 331 | #endif |
332 | delete lib; | 332 | delete lib; |
333 | return NULL; | 333 | return NULL; |
334 | } | 334 | } |
335 | // Try to get an object. | 335 | // Try to get an object. |
336 | Module *object = ((Module* (*)()) functionPointer)(); | 336 | Module *object = ((Module* (*)()) functionPointer)(); |
337 | if(object == NULL) | 337 | if(object == NULL) |
338 | { | 338 | { |
339 | #ifdef DEBUG | 339 | #ifdef DEBUG |
340 | qDebug("MainWindowImp: Couldn't create object, but did load library!"); | 340 | odebug << "MainWindowImp: Couldn't create object, but did load library!" << oendl; |
341 | #endif | 341 | #endif |
342 | delete lib; | 342 | delete lib; |
343 | return NULL; | 343 | return NULL; |
344 | } | 344 | } |
345 | 345 | ||
346 | m_handledIfaces += object->handledInterfaceNames(); | 346 | m_handledIfaces += object->handledInterfaceNames(); |
347 | // Store for deletion later | 347 | // Store for deletion later |
348 | libraries.insert(object, lib); | 348 | libraries.insert(object, lib); |
349 | return object; | 349 | return object; |
350 | 350 | ||
351 | #else | 351 | #else |
352 | QLibrary *lib = loader->library(pluginFileName); | 352 | QLibrary *lib = loader->library(pluginFileName); |
353 | if( !lib || !lib->hasSymbol(resolveString) ) | 353 | if( !lib || !lib->hasSymbol(resolveString) ) |
354 | { | 354 | { |
355 | qDebug(QString("MainWindowImp::loadPlugin: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1()); | 355 | odebug << QString("MainWindowImp::loadPlugin: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1() << oendl; |
356 | return NULL; | 356 | return NULL; |
357 | } | 357 | } |
358 | // Try to get an object. | 358 | // Try to get an object. |
359 | Module *object = ((Module* (*)()) lib->symbol(resolveString))(); | 359 | Module *object = ((Module* (*)()) lib->symbol(resolveString))(); |
360 | if(object == NULL) | 360 | if(object == NULL) |
361 | { | 361 | { |
362 | #ifdef DEBUG | 362 | #ifdef DEBUG |
363 | qDebug("MainWindowImp: Couldn't create object, but did load library!"); | 363 | odebug << "MainWindowImp: Couldn't create object, but did load library!" << oendl; |
364 | #endif | 364 | #endif |
365 | return NULL; | 365 | return NULL; |
366 | } | 366 | } |
367 | #ifdef DEBUG | 367 | #ifdef DEBUG |
368 | qDebug("MainWindowImp::loadPlugin:: Found object, storing."); | 368 | odebug << "MainWindowImp::loadPlugin:: Found object, storing." << oendl; |
369 | #endif | 369 | #endif |
370 | // Store for deletion later | 370 | // Store for deletion later |
371 | libraries.insert(object, lib); | 371 | libraries.insert(object, lib); |
372 | return object; | 372 | return object; |
373 | #endif | 373 | #endif |
374 | } | 374 | } |
375 | 375 | ||
376 | /** | 376 | /** |
377 | * The Add button was clicked. Bring up the add dialog and if OK is hit | 377 | * The Add button was clicked. Bring up the add dialog and if OK is hit |
378 | * load the plugin and append it to the list | 378 | * load the plugin and append it to the list |
379 | */ | 379 | */ |
380 | void MainWindowImp::addClicked() | 380 | void MainWindowImp::addClicked() |
@@ -402,25 +402,25 @@ void MainWindowImp::addClicked() | |||
402 | { | 402 | { |
403 | QListViewItem *item = addNewConnection.registeredServicesList->currentItem(); | 403 | QListViewItem *item = addNewConnection.registeredServicesList->currentItem(); |
404 | if(!item) | 404 | if(!item) |
405 | return; | 405 | return; |
406 | 406 | ||
407 | for( it = libraries.begin(); it != libraries.end(); ++it ) | 407 | for( it = libraries.begin(); it != libraries.end(); ++it ) |
408 | { | 408 | { |
409 | if(it.key()) | 409 | if(it.key()) |
410 | { | 410 | { |
411 | Interface *i = (it.key())->addNewInterface(item->text(0)); | 411 | Interface *i = (it.key())->addNewInterface(item->text(0)); |
412 | if(i) | 412 | if(i) |
413 | { | 413 | { |
414 | qDebug("iface name %s",i->getInterfaceName().latin1()); | 414 | odebug << "iface name " << i->getInterfaceName().latin1() << "" << oendl; |
415 | interfaceNames.insert(i->getInterfaceName(), i); | 415 | interfaceNames.insert(i->getInterfaceName(), i); |
416 | updateInterface(i); | 416 | updateInterface(i); |
417 | } | 417 | } |
418 | } | 418 | } |
419 | } | 419 | } |
420 | } | 420 | } |
421 | } | 421 | } |
422 | 422 | ||
423 | /** | 423 | /** |
424 | * Prompt the user to see if they really want to do this. | 424 | * Prompt the user to see if they really want to do this. |
425 | * If they do then remove from the list and unload. | 425 | * If they do then remove from the list and unload. |
426 | */ | 426 | */ |
@@ -504,25 +504,25 @@ void MainWindowImp::informationClicked() | |||
504 | // if(!i->isAttached()){ | 504 | // if(!i->isAttached()){ |
505 | // QMessageBox::information(this, "Sorry","No information about\na disconnected interface.", QMessageBox::Ok); | 505 | // QMessageBox::information(this, "Sorry","No information about\na disconnected interface.", QMessageBox::Ok); |
506 | // return; | 506 | // return; |
507 | // } | 507 | // } |
508 | 508 | ||
509 | if(i->getModuleOwner()) | 509 | if(i->getModuleOwner()) |
510 | { | 510 | { |
511 | QWidget *moduleInformation = i->getModuleOwner()->information(i); | 511 | QWidget *moduleInformation = i->getModuleOwner()->information(i); |
512 | if(moduleInformation != NULL) | 512 | if(moduleInformation != NULL) |
513 | { | 513 | { |
514 | QPEApplication::showWidget( moduleInformation ); | 514 | QPEApplication::showWidget( moduleInformation ); |
515 | #ifdef DEBUG | 515 | #ifdef DEBUG |
516 | qDebug("MainWindowImp::informationClicked:: Module owner has created, we showed."); | 516 | odebug << "MainWindowImp::informationClicked:: Module owner has created, we showed." << oendl; |
517 | #endif | 517 | #endif |
518 | return; | 518 | return; |
519 | } | 519 | } |
520 | } | 520 | } |
521 | InterfaceInformationImp *information = new InterfaceInformationImp(this, "InterfaceSetupImp", i, Qt::WType_Modal | Qt::WDestructiveClose | Qt::WStyle_Dialog | Qt::WStyle_ContextHelp); | 521 | InterfaceInformationImp *information = new InterfaceInformationImp(this, "InterfaceSetupImp", i, Qt::WType_Modal | Qt::WDestructiveClose | Qt::WStyle_Dialog | Qt::WStyle_ContextHelp); |
522 | QPEApplication::showWidget( information ); | 522 | QPEApplication::showWidget( information ); |
523 | } | 523 | } |
524 | 524 | ||
525 | /** | 525 | /** |
526 | * Update this interface. If no QListViewItem exists create one. | 526 | * Update this interface. If no QListViewItem exists create one. |
527 | * @param Interface* pointer to the interface that needs to be updated. | 527 | * @param Interface* pointer to the interface that needs to be updated. |
528 | */ | 528 | */ |
@@ -641,25 +641,25 @@ void MainWindowImp::removeProfile() | |||
641 | profiles = QStringList::split(" ", profiles.join(" ").replace(QRegExp(profileToRemove), "")); | 641 | profiles = QStringList::split(" ", profiles.join(" ").replace(QRegExp(profileToRemove), "")); |
642 | profilesList->clear(); | 642 | profilesList->clear(); |
643 | for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it) | 643 | for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it) |
644 | profilesList->insertItem((*it)); | 644 | profilesList->insertItem((*it)); |
645 | 645 | ||
646 | // Remove any interface settings and mappings. | 646 | // Remove any interface settings and mappings. |
647 | Interfaces interfaces; | 647 | Interfaces interfaces; |
648 | // Go through them one by one | 648 | // Go through them one by one |
649 | QMap<Interface*, QListViewItem*>::Iterator it; | 649 | QMap<Interface*, QListViewItem*>::Iterator it; |
650 | for( it = items.begin(); it != items.end(); ++it ) | 650 | for( it = items.begin(); it != items.end(); ++it ) |
651 | { | 651 | { |
652 | QString interfaceName = it.key()->getInterfaceName(); | 652 | QString interfaceName = it.key()->getInterfaceName(); |
653 | qDebug(interfaceName.latin1()); | 653 | odebug << interfaceName.latin1() << oendl; |
654 | if(interfaces.setInterface(interfaceName + "_" + profileToRemove)) | 654 | if(interfaces.setInterface(interfaceName + "_" + profileToRemove)) |
655 | { | 655 | { |
656 | interfaces.removeInterface(); | 656 | interfaces.removeInterface(); |
657 | if(interfaces.setMapping(interfaceName)) | 657 | if(interfaces.setMapping(interfaceName)) |
658 | { | 658 | { |
659 | if(profilesList->count() == 1) | 659 | if(profilesList->count() == 1) |
660 | interfaces.removeMapping(); | 660 | interfaces.removeMapping(); |
661 | else | 661 | else |
662 | { | 662 | { |
663 | interfaces.removeMap("map", interfaceName + "_" + profileToRemove); | 663 | interfaces.removeMap("map", interfaceName + "_" + profileToRemove); |
664 | } | 664 | } |
665 | } | 665 | } |
@@ -710,39 +710,39 @@ void MainWindowImp::changeProfile() | |||
710 | 710 | ||
711 | 711 | ||
712 | void MainWindowImp::makeChannel() | 712 | void MainWindowImp::makeChannel() |
713 | { | 713 | { |
714 | channel = new QCopChannel( "QPE/Application/networksettings", this ); | 714 | channel = new QCopChannel( "QPE/Application/networksettings", this ); |
715 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), | 715 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), |
716 | this, SLOT(receive(const QCString&,const QByteArray&)) ); | 716 | this, SLOT(receive(const QCString&,const QByteArray&)) ); |
717 | } | 717 | } |
718 | 718 | ||
719 | void MainWindowImp::receive(const QCString &msg, const QByteArray &arg) | 719 | void MainWindowImp::receive(const QCString &msg, const QByteArray &arg) |
720 | { | 720 | { |
721 | bool found = false; | 721 | bool found = false; |
722 | qDebug("MainWindowImp::receive QCop msg >"+msg+"<"); | 722 | odebug << "MainWindowImp::receive QCop msg >"+msg+"<" << oendl; |
723 | if (msg == "raise") | 723 | if (msg == "raise") |
724 | { | 724 | { |
725 | raise(); | 725 | raise(); |
726 | return; | 726 | return; |
727 | } | 727 | } |
728 | 728 | ||
729 | QString dest = msg.left(msg.find("(")); | 729 | QString dest = msg.left(msg.find("(")); |
730 | QCString param = msg.right(msg.length() - msg.find("(") - 1); | 730 | QCString param = msg.right(msg.length() - msg.find("(") - 1); |
731 | param = param.left( param.length() - 1 ); | 731 | param = param.left( param.length() - 1 ); |
732 | qDebug("dest >%s< param >"+param+"<",dest.latin1()); | 732 | odebug << "dest >" << dest.latin1() << "< param >"+param+"<" << oendl; |
733 | 733 | ||
734 | QMap<Module*, QLibrary*>::Iterator it; | 734 | QMap<Module*, QLibrary*>::Iterator it; |
735 | for( it = libraries.begin(); it != libraries.end(); ++it ) | 735 | for( it = libraries.begin(); it != libraries.end(); ++it ) |
736 | { | 736 | { |
737 | qDebug("plugin >%s<", it.key()->type().latin1() ); | 737 | odebug << "plugin >" << it.key()->type().latin1() << "<" << oendl; |
738 | if(it.key()->type() == dest) | 738 | if(it.key()->type() == dest) |
739 | { | 739 | { |
740 | it.key()->receive( param, arg ); | 740 | it.key()->receive( param, arg ); |
741 | found = true; | 741 | found = true; |
742 | } | 742 | } |
743 | } | 743 | } |
744 | 744 | ||
745 | 745 | ||
746 | if (found) QPEApplication::setKeepRunning(); | 746 | if (found) QPEApplication::setKeepRunning(); |
747 | else qDebug("Huh what do ya want"); | 747 | else odebug << "Huh what do ya want" << oendl; |
748 | } | 748 | } |
diff --git a/noncore/settings/networksettings/ppp/accounts.cpp b/noncore/settings/networksettings/ppp/accounts.cpp index b8a1925a..aedc0b9 100644 --- a/noncore/settings/networksettings/ppp/accounts.cpp +++ b/noncore/settings/networksettings/ppp/accounts.cpp | |||
@@ -109,25 +109,25 @@ void AccountWidget::edit() | |||
109 | void AccountWidget::create() | 109 | void AccountWidget::create() |
110 | { | 110 | { |
111 | 111 | ||
112 | // if(listListbox->count() == MAX_ACCOUNTS) { | 112 | // if(listListbox->count() == MAX_ACCOUNTS) { |
113 | // QMessageBox::information(this, "sorry", | 113 | // QMessageBox::information(this, "sorry", |
114 | // tr("Maximum number of accounts reached.")); | 114 | // tr("Maximum number of accounts reached.")); |
115 | // return; | 115 | // return; |
116 | // } | 116 | // } |
117 | 117 | ||
118 | int result; | 118 | int result; |
119 | if (_pppdata->newaccount() == -1) | 119 | if (_pppdata->newaccount() == -1) |
120 | { | 120 | { |
121 | qDebug("_pppdata->newaccount() == -1"); | 121 | odebug << "_pppdata->newaccount() == -1" << oendl; |
122 | return; | 122 | return; |
123 | } | 123 | } |
124 | result = doTab(); | 124 | result = doTab(); |
125 | 125 | ||
126 | if(result == QDialog::Accepted) | 126 | if(result == QDialog::Accepted) |
127 | { | 127 | { |
128 | listListbox->insertItem(_pppdata->accname()); | 128 | listListbox->insertItem(_pppdata->accname()); |
129 | listListbox->setSelected(listListbox->findItem(_pppdata->accname()),true); | 129 | listListbox->setSelected(listListbox->findItem(_pppdata->accname()),true); |
130 | 130 | ||
131 | _pppdata->save(); | 131 | _pppdata->save(); |
132 | } | 132 | } |
133 | else | 133 | else |
diff --git a/noncore/settings/networksettings/ppp/authwidget.cpp b/noncore/settings/networksettings/ppp/authwidget.cpp index fa2b164..f3d842f 100644 --- a/noncore/settings/networksettings/ppp/authwidget.cpp +++ b/noncore/settings/networksettings/ppp/authwidget.cpp | |||
@@ -133,34 +133,34 @@ bool AuthWidget::check() | |||
133 | void AuthWidget::save() | 133 | void AuthWidget::save() |
134 | { | 134 | { |
135 | _pppdata->setAuthMethod(auth->currentItem()); | 135 | _pppdata->setAuthMethod(auth->currentItem()); |
136 | if (scriptWidget) scriptWidget->save(); | 136 | if (scriptWidget) scriptWidget->save(); |
137 | _pppdata->setStoredUsername( userName->text() ); | 137 | _pppdata->setStoredUsername( userName->text() ); |
138 | _pppdata->setStorePassword(store_password->isChecked()); | 138 | _pppdata->setStorePassword(store_password->isChecked()); |
139 | if (store_password->isChecked()) | 139 | if (store_password->isChecked()) |
140 | _pppdata->setStoredPassword( passWord->text() ); | 140 | _pppdata->setStoredPassword( passWord->text() ); |
141 | } | 141 | } |
142 | 142 | ||
143 | void AuthWidget::authChanged( const QString &authStr ) | 143 | void AuthWidget::authChanged( const QString &authStr ) |
144 | { | 144 | { |
145 | qDebug("AuthWidget::authChanged( %s )", authStr.latin1() ); | 145 | odebug << "AuthWidget::authChanged( " << authStr.latin1() << " )" << oendl; |
146 | if ( authStr.contains( tr("Script-based") ) ){ | 146 | if ( authStr.contains( tr("Script-based") ) ){ |
147 | showUsernamePassword( false ); | 147 | showUsernamePassword( false ); |
148 | showScriptWindow( true ); | 148 | showScriptWindow( true ); |
149 | } else if ( authStr.contains( tr("PAP") ) || | 149 | } else if ( authStr.contains( tr("PAP") ) || |
150 | authStr.contains( tr("CHAP") ) ){ | 150 | authStr.contains( tr("CHAP") ) ){ |
151 | showUsernamePassword( true ); | 151 | showUsernamePassword( true ); |
152 | showScriptWindow( false ); | 152 | showScriptWindow( false ); |
153 | } else { | 153 | } else { |
154 | qDebug("do not really know how to handle"); | 154 | odebug << "do not really know how to handle" << oendl; |
155 | showUsernamePassword( false ); | 155 | showUsernamePassword( false ); |
156 | showScriptWindow( false ); | 156 | showScriptWindow( false ); |
157 | } | 157 | } |
158 | } | 158 | } |
159 | 159 | ||
160 | 160 | ||
161 | void AuthWidget::showUsernamePassword( bool show ) | 161 | void AuthWidget::showUsernamePassword( bool show ) |
162 | { | 162 | { |
163 | if (show){ | 163 | if (show){ |
164 | user_l->show(); | 164 | user_l->show(); |
165 | userName->show(); | 165 | userName->show(); |
166 | pw_l->show(); | 166 | pw_l->show(); |
diff --git a/noncore/settings/networksettings/ppp/connect.cpp b/noncore/settings/networksettings/ppp/connect.cpp index e3fab24..b75410c 100644 --- a/noncore/settings/networksettings/ppp/connect.cpp +++ b/noncore/settings/networksettings/ppp/connect.cpp | |||
@@ -463,25 +463,25 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
463 | 463 | ||
464 | // execute the script | 464 | // execute the script |
465 | if(vmain == 2) { | 465 | if(vmain == 2) { |
466 | if(!expecting && !pausing && !scanning) { | 466 | if(!expecting && !pausing && !scanning) { |
467 | 467 | ||
468 | timeout_timer->stop(); | 468 | timeout_timer->stop(); |
469 | timeout_timer->start(scriptTimeout); | 469 | timeout_timer->start(scriptTimeout); |
470 | 470 | ||
471 | if((unsigned) scriptindex < comlist->count()) { | 471 | if((unsigned) scriptindex < comlist->count()) { |
472 | scriptCommand = *(comlist->at(scriptindex)); | 472 | scriptCommand = *(comlist->at(scriptindex)); |
473 | scriptArgument = *(arglist->at(scriptindex)); | 473 | scriptArgument = *(arglist->at(scriptindex)); |
474 | } else { | 474 | } else { |
475 | qDebug( "End of script" ); | 475 | odebug << "End of script" << oendl; |
476 | vmain = 10; | 476 | vmain = 10; |
477 | return; | 477 | return; |
478 | } | 478 | } |
479 | 479 | ||
480 | if (scriptCommand == "Scan") { | 480 | if (scriptCommand == "Scan") { |
481 | QString bm = QObject::tr("Scanning %1").arg(scriptArgument); | 481 | QString bm = QObject::tr("Scanning %1").arg(scriptArgument); |
482 | messg->setText(bm); | 482 | messg->setText(bm); |
483 | emit debugMessage(bm); | 483 | emit debugMessage(bm); |
484 | 484 | ||
485 | setScan(scriptArgument); | 485 | setScan(scriptArgument); |
486 | scriptindex++; | 486 | scriptindex++; |
487 | return; | 487 | return; |
@@ -829,35 +829,35 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
829 | 829 | ||
830 | // Close the tty. This prevents the QTimer::singleShot() in | 830 | // Close the tty. This prevents the QTimer::singleShot() in |
831 | // Modem::readtty() from re-enabling the socket notifier. | 831 | // Modem::readtty() from re-enabling the socket notifier. |
832 | // The port is still held open by the helper process. | 832 | // The port is still held open by the helper process. |
833 | 833 | ||
834 | /* Er, there _is_ not QTimer::singleShot() in Modem::readtty(), | 834 | /* Er, there _is_ not QTimer::singleShot() in Modem::readtty(), |
835 | and closing the thing prevents pppd from using it later. */ | 835 | and closing the thing prevents pppd from using it later. */ |
836 | //_ifaceppp->modem()->closetty(); | 836 | //_ifaceppp->modem()->closetty(); |
837 | 837 | ||
838 | killTimer( main_timer_ID ); | 838 | killTimer( main_timer_ID ); |
839 | 839 | ||
840 | if_timeout_timer->start(_ifaceppp->data()->pppdTimeout()*1000); | 840 | if_timeout_timer->start(_ifaceppp->data()->pppdTimeout()*1000); |
841 | qDebug( "started if timeout timer with %i", _ifaceppp->data()->pppdTimeout()*1000); | 841 | odebug << "started if timeout timer with " << _ifaceppp->data()->pppdTimeout()*1000 << "" << oendl; |
842 | 842 | ||
843 | // find out PPP interface and notify the stats module | 843 | // find out PPP interface and notify the stats module |
844 | // stats->setUnit(pppInterfaceNumber()); | 844 | // stats->setUnit(pppInterfaceNumber()); |
845 | 845 | ||
846 | qApp->flushX(); | 846 | qApp->flushX(); |
847 | semaphore = true; | 847 | semaphore = true; |
848 | result = execppp(); | 848 | result = execppp(); |
849 | 849 | ||
850 | emit debugMessage(QObject::tr("Starting pppd...")); | 850 | emit debugMessage(QObject::tr("Starting pppd...")); |
851 | qDebug("execppp() returned with return-code %i", result ); | 851 | odebug << "execppp() returned with return-code " << result << "" << oendl; |
852 | 852 | ||
853 | if(result) { | 853 | if(result) { |
854 | if(!_ifaceppp->data()->autoDNS()) | 854 | if(!_ifaceppp->data()->autoDNS()) |
855 | adddns( _ifaceppp ); | 855 | adddns( _ifaceppp ); |
856 | 856 | ||
857 | // O.K we are done here, let's change over to the if_waiting loop | 857 | // O.K we are done here, let's change over to the if_waiting loop |
858 | // where we wait for the ppp if (interface) to come up. | 858 | // where we wait for the ppp if (interface) to come up. |
859 | 859 | ||
860 | emit if_waiting_signal(); | 860 | emit if_waiting_signal(); |
861 | } else { | 861 | } else { |
862 | 862 | ||
863 | // starting pppd wasn't successful. Error messages were | 863 | // starting pppd wasn't successful. Error messages were |
@@ -1055,25 +1055,25 @@ void ConnectWidget::setExpect(const QString &n) { | |||
1055 | QString ts = QObject::tr("Expecting: %1").arg(n); | 1055 | QString ts = QObject::tr("Expecting: %1").arg(n); |
1056 | ts.replace(QRegExp("\n"), "<LF>"); | 1056 | ts.replace(QRegExp("\n"), "<LF>"); |
1057 | emit debugMessage(ts); | 1057 | emit debugMessage(ts); |
1058 | 1058 | ||
1059 | // check if the expected string is in the read buffer already. | 1059 | // check if the expected string is in the read buffer already. |
1060 | checkBuffers(); | 1060 | checkBuffers(); |
1061 | } | 1061 | } |
1062 | 1062 | ||
1063 | 1063 | ||
1064 | void ConnectWidget::if_waiting_timed_out() { | 1064 | void ConnectWidget::if_waiting_timed_out() { |
1065 | if_timer->stop(); | 1065 | if_timer->stop(); |
1066 | if_timeout_timer->stop(); | 1066 | if_timeout_timer->stop(); |
1067 | qDebug("if_waiting_timed_out()"); | 1067 | odebug << "if_waiting_timed_out()" << oendl; |
1068 | 1068 | ||
1069 | _ifaceppp->data()->setpppdError(E_IF_TIMEOUT); | 1069 | _ifaceppp->data()->setpppdError(E_IF_TIMEOUT); |
1070 | 1070 | ||
1071 | // let's kill the stuck pppd | 1071 | // let's kill the stuck pppd |
1072 | _ifaceppp->modem()->killPPPDaemon(); | 1072 | _ifaceppp->modem()->killPPPDaemon(); |
1073 | 1073 | ||
1074 | emit stopAccounting(); | 1074 | emit stopAccounting(); |
1075 | // p_kppp->con_win->stopClock(); | 1075 | // p_kppp->con_win->stopClock(); |
1076 | 1076 | ||
1077 | 1077 | ||
1078 | // killing ppp will generate a SIGCHLD which will be caught in pppdie() | 1078 | // killing ppp will generate a SIGCHLD which will be caught in pppdie() |
1079 | // in main.cpp what happens next will depend on the boolean | 1079 | // in main.cpp what happens next will depend on the boolean |
@@ -1262,25 +1262,25 @@ bool ConnectWidget::execppp() { | |||
1262 | 1262 | ||
1263 | command += " call opie-kppp logfd 11"; | 1263 | command += " call opie-kppp logfd 11"; |
1264 | 1264 | ||
1265 | if (command.length() > MAX_CMDLEN) { | 1265 | if (command.length() > MAX_CMDLEN) { |
1266 | QMessageBox::critical(this, "error", QObject::tr( | 1266 | QMessageBox::critical(this, "error", QObject::tr( |
1267 | "pppd command + command-line arguments exceed " | 1267 | "pppd command + command-line arguments exceed " |
1268 | "2024 characters in length." | 1268 | "2024 characters in length." |
1269 | )); | 1269 | )); |
1270 | 1270 | ||
1271 | return false; // nonsensically long command which would bust my buffer buf. | 1271 | return false; // nonsensically long command which would bust my buffer buf. |
1272 | } | 1272 | } |
1273 | 1273 | ||
1274 | qWarning("Command IS: %s",command.latin1() ); | 1274 | owarn << "Command IS: " << command.latin1() << "" << oendl; |
1275 | 1275 | ||
1276 | qApp->flushX(); | 1276 | qApp->flushX(); |
1277 | 1277 | ||
1278 | return _ifaceppp->modem()->execPPPDaemon(command); | 1278 | return _ifaceppp->modem()->execPPPDaemon(command); |
1279 | } | 1279 | } |
1280 | 1280 | ||
1281 | 1281 | ||
1282 | void ConnectWidget::closeEvent( QCloseEvent *e ) { | 1282 | void ConnectWidget::closeEvent( QCloseEvent *e ) { |
1283 | e->ignore(); | 1283 | e->ignore(); |
1284 | emit cancelbutton(); | 1284 | emit cancelbutton(); |
1285 | } | 1285 | } |
1286 | 1286 | ||
diff --git a/noncore/settings/networksettings/ppp/devices.cpp b/noncore/settings/networksettings/ppp/devices.cpp index 9da090d..350ff32 100644 --- a/noncore/settings/networksettings/ppp/devices.cpp +++ b/noncore/settings/networksettings/ppp/devices.cpp | |||
@@ -63,29 +63,29 @@ DevicesWidget::DevicesWidget( InterfacePPP* ip, QWidget *parent, const char *nam | |||
63 | tr("Makes a copy of the selected device. All\n" | 63 | tr("Makes a copy of the selected device. All\n" |
64 | "settings of the selected device are copied\n" | 64 | "settings of the selected device are copied\n" |
65 | "to a new device, that you can modify to fit your\n" | 65 | "to a new device, that you can modify to fit your\n" |
66 | "needs")); | 66 | "needs")); |
67 | QWhatsThis::add(delete_b, | 67 | QWhatsThis::add(delete_b, |
68 | tr("<p>Deletes the selected device\n\n" | 68 | tr("<p>Deletes the selected device\n\n" |
69 | "<font color=\"red\"><b>Use with care!</b></font>")); | 69 | "<font color=\"red\"><b>Use with care!</b></font>")); |
70 | 70 | ||
71 | copy_b->setEnabled( false ); //FIXME | 71 | copy_b->setEnabled( false ); //FIXME |
72 | // delete_b->setEnabled( false ); //FIXME | 72 | // delete_b->setEnabled( false ); //FIXME |
73 | 73 | ||
74 | QStringList tmp = _pppdata->getDevicesNamesList(); | 74 | QStringList tmp = _pppdata->getDevicesNamesList(); |
75 | qDebug("DevicesWidget::DevicesWidget got devices %s",tmp.join("--").latin1()); | 75 | odebug << "DevicesWidget::DevicesWidget got devices " << tmp.join("--").latin1() << "" << oendl; |
76 | listListbox->insertStringList(tmp); | 76 | listListbox->insertStringList(tmp); |
77 | 77 | ||
78 | for (uint i = 0; i < listListbox->count(); i++){ | 78 | for (uint i = 0; i < listListbox->count(); i++){ |
79 | qDebug("listListbox->text(i) %s == _pppdata->devname() %s",listListbox->text(i).latin1(), _pppdata->devname().latin1()); | 79 | odebug << "listListbox->text(i) " << listListbox->text(i).latin1() << " == _pppdata->devname() " << _pppdata->devname().latin1() << "" << oendl; |
80 | if ( listListbox->text(i) == _pppdata->devname() ) | 80 | if ( listListbox->text(i) == _pppdata->devname() ) |
81 | listListbox->setCurrentItem( i ); | 81 | listListbox->setCurrentItem( i ); |
82 | } | 82 | } |
83 | } | 83 | } |
84 | 84 | ||
85 | 85 | ||
86 | 86 | ||
87 | void DevicesWidget::slotListBoxSelect(int idx) { | 87 | void DevicesWidget::slotListBoxSelect(int idx) { |
88 | bool ok = _pppdata->setDevice( listListbox->text(idx) ); | 88 | bool ok = _pppdata->setDevice( listListbox->text(idx) ); |
89 | delete_b->setEnabled((bool)(idx != -1)); | 89 | delete_b->setEnabled((bool)(idx != -1)); |
90 | edit_b->setEnabled((bool)(idx != -1)); | 90 | edit_b->setEnabled((bool)(idx != -1)); |
91 | //FIXME copy_b->setEnabled((bool)(idx != -1)); | 91 | //FIXME copy_b->setEnabled((bool)(idx != -1)); |
diff --git a/noncore/settings/networksettings/ppp/general.cpp b/noncore/settings/networksettings/ppp/general.cpp index 81dab38..69bb682 100644 --- a/noncore/settings/networksettings/ppp/general.cpp +++ b/noncore/settings/networksettings/ppp/general.cpp | |||
@@ -326,25 +326,25 @@ ModemWidget::~ModemWidget() | |||
326 | // _pppdata->setModemTimeout(n); | 326 | // _pppdata->setModemTimeout(n); |
327 | // } | 327 | // } |
328 | 328 | ||
329 | 329 | ||
330 | 330 | ||
331 | bool ModemWidget::save() | 331 | bool ModemWidget::save() |
332 | { | 332 | { |
333 | //first check to make sure that the device name is unique! | 333 | //first check to make sure that the device name is unique! |
334 | if(modemname->text().isEmpty() || | 334 | if(modemname->text().isEmpty() || |
335 | !_pppdata->isUniqueDevname(modemname->text())) | 335 | !_pppdata->isUniqueDevname(modemname->text())) |
336 | return false; | 336 | return false; |
337 | 337 | ||
338 | qDebug("ModemWidget::save saving modem1 data"); | 338 | odebug << "ModemWidget::save saving modem1 data" << oendl; |
339 | _pppdata->setDevname( modemname->text() ); | 339 | _pppdata->setDevname( modemname->text() ); |
340 | _pppdata->setModemDevice( modemdevice->currentText() ); | 340 | _pppdata->setModemDevice( modemdevice->currentText() ); |
341 | _pppdata->setFlowcontrol(flowcontrol->currentText()); | 341 | _pppdata->setFlowcontrol(flowcontrol->currentText()); |
342 | _pppdata->setFlowcontrol(flowcontrol->currentText()); | 342 | _pppdata->setFlowcontrol(flowcontrol->currentText()); |
343 | _pppdata->setSpeed(baud_c->currentText()); | 343 | _pppdata->setSpeed(baud_c->currentText()); |
344 | _pppdata->setModemLockFile( modemlockfile->isChecked()); | 344 | _pppdata->setModemLockFile( modemlockfile->isChecked()); |
345 | _pppdata->setModemTimeout( modemtimeout->value() ); | 345 | _pppdata->setModemTimeout( modemtimeout->value() ); |
346 | return true; | 346 | return true; |
347 | 347 | ||
348 | } | 348 | } |
349 | 349 | ||
350 | ModemWidget2::ModemWidget2( PPPData *pd, InterfacePPP *ip, QWidget *parent, | 350 | ModemWidget2::ModemWidget2( PPPData *pd, InterfacePPP *ip, QWidget *parent, |
diff --git a/noncore/settings/networksettings/ppp/interfaceinformationppp.cpp b/noncore/settings/networksettings/ppp/interfaceinformationppp.cpp index 6b158b9..5a76293 100644 --- a/noncore/settings/networksettings/ppp/interfaceinformationppp.cpp +++ b/noncore/settings/networksettings/ppp/interfaceinformationppp.cpp | |||
@@ -11,25 +11,25 @@ | |||
11 | #ifdef QWS | 11 | #ifdef QWS |
12 | #else | 12 | #else |
13 | #define showMaximized show | 13 | #define showMaximized show |
14 | #endif | 14 | #endif |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * Constructor for the InterfaceInformationImp class. This class pretty much | 17 | * Constructor for the InterfaceInformationImp class. This class pretty much |
18 | * just display's information about the interface that is passed to it. | 18 | * just display's information about the interface that is passed to it. |
19 | */ | 19 | */ |
20 | InterfaceInformationPPP::InterfaceInformationPPP(QWidget *parent, const char *name, Interface *i, WFlags f) | 20 | InterfaceInformationPPP::InterfaceInformationPPP(QWidget *parent, const char *name, Interface *i, WFlags f) |
21 | :InterfaceInformationImp(parent, name, i, Qt::WStyle_ContextHelp) | 21 | :InterfaceInformationImp(parent, name, i, Qt::WStyle_ContextHelp) |
22 | { | 22 | { |
23 | qDebug("InterfaceInformationPPP::InterfaceInformationPPP %s", name); | 23 | odebug << "InterfaceInformationPPP::InterfaceInformationPPP " << name << "" << oendl; |
24 | con = new ConnectWidget( (InterfacePPP*)i, this, "con" ); | 24 | con = new ConnectWidget( (InterfacePPP*)i, this, "con" ); |
25 | con->setSizePolicy( QSizePolicy(QSizePolicy::MinimumExpanding, | 25 | con->setSizePolicy( QSizePolicy(QSizePolicy::MinimumExpanding, |
26 | QSizePolicy::Fixed) ); | 26 | QSizePolicy::Fixed) ); |
27 | 27 | ||
28 | macAddressLabel->hide(); | 28 | macAddressLabel->hide(); |
29 | subnetMaskLabel->hide(); | 29 | subnetMaskLabel->hide(); |
30 | broadcastLabel->hide(); | 30 | broadcastLabel->hide(); |
31 | TextLabel23->hide(); | 31 | TextLabel23->hide(); |
32 | TextLabel21->hide(); | 32 | TextLabel21->hide(); |
33 | TextLabel24->hide(); | 33 | TextLabel24->hide(); |
34 | 34 | ||
35 | InterfaceInformationLayout->addWidget( con, 1, 0 ); | 35 | InterfaceInformationLayout->addWidget( con, 1, 0 ); |
diff --git a/noncore/settings/networksettings/ppp/interfaceppp.cpp b/noncore/settings/networksettings/ppp/interfaceppp.cpp index f443f3c..5cc6f70 100644 --- a/noncore/settings/networksettings/ppp/interfaceppp.cpp +++ b/noncore/settings/networksettings/ppp/interfaceppp.cpp | |||
@@ -5,64 +5,64 @@ | |||
5 | #include <qlabel.h> | 5 | #include <qlabel.h> |
6 | 6 | ||
7 | #include "auth.h" | 7 | #include "auth.h" |
8 | #include "interfaceppp.h" | 8 | #include "interfaceppp.h" |
9 | #include "modem.h" | 9 | #include "modem.h" |
10 | #include "pppdata.h" | 10 | #include "pppdata.h" |
11 | 11 | ||
12 | InterfacePPP::InterfacePPP(QObject *parent, const char *name, bool status) | 12 | InterfacePPP::InterfacePPP(QObject *parent, const char *name, bool status) |
13 | : Interface(parent, name, status), | 13 | : Interface(parent, name, status), |
14 | _modemPtr(0), | 14 | _modemPtr(0), |
15 | _dataPtr(0) | 15 | _dataPtr(0) |
16 | { | 16 | { |
17 | qDebug("InterfacePPP::InterfacePPP("); | 17 | odebug << "InterfacePPP::InterfacePPP(" << oendl; |
18 | } | 18 | } |
19 | 19 | ||
20 | PPPData* InterfacePPP::data()const | 20 | PPPData* InterfacePPP::data()const |
21 | { | 21 | { |
22 | if (!_dataPtr){ | 22 | if (!_dataPtr){ |
23 | qDebug("creating new Data obj"); | 23 | odebug << "creating new Data obj" << oendl; |
24 | _dataPtr = new PPPData(); | 24 | _dataPtr = new PPPData(); |
25 | _dataPtr->setDevice( getInterfaceName() ); | 25 | _dataPtr->setDevice( getInterfaceName() ); |
26 | _dataPtr->setAccount( getHardwareName() ); | 26 | _dataPtr->setAccount( getHardwareName() ); |
27 | } | 27 | } |
28 | return _dataPtr; | 28 | return _dataPtr; |
29 | } | 29 | } |
30 | 30 | ||
31 | Modem* InterfacePPP::modem()const | 31 | Modem* InterfacePPP::modem()const |
32 | { | 32 | { |
33 | if (!_modemPtr){ | 33 | if (!_modemPtr){ |
34 | qDebug("creating new modem obj"); | 34 | odebug << "creating new modem obj" << oendl; |
35 | _modemPtr = new Modem( data() ); | 35 | _modemPtr = new Modem( data() ); |
36 | } | 36 | } |
37 | return _modemPtr; | 37 | return _modemPtr; |
38 | } | 38 | } |
39 | 39 | ||
40 | bool InterfacePPP::refresh() | 40 | bool InterfacePPP::refresh() |
41 | { | 41 | { |
42 | qDebug("InterfacePPP::refresh()"); | 42 | odebug << "InterfacePPP::refresh()" << oendl; |
43 | QString old = getInterfaceName(); | 43 | QString old = getInterfaceName(); |
44 | setInterfaceName( modem()->pppDevice() ); | 44 | setInterfaceName( modem()->pppDevice() ); |
45 | 45 | ||
46 | (void)Interface::refresh(); | 46 | (void)Interface::refresh(); |
47 | 47 | ||
48 | setInterfaceName( old ); | 48 | setInterfaceName( old ); |
49 | emit updateInterface(this); | 49 | emit updateInterface(this); |
50 | 50 | ||
51 | return true; | 51 | return true; |
52 | } | 52 | } |
53 | 53 | ||
54 | void InterfacePPP::start() | 54 | void InterfacePPP::start() |
55 | { | 55 | { |
56 | qDebug("InterfacePPP::start"); | 56 | odebug << "InterfacePPP::start" << oendl; |
57 | 57 | ||
58 | if (data()->password().isEmpty() && !data()->storedUsername().isEmpty() ) { | 58 | if (data()->password().isEmpty() && !data()->storedUsername().isEmpty() ) { |
59 | 59 | ||
60 | QDialog mb( 0, "Dialog", true ); | 60 | QDialog mb( 0, "Dialog", true ); |
61 | mb.setCaption( tr( "No password" ) ); | 61 | mb.setCaption( tr( "No password" ) ); |
62 | QVBoxLayout layout( &mb ); | 62 | QVBoxLayout layout( &mb ); |
63 | QLabel text ( &mb ); | 63 | QLabel text ( &mb ); |
64 | text.setText( tr("Username defined but no password\n Please enter a password") ); | 64 | text.setText( tr("Username defined but no password\n Please enter a password") ); |
65 | QLineEdit lineedit( &mb ); | 65 | QLineEdit lineedit( &mb ); |
66 | lineedit.setEchoMode( QLineEdit::Password ); | 66 | lineedit.setEchoMode( QLineEdit::Password ); |
67 | layout.addWidget( &text ); | 67 | layout.addWidget( &text ); |
68 | layout.addWidget( &lineedit ); | 68 | layout.addWidget( &lineedit ); |
@@ -134,30 +134,30 @@ void InterfacePPP::start() | |||
134 | if (data()->phonenumber().isEmpty()) { | 134 | if (data()->phonenumber().isEmpty()) { |
135 | QString s = QObject::tr("You must specify a telephone number!"); | 135 | QString s = QObject::tr("You must specify a telephone number!"); |
136 | QMessageBox::warning(0, tr("Error"), s); | 136 | QMessageBox::warning(0, tr("Error"), s); |
137 | return; | 137 | return; |
138 | } | 138 | } |
139 | 139 | ||
140 | // SEGFAULTS: | 140 | // SEGFAULTS: |
141 | // setStatus( true ); | 141 | // setStatus( true ); |
142 | // emit updateInterface((Interface*) this); | 142 | // emit updateInterface((Interface*) this); |
143 | 143 | ||
144 | emit begin_connect(); | 144 | emit begin_connect(); |
145 | 145 | ||
146 | qDebug("InterfacePPP::start END"); | 146 | odebug << "InterfacePPP::start END" << oendl; |
147 | } | 147 | } |
148 | 148 | ||
149 | void InterfacePPP::stop() | 149 | void InterfacePPP::stop() |
150 | { | 150 | { |
151 | qDebug("InterfacePPP::stop"); | 151 | odebug << "InterfacePPP::stop" << oendl; |
152 | // emit hangup_now(); | 152 | // emit hangup_now(); |
153 | status = false; // not connected | 153 | status = false; // not connected |
154 | setStatus( false ); | 154 | setStatus( false ); |
155 | emit hangup_now(); | 155 | emit hangup_now(); |
156 | refresh(); | 156 | refresh(); |
157 | 157 | ||
158 | } | 158 | } |
159 | 159 | ||
160 | void InterfacePPP::save() | 160 | void InterfacePPP::save() |
161 | { | 161 | { |
162 | data()->save(); | 162 | data()->save(); |
163 | emit updateInterface((Interface*) this); | 163 | emit updateInterface((Interface*) this); |
diff --git a/noncore/settings/networksettings/ppp/kpppwidget.cpp b/noncore/settings/networksettings/ppp/kpppwidget.cpp index e21bbc7..fd09332 100644 --- a/noncore/settings/networksettings/ppp/kpppwidget.cpp +++ b/noncore/settings/networksettings/ppp/kpppwidget.cpp | |||
@@ -65,31 +65,31 @@ | |||
65 | #define execute_command system | 65 | #define execute_command system |
66 | 66 | ||
67 | KPPPWidget *p_kppp = 0; | 67 | KPPPWidget *p_kppp = 0; |
68 | 68 | ||
69 | KPPPWidget::KPPPWidget(PPPData*pd, Interface *i, QWidget *parent, const char *name, bool modal, WFlags fl ) | 69 | KPPPWidget::KPPPWidget(PPPData*pd, Interface *i, QWidget *parent, const char *name, bool modal, WFlags fl ) |
70 | : QDialog(parent, name, modal, Qt::WStyle_ContextHelp ), _pppdata(pd) | 70 | : QDialog(parent, name, modal, Qt::WStyle_ContextHelp ), _pppdata(pd) |
71 | { | 71 | { |
72 | // tabWindow = 0; | 72 | // tabWindow = 0; |
73 | p_kppp = this; | 73 | p_kppp = this; |
74 | // before doing anything else, run a few tests | 74 | // before doing anything else, run a few tests |
75 | if (!_pppdata->setModemDevice( i->getInterfaceName() )) | 75 | if (!_pppdata->setModemDevice( i->getInterfaceName() )) |
76 | _pppdata->setModemDevice("/dev/modem"); | 76 | _pppdata->setModemDevice("/dev/modem"); |
77 | qDebug("PPPConfigWidget::PPPConfigWidget"); | 77 | odebug << "PPPConfigWidget::PPPConfigWidget" << oendl; |
78 | qDebug(" interface->getHardwareName >%s<", i->getHardwareName().latin1()); | 78 | odebug << " interface->getHardwareName >" << i->getHardwareName().latin1() << "<" << oendl; |
79 | if (!_pppdata->setAccount( i->getHardwareName() )) | 79 | if (!_pppdata->setAccount( i->getHardwareName() )) |
80 | _pppdata->setAccount( 0 ); | 80 | _pppdata->setAccount( 0 ); |
81 | 81 | ||
82 | qDebug(" _pppdata->accname >%s<",_pppdata->accname().latin1()); | 82 | odebug << " _pppdata->accname >" << _pppdata->accname().latin1() << "<" << oendl; |
83 | qDebug(" _pppdata->currentAccountID() >%i<",_pppdata->currentAccountID()); | 83 | odebug << " _pppdata->currentAccountID() >" << _pppdata->currentAccountID() << "<" << oendl; |
84 | 84 | ||
85 | int result = runTests(); | 85 | int result = runTests(); |
86 | if(result == TEST_CRITICAL) | 86 | if(result == TEST_CRITICAL) |
87 | exit(4); | 87 | exit(4); |
88 | 88 | ||
89 | // installEventFilter(this); | 89 | // installEventFilter(this); |
90 | 90 | ||
91 | QVBoxLayout *tl = new QVBoxLayout(this, 10, 10); | 91 | QVBoxLayout *tl = new QVBoxLayout(this, 10, 10); |
92 | 92 | ||
93 | QGridLayout *l1 = new QGridLayout(3, 4); | 93 | QGridLayout *l1 = new QGridLayout(3, 4); |
94 | tl->addLayout(l1); | 94 | tl->addLayout(l1); |
95 | l1->addColSpacing(0, 10); | 95 | l1->addColSpacing(0, 10); |
@@ -296,25 +296,25 @@ KPPPWidget::KPPPWidget(PPPData*pd, Interface *i, QWidget *parent, const char *na | |||
296 | } | 296 | } |
297 | 297 | ||
298 | KPPPWidget::~KPPPWidget() | 298 | KPPPWidget::~KPPPWidget() |
299 | { | 299 | { |
300 | p_kppp = 0; | 300 | p_kppp = 0; |
301 | // delete stats; | 301 | // delete stats; |
302 | } | 302 | } |
303 | 303 | ||
304 | // bool KPPPWidget::eventFilter(QObject *o, QEvent *e) { | 304 | // bool KPPPWidget::eventFilter(QObject *o, QEvent *e) { |
305 | // if(e->type() == QEvent::User) { | 305 | // if(e->type() == QEvent::User) { |
306 | // switch(((SignalEvent*)e)->sigType()) { | 306 | // switch(((SignalEvent*)e)->sigType()) { |
307 | // case SIGINT: | 307 | // case SIGINT: |
308 | // qDebug( "Received a SIGINT" ); | 308 | // odebug << "Received a SIGINT" << oendl; |
309 | // interruptConnection(); | 309 | // interruptConnection(); |
310 | // break; | 310 | // break; |
311 | // case SIGCHLD: | 311 | // case SIGCHLD: |
312 | // sigChld(); | 312 | // sigChld(); |
313 | // break; | 313 | // break; |
314 | // case SIGUSR1: | 314 | // case SIGUSR1: |
315 | // sigPPPDDied(); | 315 | // sigPPPDDied(); |
316 | // break; | 316 | // break; |
317 | // } | 317 | // } |
318 | // return true; | 318 | // return true; |
319 | // } | 319 | // } |
320 | 320 | ||
@@ -414,44 +414,44 @@ void KPPPWidget::interruptConnection() { | |||
414 | // | 414 | // |
415 | 415 | ||
416 | if (con->isVisible()) | 416 | if (con->isVisible()) |
417 | emit con->cancelbutton(); | 417 | emit con->cancelbutton(); |
418 | 418 | ||
419 | // disconnect if online | 419 | // disconnect if online |
420 | if (_pppdata->pppdRunning()) | 420 | if (_pppdata->pppdRunning()) |
421 | emit disconnect(); | 421 | emit disconnect(); |
422 | } | 422 | } |
423 | 423 | ||
424 | 424 | ||
425 | void KPPPWidget::sigPPPDDied() { | 425 | void KPPPWidget::sigPPPDDied() { |
426 | qDebug( "Received a SIGUSR1" ); | 426 | odebug << "Received a SIGUSR1" << oendl; |
427 | 427 | ||
428 | // if we are not connected pppdpid is -1 so have have to check for that | 428 | // if we are not connected pppdpid is -1 so have have to check for that |
429 | // in the followin line to make sure that we don't raise a false alarm | 429 | // in the followin line to make sure that we don't raise a false alarm |
430 | // such as would be the case when the log file viewer exits. | 430 | // such as would be the case when the log file viewer exits. |
431 | if(_pppdata->pppdRunning() || _pppdata->pppdError()) { | 431 | if(_pppdata->pppdRunning() || _pppdata->pppdError()) { |
432 | qDebug( "It was pppd that died" ); | 432 | odebug << "It was pppd that died" << oendl; |
433 | 433 | ||
434 | // when we killpppd() on Cancel in ConnectWidget | 434 | // when we killpppd() on Cancel in ConnectWidget |
435 | // we set pppid to -1 so we won't | 435 | // we set pppid to -1 so we won't |
436 | // enter this block | 436 | // enter this block |
437 | 437 | ||
438 | // just to be sure | 438 | // just to be sure |
439 | 439 | ||
440 | Modem::modem->removeSecret(AUTH_PAP); | 440 | Modem::modem->removeSecret(AUTH_PAP); |
441 | Modem::modem->removeSecret(AUTH_CHAP); | 441 | Modem::modem->removeSecret(AUTH_CHAP); |
442 | 442 | ||
443 | _pppdata->setpppdRunning(false); | 443 | _pppdata->setpppdRunning(false); |
444 | 444 | ||
445 | qDebug( "Executing command on disconnect since pppd has died." ); | 445 | odebug << "Executing command on disconnect since pppd has died." << oendl; |
446 | QApplication::flushX(); | 446 | QApplication::flushX(); |
447 | execute_command(_pppdata->command_on_disconnect()); | 447 | execute_command(_pppdata->command_on_disconnect()); |
448 | 448 | ||
449 | // stopAccounting(); | 449 | // stopAccounting(); |
450 | 450 | ||
451 | con_win->stopClock(); | 451 | con_win->stopClock(); |
452 | // DockWidget::dock_widget->stop_stats(); | 452 | // DockWidget::dock_widget->stop_stats(); |
453 | // DockWidget::dock_widget->hide(); | 453 | // DockWidget::dock_widget->hide(); |
454 | 454 | ||
455 | if(!_pppdata->pppdError()) | 455 | if(!_pppdata->pppdError()) |
456 | _pppdata->setpppdError(E_PPPD_DIED); | 456 | _pppdata->setpppdError(E_PPPD_DIED); |
457 | removedns(); | 457 | removedns(); |
@@ -480,47 +480,47 @@ void KPPPWidget::sigPPPDDied() { | |||
480 | msg += QObject::tr("<p>Exit status: %1").arg(Modem::modem->lastStatus); | 480 | msg += QObject::tr("<p>Exit status: %1").arg(Modem::modem->lastStatus); |
481 | msg += QObject::tr("</p><p>See 'man pppd' for an explanation of the error " | 481 | msg += QObject::tr("</p><p>See 'man pppd' for an explanation of the error " |
482 | "codes or take a look at the kppp FAQ on " | 482 | "codes or take a look at the kppp FAQ on " |
483 | " <a href=http://devel-home.kde.org/~kppp/index.html>" | 483 | " <a href=http://devel-home.kde.org/~kppp/index.html>" |
484 | "http://devel-home.kde.org/~kppp/index.html</a></p>"); | 484 | "http://devel-home.kde.org/~kppp/index.html</a></p>"); |
485 | } | 485 | } |
486 | } | 486 | } |
487 | 487 | ||
488 | // if(QMessageBox::warning(0, msg, QObject::tr("Error"), QObject::tr("&OK"), QObject::tr("&Details...")) == QMessageBox::No) | 488 | // if(QMessageBox::warning(0, msg, QObject::tr("Error"), QObject::tr("&OK"), QObject::tr("&Details...")) == QMessageBox::No) |
489 | // // PPPL_ShowLog(); | 489 | // // PPPL_ShowLog(); |
490 | // } else { /* reconnect on disconnect */ | 490 | // } else { /* reconnect on disconnect */ |
491 | if (false){ | 491 | if (false){ |
492 | qDebug( "Trying to reconnect... " ); | 492 | odebug << "Trying to reconnect... " << oendl; |
493 | 493 | ||
494 | if(_pppdata->authMethod() == AUTH_PAP || | 494 | if(_pppdata->authMethod() == AUTH_PAP || |
495 | _pppdata->authMethod() == AUTH_CHAP || | 495 | _pppdata->authMethod() == AUTH_CHAP || |
496 | _pppdata->authMethod() == AUTH_PAPCHAP) | 496 | _pppdata->authMethod() == AUTH_PAPCHAP) |
497 | Modem::modem->setSecret(_pppdata->authMethod(), | 497 | Modem::modem->setSecret(_pppdata->authMethod(), |
498 | encodeWord(_pppdata->storedUsername()), | 498 | encodeWord(_pppdata->storedUsername()), |
499 | encodeWord(_pppdata->password())); | 499 | encodeWord(_pppdata->password())); |
500 | 500 | ||
501 | con_win->hide(); | 501 | con_win->hide(); |
502 | con_win->stopClock(); | 502 | con_win->stopClock(); |
503 | //stopAccounting(); | 503 | //stopAccounting(); |
504 | _pppdata->setpppdRunning(false); | 504 | _pppdata->setpppdRunning(false); |
505 | // not in a signal handler !!!KNotifyClient::beep(); | 505 | // not in a signal handler !!!KNotifyClient::beep(); |
506 | emit cmdl_start(); | 506 | emit cmdl_start(); |
507 | } | 507 | } |
508 | } | 508 | } |
509 | _pppdata->setpppdError(0); | 509 | _pppdata->setpppdError(0); |
510 | } | 510 | } |
511 | } | 511 | } |
512 | 512 | ||
513 | // void KPPPWidget::sigChld() { | 513 | // void KPPPWidget::sigChld() { |
514 | // qDebug( "sigchld()" ); | 514 | // odebug << "sigchld()" << oendl; |
515 | // // pid_t id = wait(0L); | 515 | // // pid_t id = wait(0L); |
516 | // // if(id == helperPid && helperPid != -1) { | 516 | // // if(id == helperPid && helperPid != -1) { |
517 | // // kdDebug(5002) << "It was the setuid child that died" << endl; | 517 | // // kdDebug(5002) << "It was the setuid child that died" << endl; |
518 | // // helperPid = -1; | 518 | // // helperPid = -1; |
519 | // QString msg = QObject::tr("kppp's helper process just died.\n" | 519 | // QString msg = QObject::tr("kppp's helper process just died.\n" |
520 | // "Since a further execution would be pointless, " | 520 | // "Since a further execution would be pointless, " |
521 | // "kppp will shut down now."); | 521 | // "kppp will shut down now."); |
522 | // QMessageBox::warning(0L,"error", msg); | 522 | // QMessageBox::warning(0L,"error", msg); |
523 | // //remove_pidfile(); | 523 | // //remove_pidfile(); |
524 | // exit(1); | 524 | // exit(1); |
525 | // // } | 525 | // // } |
526 | // } | 526 | // } |
diff --git a/noncore/settings/networksettings/ppp/modem.cpp b/noncore/settings/networksettings/ppp/modem.cpp index 3dbc8c3..f3f2639 100644 --- a/noncore/settings/networksettings/ppp/modem.cpp +++ b/noncore/settings/networksettings/ppp/modem.cpp | |||
@@ -46,25 +46,25 @@ | |||
46 | #ifndef _PATH_RESCONF | 46 | #ifndef _PATH_RESCONF |
47 | #define _PATH_RESCONF "/etc/resolv.conf" | 47 | #define _PATH_RESCONF "/etc/resolv.conf" |
48 | #endif | 48 | #endif |
49 | 49 | ||
50 | #define strlcpy strcpy | 50 | #define strlcpy strcpy |
51 | #include "auth.h" | 51 | #include "auth.h" |
52 | #include "modem.h" | 52 | #include "modem.h" |
53 | #include "pppdata.h" | 53 | #include "pppdata.h" |
54 | #define qError qDebug | 54 | #define qError qDebug |
55 | 55 | ||
56 | 56 | ||
57 | #define MY_ASSERT(x) if (!(x)) { \ | 57 | #define MY_ASSERT(x) if (!(x)) { \ |
58 | qFatal( "ASSERT: \"%s\" in %s (%d)\n",#x,__FILE__,__LINE__); \ | 58 | ofatal << "ASSERT: \"" << #x << "\" in " << __FILE__ << " (" << __LINE__ << ")\n" << oendl; \ |
59 | exit(1); } | 59 | exit(1); } |
60 | 60 | ||
61 | 61 | ||
62 | static sigjmp_buf jmp_buffer; | 62 | static sigjmp_buf jmp_buffer; |
63 | 63 | ||
64 | //Modem *Modem::modem = 0; | 64 | //Modem *Modem::modem = 0; |
65 | 65 | ||
66 | 66 | ||
67 | const char* pppdPath() { | 67 | const char* pppdPath() { |
68 | // wasting a few bytes | 68 | // wasting a few bytes |
69 | static char buffer[sizeof(PPPDSEARCHPATH)+sizeof(PPPDNAME)]; | 69 | static char buffer[sizeof(PPPDSEARCHPATH)+sizeof(PPPDNAME)]; |
70 | static char *pppdPath = 0L; | 70 | static char *pppdPath = 0L; |
@@ -156,25 +156,25 @@ speed_t Modem::modemspeed() { | |||
156 | return B38400; | 156 | return B38400; |
157 | break; | 157 | break; |
158 | } | 158 | } |
159 | } | 159 | } |
160 | 160 | ||
161 | bool Modem::opentty() { | 161 | bool Modem::opentty() { |
162 | // int flags; | 162 | // int flags; |
163 | 163 | ||
164 | //begin if((modemfd = Requester::rq->openModem(gpppdata.modemDevice()))<0) { | 164 | //begin if((modemfd = Requester::rq->openModem(gpppdata.modemDevice()))<0) { |
165 | close(modemfd); | 165 | close(modemfd); |
166 | device = _pppdata->modemDevice(); | 166 | device = _pppdata->modemDevice(); |
167 | if ((modemfd = open(device, O_RDWR|O_NDELAY|O_NOCTTY)) == -1) { | 167 | if ((modemfd = open(device, O_RDWR|O_NDELAY|O_NOCTTY)) == -1) { |
168 | qDebug("error opening modem device !"); | 168 | odebug << "error opening modem device !" << oendl; |
169 | errmsg = QObject::tr("Unable to open modem."); | 169 | errmsg = QObject::tr("Unable to open modem."); |
170 | return false; | 170 | return false; |
171 | } | 171 | } |
172 | //bend if((modemfd = Requester::rq->openModem(gpppdata.modemDevice()))<0) { | 172 | //bend if((modemfd = Requester::rq->openModem(gpppdata.modemDevice()))<0) { |
173 | //} | 173 | //} |
174 | 174 | ||
175 | #if 0 | 175 | #if 0 |
176 | if(_pppdata->UseCDLine()) { | 176 | if(_pppdata->UseCDLine()) { |
177 | if(ioctl(modemfd, TIOCMGET, &flags) == -1) { | 177 | if(ioctl(modemfd, TIOCMGET, &flags) == -1) { |
178 | errmsg = QObject::tr("Unable to detect state of CD line."); | 178 | errmsg = QObject::tr("Unable to detect state of CD line."); |
179 | ::close(modemfd); | 179 | ::close(modemfd); |
180 | modemfd = -1; | 180 | modemfd = -1; |
@@ -297,56 +297,56 @@ void Modem::notify(const QObject *receiver, const char *member) { | |||
297 | 297 | ||
298 | void Modem::stop() { | 298 | void Modem::stop() { |
299 | disconnect(SIGNAL(charWaiting(unsigned char))); | 299 | disconnect(SIGNAL(charWaiting(unsigned char))); |
300 | stopNotifier(); | 300 | stopNotifier(); |
301 | } | 301 | } |
302 | 302 | ||
303 | 303 | ||
304 | void Modem::startNotifier() { | 304 | void Modem::startNotifier() { |
305 | if(modemfd >= 0) { | 305 | if(modemfd >= 0) { |
306 | if(sn == 0) { | 306 | if(sn == 0) { |
307 | sn = new QSocketNotifier(modemfd, QSocketNotifier::Read, this); | 307 | sn = new QSocketNotifier(modemfd, QSocketNotifier::Read, this); |
308 | connect(sn, SIGNAL(activated(int)), SLOT(readtty(int))); | 308 | connect(sn, SIGNAL(activated(int)), SLOT(readtty(int))); |
309 | qDebug("QSocketNotifier started!"); | 309 | odebug << "QSocketNotifier started!" << oendl; |
310 | } else { | 310 | } else { |
311 | qDebug("QSocketNotifier re-enabled!"); | 311 | odebug << "QSocketNotifier re-enabled!" << oendl; |
312 | sn->setEnabled(true); | 312 | sn->setEnabled(true); |
313 | } | 313 | } |
314 | } | 314 | } |
315 | } | 315 | } |
316 | 316 | ||
317 | 317 | ||
318 | void Modem::stopNotifier() { | 318 | void Modem::stopNotifier() { |
319 | if(sn != 0) { | 319 | if(sn != 0) { |
320 | sn->setEnabled(false); | 320 | sn->setEnabled(false); |
321 | disconnect(sn); | 321 | disconnect(sn); |
322 | delete sn; | 322 | delete sn; |
323 | sn = 0; | 323 | sn = 0; |
324 | qDebug( "QSocketNotifier stopped!" ); | 324 | odebug << "QSocketNotifier stopped!" << oendl; |
325 | } | 325 | } |
326 | } | 326 | } |
327 | 327 | ||
328 | 328 | ||
329 | void Modem::flush() { | 329 | void Modem::flush() { |
330 | char c; | 330 | char c; |
331 | while(read(modemfd, &c, 1) == 1); | 331 | while(read(modemfd, &c, 1) == 1); |
332 | } | 332 | } |
333 | 333 | ||
334 | 334 | ||
335 | bool Modem::writeChar(unsigned char c) { | 335 | bool Modem::writeChar(unsigned char c) { |
336 | int s; | 336 | int s; |
337 | do { | 337 | do { |
338 | s = write(modemfd, &c, 1); | 338 | s = write(modemfd, &c, 1); |
339 | if (s < 0) { | 339 | if (s < 0) { |
340 | qError( "write() in Modem::writeChar failed" ); | 340 | oerr << "write() in Modem::writeChar failed" << oendl; |
341 | return false; | 341 | return false; |
342 | } | 342 | } |
343 | } while(s == 0); | 343 | } while(s == 0); |
344 | 344 | ||
345 | return true; | 345 | return true; |
346 | } | 346 | } |
347 | 347 | ||
348 | 348 | ||
349 | bool Modem::writeLine(const char *buf) { | 349 | bool Modem::writeLine(const char *buf) { |
350 | int len = strlen(buf); | 350 | int len = strlen(buf); |
351 | char *b = new char[len+2]; | 351 | char *b = new char[len+2]; |
352 | memcpy(b, buf, len); | 352 | memcpy(b, buf, len); |
@@ -356,25 +356,25 @@ bool Modem::writeLine(const char *buf) { | |||
356 | b[len++]='\n'; | 356 | b[len++]='\n'; |
357 | else if(term == "CR") | 357 | else if(term == "CR") |
358 | b[len++]='\r'; | 358 | b[len++]='\r'; |
359 | else if(term == "CR/LF") { | 359 | else if(term == "CR/LF") { |
360 | b[len++]='\r'; | 360 | b[len++]='\r'; |
361 | b[len++]='\n'; | 361 | b[len++]='\n'; |
362 | } | 362 | } |
363 | int l = len; | 363 | int l = len; |
364 | while(l) { | 364 | while(l) { |
365 | int wr = write(modemfd, &b[len-l], l); | 365 | int wr = write(modemfd, &b[len-l], l); |
366 | if(wr < 0) { | 366 | if(wr < 0) { |
367 | // TODO do something meaningful with the error code (or ignore it | 367 | // TODO do something meaningful with the error code (or ignore it |
368 | qError( "write() in Modem::writeLine failed" ); | 368 | oerr << "write() in Modem::writeLine failed" << oendl; |
369 | delete[] b; | 369 | delete[] b; |
370 | return false; | 370 | return false; |
371 | } | 371 | } |
372 | l -= wr; | 372 | l -= wr; |
373 | } | 373 | } |
374 | delete[] b; | 374 | delete[] b; |
375 | return true; | 375 | return true; |
376 | } | 376 | } |
377 | 377 | ||
378 | 378 | ||
379 | bool Modem::hangup() { | 379 | bool Modem::hangup() { |
380 | // this should really get the modem to hang up and go into command mode | 380 | // this should really get the modem to hang up and go into command mode |
@@ -465,25 +465,25 @@ void Modem::escape_to_command_mode() { | |||
465 | const QString Modem::modemMessage() { | 465 | const QString Modem::modemMessage() { |
466 | return errmsg; | 466 | return errmsg; |
467 | } | 467 | } |
468 | 468 | ||
469 | 469 | ||
470 | QString Modem::parseModemSpeed(const QString &s) { | 470 | QString Modem::parseModemSpeed(const QString &s) { |
471 | // this is a small (and bad) parser for modem speeds | 471 | // this is a small (and bad) parser for modem speeds |
472 | int rx = -1; | 472 | int rx = -1; |
473 | int tx = -1; | 473 | int tx = -1; |
474 | int i; | 474 | int i; |
475 | QString result; | 475 | QString result; |
476 | 476 | ||
477 | qDebug( "Modem reported result string: %s", s.latin1()); | 477 | odebug << "Modem reported result string: " << s.latin1() << "" << oendl; |
478 | 478 | ||
479 | const int RXMAX = 7; | 479 | const int RXMAX = 7; |
480 | const int TXMAX = 2; | 480 | const int TXMAX = 2; |
481 | QRegExp rrx[RXMAX] = { | 481 | QRegExp rrx[RXMAX] = { |
482 | QRegExp("[0-9]+[:/ ]RX", false), | 482 | QRegExp("[0-9]+[:/ ]RX", false), |
483 | QRegExp("[0-9]+RX", false), | 483 | QRegExp("[0-9]+RX", false), |
484 | QRegExp("[/: -][0-9]+[/: ]", false), | 484 | QRegExp("[/: -][0-9]+[/: ]", false), |
485 | QRegExp("[/: -][0-9]+$", false), | 485 | QRegExp("[/: -][0-9]+$", false), |
486 | QRegExp("CARRIER [^0-9]*[0-9]+", false), | 486 | QRegExp("CARRIER [^0-9]*[0-9]+", false), |
487 | QRegExp("CONNECT [^0-9]*[0-9]+", false), | 487 | QRegExp("CONNECT [^0-9]*[0-9]+", false), |
488 | QRegExp("[0-9]+") // panic mode | 488 | QRegExp("[0-9]+") // panic mode |
489 | }; | 489 | }; |
@@ -551,131 +551,131 @@ QString Modem::parseModemSpeed(const QString &s) { | |||
551 | } | 551 | } |
552 | } | 552 | } |
553 | 553 | ||
554 | if(rx == -1 && tx == -1) | 554 | if(rx == -1 && tx == -1) |
555 | result = QObject::tr("Unknown speed"); | 555 | result = QObject::tr("Unknown speed"); |
556 | else if(tx == -1) | 556 | else if(tx == -1) |
557 | result.setNum(rx); | 557 | result.setNum(rx); |
558 | else if(rx == -1) // should not happen | 558 | else if(rx == -1) // should not happen |
559 | result.setNum(tx); | 559 | result.setNum(tx); |
560 | else | 560 | else |
561 | result.sprintf("%d/%d", rx, tx); | 561 | result.sprintf("%d/%d", rx, tx); |
562 | 562 | ||
563 | qDebug( "The parsed result is: %s", result.latin1()); | 563 | odebug << "The parsed result is: " << result.latin1() << "" << oendl; |
564 | 564 | ||
565 | return result; | 565 | return result; |
566 | } | 566 | } |
567 | 567 | ||
568 | 568 | ||
569 | // Lock modem device. Returns 0 on success 1 if the modem is locked and -1 if | 569 | // Lock modem device. Returns 0 on success 1 if the modem is locked and -1 if |
570 | // a lock file can't be created ( permission problem ) | 570 | // a lock file can't be created ( permission problem ) |
571 | int Modem::lockdevice() { | 571 | int Modem::lockdevice() { |
572 | int fd; | 572 | int fd; |
573 | char newlock[80]=""; // safe | 573 | char newlock[80]=""; // safe |
574 | 574 | ||
575 | if(!_pppdata->modemLockFile()) { | 575 | if(!_pppdata->modemLockFile()) { |
576 | qDebug("The user doesn't want a lockfile."); | 576 | odebug << "The user doesn't want a lockfile." << oendl; |
577 | return 0; | 577 | return 0; |
578 | } | 578 | } |
579 | 579 | ||
580 | if (modem_is_locked) | 580 | if (modem_is_locked) |
581 | return 1; | 581 | return 1; |
582 | 582 | ||
583 | QString lockfile = LOCK_DIR"/LCK.."; | 583 | QString lockfile = LOCK_DIR"/LCK.."; |
584 | lockfile += _pppdata->modemDevice().mid(5); // append everything after /dev/ | 584 | lockfile += _pppdata->modemDevice().mid(5); // append everything after /dev/ |
585 | 585 | ||
586 | if(access(QFile::encodeName(lockfile), F_OK) == 0) { | 586 | if(access(QFile::encodeName(lockfile), F_OK) == 0) { |
587 | // if ((fd = Requester::rq-> | 587 | // if ((fd = Requester::rq-> |
588 | if ((fd = openLockfile(QFile::encodeName(lockfile), O_RDONLY)) >= 0) { | 588 | if ((fd = openLockfile(QFile::encodeName(lockfile), O_RDONLY)) >= 0) { |
589 | // Mario: it's not necessary to read more than lets say 32 bytes. If | 589 | // Mario: it's not necessary to read more than lets say 32 bytes. If |
590 | // file has more than 32 bytes, skip the rest | 590 | // file has more than 32 bytes, skip the rest |
591 | char oldlock[33]; // safe | 591 | char oldlock[33]; // safe |
592 | int sz = read(fd, &oldlock, 32); | 592 | int sz = read(fd, &oldlock, 32); |
593 | close (fd); | 593 | close (fd); |
594 | if (sz <= 0) | 594 | if (sz <= 0) |
595 | return 1; | 595 | return 1; |
596 | oldlock[sz] = '\0'; | 596 | oldlock[sz] = '\0'; |
597 | 597 | ||
598 | qDebug( "Device is locked by: %s", oldlock); | 598 | odebug << "Device is locked by: " << oldlock << "" << oendl; |
599 | 599 | ||
600 | int oldpid; | 600 | int oldpid; |
601 | int match = sscanf(oldlock, "%d", &oldpid); | 601 | int match = sscanf(oldlock, "%d", &oldpid); |
602 | 602 | ||
603 | // found a pid in lockfile ? | 603 | // found a pid in lockfile ? |
604 | if (match < 1 || oldpid <= 0) | 604 | if (match < 1 || oldpid <= 0) |
605 | return 1; | 605 | return 1; |
606 | 606 | ||
607 | // check if process exists | 607 | // check if process exists |
608 | if (kill((pid_t)oldpid, 0) == 0 || errno != ESRCH) | 608 | if (kill((pid_t)oldpid, 0) == 0 || errno != ESRCH) |
609 | return 1; | 609 | return 1; |
610 | 610 | ||
611 | qDebug( "lockfile is stale" ); | 611 | odebug << "lockfile is stale" << oendl; |
612 | } | 612 | } |
613 | } | 613 | } |
614 | 614 | ||
615 | fd = openLockfile(_pppdata->modemDevice(),O_WRONLY|O_TRUNC|O_CREAT); | 615 | fd = openLockfile(_pppdata->modemDevice(),O_WRONLY|O_TRUNC|O_CREAT); |
616 | if(fd >= 0) { | 616 | if(fd >= 0) { |
617 | sprintf(newlock,"%010d\n", getpid()); | 617 | sprintf(newlock,"%010d\n", getpid()); |
618 | qDebug("Locking Device: %s", newlock); | 618 | odebug << "Locking Device: " << newlock << "" << oendl; |
619 | 619 | ||
620 | write(fd, newlock, strlen(newlock)); | 620 | write(fd, newlock, strlen(newlock)); |
621 | close(fd); | 621 | close(fd); |
622 | modem_is_locked=true; | 622 | modem_is_locked=true; |
623 | 623 | ||
624 | return 0; | 624 | return 0; |
625 | } | 625 | } |
626 | 626 | ||
627 | return -1; | 627 | return -1; |
628 | 628 | ||
629 | } | 629 | } |
630 | 630 | ||
631 | 631 | ||
632 | // UnLock modem device | 632 | // UnLock modem device |
633 | void Modem::unlockdevice() { | 633 | void Modem::unlockdevice() { |
634 | if (modem_is_locked) { | 634 | if (modem_is_locked) { |
635 | qDebug( "UnLocking Modem Device" ); | 635 | odebug << "UnLocking Modem Device" << oendl; |
636 | close(modemfd); | 636 | close(modemfd); |
637 | modemfd = -1; | 637 | modemfd = -1; |
638 | unlink(lockfile); | 638 | unlink(lockfile); |
639 | lockfile[0] = '\0'; | 639 | lockfile[0] = '\0'; |
640 | modem_is_locked=false; | 640 | modem_is_locked=false; |
641 | } | 641 | } |
642 | } | 642 | } |
643 | 643 | ||
644 | int Modem::openLockfile( QString lockfile, int flags) | 644 | int Modem::openLockfile( QString lockfile, int flags) |
645 | { | 645 | { |
646 | int fd; | 646 | int fd; |
647 | int mode; | 647 | int mode; |
648 | flags = O_RDONLY; | 648 | flags = O_RDONLY; |
649 | if(flags == O_WRONLY|O_TRUNC|O_CREAT) | 649 | if(flags == O_WRONLY|O_TRUNC|O_CREAT) |
650 | mode = 0644; | 650 | mode = 0644; |
651 | else | 651 | else |
652 | mode = 0; | 652 | mode = 0; |
653 | 653 | ||
654 | lockfile = LOCK_DIR; | 654 | lockfile = LOCK_DIR; |
655 | lockfile += "/LCK.."; | 655 | lockfile += "/LCK.."; |
656 | lockfile += device.right( device.length() - device.findRev("/") -1 ); | 656 | lockfile += device.right( device.length() - device.findRev("/") -1 ); |
657 | qDebug("lockfile >%s<",lockfile.latin1()); | 657 | odebug << "lockfile >" << lockfile.latin1() << "<" << oendl; |
658 | // TODO: | 658 | // TODO: |
659 | // struct stat st; | 659 | // struct stat st; |
660 | // if(stat(lockfile.data(), &st) == -1) { | 660 | // if(stat(lockfile.data(), &st) == -1) { |
661 | // if(errno == EBADF) | 661 | // if(errno == EBADF) |
662 | // return -1; | 662 | // return -1; |
663 | // } else { | 663 | // } else { |
664 | // // make sure that this is a regular file | 664 | // // make sure that this is a regular file |
665 | // if(!S_ISREG(st.st_mode)) | 665 | // if(!S_ISREG(st.st_mode)) |
666 | // return -1; | 666 | // return -1; |
667 | // } | 667 | // } |
668 | if ((fd = open(lockfile, flags, mode)) == -1) { | 668 | if ((fd = open(lockfile, flags, mode)) == -1) { |
669 | qDebug("error opening lockfile!"); | 669 | odebug << "error opening lockfile!" << oendl; |
670 | lockfile = QString::null; | 670 | lockfile = QString::null; |
671 | fd = open(DEVNULL, O_RDONLY); | 671 | fd = open(DEVNULL, O_RDONLY); |
672 | } else | 672 | } else |
673 | fchown(fd, 0, 0); | 673 | fchown(fd, 0, 0); |
674 | return fd; | 674 | return fd; |
675 | } | 675 | } |
676 | 676 | ||
677 | 677 | ||
678 | 678 | ||
679 | void alarm_handler(int) { | 679 | void alarm_handler(int) { |
680 | // fprintf(stderr, "alarm_handler(): Received SIGALRM\n"); | 680 | // fprintf(stderr, "alarm_handler(): Received SIGALRM\n"); |
681 | 681 | ||
@@ -918,60 +918,60 @@ bool Modem::execpppd(const char *arguments) { | |||
918 | fprintf(stderr, "Kernel does not support ppp, oops.\n"); | 918 | fprintf(stderr, "Kernel does not support ppp, oops.\n"); |
919 | break; | 919 | break; |
920 | case 0: | 920 | case 0: |
921 | fprintf(stderr, "Kernel supports ppp alright.\n"); | 921 | fprintf(stderr, "Kernel supports ppp alright.\n"); |
922 | break; | 922 | break; |
923 | } | 923 | } |
924 | 924 | ||
925 | execve(pppdPath(), args, 0L); | 925 | execve(pppdPath(), args, 0L); |
926 | _exit(0); | 926 | _exit(0); |
927 | break; | 927 | break; |
928 | 928 | ||
929 | default: | 929 | default: |
930 | qDebug("In parent: pppd pid %d\n",pppdPid); | 930 | odebug << "In parent: pppd pid " << pppdPid << "\n" << oendl; |
931 | close(modemfd); | 931 | close(modemfd); |
932 | 932 | ||
933 | ::close( m_pppdLOG[1] ); | 933 | ::close( m_pppdLOG[1] ); |
934 | // set it to nonblocking io | 934 | // set it to nonblocking io |
935 | int flag = ::fcntl( m_pppdLOG[0], F_GETFL ); | 935 | int flag = ::fcntl( m_pppdLOG[0], F_GETFL ); |
936 | 936 | ||
937 | if ( !(flag & O_NONBLOCK) ) { | 937 | if ( !(flag & O_NONBLOCK) ) { |
938 | qDebug("Setting nonblocking io"); | 938 | odebug << "Setting nonblocking io" << oendl; |
939 | flag |= O_NONBLOCK; | 939 | flag |= O_NONBLOCK; |
940 | ::fcntl(m_pppdLOG[0], F_SETFL, flag ); | 940 | ::fcntl(m_pppdLOG[0], F_SETFL, flag ); |
941 | } | 941 | } |
942 | 942 | ||
943 | delete m_modemDebug; | 943 | delete m_modemDebug; |
944 | m_modemDebug = new QSocketNotifier(m_pppdLOG[0], QSocketNotifier::Read, this ); | 944 | m_modemDebug = new QSocketNotifier(m_pppdLOG[0], QSocketNotifier::Read, this ); |
945 | connect(m_modemDebug, SIGNAL(activated(int) ), | 945 | connect(m_modemDebug, SIGNAL(activated(int) ), |
946 | this, SLOT(slotModemDebug(int) ) ); | 946 | this, SLOT(slotModemDebug(int) ) ); |
947 | 947 | ||
948 | modemfd = -1; | 948 | modemfd = -1; |
949 | m_pppdDev = QString::fromLatin1("ppp0"); | 949 | m_pppdDev = QString::fromLatin1("ppp0"); |
950 | return true; | 950 | return true; |
951 | break; | 951 | break; |
952 | } | 952 | } |
953 | } | 953 | } |
954 | 954 | ||
955 | 955 | ||
956 | bool Modem::killpppd() { | 956 | bool Modem::killpppd() { |
957 | qDebug("In killpppd and pid is %d", pppdPid ); | 957 | odebug << "In killpppd and pid is " << pppdPid << "" << oendl; |
958 | if(pppdPid > 0) { | 958 | if(pppdPid > 0) { |
959 | delete m_modemDebug; | 959 | delete m_modemDebug; |
960 | m_modemDebug = 0; | 960 | m_modemDebug = 0; |
961 | qDebug("In killpppd(): Sending SIGTERM to %d\n", pppdPid); | 961 | odebug << "In killpppd(): Sending SIGTERM to " << pppdPid << "\n" << oendl; |
962 | if(kill(pppdPid, SIGTERM) < 0) { | 962 | if(kill(pppdPid, SIGTERM) < 0) { |
963 | qDebug("Error terminating %d. Sending SIGKILL\n", pppdPid); | 963 | odebug << "Error terminating " << pppdPid << ". Sending SIGKILL\n" << oendl; |
964 | if(kill(pppdPid, SIGKILL) < 0) { | 964 | if(kill(pppdPid, SIGKILL) < 0) { |
965 | qDebug("Error killing %d\n", pppdPid); | 965 | odebug << "Error killing " << pppdPid << "\n" << oendl; |
966 | return false; | 966 | return false; |
967 | } | 967 | } |
968 | } | 968 | } |
969 | } | 969 | } |
970 | return true; | 970 | return true; |
971 | } | 971 | } |
972 | 972 | ||
973 | 973 | ||
974 | void Modem::parseargs(char* buf, char** args) { | 974 | void Modem::parseargs(char* buf, char** args) { |
975 | int nargs = 0; | 975 | int nargs = 0; |
976 | int quotes; | 976 | int quotes; |
977 | 977 | ||
@@ -1026,46 +1026,46 @@ void Modem::killPPPDaemon() | |||
1026 | killpppd(); | 1026 | killpppd(); |
1027 | } | 1027 | } |
1028 | 1028 | ||
1029 | int Modem::pppdExitStatus() | 1029 | int Modem::pppdExitStatus() |
1030 | { | 1030 | { |
1031 | return _pppdExitStatus; | 1031 | return _pppdExitStatus; |
1032 | } | 1032 | } |
1033 | 1033 | ||
1034 | int Modem::openResolv(int flags) | 1034 | int Modem::openResolv(int flags) |
1035 | { | 1035 | { |
1036 | int fd; | 1036 | int fd; |
1037 | if ((fd = open(_PATH_RESCONF, flags)) == -1) { | 1037 | if ((fd = open(_PATH_RESCONF, flags)) == -1) { |
1038 | qDebug("error opening resolv.conf!"); | 1038 | odebug << "error opening resolv.conf!" << oendl; |
1039 | fd = open(DEVNULL, O_RDONLY); | 1039 | fd = open(DEVNULL, O_RDONLY); |
1040 | } | 1040 | } |
1041 | return fd; | 1041 | return fd; |
1042 | } | 1042 | } |
1043 | 1043 | ||
1044 | bool Modem::setHostname(const QString & name) | 1044 | bool Modem::setHostname(const QString & name) |
1045 | { | 1045 | { |
1046 | return sethostname(name, name.length()) == 0; | 1046 | return sethostname(name, name.length()) == 0; |
1047 | } | 1047 | } |
1048 | 1048 | ||
1049 | QString Modem::pppDevice()const { | 1049 | QString Modem::pppDevice()const { |
1050 | return m_pppdDev; | 1050 | return m_pppdDev; |
1051 | } | 1051 | } |
1052 | void Modem::setPPPDevice( const QString& dev ) { | 1052 | void Modem::setPPPDevice( const QString& dev ) { |
1053 | m_pppdDev = dev; | 1053 | m_pppdDev = dev; |
1054 | } | 1054 | } |
1055 | pid_t Modem::pppPID()const { | 1055 | pid_t Modem::pppPID()const { |
1056 | return pppdPid; | 1056 | return pppdPid; |
1057 | } | 1057 | } |
1058 | void Modem::setPPPDPid( pid_t pid ) { | 1058 | void Modem::setPPPDPid( pid_t pid ) { |
1059 | qDebug("Modem setting pid"); | 1059 | odebug << "Modem setting pid" << oendl; |
1060 | _pppdExitStatus = -1; | 1060 | _pppdExitStatus = -1; |
1061 | pppdPid = pid; | 1061 | pppdPid = pid; |
1062 | modemfd = -1; | 1062 | modemfd = -1; |
1063 | } | 1063 | } |
1064 | void Modem::slotModemDebug(int fd) { | 1064 | void Modem::slotModemDebug(int fd) { |
1065 | char buf[2049]; | 1065 | char buf[2049]; |
1066 | int len; | 1066 | int len; |
1067 | 1067 | ||
1068 | // read in pppd data look for Using interface | 1068 | // read in pppd data look for Using interface |
1069 | // then read the interface | 1069 | // then read the interface |
1070 | // we limit to 10 device now 0-9 | 1070 | // we limit to 10 device now 0-9 |
1071 | if((len = ::read(fd, buf, 2048)) > 0) { | 1071 | if((len = ::read(fd, buf, 2048)) > 0) { |
diff --git a/noncore/settings/networksettings/ppp/pppconfig.cpp b/noncore/settings/networksettings/ppp/pppconfig.cpp index 97baf31..a8c99fd 100644 --- a/noncore/settings/networksettings/ppp/pppconfig.cpp +++ b/noncore/settings/networksettings/ppp/pppconfig.cpp | |||
@@ -16,28 +16,28 @@ PPPConfigWidget::PPPConfigWidget( InterfacePPP* iface, QWidget *parent, | |||
16 | const char *name, | 16 | const char *name, |
17 | bool modal, WFlags fl ) | 17 | bool modal, WFlags fl ) |
18 | : QDialog(parent, name, modal, fl) | 18 | : QDialog(parent, name, modal, fl) |
19 | { | 19 | { |
20 | setCaption(tr("Configure Modem")); | 20 | setCaption(tr("Configure Modem")); |
21 | int result = runTests(); | 21 | int result = runTests(); |
22 | if(result == TEST_CRITICAL){ | 22 | if(result == TEST_CRITICAL){ |
23 | QMessageBox::critical(0, tr("Modem failure"), tr("A critical failure appeard while testing the modem") ); | 23 | QMessageBox::critical(0, tr("Modem failure"), tr("A critical failure appeard while testing the modem") ); |
24 | return; | 24 | return; |
25 | } | 25 | } |
26 | 26 | ||
27 | interface = iface; | 27 | interface = iface; |
28 | qDebug("PPPConfigWidget::PPPConfigWidget"); | 28 | odebug << "PPPConfigWidget::PPPConfigWidget" << oendl; |
29 | qDebug(" interface->getHardwareName >%s<", interface->getHardwareName().latin1()); | 29 | odebug << " interface->getHardwareName >" << interface->getHardwareName().latin1() << "<" << oendl; |
30 | 30 | ||
31 | qDebug(" _pppdata->accname >%s<",interface->data()->accname().latin1()); | 31 | odebug << " _pppdata->accname >" << interface->data()->accname().latin1() << "<" << oendl; |
32 | 32 | ||
33 | 33 | ||
34 | QVBoxLayout *layout = new QVBoxLayout( this ); | 34 | QVBoxLayout *layout = new QVBoxLayout( this ); |
35 | layout->setSpacing( 0 ); | 35 | layout->setSpacing( 0 ); |
36 | layout->setMargin( 1 ); | 36 | layout->setMargin( 1 ); |
37 | tabWindow = new QTabWidget( this, "tabWidget" ); | 37 | tabWindow = new QTabWidget( this, "tabWidget" ); |
38 | layout->addWidget( tabWindow ); | 38 | layout->addWidget( tabWindow ); |
39 | 39 | ||
40 | accounts = new AccountWidget( interface->data(), tabWindow, "accounts", Qt::WStyle_ContextHelp ); | 40 | accounts = new AccountWidget( interface->data(), tabWindow, "accounts", Qt::WStyle_ContextHelp ); |
41 | tabWindow->addTab( accounts, tr("&Accounts") ); | 41 | tabWindow->addTab( accounts, tr("&Accounts") ); |
42 | devices = new DevicesWidget( interface, tabWindow, "devices", Qt::WStyle_ContextHelp ); | 42 | devices = new DevicesWidget( interface, tabWindow, "devices", Qt::WStyle_ContextHelp ); |
43 | tabWindow->addTab( devices, tr("&Devices") ); | 43 | tabWindow->addTab( devices, tr("&Devices") ); |
@@ -49,27 +49,27 @@ PPPConfigWidget::PPPConfigWidget( InterfacePPP* iface, QWidget *parent, | |||
49 | // tabWindow->addTab( modem2, tr("&Modem") ); | 49 | // tabWindow->addTab( modem2, tr("&Modem") ); |
50 | 50 | ||
51 | } | 51 | } |
52 | 52 | ||
53 | 53 | ||
54 | PPPConfigWidget::~PPPConfigWidget() | 54 | PPPConfigWidget::~PPPConfigWidget() |
55 | { | 55 | { |
56 | 56 | ||
57 | } | 57 | } |
58 | 58 | ||
59 | void PPPConfigWidget::accept() | 59 | void PPPConfigWidget::accept() |
60 | { | 60 | { |
61 | qDebug("PPPConfigWidget::accept"); | 61 | odebug << "PPPConfigWidget::accept" << oendl; |
62 | qDebug(" _pppdata->accname >%s<",interface->data()->accname().latin1()); | 62 | odebug << " _pppdata->accname >" << interface->data()->accname().latin1() << "<" << oendl; |
63 | qDebug(" interface->getHardwareName >%s<", interface->getHardwareName().latin1()); | 63 | odebug << " interface->getHardwareName >" << interface->getHardwareName().latin1() << "<" << oendl; |
64 | interface->setInterfaceName( interface->data()->devname() ); | 64 | interface->setInterfaceName( interface->data()->devname() ); |
65 | interface->setHardwareName( interface->data()->accname() ); | 65 | interface->setHardwareName( interface->data()->accname() ); |
66 | interface->save(); | 66 | interface->save(); |
67 | QDialog::accept(); | 67 | QDialog::accept(); |
68 | } | 68 | } |
69 | 69 | ||
70 | 70 | ||
71 | void PPPConfigWidget::reject() | 71 | void PPPConfigWidget::reject() |
72 | { | 72 | { |
73 | interface->data()->cancel(); | 73 | interface->data()->cancel(); |
74 | QDialog::reject(); | 74 | QDialog::reject(); |
75 | } | 75 | } |
diff --git a/noncore/settings/networksettings/ppp/pppdata.cpp b/noncore/settings/networksettings/ppp/pppdata.cpp index f4727c1..567ccf8 100644 --- a/noncore/settings/networksettings/ppp/pppdata.cpp +++ b/noncore/settings/networksettings/ppp/pppdata.cpp | |||
@@ -47,26 +47,26 @@ PPPData::PPPData() | |||
47 | highcountdev(-1), // start out with no entries | 47 | highcountdev(-1), // start out with no entries |
48 | // caccount(-1), // set the current account index also | 48 | // caccount(-1), // set the current account index also |
49 | suidprocessid(-1), // process ID of setuid child | 49 | suidprocessid(-1), // process ID of setuid child |
50 | pppdisrunning(false), | 50 | pppdisrunning(false), |
51 | pppderror(0) | 51 | pppderror(0) |
52 | { | 52 | { |
53 | highcount = readNumConfig(GENERAL_GRP, NUMACCOUNTS_KEY, 0) - 1; | 53 | highcount = readNumConfig(GENERAL_GRP, NUMACCOUNTS_KEY, 0) - 1; |
54 | highcountdev = readNumConfig(GENERAL_GRP, NUMDEVICES_KEY, 0) - 1; | 54 | highcountdev = readNumConfig(GENERAL_GRP, NUMDEVICES_KEY, 0) - 1; |
55 | Config cfg = config(); | 55 | Config cfg = config(); |
56 | cfg.setGroup(GENERAL_GRP); | 56 | cfg.setGroup(GENERAL_GRP); |
57 | accountList = cfg.readListEntry(ACCOUNT_LIST, ',' ); | 57 | accountList = cfg.readListEntry(ACCOUNT_LIST, ',' ); |
58 | deviceList = cfg.readListEntry(DEVICESNAMES_LIST, ',' ); | 58 | deviceList = cfg.readListEntry(DEVICESNAMES_LIST, ',' ); |
59 | qDebug("PPPData::PPPData has a accountList %s", accountList.join("---").latin1()); | 59 | odebug << "PPPData::PPPData has a accountList " << accountList.join("---").latin1() << "" << oendl; |
60 | qDebug("PPPData::PPPData has a deviceList %s", deviceList.join("---").latin1()); | 60 | odebug << "PPPData::PPPData has a deviceList " << deviceList.join("---").latin1() << "" << oendl; |
61 | 61 | ||
62 | // if (highcount > MAX_ACCOUNTS) | 62 | // if (highcount > MAX_ACCOUNTS) |
63 | // highcount = MAX_ACCOUNTS; | 63 | // highcount = MAX_ACCOUNTS; |
64 | 64 | ||
65 | // if(highcount >= 0 && defaultAccount().isEmpty()) { | 65 | // if(highcount >= 0 && defaultAccount().isEmpty()) { |
66 | // setAccountbyIndex(0); | 66 | // setAccountbyIndex(0); |
67 | // setDefaultAccount(accname()); | 67 | // setDefaultAccount(accname()); |
68 | // } else if(!setAccount(defaultAccount())) | 68 | // } else if(!setAccount(defaultAccount())) |
69 | setDefaultAccount(accname()); | 69 | setDefaultAccount(accname()); |
70 | 70 | ||
71 | // start out with internal debugging disabled | 71 | // start out with internal debugging disabled |
72 | // the user is still free to specify `debug' on his own | 72 | // the user is still free to specify `debug' on his own |
@@ -77,81 +77,81 @@ PPPData::PPPData() | |||
77 | } | 77 | } |
78 | 78 | ||
79 | Config PPPData::config() | 79 | Config PPPData::config() |
80 | { | 80 | { |
81 | return Config("NetworkSetupPPP"); | 81 | return Config("NetworkSetupPPP"); |
82 | } | 82 | } |
83 | 83 | ||
84 | // | 84 | // |
85 | // save configuration | 85 | // save configuration |
86 | // | 86 | // |
87 | void PPPData::save() | 87 | void PPPData::save() |
88 | { | 88 | { |
89 | qDebug("PPPData saving data"); | 89 | odebug << "PPPData saving data" << oendl; |
90 | writeConfig(GENERAL_GRP, NUMACCOUNTS_KEY, count()); | 90 | writeConfig(GENERAL_GRP, NUMACCOUNTS_KEY, count()); |
91 | writeConfig(GENERAL_GRP, NUMDEVICES_KEY, highcountdev + 1); | 91 | writeConfig(GENERAL_GRP, NUMDEVICES_KEY, highcountdev + 1); |
92 | QString key; | 92 | QString key; |
93 | QStringList keys; | 93 | QStringList keys; |
94 | Config cfg = config(); | 94 | Config cfg = config(); |
95 | cfg.setGroup(GENERAL_GRP); | 95 | cfg.setGroup(GENERAL_GRP); |
96 | cfg.writeEntry(ACCOUNT_LIST, accountList, ',' ); | 96 | cfg.writeEntry(ACCOUNT_LIST, accountList, ',' ); |
97 | cfg.writeEntry(DEVICESNAMES_LIST, deviceList, ',' ); | 97 | cfg.writeEntry(DEVICESNAMES_LIST, deviceList, ',' ); |
98 | 98 | ||
99 | for( QMap<QString,QString>::Iterator it = stringEntries.begin(); | 99 | for( QMap<QString,QString>::Iterator it = stringEntries.begin(); |
100 | it != stringEntries.end(); ++it ){ | 100 | it != stringEntries.end(); ++it ){ |
101 | QString val = it.data(); | 101 | QString val = it.data(); |
102 | key = it.key(); | 102 | key = it.key(); |
103 | // qDebug("saving %s -> %s", key.latin1(), val.latin1() ); | 103 | // odebug << "saving " << key.latin1() << " -> " << val.latin1() << "" << oendl; |
104 | keys = QStringList::split( "SEPARATOR", key ); | 104 | keys = QStringList::split( "SEPARATOR", key ); |
105 | //qDebug("group >%s< key >%s< value >%s<", keys[0].latin1(), keys[1].latin1(), val.latin1() ); | 105 | //odebug << "group >" << keys[0].latin1() << "< key >" << keys[1].latin1() << "< value >" << val.latin1() << "<" << oendl; |
106 | cfg.setGroup(keys[0]); | 106 | cfg.setGroup(keys[0]); |
107 | cfg.writeEntry(keys[1], val); | 107 | cfg.writeEntry(keys[1], val); |
108 | } | 108 | } |
109 | for( QMap<QString,int>::Iterator it = intEntries.begin(); | 109 | for( QMap<QString,int>::Iterator it = intEntries.begin(); |
110 | it != intEntries.end(); ++it ){ | 110 | it != intEntries.end(); ++it ){ |
111 | int val = it.data(); | 111 | int val = it.data(); |
112 | key = it.key(); | 112 | key = it.key(); |
113 | // qDebug("saving %s -> %i", key.latin1(), val ); | 113 | // odebug << "saving " << key.latin1() << " -> " << val << "" << oendl; |
114 | keys = QStringList::split( "SEPARATOR", key ); | 114 | keys = QStringList::split( "SEPARATOR", key ); |
115 | //qDebug("group >%s< key >%s< val %i", keys[0].latin1(), keys[1].latin1(), val ); | 115 | //odebug << "group >" << keys[0].latin1() << "< key >" << keys[1].latin1() << "< val " << val << "" << oendl; |
116 | cfg.setGroup(keys[0]); | 116 | cfg.setGroup(keys[0]); |
117 | cfg.writeEntry(keys[1], val); | 117 | cfg.writeEntry(keys[1], val); |
118 | } | 118 | } |
119 | for( QMap<QString,QStringList>::Iterator it = listEntries.begin(); | 119 | for( QMap<QString,QStringList>::Iterator it = listEntries.begin(); |
120 | it != listEntries.end(); ++it ){ | 120 | it != listEntries.end(); ++it ){ |
121 | QStringList val = it.data(); | 121 | QStringList val = it.data(); |
122 | key = it.key(); | 122 | key = it.key(); |
123 | QChar sep = sepEntries[key]; | 123 | QChar sep = sepEntries[key]; |
124 | // qDebug("saving %s -> %s", key.latin1(), val.join(sep).latin1() ); | 124 | // odebug << "saving " << key.latin1() << " -> " << val.join(sep).latin1() << "" << oendl; |
125 | keys = QStringList::split( "SEPARATOR", key ); | 125 | keys = QStringList::split( "SEPARATOR", key ); |
126 | cfg.setGroup(keys[0]); | 126 | cfg.setGroup(keys[0]); |
127 | cfg.writeEntry(keys[1], val, sep); | 127 | cfg.writeEntry(keys[1], val, sep); |
128 | } | 128 | } |
129 | } | 129 | } |
130 | 130 | ||
131 | 131 | ||
132 | // | 132 | // |
133 | // cancel changes | 133 | // cancel changes |
134 | // | 134 | // |
135 | void PPPData::cancel() { | 135 | void PPPData::cancel() { |
136 | stringEntries.clear(); | 136 | stringEntries.clear(); |
137 | intEntries.clear(); | 137 | intEntries.clear(); |
138 | listEntries.clear(); | 138 | listEntries.clear(); |
139 | } | 139 | } |
140 | 140 | ||
141 | // functions to read/write date to configuration file | 141 | // functions to read/write date to configuration file |
142 | QString PPPData::readConfig(const QString &group, const QString &key, | 142 | QString PPPData::readConfig(const QString &group, const QString &key, |
143 | const QString &defvalue = "") | 143 | const QString &defvalue = "") |
144 | { | 144 | { |
145 | // qDebug("PPPData::readConfig key >%s< group >%s<",key.latin1(), group.latin1()); | 145 | // odebug << "PPPData::readConfig key >" << key.latin1() << "< group >" << group.latin1() << "<" << oendl; |
146 | QString idx = SEP.arg(group).arg(key); | 146 | QString idx = SEP.arg(group).arg(key); |
147 | if (stringEntries.find(idx) != stringEntries.end()) | 147 | if (stringEntries.find(idx) != stringEntries.end()) |
148 | return stringEntries[idx]; | 148 | return stringEntries[idx]; |
149 | Config cfg = config(); | 149 | Config cfg = config(); |
150 | cfg.setGroup(group); | 150 | cfg.setGroup(group); |
151 | return cfg.readEntry(key, defvalue); | 151 | return cfg.readEntry(key, defvalue); |
152 | } | 152 | } |
153 | 153 | ||
154 | 154 | ||
155 | int PPPData::readNumConfig(const QString &group, const QString &key, | 155 | int PPPData::readNumConfig(const QString &group, const QString &key, |
156 | int defvalue) | 156 | int defvalue) |
157 | { | 157 | { |
@@ -356,39 +356,39 @@ void PPPData::setpppdTimeout(int n) { | |||
356 | 356 | ||
357 | const QString PPPData::modemDevice() { | 357 | const QString PPPData::modemDevice() { |
358 | return readConfig (modemGroup(), MODEMDEV_KEY, "/dev/modem" ); | 358 | return readConfig (modemGroup(), MODEMDEV_KEY, "/dev/modem" ); |
359 | } | 359 | } |
360 | 360 | ||
361 | 361 | ||
362 | // const QString PPPData::modemName() | 362 | // const QString PPPData::modemName() |
363 | // { | 363 | // { |
364 | // return readConfig(modemGroup(), MODEMNAME_KEY); | 364 | // return readConfig(modemGroup(), MODEMNAME_KEY); |
365 | // } | 365 | // } |
366 | 366 | ||
367 | // bool PPPData::setModemName(const QString &n) { | 367 | // bool PPPData::setModemName(const QString &n) { |
368 | // qDebug("Setting modem name to >%s<", n.latin1()); | 368 | // odebug << "Setting modem name to >" << n.latin1() << "<" << oendl; |
369 | // _modemName = n; | 369 | // _modemName = n; |
370 | // writeConfig(cgroup, MODEMNAME_KEY, n); | 370 | // writeConfig(cgroup, MODEMNAME_KEY, n); |
371 | // return true; //FIXME | 371 | // return true; //FIXME |
372 | // } | 372 | // } |
373 | 373 | ||
374 | // bool PPPData::changeModemName(const QString &n) { | 374 | // bool PPPData::changeModemName(const QString &n) { |
375 | // qDebug("Setting modem name to >%s<", n.latin1()); | 375 | // odebug << "Setting modem name to >" << n.latin1() << "<" << oendl; |
376 | // _modemName = n; | 376 | // _modemName = n; |
377 | // writeConfig(modemGroup(), MODEMNAME_KEY, n); | 377 | // writeConfig(modemGroup(), MODEMNAME_KEY, n); |
378 | // return true; //FIXME | 378 | // return true; //FIXME |
379 | // } | 379 | // } |
380 | 380 | ||
381 | bool PPPData::setModemDevice(const QString &n) { | 381 | bool PPPData::setModemDevice(const QString &n) { |
382 | qDebug("Setting modem dev to >%s<", n.latin1()); | 382 | odebug << "Setting modem dev to >" << n.latin1() << "<" << oendl; |
383 | writeConfig(modemGroup(), MODEMDEV_KEY, n); | 383 | writeConfig(modemGroup(), MODEMDEV_KEY, n); |
384 | return true; //FIXME | 384 | return true; //FIXME |
385 | } | 385 | } |
386 | 386 | ||
387 | 387 | ||
388 | const QString PPPData::flowcontrol() { | 388 | const QString PPPData::flowcontrol() { |
389 | return readConfig(modemGroup(), FLOWCONTROL_KEY, "CRTSCTS"); | 389 | return readConfig(modemGroup(), FLOWCONTROL_KEY, "CRTSCTS"); |
390 | } | 390 | } |
391 | 391 | ||
392 | 392 | ||
393 | void PPPData::setFlowcontrol(const QString &n) { | 393 | void PPPData::setFlowcontrol(const QString &n) { |
394 | writeConfig(modemGroup(), FLOWCONTROL_KEY, n); | 394 | writeConfig(modemGroup(), FLOWCONTROL_KEY, n); |
@@ -730,80 +730,80 @@ void PPPData::setEnter(const QString &n) { | |||
730 | 730 | ||
731 | // | 731 | // |
732 | // functions to set/return account information | 732 | // functions to set/return account information |
733 | // | 733 | // |
734 | 734 | ||
735 | //returns number of accounts | 735 | //returns number of accounts |
736 | int PPPData::count() const { | 736 | int PPPData::count() const { |
737 | return highcount + 1; | 737 | return highcount + 1; |
738 | } | 738 | } |
739 | 739 | ||
740 | 740 | ||
741 | bool PPPData::setAccount(const QString &aname) { | 741 | bool PPPData::setAccount(const QString &aname) { |
742 | qDebug("setting account to >%s<", aname.latin1()); | 742 | odebug << "setting account to >" << aname.latin1() << "<" << oendl; |
743 | for ( QStringList::Iterator it = accountList.begin(); it != accountList.end(); ++it ) { | 743 | for ( QStringList::Iterator it = accountList.begin(); it != accountList.end(); ++it ) { |
744 | cgroup = *it; | 744 | cgroup = *it; |
745 | qDebug("PPPData::setAccount %s", cgroup.latin1()); | 745 | odebug << "PPPData::setAccount " << cgroup.latin1() << "" << oendl; |
746 | qDebug( "iterator %s", (*it).latin1() ); | 746 | odebug << "iterator " << (*it).latin1() << "" << oendl; |
747 | if(accname() == aname) { | 747 | if(accname() == aname) { |
748 | qDebug("SUCCESS"); | 748 | odebug << "SUCCESS" << oendl; |
749 | return true; | 749 | return true; |
750 | } | 750 | } |
751 | 751 | ||
752 | } | 752 | } |
753 | qDebug("FAILURE"); | 753 | odebug << "FAILURE" << oendl; |
754 | return false; | 754 | return false; |
755 | } | 755 | } |
756 | 756 | ||
757 | /* | 757 | /* |
758 | bool PPPData::setAccountbyIndex(int i) { | 758 | bool PPPData::setAccountbyIndex(int i) { |
759 | if(i >= 0 && i <= highcount) { | 759 | if(i >= 0 && i <= highcount) { |
760 | QString tmp; | 760 | QString tmp; |
761 | tmp.sprintf("%s%i", ACCOUNT_GRP, i); | 761 | tmp.sprintf("%s%i", ACCOUNT_GRP, i); |
762 | if (_deleted.find(tmp)!=_deleted.end()) return false; | 762 | if (_deleted.find(tmp)!=_deleted.end()) return false; |
763 | caccount = i; | 763 | caccount = i; |
764 | cgroup = tmp; | 764 | cgroup = tmp; |
765 | return true; | 765 | return true; |
766 | } | 766 | } |
767 | return false; | 767 | return false; |
768 | } | 768 | } |
769 | */ | 769 | */ |
770 | 770 | ||
771 | bool PPPData::isUniqueAccname(const QString &n) { | 771 | bool PPPData::isUniqueAccname(const QString &n) { |
772 | QString save_cgroup = cgroup; | 772 | QString save_cgroup = cgroup; |
773 | for ( QStringList::Iterator it = accountList.begin(); it != accountList.end(); ++it ) { | 773 | for ( QStringList::Iterator it = accountList.begin(); it != accountList.end(); ++it ) { |
774 | cgroup = *it; | 774 | cgroup = *it; |
775 | qDebug("PPPData::setAccount %s", cgroup.latin1()); | 775 | odebug << "PPPData::setAccount " << cgroup.latin1() << "" << oendl; |
776 | qDebug( "%s \n", (*it).latin1() ); | 776 | odebug << "" << (*it).latin1() << " \n" << oendl; |
777 | if(accname() == n && cgroup != save_cgroup) { | 777 | if(accname() == n && cgroup != save_cgroup) { |
778 | cgroup = save_cgroup; | 778 | cgroup = save_cgroup; |
779 | qDebug("SUCCESS"); | 779 | odebug << "SUCCESS" << oendl; |
780 | return false; | 780 | return false; |
781 | } | 781 | } |
782 | 782 | ||
783 | } | 783 | } |
784 | cgroup = save_cgroup; | 784 | cgroup = save_cgroup; |
785 | return true; | 785 | return true; |
786 | } | 786 | } |
787 | 787 | ||
788 | 788 | ||
789 | bool PPPData::isUniqueDevname(const QString &n) { | 789 | bool PPPData::isUniqueDevname(const QString &n) { |
790 | QString save_mName = _modemName; | 790 | QString save_mName = _modemName; |
791 | qDebug("PPPData::isUniqueDevname checking if %s is unique", n.latin1()); | 791 | odebug << "PPPData::isUniqueDevname checking if " << n.latin1() << " is unique" << oendl; |
792 | for ( QStringList::Iterator it = deviceList.begin(); it != deviceList.end(); ++it ) { | 792 | for ( QStringList::Iterator it = deviceList.begin(); it != deviceList.end(); ++it ) { |
793 | _modemName = *it; | 793 | _modemName = *it; |
794 | qDebug("PPPData::isUniqueDevname %s == %s", n.latin1() , devname().latin1()); | 794 | odebug << "PPPData::isUniqueDevname " << n.latin1() << " == " << devname().latin1() << "" << oendl; |
795 | if(devname() == n && _modemName != save_mName) { | 795 | if(devname() == n && _modemName != save_mName) { |
796 | _modemName = save_mName; | 796 | _modemName = save_mName; |
797 | qDebug("NOT UNIQUE"); | 797 | odebug << "NOT UNIQUE" << oendl; |
798 | return false; | 798 | return false; |
799 | } | 799 | } |
800 | 800 | ||
801 | } | 801 | } |
802 | _modemName = save_mName; | 802 | _modemName = save_mName; |
803 | return true; | 803 | return true; |
804 | } | 804 | } |
805 | 805 | ||
806 | 806 | ||
807 | bool PPPData::deleteAccount() { | 807 | bool PPPData::deleteAccount() { |
808 | // FIXME: check if this account exists in a config... | 808 | // FIXME: check if this account exists in a config... |
809 | Config cfg = PPPData::config(); | 809 | Config cfg = PPPData::config(); |
@@ -811,74 +811,74 @@ bool PPPData::deleteAccount() { | |||
811 | cfg.clearGroup(); | 811 | cfg.clearGroup(); |
812 | accountList.remove(cgroup); | 812 | accountList.remove(cgroup); |
813 | 813 | ||
814 | QString key; | 814 | QString key; |
815 | QStringList keys; | 815 | QStringList keys; |
816 | for( QMap<QString,QString>::Iterator it = stringEntries.begin(); | 816 | for( QMap<QString,QString>::Iterator it = stringEntries.begin(); |
817 | it != stringEntries.end(); ++it ){ | 817 | it != stringEntries.end(); ++it ){ |
818 | QString val = it.data(); | 818 | QString val = it.data(); |
819 | key = it.key(); | 819 | key = it.key(); |
820 | keys = QStringList::split( "SEPARATOR", key ); | 820 | keys = QStringList::split( "SEPARATOR", key ); |
821 | if(keys[0]==cgroup){ | 821 | if(keys[0]==cgroup){ |
822 | stringEntries.remove( it ); | 822 | stringEntries.remove( it ); |
823 | qDebug("deleting >%s< key >%s< value >%s<", keys[0].latin1(), keys[1].latin1(), val.latin1() ); | 823 | odebug << "deleting >" << keys[0].latin1() << "< key >" << keys[1].latin1() << "< value >" << val.latin1() << "<" << oendl; |
824 | } | 824 | } |
825 | } | 825 | } |
826 | for( QMap<QString,int>::Iterator it = intEntries.begin(); | 826 | for( QMap<QString,int>::Iterator it = intEntries.begin(); |
827 | it != intEntries.end(); ++it ){ | 827 | it != intEntries.end(); ++it ){ |
828 | int val = it.data(); | 828 | int val = it.data(); |
829 | key = it.key(); | 829 | key = it.key(); |
830 | keys = QStringList::split( "SEPARATOR", key ); | 830 | keys = QStringList::split( "SEPARATOR", key ); |
831 | if(keys[0]==cgroup){ | 831 | if(keys[0]==cgroup){ |
832 | intEntries.remove( it ); | 832 | intEntries.remove( it ); |
833 | qDebug("deleting >%s< key >%s< value >%i<", keys[0].latin1(), keys[1].latin1(), val ); | 833 | odebug << "deleting >" << keys[0].latin1() << "< key >" << keys[1].latin1() << "< value >" << val << "<" << oendl; |
834 | } | 834 | } |
835 | } | 835 | } |
836 | for( QMap<QString,QStringList>::Iterator it = listEntries.begin(); | 836 | for( QMap<QString,QStringList>::Iterator it = listEntries.begin(); |
837 | it != listEntries.end(); ++it ){ | 837 | it != listEntries.end(); ++it ){ |
838 | QStringList val = it.data(); | 838 | QStringList val = it.data(); |
839 | key = it.key(); | 839 | key = it.key(); |
840 | if(keys[0]==cgroup){ | 840 | if(keys[0]==cgroup){ |
841 | listEntries.remove( it ); | 841 | listEntries.remove( it ); |
842 | sepEntries.remove( key ); | 842 | sepEntries.remove( key ); |
843 | qDebug("deleting >%s< key >%s< value >%s<", keys[0].latin1(), keys[1].latin1(), val.join("").latin1() ); | 843 | odebug << "deleting >" << keys[0].latin1() << "< key >" << keys[1].latin1() << "< value >" << val.join("").latin1() << "<" << oendl; |
844 | } | 844 | } |
845 | } | 845 | } |
846 | 846 | ||
847 | return true; | 847 | return true; |
848 | } | 848 | } |
849 | 849 | ||
850 | 850 | ||
851 | bool PPPData::deleteAccount(const QString &aname) { | 851 | bool PPPData::deleteAccount(const QString &aname) { |
852 | if(!setAccount(aname)) | 852 | if(!setAccount(aname)) |
853 | return false; | 853 | return false; |
854 | 854 | ||
855 | deleteAccount(); | 855 | deleteAccount(); |
856 | 856 | ||
857 | return true; | 857 | return true; |
858 | } | 858 | } |
859 | 859 | ||
860 | 860 | ||
861 | int PPPData::newaccount() { | 861 | int PPPData::newaccount() { |
862 | 862 | ||
863 | qDebug("PPPData::newaccount highcount %i/%i",highcount,MAX_ACCOUNTS); | 863 | odebug << "PPPData::newaccount highcount " << highcount << "/" << MAX_ACCOUNTS << "" << oendl; |
864 | // if(!config) open(); | 864 | // if(!config) open(); |
865 | // if (highcount >= MAX_ACCOUNTS) return -1; | 865 | // if (highcount >= MAX_ACCOUNTS) return -1; |
866 | 866 | ||
867 | 867 | ||
868 | QString tmp; | 868 | QString tmp; |
869 | tmp.sprintf("%s%i", ACCOUNT_GRP, ++highcount); | 869 | tmp.sprintf("%s%i", ACCOUNT_GRP, ++highcount); |
870 | cgroup = QString(tmp); | 870 | cgroup = QString(tmp); |
871 | accountList << tmp; | 871 | accountList << tmp; |
872 | qDebug("PPPData::newaccount() Group: >%s<",cgroup.latin1()); | 872 | odebug << "PPPData::newaccount() Group: >" << cgroup.latin1() << "<" << oendl; |
873 | setpppdArgumentDefaults(); | 873 | setpppdArgumentDefaults(); |
874 | return highcount; | 874 | return highcount; |
875 | } | 875 | } |
876 | 876 | ||
877 | int PPPData::copyaccount(const QString&) { | 877 | int PPPData::copyaccount(const QString&) { |
878 | // FIXME: PPPData::copyaccount | 878 | // FIXME: PPPData::copyaccount |
879 | // if(highcount >= MAX_ACCOUNTS) | 879 | // if(highcount >= MAX_ACCOUNTS) |
880 | return -1; | 880 | return -1; |
881 | 881 | ||
882 | // setAccountbyIndex(i); | 882 | // setAccountbyIndex(i); |
883 | 883 | ||
884 | // QMap <QString, QString> map = config->entryMap(cgroup); | 884 | // QMap <QString, QString> map = config->entryMap(cgroup); |
@@ -956,27 +956,27 @@ void PPPData::setAuthMethod(int value) { | |||
956 | 956 | ||
957 | const QString PPPData::storedUsername() { | 957 | const QString PPPData::storedUsername() { |
958 | return readConfig(cgroup, STORED_USERNAME_KEY, ""); | 958 | return readConfig(cgroup, STORED_USERNAME_KEY, ""); |
959 | } | 959 | } |
960 | 960 | ||
961 | 961 | ||
962 | void PPPData::setStoredUsername(const QString &b) { | 962 | void PPPData::setStoredUsername(const QString &b) { |
963 | writeConfig(cgroup, STORED_USERNAME_KEY, b); | 963 | writeConfig(cgroup, STORED_USERNAME_KEY, b); |
964 | } | 964 | } |
965 | 965 | ||
966 | 966 | ||
967 | const QString PPPData::storedPassword() { | 967 | const QString PPPData::storedPassword() { |
968 | qDebug("getting stored pw"); | 968 | odebug << "getting stored pw" << oendl; |
969 | qDebug("g %s", cgroup.latin1() ); | 969 | odebug << "g " << cgroup.latin1() << "" << oendl; |
970 | qDebug("k %s", STORED_PASSWORD_KEY); | 970 | odebug << "k " << STORED_PASSWORD_KEY << "" << oendl; |
971 | return readConfig(cgroup, STORED_PASSWORD_KEY, ""); | 971 | return readConfig(cgroup, STORED_PASSWORD_KEY, ""); |
972 | } | 972 | } |
973 | 973 | ||
974 | 974 | ||
975 | void PPPData::setStoredPassword(const QString &b) { | 975 | void PPPData::setStoredPassword(const QString &b) { |
976 | writeConfig(cgroup, STORED_PASSWORD_KEY, b); | 976 | writeConfig(cgroup, STORED_PASSWORD_KEY, b); |
977 | } | 977 | } |
978 | 978 | ||
979 | 979 | ||
980 | bool PPPData::storePassword() { | 980 | bool PPPData::storePassword() { |
981 | return (bool)readNumConfig(cgroup, STORE_PASSWORD_KEY, 1); | 981 | return (bool)readNumConfig(cgroup, STORE_PASSWORD_KEY, 1); |
982 | } | 982 | } |
@@ -1320,28 +1320,28 @@ QMap<QString,QString> PPPData::getConfiguredInterfaces() | |||
1320 | return ifaces; | 1320 | return ifaces; |
1321 | } | 1321 | } |
1322 | 1322 | ||
1323 | void PPPData::setConfiguredInterfaces( QMap<QString,QString> ifaces ) | 1323 | void PPPData::setConfiguredInterfaces( QMap<QString,QString> ifaces ) |
1324 | { | 1324 | { |
1325 | QMap<QString,QString>::Iterator it; | 1325 | QMap<QString,QString>::Iterator it; |
1326 | int i = 0; | 1326 | int i = 0; |
1327 | Config cfg = config(); | 1327 | Config cfg = config(); |
1328 | for( it = ifaces.begin(); it != ifaces.end(); ++it ){ | 1328 | for( it = ifaces.begin(); it != ifaces.end(); ++it ){ |
1329 | cfg.setGroup(QString("%1_%1").arg(ACCLIST_GRP).arg(i++)); | 1329 | cfg.setGroup(QString("%1_%1").arg(ACCLIST_GRP).arg(i++)); |
1330 | cfg.writeEntry( ACOUNTS_DEV, it.key() ); | 1330 | cfg.writeEntry( ACOUNTS_DEV, it.key() ); |
1331 | cfg.writeEntry( ACOUNTS_ACC, it.data() ); | 1331 | cfg.writeEntry( ACOUNTS_ACC, it.data() ); |
1332 | qDebug("I %i",i); | 1332 | odebug << "I " << i << "" << oendl; |
1333 | } | 1333 | } |
1334 | cfg.setGroup( ACCLIST_GRP ); | 1334 | cfg.setGroup( ACCLIST_GRP ); |
1335 | qDebug("saved %i account settings", i); | 1335 | odebug << "saved " << i << " account settings" << oendl; |
1336 | cfg.writeEntry( ACCOUNTS_COUNT, i ); | 1336 | cfg.writeEntry( ACCOUNTS_COUNT, i ); |
1337 | 1337 | ||
1338 | } | 1338 | } |
1339 | 1339 | ||
1340 | /** | 1340 | /** |
1341 | * pppd's getword() function knows about escape characters. | 1341 | * pppd's getword() function knows about escape characters. |
1342 | * If we write the username and password to the secrets file | 1342 | * If we write the username and password to the secrets file |
1343 | * we'll therefore have to escape back slashes. | 1343 | * we'll therefore have to escape back slashes. |
1344 | */ | 1344 | */ |
1345 | QString PPPData::encodeWord(const QString &s) { | 1345 | QString PPPData::encodeWord(const QString &s) { |
1346 | QString r = s; | 1346 | QString r = s; |
1347 | r.replace(QRegExp("\\"), "\\\\"); | 1347 | r.replace(QRegExp("\\"), "\\\\"); |
@@ -1363,133 +1363,133 @@ QStringList PPPData::getAccountList() | |||
1363 | for ( QStringList::Iterator it = accountList.begin(); it != accountList.end(); ++it ) { | 1363 | for ( QStringList::Iterator it = accountList.begin(); it != accountList.end(); ++it ) { |
1364 | cgroup = *it; | 1364 | cgroup = *it; |
1365 | list << accname(); | 1365 | list << accname(); |
1366 | } | 1366 | } |
1367 | cgroup = save_cgroup; | 1367 | cgroup = save_cgroup; |
1368 | return list; | 1368 | return list; |
1369 | }; | 1369 | }; |
1370 | 1370 | ||
1371 | 1371 | ||
1372 | const QString PPPData::devname() | 1372 | const QString PPPData::devname() |
1373 | { | 1373 | { |
1374 | QString tmp = readConfig(modemGroup(), MODEMNAME_KEY ); | 1374 | QString tmp = readConfig(modemGroup(), MODEMNAME_KEY ); |
1375 | qDebug("PPPData::devname() of %s is %s", modemGroup().latin1(), tmp.latin1()); | 1375 | odebug << "PPPData::devname() of " << modemGroup().latin1() << " is " << tmp.latin1() << "" << oendl; |
1376 | return tmp; | 1376 | return tmp; |
1377 | } | 1377 | } |
1378 | 1378 | ||
1379 | void PPPData::setDevname(const QString &n) { | 1379 | void PPPData::setDevname(const QString &n) { |
1380 | // if(!cgroup.isNull()) { | 1380 | // if(!cgroup.isNull()) { |
1381 | // // are we manipulating the default account's name ? then change it, too. | 1381 | // // are we manipulating the default account's name ? then change it, too. |
1382 | // bool def = accname() == defaultAccount(); | 1382 | // bool def = accname() == defaultAccount(); |
1383 | // writeConfig(cgroup, NAME_KEY, n); | 1383 | // writeConfig(cgroup, NAME_KEY, n); |
1384 | // if (def) | 1384 | // if (def) |
1385 | // setDefaultAccount(n); | 1385 | // setDefaultAccount(n); |
1386 | // } | 1386 | // } |
1387 | writeConfig(modemGroup(), MODEMNAME_KEY, n ); | 1387 | writeConfig(modemGroup(), MODEMNAME_KEY, n ); |
1388 | } | 1388 | } |
1389 | 1389 | ||
1390 | 1390 | ||
1391 | bool PPPData::setDevice(const QString &dev ) | 1391 | bool PPPData::setDevice(const QString &dev ) |
1392 | { | 1392 | { |
1393 | qDebug("setting device to >%s<", dev.latin1()); | 1393 | odebug << "setting device to >" << dev.latin1() << "<" << oendl; |
1394 | QString save_mName = _modemName; | 1394 | QString save_mName = _modemName; |
1395 | for ( QStringList::Iterator it = deviceList.begin(); it != deviceList.end(); ++it ) { | 1395 | for ( QStringList::Iterator it = deviceList.begin(); it != deviceList.end(); ++it ) { |
1396 | _modemName = *it; | 1396 | _modemName = *it; |
1397 | qDebug("PPPData::setDevice %s is named %s", _modemName.latin1(), devname().latin1() ); | 1397 | odebug << "PPPData::setDevice " << _modemName.latin1() << " is named " << devname().latin1() << "" << oendl; |
1398 | qDebug( "iterator %s", (*it).latin1() ); | 1398 | odebug << "iterator " << (*it).latin1() << "" << oendl; |
1399 | if(devname() == dev) { | 1399 | if(devname() == dev) { |
1400 | qDebug("SUCCESS"); | 1400 | odebug << "SUCCESS" << oendl; |
1401 | return true; | 1401 | return true; |
1402 | } | 1402 | } |
1403 | 1403 | ||
1404 | } | 1404 | } |
1405 | _modemName = save_mName; | 1405 | _modemName = save_mName; |
1406 | qDebug("FAILURE"); | 1406 | odebug << "FAILURE" << oendl; |
1407 | return false; | 1407 | return false; |
1408 | } | 1408 | } |
1409 | 1409 | ||
1410 | bool PPPData::deleteDevice() | 1410 | bool PPPData::deleteDevice() |
1411 | { | 1411 | { |
1412 | // FIXME: check if this account exists in a config... | 1412 | // FIXME: check if this account exists in a config... |
1413 | Config cfg = PPPData::config(); | 1413 | Config cfg = PPPData::config(); |
1414 | cfg.setGroup(modemGroup()); | 1414 | cfg.setGroup(modemGroup()); |
1415 | cfg.clearGroup(); | 1415 | cfg.clearGroup(); |
1416 | deviceList.remove(modemGroup()); | 1416 | deviceList.remove(modemGroup()); |
1417 | 1417 | ||
1418 | QString key; | 1418 | QString key; |
1419 | QStringList keys; | 1419 | QStringList keys; |
1420 | for( QMap<QString,QString>::Iterator it = stringEntries.begin(); | 1420 | for( QMap<QString,QString>::Iterator it = stringEntries.begin(); |
1421 | it != stringEntries.end(); ++it ){ | 1421 | it != stringEntries.end(); ++it ){ |
1422 | QString val = it.data(); | 1422 | QString val = it.data(); |
1423 | key = it.key(); | 1423 | key = it.key(); |
1424 | keys = QStringList::split( "SEPARATOR", key ); | 1424 | keys = QStringList::split( "SEPARATOR", key ); |
1425 | if(keys[0]==modemGroup()){ | 1425 | if(keys[0]==modemGroup()){ |
1426 | stringEntries.remove( it ); | 1426 | stringEntries.remove( it ); |
1427 | qDebug("deleting >%s< key >%s< value >%s<", keys[0].latin1(), keys[1].latin1(), val.latin1() ); | 1427 | odebug << "deleting >" << keys[0].latin1() << "< key >" << keys[1].latin1() << "< value >" << val.latin1() << "<" << oendl; |
1428 | } | 1428 | } |
1429 | } | 1429 | } |
1430 | for( QMap<QString,int>::Iterator it = intEntries.begin(); | 1430 | for( QMap<QString,int>::Iterator it = intEntries.begin(); |
1431 | it != intEntries.end(); ++it ){ | 1431 | it != intEntries.end(); ++it ){ |
1432 | int val = it.data(); | 1432 | int val = it.data(); |
1433 | key = it.key(); | 1433 | key = it.key(); |
1434 | keys = QStringList::split( "SEPARATOR", key ); | 1434 | keys = QStringList::split( "SEPARATOR", key ); |
1435 | if(keys[0]==modemGroup()){ | 1435 | if(keys[0]==modemGroup()){ |
1436 | intEntries.remove( it ); | 1436 | intEntries.remove( it ); |
1437 | qDebug("deleting >%s< key >%s< value >%i<", keys[0].latin1(), keys[1].latin1(), val ); | 1437 | odebug << "deleting >" << keys[0].latin1() << "< key >" << keys[1].latin1() << "< value >" << val << "<" << oendl; |
1438 | } | 1438 | } |
1439 | } | 1439 | } |
1440 | for( QMap<QString,QStringList>::Iterator it = listEntries.begin(); | 1440 | for( QMap<QString,QStringList>::Iterator it = listEntries.begin(); |
1441 | it != listEntries.end(); ++it ){ | 1441 | it != listEntries.end(); ++it ){ |
1442 | QStringList val = it.data(); | 1442 | QStringList val = it.data(); |
1443 | key = it.key(); | 1443 | key = it.key(); |
1444 | if(keys[0]==modemGroup()){ | 1444 | if(keys[0]==modemGroup()){ |
1445 | listEntries.remove( it ); | 1445 | listEntries.remove( it ); |
1446 | sepEntries.remove( key ); | 1446 | sepEntries.remove( key ); |
1447 | qDebug("deleting >%s< key >%s< value >%s<", keys[0].latin1(), keys[1].latin1(), val.join("").latin1() ); | 1447 | odebug << "deleting >" << keys[0].latin1() << "< key >" << keys[1].latin1() << "< value >" << val.join("").latin1() << "<" << oendl; |
1448 | } | 1448 | } |
1449 | } | 1449 | } |
1450 | 1450 | ||
1451 | return true; | 1451 | return true; |
1452 | 1452 | ||
1453 | } | 1453 | } |
1454 | 1454 | ||
1455 | bool PPPData::deleteDevice(const QString &dev) | 1455 | bool PPPData::deleteDevice(const QString &dev) |
1456 | { | 1456 | { |
1457 | if(!setDevice(dev)) | 1457 | if(!setDevice(dev)) |
1458 | return false; | 1458 | return false; |
1459 | 1459 | ||
1460 | return deleteDevice(); | 1460 | return deleteDevice(); |
1461 | } | 1461 | } |
1462 | 1462 | ||
1463 | int PPPData::newdevice() | 1463 | int PPPData::newdevice() |
1464 | { | 1464 | { |
1465 | 1465 | ||
1466 | qDebug("PPPData::newdevice highcount %i",highcountdev); | 1466 | odebug << "PPPData::newdevice highcount " << highcountdev << "" << oendl; |
1467 | 1467 | ||
1468 | 1468 | ||
1469 | QString tmp; | 1469 | QString tmp; |
1470 | tmp.sprintf("%s%i", MODEM_GRP, ++highcountdev); | 1470 | tmp.sprintf("%s%i", MODEM_GRP, ++highcountdev); |
1471 | _modemName = QString(tmp); | 1471 | _modemName = QString(tmp); |
1472 | deviceList << tmp; | 1472 | deviceList << tmp; |
1473 | qDebug("PPPData::newdevice() Group: >%s<",cgroup.latin1()); | 1473 | odebug << "PPPData::newdevice() Group: >" << cgroup.latin1() << "<" << oendl; |
1474 | return highcountdev; | 1474 | return highcountdev; |
1475 | } | 1475 | } |
1476 | 1476 | ||
1477 | int PPPData::copydevice(const QString&) | 1477 | int PPPData::copydevice(const QString&) |
1478 | { | 1478 | { |
1479 | return false; | 1479 | return false; |
1480 | } | 1480 | } |
1481 | 1481 | ||
1482 | 1482 | ||
1483 | QStringList PPPData::getDevicesNamesList() | 1483 | QStringList PPPData::getDevicesNamesList() |
1484 | { | 1484 | { |
1485 | QStringList list; | 1485 | QStringList list; |
1486 | QString save_mName = _modemName; | 1486 | QString save_mName = _modemName; |
1487 | qDebug("PPPData::getDevicesNamesList has %s", deviceList.join("---").latin1()); | 1487 | odebug << "PPPData::getDevicesNamesList has " << deviceList.join("---").latin1() << "" << oendl; |
1488 | for ( QStringList::Iterator it = deviceList.begin(); it != deviceList.end(); ++it ) { | 1488 | for ( QStringList::Iterator it = deviceList.begin(); it != deviceList.end(); ++it ) { |
1489 | _modemName = *it; | 1489 | _modemName = *it; |
1490 | qDebug("PPPData::getDevicesNamesList adding %s as %s",_modemName.latin1(), devname().latin1()); | 1490 | odebug << "PPPData::getDevicesNamesList adding " << _modemName.latin1() << " as " << devname().latin1() << "" << oendl; |
1491 | list << devname(); | 1491 | list << devname(); |
1492 | } | 1492 | } |
1493 | _modemName = save_mName; | 1493 | _modemName = save_mName; |
1494 | return list; | 1494 | return list; |
1495 | }; | 1495 | }; |
diff --git a/noncore/settings/networksettings/ppp/pppmodule.cpp b/noncore/settings/networksettings/ppp/pppmodule.cpp index a7caffe..2291e8a 100644 --- a/noncore/settings/networksettings/ppp/pppmodule.cpp +++ b/noncore/settings/networksettings/ppp/pppmodule.cpp | |||
@@ -51,62 +51,62 @@ namespace | |||
51 | * an interface was up while closing the application | 51 | * an interface was up while closing the application |
52 | * we need to be able to shut it down... | 52 | * we need to be able to shut it down... |
53 | */ | 53 | */ |
54 | PPPModule::PPPModule() : Module() | 54 | PPPModule::PPPModule() : Module() |
55 | { | 55 | { |
56 | InterfaceKeeper inFace; | 56 | InterfaceKeeper inFace; |
57 | QMap<QString,Connection> running = inFace.interfaces(); | 57 | QMap<QString,Connection> running = inFace.interfaces(); |
58 | QStringList handledInterfaceNames; | 58 | QStringList handledInterfaceNames; |
59 | 59 | ||
60 | QMap<QString,QString> ifaces = PPPData::getConfiguredInterfaces(); | 60 | QMap<QString,QString> ifaces = PPPData::getConfiguredInterfaces(); |
61 | QMap<QString,QString>::Iterator it; | 61 | QMap<QString,QString>::Iterator it; |
62 | InterfacePPP *iface; | 62 | InterfacePPP *iface; |
63 | qDebug("getting interfaces"); | 63 | odebug << "getting interfaces" << oendl; |
64 | for( it = ifaces.begin(); it != ifaces.end(); ++it ) | 64 | for( it = ifaces.begin(); it != ifaces.end(); ++it ) |
65 | { | 65 | { |
66 | qDebug("ifaces %s %s", it.key().latin1(), it.data().latin1() ); | 66 | odebug << "ifaces " << it.key().latin1() << " " << it.data().latin1() << "" << oendl; |
67 | iface = new InterfacePPP( 0, it.key() ); | 67 | iface = new InterfacePPP( 0, it.key() ); |
68 | iface->setHardwareName( it.data() ); | 68 | iface->setHardwareName( it.data() ); |
69 | list.append( (Interface*)iface ); | 69 | list.append( (Interface*)iface ); |
70 | 70 | ||
71 | // check if (*it) is one of the running ifaces | 71 | // check if (*it) is one of the running ifaces |
72 | if ( running.contains( it.data() ) ) | 72 | if ( running.contains( it.data() ) ) |
73 | { | 73 | { |
74 | qDebug("iface is running %s", it.key().latin1() ); | 74 | odebug << "iface is running " << it.key().latin1() << "" << oendl; |
75 | handledInterfaceNames << running[it.data()].device; | 75 | handledInterfaceNames << running[it.data()].device; |
76 | iface->setStatus( true ); | 76 | iface->setStatus( true ); |
77 | iface->setPPPDpid( running[it.data()].pid ); | 77 | iface->setPPPDpid( running[it.data()].pid ); |
78 | iface->modem()->setPPPDevice( running[it.data()].device ); | 78 | iface->modem()->setPPPDevice( running[it.data()].device ); |
79 | iface->refresh(); | 79 | iface->refresh(); |
80 | } | 80 | } |
81 | } | 81 | } |
82 | 82 | ||
83 | setHandledInterfaceNames( handledInterfaceNames ); | 83 | setHandledInterfaceNames( handledInterfaceNames ); |
84 | } | 84 | } |
85 | 85 | ||
86 | /** | 86 | /** |
87 | * Delete any interfaces that we own. | 87 | * Delete any interfaces that we own. |
88 | */ | 88 | */ |
89 | PPPModule::~PPPModule() | 89 | PPPModule::~PPPModule() |
90 | { | 90 | { |
91 | qDebug("PPPModule::~PPPModule() " ); | 91 | odebug << "PPPModule::~PPPModule() " << oendl; |
92 | QMap<QString,QString> ifaces; | 92 | QMap<QString,QString> ifaces; |
93 | InterfaceKeeper keeper; | 93 | InterfaceKeeper keeper; |
94 | Interface *i; | 94 | Interface *i; |
95 | for ( i=list.first(); i != 0; i=list.next() ) | 95 | for ( i=list.first(); i != 0; i=list.next() ) |
96 | { | 96 | { |
97 | /* if online save the state */ | 97 | /* if online save the state */ |
98 | if ( i->getStatus() ) | 98 | if ( i->getStatus() ) |
99 | { | 99 | { |
100 | qDebug("Iface %s is still up", i->getHardwareName().latin1() ); | 100 | odebug << "Iface " << i->getHardwareName().latin1() << " is still up" << oendl; |
101 | InterfacePPP* ppp = static_cast<InterfacePPP*>(i); | 101 | InterfacePPP* ppp = static_cast<InterfacePPP*>(i); |
102 | keeper.addInterface( ppp->pppPID(), ppp->pppDev(), ppp->getHardwareName() ); | 102 | keeper.addInterface( ppp->pppPID(), ppp->pppDev(), ppp->getHardwareName() ); |
103 | } | 103 | } |
104 | ifaces.insert( i->getInterfaceName(), i->getHardwareName() ); | 104 | ifaces.insert( i->getInterfaceName(), i->getHardwareName() ); |
105 | delete i; | 105 | delete i; |
106 | } | 106 | } |
107 | PPPData::setConfiguredInterfaces( ifaces ); | 107 | PPPData::setConfiguredInterfaces( ifaces ); |
108 | } | 108 | } |
109 | 109 | ||
110 | /** | 110 | /** |
111 | * Change the current profile | 111 | * Change the current profile |
112 | */ | 112 | */ |
@@ -132,25 +132,25 @@ QString PPPModule::getPixmapName(Interface* ) | |||
132 | */ | 132 | */ |
133 | bool PPPModule::isOwner(Interface *i) | 133 | bool PPPModule::isOwner(Interface *i) |
134 | { | 134 | { |
135 | return list.find( i ) != -1; | 135 | return list.find( i ) != -1; |
136 | } | 136 | } |
137 | 137 | ||
138 | /** | 138 | /** |
139 | * Create, and return the WLANConfigure Module | 139 | * Create, and return the WLANConfigure Module |
140 | * @return QWidget* pointer to this modules configure. | 140 | * @return QWidget* pointer to this modules configure. |
141 | */ | 141 | */ |
142 | QWidget *PPPModule::configure(Interface *i) | 142 | QWidget *PPPModule::configure(Interface *i) |
143 | { | 143 | { |
144 | qDebug("return ModemWidget"); | 144 | odebug << "return ModemWidget" << oendl; |
145 | PPPConfigWidget *pppconfig = new PPPConfigWidget( (InterfacePPP*)i, | 145 | PPPConfigWidget *pppconfig = new PPPConfigWidget( (InterfacePPP*)i, |
146 | 0, "PPPConfig", false, | 146 | 0, "PPPConfig", false, |
147 | (Qt::WDestructiveClose | Qt::WStyle_ContextHelp)); | 147 | (Qt::WDestructiveClose | Qt::WStyle_ContextHelp)); |
148 | return pppconfig; | 148 | return pppconfig; |
149 | } | 149 | } |
150 | 150 | ||
151 | /** | 151 | /** |
152 | * Create, and return the Information Module | 152 | * Create, and return the Information Module |
153 | * @return QWidget* pointer to this modules info. | 153 | * @return QWidget* pointer to this modules info. |
154 | */ | 154 | */ |
155 | QWidget *PPPModule::information(Interface *i) | 155 | QWidget *PPPModule::information(Interface *i) |
156 | { | 156 | { |
@@ -159,25 +159,25 @@ QWidget *PPPModule::information(Interface *i) | |||
159 | 159 | ||
160 | return new InterfaceInformationPPP( 0, "InterfaceInformationPPP", i ); | 160 | return new InterfaceInformationPPP( 0, "InterfaceInformationPPP", i ); |
161 | } | 161 | } |
162 | 162 | ||
163 | /** | 163 | /** |
164 | * Get all active (up or down) interfaces | 164 | * Get all active (up or down) interfaces |
165 | * @return QList<Interface> A list of interfaces that exsist that havn't | 165 | * @return QList<Interface> A list of interfaces that exsist that havn't |
166 | * been called by isOwner() | 166 | * been called by isOwner() |
167 | */ | 167 | */ |
168 | QList<Interface> PPPModule::getInterfaces() | 168 | QList<Interface> PPPModule::getInterfaces() |
169 | { | 169 | { |
170 | // List all of the files in the peer directory | 170 | // List all of the files in the peer directory |
171 | qDebug("PPPModule::getInterfaces"); | 171 | odebug << "PPPModule::getInterfaces" << oendl; |
172 | return list; | 172 | return list; |
173 | } | 173 | } |
174 | 174 | ||
175 | /** | 175 | /** |
176 | * Attempt to add a new interface as defined by name | 176 | * Attempt to add a new interface as defined by name |
177 | * @param name the name of the type of interface that should be created given | 177 | * @param name the name of the type of interface that should be created given |
178 | * by possibleNewInterfaces(); | 178 | * by possibleNewInterfaces(); |
179 | * @return Interface* NULL if it was unable to be created. | 179 | * @return Interface* NULL if it was unable to be created. |
180 | */ | 180 | */ |
181 | Interface *PPPModule::addNewInterface(const QString &newInterface) | 181 | Interface *PPPModule::addNewInterface(const QString &newInterface) |
182 | { | 182 | { |
183 | 183 | ||
@@ -252,32 +252,32 @@ namespace | |||
252 | QMap<QString, Connection> InterfaceKeeper::interfaces()const | 252 | QMap<QString, Connection> InterfaceKeeper::interfaces()const |
253 | { | 253 | { |
254 | Config cfg("ppp_plugin_keeper"); | 254 | Config cfg("ppp_plugin_keeper"); |
255 | QMap<QString, Connection> ifaces; | 255 | QMap<QString, Connection> ifaces; |
256 | QStringList lst = cfg.groupList(); | 256 | QStringList lst = cfg.groupList(); |
257 | for (QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) | 257 | for (QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) |
258 | { | 258 | { |
259 | Connection con; | 259 | Connection con; |
260 | cfg.setGroup( (*it) ); | 260 | cfg.setGroup( (*it) ); |
261 | con.name = (*it); | 261 | con.name = (*it); |
262 | con.pid = cfg.readNumEntry("pid"); | 262 | con.pid = cfg.readNumEntry("pid"); |
263 | con.device = cfg.readEntry("device"); | 263 | con.device = cfg.readEntry("device"); |
264 | qDebug(" %s %s %d", con.name.latin1(), con.device.latin1(), con.pid ); | 264 | odebug << " " << con.name.latin1() << " " << con.device.latin1() << " " << con.pid << "" << oendl; |
265 | 265 | ||
266 | if ( con.pid != -1 && isAvailable( con.pid ) ) | 266 | if ( con.pid != -1 && isAvailable( con.pid ) ) |
267 | ifaces.insert( con.name, con ); | 267 | ifaces.insert( con.name, con ); |
268 | } | 268 | } |
269 | return ifaces; | 269 | return ifaces; |
270 | } | 270 | } |
271 | bool InterfaceKeeper::isAvailable( pid_t p)const | 271 | bool InterfaceKeeper::isAvailable( pid_t p)const |
272 | { | 272 | { |
273 | if (::kill(p, 0 ) == 0 || errno != ESRCH ) | 273 | if (::kill(p, 0 ) == 0 || errno != ESRCH ) |
274 | { | 274 | { |
275 | qDebug("isAvailable %d", p); | 275 | odebug << "isAvailable " << p << "" << oendl; |
276 | return true; | 276 | return true; |
277 | } | 277 | } |
278 | 278 | ||
279 | qDebug("notAvailable %d", p); | 279 | odebug << "notAvailable " << p << "" << oendl; |
280 | return false; | 280 | return false; |
281 | } | 281 | } |
282 | 282 | ||
283 | } | 283 | } |
diff --git a/noncore/settings/networksettings/wlan/infoimp.cpp b/noncore/settings/networksettings/wlan/infoimp.cpp index bd56678..c558f5e 100644 --- a/noncore/settings/networksettings/wlan/infoimp.cpp +++ b/noncore/settings/networksettings/wlan/infoimp.cpp | |||
@@ -4,40 +4,40 @@ | |||
4 | #include <qtimer.h> | 4 | #include <qtimer.h> |
5 | #include <qprogressbar.h> | 5 | #include <qprogressbar.h> |
6 | #include <qlabel.h> | 6 | #include <qlabel.h> |
7 | 7 | ||
8 | /** | 8 | /** |
9 | * Constructor. If wireless extensions are enabled on device name then | 9 | * Constructor. If wireless extensions are enabled on device name then |
10 | * start a timer that every second will update the information. | 10 | * start a timer that every second will update the information. |
11 | */ | 11 | */ |
12 | WlanInfoImp::WlanInfoImp( QWidget* parent, const char* name, WFlags fl): WlanInfo(parent, name, fl){ | 12 | WlanInfoImp::WlanInfoImp( QWidget* parent, const char* name, WFlags fl): WlanInfo(parent, name, fl){ |
13 | WExtensions *wExtensions = new WExtensions(name); | 13 | WExtensions *wExtensions = new WExtensions(name); |
14 | if(!wExtensions->doesHaveWirelessExtensions()){ | 14 | if(!wExtensions->doesHaveWirelessExtensions()){ |
15 | delete wExtensions; | 15 | delete wExtensions; |
16 | qDebug("WlanInfoImp::No wireless extension"); | 16 | odebug << "WlanInfoImp::No wireless extension" << oendl; |
17 | return; | 17 | return; |
18 | } | 18 | } |
19 | delete wExtensions; | 19 | delete wExtensions; |
20 | timer = new QTimer( this ); | 20 | timer = new QTimer( this ); |
21 | connect( timer, SIGNAL(timeout()), this, SLOT(update())); | 21 | connect( timer, SIGNAL(timeout()), this, SLOT(update())); |
22 | timer->start( 1000, false ); | 22 | timer->start( 1000, false ); |
23 | } | 23 | } |
24 | 24 | ||
25 | /** | 25 | /** |
26 | * Updates the information about the wireless device. | 26 | * Updates the information about the wireless device. |
27 | */ | 27 | */ |
28 | void WlanInfoImp::update(){ | 28 | void WlanInfoImp::update(){ |
29 | WExtensions *wExtensions = new WExtensions(this->name()); | 29 | WExtensions *wExtensions = new WExtensions(this->name()); |
30 | if(!wExtensions->doesHaveWirelessExtensions()){ | 30 | if(!wExtensions->doesHaveWirelessExtensions()){ |
31 | qDebug("No extension"); | 31 | odebug << "No extension" << oendl; |
32 | delete wExtensions; | 32 | delete wExtensions; |
33 | timer->stop(); | 33 | timer->stop(); |
34 | return; | 34 | return; |
35 | } | 35 | } |
36 | essidLabel->setText(wExtensions->essid()); | 36 | essidLabel->setText(wExtensions->essid()); |
37 | apLabel->setText(wExtensions->ap()); | 37 | apLabel->setText(wExtensions->ap()); |
38 | stationLabel->setText(wExtensions->station()); | 38 | stationLabel->setText(wExtensions->station()); |
39 | modeLabel->setText(wExtensions->mode()); | 39 | modeLabel->setText(wExtensions->mode()); |
40 | channelLabel->setText(QString("%1").arg(wExtensions->channel())); | 40 | channelLabel->setText(QString("%1").arg(wExtensions->channel())); |
41 | int signal = 0; | 41 | int signal = 0; |
42 | int noise = 0; | 42 | int noise = 0; |
43 | int quality = 0; | 43 | int quality = 0; |
diff --git a/noncore/settings/networksettings/wlan/wextensions.cpp b/noncore/settings/networksettings/wlan/wextensions.cpp index d1fff88..9c64323 100644 --- a/noncore/settings/networksettings/wlan/wextensions.cpp +++ b/noncore/settings/networksettings/wlan/wextensions.cpp | |||
@@ -103,25 +103,25 @@ int WExtensions::channel(){ | |||
103 | 103 | ||
104 | // http://www.elanix.com/pdf/an137e.pdf | 104 | // http://www.elanix.com/pdf/an137e.pdf |
105 | 105 | ||
106 | double num = (double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000); | 106 | double num = (double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000); |
107 | double left = 2.401; | 107 | double left = 2.401; |
108 | double right = 2.416; | 108 | double right = 2.416; |
109 | for(int channel = 1; channel<= 15; channel++){ | 109 | for(int channel = 1; channel<= 15; channel++){ |
110 | if( num >= left && num <= right ) | 110 | if( num >= left && num <= right ) |
111 | return channel; | 111 | return channel; |
112 | left += 0.005; | 112 | left += 0.005; |
113 | right += 0.005; | 113 | right += 0.005; |
114 | } | 114 | } |
115 | qDebug(QString("Unknown frequency: %1, returning -1 for the channel.").arg(num).latin1()); | 115 | odebug << QString("Unknown frequency: %1, returning -1 for the channel.").arg(num).latin1() << oendl; |
116 | return -1; | 116 | return -1; |
117 | } | 117 | } |
118 | 118 | ||
119 | /*** | 119 | /*** |
120 | * Get the current rate that the card is transmiting at. | 120 | * Get the current rate that the card is transmiting at. |
121 | * @return double the rate, 0 if error. | 121 | * @return double the rate, 0 if error. |
122 | */ | 122 | */ |
123 | double WExtensions::rate(){ | 123 | double WExtensions::rate(){ |
124 | if(!hasWirelessExtensions) | 124 | if(!hasWirelessExtensions) |
125 | return 0; | 125 | return 0; |
126 | if(0 == ioctl(fd, SIOCGIWRATE, &iwr)){ | 126 | if(0 == ioctl(fd, SIOCGIWRATE, &iwr)){ |
127 | return ((double)iwr.u.bitrate.value)/1000000; | 127 | return ((double)iwr.u.bitrate.value)/1000000; |
@@ -168,33 +168,33 @@ bool WExtensions::stats(int &signal, int &noise, int &quality){ | |||
168 | 168 | ||
169 | QFile wfile( PROCNETWIRELESS ); | 169 | QFile wfile( PROCNETWIRELESS ); |
170 | if(!wfile.open( IO_ReadOnly )) | 170 | if(!wfile.open( IO_ReadOnly )) |
171 | return false; | 171 | return false; |
172 | 172 | ||
173 | QTextStream wstream( &wfile ); | 173 | QTextStream wstream( &wfile ); |
174 | wstream.readLine(); // skip the first two lines | 174 | wstream.readLine(); // skip the first two lines |
175 | wstream.readLine(); // because they only contain headers | 175 | wstream.readLine(); // because they only contain headers |
176 | while(!wstream.atEnd()){ | 176 | while(!wstream.atEnd()){ |
177 | wstream >> name >> status >> quality >> c >> signal >> c >> noise; | 177 | wstream >> name >> status >> quality >> c >> signal >> c >> noise; |
178 | if(name == QString("%1:").arg(interface)){ | 178 | if(name == QString("%1:").arg(interface)){ |
179 | if ( quality > 92 ) | 179 | if ( quality > 92 ) |
180 | qDebug( "WIFIAPPLET: D'oh! Quality %d > estimated max!\n", quality ); | 180 | odebug << "WIFIAPPLET: D'oh! Quality " << quality << " > estimated max!\n" << oendl; |
181 | if ( ( signal > IW_UPPER ) || ( signal < IW_LOWER ) ) | 181 | if ( ( signal > IW_UPPER ) || ( signal < IW_LOWER ) ) |
182 | qDebug( "WIFIAPPLET: Doh! Strength %d > estimated max!\n", signal ); | 182 | odebug << "WIFIAPPLET: Doh! Strength " << signal << " > estimated max!\n" << oendl; |
183 | if ( ( noise > IW_UPPER ) || ( noise < IW_LOWER ) ) | 183 | if ( ( noise > IW_UPPER ) || ( noise < IW_LOWER ) ) |
184 | qDebug( "WIFIAPPLET: Doh! Noise %d > estimated max!\n", noise ); | 184 | odebug << "WIFIAPPLET: Doh! Noise " << noise << " > estimated max!\n" << oendl; |
185 | //qDebug(QString("q:%1, s:%2, n:%3").arg(quality).arg(signal).arg(noise).latin1()); | 185 | //odebug << QString("q:%1, s:%2, n:%3").arg(quality).arg(signal).arg(noise).latin1() << oendl; |
186 | signal = ( ( signal-IW_LOWER ) * 100 ) / IW_UPPER; | 186 | signal = ( ( signal-IW_LOWER ) * 100 ) / IW_UPPER; |
187 | noise = ( ( noise-IW_LOWER ) * 100 ) / IW_UPPER; | 187 | noise = ( ( noise-IW_LOWER ) * 100 ) / IW_UPPER; |
188 | quality = ( quality*100 ) / 92; | 188 | quality = ( quality*100 ) / 92; |
189 | return true; | 189 | return true; |
190 | } | 190 | } |
191 | } | 191 | } |
192 | 192 | ||
193 | qDebug("WExtensions::statsCard no longer present."); | 193 | odebug << "WExtensions::statsCard no longer present." << oendl; |
194 | quality = -1; | 194 | quality = -1; |
195 | signal = IW_LOWER; | 195 | signal = IW_LOWER; |
196 | noise = IW_LOWER; | 196 | noise = IW_LOWER; |
197 | return false; | 197 | return false; |
198 | } | 198 | } |
199 | 199 | ||
200 | // wextensions.cpp | 200 | // wextensions.cpp |
diff --git a/noncore/settings/networksettings/wlan/wlanimp.cpp b/noncore/settings/networksettings/wlan/wlanimp.cpp index 80a9927..fe7941d 100644 --- a/noncore/settings/networksettings/wlan/wlanimp.cpp +++ b/noncore/settings/networksettings/wlan/wlanimp.cpp | |||
@@ -36,25 +36,25 @@ WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, W | |||
36 | if (file.open(IO_ReadOnly)){ | 36 | if (file.open(IO_ReadOnly)){ |
37 | QTextStream stream( &file ); | 37 | QTextStream stream( &file ); |
38 | QString line = ""; | 38 | QString line = ""; |
39 | while ( !stream.eof() ) { | 39 | while ( !stream.eof() ) { |
40 | line += stream.readLine(); | 40 | line += stream.readLine(); |
41 | line += "\n"; | 41 | line += "\n"; |
42 | } | 42 | } |
43 | file.close(); | 43 | file.close(); |
44 | settingsFileText = QStringList::split("\n", line, true); | 44 | settingsFileText = QStringList::split("\n", line, true); |
45 | parseSettingFile(); | 45 | parseSettingFile(); |
46 | } | 46 | } |
47 | else | 47 | else |
48 | qDebug(QString("WLANImp: Can't open file: %1 for reading.").arg(wlanFile).latin1()); | 48 | odebug << QString("WLANImp: Can't open file: %1 for reading.").arg(wlanFile).latin1() << oendl; |
49 | connect(networkType, SIGNAL(activated(int)), this, SLOT(typeChanged(int))); | 49 | connect(networkType, SIGNAL(activated(int)), this, SLOT(typeChanged(int))); |
50 | } | 50 | } |
51 | 51 | ||
52 | void WLANImp::typeChanged(int mod){ | 52 | void WLANImp::typeChanged(int mod){ |
53 | networkChannel->setEnabled(mod); | 53 | networkChannel->setEnabled(mod); |
54 | channelLabel->setEnabled(mod); | 54 | channelLabel->setEnabled(mod); |
55 | } | 55 | } |
56 | 56 | ||
57 | /** | 57 | /** |
58 | * Change the profile for both wireless settings and network settings. | 58 | * Change the profile for both wireless settings and network settings. |
59 | */ | 59 | */ |
60 | void WLANImp::setProfile(const QString &profile){ | 60 | void WLANImp::setProfile(const QString &profile){ |
@@ -137,25 +137,25 @@ void WLANImp::parseSettingFile(){ | |||
137 | } | 137 | } |
138 | } | 138 | } |
139 | 139 | ||
140 | /** | 140 | /** |
141 | * Saves settings to the wireless.opts file using the current profile | 141 | * Saves settings to the wireless.opts file using the current profile |
142 | */ | 142 | */ |
143 | void WLANImp::changeAndSaveSettingFile(){ | 143 | void WLANImp::changeAndSaveSettingFile(){ |
144 | QString wlanFile = WIRELESS_OPTS; | 144 | QString wlanFile = WIRELESS_OPTS; |
145 | QFile::remove(wlanFile); | 145 | QFile::remove(wlanFile); |
146 | QFile file(wlanFile); | 146 | QFile file(wlanFile); |
147 | 147 | ||
148 | if (!file.open(IO_ReadWrite)){ | 148 | if (!file.open(IO_ReadWrite)){ |
149 | qDebug(QString("WLANImp::changeAndSaveSettingFile(): Can't open file: %1 for writing.").arg(wlanFile).latin1()); | 149 | odebug << QString("WLANImp::changeAndSaveSettingFile(): Can't open file: %1 for writing.").arg(wlanFile).latin1() << oendl; |
150 | return; | 150 | return; |
151 | } | 151 | } |
152 | 152 | ||
153 | QTextStream stream( &file ); | 153 | QTextStream stream( &file ); |
154 | bool foundCase = false; | 154 | bool foundCase = false; |
155 | bool found = false; | 155 | bool found = false; |
156 | bool output = true; | 156 | bool output = true; |
157 | for ( QStringList::Iterator it = settingsFileText.begin(); it != settingsFileText.end(); ++it ) { | 157 | for ( QStringList::Iterator it = settingsFileText.begin(); it != settingsFileText.end(); ++it ) { |
158 | QString line = (*it).simplifyWhiteSpace(); | 158 | QString line = (*it).simplifyWhiteSpace(); |
159 | if(line.contains("case")) | 159 | if(line.contains("case")) |
160 | foundCase = true; | 160 | foundCase = true; |
161 | // See if we found our scheme to write or the sceme couldn't be found | 161 | // See if we found our scheme to write or the sceme couldn't be found |
@@ -227,19 +227,19 @@ void WLANImp::accept(){ | |||
227 | changeAndSaveSettingFile(); | 227 | changeAndSaveSettingFile(); |
228 | 228 | ||
229 | // Try to save the interfaces settings. | 229 | // Try to save the interfaces settings. |
230 | if(!interfaceSetup->saveChanges()) | 230 | if(!interfaceSetup->saveChanges()) |
231 | return; | 231 | return; |
232 | 232 | ||
233 | OProcess insert; | 233 | OProcess insert; |
234 | insert << "sh"; | 234 | insert << "sh"; |
235 | insert << "-c"; | 235 | insert << "-c"; |
236 | insert << "cardctl eject && cardctl insert"; | 236 | insert << "cardctl eject && cardctl insert"; |
237 | 237 | ||
238 | if (!insert.start(OProcess::DontCare, OProcess::NoCommunication) ) { | 238 | if (!insert.start(OProcess::DontCare, OProcess::NoCommunication) ) { |
239 | qWarning("could not start cardctl"); | 239 | owarn << "could not start cardctl" << oendl; |
240 | } | 240 | } |
241 | 241 | ||
242 | // Close out the dialog | 242 | // Close out the dialog |
243 | QDialog::accept(); | 243 | QDialog::accept(); |
244 | } | 244 | } |
245 | 245 | ||
diff --git a/noncore/settings/networksettings/wlan/wlanimp2.cpp b/noncore/settings/networksettings/wlan/wlanimp2.cpp index eeebe7f..e483efe 100644 --- a/noncore/settings/networksettings/wlan/wlanimp2.cpp +++ b/noncore/settings/networksettings/wlan/wlanimp2.cpp | |||
@@ -43,25 +43,25 @@ | |||
43 | * Constructor, read in the wireless.opts file for parsing later. | 43 | * Constructor, read in the wireless.opts file for parsing later. |
44 | */ | 44 | */ |
45 | using namespace Opie::Net; | 45 | using namespace Opie::Net; |
46 | using namespace Opie::Core; | 46 | using namespace Opie::Core; |
47 | WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl) : WLAN(parent, name, modal, fl), interface(i), currentProfile("*") { | 47 | WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl) : WLAN(parent, name, modal, fl), interface(i), currentProfile("*") { |
48 | interfaces = new Interfaces(); | 48 | interfaces = new Interfaces(); |
49 | interfaceSetup = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i, interfaces); | 49 | interfaceSetup = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i, interfaces); |
50 | tabWidget->insertTab(interfaceSetup, "TCP/IP"); | 50 | tabWidget->insertTab(interfaceSetup, "TCP/IP"); |
51 | 51 | ||
52 | // Check sanity - the existance of the wireless-tools if-pre-up script | 52 | // Check sanity - the existance of the wireless-tools if-pre-up script |
53 | QFile file(QString(PREUP)); | 53 | QFile file(QString(PREUP)); |
54 | if (file.exists()) { | 54 | if (file.exists()) { |
55 | qWarning(QString("WLANImp: Unable to open /etc/network/if-pre-up.d/wireless-tools")); | 55 | owarn << QString("WLANImp: Unable to open /etc/network/if-pre-up.d/wireless-tools") << oendl; |
56 | } | 56 | } |
57 | 57 | ||
58 | connect( rescanButton, SIGNAL( clicked() ), this, SLOT( rescanNeighbourhood() ) ); | 58 | connect( rescanButton, SIGNAL( clicked() ), this, SLOT( rescanNeighbourhood() ) ); |
59 | connect( netView, SIGNAL( clicked(QListViewItem*) ), this, SLOT( selectNetwork(QListViewItem*) ) ); | 59 | connect( netView, SIGNAL( clicked(QListViewItem*) ), this, SLOT( selectNetwork(QListViewItem*) ) ); |
60 | netView->setColumnAlignment( col_chn, AlignCenter ); | 60 | netView->setColumnAlignment( col_chn, AlignCenter ); |
61 | netView->setItemMargin( 3 ); | 61 | netView->setItemMargin( 3 ); |
62 | netView->setAllColumnsShowFocus( true ); | 62 | netView->setAllColumnsShowFocus( true ); |
63 | 63 | ||
64 | } | 64 | } |
65 | 65 | ||
66 | WLANImp::~WLANImp() { | 66 | WLANImp::~WLANImp() { |
67 | //FIXME: delete interfaces; | 67 | //FIXME: delete interfaces; |
@@ -224,25 +224,25 @@ void WLANImp::accept() { | |||
224 | // Close out the dialog | 224 | // Close out the dialog |
225 | // FIXME: QDialog::accept(); | 225 | // FIXME: QDialog::accept(); |
226 | } | 226 | } |
227 | 227 | ||
228 | void WLANImp::writeOpts() { | 228 | void WLANImp::writeOpts() { |
229 | // eh can't really do anything about it other then return. :-D | 229 | // eh can't really do anything about it other then return. :-D |
230 | if(!interfaces->isInterfaceSet()){ | 230 | if(!interfaces->isInterfaceSet()){ |
231 | QMessageBox::warning(0,"Inface not set","should not happen!!!"); | 231 | QMessageBox::warning(0,"Inface not set","should not happen!!!"); |
232 | return; | 232 | return; |
233 | } | 233 | } |
234 | bool error = false; | 234 | bool error = false; |
235 | 235 | ||
236 | qDebug("setting wlan interface %s", interfaces->getInterfaceName( error ).latin1() ); | 236 | odebug << "setting wlan interface " << interfaces->getInterfaceName( error ).latin1() << "" << oendl; |
237 | 237 | ||
238 | if (error) QMessageBox::warning(0,"Inface not set","should not happen!!!"); | 238 | if (error) QMessageBox::warning(0,"Inface not set","should not happen!!!"); |
239 | 239 | ||
240 | interfaces->setInterfaceOption(QString("wireless_mode"), mode->currentText()); | 240 | interfaces->setInterfaceOption(QString("wireless_mode"), mode->currentText()); |
241 | interfaces->setInterfaceOption(QString("wireless_essid"), essid->currentText()); | 241 | interfaces->setInterfaceOption(QString("wireless_essid"), essid->currentText()); |
242 | 242 | ||
243 | if (specifyAp->isChecked()) { | 243 | if (specifyAp->isChecked()) { |
244 | interfaces->setInterfaceOption(QString("wireless_ap"), macEdit->text()); | 244 | interfaces->setInterfaceOption(QString("wireless_ap"), macEdit->text()); |
245 | } else { | 245 | } else { |
246 | interfaces->removeInterfaceOption(QString("wireless_ap")); | 246 | interfaces->removeInterfaceOption(QString("wireless_ap")); |
247 | } | 247 | } |
248 | 248 | ||
@@ -298,83 +298,83 @@ void WLANImp::writeOpts() { | |||
298 | 298 | ||
299 | QDialog::accept(); | 299 | QDialog::accept(); |
300 | } | 300 | } |
301 | 301 | ||
302 | /* | 302 | /* |
303 | * Scan for possible wireless networks around... | 303 | * Scan for possible wireless networks around... |
304 | * ... powered by Wellenreiter II technology (C) Michael 'Mickey' Lauer <mickeyl@handhelds.org> | 304 | * ... powered by Wellenreiter II technology (C) Michael 'Mickey' Lauer <mickeyl@handhelds.org> |
305 | */ | 305 | */ |
306 | 306 | ||
307 | void WLANImp::rescanNeighbourhood() | 307 | void WLANImp::rescanNeighbourhood() |
308 | { | 308 | { |
309 | QString name = interface->getInterfaceName(); | 309 | QString name = interface->getInterfaceName(); |
310 | qDebug( "rescanNeighbourhood via '%s'", (const char*) name ); | 310 | odebug << "rescanNeighbourhood via '" << (const char*) name << "'" << oendl; |
311 | 311 | ||
312 | OWirelessNetworkInterface* wiface = static_cast<OWirelessNetworkInterface*>( ONetwork::instance()->interface( name ) ); | 312 | OWirelessNetworkInterface* wiface = static_cast<OWirelessNetworkInterface*>( ONetwork::instance()->interface( name ) ); |
313 | assert( wiface ); | 313 | assert( wiface ); |
314 | 314 | ||
315 | // try to guess device type | 315 | // try to guess device type |
316 | QString devicetype; | 316 | QString devicetype; |
317 | QFile m( "/proc/modules" ); | 317 | QFile m( "/proc/modules" ); |
318 | if ( m.open( IO_ReadOnly ) ) | 318 | if ( m.open( IO_ReadOnly ) ) |
319 | { | 319 | { |
320 | QString line; | 320 | QString line; |
321 | QTextStream modules( &m ); | 321 | QTextStream modules( &m ); |
322 | while( !modules.atEnd() && !devicetype ) | 322 | while( !modules.atEnd() && !devicetype ) |
323 | { | 323 | { |
324 | modules >> line; | 324 | modules >> line; |
325 | if ( line.contains( "cisco" ) ) devicetype = "cisco"; | 325 | if ( line.contains( "cisco" ) ) devicetype = "cisco"; |
326 | else if ( line.contains( "hostap" ) ) devicetype = "hostap"; | 326 | else if ( line.contains( "hostap" ) ) devicetype = "hostap"; |
327 | else if ( line.contains( "prism" ) ) devicetype = "wlan-ng"; /* puke */ | 327 | else if ( line.contains( "prism" ) ) devicetype = "wlan-ng"; /* puke */ |
328 | else if ( line.contains( "orinoco" ) ) devicetype = "orinoco"; | 328 | else if ( line.contains( "orinoco" ) ) devicetype = "orinoco"; |
329 | } | 329 | } |
330 | } | 330 | } |
331 | if ( devicetype.isEmpty() ) | 331 | if ( devicetype.isEmpty() ) |
332 | { | 332 | { |
333 | qWarning( "rescanNeighbourhood(): couldn't guess device type :(" ); | 333 | owarn << "rescanNeighbourhood(): couldn't guess device type :(" << oendl; |
334 | return; | 334 | return; |
335 | } | 335 | } |
336 | else | 336 | else |
337 | { | 337 | { |
338 | qDebug( "rescanNeighbourhood(): device type seems to be '%s'", (const char*) devicetype ); | 338 | odebug << "rescanNeighbourhood(): device type seems to be '" << (const char*) devicetype << "'" << oendl; |
339 | } | 339 | } |
340 | 340 | ||
341 | // configure interface to receive 802.11 management frames | 341 | // configure interface to receive 802.11 management frames |
342 | 342 | ||
343 | wiface->setUp( true ); | 343 | wiface->setUp( true ); |
344 | wiface->setPromiscuousMode( true ); | 344 | wiface->setPromiscuousMode( true ); |
345 | 345 | ||
346 | if ( devicetype == "cisco" ) wiface->setMonitoring( new OCiscoMonitoringInterface( wiface, false ) ); | 346 | if ( devicetype == "cisco" ) wiface->setMonitoring( new OCiscoMonitoringInterface( wiface, false ) ); |
347 | else if ( devicetype == "hostap" ) wiface->setMonitoring( new OHostAPMonitoringInterface( wiface, false ) ); | 347 | else if ( devicetype == "hostap" ) wiface->setMonitoring( new OHostAPMonitoringInterface( wiface, false ) ); |
348 | else if ( devicetype == "wlan-ng" ) wiface->setMonitoring( new OWlanNGMonitoringInterface( wiface, false ) ); | 348 | else if ( devicetype == "wlan-ng" ) wiface->setMonitoring( new OWlanNGMonitoringInterface( wiface, false ) ); |
349 | else if ( devicetype == "orinoco" ) wiface->setMonitoring( new OOrinocoMonitoringInterface( wiface, false ) ); | 349 | else if ( devicetype == "orinoco" ) wiface->setMonitoring( new OOrinocoMonitoringInterface( wiface, false ) ); |
350 | else | 350 | else |
351 | { | 351 | { |
352 | qDebug( "rescanNeighbourhood(): unsupported device type for monitoring :(" ); | 352 | odebug << "rescanNeighbourhood(): unsupported device type for monitoring :(" << oendl; |
353 | return; | 353 | return; |
354 | } | 354 | } |
355 | 355 | ||
356 | wiface->setMode( "monitor" ); | 356 | wiface->setMode( "monitor" ); |
357 | if ( wiface->mode() != "monitor" ) | 357 | if ( wiface->mode() != "monitor" ) |
358 | { | 358 | { |
359 | qWarning( "rescanNeighbourhood(): Unable to bring device into monitor mode (%s).", strerror( errno ) ); | 359 | owarn << "rescanNeighbourhood(): Unable to bring device into monitor mode (" << strerror( errno ) << ")." << oendl; |
360 | return; | 360 | return; |
361 | } | 361 | } |
362 | 362 | ||
363 | // open a packet capturer | 363 | // open a packet capturer |
364 | OPacketCapturer* cap = new OPacketCapturer(); | 364 | OPacketCapturer* cap = new OPacketCapturer(); |
365 | cap->open( name ); | 365 | cap->open( name ); |
366 | if ( !cap->isOpen() ) | 366 | if ( !cap->isOpen() ) |
367 | { | 367 | { |
368 | qWarning( "rescanNeighbourhood(): Unable to open libpcap (%s).", strerror( errno ) ); | 368 | owarn << "rescanNeighbourhood(): Unable to open libpcap (" << strerror( errno ) << ")." << oendl; |
369 | return; | 369 | return; |
370 | } | 370 | } |
371 | 371 | ||
372 | // display splash screen | 372 | // display splash screen |
373 | QFrame* splash = new QFrame( this, "splash", false, WStyle_StaysOnTop | WStyle_DialogBorder | WStyle_Customize ); | 373 | QFrame* splash = new QFrame( this, "splash", false, WStyle_StaysOnTop | WStyle_DialogBorder | WStyle_Customize ); |
374 | splash->setLineWidth( 2 ); | 374 | splash->setLineWidth( 2 ); |
375 | splash->setFrameStyle( QFrame::Panel | QFrame::Raised ); | 375 | splash->setFrameStyle( QFrame::Panel | QFrame::Raised ); |
376 | QVBoxLayout* vbox = new QVBoxLayout( splash, 4, 4 ); | 376 | QVBoxLayout* vbox = new QVBoxLayout( splash, 4, 4 ); |
377 | QLabel* lab = new QLabel( "<center><b>Scanning...</b><br>Please Wait...</center>", splash ); | 377 | QLabel* lab = new QLabel( "<center><b>Scanning...</b><br>Please Wait...</center>", splash ); |
378 | QProgressBar* pb = new QProgressBar( wiface->channels(), splash ); | 378 | QProgressBar* pb = new QProgressBar( wiface->channels(), splash ); |
379 | vbox->addWidget( lab ); | 379 | vbox->addWidget( lab ); |
380 | vbox->addWidget( pb ); | 380 | vbox->addWidget( pb ); |
@@ -389,33 +389,33 @@ void WLANImp::rescanNeighbourhood() | |||
389 | splash->show(); | 389 | splash->show(); |
390 | splash->raise(); | 390 | splash->raise(); |
391 | qApp->processEvents(); | 391 | qApp->processEvents(); |
392 | 392 | ||
393 | // set capturer to non-blocking mode | 393 | // set capturer to non-blocking mode |
394 | cap->setBlocking( false ); | 394 | cap->setBlocking( false ); |
395 | 395 | ||
396 | for ( int i = 1; i <= wiface->channels(); ++i ) | 396 | for ( int i = 1; i <= wiface->channels(); ++i ) |
397 | { | 397 | { |
398 | wiface->setChannel( i ); | 398 | wiface->setChannel( i ); |
399 | pb->setProgress( i ); | 399 | pb->setProgress( i ); |
400 | qApp->processEvents(); | 400 | qApp->processEvents(); |
401 | qDebug( "rescanNeighbourhood(): listening on channel %d...", i ); | 401 | odebug << "rescanNeighbourhood(): listening on channel " << i << "..." << oendl; |
402 | OPacket* p = cap->next( 1000 ); | 402 | OPacket* p = cap->next( 1000 ); |
403 | if ( !p ) | 403 | if ( !p ) |
404 | { | 404 | { |
405 | qDebug( "rescanNeighbourhood(): nothing received on channel %d", i ); | 405 | odebug << "rescanNeighbourhood(): nothing received on channel " << i << "" << oendl; |
406 | } | 406 | } |
407 | else | 407 | else |
408 | { | 408 | { |
409 | qDebug( "rescanNeighbourhood(): TADAA - something came in on channel %d", i ); | 409 | odebug << "rescanNeighbourhood(): TADAA - something came in on channel " << i << "" << oendl; |
410 | handlePacket( p ); | 410 | handlePacket( p ); |
411 | } | 411 | } |
412 | } | 412 | } |
413 | 413 | ||
414 | cap->close(); | 414 | cap->close(); |
415 | wiface->setMode( "managed" ); // TODO: use previous mode | 415 | wiface->setMode( "managed" ); // TODO: use previous mode |
416 | wiface->setPromiscuousMode( false ); | 416 | wiface->setPromiscuousMode( false ); |
417 | 417 | ||
418 | splash->hide(); | 418 | splash->hide(); |
419 | delete splash; | 419 | delete splash; |
420 | 420 | ||
421 | } | 421 | } |
@@ -430,25 +430,25 @@ void WLANImp::handlePacket( OPacket* p ) | |||
430 | 430 | ||
431 | QString type; | 431 | QString type; |
432 | if ( beacon->canIBSS() ) | 432 | if ( beacon->canIBSS() ) |
433 | { | 433 | { |
434 | type = "adhoc"; | 434 | type = "adhoc"; |
435 | } | 435 | } |
436 | else if ( beacon->canESS() ) | 436 | else if ( beacon->canESS() ) |
437 | { | 437 | { |
438 | type = "managed"; | 438 | type = "managed"; |
439 | } | 439 | } |
440 | else | 440 | else |
441 | { | 441 | { |
442 | qWarning( "handlePacket(): invalid frame [possibly noise] detected!" ); | 442 | owarn << "handlePacket(): invalid frame [possibly noise] detected!" << oendl; |
443 | return; | 443 | return; |
444 | } | 444 | } |
445 | 445 | ||
446 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); | 446 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); |
447 | QString essid = ssid ? ssid->ID() : QString("<unknown>"); | 447 | QString essid = ssid ? ssid->ID() : QString("<unknown>"); |
448 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); | 448 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); |
449 | int channel = ds ? ds->channel() : -1; | 449 | int channel = ds ? ds->channel() : -1; |
450 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); | 450 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); |
451 | displayFoundNetwork( type, channel, essid, header->macAddress2() ); | 451 | displayFoundNetwork( type, channel, essid, header->macAddress2() ); |
452 | } | 452 | } |
453 | } | 453 | } |
454 | 454 | ||
diff --git a/noncore/settings/networksettings/wlan/wlanmodule.cpp b/noncore/settings/networksettings/wlan/wlanmodule.cpp index 74d7f8e..886af10 100644 --- a/noncore/settings/networksettings/wlan/wlanmodule.cpp +++ b/noncore/settings/networksettings/wlan/wlanmodule.cpp | |||
@@ -113,71 +113,71 @@ Interface *WLANModule::addNewInterface(const QString &){ | |||
113 | 113 | ||
114 | /** | 114 | /** |
115 | * Attempts to remove the interface, doesn't delete i | 115 | * Attempts to remove the interface, doesn't delete i |
116 | * @return bool true if successful, false otherwise. | 116 | * @return bool true if successful, false otherwise. |
117 | */ | 117 | */ |
118 | bool WLANModule::remove(Interface*){ | 118 | bool WLANModule::remove(Interface*){ |
119 | // Can't remove a hardware device, you can stop it though. | 119 | // Can't remove a hardware device, you can stop it though. |
120 | return false; | 120 | return false; |
121 | } | 121 | } |
122 | 122 | ||
123 | void WLANModule::receive(const QCString ¶m, const QByteArray &arg) | 123 | void WLANModule::receive(const QCString ¶m, const QByteArray &arg) |
124 | { | 124 | { |
125 | qDebug("WLANModule::receive "+param); | 125 | odebug << "WLANModule::receive "+param << oendl; |
126 | QStringList params = QStringList::split(",",param); | 126 | QStringList params = QStringList::split(",",param); |
127 | int count = params.count(); | 127 | int count = params.count(); |
128 | qDebug("WLANModule got %i params", count ); | 128 | odebug << "WLANModule got " << count << " params" << oendl; |
129 | if (count < 2){ | 129 | if (count < 2){ |
130 | qDebug("Erorr less than 2 parameter"); | 130 | odebug << "Erorr less than 2 parameter" << oendl; |
131 | qDebug("RETURNING"); | 131 | odebug << "RETURNING" << oendl; |
132 | return; | 132 | return; |
133 | } | 133 | } |
134 | 134 | ||
135 | QDataStream stream(arg,IO_ReadOnly); | 135 | QDataStream stream(arg,IO_ReadOnly); |
136 | QString interface; | 136 | QString interface; |
137 | QString action; | 137 | QString action; |
138 | int countMsgs = 0; | 138 | int countMsgs = 0; |
139 | stream >> interface; | 139 | stream >> interface; |
140 | qDebug("got count? >%s<",interface.latin1()); | 140 | odebug << "got count? >" << interface.latin1() << "<" << oendl; |
141 | if (interface == "count"){ | 141 | if (interface == "count"){ |
142 | qDebug("got count"); | 142 | odebug << "got count" << oendl; |
143 | stream >> action; | 143 | stream >> action; |
144 | qDebug("Got count num >%s<", action.latin1()); | 144 | odebug << "Got count num >" << action.latin1() << "<" << oendl; |
145 | countMsgs = action.toInt(); | 145 | countMsgs = action.toInt(); |
146 | } | 146 | } |
147 | 147 | ||
148 | QDialog *toShow; | 148 | QDialog *toShow; |
149 | //while (! stream.atEnd() ){ | 149 | //while (! stream.atEnd() ){ |
150 | for (int i = 0; i < countMsgs; i++){ | 150 | for (int i = 0; i < countMsgs; i++){ |
151 | qDebug("start stream %d/%d",i,countMsgs); | 151 | odebug << "start stream " << i << "/" << countMsgs << "" << oendl; |
152 | if (stream.atEnd()){ | 152 | if (stream.atEnd()){ |
153 | qDebug("end of stream"); | 153 | odebug << "end of stream" << oendl; |
154 | return; | 154 | return; |
155 | } | 155 | } |
156 | stream >> interface; | 156 | stream >> interface; |
157 | qDebug("got iface"); | 157 | odebug << "got iface" << oendl; |
158 | stream >> action; | 158 | stream >> action; |
159 | qDebug("WLANModule got interface %s and acion %s", interface.latin1(), action.latin1()); | 159 | odebug << "WLANModule got interface " << interface.latin1() << " and acion " << action.latin1() << "" << oendl; |
160 | // find interfaces | 160 | // find interfaces |
161 | Interface *ifa=0; | 161 | Interface *ifa=0; |
162 | for ( Interface *i=list.first(); i != 0; i=list.next() ){ | 162 | for ( Interface *i=list.first(); i != 0; i=list.next() ){ |
163 | if (i->getInterfaceName() == interface){ | 163 | if (i->getInterfaceName() == interface){ |
164 | qDebug("WLANModule found interface %s",interface.latin1()); | 164 | odebug << "WLANModule found interface " << interface.latin1() << "" << oendl; |
165 | ifa = i; | 165 | ifa = i; |
166 | } | 166 | } |
167 | } | 167 | } |
168 | 168 | ||
169 | if (ifa == 0){ | 169 | if (ifa == 0){ |
170 | qDebug("WLANModule Did not find %s",interface.latin1()); | 170 | odebug << "WLANModule Did not find " << interface.latin1() << "" << oendl; |
171 | qDebug("skipping"); | 171 | odebug << "skipping" << oendl; |
172 | count = 0; | 172 | count = 0; |
173 | } | 173 | } |
174 | 174 | ||
175 | if (count == 2){ | 175 | if (count == 2){ |
176 | // those should call the interface directly | 176 | // those should call the interface directly |
177 | QWidget *info = getInfo( ifa ); | 177 | QWidget *info = getInfo( ifa ); |
178 | QPEApplication::showWidget( info ); | 178 | QPEApplication::showWidget( info ); |
179 | 179 | ||
180 | if ( action.contains("start" ) ){ | 180 | if ( action.contains("start" ) ){ |
181 | ifa->start(); | 181 | ifa->start(); |
182 | } else if ( action.contains("restart" ) ){ | 182 | } else if ( action.contains("restart" ) ){ |
183 | ifa->restart(); | 183 | ifa->restart(); |
@@ -186,70 +186,70 @@ void WLANModule::receive(const QCString ¶m, const QByteArray &arg) | |||
186 | }else if ( action.contains("refresh" ) ){ | 186 | }else if ( action.contains("refresh" ) ){ |
187 | ifa->refresh(); | 187 | ifa->refresh(); |
188 | } | 188 | } |
189 | }else if (count == 3){ | 189 | }else if (count == 3){ |
190 | QString value; | 190 | QString value; |
191 | if (!wlanconfigWiget){ | 191 | if (!wlanconfigWiget){ |
192 | //FIXME: what if it got closed meanwhile? | 192 | //FIXME: what if it got closed meanwhile? |
193 | wlanconfigWiget = (WLANImp*) configure(ifa); | 193 | wlanconfigWiget = (WLANImp*) configure(ifa); |
194 | toShow = (QDialog*) wlanconfigWiget; | 194 | toShow = (QDialog*) wlanconfigWiget; |
195 | } | 195 | } |
196 | QPEApplication::showWidget( wlanconfigWiget ); | 196 | QPEApplication::showWidget( wlanconfigWiget ); |
197 | stream >> value; | 197 | stream >> value; |
198 | qDebug("WLANModule (build 4) is setting %s of %s to %s", action.latin1(), interface.latin1(), value.latin1() ); | 198 | odebug << "WLANModule (build 4) is setting " << action.latin1() << " of " << interface.latin1() << " to " << value.latin1() << "" << oendl; |
199 | if (value.isEmpty()){ | 199 | if (value.isEmpty()){ |
200 | qDebug("value is empty!!!\nreturning"); | 200 | odebug << "value is empty!!!\nreturning" << oendl; |
201 | return; | 201 | return; |
202 | } | 202 | } |
203 | if ( action.contains("ESSID") ){ | 203 | if ( action.contains("ESSID") ){ |
204 | QComboBox *combo = wlanconfigWiget->essid; | 204 | QComboBox *combo = wlanconfigWiget->essid; |
205 | bool found = false; | 205 | bool found = false; |
206 | for ( int i = 0; i < combo->count(); i++) | 206 | for ( int i = 0; i < combo->count(); i++) |
207 | if ( combo->text( i ) == value ){ | 207 | if ( combo->text( i ) == value ){ |
208 | combo->setCurrentItem( i ); | 208 | combo->setCurrentItem( i ); |
209 | found = true; | 209 | found = true; |
210 | } | 210 | } |
211 | if (!found) combo->insertItem( value, 0 ); | 211 | if (!found) combo->insertItem( value, 0 ); |
212 | }else if ( action.contains("Mode") ){ | 212 | }else if ( action.contains("Mode") ){ |
213 | QComboBox *combo = wlanconfigWiget->mode; | 213 | QComboBox *combo = wlanconfigWiget->mode; |
214 | for ( int i = 0; i < combo->count(); i++) | 214 | for ( int i = 0; i < combo->count(); i++) |
215 | if ( combo->text( i ) == value ){ | 215 | if ( combo->text( i ) == value ){ |
216 | combo->setCurrentItem( i ); | 216 | combo->setCurrentItem( i ); |
217 | } | 217 | } |
218 | 218 | ||
219 | }else if (action.contains("Channel")){ | 219 | }else if (action.contains("Channel")){ |
220 | bool ok; | 220 | bool ok; |
221 | qDebug("converting channel"); | 221 | odebug << "converting channel" << oendl; |
222 | int chan = value.toInt( &ok ); | 222 | int chan = value.toInt( &ok ); |
223 | if (ok){ | 223 | if (ok){ |
224 | qDebug("ok setting channel"); | 224 | odebug << "ok setting channel" << oendl; |
225 | wlanconfigWiget->specifyChan->setChecked( true ); | 225 | wlanconfigWiget->specifyChan->setChecked( true ); |
226 | wlanconfigWiget->networkChannel->setValue( chan ); | 226 | wlanconfigWiget->networkChannel->setValue( chan ); |
227 | } | 227 | } |
228 | }else if (action.contains("MacAddr")){ | 228 | }else if (action.contains("MacAddr")){ |
229 | wlanconfigWiget->specifyAp->setChecked( true ); | 229 | wlanconfigWiget->specifyAp->setChecked( true ); |
230 | wlanconfigWiget->macEdit->setText( value ); | 230 | wlanconfigWiget->macEdit->setText( value ); |
231 | }else | 231 | }else |
232 | qDebug("wlan plugin has no clue"); | 232 | odebug << "wlan plugin has no clue" << oendl; |
233 | } | 233 | } |
234 | qDebug("next stream"); | 234 | odebug << "next stream" << oendl; |
235 | }// while stream | 235 | }// while stream |
236 | qDebug("end of stream"); | 236 | odebug << "end of stream" << oendl; |
237 | if (toShow) toShow->exec(); | 237 | if (toShow) toShow->exec(); |
238 | qDebug("returning"); | 238 | odebug << "returning" << oendl; |
239 | } | 239 | } |
240 | 240 | ||
241 | QWidget *WLANModule::getInfo( Interface *i) | 241 | QWidget *WLANModule::getInfo( Interface *i) |
242 | { | 242 | { |
243 | qDebug("WLANModule::getInfo start"); | 243 | odebug << "WLANModule::getInfo start" << oendl; |
244 | WlanInfoImp *info = new WlanInfoImp(0, i->getInterfaceName(), Qt::WDestructiveClose); | 244 | WlanInfoImp *info = new WlanInfoImp(0, i->getInterfaceName(), Qt::WDestructiveClose); |
245 | InterfaceInformationImp *information = new InterfaceInformationImp(info->tabWidget, "InterfaceSetupImp", i); | 245 | InterfaceInformationImp *information = new InterfaceInformationImp(info->tabWidget, "InterfaceSetupImp", i); |
246 | info->tabWidget->insertTab(information, "TCP/IP", 0); | 246 | info->tabWidget->insertTab(information, "TCP/IP", 0); |
247 | info->tabWidget->setCurrentPage( 0 ); | 247 | info->tabWidget->setCurrentPage( 0 ); |
248 | info->tabWidget->showPage( information ); | 248 | info->tabWidget->showPage( information ); |
249 | if (info->tabWidget->currentPage() == information ) qDebug("infotab OK"); | 249 | if (info->tabWidget->currentPage() == information ) odebug << "infotab OK" << oendl; |
250 | else qDebug("infotab NOT OK"); | 250 | else odebug << "infotab NOT OK" << oendl; |
251 | qDebug("current idx %d", info->tabWidget->currentPageIndex()); | 251 | odebug << "current idx " << info->tabWidget->currentPageIndex() << "" << oendl; |
252 | qDebug("WLANModule::getInfo return"); | 252 | odebug << "WLANModule::getInfo return" << oendl; |
253 | return info; | 253 | return info; |
254 | } | 254 | } |
255 | 255 | ||
diff --git a/noncore/settings/sound/sound.pro b/noncore/settings/sound/sound.pro index a3804c3..58e94f3 100644 --- a/noncore/settings/sound/sound.pro +++ b/noncore/settings/sound/sound.pro | |||
@@ -1,10 +1,9 @@ | |||
1 | CONFIG += qt warn_on quick-app | 1 | CONFIG += qt warn_on quick-app |
2 | HEADERS = soundsettings.h soundsettingsbase.h | 2 | HEADERS = soundsettings.h soundsettingsbase.h |
3 | SOURCES = soundsettings.cpp soundsettingsbase.cpp main.cpp | 3 | SOURCES = soundsettings.cpp soundsettingsbase.cpp main.cpp |
4 | #INTERFACES = soundsettingsbase.ui | ||
5 | INCLUDEPATH += $(OPIEDIR)/include | 4 | INCLUDEPATH += $(OPIEDIR)/include |
6 | DEPENDPATH += $(OPIEDIR)/include | 5 | DEPENDPATH += $(OPIEDIR)/include |
7 | LIBS += -lqpe -lopiecore2 | 6 | LIBS += -lqpe -lopiecore2 |
8 | TARGET = sound | 7 | TARGET = sound |
9 | 8 | ||
10 | include ( $(OPIEDIR)/include.pro ) | 9 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/settings/sound/soundsettings.cpp b/noncore/settings/sound/soundsettings.cpp index 8ad0a3f..d55a751 100644 --- a/noncore/settings/sound/soundsettings.cpp +++ b/noncore/settings/sound/soundsettings.cpp | |||
@@ -12,38 +12,42 @@ | |||
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 | // parts copyright 2002 L.J. Potter | 20 | // parts copyright 2002 L.J. Potter |
21 | 21 | ||
22 | #include "soundsettings.h" | 22 | #include "soundsettings.h" |
23 | 23 | ||
24 | /* OPIE */ | ||
25 | #include <opie2/odebug.h> | ||
24 | #include <qpe/qpeapplication.h> | 26 | #include <qpe/qpeapplication.h> |
25 | #include <qpe/config.h> | 27 | #include <qpe/config.h> |
26 | #include <qpe/qcopenvelope_qws.h> | 28 | #include <qpe/qcopenvelope_qws.h> |
27 | #include <qpe/storage.h> | 29 | #include <qpe/storage.h> |
30 | using namespace Opie::Core; | ||
28 | 31 | ||
32 | /* QT */ | ||
29 | #include <qcheckbox.h> | 33 | #include <qcheckbox.h> |
30 | #include <qcombobox.h> | 34 | #include <qcombobox.h> |
31 | #include <qlabel.h> | 35 | #include <qlabel.h> |
32 | 36 | ||
37 | /* STD */ | ||
33 | #include <sys/utsname.h> | 38 | #include <sys/utsname.h> |
34 | #include <sys/time.h> | 39 | #include <sys/time.h> |
35 | #include <sys/types.h> | 40 | #include <sys/types.h> |
36 | #include <unistd.h> | 41 | #include <unistd.h> |
37 | #include <stdio.h> | ||
38 | #include <sys/stat.h> | 42 | #include <sys/stat.h> |
39 | 43 | ||
40 | 44 | ||
41 | SoundSettings::SoundSettings( QWidget* parent, const char* objname, WFlags fl ) | 45 | SoundSettings::SoundSettings( QWidget* parent, const char* objname, WFlags fl ) |
42 | : SoundSettingsBase( parent, objname, TRUE, fl ) | 46 | : SoundSettingsBase( parent, objname, TRUE, fl ) |
43 | { | 47 | { |
44 | keyReset=FALSE; | 48 | keyReset=FALSE; |
45 | noWarning=false; | 49 | noWarning=false; |
46 | Config config( "qpe"); | 50 | Config config( "qpe"); |
47 | config.setGroup( "Volume" ); | 51 | config.setGroup( "Volume" ); |
48 | Config cfg("Vmemo"); | 52 | Config cfg("Vmemo"); |
49 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 53 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
@@ -64,37 +68,37 @@ SoundSettings::SoundSettings( QWidget* parent, const char* objname, WFlags fl ) | |||
64 | 68 | ||
65 | stereoCheckBox->setChecked(cfg.readNumEntry("Stereo", 0)); | 69 | stereoCheckBox->setChecked(cfg.readNumEntry("Stereo", 0)); |
66 | //TODO hide if zaurus- mono only | 70 | //TODO hide if zaurus- mono only |
67 | 71 | ||
68 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) | 72 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) |
69 | //since ipaq and zaurus have particular | 73 | //since ipaq and zaurus have particular |
70 | //devices | 74 | //devices |
71 | bool systemZaurus=FALSE; | 75 | bool systemZaurus=FALSE; |
72 | struct utsname name; /* check for embedix kernel running on the zaurus*/ | 76 | struct utsname name; /* check for embedix kernel running on the zaurus*/ |
73 | if (uname(&name) != -1) {// TODO change this here,... | 77 | if (uname(&name) != -1) {// TODO change this here,... |
74 | QString release=name.release; | 78 | QString release=name.release; |
75 | if( release.find("embedix",0,TRUE) != -1) { | 79 | if( release.find("embedix",0,TRUE) != -1) { |
76 | qDebug("IS System Zaurus"); | 80 | odebug << "IS System Zaurus" << oendl; |
77 | systemZaurus=TRUE; | 81 | systemZaurus=TRUE; |
78 | } | 82 | } |
79 | } | 83 | } |
80 | if(!systemZaurus) { | 84 | if(!systemZaurus) { |
81 | stereoCheckBox->setChecked(TRUE); | 85 | stereoCheckBox->setChecked(TRUE); |
82 | } | 86 | } |
83 | stereoCheckBox->setEnabled(FALSE); | 87 | stereoCheckBox->setEnabled(FALSE); |
84 | sixteenBitCheckBox->setEnabled(FALSE); | 88 | sixteenBitCheckBox->setEnabled(FALSE); |
85 | #else | 89 | #else |
86 | #endif | 90 | #endif |
87 | int sRate=cfg.readNumEntry("SizeLimit", 30); | 91 | int sRate=cfg.readNumEntry("SizeLimit", 30); |
88 | qDebug("%d",sRate); | 92 | odebug << "" << sRate << "" << oendl; |
89 | 93 | ||
90 | if(sRate ==30) | 94 | if(sRate ==30) |
91 | timeLimitComboBox->setCurrentItem(0); | 95 | timeLimitComboBox->setCurrentItem(0); |
92 | else if(sRate==20) | 96 | else if(sRate==20) |
93 | timeLimitComboBox->setCurrentItem(1); | 97 | timeLimitComboBox->setCurrentItem(1); |
94 | else if(sRate == 15) | 98 | else if(sRate == 15) |
95 | timeLimitComboBox->setCurrentItem(2); | 99 | timeLimitComboBox->setCurrentItem(2); |
96 | else if(sRate == 10) | 100 | else if(sRate == 10) |
97 | timeLimitComboBox->setCurrentItem(3); | 101 | timeLimitComboBox->setCurrentItem(3); |
98 | else if(sRate == 5) | 102 | else if(sRate == 5) |
99 | timeLimitComboBox->setCurrentItem(4); | 103 | timeLimitComboBox->setCurrentItem(4); |
100 | else | 104 | else |
@@ -134,42 +138,42 @@ void SoundSettings::updateStorageCombo() { | |||
134 | int set=0; | 138 | int set=0; |
135 | StorageInfo storageInfo; | 139 | StorageInfo storageInfo; |
136 | QString sName, sPath; | 140 | QString sName, sPath; |
137 | QStringList list; | 141 | QStringList list; |
138 | list << "Documents : "+QPEApplication::documentDir(); | 142 | list << "Documents : "+QPEApplication::documentDir(); |
139 | list << "tmp : /tmp"; | 143 | list << "tmp : /tmp"; |
140 | 144 | ||
141 | const QList<FileSystem> &fs = storageInfo.fileSystems(); | 145 | const QList<FileSystem> &fs = storageInfo.fileSystems(); |
142 | QListIterator<FileSystem> it ( fs ); | 146 | QListIterator<FileSystem> it ( fs ); |
143 | for( ; it.current(); ++it ){ | 147 | for( ; it.current(); ++it ){ |
144 | const QString name = (*it)->name(); | 148 | const QString name = (*it)->name(); |
145 | const QString path = (*it)->path(); | 149 | const QString path = (*it)->path(); |
146 | qDebug("storage name "+name +" storage path is "+path); | 150 | odebug << "storage name "+name +" storage path is "+path << oendl; |
147 | list << name + ": " +path; | 151 | list << name + ": " +path; |
148 | if( loc.find( path,0,TRUE) != -1) | 152 | if( loc.find( path,0,TRUE) != -1) |
149 | set = i; | 153 | set = i; |
150 | // if(dit.current()->file().find(path) != -1 ) storage=name; | 154 | // if(dit.current()->file().find(path) != -1 ) storage=name; |
151 | i++; | 155 | i++; |
152 | } | 156 | } |
153 | 157 | ||
154 | LocationComboBox->insertStringList(list); | 158 | LocationComboBox->insertStringList(list); |
155 | qDebug("set item %d", set); | 159 | odebug << "set item " << set << "" << oendl; |
156 | LocationComboBox->setCurrentItem(set); | 160 | LocationComboBox->setCurrentItem(set); |
157 | } | 161 | } |
158 | 162 | ||
159 | void SoundSettings::setLocation(const QString & string) { | 163 | void SoundSettings::setLocation(const QString & string) { |
160 | Config config( "Vmemo" ); | 164 | Config config( "Vmemo" ); |
161 | config.setGroup( "System" ); | 165 | config.setGroup( "System" ); |
162 | config.writeEntry("RecLocation",string); | 166 | config.writeEntry("RecLocation",string); |
163 | qDebug("set location "+string); | 167 | odebug << "set location "+string << oendl; |
164 | config.write(); | 168 | config.write(); |
165 | } | 169 | } |
166 | 170 | ||
167 | void SoundSettings::cleanUp() { | 171 | void SoundSettings::cleanUp() { |
168 | Config cfg("Vmemo"); | 172 | Config cfg("Vmemo"); |
169 | cfg.writeEntry("Alert",AlertCheckBox->isChecked()); | 173 | cfg.writeEntry("Alert",AlertCheckBox->isChecked()); |
170 | 174 | ||
171 | cfg.setGroup("Record"); | 175 | cfg.setGroup("Record"); |
172 | cfg.writeEntry("SampleRate",sampleRate->currentText()); | 176 | cfg.writeEntry("SampleRate",sampleRate->currentText()); |
173 | cfg.writeEntry("Stereo",stereoCheckBox->isChecked()); | 177 | cfg.writeEntry("Stereo",stereoCheckBox->isChecked()); |
174 | cfg.writeEntry("SixteenBit",sixteenBitCheckBox->isChecked()); | 178 | cfg.writeEntry("SixteenBit",sixteenBitCheckBox->isChecked()); |
175 | if(keyReset && noWarning) { | 179 | if(keyReset && noWarning) { |
diff --git a/noncore/settings/sysinfo/benchmarkinfo.cpp b/noncore/settings/sysinfo/benchmarkinfo.cpp index 96bcdfc..4163fb2 100644 --- a/noncore/settings/sysinfo/benchmarkinfo.cpp +++ b/noncore/settings/sysinfo/benchmarkinfo.cpp | |||
@@ -10,31 +10,34 @@ | |||
10 | ** GNU General Public License version 2 as published by the Free Software | 10 | ** GNU General Public License version 2 as published by the Free Software |
11 | ** Foundation and appearing in the file LICENSE.GPL included in the | 11 | ** Foundation and appearing in the file LICENSE.GPL included in the |
12 | ** packaging of this file. | 12 | ** packaging of this file. |
13 | ** | 13 | ** |
14 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 14 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
15 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 15 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
16 | ** | 16 | ** |
17 | **********************************************************************/ | 17 | **********************************************************************/ |
18 | 18 | ||
19 | #include "benchmarkinfo.h" | 19 | #include "benchmarkinfo.h" |
20 | 20 | ||
21 | /* OPIE */ | 21 | /* OPIE */ |
22 | #include <opie2/odebug.h> | ||
22 | #include <opie2/ostorageinfo.h> | 23 | #include <opie2/ostorageinfo.h> |
23 | #include <opie2/olistview.h> | 24 | #include <opie2/olistview.h> |
24 | #include <qpe/qpeapplication.h> | 25 | #include <qpe/qpeapplication.h> |
25 | #include <qpe/qcopenvelope_qws.h> | 26 | #include <qpe/qcopenvelope_qws.h> |
26 | #include <qpe/qpedecoration_qws.h> | 27 | #include <qpe/qpedecoration_qws.h> |
27 | #include <qpe/resource.h> | 28 | #include <qpe/resource.h> |
28 | #include <qpe/config.h> | 29 | #include <qpe/config.h> |
30 | using namespace Opie::Core; | ||
31 | using namespace Opie::Ui; | ||
29 | 32 | ||
30 | /* QT */ | 33 | /* QT */ |
31 | #include <qclipboard.h> | 34 | #include <qclipboard.h> |
32 | #include <qcolor.h> | 35 | #include <qcolor.h> |
33 | #include <qcombobox.h> | 36 | #include <qcombobox.h> |
34 | #include <qdirectpainter_qws.h> | 37 | #include <qdirectpainter_qws.h> |
35 | #include <qfile.h> | 38 | #include <qfile.h> |
36 | #include <qtextstream.h> | 39 | #include <qtextstream.h> |
37 | #include <qfiledialog.h> | 40 | #include <qfiledialog.h> |
38 | #include <qlabel.h> | 41 | #include <qlabel.h> |
39 | #include <qlayout.h> | 42 | #include <qlayout.h> |
40 | #include <qpainter.h> | 43 | #include <qpainter.h> |
@@ -42,28 +45,25 @@ | |||
42 | #include <qtimer.h> | 45 | #include <qtimer.h> |
43 | #include <qwhatsthis.h> | 46 | #include <qwhatsthis.h> |
44 | 47 | ||
45 | /* STD */ | 48 | /* STD */ |
46 | #include <time.h> | 49 | #include <time.h> |
47 | #include <stdio.h> | 50 | #include <stdio.h> |
48 | #include <stdlib.h> | 51 | #include <stdlib.h> |
49 | #include <math.h> | 52 | #include <math.h> |
50 | #if defined (__GNUC__) && (__GNUC__ < 3) | 53 | #if defined (__GNUC__) && (__GNUC__ < 3) |
51 | #define round qRound | 54 | #define round qRound |
52 | #endif | 55 | #endif |
53 | 56 | ||
54 | using namespace Opie::Ui; | ||
55 | using namespace Opie::Core; | ||
56 | extern "C" | 57 | extern "C" |
57 | |||
58 | { | 58 | { |
59 | void BenchFFT( void ); | 59 | void BenchFFT( void ); |
60 | double dhry_main( int ); | 60 | double dhry_main( int ); |
61 | } | 61 | } |
62 | 62 | ||
63 | #define DHRYSTONE_RUNS 20000000 | 63 | #define DHRYSTONE_RUNS 20000000 |
64 | #define TEST_DURATION 3 | 64 | #define TEST_DURATION 3 |
65 | 65 | ||
66 | #define BUFF_SIZE 8192 | 66 | #define BUFF_SIZE 8192 |
67 | #define FILE_SIZE 1024 * 1024 // 1Mb | 67 | #define FILE_SIZE 1024 * 1024 // 1Mb |
68 | 68 | ||
69 | //=========================================================================== | 69 | //=========================================================================== |
@@ -139,50 +139,50 @@ BenchmarkInfo::BenchmarkInfo( QWidget *parent, const char *name, int wFlags ) | |||
139 | vb->addWidget( tests, 2 ); | 139 | vb->addWidget( tests, 2 ); |
140 | 140 | ||
141 | QFile f( QPEApplication::qpeDir() + "/share/sysinfo/results" ); | 141 | QFile f( QPEApplication::qpeDir() + "/share/sysinfo/results" ); |
142 | if ( f.open( IO_ReadOnly ) ) | 142 | if ( f.open( IO_ReadOnly ) ) |
143 | { | 143 | { |
144 | machineCombo = new QComboBox( this ); | 144 | machineCombo = new QComboBox( this ); |
145 | QWhatsThis::add( machineCombo, tr( "Choose a model to compare your results with." ) ); | 145 | QWhatsThis::add( machineCombo, tr( "Choose a model to compare your results with." ) ); |
146 | 146 | ||
147 | QTextStream ts( &f ); | 147 | QTextStream ts( &f ); |
148 | while( !ts.eof() ) | 148 | while( !ts.eof() ) |
149 | { | 149 | { |
150 | QString machline = ts.readLine(); | 150 | QString machline = ts.readLine(); |
151 | qDebug( "sysinfo: parsing benchmark results for '%s'", (const char*) machline ); | 151 | odebug << "sysinfo: parsing benchmark results for '" << (const char*) machline << "'" << oendl; |
152 | QString resline = ts.readLine(); | 152 | QString resline = ts.readLine(); |
153 | machines.insert( machline, new QStringList( QStringList::split( ",", resline ) ) ); | 153 | machines.insert( machline, new QStringList( QStringList::split( ",", resline ) ) ); |
154 | machineCombo->insertItem( machline ); | 154 | machineCombo->insertItem( machline ); |
155 | } | 155 | } |
156 | 156 | ||
157 | QHBoxLayout* hb = new QHBoxLayout( vb ); | 157 | QHBoxLayout* hb = new QHBoxLayout( vb ); |
158 | hb->addWidget( new QLabel( tr( "Compare To:" ), this ) ); | 158 | hb->addWidget( new QLabel( tr( "Compare To:" ), this ) ); |
159 | hb->addWidget( machineCombo, 2 ); | 159 | hb->addWidget( machineCombo, 2 ); |
160 | connect( machineCombo, SIGNAL( activated(int) ), this, SLOT( machineActivated(int) ) ); | 160 | connect( machineCombo, SIGNAL( activated(int) ), this, SLOT( machineActivated(int) ) ); |
161 | } | 161 | } |
162 | 162 | ||
163 | vb->addWidget( startButton, 2 ); | 163 | vb->addWidget( startButton, 2 ); |
164 | } | 164 | } |
165 | 165 | ||
166 | 166 | ||
167 | BenchmarkInfo::~BenchmarkInfo() | 167 | BenchmarkInfo::~BenchmarkInfo() |
168 | {} | 168 | {} |
169 | 169 | ||
170 | 170 | ||
171 | void BenchmarkInfo::machineActivated( int index ) | 171 | void BenchmarkInfo::machineActivated( int index ) |
172 | { | 172 | { |
173 | QStringList* results = machines[ machineCombo->text( index ) ]; | 173 | QStringList* results = machines[ machineCombo->text( index ) ]; |
174 | if ( !results ) | 174 | if ( !results ) |
175 | { | 175 | { |
176 | qDebug( "sysinfo: no results available." ); | 176 | odebug << "sysinfo: no results available." << oendl; |
177 | return; | 177 | return; |
178 | } | 178 | } |
179 | QStringList::Iterator it = results->begin(); | 179 | QStringList::Iterator it = results->begin(); |
180 | test_alu->setText( 2, *(it++) ); | 180 | test_alu->setText( 2, *(it++) ); |
181 | test_fpu->setText( 2, *(it++) ); | 181 | test_fpu->setText( 2, *(it++) ); |
182 | test_txt->setText( 2, *(it++) ); | 182 | test_txt->setText( 2, *(it++) ); |
183 | test_gfx->setText( 2, *(it++) ); | 183 | test_gfx->setText( 2, *(it++) ); |
184 | test_ram->setText( 2, *(it++) ); | 184 | test_ram->setText( 2, *(it++) ); |
185 | test_sd->setText( 2, *(it++) ); | 185 | test_sd->setText( 2, *(it++) ); |
186 | test_cf->setText( 2, *(it++) ); | 186 | test_cf->setText( 2, *(it++) ); |
187 | } | 187 | } |
188 | 188 | ||
diff --git a/noncore/settings/tabmanager/tabmanager.cpp b/noncore/settings/tabmanager/tabmanager.cpp index 15aeaf5..4274203 100644 --- a/noncore/settings/tabmanager/tabmanager.cpp +++ b/noncore/settings/tabmanager/tabmanager.cpp | |||
@@ -54,25 +54,25 @@ TabManager::~TabManager(){ | |||
54 | e << link; | 54 | e << link; |
55 | } | 55 | } |
56 | } | 56 | } |
57 | 57 | ||
58 | /** | 58 | /** |
59 | * Scans root directory for any tabs or applications. Will recursivly go down, | 59 | * Scans root directory for any tabs or applications. Will recursivly go down, |
60 | * but will not follow symlinks. | 60 | * but will not follow symlinks. |
61 | * @param directory - the directory to look in. | 61 | * @param directory - the directory to look in. |
62 | * @param parent - the parent to place any new tabs or apps into. If parent is | 62 | * @param parent - the parent to place any new tabs or apps into. If parent is |
63 | * NULL then the item is a tab and should be placed as a child of the window. | 63 | * NULL then the item is a tab and should be placed as a child of the window. |
64 | */ | 64 | */ |
65 | void TabManager::rescanFolder(QString directory, QListViewItem* parent){ | 65 | void TabManager::rescanFolder(QString directory, QListViewItem* parent){ |
66 | //qDebug(QString("rescanFolder: ") + directory.latin1()); | 66 | //odebug << QString("rescanFolder: ") + directory.latin1() << oendl; |
67 | 67 | ||
68 | QDir d; | 68 | QDir d; |
69 | d.setPath(directory); | 69 | d.setPath(directory); |
70 | // Show hidden files for .directories | 70 | // Show hidden files for .directories |
71 | d.setFilter( QDir::Files | QDir::Hidden | QDir::Dirs); | 71 | d.setFilter( QDir::Files | QDir::Hidden | QDir::Dirs); |
72 | 72 | ||
73 | const QFileInfoList *list = d.entryInfoList(); | 73 | const QFileInfoList *list = d.entryInfoList(); |
74 | QFileInfoListIterator it( *list ); // create list iterator | 74 | QFileInfoListIterator it( *list ); // create list iterator |
75 | QFileInfo *fi; // pointer for traversing | 75 | QFileInfo *fi; // pointer for traversing |
76 | 76 | ||
77 | while ( (fi=it.current()) ) { // for each file... | 77 | while ( (fi=it.current()) ) { // for each file... |
78 | // If it is a dir and not .. or . then add it as a tab and go down. | 78 | // If it is a dir and not .. or . then add it as a tab and go down. |
@@ -198,25 +198,25 @@ void TabManager::removeItem(){ | |||
198 | if(item->parent() == NULL){ | 198 | if(item->parent() == NULL){ |
199 | // Remove .directory file string | 199 | // Remove .directory file string |
200 | location = location.mid(0,location.length()-10); | 200 | location = location.mid(0,location.length()-10); |
201 | QDir dir; | 201 | QDir dir; |
202 | if(!dir.rmdir(location)) | 202 | if(!dir.rmdir(location)) |
203 | removeSuccessful = false; | 203 | removeSuccessful = false; |
204 | else | 204 | else |
205 | removeSuccessful = true; | 205 | removeSuccessful = true; |
206 | } | 206 | } |
207 | 207 | ||
208 | // If removing failed. | 208 | // If removing failed. |
209 | if(!removeSuccessful){ | 209 | if(!removeSuccessful){ |
210 | qDebug((QString("removeItem: ") + location).latin1()); | 210 | odebug << (QString("removeItem: ") + location).latin1() << oendl; |
211 | QMessageBox::critical(this, tr("Message"), tr("Can't remove."), tr("Ok") ); | 211 | QMessageBox::critical(this, tr("Message"), tr("Can't remove."), tr("Ok") ); |
212 | return; | 212 | return; |
213 | } | 213 | } |
214 | 214 | ||
215 | // Remove from the installer so it wont fail. | 215 | // Remove from the installer so it wont fail. |
216 | // Don't need to do this sense the current install uses rm -f so no error | 216 | // Don't need to do this sense the current install uses rm -f so no error |
217 | 217 | ||
218 | // Remove from the gui list. | 218 | // Remove from the gui list. |
219 | itemList.remove(item); | 219 | itemList.remove(item); |
220 | if(item->parent()) | 220 | if(item->parent()) |
221 | item->parent()->takeItem(item); | 221 | item->parent()->takeItem(item); |
222 | delete item; | 222 | delete item; |
@@ -235,25 +235,25 @@ void TabManager::editCurrentItem(){ | |||
235 | 235 | ||
236 | /** | 236 | /** |
237 | * Edit the item that is passed in. | 237 | * Edit the item that is passed in. |
238 | * Show application dialog and if anything changed | 238 | * Show application dialog and if anything changed |
239 | * @param item the item to edit. | 239 | * @param item the item to edit. |
240 | */ | 240 | */ |
241 | void TabManager::editItem( QListViewItem * item){ | 241 | void TabManager::editItem( QListViewItem * item){ |
242 | if(!item) | 242 | if(!item) |
243 | return; | 243 | return; |
244 | 244 | ||
245 | TabAppLnk app(itemList[item]); | 245 | TabAppLnk app(itemList[item]); |
246 | if(!app.isValid()){ | 246 | if(!app.isValid()){ |
247 | qDebug(QString("editItem: Not a valid applnk file: ") + itemList[item].latin1()); | 247 | odebug << QString("editItem: Not a valid applnk file: ") + itemList[item].latin1() << oendl; |
248 | return; | 248 | return; |
249 | } | 249 | } |
250 | 250 | ||
251 | // Fill with all of the icons | 251 | // Fill with all of the icons |
252 | if(!application){ | 252 | if(!application){ |
253 | Wait waitDialog(this, "Wait dialog"); | 253 | Wait waitDialog(this, "Wait dialog"); |
254 | waitDialog.waitLabel->setText(tr("Gathering icons...")); | 254 | waitDialog.waitLabel->setText(tr("Gathering icons...")); |
255 | waitDialog.show(); | 255 | waitDialog.show(); |
256 | qApp->processEvents(); | 256 | qApp->processEvents(); |
257 | application = new AppEdit(this, "Application edit", true); | 257 | application = new AppEdit(this, "Application edit", true); |
258 | 258 | ||
259 | QDir d(QPEApplication::qpeDir() + "/pics/"); | 259 | QDir d(QPEApplication::qpeDir() + "/pics/"); |
@@ -264,25 +264,25 @@ void TabManager::editItem( QListViewItem * item){ | |||
264 | QFileInfo *fi; // pointer for traversing | 264 | QFileInfo *fi; // pointer for traversing |
265 | 265 | ||
266 | while ( (fi=it.current()) ) { // for each file... | 266 | while ( (fi=it.current()) ) { // for each file... |
267 | QString fileName = fi->fileName(); | 267 | QString fileName = fi->fileName(); |
268 | if(fileName.right(4) == ".png"){ | 268 | if(fileName.right(4) == ".png"){ |
269 | fileName = fileName.mid(0,fileName.length()-4); | 269 | fileName = fileName.mid(0,fileName.length()-4); |
270 | QPixmap imageOfFile(Resource::loadPixmap(fileName)); | 270 | QPixmap imageOfFile(Resource::loadPixmap(fileName)); |
271 | QImage foo = imageOfFile.convertToImage(); | 271 | QImage foo = imageOfFile.convertToImage(); |
272 | foo = foo.smoothScale(16,16); | 272 | foo = foo.smoothScale(16,16); |
273 | imageOfFile.convertFromImage(foo); | 273 | imageOfFile.convertFromImage(foo); |
274 | application->iconLineEdit->insertItem(imageOfFile,fileName); | 274 | application->iconLineEdit->insertItem(imageOfFile,fileName); |
275 | } | 275 | } |
276 | //qDebug(fi->fileName().latin1()); | 276 | //odebug << fi->fileName().latin1() << oendl; |
277 | ++it; | 277 | ++it; |
278 | } | 278 | } |
279 | waitDialog.hide(); | 279 | waitDialog.hide(); |
280 | } | 280 | } |
281 | int pixmap = -1; | 281 | int pixmap = -1; |
282 | QString pixmapText = app.pixmapString(); | 282 | QString pixmapText = app.pixmapString(); |
283 | QComboBox *f = application->iconLineEdit; | 283 | QComboBox *f = application->iconLineEdit; |
284 | for(int i = 0; i < application->iconLineEdit->count(); i++){ | 284 | for(int i = 0; i < application->iconLineEdit->count(); i++){ |
285 | if(f->text(i) == pixmapText){ | 285 | if(f->text(i) == pixmapText){ |
286 | pixmap = i; | 286 | pixmap = i; |
287 | break; | 287 | break; |
288 | } | 288 | } |
@@ -393,38 +393,38 @@ void TabManager::moveApplication(QListViewItem *item, QListViewItem *newGroup){ | |||
393 | 393 | ||
394 | QString desktopFile = itemList[item]; | 394 | QString desktopFile = itemList[item]; |
395 | slash = desktopFile.findRev('/', -1); | 395 | slash = desktopFile.findRev('/', -1); |
396 | desktopFile = desktopFile.mid(slash, desktopFile.length()); | 396 | desktopFile = desktopFile.mid(slash, desktopFile.length()); |
397 | newFolder = newFolder + desktopFile; | 397 | newFolder = newFolder + desktopFile; |
398 | 398 | ||
399 | // Move file | 399 | // Move file |
400 | QDir r; | 400 | QDir r; |
401 | if(!r.rename(itemList[item], newFolder)){ | 401 | if(!r.rename(itemList[item], newFolder)){ |
402 | QMessageBox::critical(this, tr("Message"), "Can't move application.", tr("Ok") ); | 402 | QMessageBox::critical(this, tr("Message"), "Can't move application.", tr("Ok") ); |
403 | return; | 403 | return; |
404 | } | 404 | } |
405 | //qDebug((QString("moveApplication: ") + itemList[item]).latin1()); | 405 | //odebug << (QString("moveApplication: ") + itemList[item]).latin1() << oendl; |
406 | //qDebug((QString("moveApplication: ") + newFolder).latin1()); | 406 | //odebug << (QString("moveApplication: ") + newFolder).latin1() << oendl; |
407 | 407 | ||
408 | // Move in the gui | 408 | // Move in the gui |
409 | item->parent()->takeItem(item); | 409 | item->parent()->takeItem(item); |
410 | newGroup->insertItem(item); | 410 | newGroup->insertItem(item); |
411 | newGroup->setOpen(true); | 411 | newGroup->setOpen(true); |
412 | 412 | ||
413 | // Move file in the installer | 413 | // Move file in the installer |
414 | QString installedAppFile; | 414 | QString installedAppFile; |
415 | if(findInstalledApplication(desktopFile, installedAppFile)) | 415 | if(findInstalledApplication(desktopFile, installedAppFile)) |
416 | swapInstalledLocation(installedAppFile, desktopFile, newFolder); | 416 | swapInstalledLocation(installedAppFile, desktopFile, newFolder); |
417 | else | 417 | else |
418 | qDebug("moveApplication: No installed app found for dekstop file"); | 418 | odebug << "moveApplication: No installed app found for dekstop file" << oendl; |
419 | 419 | ||
420 | // Move application type | 420 | // Move application type |
421 | AppLnk app(newFolder); | 421 | AppLnk app(newFolder); |
422 | app.setType(folderName); | 422 | app.setType(folderName); |
423 | app.writeLink(); | 423 | app.writeLink(); |
424 | 424 | ||
425 | // Move in our internal list | 425 | // Move in our internal list |
426 | itemList.remove(item); | 426 | itemList.remove(item); |
427 | itemList.insert(item, newFolder); | 427 | itemList.insert(item, newFolder); |
428 | 428 | ||
429 | // We have changed something. | 429 | // We have changed something. |
430 | changed = true; | 430 | changed = true; |
@@ -455,54 +455,54 @@ bool TabManager::findInstalledApplication(QString desktopFile, QString &installe | |||
455 | QString line; | 455 | QString line; |
456 | while ( !stream.eof() ) { // until end of file... | 456 | while ( !stream.eof() ) { // until end of file... |
457 | line = stream.readLine(); // line of text excluding '\n' | 457 | line = stream.readLine(); // line of text excluding '\n' |
458 | if(line.contains(desktopFile)){ | 458 | if(line.contains(desktopFile)){ |
459 | installedAppFile = QString(HOME_APP_INSTALL_DIR) + "/" + fi->fileName(); | 459 | installedAppFile = QString(HOME_APP_INSTALL_DIR) + "/" + fi->fileName(); |
460 | file.close(); | 460 | file.close(); |
461 | return true; | 461 | return true; |
462 | } | 462 | } |
463 | } | 463 | } |
464 | file.close(); | 464 | file.close(); |
465 | } | 465 | } |
466 | else | 466 | else |
467 | qDebug((QString("findInstalledApplication: Can't open file") + HOME_APP_INSTALL_DIR + "/" + fi->fileName()).latin1()); | 467 | odebug << (QString("findInstalledApplication: Can't open file") + HOME_APP_INSTALL_DIR + "/" + fi->fileName()).latin1() << oendl; |
468 | ++it; // goto next list element | 468 | ++it; // goto next list element |
469 | } | 469 | } |
470 | return false; | 470 | return false; |
471 | } | 471 | } |
472 | 472 | ||
473 | /** | 473 | /** |
474 | * Open a file and replace a file containing the old desktop file with the new. | 474 | * Open a file and replace a file containing the old desktop file with the new. |
475 | * @param installedAppFile application installed list | 475 | * @param installedAppFile application installed list |
476 | * @param desktopFile old .desktop file | 476 | * @param desktopFile old .desktop file |
477 | * @param newLocation new .desktop file | 477 | * @param newLocation new .desktop file |
478 | */ | 478 | */ |
479 | void TabManager::swapInstalledLocation( QString installedAppFile, QString desktopFile, QString newLocation ){ | 479 | void TabManager::swapInstalledLocation( QString installedAppFile, QString desktopFile, QString newLocation ){ |
480 | QFile file(installedAppFile); | 480 | QFile file(installedAppFile); |
481 | if ( !file.open(IO_ReadOnly) ){ | 481 | if ( !file.open(IO_ReadOnly) ){ |
482 | qDebug(QString("swapInstalledLocation: Can't edit file: %1").arg(installedAppFile).latin1()); | 482 | odebug << QString("swapInstalledLocation: Can't edit file: %1").arg(installedAppFile).latin1() << oendl; |
483 | return; | 483 | return; |
484 | } | 484 | } |
485 | 485 | ||
486 | QTextStream stream( &file ); // use a text stream | 486 | QTextStream stream( &file ); // use a text stream |
487 | QString allLines; | 487 | QString allLines; |
488 | while ( !stream.eof() ) { // until end of file... | 488 | while ( !stream.eof() ) { // until end of file... |
489 | QString line = stream.readLine(); // line of text excluding '\n' | 489 | QString line = stream.readLine(); // line of text excluding '\n' |
490 | if(line.contains(desktopFile)) | 490 | if(line.contains(desktopFile)) |
491 | allLines += newLocation; | 491 | allLines += newLocation; |
492 | else | 492 | else |
493 | allLines += line; | 493 | allLines += line; |
494 | allLines += '\n'; | 494 | allLines += '\n'; |
495 | } | 495 | } |
496 | file.close(); | 496 | file.close(); |
497 | 497 | ||
498 | if ( !file.open(IO_ReadWrite) ){ | 498 | if ( !file.open(IO_ReadWrite) ){ |
499 | qDebug(QString("swapInstalledLocation: Can't edit file: %1").arg(installedAppFile).latin1()); | 499 | odebug << QString("swapInstalledLocation: Can't edit file: %1").arg(installedAppFile).latin1() << oendl; |
500 | return; | 500 | return; |
501 | } | 501 | } |
502 | QTextStream streamOut( &file ); | 502 | QTextStream streamOut( &file ); |
503 | streamOut << allLines; | 503 | streamOut << allLines; |
504 | file.close(); | 504 | file.close(); |
505 | } | 505 | } |
506 | 506 | ||
507 | // tabmanager.cpp | 507 | // tabmanager.cpp |
508 | 508 | ||
diff --git a/noncore/settings/usermanager/userdialog.cpp b/noncore/settings/usermanager/userdialog.cpp index 5854fe0..3616507 100644 --- a/noncore/settings/usermanager/userdialog.cpp +++ b/noncore/settings/usermanager/userdialog.cpp | |||
@@ -2,48 +2,46 @@ | |||
2 | * * | 2 | * * |
3 | * This program is free software; you can redistribute it and/or modify * | 3 | * This program is free software; you can redistribute it and/or modify * |
4 | * it under the terms of the GNU General Public License as published by * | 4 | * it under the terms of the GNU General Public License as published by * |
5 | * the Free Software Foundation; either version 2 of the License, or * | 5 | * the Free Software Foundation; either version 2 of the License, or * |
6 | * (at your option) any later version. * | 6 | * (at your option) any later version. * |
7 | * * | 7 | * * |
8 | ***************************************************************************/ | 8 | ***************************************************************************/ |
9 | 9 | ||
10 | #include "userdialog.h" | 10 | #include "userdialog.h" |
11 | #include "passwd.h" | 11 | #include "passwd.h" |
12 | 12 | ||
13 | /* OPIE */ | 13 | /* OPIE */ |
14 | #include <opie2/odebug.h> | ||
14 | #include <opie2/odevice.h> | 15 | #include <opie2/odevice.h> |
15 | #include <qpe/qpeapplication.h> | 16 | #include <qpe/qpeapplication.h> |
17 | using namespace Opie::Core; | ||
18 | using namespace Opie::Ui; | ||
16 | 19 | ||
17 | /* QT */ | 20 | /* QT */ |
18 | #include <qlayout.h> | 21 | #include <qlayout.h> |
19 | #include <qlabel.h> | 22 | #include <qlabel.h> |
20 | #include <qmessagebox.h> | 23 | #include <qmessagebox.h> |
21 | #include <qfile.h> | 24 | #include <qfile.h> |
22 | 25 | ||
23 | /* STD */ | 26 | /* STD */ |
24 | #include <sys/types.h> | 27 | #include <sys/types.h> |
25 | #include <sys/wait.h> | 28 | #include <sys/wait.h> |
26 | #include <unistd.h> | 29 | #include <unistd.h> |
27 | #include <signal.h> | 30 | #include <signal.h> |
28 | 31 | ||
29 | |||
30 | using namespace Opie::Core; | ||
31 | |||
32 | |||
33 | /** | 32 | /** |
34 | * UserDialog constructor. Setup the dialog, fill the groupComboBox & groupsListView with all groups. | 33 | * UserDialog constructor. Setup the dialog, fill the groupComboBox & groupsListView with all groups. |
35 | * | 34 | * |
36 | */ | 35 | */ |
37 | using namespace Opie::Ui; | ||
38 | UserDialog::UserDialog(int viewmode, QWidget* parent, const char* name, bool modal, WFlags fl) : QDialog(parent, name, modal, fl) | 36 | UserDialog::UserDialog(int viewmode, QWidget* parent, const char* name, bool modal, WFlags fl) : QDialog(parent, name, modal, fl) |
39 | { | 37 | { |
40 | vm=viewmode; | 38 | vm=viewmode; |
41 | QVBoxLayout *layout = new QVBoxLayout(this); | 39 | QVBoxLayout *layout = new QVBoxLayout(this); |
42 | myTabWidget=new QTabWidget(this,"User Tab Widget"); | 40 | myTabWidget=new QTabWidget(this,"User Tab Widget"); |
43 | layout->addWidget(myTabWidget); | 41 | layout->addWidget(myTabWidget); |
44 | setupTab1(); | 42 | setupTab1(); |
45 | setupTab2(); | 43 | setupTab2(); |
46 | 44 | ||
47 | accounts->groupStringList.sort(); | 45 | accounts->groupStringList.sort(); |
48 | // And also fill the listview & the combobox with all available groups. | 46 | // And also fill the listview & the combobox with all available groups. |
49 | for( QStringList::Iterator it = accounts->groupStringList.begin(); it!=accounts->groupStringList.end(); ++it) | 47 | for( QStringList::Iterator it = accounts->groupStringList.begin(); it!=accounts->groupStringList.end(); ++it) |
@@ -236,25 +234,25 @@ bool UserDialog::addUser(int uid, int gid) | |||
236 | if (temp->text()=="power") temp->setOn(true); | 234 | if (temp->text()=="power") temp->setOn(true); |
237 | if (temp->text()=="input") temp->setOn(true); | 235 | if (temp->text()=="input") temp->setOn(true); |
238 | if (temp->text()=="sharp") temp->setOn(true); | 236 | if (temp->text()=="sharp") temp->setOn(true); |
239 | if (temp->text()=="tty") temp->setOn(true); | 237 | if (temp->text()=="tty") temp->setOn(true); |
240 | } | 238 | } |
241 | } | 239 | } |
242 | // Show the dialog! | 240 | // Show the dialog! |
243 | if(!(adduserDialog->exec())) return false; | 241 | if(!(adduserDialog->exec())) return false; |
244 | if((adduserDialog->groupComboBox->currentItem()!=0)) | 242 | if((adduserDialog->groupComboBox->currentItem()!=0)) |
245 | { | 243 | { |
246 | accounts->findGroup(adduserDialog->groupComboBox->currentText()); | 244 | accounts->findGroup(adduserDialog->groupComboBox->currentText()); |
247 | adduserDialog->groupID=accounts->gr_gid; | 245 | adduserDialog->groupID=accounts->gr_gid; |
248 | qWarning(QString::number(accounts->gr_gid)); | 246 | owarn << QString::number(accounts->gr_gid) << oendl; |
249 | } | 247 | } |
250 | if(!(accounts->addUser(adduserDialog->loginLineEdit->text(), adduserDialog->passwordLineEdit->text(), | 248 | if(!(accounts->addUser(adduserDialog->loginLineEdit->text(), adduserDialog->passwordLineEdit->text(), |
251 | adduserDialog->uidLineEdit->text().toInt(), adduserDialog->groupID, adduserDialog->gecosLineEdit->text(), | 249 | adduserDialog->uidLineEdit->text().toInt(), adduserDialog->groupID, adduserDialog->gecosLineEdit->text(), |
252 | QString("/home/")+adduserDialog->loginLineEdit->text() , adduserDialog->shellComboBox->currentText()))) | 250 | QString("/home/")+adduserDialog->loginLineEdit->text() , adduserDialog->shellComboBox->currentText()))) |
253 | { | 251 | { |
254 | QMessageBox::information(0,"Ooops!","Something went wrong!\nUnable to add user."); | 252 | QMessageBox::information(0,"Ooops!","Something went wrong!\nUnable to add user."); |
255 | return false; | 253 | return false; |
256 | } | 254 | } |
257 | 255 | ||
258 | // Add User to additional groups. | 256 | // Add User to additional groups. |
259 | QListViewItemIterator it( adduserDialog->groupsListView ); | 257 | QListViewItemIterator it( adduserDialog->groupsListView ); |
260 | for ( ; it.current(); ++it ) | 258 | for ( ; it.current(); ++it ) |
@@ -365,40 +363,40 @@ bool UserDialog::editUser(const char *username) | |||
365 | { | 363 | { |
366 | edituserDialog->groupComboBox->insertItem("<Undefined group>",0); | 364 | edituserDialog->groupComboBox->insertItem("<Undefined group>",0); |
367 | edituserDialog->groupComboBox->setCurrentItem(0); | 365 | edituserDialog->groupComboBox->setCurrentItem(0); |
368 | } | 366 | } |
369 | 367 | ||
370 | // Select the groups in the listview, to which the user belongs. | 368 | // Select the groups in the listview, to which the user belongs. |
371 | QCheckListItem *temp; | 369 | QCheckListItem *temp; |
372 | // BAH!!! QRegExp in qt2 sucks... or maybe I do... can't figure out how to check for EITHER end of input ($) OR a comma, so here we do two different QRegExps instead. | 370 | // BAH!!! QRegExp in qt2 sucks... or maybe I do... can't figure out how to check for EITHER end of input ($) OR a comma, so here we do two different QRegExps instead. |
373 | QRegExp userRegExp(QString("[:,]%1$").arg(username)); // The end of line variant. | 371 | QRegExp userRegExp(QString("[:,]%1$").arg(username)); // The end of line variant. |
374 | QStringList tempList=accounts->groupStringList.grep(userRegExp); // Find all entries in the group database, that the user is a member of. | 372 | QStringList tempList=accounts->groupStringList.grep(userRegExp); // Find all entries in the group database, that the user is a member of. |
375 | for(QStringList::Iterator it=tempList.begin(); it!=tempList.end(); ++it) | 373 | for(QStringList::Iterator it=tempList.begin(); it!=tempList.end(); ++it) |
376 | { // Iterate over all of them. | 374 | { // Iterate over all of them. |
377 | qWarning(*it); | 375 | owarn << *it << oendl; |
378 | QListViewItemIterator lvit( edituserDialog->groupsListView ); // Compare to all groups. | 376 | QListViewItemIterator lvit( edituserDialog->groupsListView ); // Compare to all groups. |
379 | for ( ; lvit.current(); ++lvit ) | 377 | for ( ; lvit.current(); ++lvit ) |
380 | { | 378 | { |
381 | if(lvit.current()->text(0)==(*it).left((*it).find(":"))) | 379 | if(lvit.current()->text(0)==(*it).left((*it).find(":"))) |
382 | { | 380 | { |
383 | temp=(QCheckListItem*)lvit.current(); | 381 | temp=(QCheckListItem*)lvit.current(); |
384 | temp->setOn(true); // If we find a line with that groupname, select it.; | 382 | temp->setOn(true); // If we find a line with that groupname, select it.; |
385 | } | 383 | } |
386 | } | 384 | } |
387 | } | 385 | } |
388 | userRegExp=QRegExp(QString("[:,]%1,").arg(username)); // And the other one. (not end of line.) | 386 | userRegExp=QRegExp(QString("[:,]%1,").arg(username)); // And the other one. (not end of line.) |
389 | tempList=accounts->groupStringList.grep(userRegExp); // Find all entries in the group database, that the user is a member of. | 387 | tempList=accounts->groupStringList.grep(userRegExp); // Find all entries in the group database, that the user is a member of. |
390 | for(QStringList::Iterator it=tempList.begin(); it!=tempList.end(); ++it) | 388 | for(QStringList::Iterator it=tempList.begin(); it!=tempList.end(); ++it) |
391 | { // Iterate over all of them. | 389 | { // Iterate over all of them. |
392 | qWarning(*it); | 390 | owarn << *it << oendl; |
393 | QListViewItemIterator lvit( edituserDialog->groupsListView ); // Compare to all groups. | 391 | QListViewItemIterator lvit( edituserDialog->groupsListView ); // Compare to all groups. |
394 | for ( ; lvit.current(); ++lvit ) | 392 | for ( ; lvit.current(); ++lvit ) |
395 | { | 393 | { |
396 | if(lvit.current()->text(0)==(*it).left((*it).find(":"))) | 394 | if(lvit.current()->text(0)==(*it).left((*it).find(":"))) |
397 | { | 395 | { |
398 | temp=(QCheckListItem*)lvit.current(); | 396 | temp=(QCheckListItem*)lvit.current(); |
399 | temp->setOn(true); // If we find a line with that groupname, select it.; | 397 | temp->setOn(true); // If we find a line with that groupname, select it.; |
400 | } | 398 | } |
401 | } | 399 | } |
402 | } | 400 | } |
403 | 401 | ||
404 | if(!(edituserDialog->exec())) return false; // SHOW THE DIALOG! | 402 | if(!(edituserDialog->exec())) return false; // SHOW THE DIALOG! |
diff --git a/noncore/settings/usermanager/usermanager.cpp b/noncore/settings/usermanager/usermanager.cpp index a1130d4..1d345ee 100644 --- a/noncore/settings/usermanager/usermanager.cpp +++ b/noncore/settings/usermanager/usermanager.cpp | |||
@@ -1,29 +1,32 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * This program is free software; you can redistribute it and/or modify * | 3 | * This program is free software; you can redistribute it and/or modify * |
4 | * it under the terms of the GNU General Public License as published by * | 4 | * it under the terms of the GNU General Public License as published by * |
5 | * the Free Software Foundation; either version 2 of the License, or * | 5 | * the Free Software Foundation; either version 2 of the License, or * |
6 | * (at your option) any later version. * | 6 | * (at your option) any later version. * |
7 | * * | 7 | * * |
8 | ***************************************************************************/ | 8 | ***************************************************************************/ |
9 | 9 | ||
10 | #include "usermanager.h" | 10 | #include "usermanager.h" |
11 | 11 | ||
12 | #include <qlayout.h> | 12 | /* OPIE */ |
13 | #include <opie2/odebug.h> | ||
14 | #include <qpe/resource.h> | ||
15 | using namespace Opie::Core; | ||
13 | 16 | ||
17 | /* QT */ | ||
18 | #include <qlayout.h> | ||
14 | #include <qmessagebox.h> | 19 | #include <qmessagebox.h> |
15 | #include <qfile.h> | 20 | #include <qfile.h> |
16 | #include <qpe/resource.h> | ||
17 | |||
18 | #include <qregexp.h> | 21 | #include <qregexp.h> |
19 | 22 | ||
20 | /** | 23 | /** |
21 | * The mainwindow constructor. | 24 | * The mainwindow constructor. |
22 | * | 25 | * |
23 | * @param QWidget *parent | 26 | * @param QWidget *parent |
24 | * @param const char *name | 27 | * @param const char *name |
25 | * @ param WFlags fl | 28 | * @ param WFlags fl |
26 | * | 29 | * |
27 | */ | 30 | */ |
28 | UserConfig::UserConfig(QWidget* parent, const char* name, WFlags fl) : QMainWindow(parent, name, fl) { | 31 | UserConfig::UserConfig(QWidget* parent, const char* name, WFlags fl) : QMainWindow(parent, name, fl) { |
29 | setCaption(tr("Opie User Manager")); | 32 | setCaption(tr("Opie User Manager")); |
@@ -244,14 +247,14 @@ void UserConfig::delGroup() { | |||
244 | groupname=groupsListView->currentItem()->text(1);// Get the groupname from the listview. | 247 | groupname=groupsListView->currentItem()->text(1);// Get the groupname from the listview. |
245 | if(QMessageBox::warning(this,"Delete group","Are you sure you want to\ndelete the group \""+QString(groupname)+"\" ?","&No","&Yes",0,0,1)) { | 248 | if(QMessageBox::warning(this,"Delete group","Are you sure you want to\ndelete the group \""+QString(groupname)+"\" ?","&No","&Yes",0,0,1)) { |
246 | // If confirmed, try to delete the group. | 249 | // If confirmed, try to delete the group. |
247 | if(GroupDialog::delGroup(groupname)) getGroups(); // And also update the view afterwards if the user was deleted. | 250 | if(GroupDialog::delGroup(groupname)) getGroups(); // And also update the view afterwards if the user was deleted. |
248 | } | 251 | } |
249 | } else { | 252 | } else { |
250 | QMessageBox::information(this,"No selection","No group has been selected."); | 253 | QMessageBox::information(this,"No selection","No group has been selected."); |
251 | } | 254 | } |
252 | } | 255 | } |
253 | 256 | ||
254 | void UserConfig::showUserMenu(QListViewItem *item) { | 257 | void UserConfig::showUserMenu(QListViewItem *item) { |
255 | //userPopupMenu.exec(item->mapToGlobal(QPoint(0,0))); | 258 | //userPopupMenu.exec(item->mapToGlobal(QPoint(0,0))); |
256 | qWarning("Pressed!"); | 259 | owarn << "Pressed!" << oendl; |
257 | } | 260 | } |
diff --git a/noncore/settings/usermanager/usermanager.pro b/noncore/settings/usermanager/usermanager.pro index d0647dd..31f52a6 100644 --- a/noncore/settings/usermanager/usermanager.pro +++ b/noncore/settings/usermanager/usermanager.pro | |||
@@ -1,10 +1,9 @@ | |||
1 | #CONFIG = qt warn_on | 1 | CONFIG = qt warn_on quick-app |
2 | CONFIG = qt warn_on quick-app | ||
3 | HEADERS = usermanager.h userdialog.h groupdialog.h passwd.h | 2 | HEADERS = usermanager.h userdialog.h groupdialog.h passwd.h |
4 | SOURCES = usermanager.cpp userdialog.cpp groupdialog.cpp passwd.cpp main.cpp | 3 | SOURCES = usermanager.cpp userdialog.cpp groupdialog.cpp passwd.cpp main.cpp |
5 | INCLUDEPATH += $(OPIEDIR)/include | 4 | INCLUDEPATH += $(OPIEDIR)/include |
6 | DEPENDPATH += $(OPIEDIR)/include | 5 | DEPENDPATH += $(OPIEDIR)/include |
7 | LIBS += -lqpe -lopiecore2 -lopieui2 -lcrypt | 6 | LIBS += -lqpe -lopiecore2 -lopieui2 -lcrypt |
8 | TARGET = usermanager | 7 | TARGET = usermanager |
9 | 8 | ||
10 | include ( $(OPIEDIR)/include.pro ) | 9 | include ( $(OPIEDIR)/include.pro ) |