author | mickeyl <mickeyl> | 2004-03-08 16:43:36 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-03-08 16:43:36 (UTC) |
commit | bad368ebceecc3dd976e8eb206c773b5df6d11ef (patch) (unidiff) | |
tree | 507629b85391f5245bbcb63a0dc73333c171ece1 | |
parent | 2599910741451f86323af10585c858d217a122d5 (diff) | |
download | opie-bad368ebceecc3dd976e8eb206c773b5df6d11ef.zip opie-bad368ebceecc3dd976e8eb206c773b5df6d11ef.tar.gz opie-bad368ebceecc3dd976e8eb206c773b5df6d11ef.tar.bz2 |
support launching applications with user defined arguments
-rw-r--r-- | core/launcher/applauncher.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/core/launcher/applauncher.cpp b/core/launcher/applauncher.cpp index 08a3cb4..efbf426 100644 --- a/core/launcher/applauncher.cpp +++ b/core/launcher/applauncher.cpp | |||
@@ -462,50 +462,51 @@ bool AppLauncher::executeBuiltin(const QString &c, const QString &document) | |||
462 | e << c; // that was quick ;-) | 462 | e << c; // that was quick ;-) |
463 | #endif | 463 | #endif |
464 | return TRUE; | 464 | return TRUE; |
465 | } | 465 | } |
466 | } | 466 | } |
467 | } | 467 | } |
468 | 468 | ||
469 | // Convert the command line in to a list of arguments | 469 | // Convert the command line in to a list of arguments |
470 | QStringList list = QStringList::split(QRegExp(" *"),c); | 470 | QStringList list = QStringList::split(QRegExp(" *"),c); |
471 | QString ap=list[0]; | 471 | QString ap=list[0]; |
472 | 472 | ||
473 | if ( ap == "suspend" ) { // No tr | 473 | if ( ap == "suspend" ) { // No tr |
474 | QWSServer::processKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE ); | 474 | QWSServer::processKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE ); |
475 | return TRUE; | 475 | return TRUE; |
476 | } | 476 | } |
477 | 477 | ||
478 | return FALSE; | 478 | return FALSE; |
479 | } | 479 | } |
480 | 480 | ||
481 | bool AppLauncher::execute(const QString &c, const QString &docParam, bool noRaise) | 481 | bool AppLauncher::execute(const QString &c, const QString &docParam, bool noRaise) |
482 | { | 482 | { |
483 | qWarning("AppLauncher::execute '%s' '%s'", (const char*) c, (const char*) docParam ); | 483 | qWarning("AppLauncher::execute '%s' '%s'", (const char*) c, (const char*) docParam ); |
484 | // Convert the command line in to a list of arguments | 484 | // Convert the command line in to a list of arguments |
485 | QStringList list = QStringList::split(QRegExp(" *"),c); | 485 | QStringList list = QStringList::split(QRegExp(" *"),c); |
486 | if ( !docParam.isEmpty() ) | 486 | QStringList arglist = QStringList::split(QRegExp(" *"),docParam); |
487 | list.append( docParam ); | 487 | for ( QStringList::Iterator it = arglist.begin(); it != arglist.end(); ++it ) |
488 | list.append( *it ); | ||
488 | 489 | ||
489 | QString appName = list[0]; | 490 | QString appName = list[0]; |
490 | if ( isRunning(appName) ) { | 491 | if ( isRunning(appName) ) { |
491 | QCString channel = "QPE/Application/"; | 492 | QCString channel = "QPE/Application/"; |
492 | channel += appName.latin1(); | 493 | channel += appName.latin1(); |
493 | 494 | ||
494 | // Need to lock it to avoid race conditions with QPEApplication::processQCopFile | 495 | // Need to lock it to avoid race conditions with QPEApplication::processQCopFile |
495 | QFile f(QString::fromLatin1("/tmp/qcop-msg-") + appName); | 496 | QFile f(QString::fromLatin1("/tmp/qcop-msg-") + appName); |
496 | if ( !noRaise && f.open(IO_WriteOnly | IO_Append) ) { | 497 | if ( !noRaise && f.open(IO_WriteOnly | IO_Append) ) { |
497 | #ifndef Q_OS_WIN32 | 498 | #ifndef Q_OS_WIN32 |
498 | flock(f.handle(), LOCK_EX); | 499 | flock(f.handle(), LOCK_EX); |
499 | #endif | 500 | #endif |
500 | 501 | ||
501 | QDataStream ds(&f); | 502 | QDataStream ds(&f); |
502 | QByteArray b; | 503 | QByteArray b; |
503 | QDataStream bstream(b, IO_WriteOnly); | 504 | QDataStream bstream(b, IO_WriteOnly); |
504 | if ( !f.size() ) { | 505 | if ( !f.size() ) { |
505 | ds << channel << QCString("raise()") << b; | 506 | ds << channel << QCString("raise()") << b; |
506 | if ( !waitingHeartbeat.contains( appName ) && appKillerName != appName ) { | 507 | if ( !waitingHeartbeat.contains( appName ) && appKillerName != appName ) { |
507 | int id = startTimer(RAISE_TIMEOUT_MS); | 508 | int id = startTimer(RAISE_TIMEOUT_MS); |
508 | waitingHeartbeat.insert( appName, id ); | 509 | waitingHeartbeat.insert( appName, id ); |
509 | } | 510 | } |
510 | } | 511 | } |
511 | if ( !docParam.isEmpty() ) { | 512 | if ( !docParam.isEmpty() ) { |