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 | 23 |
1 files changed, 16 insertions, 7 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 @@ -22,17 +22,17 @@ #define QTOPIA_INTERNAL_PRELOADACCESS #endif #ifndef QTOPIA_INTERNAL_FILEOPERATIONS #define QTOPIA_INTERNAL_FILEOPERATIONS #endif #ifndef QTOPIA_PROGRAM_MONITOR #define QTOPIA_PROGRAM_MONITOR #endif -#include <qtopia/qpeglobal.h> +#include <qtopia/global.h> #ifndef Q_OS_WIN32 #include <sys/stat.h> #include <sys/wait.h> #include <sys/file.h> #include <unistd.h> #include <sys/time.h> #include <sys/resource.h> @@ -56,16 +56,17 @@ #include <qtopia/qcopenvelope_qws.h> #include <qtopia/applnk.h> #include <qtopia/qpeapplication.h> #include <qtopia/config.h> #include <qtopia/global.h> #include "applauncher.h" #include "documentlist.h" +#include "launcherglobal.h" const int AppLauncher::RAISE_TIMEOUT_MS = 5000; //--------------------------------------------------------------------------- static AppLauncher* appLauncherPtr; const int appStopEventID = 1290; @@ -398,20 +399,21 @@ void AppLauncher::sigStopped(int sigPid, int sigStatus) 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 ); } else { 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(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; } } } #endif emit terminated(sigPid, appName); @@ -439,18 +441,18 @@ bool AppLauncher::isRunning(const QString &app) } } return FALSE; } 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) { for (int i = 0; builtin[i].file; i++) { if ( builtin[i].file == c ) { if ( running[i] ) { if ( !document.isNull() && builtin[i].documentary ) Global::setDocument(running[i], document); @@ -478,28 +480,29 @@ bool AppLauncher::executeBuiltin(const QString &c, const QString &document) return TRUE; } return FALSE; } 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); if ( !docParam.isEmpty() ) list.append( docParam ); QString appName = list[0]; if ( isRunning(appName) ) { 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; QDataStream bstream(b, IO_WriteOnly); @@ -523,17 +526,17 @@ 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 QStrList slist; unsigned j; for ( j = 0; j < list.count(); j++ ) slist.append( list[j].utf8() ); @@ -630,29 +633,35 @@ int AppLauncher::pidForName( const QString &appName ) } } return pid; } void AppLauncher::createQuickLauncher() { + static bool disabled = FALSE; + if (disabled) + return; + qlReady = FALSE; qlPid = ::vfork(); if ( !qlPid ) { char **args = new char *[2]; args[0] = "quicklauncher"; args[1] = 0; for ( int fd = 3; fd < 100; fd++ ) ::close( fd ); ::setpgid( ::getpid(), ::getppid() ); // Try bindir first, so that foo/bar works too setenv( "LD_BIND_NOW", "1", 1 ); ::execv( QPEApplication::qpeDir()+"bin/quicklauncher", args ); ::execvp( "quicklauncher", args ); + delete []args; + disabled = TRUE; _exit( -1 ); } else if ( qlPid == -1 ) { qlPid = 0; } else { if ( getuid() == 0 ) setpriority( PRIO_PROCESS, qlPid, 19 ); } } |