author | ar <ar> | 2004-05-02 16:35:53 (UTC) |
---|---|---|
committer | ar <ar> | 2004-05-02 16:35:53 (UTC) |
commit | f8add41b2e0b0371754521b44d95f87fa70a6ff2 (patch) (unidiff) | |
tree | 5e31a4f036ff20fc3a5961e99a17fc141caf9b8b | |
parent | 34f1234b010fa80f9ca06e65f46130713f7362d9 (diff) | |
download | opie-f8add41b2e0b0371754521b44d95f87fa70a6ff2.zip opie-f8add41b2e0b0371754521b44d95f87fa70a6ff2.tar.gz opie-f8add41b2e0b0371754521b44d95f87fa70a6ff2.tar.bz2 |
- convert qDebug to odebug
-rw-r--r-- | core/launcher/documentlist.cpp | 8 | ||||
-rw-r--r-- | core/launcher/qprocess_unix.cpp | 8 | ||||
-rw-r--r-- | core/launcher/screensaver.cpp | 8 | ||||
-rw-r--r-- | core/launcher/server.cpp | 4 | ||||
-rw-r--r-- | core/launcher/transferserver.cpp | 3 |
5 files changed, 17 insertions, 14 deletions
diff --git a/core/launcher/documentlist.cpp b/core/launcher/documentlist.cpp index 19ceb0f..44ceb0c 100644 --- a/core/launcher/documentlist.cpp +++ b/core/launcher/documentlist.cpp | |||
@@ -342,135 +342,135 @@ void DocumentList::DiffAppLnks() | |||
342 | if ( d->sendAppLnks && d->serverGui ) { | 342 | if ( d->sendAppLnks && d->serverGui ) { |
343 | static QStringList prevTypeList = appLnkSet->types(); | 343 | static QStringList prevTypeList = appLnkSet->types(); |
344 | QStringList types = appLnkSet2->types(); | 344 | QStringList types = appLnkSet2->types(); |
345 | for ( QStringList::Iterator ittypes=types.begin(); ittypes!=types.end(); ++ittypes) { | 345 | for ( QStringList::Iterator ittypes=types.begin(); ittypes!=types.end(); ++ittypes) { |
346 | if ( !(*ittypes).isEmpty() ) { | 346 | if ( !(*ittypes).isEmpty() ) { |
347 | if ( !prevTypeList.contains(*ittypes) ) { | 347 | if ( !prevTypeList.contains(*ittypes) ) { |
348 | QString name = appLnkSet2->typeName(*ittypes); | 348 | QString name = appLnkSet2->typeName(*ittypes); |
349 | QPixmap pm = appLnkSet2->typePixmap(*ittypes); | 349 | QPixmap pm = appLnkSet2->typePixmap(*ittypes); |
350 | QPixmap bgPm = appLnkSet2->typeBigPixmap(*ittypes); | 350 | QPixmap bgPm = appLnkSet2->typeBigPixmap(*ittypes); |
351 | 351 | ||
352 | if (pm.isNull()) { | 352 | if (pm.isNull()) { |
353 | QImage img( Resource::loadImage( "UnknownDocument" ) ); | 353 | QImage img( Resource::loadImage( "UnknownDocument" ) ); |
354 | pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); | 354 | pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); |
355 | bgPm = img.smoothScale( AppLnk::bigIconSize(), AppLnk::bigIconSize() ); | 355 | bgPm = img.smoothScale( AppLnk::bigIconSize(), AppLnk::bigIconSize() ); |
356 | } | 356 | } |
357 | 357 | ||
358 | odebug << "adding type " << (*ittypes) << "" << oendl; | 358 | odebug << "adding type " << (*ittypes) << "" << oendl; |
359 | 359 | ||
360 | // ### our current launcher expects docs tab to be last | 360 | // ### our current launcher expects docs tab to be last |
361 | d->serverGui->typeAdded( *ittypes, name.isNull() ? (*ittypes) : name, pm, bgPm ); | 361 | d->serverGui->typeAdded( *ittypes, name.isNull() ? (*ittypes) : name, pm, bgPm ); |
362 | } | 362 | } |
363 | prevTypeList.remove(*ittypes); | 363 | prevTypeList.remove(*ittypes); |
364 | } | 364 | } |
365 | } | 365 | } |
366 | for ( QStringList::Iterator ittypes=prevTypeList.begin(); ittypes!=prevTypeList.end(); ++ittypes) { | 366 | for ( QStringList::Iterator ittypes=prevTypeList.begin(); ittypes!=prevTypeList.end(); ++ittypes) { |
367 | odebug << "removing type " << (*ittypes) << "" << oendl; | 367 | odebug << "removing type " << (*ittypes) << "" << oendl; |
368 | d->serverGui->typeRemoved(*ittypes); | 368 | d->serverGui->typeRemoved(*ittypes); |
369 | } | 369 | } |
370 | prevTypeList = types; | 370 | prevTypeList = types; |
371 | } | 371 | } |
372 | 372 | ||
373 | 373 | ||
374 | QListIterator<AppLnk> it1( appLnkSet->children() ); | 374 | QListIterator<AppLnk> it1( appLnkSet->children() ); |
375 | QListIterator<AppLnk> it2( appLnkSet2->children() ); | 375 | QListIterator<AppLnk> it2( appLnkSet2->children() ); |
376 | 376 | ||
377 | AppLnk *i; | 377 | AppLnk *i; |
378 | AppLnk *j; | 378 | AppLnk *j; |
379 | bool found; | 379 | bool found; |
380 | 380 | ||
381 | while ( (j=it2.current()) ) { | 381 | while ( (j=it2.current()) ) { |
382 | it1 = appLnkSet->children(); | 382 | it1 = appLnkSet->children(); |
383 | found = false; | 383 | found = false; |
384 | while ( (i=it1.current()) ){ | 384 | while ( (i=it1.current()) ){ |
385 | if (strcmp(i->name().ascii(),j->name().ascii()) == 0) | 385 | if (strcmp(i->name().ascii(),j->name().ascii()) == 0) |
386 | found = true; | 386 | found = true; |
387 | ++it1; | 387 | ++it1; |
388 | } | 388 | } |
389 | if (!found) { | 389 | if (!found) { |
390 | qDebug("Item %s needs to be added",j->name().ascii() ); | 390 | odebug << "Item " << j->name().ascii() << " needs to be added" << oendl; |
391 | d->serverGui->applicationAdded( j->type(), *j ); | 391 | d->serverGui->applicationAdded( j->type(), *j ); |
392 | } | 392 | } |
393 | ++it2; | 393 | ++it2; |
394 | } | 394 | } |
395 | 395 | ||
396 | it1 = appLnkSet->children(); | 396 | it1 = appLnkSet->children(); |
397 | while ( (i=it1.current()) ) { | 397 | while ( (i=it1.current()) ) { |
398 | it2 = appLnkSet2->children(); | 398 | it2 = appLnkSet2->children(); |
399 | found = false; | 399 | found = false; |
400 | while ( (j=it2.current()) ){ | 400 | while ( (j=it2.current()) ){ |
401 | if (strcmp(i->name().ascii(),j->name().ascii()) == 0) | 401 | if (strcmp(i->name().ascii(),j->name().ascii()) == 0) |
402 | found = true; | 402 | found = true; |
403 | ++it2; | 403 | ++it2; |
404 | } | 404 | } |
405 | if (!found) { | 405 | if (!found) { |
406 | qDebug("Item %s needs to be removed",i->name().ascii() ); | 406 | odebug << "Item " << i->name().ascii() << " needs to be removed" << oendl; |
407 | d->serverGui->applicationRemoved( i->type(), *i ); | 407 | d->serverGui->applicationRemoved( i->type(), *i ); |
408 | } | 408 | } |
409 | 409 | ||
410 | ++it1; | 410 | ++it1; |
411 | } | 411 | } |
412 | 412 | ||
413 | delete appLnkSet; | 413 | delete appLnkSet; |
414 | appLnkSet = appLnkSet2; | 414 | appLnkSet = appLnkSet2; |
415 | 415 | ||
416 | } | 416 | } |
417 | void DocumentList::storageChanged() | 417 | void DocumentList::storageChanged() |
418 | { | 418 | { |
419 | QTime t; | 419 | QTime t; |
420 | // ### can implement better | 420 | // ### can implement better |
421 | 421 | ||
422 | t.start(); | 422 | t.start(); |
423 | DiffAppLnks(); | 423 | DiffAppLnks(); |
424 | // reloadAppLnks(); | 424 | // reloadAppLnks(); |
425 | qDebug("Reload App links took %i ms",t.elapsed() ); | 425 | odebug << "Reload App links took " << t.elapsed() << " ms" << oendl; |
426 | reloadDocLnks(); | 426 | reloadDocLnks(); |
427 | // odebug << "Reload links took " << t.elapsed() << " ms " << oendl; | 427 | // odebug << "Reload links took " << t.elapsed() << " ms " << oendl; |
428 | qDebug("Reload All links took %i ms",t.elapsed() ); | 428 | odebug << "Reload All links took " << t.elapsed() << " ms" << oendl; |
429 | // ### Optimization opportunity | 429 | // ### Optimization opportunity |
430 | // Could be a bit more intelligent and somehow work out which | 430 | // Could be a bit more intelligent and somehow work out which |
431 | // mtab entry has changed and then only scan that and add and remove | 431 | // mtab entry has changed and then only scan that and add and remove |
432 | // links appropriately. | 432 | // links appropriately. |
433 | // rescan(); | 433 | // rescan(); |
434 | } | 434 | } |
435 | 435 | ||
436 | void DocumentList::sendAllDocLinks() | 436 | void DocumentList::sendAllDocLinks() |
437 | { | 437 | { |
438 | if ( d->tid != 0 ) { | 438 | if ( d->tid != 0 ) { |
439 | // We are in the middle of scanning, set a flag so | 439 | // We are in the middle of scanning, set a flag so |
440 | // we do this when we finish our scanning | 440 | // we do this when we finish our scanning |
441 | d->needToSendAllDocLinks = true; | 441 | d->needToSendAllDocLinks = true; |
442 | return; | 442 | return; |
443 | } | 443 | } |
444 | 444 | ||
445 | QString contents; | 445 | QString contents; |
446 | Categories cats; | 446 | Categories cats; |
447 | for ( QListIterator<DocLnk> it( d->dls.children() ); it.current(); ++it ) { | 447 | for ( QListIterator<DocLnk> it( d->dls.children() ); it.current(); ++it ) { |
448 | DocLnk *doc = it.current(); | 448 | DocLnk *doc = it.current(); |
449 | QFileInfo fi( doc->file() ); | 449 | QFileInfo fi( doc->file() ); |
450 | if ( !fi.exists() ) | 450 | if ( !fi.exists() ) |
451 | continue; | 451 | continue; |
452 | 452 | ||
453 | bool fake = !doc->linkFileKnown(); | 453 | bool fake = !doc->linkFileKnown(); |
454 | if ( !fake ) { | 454 | if ( !fake ) { |
455 | QFile f( doc->linkFile() ); | 455 | QFile f( doc->linkFile() ); |
456 | if ( f.open( IO_ReadOnly ) ) { | 456 | if ( f.open( IO_ReadOnly ) ) { |
457 | QTextStream ts( &f ); | 457 | QTextStream ts( &f ); |
458 | ts.setEncoding( QTextStream::UnicodeUTF8 ); | 458 | ts.setEncoding( QTextStream::UnicodeUTF8 ); |
459 | contents += ts.read(); | 459 | contents += ts.read(); |
460 | f.close(); | 460 | f.close(); |
461 | } else | 461 | } else |
462 | fake = TRUE; | 462 | fake = TRUE; |
463 | } | 463 | } |
464 | if (fake) { | 464 | if (fake) { |
465 | contents += "[Desktop Entry]\n"; // No tr | 465 | contents += "[Desktop Entry]\n"; // No tr |
466 | contents += "Categories = " + // No tr | 466 | contents += "Categories = " + // No tr |
467 | cats.labels("Document View",doc->categories()).join(";") + "\n"; // No tr | 467 | cats.labels("Document View",doc->categories()).join(";") + "\n"; // No tr |
468 | contents += "Name = "+doc->name()+"\n"; // No tr | 468 | contents += "Name = "+doc->name()+"\n"; // No tr |
469 | contents += "Type = "+doc->type()+"\n"; // No tr | 469 | contents += "Type = "+doc->type()+"\n"; // No tr |
470 | } | 470 | } |
471 | contents += "File = "+doc->file()+"\n"; // No tr // (resolves path) | 471 | contents += "File = "+doc->file()+"\n"; // No tr // (resolves path) |
472 | contents += QString("Size = %1\n").arg( fi.size() ); // No tr | 472 | contents += QString("Size = %1\n").arg( fi.size() ); // No tr |
473 | } | 473 | } |
474 | 474 | ||
475 | //odebug << "sending length " << contents.length() << "" << oendl; | 475 | //odebug << "sending length " << contents.length() << "" << oendl; |
476 | #ifndef QT_NO_COP | 476 | #ifndef QT_NO_COP |
diff --git a/core/launcher/qprocess_unix.cpp b/core/launcher/qprocess_unix.cpp index 56e1b1d..97c0460 100644 --- a/core/launcher/qprocess_unix.cpp +++ b/core/launcher/qprocess_unix.cpp | |||
@@ -987,104 +987,104 @@ void QProcess::socketRead( int fd ) | |||
987 | } | 987 | } |
988 | 988 | ||
989 | // read data | 989 | // read data |
990 | oldSize = buffer->size(); | 990 | oldSize = buffer->size(); |
991 | buffer->resize( oldSize + bufsize ); | 991 | buffer->resize( oldSize + bufsize ); |
992 | n = ::read( fd, buffer->data()+oldSize, bufsize ); | 992 | n = ::read( fd, buffer->data()+oldSize, bufsize ); |
993 | if ( n > 0 ) | 993 | if ( n > 0 ) |
994 | buffer->resize( oldSize + n ); | 994 | buffer->resize( oldSize + n ); |
995 | else | 995 | else |
996 | buffer->resize( oldSize ); | 996 | buffer->resize( oldSize ); |
997 | // eof or error? | 997 | // eof or error? |
998 | if ( n == 0 || n == -1 ) { | 998 | if ( n == 0 || n == -1 ) { |
999 | if ( fd == d->proc->socketStdout ) { | 999 | if ( fd == d->proc->socketStdout ) { |
1000 | #if defined(QT_QPROCESS_DEBUG) | 1000 | #if defined(QT_QPROCESS_DEBUG) |
1001 | odebug << "QProcess::socketRead(): stdout (" << fd << ") closed" << oendl; | 1001 | odebug << "QProcess::socketRead(): stdout (" << fd << ") closed" << oendl; |
1002 | #endif | 1002 | #endif |
1003 | d->notifierStdout->setEnabled( FALSE ); | 1003 | d->notifierStdout->setEnabled( FALSE ); |
1004 | delete d->notifierStdout; | 1004 | delete d->notifierStdout; |
1005 | d->notifierStdout = 0; | 1005 | d->notifierStdout = 0; |
1006 | ::close( d->proc->socketStdout ); | 1006 | ::close( d->proc->socketStdout ); |
1007 | d->proc->socketStdout = 0; | 1007 | d->proc->socketStdout = 0; |
1008 | return; | 1008 | return; |
1009 | } else if ( fd == d->proc->socketStderr ) { | 1009 | } else if ( fd == d->proc->socketStderr ) { |
1010 | #if defined(QT_QPROCESS_DEBUG) | 1010 | #if defined(QT_QPROCESS_DEBUG) |
1011 | odebug << "QProcess::socketRead(): stderr (" << fd << ") closed" << oendl; | 1011 | odebug << "QProcess::socketRead(): stderr (" << fd << ") closed" << oendl; |
1012 | #endif | 1012 | #endif |
1013 | d->notifierStderr->setEnabled( FALSE ); | 1013 | d->notifierStderr->setEnabled( FALSE ); |
1014 | delete d->notifierStderr; | 1014 | delete d->notifierStderr; |
1015 | d->notifierStderr = 0; | 1015 | d->notifierStderr = 0; |
1016 | ::close( d->proc->socketStderr ); | 1016 | ::close( d->proc->socketStderr ); |
1017 | d->proc->socketStderr = 0; | 1017 | d->proc->socketStderr = 0; |
1018 | return; | 1018 | return; |
1019 | } | 1019 | } |
1020 | } | 1020 | } |
1021 | // read all data that is available | 1021 | // read all data that is available |
1022 | while ( n == bufsize ) { | 1022 | while ( n == bufsize ) { |
1023 | oldSize = buffer->size(); | 1023 | oldSize = buffer->size(); |
1024 | buffer->resize( oldSize + bufsize ); | 1024 | buffer->resize( oldSize + bufsize ); |
1025 | n = ::read( fd, buffer->data()+oldSize, bufsize ); | 1025 | n = ::read( fd, buffer->data()+oldSize, bufsize ); |
1026 | if ( n > 0 ) | 1026 | if ( n > 0 ) |
1027 | buffer->resize( oldSize + n ); | 1027 | buffer->resize( oldSize + n ); |
1028 | else | 1028 | else |
1029 | buffer->resize( oldSize ); | 1029 | buffer->resize( oldSize ); |
1030 | } | 1030 | } |
1031 | 1031 | ||
1032 | d->socketReadCalled = TRUE; | 1032 | d->socketReadCalled = TRUE; |
1033 | if ( fd == d->proc->socketStdout ) { | 1033 | if ( fd == d->proc->socketStdout ) { |
1034 | #if defined(QT_QPROCESS_DEBUG) | 1034 | #if defined(QT_QPROCESS_DEBUG) |
1035 | qDebug( "QProcess::socketRead(): %d bytes read from stdout (%d)", | 1035 | odebug << "QProcess::socketRead(): " << buffer->size()-oldSize << "bytes read from stdout (" |
1036 | buffer->size()-oldSize, fd ); | 1036 | << fd << ")" << oendl; |
1037 | #endif | 1037 | #endif |
1038 | emit readyReadStdout(); | 1038 | emit readyReadStdout(); |
1039 | } else if ( fd == d->proc->socketStderr ) { | 1039 | } else if ( fd == d->proc->socketStderr ) { |
1040 | #if defined(QT_QPROCESS_DEBUG) | 1040 | #if defined(QT_QPROCESS_DEBUG) |
1041 | qDebug( "QProcess::socketRead(): %d bytes read from stderr (%d)", | 1041 | odebug << "QProcess::socketRead(): " << buffer->size()-oldSize << " bytes read from stderr (" |
1042 | buffer->size()-oldSize, fd ); | 1042 | << fd << ")" << oendl; |
1043 | #endif | 1043 | #endif |
1044 | emit readyReadStderr(); | 1044 | emit readyReadStderr(); |
1045 | } | 1045 | } |
1046 | d->socketReadCalled = FALSE; | 1046 | d->socketReadCalled = FALSE; |
1047 | } | 1047 | } |
1048 | 1048 | ||
1049 | 1049 | ||
1050 | /* | 1050 | /* |
1051 | This private slot is called when the process tries to read data from standard | 1051 | This private slot is called when the process tries to read data from standard |
1052 | input. | 1052 | input. |
1053 | */ | 1053 | */ |
1054 | void QProcess::socketWrite( int fd ) | 1054 | void QProcess::socketWrite( int fd ) |
1055 | { | 1055 | { |
1056 | if ( fd != d->proc->socketStdin || d->proc->socketStdin == 0 ) | 1056 | if ( fd != d->proc->socketStdin || d->proc->socketStdin == 0 ) |
1057 | return; | 1057 | return; |
1058 | if ( d->stdinBuf.isEmpty() ) { | 1058 | if ( d->stdinBuf.isEmpty() ) { |
1059 | d->notifierStdin->setEnabled( FALSE ); | 1059 | d->notifierStdin->setEnabled( FALSE ); |
1060 | return; | 1060 | return; |
1061 | } | 1061 | } |
1062 | #if defined(QT_QPROCESS_DEBUG) | 1062 | #if defined(QT_QPROCESS_DEBUG) |
1063 | odebug << "QProcess::socketWrite(): write to stdin (" << fd << ")" << oendl; | 1063 | odebug << "QProcess::socketWrite(): write to stdin (" << fd << ")" << oendl; |
1064 | #endif | 1064 | #endif |
1065 | ssize_t ret = ::write( fd, | 1065 | ssize_t ret = ::write( fd, |
1066 | d->stdinBuf.head()->data() + d->stdinBufRead, | 1066 | d->stdinBuf.head()->data() + d->stdinBufRead, |
1067 | d->stdinBuf.head()->size() - d->stdinBufRead ); | 1067 | d->stdinBuf.head()->size() - d->stdinBufRead ); |
1068 | if ( ret > 0 ) | 1068 | if ( ret > 0 ) |
1069 | d->stdinBufRead += ret; | 1069 | d->stdinBufRead += ret; |
1070 | if ( d->stdinBufRead == (ssize_t)d->stdinBuf.head()->size() ) { | 1070 | if ( d->stdinBufRead == (ssize_t)d->stdinBuf.head()->size() ) { |
1071 | d->stdinBufRead = 0; | 1071 | d->stdinBufRead = 0; |
1072 | delete d->stdinBuf.dequeue(); | 1072 | delete d->stdinBuf.dequeue(); |
1073 | if ( wroteToStdinConnected && d->stdinBuf.isEmpty() ) | 1073 | if ( wroteToStdinConnected && d->stdinBuf.isEmpty() ) |
1074 | emit wroteToStdin(); | 1074 | emit wroteToStdin(); |
1075 | socketWrite( fd ); | 1075 | socketWrite( fd ); |
1076 | } | 1076 | } |
1077 | } | 1077 | } |
1078 | 1078 | ||
1079 | /*! | 1079 | /*! |
1080 | \internal | 1080 | \internal |
1081 | Flushes standard input. This is useful if you want to use QProcess in a | 1081 | Flushes standard input. This is useful if you want to use QProcess in a |
1082 | synchronous manner. | 1082 | synchronous manner. |
1083 | 1083 | ||
1084 | This function should probably go into the public API. | 1084 | This function should probably go into the public API. |
1085 | */ | 1085 | */ |
1086 | void QProcess::flushStdin() | 1086 | void QProcess::flushStdin() |
1087 | { | 1087 | { |
1088 | socketWrite( d->proc->socketStdin ); | 1088 | socketWrite( d->proc->socketStdin ); |
1089 | } | 1089 | } |
1090 | 1090 | ||
diff --git a/core/launcher/screensaver.cpp b/core/launcher/screensaver.cpp index a7d23c4..f818d62 100644 --- a/core/launcher/screensaver.cpp +++ b/core/launcher/screensaver.cpp | |||
@@ -1,55 +1,56 @@ | |||
1 | 1 | ||
2 | #include "screensaver.h" | 2 | #include "screensaver.h" |
3 | 3 | ||
4 | #include <qpe/config.h> | 4 | #include <qpe/config.h> |
5 | #include <qpe/network.h> | 5 | #include <qpe/network.h> |
6 | 6 | ||
7 | #include <opie2/odevice.h> | 7 | #include <opie2/odevice.h> |
8 | #include <opie2/odebug.h> | ||
8 | 9 | ||
9 | 10 | ||
10 | using namespace Opie::Core; | 11 | using namespace Opie::Core; |
11 | 12 | ||
12 | 13 | ||
13 | 14 | ||
14 | OpieScreenSaver::OpieScreenSaver ( ) | 15 | OpieScreenSaver::OpieScreenSaver ( ) |
15 | : QObject ( 0, "screensaver" ), QWSScreenSaver ( ) | 16 | : QObject ( 0, "screensaver" ), QWSScreenSaver ( ) |
16 | { | 17 | { |
17 | m_disable_suspend = 100; | 18 | m_disable_suspend = 100; |
18 | m_enable_dim = false; | 19 | m_enable_dim = false; |
19 | m_enable_lightoff = false; | 20 | m_enable_lightoff = false; |
20 | m_enable_suspend = false; | 21 | m_enable_suspend = false; |
21 | m_onlylcdoff = false; | 22 | m_onlylcdoff = false; |
22 | 23 | ||
23 | m_enable_dim_ac = false; | 24 | m_enable_dim_ac = false; |
24 | m_enable_lightoff_ac = false; | 25 | m_enable_lightoff_ac = false; |
25 | m_enable_suspend_ac = false; | 26 | m_enable_suspend_ac = false; |
26 | m_onlylcdoff_ac = false; | 27 | m_onlylcdoff_ac = false; |
27 | 28 | ||
28 | m_use_light_sensor = false; | 29 | m_use_light_sensor = false; |
29 | m_backlight_sensor = -1; | 30 | m_backlight_sensor = -1; |
30 | ::memset ( m_sensordata, 0xff, LS_Count * sizeof( m_sensordata [0] )); | 31 | ::memset ( m_sensordata, 0xff, LS_Count * sizeof( m_sensordata [0] )); |
31 | 32 | ||
32 | m_lcd_status = true; | 33 | m_lcd_status = true; |
33 | 34 | ||
34 | m_backlight_normal = -1; | 35 | m_backlight_normal = -1; |
35 | m_backlight_current = -1; | 36 | m_backlight_current = -1; |
36 | m_backlight_forcedoff = false; | 37 | m_backlight_forcedoff = false; |
37 | 38 | ||
38 | m_on_ac = false; | 39 | m_on_ac = false; |
39 | 40 | ||
40 | m_level = -1; | 41 | m_level = -1; |
41 | 42 | ||
42 | // Make sure the LCD is in fact on, (if opie was killed while the LCD is off it would still be off) | 43 | // Make sure the LCD is in fact on, (if opie was killed while the LCD is off it would still be off) |
43 | ODevice::inst ( )-> setDisplayStatus ( true ); | 44 | ODevice::inst ( )-> setDisplayStatus ( true ); |
44 | setBacklight ( -1 ); | 45 | setBacklight ( -1 ); |
45 | } | 46 | } |
46 | 47 | ||
47 | 48 | ||
48 | /** | 49 | /** |
49 | * Stops the screen saver | 50 | * Stops the screen saver |
50 | */ | 51 | */ |
51 | void OpieScreenSaver::restore() | 52 | void OpieScreenSaver::restore() |
52 | { | 53 | { |
53 | m_level = -1; | 54 | m_level = -1; |
54 | 55 | ||
55 | if ( !m_lcd_status ) { // We must have turned it off | 56 | if ( !m_lcd_status ) { // We must have turned it off |
@@ -165,164 +166,167 @@ void OpieScreenSaver::setIntervals ( int dim, int lightoff, int suspend ) | |||
165 | v [ 2 ] = QMAX( 1000 * suspend, 100 ); | 166 | v [ 2 ] = QMAX( 1000 * suspend, 100 ); |
166 | v [ 3 ] = 0; | 167 | v [ 3 ] = 0; |
167 | 168 | ||
168 | if ( !dim && !lightoff && !suspend ) | 169 | if ( !dim && !lightoff && !suspend ) |
169 | QWSServer::setScreenSaverInterval( 0 ); | 170 | QWSServer::setScreenSaverInterval( 0 ); |
170 | else | 171 | else |
171 | QWSServer::setScreenSaverIntervals( v ); | 172 | QWSServer::setScreenSaverIntervals( v ); |
172 | } | 173 | } |
173 | 174 | ||
174 | 175 | ||
175 | /** | 176 | /** |
176 | * Set suspend time. Will read the dim and lcd-off times from the config file. | 177 | * Set suspend time. Will read the dim and lcd-off times from the config file. |
177 | * | 178 | * |
178 | * @param suspend time in seconds to go into APM suspend, -1 to | 179 | * @param suspend time in seconds to go into APM suspend, -1 to |
179 | * read value from config file, 0 to disable | 180 | * read value from config file, 0 to disable |
180 | */ | 181 | */ |
181 | void OpieScreenSaver::setInterval ( int interval ) | 182 | void OpieScreenSaver::setInterval ( int interval ) |
182 | { | 183 | { |
183 | setIntervals ( -1, -1, interval ); | 184 | setIntervals ( -1, -1, interval ); |
184 | } | 185 | } |
185 | 186 | ||
186 | 187 | ||
187 | void OpieScreenSaver::setMode ( int mode ) | 188 | void OpieScreenSaver::setMode ( int mode ) |
188 | { | 189 | { |
189 | if ( mode > m_disable_suspend ) | 190 | if ( mode > m_disable_suspend ) |
190 | setInterval ( -1 ); | 191 | setInterval ( -1 ); |
191 | m_disable_suspend = mode; | 192 | m_disable_suspend = mode; |
192 | } | 193 | } |
193 | 194 | ||
194 | 195 | ||
195 | /** | 196 | /** |
196 | * Set display brightness | 197 | * Set display brightness |
197 | * | 198 | * |
198 | * Get's default values for backlight, contrast and light sensor from config file. | 199 | * Get's default values for backlight, contrast and light sensor from config file. |
199 | * | 200 | * |
200 | * @param bright desired brighness (-1 to use automatic sensor data or value | 201 | * @param bright desired brighness (-1 to use automatic sensor data or value |
201 | * from config file, -2 to toggle backlight on and off, -3 to | 202 | * from config file, -2 to toggle backlight on and off, -3 to |
202 | * force backlight off) | 203 | * force backlight off) |
203 | */ | 204 | */ |
204 | void OpieScreenSaver::setBacklight ( int bright ) | 205 | void OpieScreenSaver::setBacklight ( int bright ) |
205 | { | 206 | { |
206 | // Read from config | 207 | // Read from config |
207 | Config config ( "apm" ); | 208 | Config config ( "apm" ); |
208 | config. setGroup ( m_on_ac ? "AC" : "Battery" ); | 209 | config. setGroup ( m_on_ac ? "AC" : "Battery" ); |
209 | m_backlight_normal = config. readNumEntry ( "Brightness", m_on_ac ? 255 : 127 ); | 210 | m_backlight_normal = config. readNumEntry ( "Brightness", m_on_ac ? 255 : 127 ); |
210 | int contrast = config. readNumEntry ( "Contrast", 127); | 211 | int contrast = config. readNumEntry ( "Contrast", 127); |
211 | m_use_light_sensor = config. readBoolEntry ( "LightSensor", false ); | 212 | m_use_light_sensor = config. readBoolEntry ( "LightSensor", false ); |
212 | 213 | ||
213 | //qDebug ( "setBacklight: %d (norm: %d) (ls: %d)", bright, m_backlight_normal, m_use_light_sensor ? 1 : 0 ); | 214 | //odebug << "setBacklight: " << bright << " (norm: " << m_backlight_normal << ") (ls: " |
215 | // << ( m_use_light_sensor ? 1 : 0 ) << ")" << oendl; | ||
214 | 216 | ||
215 | killTimers ( ); | 217 | killTimers ( ); |
216 | if (( bright < 0 ) && m_use_light_sensor ) { | 218 | if (( bright < 0 ) && m_use_light_sensor ) { |
217 | QStringList sl = config. readListEntry ( "LightSensorData", ';' ); | 219 | QStringList sl = config. readListEntry ( "LightSensorData", ';' ); |
218 | 220 | ||
219 | m_sensordata [LS_SensorMin] = 40; | 221 | m_sensordata [LS_SensorMin] = 40; |
220 | m_sensordata [LS_SensorMax] = 215; | 222 | m_sensordata [LS_SensorMax] = 215; |
221 | m_sensordata [LS_LightMin] = 1; | 223 | m_sensordata [LS_LightMin] = 1; |
222 | m_sensordata [LS_LightMax] = 255; | 224 | m_sensordata [LS_LightMax] = 255; |
223 | m_sensordata [LS_Steps] = 12; | 225 | m_sensordata [LS_Steps] = 12; |
224 | m_sensordata [LS_Interval] = 2000; | 226 | m_sensordata [LS_Interval] = 2000; |
225 | 227 | ||
226 | for ( uint i = 0; i < LS_Count; i++ ) { | 228 | for ( uint i = 0; i < LS_Count; i++ ) { |
227 | if ( i < sl. count ( )) | 229 | if ( i < sl. count ( )) |
228 | m_sensordata [i] = sl [i]. toInt ( ); | 230 | m_sensordata [i] = sl [i]. toInt ( ); |
229 | } | 231 | } |
230 | if ( m_sensordata [LS_Steps] < 2 ) // sanity check to avoid SIGFPE | 232 | if ( m_sensordata [LS_Steps] < 2 ) // sanity check to avoid SIGFPE |
231 | m_sensordata [LS_Steps] = 2; | 233 | m_sensordata [LS_Steps] = 2; |
232 | 234 | ||
233 | timerEvent ( 0 ); | 235 | timerEvent ( 0 ); |
234 | startTimer ( m_sensordata [LS_Interval] ); | 236 | startTimer ( m_sensordata [LS_Interval] ); |
235 | } | 237 | } |
236 | 238 | ||
237 | setBacklightInternal ( bright ); | 239 | setBacklightInternal ( bright ); |
238 | ODevice::inst ( )-> setDisplayContrast(contrast); | 240 | ODevice::inst ( )-> setDisplayContrast(contrast); |
239 | } | 241 | } |
240 | 242 | ||
241 | 243 | ||
242 | /** | 244 | /** |
243 | * Internal brightness setting method | 245 | * Internal brightness setting method |
244 | * | 246 | * |
245 | * Get's default values for backlight and light sensor from config file. | 247 | * Get's default values for backlight and light sensor from config file. |
246 | * | 248 | * |
247 | * @param bright desired brighness (-1 to use automatic sensor data or value | 249 | * @param bright desired brighness (-1 to use automatic sensor data or value |
248 | * from config file, -2 to toggle backlight on and off, -3 to | 250 | * from config file, -2 to toggle backlight on and off, -3 to |
249 | * force backlight off) | 251 | * force backlight off) |
250 | */ | 252 | */ |
251 | void OpieScreenSaver::setBacklightInternal ( int bright ) | 253 | void OpieScreenSaver::setBacklightInternal ( int bright ) |
252 | { | 254 | { |
253 | if ( bright == -3 ) { | 255 | if ( bright == -3 ) { |
254 | // Forced on | 256 | // Forced on |
255 | m_backlight_forcedoff = false; | 257 | m_backlight_forcedoff = false; |
256 | bright = -1; | 258 | bright = -1; |
257 | } | 259 | } |
258 | if ( m_backlight_forcedoff && bright != -2 ) | 260 | if ( m_backlight_forcedoff && bright != -2 ) |
259 | return ; | 261 | return ; |
260 | if ( bright == -2 ) { | 262 | if ( bright == -2 ) { |
261 | // Toggle between off and on | 263 | // Toggle between off and on |
262 | bright = m_backlight_current ? 0 : -1; | 264 | bright = m_backlight_current ? 0 : -1; |
263 | m_backlight_forcedoff = !bright; | 265 | m_backlight_forcedoff = !bright; |
264 | } | 266 | } |
265 | if ( bright == -1 ) | 267 | if ( bright == -1 ) |
266 | bright = m_use_light_sensor ? m_backlight_sensor : m_backlight_normal; | 268 | bright = m_use_light_sensor ? m_backlight_sensor : m_backlight_normal; |
267 | 269 | ||
268 | if ( bright != m_backlight_current ) { | 270 | if ( bright != m_backlight_current ) { |
269 | ODevice::inst ( )-> setDisplayBrightness ( bright ); | 271 | ODevice::inst ( )-> setDisplayBrightness ( bright ); |
270 | m_backlight_current = bright; | 272 | m_backlight_current = bright; |
271 | } | 273 | } |
272 | } | 274 | } |
273 | 275 | ||
274 | 276 | ||
275 | /** | 277 | /** |
276 | * Timer event used for automatic setting the backlight according to a light sensor | 278 | * Timer event used for automatic setting the backlight according to a light sensor |
277 | * and to set the default brightness | 279 | * and to set the default brightness |
278 | */ | 280 | */ |
279 | void OpieScreenSaver::timerEvent ( QTimerEvent * ) | 281 | void OpieScreenSaver::timerEvent ( QTimerEvent * ) |
280 | { | 282 | { |
281 | int s = ODevice::inst ( )-> readLightSensor ( ) * 256 / ODevice::inst ( )-> lightSensorResolution ( ); | 283 | int s = ODevice::inst ( )-> readLightSensor ( ) * 256 / ODevice::inst ( )-> lightSensorResolution ( ); |
282 | 284 | ||
283 | if ( s < m_sensordata [LS_SensorMin] ) | 285 | if ( s < m_sensordata [LS_SensorMin] ) |
284 | m_backlight_sensor = m_sensordata [LS_LightMax]; | 286 | m_backlight_sensor = m_sensordata [LS_LightMax]; |
285 | else if ( s >= m_sensordata [LS_SensorMax] ) | 287 | else if ( s >= m_sensordata [LS_SensorMax] ) |
286 | m_backlight_sensor = m_sensordata [LS_LightMin]; | 288 | m_backlight_sensor = m_sensordata [LS_LightMin]; |
287 | else { | 289 | else { |
288 | int dx = m_sensordata [LS_SensorMax] - m_sensordata [LS_SensorMin]; | 290 | int dx = m_sensordata [LS_SensorMax] - m_sensordata [LS_SensorMin]; |
289 | int dy = m_sensordata [LS_LightMax] - m_sensordata [LS_LightMin]; | 291 | int dy = m_sensordata [LS_LightMax] - m_sensordata [LS_LightMin]; |
290 | 292 | ||
291 | int stepno = ( s - m_sensordata [LS_SensorMin] ) * m_sensordata [LS_Steps] / dx; // dx is never 0 | 293 | int stepno = ( s - m_sensordata [LS_SensorMin] ) * m_sensordata [LS_Steps] / dx; // dx is never 0 |
292 | 294 | ||
293 | m_backlight_sensor = m_sensordata [LS_LightMax] - dy * stepno / ( m_sensordata [LS_Steps] - 1 ); | 295 | m_backlight_sensor = m_sensordata [LS_LightMax] - dy * stepno / ( m_sensordata [LS_Steps] - 1 ); |
294 | } | 296 | } |
295 | 297 | ||
296 | //qDebug ( "f(%d) = %d [%d - %d] -> [%d - %d] / %d", s, m_backlight_sensor, m_sensordata [LS_SensorMin], m_sensordata [LS_SensorMax], m_sensordata [LS_LightMin], m_sensordata [LS_LightMax], m_sensordata [LS_Steps] ); | 298 | odebug << "f(" << s << ") = " << m_backlight_sensor << " [" << m_sensordata [LS_SensorMin] |
299 | << " - " << m_sensordata [LS_SensorMax] << " ] -> [" << m_sensordata [LS_LightMin] | ||
300 | << " - " << m_sensordata [LS_LightMax] << "] / " << m_sensordata [LS_Steps] << oendl; | ||
297 | 301 | ||
298 | if ( m_level <= 0 ) | 302 | if ( m_level <= 0 ) |
299 | setBacklightInternal ( -1 ); | 303 | setBacklightInternal ( -1 ); |
300 | } | 304 | } |
301 | 305 | ||
302 | 306 | ||
303 | /** | 307 | /** |
304 | * Like ODevice::setDisplayStatus(), but keep current state in m_lcd_status. | 308 | * Like ODevice::setDisplayStatus(), but keep current state in m_lcd_status. |
305 | */ | 309 | */ |
306 | void OpieScreenSaver::setDisplayState ( bool on ) | 310 | void OpieScreenSaver::setDisplayState ( bool on ) |
307 | { | 311 | { |
308 | if ( m_lcd_status != on ) { | 312 | if ( m_lcd_status != on ) { |
309 | ODevice::inst ( ) -> setDisplayStatus ( on ); | 313 | ODevice::inst ( ) -> setDisplayStatus ( on ); |
310 | m_lcd_status = on; | 314 | m_lcd_status = on; |
311 | } | 315 | } |
312 | } | 316 | } |
313 | 317 | ||
314 | 318 | ||
315 | /** | 319 | /** |
316 | * Set display to default ac/battery settings when power status changed. | 320 | * Set display to default ac/battery settings when power status changed. |
317 | */ | 321 | */ |
318 | void OpieScreenSaver::powerStatusChanged ( PowerStatus ps ) | 322 | void OpieScreenSaver::powerStatusChanged ( PowerStatus ps ) |
319 | { | 323 | { |
320 | bool newonac = ( ps. acStatus ( ) == PowerStatus::Online ); | 324 | bool newonac = ( ps. acStatus ( ) == PowerStatus::Online ); |
321 | 325 | ||
322 | if ( newonac != m_on_ac ) { | 326 | if ( newonac != m_on_ac ) { |
323 | m_on_ac = newonac; | 327 | m_on_ac = newonac; |
324 | setInterval ( -1 ); | 328 | setInterval ( -1 ); |
325 | setBacklight ( -1 ); | 329 | setBacklight ( -1 ); |
326 | restore ( ); | 330 | restore ( ); |
327 | } | 331 | } |
328 | } | 332 | } |
diff --git a/core/launcher/server.cpp b/core/launcher/server.cpp index b9fa1e5..950032d 100644 --- a/core/launcher/server.cpp +++ b/core/launcher/server.cpp | |||
@@ -381,98 +381,98 @@ void Server::systemMsg(const QCString &msg, const QByteArray &data) | |||
381 | * to start with 1. We're at 0.9 | 381 | * to start with 1. We're at 0.9 |
382 | * so wee need to fake at least 1.4 to be able | 382 | * so wee need to fake at least 1.4 to be able |
383 | * to sync with QtopiaDesktop1.6 | 383 | * to sync with QtopiaDesktop1.6 |
384 | */ | 384 | */ |
385 | else if ( msg == "sendVersionInfo()" ) { | 385 | else if ( msg == "sendVersionInfo()" ) { |
386 | QCopEnvelope e( "QPE/Desktop", "versionInfo(QString,QString)" ); | 386 | QCopEnvelope e( "QPE/Desktop", "versionInfo(QString,QString)" ); |
387 | /* ### FIXME Architecture ### */ | 387 | /* ### FIXME Architecture ### */ |
388 | e << QString::fromLatin1("1.7") << "Uncustomized Device"; | 388 | e << QString::fromLatin1("1.7") << "Uncustomized Device"; |
389 | } else if ( msg == "sendCardInfo()" ) { | 389 | } else if ( msg == "sendCardInfo()" ) { |
390 | #ifndef QT_NO_COP | 390 | #ifndef QT_NO_COP |
391 | QCopEnvelope e( "QPE/Desktop", "cardInfo(QString)" ); | 391 | QCopEnvelope e( "QPE/Desktop", "cardInfo(QString)" ); |
392 | #endif | 392 | #endif |
393 | storage->update(); | 393 | storage->update(); |
394 | const QList<FileSystem> &fs = storage->fileSystems(); | 394 | const QList<FileSystem> &fs = storage->fileSystems(); |
395 | QListIterator<FileSystem> it ( fs ); | 395 | QListIterator<FileSystem> it ( fs ); |
396 | QString s; | 396 | QString s; |
397 | QString homeDir = getenv("HOME"); | 397 | QString homeDir = getenv("HOME"); |
398 | QString homeFs, homeFsPath; | 398 | QString homeFs, homeFsPath; |
399 | for ( ; it.current(); ++it ) { | 399 | for ( ; it.current(); ++it ) { |
400 | int k4 = (*it)->blockSize()/256; | 400 | int k4 = (*it)->blockSize()/256; |
401 | if ( (*it)->isRemovable() ) { | 401 | if ( (*it)->isRemovable() ) { |
402 | s += (*it)->name() + "=" + (*it)->path() + "/Documents " // No tr | 402 | s += (*it)->name() + "=" + (*it)->path() + "/Documents " // No tr |
403 | + QString::number( (*it)->availBlocks() * k4/4 ) | 403 | + QString::number( (*it)->availBlocks() * k4/4 ) |
404 | + "K " + (*it)->options() + ";"; | 404 | + "K " + (*it)->options() + ";"; |
405 | } else if ( homeDir.contains( (*it)->path() ) && | 405 | } else if ( homeDir.contains( (*it)->path() ) && |
406 | (*it)->path().length() > homeFsPath.length() ) { | 406 | (*it)->path().length() > homeFsPath.length() ) { |
407 | homeFsPath = (*it)->path(); | 407 | homeFsPath = (*it)->path(); |
408 | homeFs = | 408 | homeFs = |
409 | (*it)->name() + "=" + homeDir + "/Documents " // No tr | 409 | (*it)->name() + "=" + homeDir + "/Documents " // No tr |
410 | + QString::number( (*it)->availBlocks() * k4/4 ) | 410 | + QString::number( (*it)->availBlocks() * k4/4 ) |
411 | + "K " + (*it)->options() + ";"; | 411 | + "K " + (*it)->options() + ";"; |
412 | } | 412 | } |
413 | } | 413 | } |
414 | if ( !homeFs.isEmpty() ) | 414 | if ( !homeFs.isEmpty() ) |
415 | s += homeFs; | 415 | s += homeFs; |
416 | 416 | ||
417 | #ifndef QT_NO_COP | 417 | #ifndef QT_NO_COP |
418 | e << s; | 418 | e << s; |
419 | #endif | 419 | #endif |
420 | } else if ( msg == "sendSyncDate(QString)" ) { | 420 | } else if ( msg == "sendSyncDate(QString)" ) { |
421 | QString app; | 421 | QString app; |
422 | stream >> app; | 422 | stream >> app; |
423 | Config cfg( "qpe" ); | 423 | Config cfg( "qpe" ); |
424 | cfg.setGroup("SyncDate"); | 424 | cfg.setGroup("SyncDate"); |
425 | #ifndef QT_NO_COP | 425 | #ifndef QT_NO_COP |
426 | QCopEnvelope e( "QPE/Desktop", "syncDate(QString,QString)" ); | 426 | QCopEnvelope e( "QPE/Desktop", "syncDate(QString,QString)" ); |
427 | e << app << cfg.readEntry( app ); | 427 | e << app << cfg.readEntry( app ); |
428 | #endif | 428 | #endif |
429 | //qDebug("QPE/System sendSyncDate for %s: response %s", app.latin1(), | 429 | //odebug << "QPE/System sendSyncDate for " << app.latin1() << ": response " |
430 | //cfg.readEntry( app ).latin1() ); | 430 | // << cfg.readEntry( app ).latin1() << oendl; |
431 | } else if ( msg == "setSyncDate(QString,QString)" ) { | 431 | } else if ( msg == "setSyncDate(QString,QString)" ) { |
432 | QString app, date; | 432 | QString app, date; |
433 | stream >> app >> date; | 433 | stream >> app >> date; |
434 | Config cfg( "qpe" ); | 434 | Config cfg( "qpe" ); |
435 | cfg.setGroup("SyncDate"); | 435 | cfg.setGroup("SyncDate"); |
436 | cfg.writeEntry( app, date ); | 436 | cfg.writeEntry( app, date ); |
437 | //odebug << "setSyncDate(QString,QString) " << app << " " << date << "" << oendl; | 437 | //odebug << "setSyncDate(QString,QString) " << app << " " << date << "" << oendl; |
438 | } else if ( msg == "startSync(QString)" ) { | 438 | } else if ( msg == "startSync(QString)" ) { |
439 | QString what; | 439 | QString what; |
440 | stream >> what; | 440 | stream >> what; |
441 | delete syncDialog; | 441 | delete syncDialog; |
442 | syncDialog = new SyncDialog( this, what ); | 442 | syncDialog = new SyncDialog( this, what ); |
443 | syncDialog->show(); | 443 | syncDialog->show(); |
444 | connect( syncDialog, SIGNAL(cancel()), SLOT(cancelSync()) ); | 444 | connect( syncDialog, SIGNAL(cancel()), SLOT(cancelSync()) ); |
445 | } else if ( msg == "stopSync()") { | 445 | } else if ( msg == "stopSync()") { |
446 | delete syncDialog; | 446 | delete syncDialog; |
447 | syncDialog = 0; | 447 | syncDialog = 0; |
448 | } else if (msg == "restoreDone(QString)") { | 448 | } else if (msg == "restoreDone(QString)") { |
449 | docList->restoreDone(); | 449 | docList->restoreDone(); |
450 | } else if ( msg == "getAllDocLinks()" ) { | 450 | } else if ( msg == "getAllDocLinks()" ) { |
451 | docList->sendAllDocLinks(); | 451 | docList->sendAllDocLinks(); |
452 | } | 452 | } |
453 | #ifdef Q_WS_QWS | 453 | #ifdef Q_WS_QWS |
454 | else if ( msg == "setMouseProto(QString)" ) { | 454 | else if ( msg == "setMouseProto(QString)" ) { |
455 | QString mice; | 455 | QString mice; |
456 | stream >> mice; | 456 | stream >> mice; |
457 | setenv("QWS_MOUSE_PROTO",mice.latin1(),1); | 457 | setenv("QWS_MOUSE_PROTO",mice.latin1(),1); |
458 | qwsServer->openMouse(); | 458 | qwsServer->openMouse(); |
459 | } else if ( msg == "setKeyboard(QString)" ) { | 459 | } else if ( msg == "setKeyboard(QString)" ) { |
460 | QString kb; | 460 | QString kb; |
461 | stream >> kb; | 461 | stream >> kb; |
462 | setenv("QWS_KEYBOARD",kb.latin1(),1); | 462 | setenv("QWS_KEYBOARD",kb.latin1(),1); |
463 | qwsServer->openKeyboard(); | 463 | qwsServer->openKeyboard(); |
464 | 464 | ||
465 | } else if ( msg == "setKeyboardAutoRepeat(int,int)" ) { | 465 | } else if ( msg == "setKeyboardAutoRepeat(int,int)" ) { |
466 | int delay, period; | 466 | int delay, period; |
467 | stream >> delay >> period; | 467 | stream >> delay >> period; |
468 | qwsSetKeyboardAutoRepeat( delay, period ); | 468 | qwsSetKeyboardAutoRepeat( delay, period ); |
469 | Config cfg( "qpe" ); | 469 | Config cfg( "qpe" ); |
470 | cfg.setGroup("Keyboard"); | 470 | cfg.setGroup("Keyboard"); |
471 | cfg.writeEntry( "RepeatDelay", delay ); | 471 | cfg.writeEntry( "RepeatDelay", delay ); |
472 | cfg.writeEntry( "RepeatPeriod", period ); | 472 | cfg.writeEntry( "RepeatPeriod", period ); |
473 | } else if ( msg == "setKeyboardLayout(QString)" ) { | 473 | } else if ( msg == "setKeyboardLayout(QString)" ) { |
474 | QString kb; | 474 | QString kb; |
475 | stream >> kb; | 475 | stream >> kb; |
476 | setKeyboardLayout( kb ); | 476 | setKeyboardLayout( kb ); |
477 | Config cfg( "qpe" ); | 477 | Config cfg( "qpe" ); |
478 | cfg.setGroup("Keyboard"); | 478 | cfg.setGroup("Keyboard"); |
diff --git a/core/launcher/transferserver.cpp b/core/launcher/transferserver.cpp index 4b764e3..c3f936e 100644 --- a/core/launcher/transferserver.cpp +++ b/core/launcher/transferserver.cpp | |||
@@ -736,98 +736,97 @@ void ServerPI::process( const QString& message ) | |||
736 | else if ( cmd == "NLST" ) { | 736 | else if ( cmd == "NLST" ) { |
737 | send( "502 Command not implemented" ); // No tr | 737 | send( "502 Command not implemented" ); // No tr |
738 | } | 738 | } |
739 | 739 | ||
740 | // site parameters (SITE) | 740 | // site parameters (SITE) |
741 | else if ( cmd == "SITE" ) { | 741 | else if ( cmd == "SITE" ) { |
742 | send( "502 Command not implemented" ); // No tr | 742 | send( "502 Command not implemented" ); // No tr |
743 | } | 743 | } |
744 | 744 | ||
745 | // system (SYST) | 745 | // system (SYST) |
746 | else if ( cmd == "SYST" ) { | 746 | else if ( cmd == "SYST" ) { |
747 | send( "215 UNIX Type: L8" ); // No tr | 747 | send( "215 UNIX Type: L8" ); // No tr |
748 | } | 748 | } |
749 | 749 | ||
750 | // status (STAT) | 750 | // status (STAT) |
751 | else if ( cmd == "STAT" ) { | 751 | else if ( cmd == "STAT" ) { |
752 | send( "502 Command not implemented" ); // No tr | 752 | send( "502 Command not implemented" ); // No tr |
753 | } | 753 | } |
754 | 754 | ||
755 | // help (HELP ) | 755 | // help (HELP ) |
756 | else if ( cmd == "HELP" ) { | 756 | else if ( cmd == "HELP" ) { |
757 | send( "502 Command not implemented" ); // No tr | 757 | send( "502 Command not implemented" ); // No tr |
758 | } | 758 | } |
759 | 759 | ||
760 | // noop (NOOP) | 760 | // noop (NOOP) |
761 | else if ( cmd == "NOOP" ) { | 761 | else if ( cmd == "NOOP" ) { |
762 | send( "200 Command okay" ); // No tr | 762 | send( "200 Command okay" ); // No tr |
763 | } | 763 | } |
764 | 764 | ||
765 | // not implemented | 765 | // not implemented |
766 | else | 766 | else |
767 | send( "502 Command not implemented" ); // No tr | 767 | send( "502 Command not implemented" ); // No tr |
768 | 768 | ||
769 | lastCommand = cmd; | 769 | lastCommand = cmd; |
770 | } | 770 | } |
771 | 771 | ||
772 | bool ServerPI::backupRestoreGzip( const QString &file ) | 772 | bool ServerPI::backupRestoreGzip( const QString &file ) |
773 | { | 773 | { |
774 | return (file.find( "backup" ) != -1 && // No tr | 774 | return (file.find( "backup" ) != -1 && // No tr |
775 | file.findRev( ".tgz" ) == (int)file.length()-4 ); | 775 | file.findRev( ".tgz" ) == (int)file.length()-4 ); |
776 | } | 776 | } |
777 | 777 | ||
778 | bool ServerPI::backupRestoreGzip( const QString &file, QStringList &targets ) | 778 | bool ServerPI::backupRestoreGzip( const QString &file, QStringList &targets ) |
779 | { | 779 | { |
780 | if ( file.find( "backup" ) != -1 && // No tr | 780 | if ( file.find( "backup" ) != -1 && // No tr |
781 | file.findRev( ".tgz" ) == (int)file.length()-4 ) { | 781 | file.findRev( ".tgz" ) == (int)file.length()-4 ) { |
782 | QFileInfo info( file ); | 782 | QFileInfo info( file ); |
783 | targets = info.dirPath( TRUE ); | 783 | targets = info.dirPath( TRUE ); |
784 | qDebug("ServerPI::backupRestoreGzip for %s = %s", file.latin1(), | 784 | odebug << "ServerPI::backupRestoreGzip for " << file.latin1() << " = " << targets.join(" ").latin1() << oendl; |
785 | targets.join(" ").latin1() ); | ||
786 | return true; | 785 | return true; |
787 | } | 786 | } |
788 | return false; | 787 | return false; |
789 | } | 788 | } |
790 | 789 | ||
791 | void ServerPI::sendFile( const QString& file ) | 790 | void ServerPI::sendFile( const QString& file ) |
792 | { | 791 | { |
793 | if ( passiv ) { | 792 | if ( passiv ) { |
794 | wait[SendFile] = TRUE; | 793 | wait[SendFile] = TRUE; |
795 | waitfile = file; | 794 | waitfile = file; |
796 | if ( waitsocket ) | 795 | if ( waitsocket ) |
797 | newConnection( waitsocket ); | 796 | newConnection( waitsocket ); |
798 | } | 797 | } |
799 | else { | 798 | else { |
800 | QStringList targets; | 799 | QStringList targets; |
801 | if ( backupRestoreGzip( file, targets ) ) | 800 | if ( backupRestoreGzip( file, targets ) ) |
802 | dtp->sendGzipFile( file, targets, peeraddress, peerport ); | 801 | dtp->sendGzipFile( file, targets, peeraddress, peerport ); |
803 | else dtp->sendFile( file, peeraddress, peerport ); | 802 | else dtp->sendFile( file, peeraddress, peerport ); |
804 | } | 803 | } |
805 | } | 804 | } |
806 | 805 | ||
807 | void ServerPI::retrieveFile( const QString& file ) | 806 | void ServerPI::retrieveFile( const QString& file ) |
808 | { | 807 | { |
809 | if ( passiv ) { | 808 | if ( passiv ) { |
810 | wait[RetrieveFile] = TRUE; | 809 | wait[RetrieveFile] = TRUE; |
811 | waitfile = file; | 810 | waitfile = file; |
812 | if ( waitsocket ) | 811 | if ( waitsocket ) |
813 | newConnection( waitsocket ); | 812 | newConnection( waitsocket ); |
814 | } | 813 | } |
815 | else { | 814 | else { |
816 | QStringList targets; | 815 | QStringList targets; |
817 | if ( backupRestoreGzip( file, targets ) ) | 816 | if ( backupRestoreGzip( file, targets ) ) |
818 | dtp->retrieveGzipFile( file, peeraddress, peerport ); | 817 | dtp->retrieveGzipFile( file, peeraddress, peerport ); |
819 | else | 818 | else |
820 | dtp->retrieveFile( file, peeraddress, peerport, storFileSize ); | 819 | dtp->retrieveFile( file, peeraddress, peerport, storFileSize ); |
821 | } | 820 | } |
822 | } | 821 | } |
823 | 822 | ||
824 | bool ServerPI::parsePort( const QString& pp ) | 823 | bool ServerPI::parsePort( const QString& pp ) |
825 | { | 824 | { |
826 | QStringList p = QStringList::split( ",", pp ); | 825 | QStringList p = QStringList::split( ",", pp ); |
827 | if ( p.count() != 6 ) return FALSE; | 826 | if ( p.count() != 6 ) return FALSE; |
828 | 827 | ||
829 | // h1,h2,h3,h4,p1,p2 | 828 | // h1,h2,h3,h4,p1,p2 |
830 | peeraddress = QHostAddress( ( p[0].toInt() << 24 ) + ( p[1].toInt() << 16 ) + | 829 | peeraddress = QHostAddress( ( p[0].toInt() << 24 ) + ( p[1].toInt() << 16 ) + |
831 | ( p[2].toInt() << 8 ) + p[3].toInt() ); | 830 | ( p[2].toInt() << 8 ) + p[3].toInt() ); |
832 | peerport = ( p[4].toInt() << 8 ) + p[5].toInt(); | 831 | peerport = ( p[4].toInt() << 8 ) + p[5].toInt(); |
833 | return TRUE; | 832 | return TRUE; |