summaryrefslogtreecommitdiff
path: root/library
Side-by-side diff
Diffstat (limited to 'library') (more/less context) (show whitespace changes)
-rw-r--r--library/global.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/library/global.cpp b/library/global.cpp
index 7bdd0b1..1895006 100644
--- a/library/global.cpp
+++ b/library/global.cpp
@@ -519,81 +519,84 @@ void Global::terminate( const AppLnk* app )
if ( QCopChannel::isRegistered(channel) ) {
QCopEnvelope e(channel, "quit()");
}
#endif
}
/*!
Low-level function to run command \a c.
\warning Do not use this function. Use execute instead.
\sa execute()
*/
void Global::invoke(const QString &c)
{
// Convert the command line in to a list of arguments
QStringList list = QStringList::split(QRegExp(" *"),c);
#if !defined(QT_NO_COP)
QString ap=list[0];
// see if the application is already running
// XXX should lock file /tmp/qcop-msg-ap
if ( QCopChannel::isRegistered( ("QPE/Application/" + ap).latin1() ) ) {
// If the channel is already register, the app is already running, so show it.
- { QCopEnvelope env( ("QPE/Application/" + ap).latin1(), "raise()" ); }
+ {
+ QCopEnvelope env( ("QPE/Application/" + ap).latin1(), "raise()" );
+ }
//QCopEnvelope e("QPE/System", "notBusy(QString)" );
//e << ap;
return;
}
// XXX should unlock file /tmp/qcop-msg-ap
//see if it is being started
if ( StartingAppList::isStarting( ap ) ) {
// FIXME take it out for now, since it leads to a much to short showing of wait if
// some entry is clicked.
// Real cause is that ::execute is called twice for document tab. But it would need some larger changes
// to fix that, and with future syncs with qtopia 1.6 it will change anyway big time since somebody there
// had the idea that an apploader belongs to the launcher ...
//QCopEnvelope e("QPE/System", "notBusy(QString)" );
//e << ap;
return;
}
#endif
#ifdef QT_NO_QWS_MULTIPROCESS
QMessageBox::warning( 0, "Error", "Could not find the application " + c, "Ok", 0, 0, 0, 1 );
#else
QStrList slist;
unsigned int 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;
#if !defined(QT_NO_COP)
// an attempt to show a wait...
// more logic should be used, but this will be fine for the moment...
QCopEnvelope ( "QPE/System", "busy()" );
#endif
#ifdef HAVE_QUICKEXEC
#ifdef Q_OS_MACX
QString libexe = qpeDir()+"/binlib/lib"+args[0] + ".dylib";
#else
QString libexe = qpeDir()+"/binlib/lib"+args[0] + ".so";
#endif
qDebug("libfile = %s", libexe.latin1() );
if ( QFile::exists( libexe ) ) {
qDebug("calling quickexec %s", libexe.latin1() );
quickexecv( libexe.utf8().data(), (const char **)args );
} else
#endif
{
bool success = false;
int pfd [2];
if ( ::pipe ( pfd ) < 0 )
@@ -626,48 +629,49 @@ void Global::invoke(const QString &c)
if ( pfd [1] >= 0 )
::close ( pfd [1] );
if ( pfd [0] >= 0 ) {
while ( true ) {
char resultByte;
int n = ::read ( pfd [0], &resultByte, 1 );
if ( n == 1 ) {
success = false;
break;
}
if (( n == -1 ) && (( errno == ECHILD ) || ( errno == EINTR )))
continue;
break; // success
}
::close ( pfd [0] );
}
}
if ( success )
StartingAppList::add( list[0] );
else
QMessageBox::warning( 0, "Error", "Could not start the application " + c, "Ok", 0, 0, 0, 1 );
}
+ delete [] args;
#endif //QT_NO_QWS_MULTIPROCESS
}
/*!
Executes the application identfied by \a c, passing \a
document if it isn't null.
Note that a better approach might be to send a QCop message to the
application's QPE/Application/\e{appname} channel.
*/
void Global::execute( const QString &c, const QString& document )
{
// ask the server to do the work
#if !defined(QT_NO_COP)
if ( document.isNull() ) {
QCopEnvelope e( "QPE/System", "execute(QString)" );
e << c;
} else {
QCopEnvelope e( "QPE/System", "execute(QString,QString)" );
e << c << document;
}
#endif
return;