author | zecke <zecke> | 2005-03-02 19:23:54 (UTC) |
---|---|---|
committer | zecke <zecke> | 2005-03-02 19:23:54 (UTC) |
commit | af157881a6265b1ea9e74d61853c2d3d865a6080 (patch) (unidiff) | |
tree | 6d10df4742bf4c53beefe7b67744dadce6393750 /core/apps/qcop | |
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 | ||||
-rw-r--r-- | core/apps/qcop/qcop.pro | 4 | ||||
-rw-r--r-- | core/apps/qcop/qcopimpl.cpp | 10 | ||||
-rw-r--r-- | core/apps/qcop/qcopimpl.h | 10 |
4 files changed, 17 insertions, 89 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,83 +1,31 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2004 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This program is free software; you can redistribute it and/or modify it |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** under the terms of the GNU General Public License as published by the |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Free Software Foundation; either version 2 of the License, or (at your |
9 | ** packaging of this file. | 9 | ** option) any later version. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** A copy of the GNU GPL license version 2 is included in this package as |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** LICENSE.GPL. |
13 | ** | ||
14 | ** This program is distributed in the hope that it will be useful, but | ||
15 | ** WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | ** See the GNU General Public License for more details. | ||
13 | ** | 18 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 19 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 20 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 21 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 22 | ** not clear to you. |
18 | ** | 23 | ** |
19 | **********************************************************************/ | 24 | **********************************************************************/ |
20 | 25 | ||
21 | #include <qpe/qcopenvelope_qws.h> | 26 | #include "qcopimpl.h" |
22 | |||
23 | #include <qapplication.h> | ||
24 | #include <qtimer.h> | ||
25 | |||
26 | #include <stdlib.h> | ||
27 | #include <stdio.h> | ||
28 | |||
29 | static void usage() | ||
30 | { | ||
31 | fprintf( stderr, "Usage: qcop channel command [parameters]\n" ); | ||
32 | } | ||
33 | |||
34 | static void syntax( const QString &where, const QString &what ) | ||
35 | { | ||
36 | fprintf( stderr, "Syntax error in %s: %s\n", where.latin1(), what.latin1() ); | ||
37 | exit(1); | ||
38 | } | ||
39 | 27 | ||
40 | int main( int argc, char *argv[] ) | 28 | int main( int argc, char *argv[] ) |
41 | { | 29 | { |
42 | QApplication app( argc, argv ); | 30 | return doqcopimpl(argc,argv); |
43 | |||
44 | if ( argc < 3 ) { | ||
45 | usage(); | ||
46 | exit(1); | ||
47 | } | 31 | } |
48 | |||
49 | QString channel = argv[1]; | ||
50 | QString command = argv[2]; | ||
51 | command.stripWhiteSpace(); | ||
52 | |||
53 | int paren = command.find( "(" ); | ||
54 | if ( paren <= 0 ) | ||
55 | syntax( "command", command ); | ||
56 | |||
57 | QString params = command.mid( paren + 1 ); | ||
58 | if ( params[params.length()-1] != ')' ) | ||
59 | syntax( "command", command ); | ||
60 | |||
61 | params.truncate( params.length()-1 ); | ||
62 | QCopEnvelope env(channel.latin1(), command.latin1()); | ||
63 | |||
64 | int argIdx = 3; | ||
65 | |||
66 | QStringList paramList = QStringList::split( ",", params ); | ||
67 | QStringList::Iterator it; | ||
68 | for ( it = paramList.begin(); it != paramList.end(); ++it ) { | ||
69 | QString arg = argv[argIdx]; | ||
70 | if ( *it == "QString" ) { | ||
71 | env << arg; | ||
72 | } else if ( *it == "int" ) { | ||
73 | env << arg.toInt(); | ||
74 | } else { | ||
75 | syntax( "paramter type", *it ); | ||
76 | } | ||
77 | argIdx++; | ||
78 | } | ||
79 | |||
80 | QTimer::singleShot( 0, &app, SLOT(quit()) ); | ||
81 | return app.exec(); | ||
82 | } | ||
83 | |||
diff --git a/core/apps/qcop/qcop.pro b/core/apps/qcop/qcop.pro index 8cb1b55..6276bee 100644 --- a/core/apps/qcop/qcop.pro +++ b/core/apps/qcop/qcop.pro | |||
@@ -1,11 +1,11 @@ | |||
1 | TEMPLATE= app | 1 | TEMPLATE= app |
2 | CONFIG = qt warn_on | 2 | CONFIG = qt warn_on |
3 | DESTDIR = $(OPIEDIR)/bin | 3 | DESTDIR = $(OPIEDIR)/bin |
4 | HEADERS = | 4 | HEADERS = qcopimpl.h |
5 | SOURCES = main.cpp | 5 | SOURCES = qcopimpl.cpp main.cpp |
6 | INCLUDEPATH += $(OPIEDIR)/include | 6 | INCLUDEPATH += $(OPIEDIR)/include |
7 | DEPENDPATH+= $(OPIEDIR)/include | 7 | DEPENDPATH+= $(OPIEDIR)/include |
8 | LIBS += -lqpe | 8 | LIBS += -lqpe |
9 | INTERFACES= | 9 | INTERFACES= |
10 | TARGET = qcop | 10 | TARGET = qcop |
11 | 11 | ||
diff --git a/core/apps/qcop/qcopimpl.cpp b/core/apps/qcop/qcopimpl.cpp index c018aea..43863bb 100644 --- a/core/apps/qcop/qcopimpl.cpp +++ b/core/apps/qcop/qcopimpl.cpp | |||
@@ -13,22 +13,12 @@ | |||
13 | ** | 13 | ** |
14 | ** This program is distributed in the hope that it will be useful, but | 14 | ** This program is distributed in the hope that it will be useful, but |
15 | ** WITHOUT ANY WARRANTY; without even the implied warranty of | 15 | ** WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | ** See the GNU General Public License for more details. | 17 | ** See the GNU General Public License for more details. |
18 | ** | 18 | ** |
19 | ** In addition, as a special exception Trolltech gives permission to link | ||
20 | ** the code of this program with Qtopia applications copyrighted, developed | ||
21 | ** and distributed by Trolltech under the terms of the Qtopia Personal Use | ||
22 | ** License Agreement. You must comply with the GNU General Public License | ||
23 | ** in all respects for all of the code used other than the applications | ||
24 | ** licensed under the Qtopia Personal Use License Agreement. If you modify | ||
25 | ** this file, you may extend this exception to your version of the file, | ||
26 | ** but you are not obligated to do so. If you do not wish to do so, delete | ||
27 | ** this exception statement from your version. | ||
28 | ** | ||
29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 19 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
30 | ** | 20 | ** |
31 | ** Contact info@trolltech.com if any conditions of this licensing are | 21 | ** Contact info@trolltech.com if any conditions of this licensing are |
32 | ** not clear to you. | 22 | ** not clear to you. |
33 | ** | 23 | ** |
34 | **********************************************************************/ | 24 | **********************************************************************/ |
diff --git a/core/apps/qcop/qcopimpl.h b/core/apps/qcop/qcopimpl.h index dfda063..dc847f1 100644 --- a/core/apps/qcop/qcopimpl.h +++ b/core/apps/qcop/qcopimpl.h | |||
@@ -13,22 +13,12 @@ | |||
13 | ** | 13 | ** |
14 | ** This program is distributed in the hope that it will be useful, but | 14 | ** This program is distributed in the hope that it will be useful, but |
15 | ** WITHOUT ANY WARRANTY; without even the implied warranty of | 15 | ** WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | ** See the GNU General Public License for more details. | 17 | ** See the GNU General Public License for more details. |
18 | ** | 18 | ** |
19 | ** In addition, as a special exception Trolltech gives permission to link | ||
20 | ** the code of this program with Qtopia applications copyrighted, developed | ||
21 | ** and distributed by Trolltech under the terms of the Qtopia Personal Use | ||
22 | ** License Agreement. You must comply with the GNU General Public License | ||
23 | ** in all respects for all of the code used other than the applications | ||
24 | ** licensed under the Qtopia Personal Use License Agreement. If you modify | ||
25 | ** this file, you may extend this exception to your version of the file, | ||
26 | ** but you are not obligated to do so. If you do not wish to do so, delete | ||
27 | ** this exception statement from your version. | ||
28 | ** | ||
29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 19 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
30 | ** | 20 | ** |
31 | ** Contact info@trolltech.com if any conditions of this licensing are | 21 | ** Contact info@trolltech.com if any conditions of this licensing are |
32 | ** not clear to you. | 22 | ** not clear to you. |
33 | ** | 23 | ** |
34 | **********************************************************************/ | 24 | **********************************************************************/ |