author | mickeyl <mickeyl> | 2004-04-07 13:36:16 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-04-07 13:36:16 (UTC) |
commit | 4f1d28a25ce6180850c3d26bac9b638f0f25532b (patch) (side-by-side diff) | |
tree | 59b4879b1065086c9a2e28f16f7d48540c8a9456 | |
parent | 8af35b63a277ec14dcc4a0a6ca5bbe228e276b98 (diff) | |
download | opie-4f1d28a25ce6180850c3d26bac9b638f0f25532b.zip opie-4f1d28a25ce6180850c3d26bac9b638f0f25532b.tar.gz opie-4f1d28a25ce6180850c3d26bac9b638f0f25532b.tar.bz2 |
use Opie debugging framework
-rw-r--r-- | core/launcher/applauncher.cpp | 83 | ||||
-rw-r--r-- | core/launcher/documentlist.cpp | 46 | ||||
-rw-r--r-- | core/launcher/firstuse.cpp | 44 | ||||
-rw-r--r-- | core/launcher/inputmethods.cpp | 34 | ||||
-rw-r--r-- | core/launcher/irserver.cpp | 16 | ||||
-rw-r--r-- | core/launcher/launcher.cpp | 37 | ||||
-rw-r--r-- | core/launcher/launcherview.cpp | 9 | ||||
-rw-r--r-- | core/launcher/main.cpp | 42 | ||||
-rw-r--r-- | core/launcher/packageslave.cpp | 26 | ||||
-rw-r--r-- | core/launcher/qcopbridge.cpp | 23 | ||||
-rw-r--r-- | core/launcher/qprocess.cpp | 14 | ||||
-rw-r--r-- | core/launcher/qprocess_unix.cpp | 93 | ||||
-rw-r--r-- | core/launcher/runningappbar.cpp | 24 | ||||
-rw-r--r-- | core/launcher/screensaver.cpp | 2 | ||||
-rw-r--r-- | core/launcher/server.cpp | 32 | ||||
-rw-r--r-- | core/launcher/serverapp.cpp | 26 | ||||
-rw-r--r-- | core/launcher/suspendmonitor.cpp | 2 | ||||
-rw-r--r-- | core/launcher/systray.cpp | 18 | ||||
-rw-r--r-- | core/launcher/taskbar.cpp | 7 | ||||
-rw-r--r-- | core/launcher/transferserver.cpp | 107 |
20 files changed, 334 insertions, 351 deletions
diff --git a/core/launcher/applauncher.cpp b/core/launcher/applauncher.cpp index 5a5517c..7000346 100644 --- a/core/launcher/applauncher.cpp +++ b/core/launcher/applauncher.cpp @@ -24,44 +24,41 @@ #ifndef QTOPIA_INTERNAL_FILEOPERATIONS #define QTOPIA_INTERNAL_FILEOPERATIONS #endif #ifndef QTOPIA_PROGRAM_MONITOR #define QTOPIA_PROGRAM_MONITOR #endif + +#include "applauncher.h" +#include "documentlist.h" + +/* OPIE */ +#include <opie2/odebug.h> #include <opie2/oglobal.h> +#include <qtopia/qcopenvelope_qws.h> +#include <qtopia/qpeapplication.h> +using namespace Opie::Core; -#ifndef Q_OS_WIN32 +/* QT */ +#include <qtimer.h> +#include <qwindowsystem_qws.h> +#include <qmessagebox.h> +#include <qfileinfo.h> + +/* STD */ #include <sys/stat.h> #include <sys/wait.h> #include <sys/file.h> #include <unistd.h> #include <sys/time.h> #include <sys/resource.h> #include <errno.h> -#else -#include <process.h> -#include <windows.h> -#include <winbase.h> -#endif - #include <signal.h> #include <sys/types.h> #include <stdlib.h> -#include <qtimer.h> -#include <qwindowsystem_qws.h> -#include <qmessagebox.h> -#include <qfileinfo.h> - -#include <qtopia/qcopenvelope_qws.h> -#include <qtopia/qpeapplication.h> - -#include "applauncher.h" -#include "documentlist.h" - -using namespace Opie::Core; const int AppLauncher::RAISE_TIMEOUT_MS = 5000; //--------------------------------------------------------------------------- static AppLauncher* appLauncherPtr; @@ -124,13 +121,13 @@ AppLauncher::~AppLauncher() } /* We use the QCopChannel of the app as an indicator of when it has been launched so that we can disable the busy indicators */ void AppLauncher::newQcopChannel(const QString& channelName) { -// qDebug("channel %s added", channelName.data() ); +// odebug << "channel " << channelName.data() << " added" << oendl; QString prefix("QPE/Application/"); if (channelName.startsWith(prefix)) { { QCopEnvelope e("QPE/System", "newChannel(QString)"); e << channelName; } @@ -138,13 +135,13 @@ void AppLauncher::newQcopChannel(const QString& channelName) if ( appName != "quicklauncher" ) { emit connected( appName ); QCopEnvelope e("QPE/System", "notBusy(QString)"); e << appName; } } else if (channelName.startsWith("QPE/QuickLauncher-")) { - qDebug("Registered %s", channelName.latin1()); + odebug << "Registered " << channelName << "" << oendl; int pid = channelName.mid(18).toInt(); if (pid == qlPid) qlReady = TRUE; } } @@ -177,13 +174,13 @@ void AppLauncher::received(const QCString& msg, const QByteArray& data) } else if ( msg == "raise(QString)" ) { QString appName; stream >> appName; if ( !executeBuiltin( appName, QString::null ) ) { if ( !waitingHeartbeat.contains( appName ) && appKillerName != appName ) { - //qDebug( "Raising: %s", appName.latin1() ); + //odebug << "Raising: " << appName << "" << oendl; QCString channel = "QPE/Application/"; channel += appName.latin1(); // Need to lock it to avoid race conditions with QPEApplication::processQCopFile QFile f("/tmp/qcop-msg-" + appName); if ( f.open(IO_WriteOnly | IO_Append) ) { @@ -214,13 +211,13 @@ void AppLauncher::received(const QCString& msg, const QByteArray& data) apps.append( *it ); QCopEnvelope e( "QPE/Desktop", "runningApps(QStringList)" ); e << apps; } else if ( msg == "appRaised(QString)" ) { QString appName; stream >> appName; - qDebug("Got a heartbeat from %s", appName.latin1()); + odebug << "Got a heartbeat from " << appName << "" << oendl; QMap<QString,int>::Iterator it = waitingHeartbeat.find(appName); if ( it != waitingHeartbeat.end() ) { killTimer( *it ); waitingHeartbeat.remove(it); } // Check to make sure we're not waiting on user input... @@ -237,18 +234,18 @@ void AppLauncher::received(const QCString& msg, const QByteArray& data) void AppLauncher::signalHandler(int) { #ifndef Q_OS_WIN32 int status; pid_t pid = waitpid(-1, &status, WNOHANG); /* if (pid == 0 || &status == 0 ) { - qDebug("hmm, could not get return value from signal"); + odebug << "hmm, could not get return value from signal" << oendl; } */ QApplication::postEvent(appLauncherPtr, new AppStoppedEvent(pid, status) ); #else - qDebug("Unhandled signal see by AppLauncher::signalHandler(int)"); + odebug << "Unhandled signal see by AppLauncher::signalHandler(int)" << oendl; #endif } bool AppLauncher::event(QEvent *e) { if ( e->type() == appStopEventID ) { @@ -270,24 +267,24 @@ void AppLauncher::timerEvent( QTimerEvent *e ) return; appKillerName = it.key(); killTimer( id ); waitingHeartbeat.remove( it ); - // qDebug("Checking in on %s", appKillerName.latin1()); + // odebug << "Checking in on " << appKillerName << "" << oendl; // We store this incase the application responds while we're // waiting for user input so we know not to delete ourselves. appKillerBox = new QMessageBox(tr("Application Problem"), tr("<p>%1 is not responding.</p>").arg(appKillerName) + tr("<p>Would you like to force the application to exit?</p>"), QMessageBox::Warning, QMessageBox::Yes, QMessageBox::No | QMessageBox::Default, QMessageBox::NoButton); if (appKillerBox->exec() == QMessageBox::Yes) { - // qDebug("Killing the app!!! Bwuhahahaha!"); + // odebug << "Killing the app!!! Bwuhahahaha!" << oendl; int pid = pidForName(appKillerName); if ( pid > 0 ) kill( pid ); } appKillerName = QString::null; delete appKillerBox; @@ -312,23 +309,23 @@ void AppLauncher::sigStopped(int sigPid, int sigStatus) exitStatus = WTERMSIG(sigStatus); } QMap<int,QString>::Iterator it = runningApps.find( sigPid ); if ( it == runningApps.end() ) { if ( sigPid == qlPid ) { - qDebug( "quicklauncher stopped" ); + odebug << "quicklauncher stopped" << oendl; qlPid = 0; qlReady = FALSE; QFile::remove("/tmp/qcop-msg-quicklauncher" ); QTimer::singleShot( 2000, this, SLOT(createQuickLauncher()) ); } /* if ( sigPid == -1 ) - qDebug("non-qtopia application exited (disregarded)"); + odebug << "non-qtopia application exited (disregarded)" << oendl; else - qDebug("==== no pid matching %d in list, definite bug", sigPid); + odebug << "==== no pid matching " << sigPid << " in list, definite bug" << oendl; */ return; } QString appName = *it; runningApps.remove(it); @@ -366,13 +363,13 @@ void AppLauncher::sigStopped(int sigPid, int sigStatus) QCopEnvelope e("QPE/System", "notBusy(QString)"); e << app->exec(); } /* // debug info for (it = runningApps.begin(); it != runningApps.end(); ++it) { - qDebug("running according to internal list: %s, with pid %d", (*it).data(), it.key() ); + odebug << "running according to internal list: " << (*it).data() << ", with pid " << it.key() << "" << oendl; } */ #ifdef QTOPIA_PROGRAM_MONITOR if ( crashed ) { QString sig; @@ -400,13 +397,13 @@ void AppLauncher::sigStopped(int sigPid, int sigStatus) if ( exitStatus == 255 ) { //could not find app (because global returns -1) QMessageBox::information(0, tr("Application not found"), tr("<qt>Could not locate application <b>%1</b></qt>").arg( app->exec() ) ); } else { QFileInfo fi(QString::fromLatin1("/tmp/qcop-msg-") + appName); if ( fi.exists() && fi.size() ) { emit terminated(sigPid, appName); - qWarning("Re executing obmitted for %s", appName.latin1() ); + owarn << "Re executing obmitted for " << appName << "" << oendl; // execute( appName, QString::null ); return; } } } @@ -414,24 +411,24 @@ void AppLauncher::sigStopped(int sigPid, int sigStatus) emit terminated(sigPid, appName); } #else void AppLauncher::sigStopped(int sigPid, int sigStatus) { - qDebug("Unhandled signal : AppLauncher::sigStopped(int sigPid, int sigStatus)"); + odebug << "Unhandled signal : AppLauncher::sigStopped(int sigPid, int sigStatus)" << oendl; } #endif // Q_OS_WIN32 bool AppLauncher::isRunning(const QString &app) { for (QMap<int,QString>::ConstIterator it = runningApps.begin(); it != runningApps.end(); ++it) { if ( *it == app ) { #ifdef Q_OS_UNIX pid_t t = ::__getpgid( it.key() ); if ( t == -1 ) { - qDebug("appLauncher bug, %s believed running, but pid %d is not existing", app.data(), it.key() ); + odebug << "appLauncher bug, " << app.data() << " believed running, but pid " << it.key() << " is not existing" << oendl; runningApps.remove( it.key() ); return FALSE; } #endif return TRUE; } @@ -478,13 +475,13 @@ bool AppLauncher::executeBuiltin(const QString &c, const QString &document) return FALSE; } bool AppLauncher::execute(const QString &c, const QString &docParam, bool noRaise) { - qWarning("AppLauncher::execute '%s' '%s'", (const char*) c, (const char*) docParam ); + owarn << "AppLauncher::execute '" << c << "' '" << docParam << "'" << oendl; // Convert the command line in to a list of arguments QStringList list = QStringList::split(QRegExp(" *"),c); QStringList arglist = QStringList::split(QRegExp(" *"),docParam); for ( QStringList::Iterator it = arglist.begin(); it != arglist.end(); ++it ) list.append( *it ); @@ -545,13 +542,13 @@ bool AppLauncher::execute(const QString &c, const QString &docParam, bool noRais #ifndef Q_OS_WIN32 #ifdef Q_OS_MACX if ( qlPid && qlReady && QFile::exists( QPEApplication::qpeDir()+"plugins/application/lib"+args[0] + ".dylib" ) ) { #else if ( qlPid && qlReady && QFile::exists( QPEApplication::qpeDir()+"plugins/application/lib"+args[0] + ".so" ) ) { #endif /* Q_OS_MACX */ - qDebug( "Quick launching: %s", args[0] ); + odebug << "Quick launching: " << args[0] << "" << oendl; if ( getuid() == 0 ) setpriority( PRIO_PROCESS, qlPid, 0 ); QCString qlch("QPE/QuickLauncher-"); qlch += QString::number(qlPid); QCopEnvelope env( qlch, "execute(QStrList)" ); env << slist; @@ -581,27 +578,27 @@ bool AppLauncher::execute(const QString &c, const QString &docParam, bool noRais QProcess *proc = new QProcess(this); if (proc){ for (int i=0; i < slist.count(); i++) proc->addArgument(args[i]); connect(proc, SIGNAL(processExited()), this, SLOT(processExited())); if (!proc->start()){ - qDebug("Unable to start application %s", args[0]); + odebug << "Unable to start application " << args[0] << "" << oendl; }else{ PROCESS_INFORMATION *procInfo = (PROCESS_INFORMATION *)proc->processIdentifier(); if (procInfo){ DWORD pid = procInfo->dwProcessId; runningApps[pid] = QString(args[0]); runningAppsProc.append(proc); emit launched(pid, QString(args[0])); QCopEnvelope e("QPE/System", "busy()"); }else{ - qDebug("Unable to read process inforation #1 for %s", args[0]); + odebug << "Unable to read process inforation #1 for " << args[0] << "" << oendl; } } }else{ - qDebug("Unable to create process for application %s", args[0]); + odebug << "Unable to create process for application " << args[0] << "" << oendl; return FALSE; } #endif #endif //QT_NO_QWS_MULTIPROCESS delete [] args; @@ -675,22 +672,22 @@ void AppLauncher::createQuickLauncher() } // Used only by Win32 void AppLauncher::processExited() { #ifdef Q_OS_WIN32 - qDebug("AppLauncher::processExited()"); + odebug << "AppLauncher::processExited()" << oendl; bool found = FALSE; QProcess *proc = (QProcess *) sender(); if (!proc){ - qDebug("Interanl error NULL proc"); + odebug << "Interanl error NULL proc" << oendl; return; } QString appName = proc->arguments()[0]; - qDebug("Removing application %s", appName.latin1()); + odebug << "Removing application " << appName << "" << oendl; runningAppsProc.remove(proc); QMap<QString,int>::Iterator hbit = waitingHeartbeat.find(appName); if ( hbit != waitingHeartbeat.end() ) { killTimer( *hbit ); waitingHeartbeat.remove( hbit ); @@ -711,12 +708,12 @@ void AppLauncher::processExited() } if (found){ emit terminated(it.key(), it.data()); runningApps.remove(it.key()); }else{ - qDebug("Internal error application %s not listed as running", appName.latin1()); + odebug << "Internal error application " << appName << " not listed as running" << oendl; } #endif } diff --git a/core/launcher/documentlist.cpp b/core/launcher/documentlist.cpp index 3e0a96c..92b8c25 100644 --- a/core/launcher/documentlist.cpp +++ b/core/launcher/documentlist.cpp @@ -18,25 +18,28 @@ ** **********************************************************************/ #include "documentlist.h" #include "serverinterface.h" #include "mediadlg.h" +/* OPIE */ #include <opie2/oglobal.h> - +#include <opie2/odebug.h> #include <qtopia/config.h> #include <qtopia/mimetype.h> #include <qtopia/resource.h> #include <qtopia/private/categories.h> #include <qtopia/qpeapplication.h> #include <qtopia/applnk.h> #include <qtopia/storage.h> #ifdef Q_WS_QWS #include <qtopia/qcopenvelope_qws.h> #endif +using namespace Opie::Core; +/* QT */ #include <qtimer.h> #include <qfileinfo.h> #include <qtextstream.h> #include <qfile.h> #include <qdir.h> #include <qpainter.h> @@ -44,13 +47,12 @@ #include <qcopchannel_qws.h> #include <qlistview.h> #include <qlist.h> #include <qpixmap.h> -using namespace Opie::Core; AppLnkSet *DocumentList::appLnkSet = 0; static const int MAX_SEARCH_DEPTH = 10; class DocumentListPrivate : public QObject { @@ -105,13 +107,13 @@ DocumentList::DocumentList( ServerInterface *serverGui, bool /*scanDocs*/, d = new DocumentListPrivate( serverGui ); d->needToSendAllDocLinks = false; Config cfg( "Launcher" ); cfg.setGroup( "DocTab" ); d->scanDocs = cfg.readBoolEntry( "Enable", true ); - qDebug( "DocumentList::DocumentList() : scanDocs = %d", d->scanDocs ); + odebug << "DocumentList::DocumentList() : scanDocs = " << d->scanDocs << "" << oendl; QTimer::singleShot( 10, this, SLOT( startInitialScan() ) ); } void DocumentList::startInitialScan() { @@ -138,23 +140,23 @@ void DocumentList::start() resume(); } void DocumentList::pause() { - //qDebug("pause %i", d->tid); + //odebug << "pause " << d->tid << "" << oendl; killTimer( d->tid ); d->tid = 0; } void DocumentList::resume() { if ( d->tid == 0 ) { d->tid = startTimer( 20 ); - //qDebug("resumed %i", d->tid); + //odebug << "resumed " << d->tid << "" << oendl; } } /* void DocumentList::resend() { @@ -174,13 +176,13 @@ void DocumentList::resendWorker() resume(); } */ void DocumentList::rescan() { - //qDebug("rescan"); + //odebug << "rescan" << oendl; pause(); d->initialize(); resume(); } @@ -229,22 +231,22 @@ void DocumentList::reloadAppLnks() if (pm.isNull()) { QImage img( Resource::loadImage( "UnknownDocument" ) ); pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); bgPm = img.smoothScale( AppLnk::bigIconSize(), AppLnk::bigIconSize() ); } - //qDebug("adding type %s", (*ittypes).latin1()); + //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) { - //qDebug("removing type %s", (*ittypes).latin1()); + //odebug << "removing type " << (*ittypes) << "" << oendl; d->serverGui->typeRemoved(*ittypes); } prevTypeList = types; } QListIterator<AppLnk> itapp( appLnkSet->children() ); @@ -271,39 +273,39 @@ void DocumentList::reloadDocLnks() rescan(); } void DocumentList::linkChanged( QString arg ) { - //qDebug( "linkchanged( %s )", arg.latin1() ); + //odebug << "linkchanged( " << arg << " )" << oendl; if ( arg.isNull() || OGlobal::isAppLnkFileName( arg ) ) { reloadAppLnks(); } else { const QList<DocLnk> &list = d->dls.children(); QListIterator<DocLnk> it( list ); while ( it.current() ) { DocLnk *doc = it.current(); ++it; if ( ( doc->linkFileKnown() && doc->linkFile() == arg ) || ( doc->fileKnown() && doc->file() == arg ) ) { - //qDebug( "found old link" ); + //odebug << "found old link" << oendl; DocLnk* dl = new DocLnk( arg ); // add new one if it exists and matches the mimetype if ( d->store( dl ) ) { // Existing link has been changed, send old link ref and a ref // to the new link - //qDebug( "change case" ); + //odebug << "change case" << oendl; if ( d->serverGui ) d->serverGui->documentChanged( *doc, *dl ); } else { // Link has been removed or doesn't match the mimetypes any more // so we aren't interested in it, so take it away from the list - //qDebug( "removal case" ); + //odebug << "removal case" << oendl; if ( d->serverGui ) d->serverGui->documentRemoved( *doc ); } d->dls.remove( doc ); // remove old link from docLnkSet delete doc; @@ -311,13 +313,13 @@ void DocumentList::linkChanged( QString arg ) } } // Didn't find existing link, must be new DocLnk* dl = new DocLnk( arg ); if ( d->store( dl ) ) { // Add if it's a link we are interested in - //qDebug( "add case" ); + //odebug << "add case" << oendl; add( *dl ); } } } @@ -375,18 +377,18 @@ void DocumentList::sendAllDocLinks() contents += "Type = "+doc->type()+"\n"; // No tr } contents += "File = "+doc->file()+"\n"; // No tr // (resolves path) contents += QString("Size = %1\n").arg( fi.size() ); // No tr } - //qDebug( "sending length %d", contents.length() ); + //odebug << "sending length " << contents.length() << "" << oendl; #ifndef QT_NO_COP QCopEnvelope e( "QPE/Desktop", "docLinks(QString)" ); e << contents; #endif - //qDebug( "================ \n\n%s\n\n===============", contents.latin1() ); + //odebug << "================ \n\n" << contents << "\n\n===============" << oendl; d->needToSendAllDocLinks = false; } @@ -533,13 +535,13 @@ void DocumentListPrivate::estimatedPercentScanned() } } else { break; } } - // qDebug( "overallProgress: %f", overallProgress ); + // odebug << "overallProgress: " << overallProgress << "" << oendl; if ( serverGui ) serverGui->documentScanningProgress( (int)overallProgress ); } @@ -550,13 +552,13 @@ const QString DocumentListPrivate::nextFile() // go to next base path if ( docPathsSearched >= docPaths.count() ) { // end of base paths return QString::null; } else { QDir dir( docPaths[docPathsSearched] ); - // qDebug("now using base path: %s", docPaths[docPathsSearched].latin1() ); + // odebug << "now using base path: " << docPaths[docPathsSearched] << "" << oendl; docPathsSearched++; if ( !dir.exists( ".Qtopia-ignore" ) ) { listDirs[0] = new QDir( dir ); lists[0] = listDirs[0]->entryInfoList(); listPositions[0] = 0; searchDepth = 0; @@ -584,13 +586,13 @@ const QString DocumentListPrivate::nextFile() QString bn = fi->fileName(); if ( bn[0] != '.' ) { if ( fi->isDir() ) { if ( bn != "CVS" && bn != "Qtopia" && bn != "QtPalmtop" ) { // go down a depth QDir dir( fi->filePath() ); - // qDebug("now going in to path: %s", bn.latin1() ); + // odebug << "now going in to path: " << bn << "" << oendl; if ( !dir.exists( ".Qtopia-ignore" ) ) { if ( searchDepth < MAX_SEARCH_DEPTH - 1) { searchDepth++; listDirs[searchDepth] = new QDir( dir ); lists[searchDepth] = listDirs[searchDepth]->entryInfoList(); listPositions[searchDepth] = 0; @@ -625,13 +627,13 @@ bool DocumentListPrivate::store( DocLnk* dl ) #define MAGIC_NUMBER ((void*)2) const DocLnk *DocumentListPrivate::iterate() { if ( state == Find ) { - //qDebug("state Find"); + //odebug << "state Find" << oendl; QString file = nextFile(); while ( !file.isNull() ) { if ( file.right(8) == ".desktop" ) { // No tr DocLnk* dl = new DocLnk( file ); if ( store(dl) ) return dl; @@ -647,13 +649,13 @@ const DocLnk *DocumentListPrivate::iterate() } static int iterationI; static int iterationCount; if ( state == RemoveKnownFiles ) { - //qDebug("state RemoveKnownFiles"); + //odebug << "state RemoveKnownFiles" << oendl; const QList<DocLnk> &list = dls.children(); for ( QListIterator<DocLnk> it( list ); it.current(); ++it ) { reference.remove( (*it)->file() ); // ### does this need to be deleted? } dit = new QDictIterator<void>(reference); @@ -661,13 +663,13 @@ const DocLnk *DocumentListPrivate::iterate() iterationI = 0; iterationCount = dit->count(); } if ( state == MakeUnknownFiles ) { - //qDebug("state MakeUnknownFiles"); + //odebug << "state MakeUnknownFiles" << oendl; for (void* c; (c=dit->current()); ++(*dit) ) { if ( c == MAGIC_NUMBER ) { DocLnk* dl = new DocLnk; QFileInfo fi( dit->currentKey() ); dl->setFile( fi.filePath() ); dl->setName( fi.baseName() ); @@ -684,13 +686,13 @@ const DocLnk *DocumentListPrivate::iterate() delete dit; dit = 0; state = Done; } - //qDebug("state Done"); + //odebug << "state Done" << oendl; return NULL; } #include "documentlist.moc" diff --git a/core/launcher/firstuse.cpp b/core/launcher/firstuse.cpp index 4316648..e9e2d83 100644 --- a/core/launcher/firstuse.cpp +++ b/core/launcher/firstuse.cpp @@ -26,35 +26,37 @@ #define protected public #endif #include "firstuse.h" #include "inputmethods.h" #include "applauncher.h" #include "serverapp.h" -//#include <qtopia/custom.h> - #include "calibrate.h" #include "documentlist.h" +/* OPIE */ +#include <opie2/odebug.h> #include <qtopia/resource.h> #include <qtopia/qcopenvelope_qws.h> #include <qtopia/config.h> #include <qtopia/fontmanager.h> +using namespace Opie::Core; +/* QT */ #include <qfile.h> #include <qpainter.h> #include <qsimplerichtext.h> #include <qpushbutton.h> #include <qlabel.h> #include <qtimer.h> #if defined( Q_WS_QWS ) #include <qwsdisplay_qws.h> #include <qgfx_qws.h> #endif - +/* STD */ #include <stdlib.h> #include <sys/types.h> #if defined(Q_OS_LINUX) || defined(_OS_LINUX_) #include <unistd.h> #endif @@ -152,13 +154,13 @@ FirstUse::FirstUse(QWidget* parent, const char * name, WFlags wf) : next->setGeometry(x, 0, buttonWidth, controlHeight); taskBar->setGeometry( 0, height() - controlHeight, desk.width(), controlHeight); taskBar->hide(); #if defined(Q_WS_QWS) && !defined(QT_NO_COP) - qDebug("Setting up QCop to QPE/System"); + odebug << "Setting up QCop to QPE/System" << oendl; QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); connect(sysChannel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(message(const QCString&,const QByteArray&)) ); #endif calcMaxWindowRect(); @@ -220,24 +222,24 @@ void FirstUse::calcMaxWindowRect() /* cancel current dialog, and bring up next */ void FirstUse::nextDialog() { int prevApp = currApp; do { currApp++; - qDebug( "currApp = %d", currApp ); + odebug << "currApp = " << currApp << "" << oendl; if ( settingsTable[currApp].app == 0 ) { if ( prevApp >= 0 && appLauncher->isRunning(settingsTable[prevApp].app) ) { // The last application is still running. // Tell it to stop, and when its done we'll come back // to nextDialog and exit. - qDebug( "Waiting for %s to exit", settingsTable[prevApp].app ); + odebug << "Waiting for " << settingsTable[prevApp].app << " to exit" << oendl; QCopEnvelope e(QCString("QPE/Application/") + settingsTable[prevApp].app, settingsTable[prevApp].stop ); currApp = prevApp; } else { - qDebug( "Done!" ); + odebug << "Done!" << oendl; Config config( "qpe" ); config.setGroup( "Startup" ); config.writeEntry( "FirstUse", FALSE ); QPixmap pix = Resource::loadPixmap("bigwait"); QLabel *lblWait = new QLabel(0, "wait hack!", // No tr QWidget::WStyle_Customize | QWidget::WDestructiveClose | @@ -255,18 +257,18 @@ void FirstUse::nextDialog() } return; } } while ( !settingsTable[currApp].enabled ); if ( prevApp >= 0 && appLauncher->isRunning(settingsTable[prevApp].app) ) { - qDebug( "Shutdown: %s", settingsTable[prevApp].app ); + odebug << "Shutdown: " << settingsTable[prevApp].app << "" << oendl; QCopEnvelope e(QCString("QPE/Application/") + settingsTable[prevApp].app, settingsTable[prevApp].stop ); waitForExit = prevApp; } else { - qDebug( "Startup: %s", settingsTable[currApp].app ); + odebug << "Startup: " << settingsTable[currApp].app << "" << oendl; QCopEnvelope e(QCString("QPE/Application/") + settingsTable[currApp].app, settingsTable[currApp].start ); waitingForLaunch = TRUE; } updateButtons(); @@ -282,22 +284,22 @@ void FirstUse::previousDialog() currApp = prevApp; return; } } while ( !settingsTable[currApp].enabled ); if ( prevApp >= 0 ) { - qDebug( "Shutdown: %s", settingsTable[prevApp].app ); + odebug << "Shutdown: " << settingsTable[prevApp].app << "" << oendl; QCopEnvelope e(QCString("QPE/Application/") + settingsTable[prevApp].app, settingsTable[prevApp].stop ); /* if (settingsTable[prevApp].app == QString("systemtime")) QCopEnvelope e("QPE/Application/citytime", "close()"); */ waitForExit = prevApp; } else { - qDebug( "Startup: %s", settingsTable[currApp].app ); + odebug << "Startup: " << settingsTable[currApp].app << "" << oendl; QCopEnvelope e(QCString("QPE/Application/") + settingsTable[currApp].app, settingsTable[currApp].start ); waitingForLaunch = TRUE; } updateButtons(); @@ -315,15 +317,15 @@ void FirstUse::message(const QCString &msg, const QByteArray &data) setenv( "TZ", t.latin1(), 1 ); } } void FirstUse::terminated( int, const QString &app ) { - qDebug( "--- terminated: %s", app.latin1() ); + odebug << "--- terminated: " << app << "" << oendl; if ( waitForExit != -1 && settingsTable[waitForExit].app == app ) { - qDebug( "Startup: %s", settingsTable[currApp].app ); + odebug << "Startup: " << settingsTable[currApp].app << "" << oendl; if ( settingsTable[waitForExit].app == "language" ) { // No tr Config config("locale"); config.setGroup( "Language"); QString l = config.readEntry( "Language", "en"); if ( l != lang ) { reloadLanguages(); @@ -344,18 +346,18 @@ void FirstUse::terminated( int, const QString &app ) next->setEnabled(TRUE); } } void FirstUse::newQcopChannel(const QString& channelName) { - qDebug("channel %s added", channelName.data() ); + odebug << "channel " << channelName.data() << " added" << oendl; QString prefix("QPE/Application/"); if (channelName.startsWith(prefix)) { QString appName = channelName.mid(prefix.length()); if ( currApp >= 0 && appName == settingsTable[currApp].app ) { - qDebug( "Application: %s started", settingsTable[currApp].app ); + odebug << "Application: " << settingsTable[currApp].app << " started" << oendl; waitingForLaunch = FALSE; updateButtons(); repaint(); } else if (appName != "quicklauncher") { back->setEnabled(FALSE); next->setEnabled(FALSE); @@ -367,18 +369,18 @@ void FirstUse::reloadLanguages() { // read language from config file. Waiting on QCop takes too long. Config config("locale"); config.setGroup( "Language"); QString l = config.readEntry( "Language", "en"); QString cl = getenv("LANG"); - qWarning("language message - " + l); + owarn << "language message - " + l << oendl; // setting anyway... if (l.isNull() ) unsetenv( "LANG" ); else { - qWarning("and its not null"); + owarn << "and its not null" << oendl; setenv( "LANG", l.latin1(), 1 ); } #ifndef QT_NO_TRANSLATION // clear old translators #ifndef _MSC_VER //### revise to allow removal of translators under MSVC @@ -389,26 +391,26 @@ void FirstUse::reloadLanguages() } #endif // load translation tables transApp = new QTranslator(qApp); QString tfn = QPEApplication::qpeDir() + "i18n/"+l+"/qpe.qm"; - qWarning("loading " + tfn); + owarn << "loading " + tfn << oendl; if ( transApp->load(tfn) ) { - qWarning("installing translator"); + owarn << "installing translator" << oendl; qApp->installTranslator( transApp ); } else { delete transApp; transApp = 0; } transLib = new QTranslator(qApp); tfn = QPEApplication::qpeDir() + "i18n/"+l+"/libqpe.qm"; - qWarning("loading " + tfn); + owarn << "loading " + tfn << oendl; if ( transLib->load(tfn) ) { - qWarning("installing translator library"); + owarn << "installing translator library" << oendl; qApp->installTranslator( transLib ); } else { delete transLib; transLib = 0; } loadPixmaps(); diff --git a/core/launcher/inputmethods.cpp b/core/launcher/inputmethods.cpp index 19e799a..cef16bf 100644 --- a/core/launcher/inputmethods.cpp +++ b/core/launcher/inputmethods.cpp @@ -18,37 +18,33 @@ ** **********************************************************************/ #define QTOPIA_INTERNAL_LANGLIST #include "inputmethods.h" +/* OPIE */ +#include <opie2/odebug.h> #include <qtopia/config.h> #include <qtopia/qpeapplication.h> +using namespace Opie::Core; +/* QT */ #include <qpopupmenu.h> #include <qtoolbutton.h> #include <qwidgetstack.h> #include <qlayout.h> #include <qdir.h> -#include <stdlib.h> #include <qtl.h> - #ifdef Q_WS_QWS #include <qwindowsystem_qws.h> #include <qwsevent_qws.h> #include <qcopchannel_qws.h> #endif -/* ### SingleFloppy if someone is interested? */ -#if 0 -#ifdef QT_NO_COMPONENT -#include "../plugins/inputmethods/handwriting/handwritingimpl.h" -#include "../plugins/inputmethods/keyboard/keyboardimpl.h" -#include "../3rdparty/plugins/inputmethods/pickboard/pickboardimpl.h" -#endif -#endif +/* STD */ +#include <stdlib.h> /* XPM */ static const char * tri_xpm[]={ "9 9 2 1", "a c #000000", ". c None", @@ -259,13 +255,13 @@ void InputMethods::setPreferedHandlers() { } } if (!inputMethodList.isEmpty() && !current.isEmpty() ) { for (it = inputMethodList.begin(); it != inputMethodList.end(); ++it ) if ( (*it).name() == current ) { - qWarning("preferred keyboard is %s", current.latin1() ); + owarn << "preferred keyboard is " << current << "" << oendl; mkeyboard = &(*it); kbdButton->setPixmap( *mkeyboard->icon() ); break; } } @@ -302,19 +298,19 @@ void InputMethods::loadInputMethods() input.library = lib; input.libName = *it; input.extInterface = eface; input.widget = input.extInterface->keyboardWidget( 0, inputWidgetStyle ); // may be either a simple, or advanced. if (input.widget) { - //qDebug("its a keyboard"); + //odebug << "its a keyboard" << oendl; inputMethodList.append( input ); } else { - //qDebug("its a real im"); + //odebug << "its a real im" << oendl; input.widget = input.extInterface->statusWidget( 0, 0 ); if (input.widget) { - //qDebug("blah"); + //odebug << "blah" << oendl; inputModifierList.append( input ); imButton->addWidget(input.widget, inputModifierList.count()); } } }else{ delete lib; @@ -538,49 +534,49 @@ void InputMethods::showKbd( bool on ) int width = qApp->desktop()->width() * (inputWidgetWidth*0.01); int left = 0; int top = mapToGlobal( QPoint() ).y() - height; if ( inputWidgetStyle & QWidget::WStyle_DialogBorder ) { - qDebug( "InputMethods: reading geometry." ); + odebug << "InputMethods: reading geometry." << oendl; Config cfg( "Launcher" ); cfg.setGroup( "InputMethods" ); int l = cfg.readNumEntry( "absX", -1 ); int t = cfg.readNumEntry( "absY", -1 ); int w = cfg.readNumEntry( "absWidth", -1 ); int h = cfg.readNumEntry( "absHeight", -1 ); if ( l > -1 && t > -1 && w > -1 && h > -1 ) { - qDebug( "InputMethods: config values ( %d, %d, %d, %d ) are ok.", l, t, w, h ); + odebug << "InputMethods: config values ( " << l << ", " << t << ", " << w << ", " << h << " ) are ok." << oendl; left = l; top = t; width = w; height = h; } else { - qDebug( "InputMethods: config values are new or not ok." ); + odebug << "InputMethods: config values are new or not ok." << oendl; } } else { - qDebug( "InputMethods: no floating selected." ); + odebug << "InputMethods: no floating selected." << oendl; } mkeyboard->widget->resize( width, height ); mkeyboard->widget->move( left, top ); mkeyboard->widget->show(); mkeyboard->widget->installEventFilter( this ); } else { if ( inputWidgetStyle & QWidget::WStyle_DialogBorder ) { QPoint pos = mkeyboard->widget->pos(); QSize siz = mkeyboard->widget->size(); - qDebug( "InputMethods: saving geometry." ); + odebug << "InputMethods: saving geometry." << oendl; Config cfg( "Launcher" ); cfg.setGroup( "InputMethods" ); cfg.writeEntry( "absX", pos.x() ); cfg.writeEntry( "absY", pos.y() ); cfg.writeEntry( "absWidth", siz.width() ); cfg.writeEntry( "absHeight", siz.height() ); diff --git a/core/launcher/irserver.cpp b/core/launcher/irserver.cpp index a0e9c16..092eb0c 100644 --- a/core/launcher/irserver.cpp +++ b/core/launcher/irserver.cpp @@ -15,21 +15,21 @@ ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ - #include "irserver.h" +#include "obexinterface.h" +/* OPIE */ +#include <opie2/odebug.h> #include <qtopia/qlibrary.h> #include <qtopia/qpeapplication.h> - -#include "obexinterface.h" - +/* QT */ #include <qdir.h> IrServer::IrServer( QObject *parent, const char *name ) : QObject( parent, name ), obexIface(0) { lib = 0; @@ -41,33 +41,33 @@ IrServer::IrServer( QObject *parent, const char *name ) QDir dir( path, "lib*.so" ); #endif /* Q_OS_MACX */ QStringList list = dir.entryList(); QStringList::Iterator it; for ( it = list.begin(); it != list.end(); ++it ) { QLibrary *trylib = new QLibrary( path + *it ); - //qDebug("trying lib %s", (path + (*it)).latin1() ); + //odebug << "trying lib " << (path + (*it)) << "" << oendl; if ( trylib->queryInterface( IID_ObexInterface, (QUnknownInterface**)&obexIface ) == QS_OK ) { lib = trylib; - //qDebug("found obex lib" ); + //odebug << "found obex lib" << oendl; QString lang = getenv( "LANG" ); QTranslator * trans = new QTranslator(qApp); QString type = (*it).left( (*it).find(".") ); QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm"; - //qDebug("tr fpr obex: %s", tfn.latin1() ); + //odebug << "tr fpr obex: " << tfn << "" << oendl; if ( trans->load( tfn )) qApp->installTranslator( trans ); else delete trans; break; } else { delete lib; } } if ( !lib ) - qDebug("could not load IR plugin" ); + odebug << "could not load IR plugin" << oendl; } IrServer::~IrServer() { if ( obexIface ) obexIface->release(); diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index 5d0c778..bf2287d 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp @@ -15,26 +15,38 @@ ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ +#include "startmenu.h" +#include "taskbar.h" +#include "serverinterface.h" +#include "launcherview.h" +#include "launcher.h" +#include "server.h" + +/* OPIE */ +#include <opie2/odebug.h> #include <qtopia/global.h> #ifdef Q_WS_QWS #include <qtopia/qcopenvelope_qws.h> #endif #include <qtopia/resource.h> #include <qtopia/applnk.h> #include <qtopia/config.h> #include <qtopia/qpeapplication.h> #include <qtopia/mimetype.h> #include <qtopia/private/categories.h> -//#include <qtopia/custom.h> +#define QTOPIA_INTERNAL_FSLP +#include <qtopia/lnkproperties.h> +/* QT */ #include <qdir.h> #ifdef Q_WS_QWS +#include <qkeyboard_qws.h> #include <qwindowsystem_qws.h> #endif #include <qtimer.h> #include <qcombobox.h> #include <qvbox.h> #include <qlayout.h> @@ -47,37 +59,22 @@ #include <qframe.h> #include <qpainter.h> #include <qlabel.h> #include <qtextstream.h> #include <qpopupmenu.h> -#include "startmenu.h" -#include "taskbar.h" - -#include "serverinterface.h" -#include "launcherview.h" -#include "launcher.h" -#include "server.h" - -#define QTOPIA_INTERNAL_FSLP -#include <qtopia/lnkproperties.h> +/* STD */ #include <stdlib.h> #include <assert.h> - #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) #include <unistd.h> #include <stdio.h> #include <sys/vfs.h> #include <mntent.h> #endif -#ifdef Q_WS_QWS -#include <qkeyboard_qws.h> -#include <qpe/lnkproperties.h> -#endif - static bool isVisibleWindow( int ); //=========================================================================== LauncherTabWidget::LauncherTabWidget( Launcher* parent ) : QVBox( parent ), docview( 0 ) @@ -225,13 +222,13 @@ LauncherView* LauncherTabWidget::newView( const QString& id, const QPixmap& pm, LauncherTab *tab = new LauncherTab( id, view, pm, label ); categoryBar->insertTab( tab, n-1 ); if ( id == "Documents" ) docview = view; - qDebug("inserting %s at %d", id.latin1(), n-1 ); + odebug << "inserting " << id << " at " << n-1 << "" << oendl; Config cfg("Launcher"); setTabAppearance( tab, cfg ); cfg.setGroup( "GUI" ); view->setBusyIndicatorType( cfg.readEntry( "BusyType", QString::null ) ); @@ -410,13 +407,13 @@ void LauncherTabWidget::launcherMessage( const QCString &msg, const QByteArray & stream >> weight; int italic; stream >> italic; if ( view(id) ) { if ( !fam.isEmpty() ) { view(id)->setViewFont( QFont(fam, size, weight, italic!=0) ); - qDebug( "setFont: %s, %d, %d, %d", fam.latin1(), size, weight, italic ); + odebug << "setFont: " << fam << ", " << size << ", " << weight << ", " << italic << "" << oendl; } else { view(id)->clearViewFont(); } } }else if ( msg == "setBusyIndicatorType(QString)" ) { QString type; @@ -681,13 +678,13 @@ void Launcher::applicationAdded( const QString& type, const AppLnk& app ) void Launcher::applicationRemoved( const QString& type, const AppLnk& app ) { LauncherView *view = tabs->view( type ); if ( view ) view->removeLink( app.linkFile() ); else - qWarning("removeAppLnk: No view for %s!", type.latin1() ); + owarn << "removeAppLnk: No view for " << type << "!" << oendl; } void Launcher::allApplicationsRemoved() { MimeType::clear(); for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp index 6c7d487..71e8753 100644 --- a/core/launcher/launcherview.cpp +++ b/core/launcher/launcherview.cpp @@ -17,19 +17,22 @@ ** not clear to you. ** **********************************************************************/ #include "launcherview.h" +/* OPIE */ +#include <opie2/odebug.h> #include <qtopia/qpeapplication.h> #include <qtopia/private/categories.h> #include <qtopia/categoryselect.h> #include <qtopia/mimetype.h> #include <qtopia/resource.h> -//#include <qtopia/private/palmtoprecord.h> +using namespace Opie::Core; +/* QT */ #include <qtimer.h> #include <qfileinfo.h> #include <qiconview.h> #include <qobjectlist.h> @@ -112,13 +115,13 @@ public: { #if 0 // debuggery QListIterator<AppLnk> it(hidden); AppLnk* l; while ((l=it.current())) { ++it; - //qDebug("%p: hidden (should remove)",l); + //odebug << "" << l << ": hidden (should remove)" << oendl; } #endif } QIconViewItem* busyItem() const { return bsy; } #ifdef USE_ANIMATED_BUSY_ICON_OVERLAY @@ -1026,13 +1029,13 @@ void LauncherView::paletteChange( const QPalette &p ) cg.setColor( QColorGroup::Text, textCol ); icons->setPalette( QPalette(cg,cg,cg) ); } void LauncherView::fontChanged(const QFont&) { - qDebug("LauncherView::fontChanged()"); + odebug << "LauncherView::fontChanged()" << oendl; icons->hideOrShowItems( FALSE ); } void LauncherView::relayout(void) { icons->hideOrShowItems(FALSE); diff --git a/core/launcher/main.cpp b/core/launcher/main.cpp index 3e7e0d2..a86aca6 100644 --- a/core/launcher/main.cpp +++ b/core/launcher/main.cpp @@ -18,56 +18,50 @@ ** **********************************************************************/ #ifndef QTOPIA_INTERNAL_FILEOPERATIONS #define QTOPIA_INTERNAL_FILEOPERATIONS #endif +#ifdef QT_QWS_LOGIN +#include "../login/qdmdialogimpl.h" +#endif +#include "calibrate.h" #include "server.h" #include "serverapp.h" #include "stabmon.h" #include "firstuse.h" +/* OPIE */ +#include <opie2/odebug.h> +#include <opie2/odevice.h> #include <opie2/oglobal.h> - #include <qtopia/network.h> -//#include <qtopia/custom.h> - +#include <qtopia/alarmserver.h> +using namespace Opie::Core; +/* QT */ #include <qdir.h> +#include <qmessagebox.h> #ifdef QWS #include <qwindowsystem_qws.h> #include <qtopia/qcopenvelope_qws.h> #endif -#include <qtopia/alarmserver.h> +#ifdef Q_WS_QWS +#include <qkeyboard_qws.h> +#endif +/* STD */ #include <stdlib.h> #include <stdio.h> #include <signal.h> #ifndef Q_OS_WIN32 #include <unistd.h> #else #include <process.h> #endif -#include "calibrate.h" - - -#ifdef QT_QWS_LOGIN -#include "../login/qdmdialogimpl.h" -#endif - -#ifdef Q_WS_QWS -#include <qkeyboard_qws.h> -#endif - -#include <qmessagebox.h> -#include <opie2/odevice.h> - -using namespace Opie::Core; - - static void cleanup() { QDir dir( "/tmp", "qcop-msg-*" ); QStringList stale = dir.entryList(); QStringList::Iterator it; @@ -118,13 +112,13 @@ static void refreshTimeZoneConfig() // translations of TimeZone name zoneIndex = 0; while (cfg.hasKey( "Zone"+ QString::number( zoneIndex ))){ zoneID = cfg.readEntry( "Zone" + QString::number( zoneIndex )); curZone = TimeZone( zoneID ); if ( !curZone.isValid() ){ - qDebug( "initEnvironment() Invalid TimeZone %s", zoneID.latin1() ); + odebug << "initEnvironment() Invalid TimeZone " << zoneID << "" << oendl; break; } cfg.writeEntry( "ZoneName" + QString::number( zoneIndex ), curZone.city() ); zoneIndex++; } #endif @@ -266,13 +260,13 @@ int initApplication( int argc, char ** argv ) e << QString ( ); } } int rv = a.exec(); - qDebug("exiting..."); + odebug << "exiting..." << oendl; delete s; #ifndef Q_OS_MACX ODevice::inst()->setSoftSuspend( false ); #endif @@ -338,13 +332,13 @@ int main( int argc, char ** argv ) int main( int argc, char ** argv ) { int retVal = initApplication( argc, argv ); if ( DesktopApplication::doRestart ) { - qDebug("Trying to restart"); + odebug << "Trying to restart" << oendl; execl( (QPEApplication::qpeDir()+"bin\\qpe").latin1(), "qpe", 0 ); } return retVal; } diff --git a/core/launcher/packageslave.cpp b/core/launcher/packageslave.cpp index 7e61b0e..a11ac86 100644 --- a/core/launcher/packageslave.cpp +++ b/core/launcher/packageslave.cpp @@ -16,34 +16,34 @@ ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "packageslave.h" -#include <qtopia/qprocess.h> +/* OPIE */ +#include <opie2/odebug.h> +#include <qtopia/qprocess.h> #ifdef Q_WS_QWS #include <qtopia/qcopenvelope_qws.h> #endif +using namespace Opie::Core; +/* QT */ #ifdef Q_WS_QWS #include <qcopchannel_qws.h> #endif - #include <qtextstream.h> +/* STD */ #include <stdlib.h> #include <sys/stat.h> // mkdir() - #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) #include <unistd.h> #include <sys/vfs.h> #include <mntent.h> -#elif defined(Q_OS_WIN32) -#include <windows.h> -#include <winbase.h> #elif defined(Q_OS_MACX) #include <unistd.h> #endif PackageHandler::PackageHandler( QObject *parent, char* name ) @@ -142,13 +142,13 @@ void PackageHandler::addPackageFiles( const QString &location, //make a copy so we can remove the symlinks later mkdir( ("/usr/lib/ipkg/info/"+location).ascii(), 0777 ); system(("cp " + f.name() + " /usr/lib/ipkg/info/"+location).ascii()); #else QDir d; //#### revise - qDebug("Copy file at %s: %s", __FILE__, __LINE__ ); + odebug << "Copy file at " << __FILE__ << ": " << __LINE__ << "" << oendl; d.mkdir(("/usr/lib/ipkg/info/" + location).ascii()); system(("copy " + f.name() + " /usr/lib/ipkg/info/"+location).ascii()); #endif if ( f.open(IO_ReadOnly) ) { @@ -156,27 +156,27 @@ void PackageHandler::addPackageFiles( const QString &location, QString s; while ( !ts.eof() ) { // until end of file... s = ts.readLine(); // line of text excluding '\n' // for s, do link/mkdir. if ( s.right(1) == "/" ) { - qDebug("do mkdir for %s", s.ascii()); + odebug << "do mkdir for " << s.ascii() << "" << oendl; #ifndef Q_OS_WIN32 mkdir( s.ascii(), 0777 ); //possible optimization: symlink directories //that don't exist already. -- Risky. #else d.mkdir( s.ascii()); #endif } else { #ifndef Q_OS_WIN32 - qDebug("do symlink for %s", s.ascii()); + odebug << "do symlink for " << s.ascii() << "" << oendl; symlink( (location + s).ascii(), s.ascii() ); #else - qDebug("Copy file instead of a symlink for WIN32"); + odebug << "Copy file instead of a symlink for WIN32" << oendl; if (!CopyFile((TCHAR*)qt_winTchar((location + s), TRUE), (TCHAR*)qt_winTchar(s, TRUE), FALSE)) qWarning("Unable to create symlinkfor %s", (location + s).ascii()); #endif } } @@ -212,20 +212,20 @@ void PackageHandler::cleanupPackageFiles( const QString &listfile ) s = ts.readLine(); // line of text excluding '\n' // for s, do link/mkdir. if ( s.right(1) == "/" ) { //should rmdir if empty, after all files have been removed } else { #ifndef Q_OS_WIN32 - qDebug("remove symlink for %s", s.ascii()); + odebug << "remove symlink for " << s.ascii() << "" << oendl; //check if it is a symlink first (don't remove /etc/passwd...) char buf[10]; //we don't care about the contents if ( ::readlink( s.ascii(),buf, 10 >= 0 ) ) ::unlink( s.ascii() ); #else // ### revise - qWarning("Unable to remove symlink %s:%s", __FILE__, __LINE__); + owarn << "Unable to remove symlink " << __FILE__ << ":" << __LINE__ << "" << oendl; #endif } } f.close(); //remove the list file @@ -263,13 +263,13 @@ void PackageHandler::prepareInstall( const QString& size, const QString& path ) // Shamelessly stolen from the sysinfo application (Werner) #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) struct statfs fs; if ( statfs( path.latin1(), &fs ) == 0 ) if ( s > fs.f_bsize * fs.f_bavail ) { - //qDebug("############### Not enough space left ###############"); + //odebug << "############### Not enough space left ###############" << oendl; mNoSpaceLeft = TRUE; } #endif } void PackageHandler::iProcessExited() diff --git a/core/launcher/qcopbridge.cpp b/core/launcher/qcopbridge.cpp index 33df6c4..e339dc7 100644 --- a/core/launcher/qcopbridge.cpp +++ b/core/launcher/qcopbridge.cpp @@ -18,27 +18,30 @@ ** **********************************************************************/ #include "qcopbridge.h" #include "transferserver.h" +/* OPIE */ +#include <opie2/odebug.h> #include <opie2/oglobal.h> - #ifdef Q_WS_QWS #include <qtopia/qcopenvelope_qws.h> #endif #include <qtopia/qpeapplication.h> - #include <qtopia/version.h> +using namespace Opie::Core; +/* QT */ #include <qtextstream.h> #include <qtimer.h> #ifdef Q_WS_QWS #include <qcopchannel_qws.h> #endif +/* STD */ #ifndef _XOPEN_SOURCE #define _XOPEN_SOURCE #endif #ifndef Q_OS_WIN32 #include <pwd.h> #include <unistd.h> @@ -46,26 +49,22 @@ #endif #if defined(_OS_LINUX_) #include <shadow.h> #endif - -//#define INSECURE - const int block_size = 51200; -using namespace Opie::Core; QCopBridge::QCopBridge( Q_UINT16 port, QObject *parent, const char* name ) : QServerSocket( port, 1, parent, name ), desktopChannel( 0 ), 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 ); connect( desktopChannel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(desktopMessage(const QCString&,const QByteArray&)) ); cardChannel = new QCopChannel( "QPE/Card", this ); @@ -168,19 +167,19 @@ void QCopBridge::desktopMessage( const QCString &command, const QByteArray &data */ void QCopBridge::sendDesktopMessageOld( const QCString& command, const QByteArray& args) { command.stripWhiteSpace(); 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; } params.truncate( params.length()-1 ); QStringList paramList = QStringList::split( ",", params ); @@ -201,13 +200,13 @@ void QCopBridge::sendDesktopMessageOld( const QCString& command, const QByteArra str = QString::number( i ); } else if ( *it == "bool" ) { int i; 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; for (int i=0; i<(int)str.length(); i++) { QChar ch = str[i]; if ( ch.row() ) @@ -329,26 +328,26 @@ void QCopBridgePI::sendDesktopMessage( const QCString &msg, const QByteArray& da void QCopBridgePI::send( const QString& msg ) { if ( !isOpen() ) // eg. Forbidden return; QTextStream os( this ); os << msg << endl; - //qDebug( "sending qcop message: %s", msg.latin1() ); + //odebug << "sending qcop message: " << msg << "" << oendl; } void QCopBridgePI::read() { while ( canReadLine() ) { timer->start( 300000, TRUE ); process( readLine().stripWhiteSpace() ); } } 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 ); if ( msg.isEmpty() ) return; // command token diff --git a/core/launcher/qprocess.cpp b/core/launcher/qprocess.cpp index 97bd539..3fe1238 100644 --- a/core/launcher/qprocess.cpp +++ b/core/launcher/qprocess.cpp @@ -578,34 +578,34 @@ void QProcess::writeToStdin( const QString& buf ) */ /*! \reimp */ void QProcess::connectNotify( const char * signal ) { #if defined(QT_QPROCESS_DEBUG) - qDebug( "QProcess::connectNotify(): signal %s has been connected", signal ); + odebug << "QProcess::connectNotify(): signal " << signal << " has been connected" << oendl; #endif if ( !ioRedirection ) if ( qstrcmp( signal, SIGNAL(readyReadStdout()) )==0 || qstrcmp( signal, SIGNAL(readyReadStderr()) )==0 ) { #if defined(QT_QPROCESS_DEBUG) - qDebug( "QProcess::connectNotify(): set ioRedirection to TRUE" ); + odebug << "QProcess::connectNotify(): set ioRedirection to TRUE" << oendl; #endif setIoRedirection( TRUE ); return; } if ( !notifyOnExit && qstrcmp( signal, SIGNAL(processExited()) )==0 ) { #if defined(QT_QPROCESS_DEBUG) - qDebug( "QProcess::connectNotify(): set notifyOnExit to TRUE" ); + odebug << "QProcess::connectNotify(): set notifyOnExit to TRUE" << oendl; #endif setNotifyOnExit( TRUE ); return; } if ( !wroteToStdinConnected && qstrcmp( signal, SIGNAL(wroteToStdin()) )==0 ) { #if defined(QT_QPROCESS_DEBUG) - qDebug( "QProcess::connectNotify(): set wroteToStdinConnected to TRUE" ); + odebug << "QProcess::connectNotify(): set wroteToStdinConnected to TRUE" << oendl; #endif setWroteStdinConnected( TRUE ); return; } } @@ -615,25 +615,25 @@ void QProcess::disconnectNotify( const char * ) { if ( ioRedirection && receivers( SIGNAL(readyReadStdout()) ) ==0 && receivers( SIGNAL(readyReadStderr()) ) ==0 ) { #if defined(QT_QPROCESS_DEBUG) - qDebug( "QProcess::disconnectNotify(): set ioRedirection to FALSE" ); + odebug << "QProcess::disconnectNotify(): set ioRedirection to FALSE" << oendl; #endif setIoRedirection( FALSE ); } if ( notifyOnExit && receivers( SIGNAL(processExited()) ) == 0 ) { #if defined(QT_QPROCESS_DEBUG) - qDebug( "QProcess::disconnectNotify(): set notifyOnExit to FALSE" ); + odebug << "QProcess::disconnectNotify(): set notifyOnExit to FALSE" << oendl; #endif setNotifyOnExit( FALSE ); } if ( wroteToStdinConnected && receivers( SIGNAL(wroteToStdin()) ) == 0 ) { #if defined(QT_QPROCESS_DEBUG) - qDebug( "QProcess::disconnectNotify(): set wroteToStdinConnected to FALSE" ); + odebug << "QProcess::disconnectNotify(): set wroteToStdinConnected to FALSE" << oendl; #endif setWroteStdinConnected( FALSE ); } } #endif // QT_NO_PROCESS diff --git a/core/launcher/qprocess_unix.cpp b/core/launcher/qprocess_unix.cpp index 19a8c93..d62e4e6 100644 --- a/core/launcher/qprocess_unix.cpp +++ b/core/launcher/qprocess_unix.cpp @@ -15,48 +15,47 @@ ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ -//#include "qplatformdefs.h" - // Solaris redefines connect -> __xnet_connect with _XOPEN_SOURCE_EXTENDED. #if defined(connect) #undef connect #endif #include "qprocess.h" -#ifndef QT_NO_PROCESS +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; -#include "qapplication.h" -#include "qqueue.h" -#include "qlist.h" -#include "qsocketnotifier.h" -#include "qtimer.h" -#include "qregexp.h" +/* QT */ +#ifndef QT_NO_PROCESS +#include <qapplication.h> +#include <qqueue.h> +#include <qlist.h> +#include <qsocketnotifier.h> +#include <qtimer.h> +#include <qregexp.h> #include "qcleanuphandler_p.h" +/* STD */ #include <stdlib.h> - -// ### FOR Qt 2.3 compat #include <unistd.h> #include <signal.h> #include <sys/socket.h> #include <sys/ioctl.h> #include <sys/wait.h> #include <sys/fcntl.h> - +#include <sys/resource.h> #include <errno.h> - #ifdef Q_OS_MACX #include <sys/time.h> #endif -#include <sys/resource.h> #ifdef __MIPSEL__ # ifndef SOCK_DGRAM # define SOCK_DGRAM 1 # endif # ifndef SOCK_STREAM @@ -129,22 +128,22 @@ public: class QProc { public: QProc( pid_t p, QProcess *proc=0 ) : pid(p), process(proc) { #if defined(QT_QPROCESS_DEBUG) - qDebug( "QProc: Constructor for pid %d and QProcess %p", pid, process ); + odebug << "QProc: Constructor for pid " << pid << " and QProcess " << process << "" << oendl; #endif socketStdin = 0; socketStdout = 0; socketStderr = 0; } ~QProc() { #if defined(QT_QPROCESS_DEBUG) - qDebug( "QProc: Destructor for pid %d and QProcess %p", pid, process ); + odebug << "QProc: Destructor for pid " << pid << " and QProcess " << process << "" << oendl; #endif if ( process != 0 ) { if ( process->d->notifierStdin ) process->d->notifierStdin->setEnabled( FALSE ); if ( process->d->notifierStdout ) process->d->notifierStdout->setEnabled( FALSE ); @@ -210,52 +209,52 @@ QProcessManager::QProcessManager() // event reporting. if ( ::socketpair( AF_UNIX, SOCK_STREAM, 0, sigchldFd ) ) { sigchldFd[0] = 0; sigchldFd[1] = 0; } else { #if defined(QT_QPROCESS_DEBUG) - qDebug( "QProcessManager: install socket notifier (%d)", sigchldFd[1] ); + odebug << "QProcessManager: install socket notifier (" << sigchldFd[1] << ")" << oendl; #endif QSocketNotifier *sn = new QSocketNotifier( sigchldFd[1], QSocketNotifier::Read, this ); connect( sn, SIGNAL(activated(int)), this, SLOT(sigchldHnd(int)) ); sn->setEnabled( TRUE ); } // install a SIGCHLD handler and ignore SIGPIPE struct sigaction act; #if defined(QT_QPROCESS_DEBUG) - qDebug( "QProcessManager: install a SIGCHLD handler" ); + odebug << "QProcessManager: install a SIGCHLD handler" << oendl; #endif act.sa_handler = qt_C_sigchldHnd; sigemptyset( &(act.sa_mask) ); sigaddset( &(act.sa_mask), SIGCHLD ); act.sa_flags = SA_NOCLDSTOP; #if defined(SA_RESTART) act.sa_flags |= SA_RESTART; #endif if ( sigaction( SIGCHLD, &act, &oldactChld ) != 0 ) - qWarning( "Error installing SIGCHLD handler" ); + owarn << "Error installing SIGCHLD handler" << oendl; #if defined(QT_QPROCESS_DEBUG) - qDebug( "QProcessManager: install a SIGPIPE handler (SIG_IGN)" ); + odebug << "QProcessManager: install a SIGPIPE handler (SIG_IGN)" << oendl; #endif /* Using qt_C_sigpipeHnd rather than SIG_IGN is a workaround for a strange problem where GNU tar (called by backuprestore) would hang on filesystem-full. Strangely, the qt_C_sigpipeHnd is never even called, yet this avoids the hang. */ act.sa_handler = qt_C_sigpipeHnd; sigemptyset( &(act.sa_mask) ); sigaddset( &(act.sa_mask), SIGPIPE ); act.sa_flags = 0; if ( sigaction( SIGPIPE, &act, &oldactPipe ) != 0 ) - qWarning( "Error installing SIGPIPE handler" ); + owarn << "Error installing SIGPIPE handler" << oendl; } QProcessManager::~QProcessManager() { delete procList; @@ -263,37 +262,37 @@ QProcessManager::~QProcessManager() ::close( sigchldFd[0] ); if ( sigchldFd[1] != 0 ) ::close( sigchldFd[1] ); // restore SIGCHLD handler #if defined(QT_QPROCESS_DEBUG) - qDebug( "QProcessManager: restore old sigchild handler" ); + odebug << "QProcessManager: restore old sigchild handler" << oendl; #endif if ( sigaction( SIGCHLD, &oldactChld, 0 ) != 0 ) - qWarning( "Error restoring SIGCHLD handler" ); + owarn << "Error restoring SIGCHLD handler" << oendl; #if defined(QT_QPROCESS_DEBUG) - qDebug( "QProcessManager: restore old sigpipe handler" ); + odebug << "QProcessManager: restore old sigpipe handler" << oendl; #endif if ( sigaction( SIGPIPE, &oldactPipe, 0 ) != 0 ) - qWarning( "Error restoring SIGPIPE handler" ); + owarn << "Error restoring SIGPIPE handler" << oendl; } void QProcessManager::append( QProc *p ) { procList->append( p ); #if defined(QT_QPROCESS_DEBUG) - qDebug( "QProcessManager: append process (procList.count(): %d)", procList->count() ); + odebug << "QProcessManager: append process (procList.count(): " << procList->count() << ")" << oendl; #endif } void QProcessManager::remove( QProc *p ) { procList->remove( p ); #if defined(QT_QPROCESS_DEBUG) - qDebug( "QProcessManager: remove process (procList.count(): %d)", procList->count() ); + odebug << "QProcessManager: remove process (procList.count(): " << procList->count() << ")" << oendl; #endif cleanup(); } void QProcessManager::cleanup() { @@ -313,39 +312,39 @@ void QProcessManager::removeMe() void QProcessManager::sigchldHnd( int fd ) { char tmp; ::read( fd, &tmp, sizeof(tmp) ); #if defined(QT_QPROCESS_DEBUG) - qDebug( "QProcessManager::sigchldHnd()" ); + odebug << "QProcessManager::sigchldHnd()" << oendl; #endif QProc *proc; QProcess *process; bool removeProc; proc = procList->first(); while ( proc != 0 ) { removeProc = FALSE; process = proc->process; QProcess *process_exit_notify=0; if ( process != 0 ) { if ( !process->isRunning() ) { #if defined(QT_QPROCESS_DEBUG) - qDebug( "QProcessManager::sigchldHnd() (PID: %d): process exited (QProcess available)", proc->pid ); + odebug << "QProcessManager::sigchldHnd() (PID: " << proc->pid << "): process exited (QProcess available)" << oendl; #endif // read pending data int nbytes = 0; if ( ::ioctl(proc->socketStdout, FIONREAD, (char*)&nbytes)==0 && nbytes>0 ) { #if defined(QT_QPROCESS_DEBUG) - qDebug( "QProcessManager::sigchldHnd() (PID: %d): reading %d bytes of pending data on stdout", proc->pid, nbytes ); + odebug << "QProcessManager::sigchldHnd() (PID: " << proc->pid << "): reading " << nbytes << " bytes of pending data on stdout" << oendl; #endif process->socketRead( proc->socketStdout ); } nbytes = 0; if ( ::ioctl(proc->socketStderr, FIONREAD, (char*)&nbytes)==0 && nbytes>0 ) { #if defined(QT_QPROCESS_DEBUG) - qDebug( "QProcessManager::sigchldHnd() (PID: %d): reading %d bytes of pending data on stderr", proc->pid, nbytes ); + odebug << "QProcessManager::sigchldHnd() (PID: " << proc->pid << "): reading " << nbytes << " bytes of pending data on stderr" << oendl; #endif process->socketRead( proc->socketStderr ); } if ( process->notifyOnExit ) process_exit_notify = process; @@ -353,13 +352,13 @@ void QProcessManager::sigchldHnd( int fd ) removeProc = TRUE; } } else { int status; if ( ::waitpid( proc->pid, &status, WNOHANG ) == proc->pid ) { #if defined(QT_QPROCESS_DEBUG) - qDebug( "QProcessManager::sigchldHnd() (PID: %d): process exited (QProcess not available)", proc->pid ); + odebug << "QProcessManager::sigchldHnd() (PID: " << proc->pid << "): process exited (QProcess not available)" << oendl; #endif removeProc = TRUE; } } if ( removeProc ) { QProc *oldproc = proc; @@ -383,13 +382,13 @@ void QProcessManager::sigchldHnd( int fd ) **********************************************************************/ QProcessManager *QProcessPrivate::procManager = 0; QProcessPrivate::QProcessPrivate() { #if defined(QT_QPROCESS_DEBUG) - qDebug( "QProcessPrivate: Constructor" ); + odebug << "QProcessPrivate: Constructor" << oendl; #endif stdinBufRead = 0; notifierStdin = 0; notifierStdout = 0; notifierStderr = 0; @@ -400,13 +399,13 @@ QProcessPrivate::QProcessPrivate() proc = 0; } QProcessPrivate::~QProcessPrivate() { #if defined(QT_QPROCESS_DEBUG) - qDebug( "QProcessPrivate: Destructor" ); + odebug << "QProcessPrivate: Destructor" << oendl; #endif if ( proc != 0 ) { if ( proc->socketStdin != 0 ) { ::close( proc->socketStdin ); proc->socketStdin = 0; @@ -596,13 +595,13 @@ QProcess::~QProcess() \sa launch() closeStdin() */ bool QProcess::start( QStringList *env ) { #if defined(QT_QPROCESS_DEBUG) - qDebug( "QProcess::start()" ); + odebug << "QProcess::start()" << oendl; #endif reset(); int sStdin[2]; int sStdout[2]; int sStderr[2]; @@ -632,13 +631,13 @@ bool QProcess::start( QStringList *env ) const char** arglist = new const char*[ _arguments.count() + 1 ]; int i = 0; for ( QStringList::Iterator it = _arguments.begin(); it != _arguments.end(); ++it ) { arglistQ[i] = (*it).local8Bit(); arglist[i] = arglistQ[i]; #if defined(QT_QPROCESS_DEBUG) - qDebug( "QProcess::start(): arg %d = %s", i, arglist[i] ); + odebug << "QProcess::start(): arg " << i << " = " << arglist[i] << "" << oendl; #endif i++; } arglist[i] = 0; // Must make sure signal handlers are installed before exec'ing @@ -796,13 +795,13 @@ bool QProcess::start( QStringList *env ) delete[] arglistQ; delete[] arglist; return TRUE; error: #if defined(QT_QPROCESS_DEBUG) - qDebug( "QProcess::start(): error starting process" ); + odebug << "QProcess::start(): error starting process" << oendl; #endif if ( d->procManager ) d->procManager->cleanup(); if ( comms & Stdin ) { ::close( sStdin[1] ); ::close( sStdin[0] ); @@ -875,13 +874,13 @@ void QProcess::kill() const \sa normalExit() exitStatus() processExited() */ bool QProcess::isRunning() const { if ( d->exitValuesCalculated ) { #if defined(QT_QPROCESS_DEBUG) - qDebug( "QProcess::isRunning(): FALSE (already computed)" ); + odebug << "QProcess::isRunning(): FALSE (already computed)" << oendl; #endif return FALSE; } if ( d->proc == 0 ) return FALSE; int status; @@ -892,18 +891,18 @@ bool QProcess::isRunning() const that->exitNormal = WIFEXITED( status ) != 0; if ( exitNormal ) { that->exitStat = (char)WEXITSTATUS( status ); } d->exitValuesCalculated = TRUE; #if defined(QT_QPROCESS_DEBUG) - qDebug( "QProcess::isRunning() (PID: %d): FALSE", d->proc->pid ); + odebug << "QProcess::isRunning() (PID: " << d->proc->pid << "): FALSE" << oendl; #endif return FALSE; } #if defined(QT_QPROCESS_DEBUG) - qDebug( "QProcess::isRunning() (PID: %d): TRUE", d->proc->pid ); + odebug << "QProcess::isRunning() (PID: " << d->proc->pid << "): TRUE" << oendl; #endif return TRUE; } /*! Writes the data \a buf to the standard input of the process. The process may @@ -917,13 +916,13 @@ bool QProcess::isRunning() const \sa wroteToStdin() closeStdin() readStdout() readStderr() */ void QProcess::writeToStdin( const QByteArray& buf ) { #if defined(QT_QPROCESS_DEBUG) -// qDebug( "QProcess::writeToStdin(): write to stdin (%d)", d->socketStdin ); +// odebug << "QProcess::writeToStdin(): write to stdin (" << d->socketStdin << ")" << oendl; #endif d->stdinBuf.enqueue( new QByteArray(buf) ); if ( d->notifierStdin != 0 ) d->notifierStdin->setEnabled( TRUE ); } @@ -944,16 +943,16 @@ void QProcess::closeStdin() while ( !d->stdinBuf.isEmpty() ) { delete d->stdinBuf.dequeue(); } delete d->notifierStdin; d->notifierStdin = 0; if ( ::close( d->proc->socketStdin ) != 0 ) { - qWarning( "Could not close stdin of child process" ); + owarn << "Could not close stdin of child process" << oendl; } #if defined(QT_QPROCESS_DEBUG) - qDebug( "QProcess::closeStdin(): stdin (%d) closed", d->proc->socketStdin ); + odebug << "QProcess::closeStdin(): stdin (" << d->proc->socketStdin << ") closed" << oendl; #endif d->proc->socketStdin = 0; } } @@ -967,13 +966,13 @@ void QProcess::socketRead( int fd ) // the slots that are connected to the readyRead...() signals might // trigger a recursive call of socketRead(). Avoid this since you get a // blocking read otherwise. return; } #if defined(QT_QPROCESS_DEBUG) - qDebug( "QProcess::socketRead(): %d", fd ); + odebug << "QProcess::socketRead(): " << fd << "" << oendl; #endif if ( fd == 0 ) return; const int bufsize = 4096; QByteArray *buffer = 0; uint oldSize; @@ -996,23 +995,23 @@ void QProcess::socketRead( int fd ) else buffer->resize( oldSize ); // eof or error? if ( n == 0 || n == -1 ) { if ( fd == d->proc->socketStdout ) { #if defined(QT_QPROCESS_DEBUG) - qDebug( "QProcess::socketRead(): stdout (%d) closed", fd ); + odebug << "QProcess::socketRead(): stdout (" << fd << ") closed" << oendl; #endif 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) - qDebug( "QProcess::socketRead(): stderr (%d) closed", fd ); + 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; @@ -1058,13 +1057,13 @@ void QProcess::socketWrite( int fd ) return; if ( d->stdinBuf.isEmpty() ) { d->notifierStdin->setEnabled( FALSE ); return; } #if defined(QT_QPROCESS_DEBUG) - qDebug( "QProcess::socketWrite(): write to stdin (%d)", fd ); + 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; diff --git a/core/launcher/runningappbar.cpp b/core/launcher/runningappbar.cpp index 2e9d2a9..a25963f 100644 --- a/core/launcher/runningappbar.cpp +++ b/core/launcher/runningappbar.cpp @@ -17,21 +17,25 @@ ** not clear to you. ** ***********************************************************************/ #define QTOPIA_INTERNAL_PRELOADACCESS +#include "runningappbar.h" +#include "serverinterface.h" -#include <stdlib.h> +/* OPIE */ +#include <opie2/odebug.h> +#include <qtopia/qcopenvelope_qws.h> +using namespace Opie::Core; +/* QT */ #include <qpainter.h> -#include <qtopia/qcopenvelope_qws.h> - -#include "runningappbar.h" -#include "serverinterface.h" +/* STD */ +#include <stdlib.h> RunningAppBar::RunningAppBar(QWidget* parent) : QFrame(parent), selectedAppIndex(-1) { QCopChannel* channel = new QCopChannel( "QPE/System", this ); connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), @@ -48,37 +52,37 @@ void RunningAppBar::received(const QCString& msg, const QByteArray& data) { // Since fast apps appear and disappear without disconnecting from their // channel we need to watch for the showing/hiding events and update according. QDataStream stream( data, IO_ReadOnly ); if ( msg == "fastAppShowing(QString)") { QString appName; stream >> appName; - // qDebug("fastAppShowing %s", appName.data() ); + // odebug << "fastAppShowing " << appName.data() << "" << oendl; const AppLnk* f = ServerInterface::appLnks().findExec(appName); if ( f ) addTask(*f); } else if ( msg == "fastAppHiding(QString)") { QString appName; stream >> appName; const AppLnk* f = ServerInterface::appLnks().findExec(appName); if ( f ) removeTask(*f); } } void RunningAppBar::addTask(const AppLnk& appLnk) { - qDebug("Added %s to app list.", appLnk.name().latin1()); + odebug << "Added " << appLnk.name() << " to app list." << oendl; AppLnk* newApp = new AppLnk(appLnk); newApp->setExec(appLnk.exec()); appList.prepend(newApp); update(); } void RunningAppBar::removeTask(const AppLnk& appLnk) { unsigned int i = 0; for (; i < appList.count() ; i++) { AppLnk* target = appList.at(i); if (target->exec() == appLnk.exec()) { - qDebug("Removing %s from app list.", appLnk.name().latin1()); + odebug << "Removing " << appLnk.name() << " from app list." << oendl; appList.remove(); delete target; } } update(); } @@ -132,13 +136,13 @@ void RunningAppBar::paintEvent( QPaintEvent * ) QListIterator<AppLnk> it(appList); for (; it.current(); i++, ++it ) { if ( x + spacing <= width() ) { curApp = it.current(); - qWarning("Drawing %s", curApp->name().latin1() ); + owarn << "Drawing " << curApp->name() << "" << oendl; if ( (int)i == selectedAppIndex ) p.fillRect( x, y, spacing, curApp->pixmap().height()+1, colorGroup().highlight() ); else p.eraseRect( x, y, spacing, curApp->pixmap().height()+1 ); p.drawPixmap( x, y, curApp->pixmap() ); x += spacing; @@ -150,13 +154,13 @@ QSize RunningAppBar::sizeHint() const { return QSize( frameWidth(), AppLnk::smallIconSize()+frameWidth()*2+3 ); } void RunningAppBar::applicationLaunched(const QString &appName) { - qDebug("desktop:: app: %s launched with pid ", appName.data() ); + odebug << "desktop:: app: " << appName.data() << " launched with pid " << oendl; const AppLnk* newGuy = ServerInterface::appLnks().findExec(appName); if ( newGuy && !newGuy->isPreloaded() ) { addTask( *newGuy ); } } diff --git a/core/launcher/screensaver.cpp b/core/launcher/screensaver.cpp index 6aaab3a..a7d23c4 100644 --- a/core/launcher/screensaver.cpp +++ b/core/launcher/screensaver.cpp @@ -155,13 +155,13 @@ void OpieScreenSaver::setIntervals ( int dim, int lightoff, int suspend ) m_enable_dim = ( dim > 0 ); m_enable_lightoff = ( lightoff > 0 ); m_enable_suspend = ( suspend > 0 ); m_onlylcdoff = config.readBoolEntry ( "LcdOffOnly", false ); } - //qDebug("screen saver intervals: %d %d %d", dim, lightoff, suspend); + //odebug << "screen saver intervals: " << dim << " " << lightoff << " " << suspend << "" << oendl; v [ 0 ] = QMAX( 1000 * dim, 100 ); v [ 1 ] = QMAX( 1000 * lightoff, 100 ); v [ 2 ] = QMAX( 1000 * suspend, 100 ); v [ 3 ] = 0; diff --git a/core/launcher/server.cpp b/core/launcher/server.cpp index 9a86a80..b9fa1e5 100644 --- a/core/launcher/server.cpp +++ b/core/launcher/server.cpp @@ -33,41 +33,41 @@ #include "applauncher.h" #if 0 #include "suspendmonitor.h" #endif #include "documentlist.h" +/* OPIE */ +#include <opie2/odebug.h> +#include <opie2/odevicebutton.h> +#include <opie2/odevice.h> #include <qtopia/applnk.h> #include <qtopia/private/categories.h> #include <qtopia/mimetype.h> #include <qtopia/config.h> #include <qtopia/resource.h> #include <qtopia/version.h> #include <qtopia/storage.h> - #include <qtopia/qcopenvelope_qws.h> -#include <qwindowsystem_qws.h> -#include <qgfx_qws.h> #include <qtopia/global.h> -//#include <qtopia/custom.h> - -#include <opie2/odevicebutton.h> -#include <opie2/odevice.h> +using namespace Opie::Core; -#include <unistd.h> +/* QT */ #include <qmainwindow.h> #include <qmessagebox.h> #include <qtimer.h> #include <qtextstream.h> +#include <qwindowsystem_qws.h> +#include <qgfx_qws.h> +/* STD */ +#include <unistd.h> #include <stdlib.h> extern QRect qt_maxWindowRect; - -using namespace Opie::Core; static QWidget *calibrate(bool) { #ifdef Q_WS_QWS Calibrate *c = new Calibrate; c->show(); return c; @@ -326,13 +326,13 @@ void Server::systemMsg(const QCString &msg, const QByteArray &data) tsmMonitor->setTempMode(mode, pid); } #endif else if ( msg == "linkChanged(QString)" ) { QString link; stream >> link; - qDebug( "desktop.cpp systemMsg -> linkchanged( %s )", link.latin1() ); + odebug << "desktop.cpp systemMsg -> linkchanged( " << link << " )" << oendl; docList->linkChanged(link); } else if ( msg == "serviceChanged(QString)" ) { MimeType::updateApplications(); } else if ( msg == "mkdir(QString)" ) { QString dir; stream >> dir; @@ -431,13 +431,13 @@ void Server::systemMsg(const QCString &msg, const QByteArray &data) } else if ( msg == "setSyncDate(QString,QString)" ) { QString app, date; stream >> app >> date; Config cfg( "qpe" ); cfg.setGroup("SyncDate"); cfg.writeEntry( app, date ); - //qDebug("setSyncDate(QString,QString) %s %s", app.latin1(), date.latin1()); + //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(); @@ -569,13 +569,13 @@ bool Server::mkdir(const QString &localPath) QString dirSeps = "/"; int dirIndex = localPath.find(dirSeps); QString checkedPath; // didn't find any seps; weird, use the cur dir instead if (dirIndex == -1) { - //qDebug("No seperators found in path %s", localPath.latin1()); + //odebug << "No seperators found in path " << localPath << "" << oendl; checkedPath = QDir::currentDirPath(); } while (checkedPath != localPath) { // no more seperators found, use the local path if (dirIndex == -1) @@ -586,16 +586,16 @@ bool Server::mkdir(const QString &localPath) // advance the iterator; the next dir seperator dirIndex = localPath.find(dirSeps, dirIndex+1); } QDir checkDir(checkedPath); if (!checkDir.exists()) { - //qDebug("mkdir making dir %s", checkedPath.latin1()); + //odebug << "mkdir making dir " << checkedPath << "" << oendl; if (!checkDir.mkdir(checkedPath)) { - qDebug("Unable to make directory %s", checkedPath.latin1()); + odebug << "Unable to make directory " << checkedPath << "" << oendl; return FALSE; } } } return TRUE; @@ -667,13 +667,13 @@ void Server::terminateServers() transferServer = 0; qcopBridge = 0; } void Server::syncConnectionClosed( const QHostAddress & ) { - qDebug( "Lost sync connection" ); + odebug << "Lost sync connection" << oendl; delete syncDialog; syncDialog = 0; } void Server::pokeTimeMonitors() { diff --git a/core/launcher/serverapp.cpp b/core/launcher/serverapp.cpp index e4e16f2..cf543ce 100644 --- a/core/launcher/serverapp.cpp +++ b/core/launcher/serverapp.cpp @@ -16,49 +16,49 @@ ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "serverapp.h" +#include "screensaver.h" +/* OPIE */ +#include <opie2/odebug.h> #include <opie2/odevice.h> - #include <qtopia/password.h> #include <qtopia/config.h> #include <qtopia/power.h> #ifdef Q_WS_QWS #include <qtopia/qcopenvelope_qws.h> #endif #include <qtopia/global.h> -//#include <qtopia/custom.h> +using namespace Opie::Core; +/* QT */ #ifdef Q_WS_QWS #include <qgfx_qws.h> #endif -#ifdef Q_OS_WIN32 -#include <io.h> -#include <process.h> -#else -#include <unistd.h> -#endif #include <qmessagebox.h> #include <qtimer.h> #include <qpainter.h> #include <qfile.h> #include <qpixmapcache.h> +/* STD */ +#ifdef Q_OS_WIN32 +#include <io.h> +#include <process.h> +#else +#include <unistd.h> +#endif #include <stdlib.h> -#include "screensaver.h" static ServerApplication *serverApp = 0; static int loggedin=0; -using namespace Opie; - -using namespace Opie::Core; QCopKeyRegister::QCopKeyRegister() : m_keyCode( 0 ) { } QCopKeyRegister::QCopKeyRegister( int k, const QCString& c, const QCString& m ) :m_keyCode( k ), m_channel( c ), m_message( m ) { @@ -853,11 +853,11 @@ bool ServerApplication::isStarting() return ms_is_starting; } int ServerApplication::exec() { ms_is_starting = true; - qDebug("Serverapp - exec"); + odebug << "Serverapp - exec" << oendl; return QPEApplication::exec(); } #include "serverapp.moc" diff --git a/core/launcher/suspendmonitor.cpp b/core/launcher/suspendmonitor.cpp index f555e84..50bc56f 100644 --- a/core/launcher/suspendmonitor.cpp +++ b/core/launcher/suspendmonitor.cpp @@ -47,13 +47,13 @@ void TempScreenSaverMonitor::setTempMode(int mode, int pid) case QPEApplication::DisableSuspend: sStatus[2].append(pid); break; case QPEApplication::Enable: break; default: - qWarning("Unrecognized temp power setting. Ignored"); + owarn << "Unrecognized temp power setting. Ignored" << oendl; return; } updateAll(); } // Returns true if app had set a temp Mode earlier diff --git a/core/launcher/systray.cpp b/core/launcher/systray.cpp index 6cc1446..3c72d25 100644 --- a/core/launcher/systray.cpp +++ b/core/launcher/systray.cpp @@ -15,30 +15,28 @@ ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ +#include "systray.h" + +/* OPIE */ +#include <opie2/odebug.h> #include <qtopia/qpeapplication.h> #include <qtopia/qlibrary.h> #include <qtopia/config.h> +using namespace Opie::Core; +/* QT */ #include <qlayout.h> #include <qdir.h> -#include "systray.h" - +/* STD */ #include <stdlib.h> -/* ### Single build floppies ### */ -#if 0 -#ifdef QT_NO_COMPONENTS -#include "../plugins/applets/clockapplet/clockappletimpl.h" -#endif -#endif - SysTray::SysTray( QWidget *parent ) : QFrame( parent ), layout(0) { //setFrameStyle( QFrame::Panel | QFrame::Sunken ); loadApplets(); } @@ -109,13 +107,13 @@ void SysTray::addApplets() QStringList::Iterator it; int napplets=0; TaskbarApplet* *applets = new TaskbarApplet*[list.count()]; for ( it = list.begin(); it != list.end(); ++it ) { if ( exclude.find( *it ) != exclude.end() ) continue; - qWarning( "Found Applet: %s", (*it).latin1() ); + owarn << "Found Applet: " << (*it) << "" << oendl; TaskbarAppletInterface *iface = 0; QLibrary *lib = new QLibrary( path + "/" + *it ); if (( lib->queryInterface( IID_TaskbarApplet, (QUnknownInterface**)&iface ) == QS_OK ) && iface ) { TaskbarApplet *applet = new TaskbarApplet; applets[napplets++] = applet; applet->library = lib; diff --git a/core/launcher/taskbar.cpp b/core/launcher/taskbar.cpp index 91e2f20..86e0d0d 100644 --- a/core/launcher/taskbar.cpp +++ b/core/launcher/taskbar.cpp @@ -25,20 +25,23 @@ #include "wait.h" #include "appicons.h" #include "taskbar.h" #include "server.h" +/* OPIE */ +#include <opie2/odebug.h> #include <qtopia/config.h> #include <qtopia/qpeapplication.h> #ifdef QWS #include <qtopia/qcopenvelope_qws.h> #endif #include <qtopia/global.h> -//#include <qtopia/custom.h> +using namespace Opie::Core; +/* QT */ #include <qlabel.h> #include <qlayout.h> #include <qtimer.h> #ifdef QWS #include <qwindowsystem_qws.h> #endif @@ -282,13 +285,13 @@ void TaskBar::resizeEvent( QResizeEvent *e ) QHBox::resizeEvent( e ); if ( sysTray ) sysTray->show(); - qWarning("TaskBar::resize event"); + owarn << "TaskBar::resize event" << oendl; } void TaskBar::styleChange( QStyle &s ) { QHBox::styleChange( s ); calcMaxWindowRect(); diff --git a/core/launcher/transferserver.cpp b/core/launcher/transferserver.cpp index e32cf41..4b764e3 100644 --- a/core/launcher/transferserver.cpp +++ b/core/launcher/transferserver.cpp @@ -14,62 +14,51 @@ ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ -//#define _XOPEN_SOURCE +#include "transferserver.h" +/* OPIE */ +#include <opie2/odebug.h> #include <opie2/oglobal.h> +#include <qtopia/qprocess.h> +#include <qtopia/process.h> +#include <qtopia/private/contact.h> +#include <qtopia/version.h> +#ifdef Q_WS_QWS +#include <qtopia/qcopenvelope_qws.h> +#endif +using namespace Opie::Core; -#ifndef Q_OS_WIN32 +/* QT */ +#include <qtextstream.h> +#include <qmessagebox.h> + +/* STD */ #include <pwd.h> #include <sys/types.h> #include <unistd.h> #include <stdlib.h> #include <time.h> #ifndef Q_OS_MACX #include <shadow.h> #include <crypt.h> #endif /* Q_OS_MACX */ -#else -#include <stdlib.h> -#include <time.h> -#endif - - -#if defined(_OS_LINUX_) -#include <shadow.h> -#endif - -#include <qtextstream.h> -#include <qmessagebox.h> -//#include <qtopia/qcopchannel_qws.h> -#include <qtopia/process.h> -#include <qtopia/private/contact.h> -#include <qtopia/version.h> -#ifdef Q_WS_QWS -#include <qtopia/qcopenvelope_qws.h> -#endif - - -#include "transferserver.h" -#include <qtopia/qprocess.h> - const int block_size = 51200; -using namespace Opie::Core; TransferServer::TransferServer( Q_UINT16 port, QObject *parent, const char* name) : QServerSocket( port, 1, parent, name ) { connections.setAutoDelete( TRUE ); if ( !ok() ) - qWarning( "Failed to bind to port %d", port ); + owarn << "Failed to bind to port " << port << "" << oendl; } void TransferServer::authorizeConnections() { QListIterator<ServerPI> it(connections); while ( it.current() ) { @@ -368,21 +357,21 @@ bool ServerPI::verifyAuthorised() } return TRUE; } void ServerPI::connectionClosed() { - // qDebug( "Debug: Connection closed" ); + // odebug << "Debug: Connection closed" << oendl; emit connectionClosed(this); } void ServerPI::send( const QString& msg ) { QTextStream os( this ); os << msg << endl; - //qDebug( "Reply: %s", msg.latin1() ); + //odebug << "Reply: " << msg << "" << oendl; } void ServerPI::read() { while ( canReadLine() ) process( readLine().stripWhiteSpace() ); @@ -417,13 +406,13 @@ bool ServerPI::checkWriteFile( const QString& file ) return FALSE; return TRUE; } 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 ); if ( msg.isEmpty() ) return; // command token @@ -441,13 +430,13 @@ void ServerPI::process( const QString& message ) // FIXME: for Qt3 // copy.pop_front() copy.remove( copy.begin() ); args = copy.join( " " ); } - //qDebug( "args: %s", args.latin1() ); + //odebug << "args: " << args << "" << oendl; // we always respond to QUIT, regardless of state if ( cmd == "QUIT" ) { send( "211 Good bye!" ); // No tr close(); return; @@ -580,13 +569,13 @@ void ServerPI::process( const QString& message ) if ( !args.isEmpty() && checkReadFile( absFilePath( args ) ) || backupRestoreGzip( absFilePath( args ) ) ) { send( "150 File status okay" ); // No tr sendFile( absFilePath( args ) ); } else { - qDebug("550 Requested action not taken"); + odebug << "550 Requested action not taken" << oendl; send( "550 Requested action not taken" ); // No tr } // store (STOR) else if ( cmd == "STOR" ) if ( !args.isEmpty() && checkWriteFile( absFilePath( args ) ) ) { @@ -686,13 +675,13 @@ 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" ); // No tr } else { QDir dir; if ( dir.mkdir( absFilePath( args ), TRUE ) ) send( "250 Requested file action okay, completed." ); // No tr @@ -726,21 +715,21 @@ void ServerPI::process( const QString& message ) send( "213 " + QString::number( fi.size() ) ); else { Process duproc( QString("du") ); 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 { QString size = out.left( out.find("\t") ); int guess = size.toInt()/5; if ( filePath.contains("doc") ) // No tr guess *= 1000; - qDebug("sending back gzip guess of %d", guess); + odebug << "sending back gzip guess of " << guess << "" << oendl; send( "213 " + QString::number(guess) ); } } } } // name list (NLST) @@ -1023,38 +1012,38 @@ QString ServerPI::permissionString( QFileInfo *info ) return s; } void ServerPI::newConnection( int socket ) { - //qDebug( "New incomming connection" ); + //odebug << "New incomming connection" << oendl; if ( !passiv ) return; if ( wait[SendFile] ) { QStringList targets; if ( backupRestoreGzip( waitfile, targets ) ) dtp->sendGzipFile( waitfile, targets ); else dtp->sendFile( waitfile ); dtp->setSocket( socket ); } else if ( wait[RetrieveFile] ) { - qDebug("check retrieve file"); + odebug << "check retrieve file" << oendl; if ( backupRestoreGzip( waitfile ) ) dtp->retrieveGzipFile( waitfile ); else dtp->retrieveFile( waitfile, storFileSize ); dtp->setSocket( socket ); } else if ( wait[SendByteArray] ) { dtp->sendByteArray( waitarray ); dtp->setSocket( socket ); } else if ( wait[RetrieveByteArray] ) { - qDebug("retrieve byte array"); + odebug << "retrieve byte array" << oendl; dtp->retrieveByteArray(); dtp->setSocket( socket ); } else waitsocket = socket; @@ -1108,24 +1097,24 @@ ServerDTP::~ServerDTP() { buf.close(); if ( RetrieveFile == mode && file.isOpen() ) { // We're being shutdown before the client closed. file.close(); if ( recvFileSize >= 0 && (int)file.size() != recvFileSize ) { - qDebug( "STOR incomplete" ); + odebug << "STOR incomplete" << oendl; file.remove(); } } else { file.close(); } createTargzProc->kill(); } void ServerDTP::extractTarDone() { - qDebug("extract done"); + odebug << "extract done" << oendl; #ifndef QT_NO_COP QCopEnvelope e( "QPE/System", "restoreDone(QString)" ); e << file.name(); #endif } @@ -1137,13 +1126,13 @@ void ServerDTP::connected() if ( !file.exists() || !file.open( IO_ReadOnly) ) { emit failed(); mode = Idle; return; } - //qDebug( "Debug: Sending file '%s'", file.name().latin1() ); + //odebug << "Debug: Sending file '" << file.name() << "'" << oendl; bytes_written = 0; if ( file.size() == 0 ) { //make sure it doesn't hang on empty files file.close(); emit completed(); @@ -1158,30 +1147,30 @@ void ServerDTP::connected() } } break; 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() ) qWarning("Error starting %s", createTargzProc->arguments().join(" ").latin1()); break; case SendBuffer: if ( !buf.open( IO_ReadOnly) ) { emit failed(); mode = Idle; return; } - // qDebug( "Debug: Sending byte array" ); + // odebug << "Debug: Sending byte array" << oendl; bytes_written = 0; while( !buf.atEnd() ) putch( buf.getch() ); buf.close(); break; case RetrieveFile: @@ -1194,35 +1183,35 @@ void ServerDTP::connected() if ( !file.open( IO_WriteOnly) ) { emit failed(); 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 if ( !buf.open( IO_WriteOnly) ) { emit failed(); 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 ) { if ( bytes_written == file.size() ) emit completed(); else @@ -1238,22 +1227,22 @@ void ServerDTP::connectionClosed() } // retrieve file mode else if ( RetrieveFile == mode ) { file.close(); if ( recvFileSize >= 0 && (int)file.size() != recvFileSize ) { - qDebug( "STOR incomplete" ); + odebug << "STOR incomplete" << oendl; file.remove(); emit failed(); } else { emit completed(); } } else if ( RetrieveGzipFile == mode ) { - qDebug("Done writing ungzip file; closing input"); + odebug << "Done writing ungzip file; closing input" << oendl; retrieveTargzProc->flushStdin(); retrieveTargzProc->closeStdin(); } // retrieve buffer mode else if ( RetrieveBuffer == mode ) { @@ -1269,13 +1258,13 @@ void ServerDTP::bytesWritten( int bytes ) bytes_written += bytes; // send file mode 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; } else if( !file.atEnd() ) { QCString s; @@ -1286,13 +1275,13 @@ void ServerDTP::bytesWritten( int bytes ) } // send buffer mode 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; } } } @@ -1310,13 +1299,13 @@ void ServerDTP::readyRead() retrieveTargzProc->start(); QByteArray s; s.resize( bytesAvailable() ); readBlock( s.data(), bytesAvailable() ); retrieveTargzProc->writeToStdin( s ); - qDebug("wrote %d bytes to ungzip ", s.size() ); + odebug << "wrote " << s.size() << " bytes to ungzip " << oendl; } // retrieve buffer mode else if ( RetrieveBuffer == mode ) { QCString s; s.resize( bytesAvailable() ); readBlock( s.data(), bytesAvailable() ); @@ -1325,18 +1314,18 @@ void ServerDTP::readyRead() } void ServerDTP::writeTargzBlock() { QByteArray block = createTargzProc->readStdout(); writeBlock( block.data(), block.size() ); - qDebug("writeTargzBlock %d", block.size()); + odebug << "writeTargzBlock " << block.size() << "" << oendl; } void ServerDTP::targzDone() { - qDebug("tar and gzip done"); + odebug << "tar and gzip done" << oendl; emit completed(); mode = Idle; disconnect( createTargzProc, SIGNAL( readyReadStdout() ), this, SLOT( writeTargzBlock() ) ); } @@ -1367,13 +1356,13 @@ void ServerDTP::sendGzipFile( const QString &fn, mode = SendGzipFile; file.setName( fn ); QStringList args = "targzip"; //args += "-cv"; args += archiveTargets; - qDebug("sendGzipFile %s", args.join(" ").latin1() ); + odebug << "sendGzipFile " << args.join(" ") << "" << oendl; createTargzProc->setArguments( args ); connect( createTargzProc, SIGNAL( readyReadStdout() ), SLOT( writeTargzBlock() ) ); } void ServerDTP::retrieveFile( const QString fn, const QHostAddress& host, Q_UINT16 port, int fileSize ) @@ -1390,13 +1379,13 @@ void ServerDTP::retrieveFile( const QString fn, int fileSize ) file.setName( fn ); mode = RetrieveFile; } void ServerDTP::retrieveGzipFile( const QString &fn ) { - qDebug("retrieveGzipFile %s", fn.latin1()); + odebug << "retrieveGzipFile " << fn << "" << oendl; file.setName( fn ); mode = RetrieveGzipFile; retrieveTargzProc->setArguments( "targunzip" ); connect( retrieveTargzProc, SIGNAL( processExited() ), SLOT( extractTarDone() ) ); |