Warning, /sdk/kompare/tests/diff/normalm.diff is written in an unsupported language. File is not indexed.
0001 diff -r dcop/client/dcop.cpp dcop2/client/dcop.cpp
0002 23c23,26
0003 < #include <qvariant.h>
0004 ---
0005 > #include <ctype.h>
0006 > #include <stdio.h>
0007 > #include <stdlib.h>
0008 >
0009 25c28,39
0010 < #include "../kdatastream.h"
0011 ---
0012 > #include <qdir.h>
0013 > #include <qfile.h>
0014 > #include <qfileinfo.h>
0015 > #include <qmap.h>
0016 > #include <qstringlist.h>
0017 > #include <qtextstream.h>
0018 > #include <qvariant.h>
0019 >
0020 > // putenv() is not available on all platforms, so make sure the emulation
0021 > // wrapper is available in those cases by loading config.h!
0022 > #include <config.h>
0023 >
0024 28,30c42
0025 < #include <stdlib.h>
0026 < #include <stdio.h>
0027 < #include <ctype.h>
0028 ---
0029 > #include "../kdatastream.h"
0030 33a46,47
0031 > typedef QMap<QString, QString> UserList;
0032 >
0033 35a50,63
0034 > static QTextStream cout( stdout, IO_WriteOnly );
0035 > static QTextStream cerr( stderr, IO_WriteOnly );
0036 >
0037 > /**
0038 > * Session to send call to
0039 > * DefaultSession - current session. Current KDE session when called without
0040 > * --user or --all-users option. Otherwise this value ignores
0041 > * all users with more than one active session.
0042 > * AllSessions - Send to all sessions found. requires --user or --all-users.
0043 > * QuerySessions - Don't call DCOP, return a list of available sessions.
0044 > * CustomSession - Use the specified session
0045 > */
0046 > enum Session { DefaultSession = 0, AllSessions, QuerySessions, CustomSession };
0047 >
0048 121c149
0049 < void callFunction( const char* app, const char* obj, const char* func, int argc, char** args )
0050 ---
0051 > void callFunction( const char* app, const char* obj, const char* func, const QCStringList args )
0052 123d150
0053 <
0054 139c166
0055 < if ( !ok && argc == 0 )
0056 ---
0057 > if ( !ok && args.isEmpty() )
0058 156,157c183,184
0059 < int a = (*it).contains(',');
0060 < if ( ( a == 0 && argc == 0) || ( a > 0 && a + 1 == argc ) )
0061 ---
0062 > uint a = (*it).contains(',');
0063 > if ( ( a == 0 && args.isEmpty() ) || ( a > 0 && a + 1 == args.count() ) )
0064 164c191,192
0065 < exit(1);
0066 ---
0067 > // exit(1);
0068 > return;
0069 246,250c274,279
0070 < int i = 0;
0071 < for ( QStringList::Iterator it = types.begin(); it != types.end(); ++it ) {
0072 < marshall(arg, argc, args, i, *it);
0073 < }
0074 < if ( i != argc ) {
0075 ---
0076 > uint i = 0;
0077 > for( QStringList::Iterator it = types.begin(); it != types.end(); ++it )
0078 > marshall( arg, args, i, *it );
0079 >
0080 > if ( i != args.count() )
0081 > {
0082 268a298,324
0083 > /**
0084 > * Show command-line help and exit
0085 > */
0086 > void showHelp( int exitCode = 0 )
0087 > {
0088 > cout << "Usage: dcop [options] [application [object [function [arg1] [arg2] ... ] ] ]" << endl
0089 > << "" << endl
0090 > << "Console DCOP client" << endl
0091 > << "" << endl
0092 > << "Generic options:" << endl
0093 > << " --help Show help about options" << endl
0094 > << "" << endl
0095 > << "Options:" << endl
0096 > << " --pipe Call DCOP for each line read from stdin" << endl
0097 > << " --user <user> Connect to the given user's DCOP server. This option will" << endl
0098 > << " ignore the values of the environment vars $DCOPSERVER and" << endl
0099 > << " $ICEAUTHORITY, even if they are set." << endl
0100 > << " If the user has more than one open session, you must also" << endl
0101 > << " use one of the --list-sessions, --session or --als-sessions" << endl
0102 > << " command-line options." << endl
0103 > << " --all-users Send the same DCOP call to all users with a running DCOP" << endl
0104 > << " server. Only failed calls to existing DCOP servers will"
0105 > << " generate an error message. If no DCOP server is available" << endl
0106 > << " at all, no error will be generated." << endl;
0107 >
0108 > exit( exitCode );
0109 > }
0110 270,271c326,330
0111 <
0112 < int main( int argc, char** argv )
0113 ---
0114 > /**
0115 > * Return a list of all users and their home directories.
0116 > * Returns an empty list if /etc/passwd cannot be read for some reason.
0117 > */
0118 > static UserList userList()
0119 272a332,340
0120 > UserList result;
0121 >
0122 > QFile f( "/etc/passwd" );
0123 >
0124 > if( !f.open( IO_ReadOnly ) )
0125 > {
0126 > cerr << "Can't open /etc/passwd for reading!" << endl;
0127 > return result;
0128 > }
0129 274,276c342,347
0130 < if ( argc > 1 && argv[1][0] == '-' ) {
0131 < fprintf( stderr, "Usage: dcop [ application [object [function [arg1] [arg2] [arg3] ... ] ] ] \n" );
0132 < exit(0);
0133 ---
0134 > QStringList l( QStringList::split( '\n', f.readAll() ) );
0135 >
0136 > for( QStringList::ConstIterator it( l.begin() ); it != l.end(); ++it )
0137 > {
0138 > QStringList userInfo( QStringList::split( ':', *it, true ) );
0139 > result[ userInfo[ 0 ] ] = userInfo[ 5 ];
0140 279,281c350,391
0141 < DCOPClient client;
0142 < client.attach();
0143 < dcop = &client;
0144 ---
0145 > return result;
0146 > }
0147 >
0148 > /**
0149 > * Return a list of available DCOP sessions for the specified user
0150 > * An empty list means no sessions are available, or an error occurred.
0151 > */
0152 > QStringList dcopSessionList( const QString &user, const QString &home )
0153 > {
0154 > if( home.isEmpty() )
0155 > {
0156 > cerr << "WARNING: Cannot determine home directory for user "
0157 > << user << "!" << endl
0158 > << "Please check permissions or set the $DCOPSERVER variable manually before" << endl
0159 > << "calling dcop." << endl;
0160 > return QStringList();
0161 > }
0162 >
0163 > QStringList result;
0164 > QFileInfo dirInfo( home );
0165 > if( !dirInfo.exists() || !dirInfo.isReadable() )
0166 > return result;
0167 >
0168 > QDir d( home );
0169 > d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks );
0170 > d.setNameFilter( ".DCOPserver*" );
0171 >
0172 > const QFileInfoList *list = d.entryInfoList();
0173 > if( !list )
0174 > return result;
0175 >
0176 > QFileInfoListIterator it( *list );
0177 > QFileInfo *fi;
0178 >
0179 > while ( ( fi = it.current() ) != 0 )
0180 > {
0181 > if( fi->isReadable() )
0182 > result.append( fi->fileName() );
0183 > ++it;
0184 > }
0185 > return result;
0186 > }
0187 282a393,398
0188 > /**
0189 > * Do the actual DCOP call
0190 > */
0191 > void runDCOP( QCStringList args, UserList users, Session session,
0192 > const QString sessionName, bool readStdin )
0193 > {
0194 286,287c402,404
0195 < char **args = 0;
0196 < if ((argc > 1) && (strncmp(argv[1], "DCOPRef(", 8)) == 0)
0197 ---
0198 > QCStringList params;
0199 > DCOPClient *client = 0L;
0200 > if ( !args.isEmpty() && args[ 0 ].find( "DCOPRef(" ) == 0 )
0201 289,304c406,429
0202 < char *delim = strchr(argv[1], ',');
0203 < if (!delim)
0204 < {
0205 < fprintf(stderr, "Error: '%s' is not a valid DCOP reference.\n", argv[1]);
0206 < return 1;
0207 < }
0208 < *delim = 0;
0209 < app = argv[1] + 8;
0210 < delim++;
0211 < delim[strlen(delim)-1] = 0;
0212 < objid = delim;
0213 < if (argc > 2)
0214 < function = argv[2];
0215 < if (argc > 3)
0216 < args = &argv[3];
0217 < argc++;
0218 ---
0219 > // WARNING: This part (until the closing '}') could very
0220 > // well be broken now. As I don't know how to trigger and test
0221 > // dcoprefs this code is *not* tested. It compiles and it looks
0222 > // ok to me, but that's all I can say - Martijn (2001/12/24)
0223 > int delimPos = args[ 0 ].findRev( ',' );
0224 > if( delimPos == -1 )
0225 > {
0226 > cerr << "Error: '" << args[ 0 ]
0227 > << "' is not a valid DCOP reference." << endl;
0228 > exit( -1 );
0229 > }
0230 > args[ 0 ][ delimPos ] = 0;
0231 > app = args[ 0 ].mid( 8 );
0232 > delimPos++;
0233 > args[ 0 ][ args[ 0 ].length() - 1 ] = 0;
0234 > objid = args[ 0 ].mid( delimPos );
0235 > if( args.count() > 1 )
0236 > function = args[ 1 ];
0237 > if( args.count() > 2 )
0238 > {
0239 > params = args;
0240 > params.remove( params.begin() );
0241 > params.remove( params.begin() );
0242 > }
0243 308,338c433,516
0244 < if (argc > 1)
0245 < app = argv[1];
0246 < if (argc > 2)
0247 < objid = argv[2];
0248 < if (argc > 3)
0249 < function = argv[3];
0250 < if (argc > 4)
0251 < args = &argv[4];
0252 < }
0253 <
0254 < switch ( argc ) {
0255 < case 0:
0256 < case 1:
0257 < queryApplications("");
0258 < break;
0259 < case 2:
0260 < if (endsWith(app, '*'))
0261 < queryApplications(app);
0262 < else
0263 < queryObjects( app, "" );
0264 < break;
0265 < case 3:
0266 < if (endsWith(objid, '*'))
0267 < queryObjects(app, objid);
0268 < else
0269 < queryFunctions( app, objid );
0270 < break;
0271 < case 4:
0272 < default:
0273 < callFunction( app, objid, function, argc - 4, args );
0274 < break;
0275 ---
0276 > if( !args.isEmpty() )
0277 > app = args[ 0 ];
0278 > if( args.count() > 1 )
0279 > objid = args[ 1 ];
0280 > if( args.count() > 2 )
0281 > function = args[ 2 ];
0282 > if( args.count() > 3)
0283 > {
0284 > params = args;
0285 > params.remove( params.begin() );
0286 > params.remove( params.begin() );
0287 > params.remove( params.begin() );
0288 > }
0289 > }
0290 >
0291 > bool firstRun = true;
0292 > UserList::Iterator it;
0293 > QStringList sessions;
0294 > bool presetDCOPServer = false;
0295 > // char *dcopStr = 0L;
0296 > QString dcopServer;
0297 >
0298 > for( it = users.begin(); it != users.end() || firstRun; it++ )
0299 > {
0300 > firstRun = false;
0301 >
0302 > //cout << "Iterating '" << it.key() << "'" << endl;
0303 >
0304 > if( session == QuerySessions )
0305 > {
0306 > QStringList sessions = dcopSessionList( it.key(), it.data() );
0307 > if( sessions.isEmpty() )
0308 > {
0309 > cout << "No active sessions";
0310 > if( !( *it ).isEmpty() )
0311 > cout << " for user " << *it;
0312 > cout << endl;
0313 > }
0314 > else
0315 > {
0316 > cout << "Active sessions ";
0317 > if( !( *it ).isEmpty() )
0318 > cout << "for user " << *it << " ";
0319 > cout << ":" << endl;
0320 >
0321 > QStringList::Iterator sIt;
0322 > for( sIt = sessions.begin(); sIt != sessions.end(); sIt++ )
0323 > cout << " " << *sIt << endl;
0324 >
0325 > cout << endl;
0326 > }
0327 > continue;
0328 > }
0329 >
0330 > if( getenv( "DCOPSERVER" ) )
0331 > {
0332 > sessions.append( getenv( "DCOPSERVER" ) );
0333 > presetDCOPServer = true;
0334 > }
0335 >
0336 > if( users.count() > 1 || ( users.count() == 1 &&
0337 > ( getenv( "DCOPSERVER" ) == 0 /*&& getenv( "DISPLAY" ) == 0*/ ) ) )
0338 > {
0339 > sessions = dcopSessionList( it.key(), it.data() );
0340 > if( sessions.isEmpty() )
0341 > {
0342 > if( users.count() > 1 )
0343 > continue;
0344 > else
0345 > {
0346 > cerr << "ERROR: No active KDE sessions!" << endl
0347 > << "If you are sure there is one, please set the $DCOPSERVER variable manually" << endl
0348 > << "before calling dcop." << endl;
0349 > exit( -1 );
0350 > }
0351 > }
0352 > else if( sessions.count() > 1 && session != AllSessions )
0353 > {
0354 > cerr << "ERROR: Multiple available KDE sessions!" << endl
0355 > << "Please specify the correct session to use with --session or use the" << endl
0356 > << "--all-sessions option to broadcast to all sessions." << endl;
0357 > exit( -1 );
0358 > }
0359 > }
0360 339a518,660
0361 > if( users.count() > 1 || ( users.count() == 1 &&
0362 > ( getenv( "ICEAUTHORITY" ) == 0 || getenv( "DISPLAY" ) == 0 ) ) )
0363 > {
0364 > // Check for ICE authority file and if the file can be read by us
0365 > QString home = it.data();
0366 > QString iceFile = it.data() + "/.ICEauthority";
0367 > QFileInfo fi( iceFile );
0368 > if( iceFile.isEmpty() )
0369 > {
0370 > cerr << "WARNING: Cannot determine home directory for user "
0371 > << it.key() << "!" << endl
0372 > << "Please check permissions or set the $ICEAUTHORITY variable manually before" << endl
0373 > << "calling dcop." << endl;
0374 > }
0375 > else if( fi.exists() )
0376 > {
0377 > if( fi.isReadable() )
0378 > {
0379 > char *envStr = strdup( ( "ICEAUTHORITY=" + iceFile ).ascii() );
0380 > putenv( envStr );
0381 > //cerr << "ice: " << envStr << endl;
0382 > }
0383 > else
0384 > {
0385 > cerr << "WARNING: ICE authority file " << iceFile
0386 > << "is not readable by you!" << endl
0387 > << "Please check permissions or set the $ICEAUTHORITY variable manually before" << endl
0388 > << "calling dcop." << endl;
0389 > }
0390 > }
0391 > else
0392 > {
0393 > if( users.count() > 1 )
0394 > continue;
0395 > else
0396 > {
0397 > cerr << "WARNING: Cannot find ICE authority file "
0398 > << iceFile << "!" << endl
0399 > << "Please check permissions or set the $ICEAUTHORITY"
0400 > << " variable manually before" << endl
0401 > << "calling dcop." << endl;
0402 > }
0403 > }
0404 > }
0405 >
0406 > // Main loop
0407 > // If users is an empty list we're calling for the currently logged
0408 > // in user. In this case we don't have a session, but still want
0409 > // to iterate the loop once.
0410 > QStringList::Iterator sIt = sessions.begin();
0411 > for( ; sIt != sessions.end() || users.isEmpty(); sIt++ )
0412 > {
0413 > if( !presetDCOPServer && !users.isEmpty() )
0414 > {
0415 > QString dcopFile = it.data() + "/" + *sIt;
0416 > QFile f( dcopFile );
0417 > if( !f.open( IO_ReadOnly ) )
0418 > {
0419 > cerr << "Can't open " << dcopFile << " for reading!" << endl;
0420 > exit( -1 );
0421 > }
0422 >
0423 > QStringList l( QStringList::split( '\n', f.readAll() ) );
0424 > dcopServer = l.first();
0425 >
0426 > if( dcopServer.isEmpty() )
0427 > {
0428 > cerr << "WARNING: Unable to determine DCOP server for session "
0429 > << *sIt << "!" << endl
0430 > << "Please check permissions or set the $DCOPSERVER variable manually before" << endl
0431 > << "calling dcop." << endl;
0432 > exit( -1 );
0433 > }
0434 > }
0435 >
0436 > delete client;
0437 > client = new DCOPClient;
0438 > if( !dcopServer.isEmpty() )
0439 > client->setServerAddress( dcopServer.ascii() );
0440 > bool success = client->attach();
0441 > if( !success )
0442 > {
0443 > cerr << "ERROR: Couldn't attach to DCOP server!" << endl;
0444 > continue;
0445 > }
0446 > dcop = client;
0447 >
0448 > switch ( args.count() )
0449 > {
0450 > case 0:
0451 > queryApplications("");
0452 > break;
0453 > case 1:
0454 > if (endsWith(app, '*'))
0455 > queryApplications(app);
0456 > else
0457 > queryObjects( app, "" );
0458 > break;
0459 > case 2:
0460 > if (endsWith(objid, '*'))
0461 > queryObjects(app, objid);
0462 > else
0463 > queryFunctions( app, objid );
0464 > break;
0465 > case 3:
0466 > default:
0467 > if( readStdin )
0468 > {
0469 > QCStringList::Iterator replaceArg = args.end();
0470 >
0471 > QCStringList::Iterator it;
0472 > for( it = args.begin(); it != args.end(); it++ )
0473 > if( *it == "%1" )
0474 > replaceArg = it;
0475 >
0476 > // Read from stdin until EOF and call function for each line read
0477 > char *buf = new char[ 1000 ];
0478 > while ( !feof( stdin ) )
0479 > {
0480 > fgets( buf, 1000, stdin );
0481 >
0482 > if( replaceArg != args.end() )
0483 > *replaceArg = buf;
0484 >
0485 > callFunction( app, objid, function, params );
0486 > }
0487 > }
0488 > else
0489 > {
0490 > // Just call function
0491 > // cout << "call " << app << ", " << objid << ", " << function << ", (params)" << endl;
0492 > callFunction( app, objid, function, params );
0493 > }
0494 > break;
0495 > }
0496 > // Another sIt++ would make the loop infinite...
0497 > if( users.isEmpty() )
0498 > break;
0499 > }
0500 >
0501 > // Another it++ would make the loop infinite...
0502 > if( it == users.end() )
0503 > break;
0504 340a662,767
0505 > }
0506 >
0507 >
0508 > int main( int argc, char** argv )
0509 > {
0510 > bool readStdin = false;
0511 > int numOptions = 0;
0512 > QString user;
0513 > Session session = DefaultSession;
0514 > QString sessionName;
0515 >
0516 > // Scan for command-line options first
0517 > for( int pos = 1 ; pos <= argc - 1 ; pos++ )
0518 > {
0519 > if( strcmp( argv[ pos ], "--help" ) == 0 )
0520 > showHelp( 0 );
0521 > else if( strcmp( argv[ pos ], "--pipe" ) == 0 )
0522 > {
0523 > readStdin = true;
0524 > numOptions++;
0525 > }
0526 > else if( strcmp( argv[ pos ], "--user" ) == 0 )
0527 > {
0528 > if( pos <= argc - 2 )
0529 > {
0530 > user = QString::fromLocal8Bit( argv[ pos + 1] );
0531 > numOptions +=2;
0532 > pos++;
0533 > }
0534 > else
0535 > {
0536 > cerr << "Missing username for '--user' option!" << endl << endl;
0537 > showHelp( -1 );
0538 > }
0539 > }
0540 > else if( strcmp( argv[ pos ], "--all-users" ) == 0 )
0541 > {
0542 > user = "*";
0543 > numOptions ++;
0544 > }
0545 > else if( strcmp( argv[ pos ], "--list-sessions" ) == 0 )
0546 > {
0547 > session = QuerySessions;
0548 > numOptions ++;
0549 > }
0550 > else if( strcmp( argv[ pos ], "--all-sessions" ) == 0 )
0551 > {
0552 > session = AllSessions;
0553 > numOptions ++;
0554 > }
0555 > else if( argv[ pos ][ 0 ] == '-' )
0556 > {
0557 > cerr << "Unknown command-line option '" << argv[ pos ]
0558 > << "'." << endl << endl;
0559 > showHelp( -1 );
0560 > }
0561 > else
0562 > break; // End of options
0563 > }
0564 >
0565 > argc -= numOptions;
0566 >
0567 > QCStringList args;
0568 > for( int i = numOptions; i < argc + numOptions - 1; i++ )
0569 > args.append( argv[ i + 1 ] );
0570 >
0571 > if( readStdin && args.count() < 3 )
0572 > {
0573 > cerr << "--pipe option only supported for function calls!" << endl << endl;
0574 > showHelp( -1 );
0575 > }
0576 >
0577 > if( user == "*" && args.count() < 3 && session != QuerySessions )
0578 > {
0579 > cerr << "ERROR: The --all-users option is only supported for function calls!" << endl << endl;
0580 > showHelp( -1 );
0581 > }
0582 >
0583 > if( session == QuerySessions && !args.isEmpty() )
0584 > {
0585 > cerr << "ERROR: The --list-sessions option cannot be used for actual DCOP calls!" << endl << endl;
0586 > showHelp( -1 );
0587 > }
0588 >
0589 > if( session == QuerySessions && user.isEmpty() )
0590 > {
0591 > cerr << "ERROR: The --list-sessions option can only be used with the --user or" << endl
0592 > << "--all-users options!" << endl << endl;
0593 > showHelp( -1 );
0594 > }
0595 >
0596 > if( session != DefaultSession && session != QuerySessions &&
0597 > args.count() < 3 )
0598 > {
0599 > cerr << "ERROR: The --session and --all-sessions options are only supported for function" << endl
0600 > << "calls!" << endl << endl;
0601 > showHelp( -1 );
0602 > }
0603 >
0604 > UserList users;
0605 > if( user == "*" )
0606 > users = userList();
0607 > else if( !user.isEmpty() )
0608 > users[ user ] = userList()[ user ];
0609 >
0610 > runDCOP( args, users, session, sessionName, readStdin );
0611 343a771,773
0612 >
0613 > // vim: set ts=8 sts=4 sw=4 noet:
0614 >
0615 diff -r dcop/client/dcopfind.cpp dcop2/client/dcopfind.cpp
0616 39c39
0617 < bool findObject( const char* app, const char* obj, const char* func, int argc, char** args )
0618 ---
0619 > bool findObject( const char* app, const char* obj, const char* func, QCStringList args )
0620 121c121
0621 < if ( (int) types.count() != argc ) {
0622 ---
0623 > if ( types.count() != args.count() ) {
0624 131c131
0625 < marshall(arg, argc, args, i, *it);
0626 ---
0627 > marshall(arg, args, i, *it);
0628 133c133
0629 < if ( (int) i != argc ) {
0630 ---
0631 > if ( (uint) i != args.count() ) {
0632 224c224,228
0633 < findObject( app, objid, function, argc, args );
0634 ---
0635 > QCStringList params;
0636 > for( int i = 0; i < argc; i++ )
0637 > params.append( args[ i ] );
0638 >
0639 > findObject( app, objid, function, params );
0640 diff -r dcop/client/marshall.cpp dcop2/client/marshall.cpp
0641 245c245
0642 < void marshall(QDataStream &arg, int argc, char **argv, int &i, QString type)
0643 ---
0644 > void marshall( QDataStream &arg, QCStringList args, uint &i, QString type )
0645 247,317c247,256
0646 < if (type == "QStringList")
0647 < type = "QValueList<QString>";
0648 < if (type == "QCStringList")
0649 < type = "QValueList<QCString>";
0650 < if (i >= argc)
0651 < {
0652 < qWarning("Not enough arguments.");
0653 < exit(1);
0654 < }
0655 < QString s = QString::fromLocal8Bit(argv[i]);
0656 <
0657 < if ( type == "int" )
0658 < arg << s.toInt();
0659 < else if ( type == "uint" )
0660 < arg << s.toUInt();
0661 < else if ( type == "unsigned" )
0662 < arg << s.toUInt();
0663 < else if ( type == "unsigned int" )
0664 < arg << s.toUInt();
0665 < else if ( type == "long" )
0666 < arg << s.toLong();
0667 < else if ( type == "long int" )
0668 < arg << s.toLong();
0669 < else if ( type == "unsigned long" )
0670 < arg << s.toULong();
0671 < else if ( type == "unsigned long int" )
0672 < arg << s.toULong();
0673 < else if ( type == "float" )
0674 < arg << s.toFloat();
0675 < else if ( type == "double" )
0676 < arg << s.toDouble();
0677 < else if ( type == "bool" )
0678 < arg << mkBool( s );
0679 < else if ( type == "QString" )
0680 < arg << s;
0681 < else if ( type == "QCString" )
0682 < arg << QCString( argv[i] );
0683 < else if ( type == "QColor" )
0684 < arg << mkColor( s );
0685 < else if ( type == "QPoint" )
0686 < arg << mkPoint( s );
0687 < else if ( type == "QSize" )
0688 < arg << mkSize( s );
0689 < else if ( type == "QRect" )
0690 < arg << mkRect( s );
0691 < else if ( type == "QVariant" ) {
0692 < if ( s == "true" || s == "false" )
0693 < arg << QVariant( mkBool( s ), 42 );
0694 < else if ( s.left( 4 ) == "int(" )
0695 < arg << QVariant( s.mid(4, s.length()-5).toInt() );
0696 < else if ( s.left( 7 ) == "QPoint(" )
0697 < arg << QVariant( mkPoint( s.mid(7, s.length()-8) ) );
0698 < else if ( s.left( 6 ) == "QSize(" )
0699 < arg << QVariant( mkSize( s.mid(6, s.length()-7) ) );
0700 < else if ( s.left( 6 ) == "QRect(" )
0701 < arg << QVariant( mkRect( s.mid(6, s.length()-7) ) );
0702 < else if ( s.left( 7 ) == "QColor(" )
0703 < arg << QVariant( mkColor( s.mid(7, s.length()-8) ) );
0704 < else
0705 < arg << QVariant( s );
0706 < } else if ( type.startsWith("QValueList<")) {
0707 < type = type.mid(11, type.length() - 12);
0708 < QStringList list;
0709 < QString delim = s;
0710 < if (delim == "[")
0711 < delim = "]";
0712 < if (delim == "(")
0713 < delim = ")";
0714 < i++;
0715 < QByteArray dummy_data;
0716 < QDataStream dummy_arg(dummy_data, IO_WriteOnly);
0717 ---
0718 > if (type == "QStringList")
0719 > type = "QValueList<QString>";
0720 > if (type == "QCStringList")
0721 > type = "QValueList<QCString>";
0722 > if( i > args.count() )
0723 > {
0724 > qWarning("Not enough arguments.");
0725 > exit(1);
0726 > }
0727 > QString s = QString::fromLocal8Bit( args[ i ] );
0728 319,346c258,314
0729 < int j = i;
0730 < int count = 0;
0731 < // Parse list to get the count
0732 < while (true) {
0733 < if (j >= argc)
0734 < {
0735 < qWarning("List end-delimiter '%s' not found.", delim.latin1());
0736 < exit(1);
0737 < }
0738 < if (argv[j] == delim) break;
0739 < marshall(dummy_arg, argc, argv, j, type);
0740 < count++;
0741 < }
0742 < arg << (Q_UINT32) count;
0743 < // Parse the list for real
0744 < while (true) {
0745 < if (i >= argc)
0746 < {
0747 < qWarning("List end-delimiter '%s' not found.", delim.latin1());
0748 < exit(1);
0749 < }
0750 < if (argv[i] == delim) break;
0751 < marshall(arg, argc, argv, i, type);
0752 < }
0753 < } else {
0754 < qWarning( "cannot handle datatype '%s'", type.latin1() );
0755 < exit(1);
0756 < }
0757 ---
0758 > if ( type == "int" )
0759 > arg << s.toInt();
0760 > else if ( type == "uint" )
0761 > arg << s.toUInt();
0762 > else if ( type == "unsigned" )
0763 > arg << s.toUInt();
0764 > else if ( type == "unsigned int" )
0765 > arg << s.toUInt();
0766 > else if ( type == "long" )
0767 > arg << s.toLong();
0768 > else if ( type == "long int" )
0769 > arg << s.toLong();
0770 > else if ( type == "unsigned long" )
0771 > arg << s.toULong();
0772 > else if ( type == "unsigned long int" )
0773 > arg << s.toULong();
0774 > else if ( type == "float" )
0775 > arg << s.toFloat();
0776 > else if ( type == "double" )
0777 > arg << s.toDouble();
0778 > else if ( type == "bool" )
0779 > arg << mkBool( s );
0780 > else if ( type == "QString" )
0781 > arg << s;
0782 > else if ( type == "QCString" )
0783 > arg << QCString( args[ i ] );
0784 > else if ( type == "QColor" )
0785 > arg << mkColor( s );
0786 > else if ( type == "QPoint" )
0787 > arg << mkPoint( s );
0788 > else if ( type == "QSize" )
0789 > arg << mkSize( s );
0790 > else if ( type == "QRect" )
0791 > arg << mkRect( s );
0792 > else if ( type == "QVariant" ) {
0793 > if ( s == "true" || s == "false" )
0794 > arg << QVariant( mkBool( s ), 42 );
0795 > else if ( s.left( 4 ) == "int(" )
0796 > arg << QVariant( s.mid(4, s.length()-5).toInt() );
0797 > else if ( s.left( 7 ) == "QPoint(" )
0798 > arg << QVariant( mkPoint( s.mid(7, s.length()-8) ) );
0799 > else if ( s.left( 6 ) == "QSize(" )
0800 > arg << QVariant( mkSize( s.mid(6, s.length()-7) ) );
0801 > else if ( s.left( 6 ) == "QRect(" )
0802 > arg << QVariant( mkRect( s.mid(6, s.length()-7) ) );
0803 > else if ( s.left( 7 ) == "QColor(" )
0804 > arg << QVariant( mkColor( s.mid(7, s.length()-8) ) );
0805 > else
0806 > arg << QVariant( s );
0807 > } else if ( type.startsWith("QValueList<")) {
0808 > type = type.mid(11, type.length() - 12);
0809 > QStringList list;
0810 > QString delim = s;
0811 > if (delim == "[")
0812 > delim = "]";
0813 > if (delim == "(")
0814 > delim = ")";
0815 347a316,349
0816 > QByteArray dummy_data;
0817 > QDataStream dummy_arg(dummy_data, IO_WriteOnly);
0818 >
0819 > uint j = i;
0820 > uint count = 0;
0821 > // Parse list to get the count
0822 > while (true) {
0823 > if( j > args.count() )
0824 > {
0825 > qWarning("List end-delimiter '%s' not found.", delim.latin1());
0826 > exit(1);
0827 > }
0828 > if( QString::fromLocal8Bit( args[ j ] ) == delim )
0829 > break;
0830 > marshall( dummy_arg, args, j, type );
0831 > count++;
0832 > }
0833 > arg << (Q_UINT32) count;
0834 > // Parse the list for real
0835 > while (true) {
0836 > if( i > args.count() )
0837 > {
0838 > qWarning("List end-delimiter '%s' not found.", delim.latin1());
0839 > exit(1);
0840 > }
0841 > if( QString::fromLocal8Bit( args[ i ] ) == delim )
0842 > break;
0843 > marshall( arg, args, i, type );
0844 > }
0845 > } else {
0846 > qWarning( "cannot handle datatype '%s'", type.latin1() );
0847 > exit(1);
0848 > }
0849 > i++;