summaryrefslogtreecommitdiff
path: root/core
Unidiff
Diffstat (limited to 'core') (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/qcop/main.cpp84
-rw-r--r--core/apps/qcop/qcop.pro4
-rw-r--r--core/apps/qcop/qcopimpl.cpp10
-rw-r--r--core/apps/qcop/qcopimpl.h10
4 files changed, 18 insertions, 90 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,15 +1,20 @@
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**
6** This program is free software; you can redistribute it and/or modify it
7** under the terms of the GNU General Public License as published by the
8** Free Software Foundation; either version 2 of the License, or (at your
9** option) any later version.
10**
11** A copy of the GNU GPL license version 2 is included in this package as
12** LICENSE.GPL.
5** 13**
6** This file may be distributed and/or modified under the terms of the 14** This program is distributed in the hope that it will be useful, but
7** GNU General Public License version 2 as published by the Free Software 15** WITHOUT ANY WARRANTY; without even the implied warranty of
8** Foundation and appearing in the file LICENSE.GPL included in the 16** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9** packaging of this file. 17** See the GNU General Public License for more details.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
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**
@@ -18,66 +23,9 @@
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
29static void usage()
30{
31 fprintf( stderr, "Usage: qcop channel command [parameters]\n" );
32}
33
34static 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
40int main( int argc, char *argv[] ) 28int 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 }
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} 31}
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,8 +1,8 @@
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
6INCLUDEPATH += $(OPIEDIR)/include 6INCLUDEPATH += $(OPIEDIR)/include
7 DEPENDPATH+= $(OPIEDIR)/include 7 DEPENDPATH+= $(OPIEDIR)/include
8LIBS += -lqpe 8LIBS += -lqpe
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
@@ -16,16 +16,6 @@
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
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
@@ -16,16 +16,6 @@
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