author | zecke <zecke> | 2003-08-28 14:32:22 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-08-28 14:32:22 (UTC) |
commit | f3c6caca7e96488ad9e1873e9c853f11b17a944e (patch) (unidiff) | |
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 | |||
@@ -24,13 +24,13 @@ | |||
24 | #ifndef QTOPIA_INTERNAL_FILEOPERATIONS | 24 | #ifndef QTOPIA_INTERNAL_FILEOPERATIONS |
25 | #define QTOPIA_INTERNAL_FILEOPERATIONS | 25 | #define QTOPIA_INTERNAL_FILEOPERATIONS |
26 | #endif | 26 | #endif |
27 | #ifndef QTOPIA_PROGRAM_MONITOR | 27 | #ifndef QTOPIA_PROGRAM_MONITOR |
28 | #define QTOPIA_PROGRAM_MONITOR | 28 | #define QTOPIA_PROGRAM_MONITOR |
29 | #endif | 29 | #endif |
30 | #include <qtopia/qpeglobal.h> | 30 | #include <qtopia/global.h> |
31 | 31 | ||
32 | #ifndef Q_OS_WIN32 | 32 | #ifndef Q_OS_WIN32 |
33 | #include <sys/stat.h> | 33 | #include <sys/stat.h> |
34 | #include <sys/wait.h> | 34 | #include <sys/wait.h> |
35 | #include <sys/file.h> | 35 | #include <sys/file.h> |
36 | #include <unistd.h> | 36 | #include <unistd.h> |
@@ -58,12 +58,13 @@ | |||
58 | #include <qtopia/qpeapplication.h> | 58 | #include <qtopia/qpeapplication.h> |
59 | #include <qtopia/config.h> | 59 | #include <qtopia/config.h> |
60 | #include <qtopia/global.h> | 60 | #include <qtopia/global.h> |
61 | 61 | ||
62 | #include "applauncher.h" | 62 | #include "applauncher.h" |
63 | #include "documentlist.h" | 63 | #include "documentlist.h" |
64 | #include "launcherglobal.h" | ||
64 | 65 | ||
65 | const int AppLauncher::RAISE_TIMEOUT_MS = 5000; | 66 | const int AppLauncher::RAISE_TIMEOUT_MS = 5000; |
66 | 67 | ||
67 | //--------------------------------------------------------------------------- | 68 | //--------------------------------------------------------------------------- |
68 | 69 | ||
69 | static AppLauncher* appLauncherPtr; | 70 | static AppLauncher* appLauncherPtr; |
@@ -72,13 +73,13 @@ const int appStopEventID = 1290; | |||
72 | 73 | ||
73 | class AppStoppedEvent : public QCustomEvent | 74 | class AppStoppedEvent : public QCustomEvent |
74 | { | 75 | { |
75 | public: | 76 | public: |
76 | AppStoppedEvent(int pid, int status) | 77 | AppStoppedEvent(int pid, int status) |
77 | : QCustomEvent( appStopEventID ), mPid(pid), mStatus(status) { } | 78 | : QCustomEvent( appStopEventID ), mPid(pid), mStatus(status) { } |
78 | 79 | ||
79 | int pid() { return mPid; } | 80 | int pid() { return mPid; } |
80 | int status() { return mStatus; } | 81 | int status() { return mStatus; } |
81 | 82 | ||
82 | private: | 83 | private: |
83 | int mPid, mStatus; | 84 | int mPid, mStatus; |
84 | }; | 85 | }; |
@@ -93,24 +94,24 @@ AppLauncher::AppLauncher(QObject *parent, const char *name) | |||
93 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 94 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), |
94 | this, SLOT(received(const QCString&, const QByteArray&)) ); | 95 | this, SLOT(received(const QCString&, const QByteArray&)) ); |
95 | 96 | ||
96 | channel = new QCopChannel( "QPE/Server", this ); | 97 | channel = new QCopChannel( "QPE/Server", this ); |
97 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 98 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), |
98 | this, SLOT(received(const QCString&, const QByteArray&)) ); | 99 | this, SLOT(received(const QCString&, const QByteArray&)) ); |
99 | 100 | ||
100 | #ifndef Q_OS_WIN32 | 101 | #ifndef Q_OS_WIN32 |
101 | signal(SIGCHLD, signalHandler); | 102 | signal(SIGCHLD, signalHandler); |
102 | #else | 103 | #else |
103 | runningAppsProc.setAutoDelete( TRUE ); | 104 | runningAppsProc.setAutoDelete( TRUE ); |
104 | #endif | 105 | #endif |
105 | QString tmp = qApp->argv()[0]; | 106 | QString tmp = qApp->argv()[0]; |
106 | int pos = tmp.findRev('/'); | 107 | int pos = tmp.findRev('/'); |
107 | if ( pos > -1 ) | 108 | if ( pos > -1 ) |
108 | tmp = tmp.mid(++pos); | 109 | tmp = tmp.mid(++pos); |
109 | runningApps[::getpid()] = tmp; | 110 | runningApps[::getpid()] = tmp; |
110 | 111 | ||
111 | appLauncherPtr = this; | 112 | appLauncherPtr = this; |
112 | 113 | ||
113 | QTimer::singleShot( 1000, this, SLOT(createQuickLauncher()) ); | 114 | QTimer::singleShot( 1000, this, SLOT(createQuickLauncher()) ); |
114 | } | 115 | } |
115 | 116 | ||
116 | AppLauncher::~AppLauncher() | 117 | AppLauncher::~AppLauncher() |
@@ -125,13 +126,13 @@ AppLauncher::~AppLauncher() | |||
125 | waitpid( qlPid, &status, 0 ); | 126 | waitpid( qlPid, &status, 0 ); |
126 | } | 127 | } |
127 | } | 128 | } |
128 | 129 | ||
129 | /* We use the QCopChannel of the app as an indicator of when it has been launched | 130 | /* We use the QCopChannel of the app as an indicator of when it has been launched |
130 | so that we can disable the busy indicators */ | 131 | so that we can disable the busy indicators */ |
131 | void AppLauncher::newQcopChannel(const QString& channelName) | 132 | void AppLauncher::newQcopChannel(const QString& channelName) |
132 | { | 133 | { |
133 | // qDebug("channel %s added", channelName.data() ); | 134 | // qDebug("channel %s added", channelName.data() ); |
134 | QString prefix("QPE/Application/"); | 135 | QString prefix("QPE/Application/"); |
135 | if (channelName.startsWith(prefix)) { | 136 | if (channelName.startsWith(prefix)) { |
136 | { | 137 | { |
137 | QCopEnvelope e("QPE/System", "newChannel(QString)"); | 138 | QCopEnvelope e("QPE/System", "newChannel(QString)"); |
@@ -148,13 +149,13 @@ void AppLauncher::newQcopChannel(const QString& channelName) | |||
148 | int pid = channelName.mid(18).toInt(); | 149 | int pid = channelName.mid(18).toInt(); |
149 | if (pid == qlPid) | 150 | if (pid == qlPid) |
150 | qlReady = TRUE; | 151 | qlReady = TRUE; |
151 | } | 152 | } |
152 | } | 153 | } |
153 | 154 | ||
154 | void AppLauncher::removedQcopChannel(const QString& channelName) | 155 | void AppLauncher::removedQcopChannel(const QString& channelName) |
155 | { | 156 | { |
156 | if (channelName.startsWith("QPE/Application/")) { | 157 | if (channelName.startsWith("QPE/Application/")) { |
157 | QCopEnvelope e("QPE/System", "removedChannel(QString)"); | 158 | QCopEnvelope e("QPE/System", "removedChannel(QString)"); |
158 | e << channelName; | 159 | e << channelName; |
159 | } | 160 | } |
160 | } | 161 | } |
@@ -256,13 +257,13 @@ bool AppLauncher::event(QEvent *e) | |||
256 | { | 257 | { |
257 | if ( e->type() == appStopEventID ) { | 258 | if ( e->type() == appStopEventID ) { |
258 | AppStoppedEvent *ae = (AppStoppedEvent *) e; | 259 | AppStoppedEvent *ae = (AppStoppedEvent *) e; |
259 | sigStopped(ae->pid(), ae->status() ); | 260 | sigStopped(ae->pid(), ae->status() ); |
260 | return TRUE; | 261 | return TRUE; |
261 | } | 262 | } |
262 | 263 | ||
263 | return QObject::event(e); | 264 | return QObject::event(e); |
264 | } | 265 | } |
265 | 266 | ||
266 | void AppLauncher::timerEvent( QTimerEvent *e ) | 267 | void AppLauncher::timerEvent( QTimerEvent *e ) |
267 | { | 268 | { |
268 | int id = e->timerId(); | 269 | int id = e->timerId(); |
@@ -279,17 +280,17 @@ void AppLauncher::timerEvent( QTimerEvent *e ) | |||
279 | // qDebug("Checking in on %s", appKillerName.latin1()); | 280 | // qDebug("Checking in on %s", appKillerName.latin1()); |
280 | 281 | ||
281 | // We store this incase the application responds while we're | 282 | // We store this incase the application responds while we're |
282 | // waiting for user input so we know not to delete ourselves. | 283 | // waiting for user input so we know not to delete ourselves. |
283 | appKillerBox = new QMessageBox(tr("Application Problem"), | 284 | appKillerBox = new QMessageBox(tr("Application Problem"), |
284 | tr("<p>%1 is not responding.</p>").arg(appKillerName) + | 285 | tr("<p>%1 is not responding.</p>").arg(appKillerName) + |
285 | tr("<p>Would you like to force the application to exit?</p>"), | 286 | tr("<p>Would you like to force the application to exit?</p>"), |
286 | QMessageBox::Warning, QMessageBox::Yes, | 287 | QMessageBox::Warning, QMessageBox::Yes, |
287 | QMessageBox::No | QMessageBox::Default, | 288 | QMessageBox::No | QMessageBox::Default, |
288 | QMessageBox::NoButton); | 289 | QMessageBox::NoButton); |
289 | if (appKillerBox->exec() == QMessageBox::Yes) { | 290 | if (appKillerBox->exec() == QMessageBox::Yes) { |
290 | // qDebug("Killing the app!!! Bwuhahahaha!"); | 291 | // qDebug("Killing the app!!! Bwuhahahaha!"); |
291 | int pid = pidForName(appKillerName); | 292 | int pid = pidForName(appKillerName); |
292 | if ( pid > 0 ) | 293 | if ( pid > 0 ) |
293 | kill( pid ); | 294 | kill( pid ); |
294 | } | 295 | } |
295 | appKillerName = QString::null; | 296 | appKillerName = QString::null; |
@@ -299,17 +300,17 @@ void AppLauncher::timerEvent( QTimerEvent *e ) | |||
299 | } | 300 | } |
300 | } | 301 | } |
301 | 302 | ||
302 | QObject::timerEvent( e ); | 303 | QObject::timerEvent( e ); |
303 | } | 304 | } |
304 | 305 | ||
305 | #ifndef Q_OS_WIN32 | 306 | #ifndef Q_OS_WIN32 |
306 | void AppLauncher::sigStopped(int sigPid, int sigStatus) | 307 | void AppLauncher::sigStopped(int sigPid, int sigStatus) |
307 | { | 308 | { |
308 | int exitStatus = 0; | 309 | int exitStatus = 0; |
309 | 310 | ||
310 | bool crashed = WIFSIGNALED(sigStatus); | 311 | bool crashed = WIFSIGNALED(sigStatus); |
311 | if ( !crashed ) { | 312 | if ( !crashed ) { |
312 | if ( WIFEXITED(sigStatus) ) | 313 | if ( WIFEXITED(sigStatus) ) |
313 | exitStatus = WEXITSTATUS(sigStatus); | 314 | exitStatus = WEXITSTATUS(sigStatus); |
314 | } else { | 315 | } else { |
315 | exitStatus = WTERMSIG(sigStatus); | 316 | exitStatus = WTERMSIG(sigStatus); |
@@ -361,18 +362,18 @@ void AppLauncher::sigStopped(int sigPid, int sigStatus) | |||
361 | QString exe = app->exec(); | 362 | QString exe = app->exec(); |
362 | apps.remove(exe); | 363 | apps.remove(exe); |
363 | cfg.writeEntry("Apps",apps,','); | 364 | cfg.writeEntry("Apps",apps,','); |
364 | preloadDisabled = TRUE; | 365 | preloadDisabled = TRUE; |
365 | } | 366 | } |
366 | 367 | ||
367 | // clean up | 368 | // clean up |
368 | if ( exitStatus ) { | 369 | if ( exitStatus ) { |
369 | QCopEnvelope e("QPE/System", "notBusy(QString)"); | 370 | QCopEnvelope e("QPE/System", "notBusy(QString)"); |
370 | e << app->exec(); | 371 | e << app->exec(); |
371 | } | 372 | } |
372 | /* | 373 | /* |
373 | // debug info | 374 | // debug info |
374 | for (it = runningApps.begin(); it != runningApps.end(); ++it) { | 375 | for (it = runningApps.begin(); it != runningApps.end(); ++it) { |
375 | qDebug("running according to internal list: %s, with pid %d", (*it).data(), it.key() ); | 376 | qDebug("running according to internal list: %s, with pid %d", (*it).data(), it.key() ); |
376 | } | 377 | } |
377 | */ | 378 | */ |
378 | 379 | ||
@@ -393,30 +394,31 @@ void AppLauncher::sigStopped(int sigPid, int sigStatus) | |||
393 | case SIGTERM: sig = "SIGTERM"; break; | 394 | case SIGTERM: sig = "SIGTERM"; break; |
394 | case SIGTRAP: sig = "SIGTRAP"; break; | 395 | case SIGTRAP: sig = "SIGTRAP"; break; |
395 | default: sig = QString("Unkown %1").arg(exitStatus); | 396 | default: sig = QString("Unkown %1").arg(exitStatus); |
396 | } | 397 | } |
397 | if ( preloadDisabled ) | 398 | if ( preloadDisabled ) |
398 | sig += tr("<qt><p>Fast loading has been disabled for this application. Tap and hold the application icon to reenable it.</qt>"); | 399 | sig += tr("<qt><p>Fast loading has been disabled for this application. Tap and hold the application icon to reenable it.</qt>"); |
399 | 400 | ||
400 | QString str = tr("<qt><b>%1</b> was terminated due to signal code %2</qt>").arg( app->name() ).arg( sig ); | 401 | QString str = tr("<qt><b>%1</b> was terminated due to signal code %2</qt>").arg( app->name() ).arg( sig ); |
401 | QMessageBox::information(0, tr("Application terminated"), str ); | 402 | QMessageBox::information(0, tr("Application terminated"), str ); |
402 | } else { | 403 | } else { |
403 | if ( exitStatus == 255 ) { //could not find app (because global returns -1) | 404 | if ( exitStatus == 255 ) { //could not find app (because global returns -1) |
404 | QMessageBox::information(0, tr("Application not found"), tr("<qt>Could not locate application <b>%1</b></qt>").arg( app->exec() ) ); | 405 | QMessageBox::information(0, tr("Application not found"), tr("<qt>Could not locate application <b>%1</b></qt>").arg( app->exec() ) ); |
405 | } else { | 406 | } else { |
406 | QFileInfo fi(Global::tempDir() + "qcop-msg-" + appName); | 407 | QFileInfo fi(Opie::Global::tempDir() + "qcop-msg-" + appName); |
407 | if ( fi.exists() && fi.size() ) { | 408 | if ( fi.exists() && fi.size() ) { |
408 | emit terminated(sigPid, appName); | 409 | emit terminated(sigPid, appName); |
409 | execute( appName, QString::null ); | 410 | qWarning("Re executing obmitted for %s", appName.latin1() ); |
411 | // execute( appName, QString::null ); | ||
410 | return; | 412 | return; |
411 | } | 413 | } |
412 | } | 414 | } |
413 | } | 415 | } |
414 | 416 | ||
415 | #endif | 417 | #endif |
416 | 418 | ||
417 | emit terminated(sigPid, appName); | 419 | emit terminated(sigPid, appName); |
418 | } | 420 | } |
419 | #else | 421 | #else |
420 | void AppLauncher::sigStopped(int sigPid, int sigStatus) | 422 | void AppLauncher::sigStopped(int sigPid, int sigStatus) |
421 | { | 423 | { |
422 | qDebug("Unhandled signal : AppLauncher::sigStopped(int sigPid, int sigStatus)"); | 424 | qDebug("Unhandled signal : AppLauncher::sigStopped(int sigPid, int sigStatus)"); |
@@ -441,15 +443,15 @@ bool AppLauncher::isRunning(const QString &app) | |||
441 | 443 | ||
442 | return FALSE; | 444 | return FALSE; |
443 | } | 445 | } |
444 | 446 | ||
445 | bool AppLauncher::executeBuiltin(const QString &c, const QString &document) | 447 | bool AppLauncher::executeBuiltin(const QString &c, const QString &document) |
446 | { | 448 | { |
447 | Global::Command* builtin = Global::builtinCommands(); | 449 | Global::Command* builtin = Opie::Global::builtinCommands(); |
448 | QGuardedPtr<QWidget> *running = Global::builtinRunning(); | 450 | QGuardedPtr<QWidget> *running = Opie::Global::builtinRunning(); |
449 | 451 | ||
450 | // Attempt to execute the app using a builtin class for the app | 452 | // Attempt to execute the app using a builtin class for the app |
451 | if (builtin) { | 453 | if (builtin) { |
452 | for (int i = 0; builtin[i].file; i++) { | 454 | for (int i = 0; builtin[i].file; i++) { |
453 | if ( builtin[i].file == c ) { | 455 | if ( builtin[i].file == c ) { |
454 | if ( running[i] ) { | 456 | if ( running[i] ) { |
455 | if ( !document.isNull() && builtin[i].documentary ) | 457 | if ( !document.isNull() && builtin[i].documentary ) |
@@ -480,29 +482,30 @@ bool AppLauncher::executeBuiltin(const QString &c, const QString &document) | |||
480 | 482 | ||
481 | return FALSE; | 483 | return FALSE; |
482 | } | 484 | } |
483 | 485 | ||
484 | bool AppLauncher::execute(const QString &c, const QString &docParam, bool noRaise) | 486 | bool AppLauncher::execute(const QString &c, const QString &docParam, bool noRaise) |
485 | { | 487 | { |
488 | qWarning("AppLauncher::execute"); | ||
486 | // Convert the command line in to a list of arguments | 489 | // Convert the command line in to a list of arguments |
487 | QStringList list = QStringList::split(QRegExp(" *"),c); | 490 | QStringList list = QStringList::split(QRegExp(" *"),c); |
488 | if ( !docParam.isEmpty() ) | 491 | if ( !docParam.isEmpty() ) |
489 | list.append( docParam ); | 492 | list.append( docParam ); |
490 | 493 | ||
491 | QString appName = list[0]; | 494 | QString appName = list[0]; |
492 | if ( isRunning(appName) ) { | 495 | if ( isRunning(appName) ) { |
493 | QCString channel = "QPE/Application/"; | 496 | QCString channel = "QPE/Application/"; |
494 | channel += appName.latin1(); | 497 | channel += appName.latin1(); |
495 | 498 | ||
496 | // Need to lock it to avoid race conditions with QPEApplication::processQCopFile | 499 | // Need to lock it to avoid race conditions with QPEApplication::processQCopFile |
497 | QFile f(Global::tempDir() + "qcop-msg-" + appName); | 500 | QFile f(Opie::Global::tempDir() + "qcop-msg-" + appName); |
498 | if ( !noRaise && f.open(IO_WriteOnly | IO_Append) ) { | 501 | if ( !noRaise && f.open(IO_WriteOnly | IO_Append) ) { |
499 | #ifndef Q_OS_WIN32 | 502 | #ifndef Q_OS_WIN32 |
500 | flock(f.handle(), LOCK_EX); | 503 | flock(f.handle(), LOCK_EX); |
501 | #endif | 504 | #endif |
502 | 505 | ||
503 | QDataStream ds(&f); | 506 | QDataStream ds(&f); |
504 | QByteArray b; | 507 | QByteArray b; |
505 | QDataStream bstream(b, IO_WriteOnly); | 508 | QDataStream bstream(b, IO_WriteOnly); |
506 | if ( !f.size() ) { | 509 | if ( !f.size() ) { |
507 | ds << channel << QCString("raise()") << b; | 510 | ds << channel << QCString("raise()") << b; |
508 | if ( !waitingHeartbeat.contains( appName ) && appKillerName != appName ) { | 511 | if ( !waitingHeartbeat.contains( appName ) && appKillerName != appName ) { |
@@ -520,18 +523,18 @@ bool AppLauncher::execute(const QString &c, const QString &docParam, bool noRais | |||
520 | flock(f.handle(), LOCK_UN); | 523 | flock(f.handle(), LOCK_UN); |
521 | #endif | 524 | #endif |
522 | f.close(); | 525 | f.close(); |
523 | } | 526 | } |
524 | if ( QCopChannel::isRegistered(channel) ) // avoid unnecessary warnings | 527 | if ( QCopChannel::isRegistered(channel) ) // avoid unnecessary warnings |
525 | QCopChannel::send(channel,"QPEProcessQCop()"); | 528 | QCopChannel::send(channel,"QPEProcessQCop()"); |
526 | 529 | ||
527 | return TRUE; | 530 | return TRUE; |
528 | } | 531 | } |
529 | 532 | ||
530 | #ifdef QT_NO_QWS_MULTIPROCESS | 533 | #ifdef QT_NO_QWS_MULTIPROCESS |
531 | QMessageBox::warning( 0, tr("Error"), tr("Could not find the application %1").arg(c), | 534 | QMessageBox::warning( 0, tr("Error"), tr("<qt>Could not find the application %1</qt>").arg(c), |
532 | tr("OK"), 0, 0, 0, 1 ); | 535 | tr("OK"), 0, 0, 0, 1 ); |
533 | #else | 536 | #else |
534 | 537 | ||
535 | QStrList slist; | 538 | QStrList slist; |
536 | unsigned j; | 539 | unsigned j; |
537 | for ( j = 0; j < list.count(); j++ ) | 540 | for ( j = 0; j < list.count(); j++ ) |
@@ -582,13 +585,13 @@ bool AppLauncher::execute(const QString &c, const QString &docParam, bool noRais | |||
582 | if (!proc->start()){ | 585 | if (!proc->start()){ |
583 | qDebug("Unable to start application %s", args[0]); | 586 | qDebug("Unable to start application %s", args[0]); |
584 | }else{ | 587 | }else{ |
585 | PROCESS_INFORMATION *procInfo = (PROCESS_INFORMATION *)proc->processIdentifier(); | 588 | PROCESS_INFORMATION *procInfo = (PROCESS_INFORMATION *)proc->processIdentifier(); |
586 | if (procInfo){ | 589 | if (procInfo){ |
587 | DWORD pid = procInfo->dwProcessId; | 590 | DWORD pid = procInfo->dwProcessId; |
588 | runningApps[pid] = QString(args[0]); | 591 | runningApps[pid] = QString(args[0]); |
589 | runningAppsProc.append(proc); | 592 | runningAppsProc.append(proc); |
590 | emit launched(pid, QString(args[0])); | 593 | emit launched(pid, QString(args[0])); |
591 | QCopEnvelope e("QPE/System", "busy()"); | 594 | QCopEnvelope e("QPE/System", "busy()"); |
592 | }else{ | 595 | }else{ |
593 | qDebug("Unable to read process inforation #1 for %s", args[0]); | 596 | qDebug("Unable to read process inforation #1 for %s", args[0]); |
594 | } | 597 | } |
@@ -632,12 +635,16 @@ int AppLauncher::pidForName( const QString &appName ) | |||
632 | 635 | ||
633 | return pid; | 636 | return pid; |
634 | } | 637 | } |
635 | 638 | ||
636 | void AppLauncher::createQuickLauncher() | 639 | void AppLauncher::createQuickLauncher() |
637 | { | 640 | { |
641 | static bool disabled = FALSE; | ||
642 | if (disabled) | ||
643 | return; | ||
644 | |||
638 | qlReady = FALSE; | 645 | qlReady = FALSE; |
639 | qlPid = ::vfork(); | 646 | qlPid = ::vfork(); |
640 | if ( !qlPid ) { | 647 | if ( !qlPid ) { |
641 | char **args = new char *[2]; | 648 | char **args = new char *[2]; |
642 | args[0] = "quicklauncher"; | 649 | args[0] = "quicklauncher"; |
643 | args[1] = 0; | 650 | args[1] = 0; |
@@ -645,12 +652,14 @@ void AppLauncher::createQuickLauncher() | |||
645 | ::close( fd ); | 652 | ::close( fd ); |
646 | ::setpgid( ::getpid(), ::getppid() ); | 653 | ::setpgid( ::getpid(), ::getppid() ); |
647 | // Try bindir first, so that foo/bar works too | 654 | // Try bindir first, so that foo/bar works too |
648 | setenv( "LD_BIND_NOW", "1", 1 ); | 655 | setenv( "LD_BIND_NOW", "1", 1 ); |
649 | ::execv( QPEApplication::qpeDir()+"bin/quicklauncher", args ); | 656 | ::execv( QPEApplication::qpeDir()+"bin/quicklauncher", args ); |
650 | ::execvp( "quicklauncher", args ); | 657 | ::execvp( "quicklauncher", args ); |
658 | delete []args; | ||
659 | disabled = TRUE; | ||
651 | _exit( -1 ); | 660 | _exit( -1 ); |
652 | } else if ( qlPid == -1 ) { | 661 | } else if ( qlPid == -1 ) { |
653 | qlPid = 0; | 662 | qlPid = 0; |
654 | } else { | 663 | } else { |
655 | if ( getuid() == 0 ) | 664 | if ( getuid() == 0 ) |
656 | setpriority( PRIO_PROCESS, qlPid, 19 ); | 665 | setpriority( PRIO_PROCESS, qlPid, 19 ); |
@@ -668,13 +677,13 @@ void AppLauncher::processExited() | |||
668 | qDebug("Interanl error NULL proc"); | 677 | qDebug("Interanl error NULL proc"); |
669 | return; | 678 | return; |
670 | } | 679 | } |
671 | 680 | ||
672 | QString appName = proc->arguments()[0]; | 681 | QString appName = proc->arguments()[0]; |
673 | qDebug("Removing application %s", appName.latin1()); | 682 | qDebug("Removing application %s", appName.latin1()); |
674 | runningAppsProc.remove(proc); | 683 | runningAppsProc.remove(proc); |
675 | 684 | ||
676 | QMap<QString,int>::Iterator hbit = waitingHeartbeat.find(appName); | 685 | QMap<QString,int>::Iterator hbit = waitingHeartbeat.find(appName); |
677 | if ( hbit != waitingHeartbeat.end() ) { | 686 | if ( hbit != waitingHeartbeat.end() ) { |
678 | killTimer( *hbit ); | 687 | killTimer( *hbit ); |
679 | waitingHeartbeat.remove( hbit ); | 688 | waitingHeartbeat.remove( hbit ); |
680 | } | 689 | } |
@@ -696,10 +705,10 @@ void AppLauncher::processExited() | |||
696 | if (found){ | 705 | if (found){ |
697 | emit terminated(it.key(), it.data()); | 706 | emit terminated(it.key(), it.data()); |
698 | runningApps.remove(it.key()); | 707 | runningApps.remove(it.key()); |
699 | }else{ | 708 | }else{ |
700 | qDebug("Internal error application %s not listed as running", appName.latin1()); | 709 | qDebug("Internal error application %s not listed as running", appName.latin1()); |
701 | } | 710 | } |
702 | 711 | ||
703 | #endif | 712 | #endif |
704 | } | 713 | } |
705 | 714 | ||