-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 @@ -358,103 +358,103 @@ void DocumentList::DiffAppLnks() odebug << "adding type " << (*ittypes) << "" << oendl; // ### our current launcher expects docs tab to be last d->serverGui->typeAdded( *ittypes, name.isNull() ? (*ittypes) : name, pm, bgPm ); } prevTypeList.remove(*ittypes); } } for ( QStringList::Iterator ittypes=prevTypeList.begin(); ittypes!=prevTypeList.end(); ++ittypes) { odebug << "removing type " << (*ittypes) << "" << oendl; d->serverGui->typeRemoved(*ittypes); } prevTypeList = types; } QListIterator<AppLnk> it1( appLnkSet->children() ); QListIterator<AppLnk> it2( appLnkSet2->children() ); AppLnk *i; AppLnk *j; bool found; while ( (j=it2.current()) ) { it1 = appLnkSet->children(); found = false; while ( (i=it1.current()) ){ if (strcmp(i->name().ascii(),j->name().ascii()) == 0) found = true; ++it1; } if (!found) { - qDebug("Item %s needs to be added",j->name().ascii() ); + odebug << "Item " << j->name().ascii() << " needs to be added" << oendl; d->serverGui->applicationAdded( j->type(), *j ); } ++it2; } it1 = appLnkSet->children(); while ( (i=it1.current()) ) { it2 = appLnkSet2->children(); found = false; while ( (j=it2.current()) ){ if (strcmp(i->name().ascii(),j->name().ascii()) == 0) found = true; ++it2; } if (!found) { - qDebug("Item %s needs to be removed",i->name().ascii() ); + odebug << "Item " << i->name().ascii() << " needs to be removed" << oendl; d->serverGui->applicationRemoved( i->type(), *i ); } ++it1; } delete appLnkSet; appLnkSet = appLnkSet2; } void DocumentList::storageChanged() { QTime t; // ### can implement better t.start(); DiffAppLnks(); // reloadAppLnks(); - qDebug("Reload App links took %i ms",t.elapsed() ); + odebug << "Reload App links took " << t.elapsed() << " ms" << oendl; reloadDocLnks(); // odebug << "Reload links took " << t.elapsed() << " ms " << oendl; - qDebug("Reload All links took %i ms",t.elapsed() ); + odebug << "Reload All links took " << t.elapsed() << " ms" << oendl; // ### Optimization opportunity // Could be a bit more intelligent and somehow work out which // mtab entry has changed and then only scan that and add and remove // links appropriately. // rescan(); } void DocumentList::sendAllDocLinks() { if ( d->tid != 0 ) { // We are in the middle of scanning, set a flag so // we do this when we finish our scanning d->needToSendAllDocLinks = true; return; } QString contents; Categories cats; for ( QListIterator<DocLnk> it( d->dls.children() ); it.current(); ++it ) { DocLnk *doc = it.current(); QFileInfo fi( doc->file() ); if ( !fi.exists() ) continue; bool fake = !doc->linkFileKnown(); if ( !fake ) { QFile f( doc->linkFile() ); if ( f.open( IO_ReadOnly ) ) { QTextStream ts( &f ); ts.setEncoding( QTextStream::UnicodeUTF8 ); contents += ts.read(); f.close(); 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 @@ -1003,72 +1003,72 @@ void QProcess::socketRead( int fd ) d->notifierStdout->setEnabled( FALSE ); delete d->notifierStdout; d->notifierStdout = 0; ::close( d->proc->socketStdout ); d->proc->socketStdout = 0; return; } else if ( fd == d->proc->socketStderr ) { #if defined(QT_QPROCESS_DEBUG) odebug << "QProcess::socketRead(): stderr (" << fd << ") closed" << oendl; #endif d->notifierStderr->setEnabled( FALSE ); delete d->notifierStderr; d->notifierStderr = 0; ::close( d->proc->socketStderr ); d->proc->socketStderr = 0; return; } } // read all data that is available while ( n == bufsize ) { oldSize = buffer->size(); buffer->resize( oldSize + bufsize ); n = ::read( fd, buffer->data()+oldSize, bufsize ); if ( n > 0 ) buffer->resize( oldSize + n ); else buffer->resize( oldSize ); } d->socketReadCalled = TRUE; if ( fd == d->proc->socketStdout ) { #if defined(QT_QPROCESS_DEBUG) - qDebug( "QProcess::socketRead(): %d bytes read from stdout (%d)", - buffer->size()-oldSize, fd ); + odebug << "QProcess::socketRead(): " << buffer->size()-oldSize << "bytes read from stdout (" + << fd << ")" << oendl; #endif emit readyReadStdout(); } else if ( fd == d->proc->socketStderr ) { #if defined(QT_QPROCESS_DEBUG) - qDebug( "QProcess::socketRead(): %d bytes read from stderr (%d)", - buffer->size()-oldSize, fd ); + odebug << "QProcess::socketRead(): " << buffer->size()-oldSize << " bytes read from stderr (" + << fd << ")" << oendl; #endif emit readyReadStderr(); } d->socketReadCalled = FALSE; } /* This private slot is called when the process tries to read data from standard input. */ void QProcess::socketWrite( int fd ) { if ( fd != d->proc->socketStdin || d->proc->socketStdin == 0 ) return; if ( d->stdinBuf.isEmpty() ) { d->notifierStdin->setEnabled( FALSE ); return; } #if defined(QT_QPROCESS_DEBUG) odebug << "QProcess::socketWrite(): write to stdin (" << fd << ")" << oendl; #endif ssize_t ret = ::write( fd, d->stdinBuf.head()->data() + d->stdinBufRead, d->stdinBuf.head()->size() - d->stdinBufRead ); if ( ret > 0 ) d->stdinBufRead += ret; if ( d->stdinBufRead == (ssize_t)d->stdinBuf.head()->size() ) { d->stdinBufRead = 0; delete d->stdinBuf.dequeue(); if ( wroteToStdinConnected && d->stdinBuf.isEmpty() ) emit wroteToStdin(); 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,39 +1,40 @@ #include "screensaver.h" #include <qpe/config.h> #include <qpe/network.h> #include <opie2/odevice.h> +#include <opie2/odebug.h> using namespace Opie::Core; OpieScreenSaver::OpieScreenSaver ( ) : QObject ( 0, "screensaver" ), QWSScreenSaver ( ) { m_disable_suspend = 100; m_enable_dim = false; m_enable_lightoff = false; m_enable_suspend = false; m_onlylcdoff = false; m_enable_dim_ac = false; m_enable_lightoff_ac = false; m_enable_suspend_ac = false; m_onlylcdoff_ac = false; m_use_light_sensor = false; m_backlight_sensor = -1; ::memset ( m_sensordata, 0xff, LS_Count * sizeof( m_sensordata [0] )); m_lcd_status = true; m_backlight_normal = -1; m_backlight_current = -1; m_backlight_forcedoff = false; m_on_ac = false; @@ -181,65 +182,66 @@ void OpieScreenSaver::setIntervals ( int dim, int lightoff, int suspend ) void OpieScreenSaver::setInterval ( int interval ) { setIntervals ( -1, -1, interval ); } void OpieScreenSaver::setMode ( int mode ) { if ( mode > m_disable_suspend ) setInterval ( -1 ); m_disable_suspend = mode; } /** * Set display brightness * * Get's default values for backlight, contrast and light sensor from config file. * * @param bright desired brighness (-1 to use automatic sensor data or value * from config file, -2 to toggle backlight on and off, -3 to * force backlight off) */ void OpieScreenSaver::setBacklight ( int bright ) { // Read from config Config config ( "apm" ); config. setGroup ( m_on_ac ? "AC" : "Battery" ); m_backlight_normal = config. readNumEntry ( "Brightness", m_on_ac ? 255 : 127 ); int contrast = config. readNumEntry ( "Contrast", 127); m_use_light_sensor = config. readBoolEntry ( "LightSensor", false ); - //qDebug ( "setBacklight: %d (norm: %d) (ls: %d)", bright, m_backlight_normal, m_use_light_sensor ? 1 : 0 ); + //odebug << "setBacklight: " << bright << " (norm: " << m_backlight_normal << ") (ls: " + // << ( m_use_light_sensor ? 1 : 0 ) << ")" << oendl; killTimers ( ); if (( bright < 0 ) && m_use_light_sensor ) { QStringList sl = config. readListEntry ( "LightSensorData", ';' ); m_sensordata [LS_SensorMin] = 40; m_sensordata [LS_SensorMax] = 215; m_sensordata [LS_LightMin] = 1; m_sensordata [LS_LightMax] = 255; m_sensordata [LS_Steps] = 12; m_sensordata [LS_Interval] = 2000; for ( uint i = 0; i < LS_Count; i++ ) { if ( i < sl. count ( )) m_sensordata [i] = sl [i]. toInt ( ); } if ( m_sensordata [LS_Steps] < 2 ) // sanity check to avoid SIGFPE m_sensordata [LS_Steps] = 2; timerEvent ( 0 ); startTimer ( m_sensordata [LS_Interval] ); } setBacklightInternal ( bright ); ODevice::inst ( )-> setDisplayContrast(contrast); } /** * Internal brightness setting method * * Get's default values for backlight and light sensor from config file. @@ -264,65 +266,67 @@ void OpieScreenSaver::setBacklightInternal ( int bright ) } if ( bright == -1 ) bright = m_use_light_sensor ? m_backlight_sensor : m_backlight_normal; if ( bright != m_backlight_current ) { ODevice::inst ( )-> setDisplayBrightness ( bright ); m_backlight_current = bright; } } /** * Timer event used for automatic setting the backlight according to a light sensor * and to set the default brightness */ void OpieScreenSaver::timerEvent ( QTimerEvent * ) { int s = ODevice::inst ( )-> readLightSensor ( ) * 256 / ODevice::inst ( )-> lightSensorResolution ( ); if ( s < m_sensordata [LS_SensorMin] ) m_backlight_sensor = m_sensordata [LS_LightMax]; else if ( s >= m_sensordata [LS_SensorMax] ) m_backlight_sensor = m_sensordata [LS_LightMin]; else { int dx = m_sensordata [LS_SensorMax] - m_sensordata [LS_SensorMin]; int dy = m_sensordata [LS_LightMax] - m_sensordata [LS_LightMin]; int stepno = ( s - m_sensordata [LS_SensorMin] ) * m_sensordata [LS_Steps] / dx; // dx is never 0 m_backlight_sensor = m_sensordata [LS_LightMax] - dy * stepno / ( m_sensordata [LS_Steps] - 1 ); } - //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] ); + odebug << "f(" << s << ") = " << m_backlight_sensor << " [" << m_sensordata [LS_SensorMin] + << " - " << m_sensordata [LS_SensorMax] << " ] -> [" << m_sensordata [LS_LightMin] + << " - " << m_sensordata [LS_LightMax] << "] / " << m_sensordata [LS_Steps] << oendl; if ( m_level <= 0 ) setBacklightInternal ( -1 ); } /** * Like ODevice::setDisplayStatus(), but keep current state in m_lcd_status. */ void OpieScreenSaver::setDisplayState ( bool on ) { if ( m_lcd_status != on ) { ODevice::inst ( ) -> setDisplayStatus ( on ); m_lcd_status = on; } } /** * Set display to default ac/battery settings when power status changed. */ void OpieScreenSaver::powerStatusChanged ( PowerStatus ps ) { bool newonac = ( ps. acStatus ( ) == PowerStatus::Online ); if ( newonac != m_on_ac ) { m_on_ac = newonac; setInterval ( -1 ); setBacklight ( -1 ); restore ( ); } } 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 @@ -397,66 +397,66 @@ void Server::systemMsg(const QCString &msg, const QByteArray &data) QString homeDir = getenv("HOME"); QString homeFs, homeFsPath; for ( ; it.current(); ++it ) { int k4 = (*it)->blockSize()/256; if ( (*it)->isRemovable() ) { s += (*it)->name() + "=" + (*it)->path() + "/Documents " // No tr + QString::number( (*it)->availBlocks() * k4/4 ) + "K " + (*it)->options() + ";"; } else if ( homeDir.contains( (*it)->path() ) && (*it)->path().length() > homeFsPath.length() ) { homeFsPath = (*it)->path(); homeFs = (*it)->name() + "=" + homeDir + "/Documents " // No tr + QString::number( (*it)->availBlocks() * k4/4 ) + "K " + (*it)->options() + ";"; } } if ( !homeFs.isEmpty() ) s += homeFs; #ifndef QT_NO_COP e << s; #endif } else if ( msg == "sendSyncDate(QString)" ) { QString app; stream >> app; Config cfg( "qpe" ); cfg.setGroup("SyncDate"); #ifndef QT_NO_COP QCopEnvelope e( "QPE/Desktop", "syncDate(QString,QString)" ); e << app << cfg.readEntry( app ); #endif - //qDebug("QPE/System sendSyncDate for %s: response %s", app.latin1(), - //cfg.readEntry( app ).latin1() ); + //odebug << "QPE/System sendSyncDate for " << app.latin1() << ": response " + // << cfg.readEntry( app ).latin1() << oendl; } else if ( msg == "setSyncDate(QString,QString)" ) { QString app, date; stream >> app >> date; Config cfg( "qpe" ); cfg.setGroup("SyncDate"); cfg.writeEntry( app, date ); //odebug << "setSyncDate(QString,QString) " << app << " " << date << "" << oendl; } else if ( msg == "startSync(QString)" ) { QString what; stream >> what; delete syncDialog; syncDialog = new SyncDialog( this, what ); syncDialog->show(); connect( syncDialog, SIGNAL(cancel()), SLOT(cancelSync()) ); } else if ( msg == "stopSync()") { delete syncDialog; syncDialog = 0; } else if (msg == "restoreDone(QString)") { docList->restoreDone(); } else if ( msg == "getAllDocLinks()" ) { docList->sendAllDocLinks(); } #ifdef Q_WS_QWS else if ( msg == "setMouseProto(QString)" ) { QString mice; stream >> mice; setenv("QWS_MOUSE_PROTO",mice.latin1(),1); qwsServer->openMouse(); } else if ( msg == "setKeyboard(QString)" ) { QString kb; stream >> kb; setenv("QWS_KEYBOARD",kb.latin1(),1); 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 @@ -752,66 +752,65 @@ void ServerPI::process( const QString& message ) send( "502 Command not implemented" ); // No tr } // help (HELP ) else if ( cmd == "HELP" ) { send( "502 Command not implemented" ); // No tr } // noop (NOOP) else if ( cmd == "NOOP" ) { send( "200 Command okay" ); // No tr } // not implemented else send( "502 Command not implemented" ); // No tr lastCommand = cmd; } bool ServerPI::backupRestoreGzip( const QString &file ) { return (file.find( "backup" ) != -1 && // No tr file.findRev( ".tgz" ) == (int)file.length()-4 ); } bool ServerPI::backupRestoreGzip( const QString &file, QStringList &targets ) { if ( file.find( "backup" ) != -1 && // No tr file.findRev( ".tgz" ) == (int)file.length()-4 ) { QFileInfo info( file ); targets = info.dirPath( TRUE ); - qDebug("ServerPI::backupRestoreGzip for %s = %s", file.latin1(), - targets.join(" ").latin1() ); + odebug << "ServerPI::backupRestoreGzip for " << file.latin1() << " = " << targets.join(" ").latin1() << oendl; return true; } return false; } void ServerPI::sendFile( const QString& file ) { if ( passiv ) { wait[SendFile] = TRUE; waitfile = file; if ( waitsocket ) newConnection( waitsocket ); } else { QStringList targets; if ( backupRestoreGzip( file, targets ) ) dtp->sendGzipFile( file, targets, peeraddress, peerport ); else dtp->sendFile( file, peeraddress, peerport ); } } void ServerPI::retrieveFile( const QString& file ) { if ( passiv ) { wait[RetrieveFile] = TRUE; waitfile = file; if ( waitsocket ) newConnection( waitsocket ); } else { QStringList targets; if ( backupRestoreGzip( file, targets ) ) |