summaryrefslogtreecommitdiffstats
path: root/kresources/egroupware/xmlrpciface.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:53:50 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:53:50 +0000
commit7be55ffa061c026e35e2d6a0effe1161ddb0d41f (patch)
tree8474f9b444b2756228600050f07a7ff25de532b2 /kresources/egroupware/xmlrpciface.cpp
parentf587f20a6d09f1729dd0a8c1cd8ee0110aec7451 (diff)
downloadtdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.tar.gz
tdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1157655 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kresources/egroupware/xmlrpciface.cpp')
-rw-r--r--kresources/egroupware/xmlrpciface.cpp280
1 files changed, 140 insertions, 140 deletions
diff --git a/kresources/egroupware/xmlrpciface.cpp b/kresources/egroupware/xmlrpciface.cpp
index 0158e23d1..2d91edbde 100644
--- a/kresources/egroupware/xmlrpciface.cpp
+++ b/kresources/egroupware/xmlrpciface.cpp
@@ -8,7 +8,7 @@
* (at your option) any later version. *
***************************************************************************/
-#include <qfile.h>
+#include <tqfile.h>
#include <kdebug.h>
#include <kio/job.h>
@@ -37,11 +37,11 @@ namespace KXMLRPC
{
return m_errorCode;
}
- QString errorString() const
+ TQString errorString() const
{
return m_errorString;
}
- QValueList<QVariant> data() const
+ TQValueList<TQVariant> data() const
{
return m_data;
}
@@ -49,24 +49,24 @@ namespace KXMLRPC
private:
bool m_success;
int m_errorCode;
- QString m_errorString;
- QValueList<QVariant> m_data;
+ TQString m_errorString;
+ TQValueList<TQVariant> m_data;
};
}
-Query *Query::create( const QVariant &id, QObject *parent, const char *name )
+Query *Query::create( const TQVariant &id, TQObject *parent, const char *name )
{
return new Query( id, parent, name );
}
-void Query::call( const QString &server, const QString &method,
- const QValueList<QVariant> &args, const QString &userAgent )
+void Query::call( const TQString &server, const TQString &method,
+ const TQValueList<TQVariant> &args, const TQString &userAgent )
{
- const QString xmlMarkup = markupCall( method, args );
+ const TQString xmlMarkup = markupCall( method, args );
DebugDialog::addMessage( xmlMarkup, DebugDialog::Output );
- QByteArray postData;
- QDataStream stream( postData, IO_WriteOnly );
+ TQByteArray postData;
+ TQDataStream stream( postData, IO_WriteOnly );
stream.writeRawBytes( xmlMarkup.utf8(), xmlMarkup.utf8().length() );
KIO::TransferJob *job = KIO::http_post( KURL( server ), postData, false );
@@ -78,15 +78,15 @@ void Query::call( const QString &server, const QString &method,
job->addMetaData( "content-type", "Content-Type: text/xml; charset=utf-8" );
job->addMetaData( "ConnectTimeout", "50" );
- connect( job, SIGNAL( data( KIO::Job *, const QByteArray & ) ),
- this, SLOT( slotData( KIO::Job *, const QByteArray & ) ) );
- connect( job, SIGNAL( result( KIO::Job * ) ),
- this, SLOT( slotResult( KIO::Job * ) ) );
+ connect( job, TQT_SIGNAL( data( KIO::Job *, const TQByteArray & ) ),
+ this, TQT_SLOT( slotData( KIO::Job *, const TQByteArray & ) ) );
+ connect( job, TQT_SIGNAL( result( KIO::Job * ) ),
+ this, TQT_SLOT( slotResult( KIO::Job * ) ) );
m_pendingJobs.append( job );
}
-void Query::slotData( KIO::Job *, const QByteArray &data )
+void Query::slotData( KIO::Job *, const TQByteArray &data )
{
unsigned int oldSize = m_buffer.size();
m_buffer.resize( oldSize + data.size() );
@@ -104,11 +104,11 @@ void Query::slotResult( KIO::Job *job )
return ;
}
- QString data = QString::fromUtf8( m_buffer.data(), m_buffer.size() );
+ TQString data = TQString::fromUtf8( m_buffer.data(), m_buffer.size() );
DebugDialog::addMessage( data, DebugDialog::Input );
- QDomDocument doc;
- QString errMsg;
+ TQDomDocument doc;
+ TQString errMsg;
int errLine, errCol;
if ( !doc.setContent( data, false, &errMsg, &errLine, &errCol ) )
{
@@ -134,17 +134,17 @@ void Query::slotResult( KIO::Job *job )
emit finished( this );
}
-bool Query::isMessageResponse( const QDomDocument &doc ) const
+bool Query::isMessageResponse( const TQDomDocument &doc ) const
{
return doc.documentElement().firstChild().toElement().tagName().lower() == "params";
}
-Result Query::parseMessageResponse( const QDomDocument &doc ) const
+Result Query::parseMessageResponse( const TQDomDocument &doc ) const
{
Result response;
response.m_success = true;
- QDomNode paramNode = doc.documentElement().firstChild().firstChild();
+ TQDomNode paramNode = doc.documentElement().firstChild().firstChild();
while ( !paramNode.isNull() )
{
response.m_data << demarshal( paramNode.firstChild().toElement() );
@@ -154,36 +154,36 @@ Result Query::parseMessageResponse( const QDomDocument &doc ) const
return response;
}
-bool Query::isFaultResponse( const QDomDocument &doc ) const
+bool Query::isFaultResponse( const TQDomDocument &doc ) const
{
return doc.documentElement().firstChild().toElement().tagName().lower() == "fault";
}
-Result Query::parseFaultResponse( const QDomDocument &doc ) const
+Result Query::parseFaultResponse( const TQDomDocument &doc ) const
{
Result response;
response.m_success = false;
- QDomNode errorNode = doc.documentElement().firstChild().firstChild();
- const QVariant errorVariant = demarshal( errorNode.toElement() );
+ TQDomNode errorNode = doc.documentElement().firstChild().firstChild();
+ const TQVariant errorVariant = demarshal( errorNode.toElement() );
response.m_errorCode = errorVariant.toMap() [ "faultCode" ].toInt();
response.m_errorString = errorVariant.toMap() [ "faultString" ].toString();
return response;
}
-QString Query::markupCall( const QString &cmd,
- const QValueList<QVariant> &args ) const
+TQString Query::markupCall( const TQString &cmd,
+ const TQValueList<TQVariant> &args ) const
{
- QString markup = "<?xml version=\"1.0\" ?>\r\n<methodCall>\r\n";
+ TQString markup = "<?xml version=\"1.0\" ?>\r\n<methodCall>\r\n";
markup += "<methodName>" + cmd + "</methodName>\r\n";
if ( !args.isEmpty() )
{
markup += "<params>\r\n";
- QValueList<QVariant>::ConstIterator it = args.begin();
- QValueList<QVariant>::ConstIterator end = args.end();
+ TQValueList<TQVariant>::ConstIterator it = args.begin();
+ TQValueList<TQVariant>::ConstIterator end = args.end();
for ( ; it != end; ++it )
markup += "<param>\r\n" + marshal( *it ) + "</param>\r\n";
markup += "</params>\r\n";
@@ -194,52 +194,52 @@ QString Query::markupCall( const QString &cmd,
return markup;
}
-QString Query::marshal( const QVariant &arg ) const
+TQString Query::marshal( const TQVariant &arg ) const
{
switch ( arg.type() )
{
- case QVariant::String:
- case QVariant::CString:
+ case TQVariant::String:
+ case TQVariant::CString:
{
- QString result = arg.toString();
+ TQString result = arg.toString();
result = result.replace( "&", "&amp;" );
result = result.replace( "\"", "&quot;" );
result = result.replace( "<", "&lt;" );
result = result.replace( ">", "&gt;" );
return "<value><string>" + result + "</string></value>\r\n";
}
- case QVariant::Int:
- return "<value><int>" + QString::number( arg.toInt() ) + "</int></value>\r\n";
- case QVariant::Double:
- return "<value><double>" + QString::number( arg.toDouble() ) + "</double></value>\r\n";
- case QVariant::Bool:
+ case TQVariant::Int:
+ return "<value><int>" + TQString::number( arg.toInt() ) + "</int></value>\r\n";
+ case TQVariant::Double:
+ return "<value><double>" + TQString::number( arg.toDouble() ) + "</double></value>\r\n";
+ case TQVariant::Bool:
{
- QString markup = "<value><boolean>";
+ TQString markup = "<value><boolean>";
markup += arg.toBool() ? "1" : "0";
markup += "</boolean></value>\r\n";
return markup;
}
- case QVariant::ByteArray:
+ case TQVariant::ByteArray:
return "<value><base64>" + KCodecs::base64Encode( arg.toByteArray() ) + "</base64></value>\r\n";
- case QVariant::DateTime:
+ case TQVariant::DateTime:
return "<value><datetime.iso8601>" + arg.toDateTime().toString( Qt::ISODate ) + "</datetime.iso8601></value>\r\n";
- case QVariant::List:
+ case TQVariant::List:
{
- QString markup = "<value><array><data>\r\n";
- const QValueList<QVariant> args = arg.toList();
- QValueList<QVariant>::ConstIterator it = args.begin();
- QValueList<QVariant>::ConstIterator end = args.end();
+ TQString markup = "<value><array><data>\r\n";
+ const TQValueList<TQVariant> args = arg.toList();
+ TQValueList<TQVariant>::ConstIterator it = args.begin();
+ TQValueList<TQVariant>::ConstIterator end = args.end();
for ( ; it != end; ++it )
markup += marshal( *it );
markup += "</data></array></value>\r\n";
return markup;
}
- case QVariant::Map:
+ case TQVariant::Map:
{
- QString markup = "<value><struct>\r\n";
- QMap<QString, QVariant> map = arg.toMap();
- QMap<QString, QVariant>::ConstIterator it = map.begin();
- QMap<QString, QVariant>::ConstIterator end = map.end();
+ TQString markup = "<value><struct>\r\n";
+ TQMap<TQString, TQVariant> map = arg.toMap();
+ TQMap<TQString, TQVariant>::ConstIterator it = map.begin();
+ TQMap<TQString, TQVariant>::ConstIterator end = map.end();
for ( ; it != end; ++it )
{
markup += "<member>\r\n";
@@ -253,76 +253,76 @@ QString Query::marshal( const QVariant &arg ) const
default:
kdWarning() << "Failed to marshal unknown variant type: " << arg.type() << endl;
};
- return QString::null;
+ return TQString::null;
}
-QVariant Query::demarshal( const QDomElement &elem ) const
+TQVariant Query::demarshal( const TQDomElement &elem ) const
{
Q_ASSERT( elem.tagName().lower() == "value" );
- const QDomElement typeElement = elem.firstChild().toElement();
- const QString typeName = typeElement.tagName().lower();
+ const TQDomElement typeElement = elem.firstChild().toElement();
+ const TQString typeName = typeElement.tagName().lower();
if ( typeName == "string" )
- return QVariant( typeElement.text() );
+ return TQVariant( typeElement.text() );
else if ( typeName == "i4" || typeName == "int" )
- return QVariant( typeElement.text().toInt() );
+ return TQVariant( typeElement.text().toInt() );
else if ( typeName == "double" )
- return QVariant( typeElement.text().toDouble() );
+ return TQVariant( typeElement.text().toDouble() );
else if ( typeName == "boolean" )
{
if ( typeElement.text().lower() == "true" || typeElement.text() == "1" )
- return QVariant( true );
+ return TQVariant( true );
else
- return QVariant( false );
+ return TQVariant( false );
}
else if ( typeName == "base64" )
- return QVariant( KCodecs::base64Decode( typeElement.text().latin1() ) );
+ return TQVariant( KCodecs::base64Decode( typeElement.text().latin1() ) );
else if ( typeName == "datetime" || typeName == "datetime.iso8601" )
- return QVariant( QDateTime::fromString( typeElement.text(), Qt::ISODate ) );
+ return TQVariant( TQDateTime::fromString( typeElement.text(), Qt::ISODate ) );
else if ( typeName == "array" )
{
- QValueList<QVariant> values;
- QDomNode valueNode = typeElement.firstChild().firstChild();
+ TQValueList<TQVariant> values;
+ TQDomNode valueNode = typeElement.firstChild().firstChild();
while ( !valueNode.isNull() )
{
values << demarshal( valueNode.toElement() );
valueNode = valueNode.nextSibling();
}
- return QVariant( values );
+ return TQVariant( values );
}
else if ( typeName == "struct" )
{
- QMap<QString, QVariant> map;
- QDomNode memberNode = typeElement.firstChild();
+ TQMap<TQString, TQVariant> map;
+ TQDomNode memberNode = typeElement.firstChild();
while ( !memberNode.isNull() )
{
- const QString key = memberNode.toElement().elementsByTagName( "name" ).item( 0 ).toElement().text();
- const QVariant data = demarshal( memberNode.toElement().elementsByTagName( "value" ).item( 0 ).toElement() );
+ const TQString key = memberNode.toElement().elementsByTagName( "name" ).item( 0 ).toElement().text();
+ const TQVariant data = demarshal( memberNode.toElement().elementsByTagName( "value" ).item( 0 ).toElement() );
map[ key ] = data;
memberNode = memberNode.nextSibling();
}
- return QVariant( map );
+ return TQVariant( map );
}
else
kdWarning() << "Cannot demarshal unknown type " << typeName << endl;
- return QVariant();
+ return TQVariant();
}
-Query::Query( const QVariant &id, QObject *parent, const char *name )
- : QObject( parent, name ), m_id( id )
+Query::Query( const TQVariant &id, TQObject *parent, const char *name )
+ : TQObject( parent, name ), m_id( id )
{}
Query::~Query()
{
- QValueList<KIO::Job*>::Iterator it;
+ TQValueList<KIO::Job*>::Iterator it;
for ( it = m_pendingJobs.begin(); it != m_pendingJobs.end(); ++it )
(*it)->kill();
}
-Server::Server( const KURL &url, QObject *parent, const char *name )
- : QObject( parent, name )
+Server::Server( const KURL &url, TQObject *parent, const char *name )
+ : TQObject( parent, name )
{
if ( url.isValid() )
m_url = url;
@@ -334,7 +334,7 @@ Server::Server( const KURL &url, QObject *parent, const char *name )
Server::~Server()
{
- QValueList<Query*>::Iterator it;
+ TQValueList<Query*>::Iterator it;
for ( it = mPendingQueries.begin(); it !=mPendingQueries.end(); ++it )
(*it)->deleteLater();
@@ -352,112 +352,112 @@ void Server::setUrl( const KURL &url )
m_url = url.isValid() ? url : KURL();
}
-void Server::call( const QString &method, const QValueList<QVariant> &args,
- QObject* msgObj, const char* messageSlot,
- QObject* faultObj, const char* faultSlot, const QVariant &id )
+void Server::call( const TQString &method, const TQValueList<TQVariant> &args,
+ TQObject* msgObj, const char* messageSlot,
+ TQObject* faultObj, const char* faultSlot, const TQVariant &id )
{
if ( m_url.isEmpty() )
kdWarning() << "Cannot execute call to " << method << ": empty server URL" << endl;
Query *query = Query::create( id, this );
- connect( query, SIGNAL( message( const QValueList<QVariant> &, const QVariant& ) ), msgObj, messageSlot );
- connect( query, SIGNAL( fault( int, const QString&, const QVariant& ) ), faultObj, faultSlot );
- connect( query, SIGNAL( finished( Query* ) ), this, SLOT( queryFinished( Query* ) ) );
+ connect( query, TQT_SIGNAL( message( const TQValueList<TQVariant> &, const TQVariant& ) ), msgObj, messageSlot );
+ connect( query, TQT_SIGNAL( fault( int, const TQString&, const TQVariant& ) ), faultObj, faultSlot );
+ connect( query, TQT_SIGNAL( finished( Query* ) ), this, TQT_SLOT( queryFinished( Query* ) ) );
mPendingQueries.append( query );
query->call( m_url.url(), method, args, m_userAgent );
}
-void Server::call( const QString &method, const QVariant &arg,
- QObject* msgObj, const char* messageSlot,
- QObject* faultObj, const char* faultSlot,
- const QVariant &id )
+void Server::call( const TQString &method, const TQVariant &arg,
+ TQObject* msgObj, const char* messageSlot,
+ TQObject* faultObj, const char* faultSlot,
+ const TQVariant &id )
{
- QValueList<QVariant> args;
+ TQValueList<TQVariant> args;
args << arg ;
call( method, args, msgObj, messageSlot, faultObj, faultSlot, id );
}
-void Server::call( const QString &method, int arg,
- QObject* msgObj, const char* messageSlot,
- QObject* faultObj, const char* faultSlot,
- const QVariant &id )
+void Server::call( const TQString &method, int arg,
+ TQObject* msgObj, const char* messageSlot,
+ TQObject* faultObj, const char* faultSlot,
+ const TQVariant &id )
{
- QValueList<QVariant> args;
- args << QVariant( arg );
+ TQValueList<TQVariant> args;
+ args << TQVariant( arg );
call( method, args, msgObj, messageSlot, faultObj, faultSlot, id );
}
-void Server::call( const QString &method, bool arg,
- QObject* msgObj, const char* messageSlot,
- QObject* faultObj, const char* faultSlot,
- const QVariant &id )
+void Server::call( const TQString &method, bool arg,
+ TQObject* msgObj, const char* messageSlot,
+ TQObject* faultObj, const char* faultSlot,
+ const TQVariant &id )
{
- QValueList<QVariant> args;
- args << QVariant( arg );
+ TQValueList<TQVariant> args;
+ args << TQVariant( arg );
call( method, args, msgObj, messageSlot, faultObj, faultSlot, id );
}
-void Server::call( const QString &method, double arg ,
- QObject* msgObj, const char* messageSlot,
- QObject* faultObj, const char* faultSlot,
- const QVariant &id )
+void Server::call( const TQString &method, double arg ,
+ TQObject* msgObj, const char* messageSlot,
+ TQObject* faultObj, const char* faultSlot,
+ const TQVariant &id )
{
- QValueList<QVariant> args;
- args << QVariant( arg );
+ TQValueList<TQVariant> args;
+ args << TQVariant( arg );
call( method, args, msgObj, messageSlot, faultObj, faultSlot, id );
}
-void Server::call( const QString &method, const QString &arg ,
- QObject* msgObj, const char* messageSlot,
- QObject* faultObj, const char* faultSlot,
- const QVariant &id )
+void Server::call( const TQString &method, const TQString &arg ,
+ TQObject* msgObj, const char* messageSlot,
+ TQObject* faultObj, const char* faultSlot,
+ const TQVariant &id )
{
- QValueList<QVariant> args;
- args << QVariant( arg );
+ TQValueList<TQVariant> args;
+ args << TQVariant( arg );
call( method, args, msgObj, messageSlot, faultObj, faultSlot, id );
}
-void Server::call( const QString &method, const QCString &arg,
- QObject* msgObj, const char* messageSlot,
- QObject* faultObj, const char* faultSlot,
- const QVariant &id )
+void Server::call( const TQString &method, const TQCString &arg,
+ TQObject* msgObj, const char* messageSlot,
+ TQObject* faultObj, const char* faultSlot,
+ const TQVariant &id )
{
- QValueList<QVariant> args;
- args << QVariant( arg );
+ TQValueList<TQVariant> args;
+ args << TQVariant( arg );
call( method, args, msgObj, messageSlot, faultObj, faultSlot, id );
}
-void Server::call( const QString &method, const QByteArray &arg ,
- QObject* msgObj, const char* messageSlot,
- QObject* faultObj, const char* faultSlot,
- const QVariant &id )
+void Server::call( const TQString &method, const TQByteArray &arg ,
+ TQObject* msgObj, const char* messageSlot,
+ TQObject* faultObj, const char* faultSlot,
+ const TQVariant &id )
{
- QValueList<QVariant> args;
- args << QVariant( arg );
+ TQValueList<TQVariant> args;
+ args << TQVariant( arg );
call( method, args, faultObj, faultSlot, msgObj, messageSlot, id );
}
-void Server::call( const QString &method, const QDateTime &arg,
- QObject* msgObj, const char* messageSlot,
- QObject* faultObj, const char* faultSlot,
- const QVariant &id )
+void Server::call( const TQString &method, const TQDateTime &arg,
+ TQObject* msgObj, const char* messageSlot,
+ TQObject* faultObj, const char* faultSlot,
+ const TQVariant &id )
{
- QValueList<QVariant> args;
- args << QVariant( arg );
+ TQValueList<TQVariant> args;
+ args << TQVariant( arg );
call( method, args, msgObj, messageSlot, faultObj, faultSlot, id );
}
-void Server::call( const QString &method, const QStringList &arg,
- QObject* msgObj, const char* messageSlot,
- QObject* faultObj, const char* faultSlot,
- const QVariant &id )
+void Server::call( const TQString &method, const TQStringList &arg,
+ TQObject* msgObj, const char* messageSlot,
+ TQObject* faultObj, const char* faultSlot,
+ const TQVariant &id )
{
- QValueList<QVariant> args;
- QStringList::ConstIterator it = arg.begin();
- QStringList::ConstIterator end = arg.end();
+ TQValueList<TQVariant> args;
+ TQStringList::ConstIterator it = arg.begin();
+ TQStringList::ConstIterator end = arg.end();
for ( ; it != end; ++it )
- args << QVariant( *it );
+ args << TQVariant( *it );
call( method, args, msgObj, messageSlot, faultObj, faultSlot, id );
}