summaryrefslogtreecommitdiff
path: root/core/launcher/applauncher.cpp
Side-by-side diff
Diffstat (limited to 'core/launcher/applauncher.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/applauncher.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/launcher/applauncher.cpp b/core/launcher/applauncher.cpp
index d6f93da..0ac043b 100644
--- a/core/launcher/applauncher.cpp
+++ b/core/launcher/applauncher.cpp
@@ -501,97 +501,101 @@ bool AppLauncher::execute(const QString &c, const QString &docParam, bool noRais
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);
if ( !f.size() ) {
ds << channel << QCString("raise()") << b;
if ( !waitingHeartbeat.contains( appName ) && appKillerName != appName ) {
int id = startTimer(RAISE_TIMEOUT_MS);
waitingHeartbeat.insert( appName, id );
}
}
if ( !docParam.isEmpty() ) {
bstream << docParam;
ds << channel << QCString("setDocument(QString)") << b;
}
f.flush();
#ifndef Q_OS_WIN32
flock(f.handle(), LOCK_UN);
#endif
f.close();
}
if ( QCopChannel::isRegistered(channel) ) // avoid unnecessary warnings
QCopChannel::send(channel,"QPEProcessQCop()");
return TRUE;
}
#ifdef QT_NO_QWS_MULTIPROCESS
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() );
const char **args = new const char *[slist.count() + 1];
for ( j = 0; j < slist.count(); j++ )
args[j] = slist.at(j);
args[j] = NULL;
#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] );
if ( getuid() == 0 )
setpriority( PRIO_PROCESS, qlPid, 0 );
QCString qlch("QPE/QuickLauncher-");
qlch += QString::number(qlPid);
QCopEnvelope env( qlch, "execute(QStrList)" );
env << slist;
runningApps[qlPid] = QString(args[0]);
emit launched(qlPid, QString(args[0]));
QCopEnvelope e("QPE/System", "busy()");
qlPid = 0;
qlReady = FALSE;
QTimer::singleShot( getuid() == 0 ? 800 : 1500, this, SLOT(createQuickLauncher()) );
} else {
int pid = ::vfork();
if ( !pid ) {
for ( int fd = 3; fd < 100; fd++ )
::close( fd );
::setpgid( ::getpid(), ::getppid() );
// Try bindir first, so that foo/bar works too
::execv( QPEApplication::qpeDir()+"bin/"+args[0], (char * const *)args );
::execvp( args[0], (char * const *)args );
_exit( -1 );
}
runningApps[pid] = QString(args[0]);
emit launched(pid, QString(args[0]));
QCopEnvelope e("QPE/System", "busy()");
}
#else
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]);
}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]);
}