-rw-r--r-- | core/apps/qcop/main.cpp | 84 | ||||
-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, 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,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 | ** | ||
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 | ** |
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 | } | ||
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,12 +1,12 @@ | |||
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 | ||
12 | include( $(OPIEDIR)/include.pro ) | 12 | include( $(OPIEDIR)/include.pro ) |
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 | |||
@@ -1,246 +1,236 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2005 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2005 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This program is free software; you can redistribute it and/or modify it | 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 | 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 | 8 | ** Free Software Foundation; either version 2 of the License, or (at your |
9 | ** option) any later version. | 9 | ** option) any later version. |
10 | ** | 10 | ** |
11 | ** A copy of the GNU GPL license version 2 is included in this package as | 11 | ** A copy of the GNU GPL license version 2 is included in this package as |
12 | ** LICENSE.GPL. | 12 | ** LICENSE.GPL. |
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 | **********************************************************************/ |
35 | 25 | ||
36 | #include "qcopimpl.h" | 26 | #include "qcopimpl.h" |
37 | #include <qtopia/timeconversion.h> | 27 | #include <qtopia/timeconversion.h> |
38 | 28 | ||
39 | void doqcopusage() | 29 | void doqcopusage() |
40 | { | 30 | { |
41 | fprintf( stderr, "Usage: qcop [-l username] channel command [parameters] [-w channel command [timeout]]\n" ); | 31 | fprintf( stderr, "Usage: qcop [-l username] channel command [parameters] [-w channel command [timeout]]\n" ); |
42 | } | 32 | } |
43 | 33 | ||
44 | void doqcopsyntax( const QString &where, const QString &what ) | 34 | void doqcopsyntax( const QString &where, const QString &what ) |
45 | { | 35 | { |
46 | fprintf( stderr, "Syntax error in %s: %s\n", where.latin1(), what.latin1() ); | 36 | fprintf( stderr, "Syntax error in %s: %s\n", where.latin1(), what.latin1() ); |
47 | exit(1); | 37 | exit(1); |
48 | } | 38 | } |
49 | 39 | ||
50 | void disableqdebug( QtMsgType type, const char *msg ) | 40 | void disableqdebug( QtMsgType type, const char *msg ) |
51 | { | 41 | { |
52 | // Ignore messages that are sent via qDebug. | 42 | // Ignore messages that are sent via qDebug. |
53 | Q_UNUSED( type ); | 43 | Q_UNUSED( type ); |
54 | Q_UNUSED( msg ); | 44 | Q_UNUSED( msg ); |
55 | } | 45 | } |
56 | 46 | ||
57 | int doqcopimpl (int argc, char *argv[]) | 47 | int doqcopimpl (int argc, char *argv[]) |
58 | { | 48 | { |
59 | qInstallMsgHandler( disableqdebug ); | 49 | qInstallMsgHandler( disableqdebug ); |
60 | 50 | ||
61 | if ( argc > 1 ) { | 51 | if ( argc > 1 ) { |
62 | QString opt = argv[1]; | 52 | QString opt = argv[1]; |
63 | if ( opt == "-l" ) { | 53 | if ( opt == "-l" ) { |
64 | if ( argc < 5 ) { | 54 | if ( argc < 5 ) { |
65 | doqcopusage(); | 55 | doqcopusage(); |
66 | exit(1); | 56 | exit(1); |
67 | } | 57 | } |
68 | #ifndef Q_OS_WIN32 | 58 | #ifndef Q_OS_WIN32 |
69 | const char *username = argv[2]; | 59 | const char *username = argv[2]; |
70 | struct passwd *pwd = getpwnam( username ); | 60 | struct passwd *pwd = getpwnam( username ); |
71 | if ( !pwd ) { | 61 | if ( !pwd ) { |
72 | fprintf( stderr, "Unknown user %s\n", username ); | 62 | fprintf( stderr, "Unknown user %s\n", username ); |
73 | exit(1); | 63 | exit(1); |
74 | } | 64 | } |
75 | int uid = pwd->pw_uid; | 65 | int uid = pwd->pw_uid; |
76 | int gid = pwd->pw_gid; | 66 | int gid = pwd->pw_gid; |
77 | if ( initgroups( username, gid ) != 0 ) { | 67 | if ( initgroups( username, gid ) != 0 ) { |
78 | fprintf( stderr, "Could not chg group for user:%s\n", username ); | 68 | fprintf( stderr, "Could not chg group for user:%s\n", username ); |
79 | exit(1); | 69 | exit(1); |
80 | } | 70 | } |
81 | 71 | ||
82 | if ( setuid( uid ) != 0 ) { | 72 | if ( setuid( uid ) != 0 ) { |
83 | fprintf( stderr, "Could not run as user %s\n", username ); | 73 | fprintf( stderr, "Could not run as user %s\n", username ); |
84 | exit(1); | 74 | exit(1); |
85 | } | 75 | } |
86 | setenv( "LOGNAME", username, 1 ); | 76 | setenv( "LOGNAME", username, 1 ); |
87 | #else | 77 | #else |
88 | setenv("LOGNAME", argv[2], 1); | 78 | setenv("LOGNAME", argv[2], 1); |
89 | #endif | 79 | #endif |
90 | 80 | ||
91 | argc -= 2; | 81 | argc -= 2; |
92 | for ( int i = 1; i < argc; i++ ) { | 82 | for ( int i = 1; i < argc; i++ ) { |
93 | argv[i] = argv[i+2]; | 83 | argv[i] = argv[i+2]; |
94 | } | 84 | } |
95 | } | 85 | } |
96 | 86 | ||
97 | } | 87 | } |
98 | 88 | ||
99 | if ( argc < 3 ) { | 89 | if ( argc < 3 ) { |
100 | doqcopusage(); | 90 | doqcopusage(); |
101 | exit(1); | 91 | exit(1); |
102 | } | 92 | } |
103 | 93 | ||
104 | QApplication app( argc, argv ); | 94 | QApplication app( argc, argv ); |
105 | 95 | ||
106 | QString channel = argv[1]; | 96 | QString channel = argv[1]; |
107 | QString command = argv[2]; | 97 | QString command = argv[2]; |
108 | command.stripWhiteSpace(); | 98 | command.stripWhiteSpace(); |
109 | 99 | ||
110 | int paren = command.find( "(" ); | 100 | int paren = command.find( "(" ); |
111 | if ( paren <= 0 ) | 101 | if ( paren <= 0 ) |
112 | doqcopsyntax( "command", command ); | 102 | doqcopsyntax( "command", command ); |
113 | 103 | ||
114 | QString params = command.mid( paren + 1 ); | 104 | QString params = command.mid( paren + 1 ); |
115 | if ( params[(int)params.length()-1] != ')' ) | 105 | if ( params[(int)params.length()-1] != ')' ) |
116 | doqcopsyntax( "command", command ); | 106 | doqcopsyntax( "command", command ); |
117 | 107 | ||
118 | params.truncate( params.length()-1 ); | 108 | params.truncate( params.length()-1 ); |
119 | #ifndef QT_NO_COP | 109 | #ifndef QT_NO_COP |
120 | int argIdx = 3; | 110 | int argIdx = 3; |
121 | { | 111 | { |
122 | QCopEnvelope env(channel.latin1(), command.latin1()); | 112 | QCopEnvelope env(channel.latin1(), command.latin1()); |
123 | 113 | ||
124 | QStringList paramList = QStringList::split( ",", params ); | 114 | QStringList paramList = QStringList::split( ",", params ); |
125 | QStringList::Iterator it; | 115 | QStringList::Iterator it; |
126 | for ( it = paramList.begin(); it != paramList.end(); ++it ) { | 116 | for ( it = paramList.begin(); it != paramList.end(); ++it ) { |
127 | QString arg = argv[argIdx]; | 117 | QString arg = argv[argIdx]; |
128 | if ( *it == "QString" ) { | 118 | if ( *it == "QString" ) { |
129 | env << arg; | 119 | env << arg; |
130 | } else if ( *it == "int" ) { | 120 | } else if ( *it == "int" ) { |
131 | env << arg.toInt(); | 121 | env << arg.toInt(); |
132 | } else if ( *it == "QDateTime") { | 122 | } else if ( *it == "QDateTime") { |
133 | env << TimeConversion::fromISO8601(QCString(arg)); | 123 | env << TimeConversion::fromISO8601(QCString(arg)); |
134 | } else if ( *it == "bool") { | 124 | } else if ( *it == "bool") { |
135 | if (arg.lower() == "false") | 125 | if (arg.lower() == "false") |
136 | env << (int)false; | 126 | env << (int)false; |
137 | else if (arg.lower() == "true") | 127 | else if (arg.lower() == "true") |
138 | env << (int)true; | 128 | env << (int)true; |
139 | else | 129 | else |
140 | doqcopsyntax( "parameter value for bool should be either 'true' or 'false'", arg ); | 130 | doqcopsyntax( "parameter value for bool should be either 'true' or 'false'", arg ); |
141 | } else { | 131 | } else { |
142 | doqcopsyntax( "parameter type", *it ); | 132 | doqcopsyntax( "parameter type", *it ); |
143 | } | 133 | } |
144 | argIdx++; | 134 | argIdx++; |
145 | } | 135 | } |
146 | // send env | 136 | // send env |
147 | } | 137 | } |
148 | 138 | ||
149 | // Check for a "-w" option, which indicates that we should | 139 | // Check for a "-w" option, which indicates that we should |
150 | // wait for a QCop command before exiting. | 140 | // wait for a QCop command before exiting. |
151 | if ( argIdx < argc && QString(argv[argIdx]) == "-w" ) { | 141 | if ( argIdx < argc && QString(argv[argIdx]) == "-w" ) { |
152 | if ( ( argIdx + 3 ) > argc ) { | 142 | if ( ( argIdx + 3 ) > argc ) { |
153 | doqcopusage(); | 143 | doqcopusage(); |
154 | exit(1); | 144 | exit(1); |
155 | } | 145 | } |
156 | 146 | ||
157 | channel = argv[argIdx + 1]; | 147 | channel = argv[argIdx + 1]; |
158 | command = argv[argIdx + 2]; | 148 | command = argv[argIdx + 2]; |
159 | 149 | ||
160 | QCopWatcher *watcher = new QCopWatcher( &app, command ); | 150 | QCopWatcher *watcher = new QCopWatcher( &app, command ); |
161 | QCopChannel *chan = new QCopChannel( QCString(channel), &app ); | 151 | QCopChannel *chan = new QCopChannel( QCString(channel), &app ); |
162 | 152 | ||
163 | QObject::connect | 153 | QObject::connect |
164 | ( chan, SIGNAL(received(const QCString&,const QByteArray&)), | 154 | ( chan, SIGNAL(received(const QCString&,const QByteArray&)), |
165 | watcher, SLOT(received(const QCString&,const QByteArray&)) ); | 155 | watcher, SLOT(received(const QCString&,const QByteArray&)) ); |
166 | QObject::connect | 156 | QObject::connect |
167 | ( watcher, SIGNAL(done()), &app, SLOT(quit()) ); | 157 | ( watcher, SIGNAL(done()), &app, SLOT(quit()) ); |
168 | 158 | ||
169 | if ( ( argIdx + 3 ) < argc ) { | 159 | if ( ( argIdx + 3 ) < argc ) { |
170 | QTimer::singleShot( QString(argv[argIdx + 3]).toInt(), | 160 | QTimer::singleShot( QString(argv[argIdx + 3]).toInt(), |
171 | watcher, SLOT(timeout()) ); | 161 | watcher, SLOT(timeout()) ); |
172 | } | 162 | } |
173 | 163 | ||
174 | return app.exec(); | 164 | return app.exec(); |
175 | } | 165 | } |
176 | 166 | ||
177 | #endif | 167 | #endif |
178 | 168 | ||
179 | QTimer::singleShot( 0, &app, SLOT(quit()) ); | 169 | QTimer::singleShot( 0, &app, SLOT(quit()) ); |
180 | return app.exec(); | 170 | return app.exec(); |
181 | } | 171 | } |
182 | 172 | ||
183 | QCopWatcher::QCopWatcher( QObject *parent, const QString& msg ) | 173 | QCopWatcher::QCopWatcher( QObject *parent, const QString& msg ) |
184 | : QObject( parent ) | 174 | : QObject( parent ) |
185 | { | 175 | { |
186 | this->msg = msg; | 176 | this->msg = msg; |
187 | } | 177 | } |
188 | 178 | ||
189 | QCopWatcher::~QCopWatcher() | 179 | QCopWatcher::~QCopWatcher() |
190 | { | 180 | { |
191 | } | 181 | } |
192 | 182 | ||
193 | void QCopWatcher::received( const QCString& msg, const QByteArray& data ) | 183 | void QCopWatcher::received( const QCString& msg, const QByteArray& data ) |
194 | { | 184 | { |
195 | if ( msg != this->msg ) | 185 | if ( msg != this->msg ) |
196 | return; | 186 | return; |
197 | 187 | ||
198 | QString command = msg; | 188 | QString command = msg; |
199 | QDataStream stream( data, IO_ReadOnly ); | 189 | QDataStream stream( data, IO_ReadOnly ); |
200 | 190 | ||
201 | int paren = command.find( "(" ); | 191 | int paren = command.find( "(" ); |
202 | if ( paren <= 0 ) | 192 | if ( paren <= 0 ) |
203 | doqcopsyntax( "wait-command", command ); | 193 | doqcopsyntax( "wait-command", command ); |
204 | 194 | ||
205 | QString params = command.mid( paren + 1 ); | 195 | QString params = command.mid( paren + 1 ); |
206 | if ( params[(int)params.length()-1] != ')' ) | 196 | if ( params[(int)params.length()-1] != ')' ) |
207 | doqcopsyntax( "wait-command", command ); | 197 | doqcopsyntax( "wait-command", command ); |
208 | 198 | ||
209 | params.truncate( params.length()-1 ); | 199 | params.truncate( params.length()-1 ); |
210 | QStringList paramList = QStringList::split( ",", params ); | 200 | QStringList paramList = QStringList::split( ",", params ); |
211 | QStringList::Iterator it; | 201 | QStringList::Iterator it; |
212 | for ( it = paramList.begin(); it != paramList.end(); ++it ) { | 202 | for ( it = paramList.begin(); it != paramList.end(); ++it ) { |
213 | if ( *it == "QString" ) { | 203 | if ( *it == "QString" ) { |
214 | QString value; | 204 | QString value; |
215 | stream >> value; | 205 | stream >> value; |
216 | puts( value.latin1() ); | 206 | puts( value.latin1() ); |
217 | } else if ( *it == "int" ) { | 207 | } else if ( *it == "int" ) { |
218 | int value; | 208 | int value; |
219 | stream >> value; | 209 | stream >> value; |
220 | printf( "%d\n", value ); | 210 | printf( "%d\n", value ); |
221 | } else if ( *it == "QDateTime") { | 211 | } else if ( *it == "QDateTime") { |
222 | QDateTime value; | 212 | QDateTime value; |
223 | QString converted; | 213 | QString converted; |
224 | stream >> value; | 214 | stream >> value; |
225 | converted = TimeConversion::toISO8601(value); | 215 | converted = TimeConversion::toISO8601(value); |
226 | puts( converted.latin1() ); | 216 | puts( converted.latin1() ); |
227 | } else if ( *it == "bool") { | 217 | } else if ( *it == "bool") { |
228 | int value; | 218 | int value; |
229 | stream >> value; | 219 | stream >> value; |
230 | if ( value ) | 220 | if ( value ) |
231 | puts( "true" ); | 221 | puts( "true" ); |
232 | else | 222 | else |
233 | puts( "false" ); | 223 | puts( "false" ); |
234 | } else { | 224 | } else { |
235 | doqcopsyntax( "parameter type", *it ); | 225 | doqcopsyntax( "parameter type", *it ); |
236 | } | 226 | } |
237 | } | 227 | } |
238 | 228 | ||
239 | emit done(); | 229 | emit done(); |
240 | } | 230 | } |
241 | 231 | ||
242 | void QCopWatcher::timeout() | 232 | void QCopWatcher::timeout() |
243 | { | 233 | { |
244 | QApplication::exit(1); | 234 | QApplication::exit(1); |
245 | } | 235 | } |
246 | 236 | ||
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 | |||
@@ -1,82 +1,72 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2005 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2005 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This program is free software; you can redistribute it and/or modify it | 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 | 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 | 8 | ** Free Software Foundation; either version 2 of the License, or (at your |
9 | ** option) any later version. | 9 | ** option) any later version. |
10 | ** | 10 | ** |
11 | ** A copy of the GNU GPL license version 2 is included in this package as | 11 | ** A copy of the GNU GPL license version 2 is included in this package as |
12 | ** LICENSE.GPL. | 12 | ** LICENSE.GPL. |
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 | **********************************************************************/ |
35 | 25 | ||
36 | #ifndef QCOPIMPL_H | 26 | #ifndef QCOPIMPL_H |
37 | #define QCOPIMPL_H | 27 | #define QCOPIMPL_H |
38 | 28 | ||
39 | #ifdef QWS | 29 | #ifdef QWS |
40 | #include <qtopia/qcopenvelope_qws.h> | 30 | #include <qtopia/qcopenvelope_qws.h> |
41 | #endif | 31 | #endif |
42 | 32 | ||
43 | #include <qtopia/qpeapplication.h> | 33 | #include <qtopia/qpeapplication.h> |
44 | #include <qstringlist.h> | 34 | #include <qstringlist.h> |
45 | #include <qdatastream.h> | 35 | #include <qdatastream.h> |
46 | #include <qtimer.h> | 36 | #include <qtimer.h> |
47 | 37 | ||
48 | #include <stdlib.h> | 38 | #include <stdlib.h> |
49 | #include <stdio.h> | 39 | #include <stdio.h> |
50 | #include <sys/types.h> | 40 | #include <sys/types.h> |
51 | 41 | ||
52 | #ifndef Q_OS_WIN32 | 42 | #ifndef Q_OS_WIN32 |
53 | #include <pwd.h> | 43 | #include <pwd.h> |
54 | #include <unistd.h> | 44 | #include <unistd.h> |
55 | #include <grp.h> | 45 | #include <grp.h> |
56 | #endif | 46 | #endif |
57 | 47 | ||
58 | // No tr() anywhere in this file | 48 | // No tr() anywhere in this file |
59 | 49 | ||
60 | void doqcopusage(); | 50 | void doqcopusage(); |
61 | void doqcopsyntax( const QString &where, const QString &what ); | 51 | void doqcopsyntax( const QString &where, const QString &what ); |
62 | int doqcopimpl (int argc, char *argv[]); | 52 | int doqcopimpl (int argc, char *argv[]); |
63 | 53 | ||
64 | class QCopWatcher : public QObject | 54 | class QCopWatcher : public QObject |
65 | { | 55 | { |
66 | Q_OBJECT | 56 | Q_OBJECT |
67 | public: | 57 | public: |
68 | QCopWatcher( QObject *parent, const QString& msg ); | 58 | QCopWatcher( QObject *parent, const QString& msg ); |
69 | ~QCopWatcher(); | 59 | ~QCopWatcher(); |
70 | 60 | ||
71 | signals: | 61 | signals: |
72 | void done(); | 62 | void done(); |
73 | 63 | ||
74 | public slots: | 64 | public slots: |
75 | void received( const QCString& msg, const QByteArray& data ); | 65 | void received( const QCString& msg, const QByteArray& data ); |
76 | void timeout(); | 66 | void timeout(); |
77 | 67 | ||
78 | private: | 68 | private: |
79 | QCString msg; | 69 | QCString msg; |
80 | }; | 70 | }; |
81 | 71 | ||
82 | #endif | 72 | #endif |