summaryrefslogtreecommitdiff
authorar <ar>2004-05-02 17:11:49 (UTC)
committer ar <ar>2004-05-02 17:11:49 (UTC)
commit18759e9156c96795831120408a9da0d3b4ec71a4 (patch) (side-by-side diff)
treebfc1a5560340b77a1918855e9915d133898ec189
parent4d3379027557e251201b531896974a69ae4c665a (diff)
downloadopie-18759e9156c96795831120408a9da0d3b4ec71a4.zip
opie-18759e9156c96795831120408a9da0d3b4ec71a4.tar.gz
opie-18759e9156c96795831120408a9da0d3b4ec71a4.tar.bz2
- convert qDebug to odebug
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/qws/qcopbridge.cpp18
-rw-r--r--core/qws/transferserver.cpp82
2 files changed, 54 insertions, 46 deletions
diff --git a/core/qws/qcopbridge.cpp b/core/qws/qcopbridge.cpp
index 4fd0807..822efb7 100644
--- a/core/qws/qcopbridge.cpp
+++ b/core/qws/qcopbridge.cpp
@@ -21,15 +21,19 @@
#include "qcopbridge.h"
#include "transferserver.h"
+/* OPIE */
#include <qpe/qcopenvelope_qws.h>
#include <qpe/qpeapplication.h>
#include <qpe/version.h>
+#include <opie2/odebug.h>
+/* QT */
#include <qtextstream.h>
#ifdef QWS
#include <qcopchannel_qws.h>
#endif
+/* STD */
#define _XOPEN_SOURCE
#include <pwd.h>
#include <sys/types.h>
@@ -50,7 +54,7 @@ QCopBridge::QCopBridge( Q_UINT16 port, QObject *parent ,
cardChannel( 0 )
{
if ( !ok() )
- qWarning( "Failed to bind to port %d", port );
+ owarn << "Failed to bind to port " << port << "" << oendl;
else {
#ifndef QT_NO_COP
desktopChannel = new QCopChannel( "QPE/Desktop", this );
@@ -110,13 +114,13 @@ void QCopBridge::desktopMessage( const QCString &command, const QByteArray &args
int paren = command.find( "(" );
if ( paren <= 0 ) {
- qDebug("DesktopMessage: bad qcop syntax");
+ odebug << "DesktopMessage: bad qcop syntax" << oendl;
return;
}
QString params = command.mid( paren + 1 );
if ( params[params.length()-1] != ')' ) {
- qDebug("DesktopMessage: bad qcop syntax");
+ odebug << "DesktopMessage: bad qcop syntax" << oendl;
return;
}
@@ -143,7 +147,7 @@ void QCopBridge::desktopMessage( const QCString &command, const QByteArray &args
stream >> i;
str = QString::number( i );
} else {
- qDebug(" cannot route the argument type %s throught the qcop bridge", (*it).latin1() );
+ odebug << " cannot route the argument type " << (*it) << " throught the qcop bridge" << oendl;
return;
}
QString estr;
@@ -235,7 +239,7 @@ QCopBridgePI::~QCopBridgePI()
void QCopBridgePI::connectionClosed()
{
emit connectionClosed( this );
- // qDebug( "Debug: Connection closed" );
+ // odebug << "Debug: Connection closed" << oendl;
delete this;
}
@@ -250,7 +254,7 @@ void QCopBridgePI::send( const QString& msg )
{
QTextStream os( this );
os << msg << endl;
- //qDebug( "sending qcop message: %s", msg.latin1() );
+ //odebug << "sending qcop message: " << msg << "" << oendl;
}
void QCopBridgePI::read()
@@ -261,7 +265,7 @@ void QCopBridgePI::read()
void QCopBridgePI::process( const QString& message )
{
- //qDebug( "Command: %s", message.latin1() );
+ //odebug << "Command: " << message << "" << oendl;
// split message using "," as separator
QStringList msg = QStringList::split( " ", message );
diff --git a/core/qws/transferserver.cpp b/core/qws/transferserver.cpp
index d0fec89..777c384 100644
--- a/core/qws/transferserver.cpp
+++ b/core/qws/transferserver.cpp
@@ -17,6 +17,10 @@
** not clear to you.
**
**********************************************************************/
+
+/* OPIE */
+#include <opie2/odebug.h>
+
#define _XOPEN_SOURCE
#include <pwd.h>
#include <sys/types.h>
@@ -74,7 +78,7 @@ TransferServer::TransferServer( Q_UINT16 port, QObject *parent ,
: QServerSocket( port, 1, parent, name )
{
if ( !ok() )
- qWarning( "Failed to bind to port %d", port );
+ owarn << "Failed to bind to port " << port << "" << oendl;
}
TransferServer::~TransferServer()
@@ -317,7 +321,7 @@ ServerPI::~ServerPI()
void ServerPI::connectionClosed()
{
- // qDebug( "Debug: Connection closed" );
+ // odebug << "Debug: Connection closed" << oendl;
delete this;
}
@@ -325,7 +329,7 @@ void ServerPI::send( const QString& msg )
{
QTextStream os( this );
os << msg << endl;
- //qDebug( "Reply: %s", msg.latin1() );
+ //odebug << "Reply: " << msg << "" << oendl;
}
void ServerPI::read()
@@ -366,7 +370,7 @@ bool ServerPI::checkWriteFile( const QString& file )
void ServerPI::process( const QString& message )
{
- //qDebug( "Command: %s", message.latin1() );
+ //odebug << "Command: " << message << "" << oendl;
// split message using "," as separator
QStringList msg = QStringList::split( " ", message );
@@ -391,7 +395,7 @@ void ServerPI::process( const QString& message )
args = copy.join( " " );
}
- //qDebug( "args: %s", args.latin1() );
+ //odebug << "args: " << args << "" << oendl;
// we always respond to QUIT, regardless of state
if ( cmd == "QUIT" ) {
@@ -527,7 +531,7 @@ void ServerPI::process( const QString& message )
sendFile( absFilePath( args ) );
}
else {
- qDebug("550 Requested action not taken");
+ odebug << "550 Requested action not taken" << oendl;
send( "550 Requested action not taken" );
}
@@ -633,7 +637,7 @@ void ServerPI::process( const QString& message )
// make directory (MKD)
else if ( cmd == "MKD" ) {
if ( args.isEmpty() ) {
- qDebug(" Error: no arg");
+ odebug << " Error: no arg" << oendl;
send( "500 Syntax error, command unrecognized" );
}
else {
@@ -673,7 +677,7 @@ void ServerPI::process( const QString& message )
duproc.addArgument("-s");
QString in, out;
if ( !duproc.exec(in, out) ) {
- qDebug("du process failed; just sending back 1K");
+ odebug << "du process failed; just sending back 1K" << oendl;
send( "213 1024");
}
else {
@@ -681,7 +685,7 @@ void ServerPI::process( const QString& message )
int guess = size.toInt() / 5;
if ( filePath.contains("doc") )
guess *= 1000;
- qDebug("sending back gzip guess of %d", guess);
+ odebug << "sending back gzip guess of " << guess << "" << oendl;
send( "213 " + QString::number(guess) );
}
}
@@ -736,8 +740,8 @@ bool ServerPI::backupRestoreGzip( const QString &file, QStringList &targets )
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;
@@ -984,7 +988,7 @@ QString ServerPI::permissionString( QFileInfo *info )
void ServerPI::newConnection( int socket )
{
- //qDebug( "New incomming connection" );
+ //odebug << "New incomming connection" << oendl;
if ( !passiv )
return ;
@@ -998,7 +1002,7 @@ void ServerPI::newConnection( int socket )
dtp->setSocket( socket );
}
else if ( wait[RetrieveFile] ) {
- qDebug("check retrieve file");
+ odebug << "check retrieve file" << oendl;
if ( backupRestoreGzip( waitfile ) )
dtp->retrieveGzipFile( waitfile );
else
@@ -1010,7 +1014,7 @@ void ServerPI::newConnection( int socket )
dtp->setSocket( socket );
}
else if ( wait[RetrieveByteArray] ) {
- qDebug("retrieve byte array");
+ odebug << "retrieve byte array" << oendl;
dtp->retrieveByteArray();
dtp->setSocket( socket );
}
@@ -1075,7 +1079,7 @@ ServerDTP::~ServerDTP()
void ServerDTP::extractTarDone()
{
- qDebug("extract done");
+ odebug << "extract done" << oendl;
#ifndef QT_NO_COP
QCopEnvelope e( "QPE/Desktop", "restoreDone(QString)" );
@@ -1094,7 +1098,7 @@ void ServerDTP::connected()
return ;
}
- //qDebug( "Debug: Sending file '%s'", file.name().latin1() );
+ //odebug << "Debug: Sending file '" << file.name() << "'" << oendl;
bytes_written = 0;
if ( file.size() == 0 ) {
@@ -1116,12 +1120,12 @@ void ServerDTP::connected()
case SendGzipFile:
if ( createTargzProc->isRunning() ) {
// SHOULDN'T GET HERE, BUT DOING A SAFETY CHECK ANYWAY
- qWarning("Previous tar --gzip process is still running; killing it...");
+ owarn << "Previous tar --gzip process is still running; killing it..." << oendl;
createTargzProc->kill();
}
bytes_written = 0;
- qDebug("==>start send tar process");
+ odebug << "==>start send tar process" << oendl;
if ( !createTargzProc->start(Opie::Core::OProcess::NotifyOnExit, Opie::Core::OProcess::Stdout) )
qWarning("Error starting %s or %s",
createTargzProc->args()[0].data(),
@@ -1134,7 +1138,7 @@ void ServerDTP::connected()
return ;
}
- // qDebug( "Debug: Sending byte array" );
+ // odebug << "Debug: Sending byte array" << oendl;
bytes_written = 0;
while ( !buf.atEnd() )
putch( buf.getch() );
@@ -1153,10 +1157,10 @@ void ServerDTP::connected()
mode = Idle;
return ;
}
- // qDebug( "Debug: Retrieving file %s", file.name().latin1() );
+ // odebug << "Debug: Retrieving file " << file.name() << "" << oendl;
break;
case RetrieveGzipFile:
- qDebug("=-> starting tar process to receive .tgz file");
+ odebug << "=-> starting tar process to receive .tgz file" << oendl;
break;
case RetrieveBuffer:
// retrieve buffer mode
@@ -1165,17 +1169,17 @@ void ServerDTP::connected()
mode = Idle;
return ;
}
- // qDebug( "Debug: Retrieving byte array" );
+ // odebug << "Debug: Retrieving byte array" << oendl;
break;
case Idle:
- qDebug("connection established but mode set to Idle; BUG!");
+ odebug << "connection established but mode set to Idle; BUG!" << oendl;
break;
}
}
void ServerDTP::connectionClosed()
{
- //qDebug( "Debug: Data connection closed %ld bytes written", bytes_written );
+ //odebug << "Debug: Data connection closed " << bytes_written << " bytes written" << oendl;
// send file mode
if ( SendFile == mode ) {
@@ -1200,7 +1204,7 @@ void ServerDTP::connectionClosed()
}
else if ( RetrieveGzipFile == mode ) {
- qDebug("Done writing ungzip file; closing input");
+ odebug << "Done writing ungzip file; closing input" << oendl;
gzipProc->flushStdin();
gzipProc->closeStdin();
}
@@ -1222,7 +1226,7 @@ void ServerDTP::bytesWritten( int bytes )
if ( SendFile == mode ) {
if ( bytes_written == file.size() ) {
- // qDebug( "Debug: Sending complete: %d bytes", file.size() );
+ // odebug << "Debug: Sending complete: " << file.size() << " bytes" << oendl;
file.close();
emit completed();
mode = Idle;
@@ -1239,7 +1243,7 @@ void ServerDTP::bytesWritten( int bytes )
if ( SendBuffer == mode ) {
if ( bytes_written == buf.size() ) {
- // qDebug( "Debug: Sending complete: %d bytes", buf.size() );
+ // odebug << "Debug: Sending complete: " << buf.size() << " bytes" << oendl;
emit completed();
mode = Idle;
}
@@ -1263,7 +1267,7 @@ void ServerDTP::readyRead()
s.resize( bytesAvailable() );
readBlock( s.data(), bytesAvailable() );
gzipProc->writeStdin( s.data(), s.size() );
- qDebug("wrote %d bytes to ungzip ", s.size() );
+ odebug << "wrote " << s.size() << " bytes to ungzip " << oendl;
}
// retrieve buffer mode
else if ( RetrieveBuffer == mode ) {
@@ -1277,9 +1281,9 @@ void ServerDTP::readyRead()
void ServerDTP::writeTargzBlock(Opie::Core::OProcess *, char *buffer, int buflen)
{
writeBlock( buffer, buflen );
- qDebug("writeTargzBlock %d", buflen);
+ odebug << "writeTargzBlock " << buflen << "" << oendl;
if ( !createTargzProc->isRunning() ) {
- qDebug("tar and gzip done");
+ odebug << "tar and gzip done" << oendl;
emit completed();
mode = Idle;
disconnect( gzipProc, SIGNAL( receivedStdout(Opie::Core::OProcess*,char*,int) ),
@@ -1289,7 +1293,7 @@ void ServerDTP::writeTargzBlock(Opie::Core::OProcess *, char *buffer, int buflen
void ServerDTP::targzDone()
{
- //qDebug("targz done");
+ //odebug << "targz done" << oendl;
disconnect( createTargzProc, SIGNAL( receivedStdout(Opie::Core::OProcess*,char*,int) ),
this, SLOT( gzipTarBlock(Opie::Core::OProcess*,char*,int) ) );
gzipProc->closeStdin();
@@ -1297,9 +1301,9 @@ void ServerDTP::targzDone()
void ServerDTP::gzipTarBlock(Opie::Core::OProcess *, char *buffer, int buflen)
{
- //qDebug("gzipTarBlock");
+ //odebug << "gzipTarBlock" << oendl;
if ( !gzipProc->isRunning() ) {
- //qDebug("auto start gzip proc");
+ //odebug << "auto start gzip proc" << oendl;
gzipProc->start(Opie::Core::OProcess::NotifyOnExit, (Opie::Core::OProcess::Communication) ( Opie::Core::OProcess::Stdin | Opie::Core::OProcess::Stdout ));
}
gzipProc->writeStdin( buffer, buflen );
@@ -1335,7 +1339,7 @@ void ServerDTP::sendGzipFile( const QString &fn,
QStringList args = "tar";
args += "-cv";
args += archiveTargets;
- qDebug("sendGzipFile %s", args.join(" ").latin1() );
+ odebug << "sendGzipFile " << args.join(" ") << "" << oendl;
createTargzProc->clearArguments( );
*createTargzProc << args;
connect( createTargzProc,
@@ -1349,7 +1353,7 @@ void ServerDTP::sendGzipFile( const QString &fn,
void ServerDTP::gunzipDone()
{
- qDebug("gunzipDone");
+ odebug << "gunzipDone" << oendl;
disconnect( gzipProc, SIGNAL( processExited() ),
this, SLOT( gunzipDone() ) );
retrieveTargzProc->closeStdin();
@@ -1359,11 +1363,11 @@ void ServerDTP::gunzipDone()
void ServerDTP::tarExtractBlock(Opie::Core::OProcess *, char *buffer, int buflen)
{
- qDebug("tarExtractBlock");
+ odebug << "tarExtractBlock" << oendl;
if ( !retrieveTargzProc->isRunning() ) {
- qDebug("auto start ungzip proc");
+ odebug << "auto start ungzip proc" << oendl;
if ( !retrieveTargzProc->start(Opie::Core::OProcess::NotifyOnExit, Opie::Core::OProcess::Stdin) )
- qWarning(" failed to start tar -x process");
+ owarn << " failed to start tar -x process" << oendl;
}
retrieveTargzProc->writeStdin( buffer, buflen );
}
@@ -1384,7 +1388,7 @@ void ServerDTP::retrieveFile( const QString fn )
void ServerDTP::retrieveGzipFile( const QString &fn )
{
- qDebug("retrieveGzipFile %s", fn.latin1());
+ odebug << "retrieveGzipFile " << fn << "" << oendl;
file.setName( fn );
mode = RetrieveGzipFile;