author | zecke <zecke> | 2003-08-28 14:32:22 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-08-28 14:32:22 (UTC) |
commit | f3c6caca7e96488ad9e1873e9c853f11b17a944e (patch) (side-by-side diff) | |
tree | 4a83c306c573d5185f20c0f96f89aeffa24e2e1d | |
parent | a069f32d9339fad02af60ac8aa991c3dee011039 (diff) | |
download | opie-f3c6caca7e96488ad9e1873e9c853f11b17a944e.zip opie-f3c6caca7e96488ad9e1873e9c853f11b17a944e.tar.gz opie-f3c6caca7e96488ad9e1873e9c853f11b17a944e.tar.bz2 |
Make conpile with Opie
If QuickApps exec fails don't try to start it anytime soon
If application fails to start and /tmp/qcop-msg- is present don't try to restart
-rw-r--r-- | core/launcher/applauncher.cpp | 69 |
1 files changed, 39 insertions, 30 deletions
diff --git a/core/launcher/applauncher.cpp b/core/launcher/applauncher.cpp index 50c1b71..d6f93da 100644 --- a/core/launcher/applauncher.cpp +++ b/core/launcher/applauncher.cpp @@ -28,5 +28,5 @@ #define QTOPIA_PROGRAM_MONITOR #endif -#include <qtopia/qpeglobal.h> +#include <qtopia/global.h> #ifndef Q_OS_WIN32 @@ -62,4 +62,5 @@ #include "applauncher.h" #include "documentlist.h" +#include "launcherglobal.h" const int AppLauncher::RAISE_TIMEOUT_MS = 5000; @@ -76,5 +77,5 @@ public: AppStoppedEvent(int pid, int status) : QCustomEvent( appStopEventID ), mPid(pid), mStatus(status) { } - + int pid() { return mPid; } int status() { return mStatus; } @@ -97,5 +98,5 @@ AppLauncher::AppLauncher(QObject *parent, const char *name) connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), this, SLOT(received(const QCString&, const QByteArray&)) ); - + #ifndef Q_OS_WIN32 signal(SIGCHLD, signalHandler); @@ -108,5 +109,5 @@ AppLauncher::AppLauncher(QObject *parent, const char *name) tmp = tmp.mid(++pos); runningApps[::getpid()] = tmp; - + appLauncherPtr = this; @@ -129,5 +130,5 @@ 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) +void AppLauncher::newQcopChannel(const QString& channelName) { // qDebug("channel %s added", channelName.data() ); @@ -152,5 +153,5 @@ void AppLauncher::newQcopChannel(const QString& channelName) } -void AppLauncher::removedQcopChannel(const QString& channelName) +void AppLauncher::removedQcopChannel(const QString& channelName) { if (channelName.startsWith("QPE/Application/")) { @@ -260,5 +261,5 @@ bool AppLauncher::event(QEvent *e) return TRUE; } - + return QObject::event(e); } @@ -283,9 +284,9 @@ void AppLauncher::timerEvent( QTimerEvent *e ) 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, + 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) { + if (appKillerBox->exec() == QMessageBox::Yes) { // qDebug("Killing the app!!! Bwuhahahaha!"); int pid = pidForName(appKillerName); @@ -303,9 +304,9 @@ void AppLauncher::timerEvent( QTimerEvent *e ) } -#ifndef Q_OS_WIN32 +#ifndef Q_OS_WIN32 void AppLauncher::sigStopped(int sigPid, int sigStatus) { int exitStatus = 0; - + bool crashed = WIFSIGNALED(sigStatus); if ( !crashed ) { @@ -365,10 +366,10 @@ void AppLauncher::sigStopped(int sigPid, int sigStatus) } - // clean up + // clean up if ( exitStatus ) { QCopEnvelope e("QPE/System", "notBusy(QString)"); e << app->exec(); } -/* +/* // debug info for (it = runningApps.begin(); it != runningApps.end(); ++it) { @@ -397,5 +398,5 @@ void AppLauncher::sigStopped(int sigPid, int sigStatus) if ( preloadDisabled ) sig += tr("<qt><p>Fast loading has been disabled for this application. Tap and hold the application icon to reenable it.</qt>"); - + QString str = tr("<qt><b>%1</b> was terminated due to signal code %2</qt>").arg( app->name() ).arg( sig ); QMessageBox::information(0, tr("Application terminated"), str ); @@ -404,8 +405,9 @@ void AppLauncher::sigStopped(int sigPid, int sigStatus) QMessageBox::information(0, tr("Application not found"), tr("<qt>Could not locate application <b>%1</b></qt>").arg( app->exec() ) ); } else { - QFileInfo fi(Global::tempDir() + "qcop-msg-" + appName); + QFileInfo fi(Opie::Global::tempDir() + "qcop-msg-" + appName); if ( fi.exists() && fi.size() ) { emit terminated(sigPid, appName); - execute( appName, QString::null ); + qWarning("Re executing obmitted for %s", appName.latin1() ); +// execute( appName, QString::null ); return; } @@ -414,5 +416,5 @@ void AppLauncher::sigStopped(int sigPid, int sigStatus) #endif - + emit terminated(sigPid, appName); } @@ -445,7 +447,7 @@ bool AppLauncher::isRunning(const QString &app) bool AppLauncher::executeBuiltin(const QString &c, const QString &document) { - Global::Command* builtin = Global::builtinCommands(); - QGuardedPtr<QWidget> *running = Global::builtinRunning(); - + Global::Command* builtin = Opie::Global::builtinCommands(); + QGuardedPtr<QWidget> *running = Opie::Global::builtinRunning(); + // Attempt to execute the app using a builtin class for the app if (builtin) { @@ -484,4 +486,5 @@ bool AppLauncher::executeBuiltin(const QString &c, const QString &document) bool AppLauncher::execute(const QString &c, const QString &docParam, bool noRaise) { + qWarning("AppLauncher::execute"); // Convert the command line in to a list of arguments QStringList list = QStringList::split(QRegExp(" *"),c); @@ -493,12 +496,12 @@ bool AppLauncher::execute(const QString &c, const QString &docParam, bool noRais QCString channel = "QPE/Application/"; channel += appName.latin1(); - + // Need to lock it to avoid race conditions with QPEApplication::processQCopFile - QFile f(Global::tempDir() + "qcop-msg-" + appName); + QFile f(Opie::Global::tempDir() + "qcop-msg-" + appName); if ( !noRaise && f.open(IO_WriteOnly | IO_Append) ) { #ifndef Q_OS_WIN32 flock(f.handle(), LOCK_EX); #endif - + QDataStream ds(&f); QByteArray b; @@ -524,10 +527,10 @@ bool AppLauncher::execute(const QString &c, const QString &docParam, bool noRais if ( QCopChannel::isRegistered(channel) ) // avoid unnecessary warnings QCopChannel::send(channel,"QPEProcessQCop()"); - + return TRUE; } #ifdef QT_NO_QWS_MULTIPROCESS - QMessageBox::warning( 0, tr("Error"), tr("Could not find the application %1").arg(c), + QMessageBox::warning( 0, tr("Error"), tr("<qt>Could not find the application %1</qt>").arg(c), tr("OK"), 0, 0, 0, 1 ); #else @@ -586,5 +589,5 @@ bool AppLauncher::execute(const QString &c, const QString &docParam, bool noRais if (procInfo){ DWORD pid = procInfo->dwProcessId; - runningApps[pid] = QString(args[0]); + runningApps[pid] = QString(args[0]); runningAppsProc.append(proc); emit launched(pid, QString(args[0])); @@ -636,4 +639,8 @@ int AppLauncher::pidForName( const QString &appName ) void AppLauncher::createQuickLauncher() { + static bool disabled = FALSE; + if (disabled) + return; + qlReady = FALSE; qlPid = ::vfork(); @@ -649,4 +656,6 @@ void AppLauncher::createQuickLauncher() ::execv( QPEApplication::qpeDir()+"bin/quicklauncher", args ); ::execvp( "quicklauncher", args ); + delete []args; + disabled = TRUE; _exit( -1 ); } else if ( qlPid == -1 ) { @@ -672,5 +681,5 @@ void AppLauncher::processExited() QString appName = proc->arguments()[0]; qDebug("Removing application %s", appName.latin1()); - runningAppsProc.remove(proc); + runningAppsProc.remove(proc); QMap<QString,int>::Iterator hbit = waitingHeartbeat.find(appName); @@ -700,5 +709,5 @@ void AppLauncher::processExited() qDebug("Internal error application %s not listed as running", appName.latin1()); } - + #endif } |