author | mickeyl <mickeyl> | 2004-03-08 16:43:36 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-03-08 16:43:36 (UTC) |
commit | bad368ebceecc3dd976e8eb206c773b5df6d11ef (patch) (side-by-side diff) | |
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 @@ -438,98 +438,99 @@ bool AppLauncher::isRunning(const QString &app) return FALSE; } bool AppLauncher::executeBuiltin(const QString &c, const QString &document) { Global::Command* builtin = OGlobal::builtinCommands(); QGuardedPtr<QWidget> *running = OGlobal::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); running[i]->raise(); running[i]->show(); running[i]->setActiveWindow(); } else { running[i] = builtin[i].func( builtin[i].maximized ); } #ifndef QT_NO_COP QCopEnvelope e("QPE/System", "notBusy(QString)" ); e << c; // that was quick ;-) #endif return TRUE; } } } // Convert the command line in to a list of arguments QStringList list = QStringList::split(QRegExp(" *"),c); QString ap=list[0]; if ( ap == "suspend" ) { // No tr QWSServer::processKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE ); return TRUE; } return FALSE; } bool AppLauncher::execute(const QString &c, const QString &docParam, bool noRaise) { qWarning("AppLauncher::execute '%s' '%s'", (const char*) c, (const char*) docParam ); // Convert the command line in to a list of arguments QStringList list = QStringList::split(QRegExp(" *"),c); - if ( !docParam.isEmpty() ) - list.append( docParam ); + QStringList arglist = QStringList::split(QRegExp(" *"),docParam); + for ( QStringList::Iterator it = arglist.begin(); it != arglist.end(); ++it ) + list.append( *it ); 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(QString::fromLatin1("/tmp/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); 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++ ) |