author | zecke <zecke> | 2005-03-02 19:23:54 (UTC) |
---|---|---|
committer | zecke <zecke> | 2005-03-02 19:23:54 (UTC) |
commit | af157881a6265b1ea9e74d61853c2d3d865a6080 (patch) (side-by-side diff) | |
tree | 6d10df4742bf4c53beefe7b67744dadce6393750 /core/apps/qcop/main.cpp | |
parent | 0a4dabaa72dda35694445345ebb4d9d80921a5a2 (diff) | |
download | opie-af157881a6265b1ea9e74d61853c2d3d865a6080.zip opie-af157881a6265b1ea9e74d61853c2d3d865a6080.tar.gz opie-af157881a6265b1ea9e74d61853c2d3d865a6080.tar.bz2 |
Merge HEAD with QTOPIA_2_1_1 vendor branch
The new qcop tool can change the user and wait for repsonses on the channel
it sent data
-rw-r--r-- | core/apps/qcop/main.cpp | 82 |
1 files changed, 15 insertions, 67 deletions
diff --git a/core/apps/qcop/main.cpp b/core/apps/qcop/main.cpp index 9306cbf..0f5cb2c 100644 --- a/core/apps/qcop/main.cpp +++ b/core/apps/qcop/main.cpp @@ -1,13 +1,18 @@ /********************************************************************** -** Copyright (C) 2000 Trolltech AS. All rights reserved. +** Copyright (C) 2000-2004 Trolltech AS. All rights reserved. ** -** This file is part of Qtopia Environment. +** This file is part of the Qtopia Environment. ** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. +** This program is free software; you can redistribute it and/or modify it +** under the terms of the GNU General Public License as published by the +** Free Software Foundation; either version 2 of the License, or (at your +** option) any later version. ** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** A copy of the GNU GPL license version 2 is included in this package as +** LICENSE.GPL. +** +** This program is distributed in the hope that it will be useful, but +** WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +** See the GNU General Public License for more details. ** @@ -20,20 +25,3 @@ -#include <qpe/qcopenvelope_qws.h> - -#include <qapplication.h> -#include <qtimer.h> - -#include <stdlib.h> -#include <stdio.h> - -static void usage() -{ - fprintf( stderr, "Usage: qcop channel command [parameters]\n" ); -} - -static void syntax( const QString &where, const QString &what ) -{ - fprintf( stderr, "Syntax error in %s: %s\n", where.latin1(), what.latin1() ); - exit(1); -} +#include "qcopimpl.h" @@ -41,43 +29,3 @@ int main( int argc, char *argv[] ) { - QApplication app( argc, argv ); - - if ( argc < 3 ) { - usage(); - exit(1); + return doqcopimpl(argc,argv); } - - QString channel = argv[1]; - QString command = argv[2]; - command.stripWhiteSpace(); - - int paren = command.find( "(" ); - if ( paren <= 0 ) - syntax( "command", command ); - - QString params = command.mid( paren + 1 ); - if ( params[params.length()-1] != ')' ) - syntax( "command", command ); - - params.truncate( params.length()-1 ); - QCopEnvelope env(channel.latin1(), command.latin1()); - - int argIdx = 3; - - QStringList paramList = QStringList::split( ",", params ); - QStringList::Iterator it; - for ( it = paramList.begin(); it != paramList.end(); ++it ) { - QString arg = argv[argIdx]; - if ( *it == "QString" ) { - env << arg; - } else if ( *it == "int" ) { - env << arg.toInt(); - } else { - syntax( "paramter type", *it ); - } - argIdx++; - } - - QTimer::singleShot( 0, &app, SLOT(quit()) ); - return app.exec(); -} - |