summaryrefslogtreecommitdiff
authoralwin <alwin>2004-02-21 13:24:51 (UTC)
committer alwin <alwin>2004-02-21 13:24:51 (UTC)
commit76b70b355d2c1c32c0f74e844e0654e39db2a175 (patch) (unidiff)
tree63b32f2e0e9cdcb38e5d23ccfc51b7989894297d
parent814c3c8957f25d1436ce0b63c4201bbd2f340e7f (diff)
downloadopie-76b70b355d2c1c32c0f74e844e0654e39db2a175.zip
opie-76b70b355d2c1c32c0f74e844e0654e39db2a175.tar.gz
opie-76b70b355d2c1c32c0f74e844e0654e39db2a175.tar.bz2
qcop-msg related stuff don't use tmpDirPath 'cause it isn't that good IMHO
first: content of $TEMP can change due login - so it may run into problems when searching for qcop-msg-* files second: TEMP will set by user. The user can set it to a wrong value so cop would fail. But we can mostly guarantee that /tmp will exists.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/applauncher.cpp4
-rw-r--r--core/launcher/main.cpp2
2 files changed, 3 insertions, 3 deletions
diff --git a/core/launcher/applauncher.cpp b/core/launcher/applauncher.cpp
index f161e98..a8779a5 100644
--- a/core/launcher/applauncher.cpp
+++ b/core/launcher/applauncher.cpp
@@ -374,65 +374,65 @@ void AppLauncher::sigStopped(int sigPid, int sigStatus)
374 for (it = runningApps.begin(); it != runningApps.end(); ++it) { 374 for (it = runningApps.begin(); it != runningApps.end(); ++it) {
375 qDebug("running according to internal list: %s, with pid %d", (*it).data(), it.key() ); 375 qDebug("running according to internal list: %s, with pid %d", (*it).data(), it.key() );
376 } 376 }
377*/ 377*/
378 378
379#ifdef QTOPIA_PROGRAM_MONITOR 379#ifdef QTOPIA_PROGRAM_MONITOR
380 if ( crashed ) { 380 if ( crashed ) {
381 QString sig; 381 QString sig;
382 switch( exitStatus ) { 382 switch( exitStatus ) {
383 case SIGABRT: sig = "SIGABRT"; break; 383 case SIGABRT: sig = "SIGABRT"; break;
384 case SIGALRM: sig = "SIGALRM"; break; 384 case SIGALRM: sig = "SIGALRM"; break;
385 case SIGBUS: sig = "SIGBUS"; break; 385 case SIGBUS: sig = "SIGBUS"; break;
386 case SIGFPE: sig = "SIGFPE"; break; 386 case SIGFPE: sig = "SIGFPE"; break;
387 case SIGHUP: sig = "SIGHUP"; break; 387 case SIGHUP: sig = "SIGHUP"; break;
388 case SIGILL: sig = "SIGILL"; break; 388 case SIGILL: sig = "SIGILL"; break;
389 case SIGKILL: sig = "SIGKILL"; break; 389 case SIGKILL: sig = "SIGKILL"; break;
390 case SIGPIPE: sig = "SIGPIPE"; break; 390 case SIGPIPE: sig = "SIGPIPE"; break;
391 case SIGQUIT: sig = "SIGQUIT"; break; 391 case SIGQUIT: sig = "SIGQUIT"; break;
392 case SIGSEGV: sig = "SIGSEGV"; break; 392 case SIGSEGV: sig = "SIGSEGV"; break;
393 case SIGTERM: sig = "SIGTERM"; break; 393 case SIGTERM: sig = "SIGTERM"; break;
394 case SIGTRAP: sig = "SIGTRAP"; break; 394 case SIGTRAP: sig = "SIGTRAP"; break;
395 default: sig = QString("Unkown %1").arg(exitStatus); 395 default: sig = QString("Unkown %1").arg(exitStatus);
396 } 396 }
397 if ( preloadDisabled ) 397 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>"); 398 sig += tr("<qt><p>Fast loading has been disabled for this application. Tap and hold the application icon to reenable it.</qt>");
399 399
400 QString str = tr("<qt><b>%1</b> was terminated due to signal code %2</qt>").arg( app->name() ).arg( sig ); 400 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 ); 401 QMessageBox::information(0, tr("Application terminated"), str );
402 } else { 402 } else {
403 if ( exitStatus == 255 ) { //could not find app (because global returns -1) 403 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() ) ); 404 QMessageBox::information(0, tr("Application not found"), tr("<qt>Could not locate application <b>%1</b></qt>").arg( app->exec() ) );
405 } else { 405 } else {
406 QFileInfo fi(OGlobal::tempDirPath() + "qcop-msg-" + appName); 406 QFileInfo fi(QString::fromLatin1("/tmp/qcop-msg-") + appName);
407 if ( fi.exists() && fi.size() ) { 407 if ( fi.exists() && fi.size() ) {
408 emit terminated(sigPid, appName); 408 emit terminated(sigPid, appName);
409 qWarning("Re executing obmitted for %s", appName.latin1() ); 409 qWarning("Re executing obmitted for %s", appName.latin1() );
410 // execute( appName, QString::null ); 410 // execute( appName, QString::null );
411 return; 411 return;
412 } 412 }
413 } 413 }
414 } 414 }
415 415
416#endif 416#endif
417 417
418 emit terminated(sigPid, appName); 418 emit terminated(sigPid, appName);
419} 419}
420#else 420#else
421void AppLauncher::sigStopped(int sigPid, int sigStatus) 421void AppLauncher::sigStopped(int sigPid, int sigStatus)
422{ 422{
423 qDebug("Unhandled signal : AppLauncher::sigStopped(int sigPid, int sigStatus)"); 423 qDebug("Unhandled signal : AppLauncher::sigStopped(int sigPid, int sigStatus)");
424} 424}
425#endif // Q_OS_WIN32 425#endif // Q_OS_WIN32
426 426
427bool AppLauncher::isRunning(const QString &app) 427bool AppLauncher::isRunning(const QString &app)
428{ 428{
429 for (QMap<int,QString>::ConstIterator it = runningApps.begin(); it != runningApps.end(); ++it) { 429 for (QMap<int,QString>::ConstIterator it = runningApps.begin(); it != runningApps.end(); ++it) {
430 if ( *it == app ) { 430 if ( *it == app ) {
431#ifdef Q_OS_UNIX 431#ifdef Q_OS_UNIX
432 pid_t t = ::__getpgid( it.key() ); 432 pid_t t = ::__getpgid( it.key() );
433 if ( t == -1 ) { 433 if ( t == -1 ) {
434 qDebug("appLauncher bug, %s believed running, but pid %d is not existing", app.data(), it.key() ); 434 qDebug("appLauncher bug, %s believed running, but pid %d is not existing", app.data(), it.key() );
435 runningApps.remove( it.key() ); 435 runningApps.remove( it.key() );
436 return FALSE; 436 return FALSE;
437 } 437 }
438#endif 438#endif
@@ -467,65 +467,65 @@ bool AppLauncher::executeBuiltin(const QString &c, const QString &document)
467#endif 467#endif
468 return TRUE; 468 return TRUE;
469 } 469 }
470 } 470 }
471 } 471 }
472 472
473 // Convert the command line in to a list of arguments 473 // Convert the command line in to a list of arguments
474 QStringList list = QStringList::split(QRegExp(" *"),c); 474 QStringList list = QStringList::split(QRegExp(" *"),c);
475 QString ap=list[0]; 475 QString ap=list[0];
476 476
477 if ( ap == "suspend" ) { // No tr 477 if ( ap == "suspend" ) { // No tr
478 QWSServer::processKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE ); 478 QWSServer::processKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE );
479 return TRUE; 479 return TRUE;
480 } 480 }
481 481
482 return FALSE; 482 return FALSE;
483} 483}
484 484
485bool AppLauncher::execute(const QString &c, const QString &docParam, bool noRaise) 485bool AppLauncher::execute(const QString &c, const QString &docParam, bool noRaise)
486{ 486{
487 qWarning("AppLauncher::execute"); 487 qWarning("AppLauncher::execute");
488 // Convert the command line in to a list of arguments 488 // Convert the command line in to a list of arguments
489 QStringList list = QStringList::split(QRegExp(" *"),c); 489 QStringList list = QStringList::split(QRegExp(" *"),c);
490 if ( !docParam.isEmpty() ) 490 if ( !docParam.isEmpty() )
491 list.append( docParam ); 491 list.append( docParam );
492 492
493 QString appName = list[0]; 493 QString appName = list[0];
494 if ( isRunning(appName) ) { 494 if ( isRunning(appName) ) {
495 QCString channel = "QPE/Application/"; 495 QCString channel = "QPE/Application/";
496 channel += appName.latin1(); 496 channel += appName.latin1();
497 497
498 // Need to lock it to avoid race conditions with QPEApplication::processQCopFile 498 // Need to lock it to avoid race conditions with QPEApplication::processQCopFile
499 QFile f(OGlobal::tempDirPath() + "qcop-msg-" + appName); 499 QFile f(QString::fromLatin1("/tmp/qcop-msg-") + appName);
500 if ( !noRaise && f.open(IO_WriteOnly | IO_Append) ) { 500 if ( !noRaise && f.open(IO_WriteOnly | IO_Append) ) {
501#ifndef Q_OS_WIN32 501#ifndef Q_OS_WIN32
502 flock(f.handle(), LOCK_EX); 502 flock(f.handle(), LOCK_EX);
503#endif 503#endif
504 504
505 QDataStream ds(&f); 505 QDataStream ds(&f);
506 QByteArray b; 506 QByteArray b;
507 QDataStream bstream(b, IO_WriteOnly); 507 QDataStream bstream(b, IO_WriteOnly);
508 if ( !f.size() ) { 508 if ( !f.size() ) {
509 ds << channel << QCString("raise()") << b; 509 ds << channel << QCString("raise()") << b;
510 if ( !waitingHeartbeat.contains( appName ) && appKillerName != appName ) { 510 if ( !waitingHeartbeat.contains( appName ) && appKillerName != appName ) {
511 int id = startTimer(RAISE_TIMEOUT_MS); 511 int id = startTimer(RAISE_TIMEOUT_MS);
512 waitingHeartbeat.insert( appName, id ); 512 waitingHeartbeat.insert( appName, id );
513 } 513 }
514 } 514 }
515 if ( !docParam.isEmpty() ) { 515 if ( !docParam.isEmpty() ) {
516 bstream << docParam; 516 bstream << docParam;
517 ds << channel << QCString("setDocument(QString)") << b; 517 ds << channel << QCString("setDocument(QString)") << b;
518 } 518 }
519 519
520 f.flush(); 520 f.flush();
521#ifndef Q_OS_WIN32 521#ifndef Q_OS_WIN32
522 flock(f.handle(), LOCK_UN); 522 flock(f.handle(), LOCK_UN);
523#endif 523#endif
524 f.close(); 524 f.close();
525 } 525 }
526 if ( QCopChannel::isRegistered(channel) ) // avoid unnecessary warnings 526 if ( QCopChannel::isRegistered(channel) ) // avoid unnecessary warnings
527 QCopChannel::send(channel,"QPEProcessQCop()"); 527 QCopChannel::send(channel,"QPEProcessQCop()");
528 528
529 return TRUE; 529 return TRUE;
530 } 530 }
531 531
diff --git a/core/launcher/main.cpp b/core/launcher/main.cpp
index bf06e75..9e53bb0 100644
--- a/core/launcher/main.cpp
+++ b/core/launcher/main.cpp
@@ -43,65 +43,65 @@
43#include <qtopia/qcopenvelope_qws.h> 43#include <qtopia/qcopenvelope_qws.h>
44#endif 44#endif
45#include <qtopia/alarmserver.h> 45#include <qtopia/alarmserver.h>
46 46
47#include <stdlib.h> 47#include <stdlib.h>
48#include <stdio.h> 48#include <stdio.h>
49#include <signal.h> 49#include <signal.h>
50#ifndef Q_OS_WIN32 50#ifndef Q_OS_WIN32
51#include <unistd.h> 51#include <unistd.h>
52#else 52#else
53#include <process.h> 53#include <process.h>
54#endif 54#endif
55 55
56#include "calibrate.h" 56#include "calibrate.h"
57 57
58 58
59#ifdef QT_QWS_LOGIN 59#ifdef QT_QWS_LOGIN
60#include "../login/qdmdialogimpl.h" 60#include "../login/qdmdialogimpl.h"
61#endif 61#endif
62 62
63#ifdef Q_WS_QWS 63#ifdef Q_WS_QWS
64#include <qkeyboard_qws.h> 64#include <qkeyboard_qws.h>
65#endif 65#endif
66 66
67#include <qmessagebox.h> 67#include <qmessagebox.h>
68#include <opie2/odevice.h> 68#include <opie2/odevice.h>
69 69
70using namespace Opie; 70using namespace Opie;
71 71
72 72
73static void cleanup() 73static void cleanup()
74{ 74{
75 QDir dir( OGlobal::tempDirPath(), "qcop-msg-*" ); 75 QDir dir( "/tmp", "qcop-msg-*" );
76 76
77 QStringList stale = dir.entryList(); 77 QStringList stale = dir.entryList();
78 QStringList::Iterator it; 78 QStringList::Iterator it;
79 for ( it = stale.begin(); it != stale.end(); ++it ) { 79 for ( it = stale.begin(); it != stale.end(); ++it ) {
80 dir.remove( *it ); 80 dir.remove( *it );
81 } 81 }
82} 82}
83 83
84static void refreshTimeZoneConfig() 84static void refreshTimeZoneConfig()
85{ 85{
86 /* ### FIXME timezone handling */ 86 /* ### FIXME timezone handling */
87#if 0 87#if 0
88 // We need to help WorldTime in setting up its configuration for 88 // We need to help WorldTime in setting up its configuration for
89 // the current translation 89 // the current translation
90 // BEGIN no tr 90 // BEGIN no tr
91 const char *defaultTz[] = { 91 const char *defaultTz[] = {
92 "America/New_York", 92 "America/New_York",
93 "America/Los_Angeles", 93 "America/Los_Angeles",
94 "Europe/Oslo", 94 "Europe/Oslo",
95 "Asia/Tokyo", 95 "Asia/Tokyo",
96 "Asia/Hong_Kong", 96 "Asia/Hong_Kong",
97 "Australia/Brisbane", 97 "Australia/Brisbane",
98 0 98 0
99 }; 99 };
100 // END no tr 100 // END no tr
101 101
102 TimeZone curZone; 102 TimeZone curZone;
103 QString zoneID; 103 QString zoneID;
104 int zoneIndex; 104 int zoneIndex;
105 Config cfg = Config( "WorldTime" ); 105 Config cfg = Config( "WorldTime" );
106 cfg.setGroup( "TimeZones" ); 106 cfg.setGroup( "TimeZones" );
107 if (!cfg.hasKey( "Zone0" )){ 107 if (!cfg.hasKey( "Zone0" )){