Fix DCOP standard TQt object marshaling

This partially resolves Bug 1510
(cherry picked from commit 7e397d203c)
v3.5.13-sru
Timothy Pearson 12 years ago committed by Slávek Banko
parent 251896b94c
commit 83803589ba

@ -289,8 +289,9 @@ int callFunction( const char* app, const char* obj, const char* func, const QCSt
TQDataStream arg(data, IO_WriteOnly); TQDataStream arg(data, IO_WriteOnly);
uint i = 0; uint i = 0;
for( TQStringList::Iterator it = types.begin(); it != types.end(); ++it ) for( TQStringList::Iterator it = types.begin(); it != types.end(); ++it ) {
marshall( arg, args, i, *it ); marshall( arg, args, i, *it );
}
if ( i != args.count() ) if ( i != args.count() )
{ {

@ -278,10 +278,12 @@ void marshall( TQDataStream &arg, QCStringList args, uint &i, TQString type )
} }
TQString s = TQString::fromLocal8Bit( args[ i ] ); TQString s = TQString::fromLocal8Bit( args[ i ] );
if (type == "TQStringList") if (type == "TQStringList") {
type = "TQValueList<TQString>"; type = "TQValueList<TQString>";
if (type == "QCStringList") }
if (type == "QCStringList") {
type = "TQValueList<TQCString>"; type = "TQValueList<TQCString>";
}
if ( type == "int" ) if ( type == "int" )
arg << s.toInt(); arg << s.toInt();
@ -332,26 +334,39 @@ void marshall( TQDataStream &arg, QCStringList args, uint &i, TQString type )
else if ( type == "KURL" ) else if ( type == "KURL" )
arg << KURL( s ); arg << KURL( s );
else if ( type == "TQVariant" ) { else if ( type == "TQVariant" ) {
if ( s == "true" || s == "false" ) int tqPointKeywordLength = strlen("TQPoint");
int tqSizeKeywordLength = strlen("TQSize");
int tqRectKeywordLength = strlen("TQRect");
int tqColorKeywordLength = strlen("TQColor");
if ( s == "true" || s == "false" ) {
arg << TQVariant( mkBool( s ), 42 ); arg << TQVariant( mkBool( s ), 42 );
else if ( s.left( 4 ) == "int(" ) }
else if ( s.left( 4 ) == "int(" ) {
arg << TQVariant( s.mid(4, s.length()-5).toInt() ); arg << TQVariant( s.mid(4, s.length()-5).toInt() );
else if ( s.left( 7 ) == "TQPoint(" ) }
arg << TQVariant( mkPoint( s.mid(7, s.length()-8) ) ); else if ( s.left( (tqPointKeywordLength+1) ) == "TQPoint(" ) {
else if ( s.left( 6 ) == "TQSize(" ) arg << TQVariant( mkPoint( s.mid((tqPointKeywordLength+1), s.length()-(tqPointKeywordLength+2)) ) );
arg << TQVariant( mkSize( s.mid(6, s.length()-7) ) ); }
else if ( s.left( 6 ) == "TQRect(" ) else if ( s.left( (tqSizeKeywordLength+1) ) == "TQSize(" ) {
arg << TQVariant( mkRect( s.mid(6, s.length()-7) ) ); arg << TQVariant( mkSize( s.mid((tqSizeKeywordLength+1), s.length()-(tqSizeKeywordLength+2)) ) );
else if ( s.left( 7 ) == "TQColor(" ) }
arg << TQVariant( mkColor( s.mid(7, s.length()-8) ) ); else if ( s.left( (tqRectKeywordLength+1) ) == "TQRect(" ) {
else arg << TQVariant( mkRect( s.mid((tqRectKeywordLength+1), s.length()-(tqRectKeywordLength+2)) ) );
}
else if ( s.left( (tqColorKeywordLength+1) ) == "TQColor(" ) {
arg << TQVariant( mkColor( s.mid((tqColorKeywordLength+1), s.length()-(tqColorKeywordLength+2)) ) );
}
else {
arg << TQVariant( s ); arg << TQVariant( s );
} else if ( type.startsWith("TQValueList<") || }
type == "KURL::List" ) { } else if ( type.startsWith("TQValueList<") || type == "KURL::List" ) {
if ( type == "KURL::List" ) if ( type == "KURL::List" ) {
type = "KURL"; type = "KURL";
else }
type = type.mid(11, type.length() - 12); else {
int tqValueListKeywordLength = strlen("TQValueList");
type = type.mid((tqValueListKeywordLength+1), type.length() - (tqValueListKeywordLength+2));
}
TQStringList list; TQStringList list;
TQString delim = s; TQString delim = s;
if (delim == "[") if (delim == "[")

Loading…
Cancel
Save