diff options
Diffstat (limited to 'kresources/slox/webdavhandler.cpp')
-rw-r--r-- | kresources/slox/webdavhandler.cpp | 104 |
1 files changed, 52 insertions, 52 deletions
diff --git a/kresources/slox/webdavhandler.cpp b/kresources/slox/webdavhandler.cpp index 511373d51..3f1b6be86 100644 --- a/kresources/slox/webdavhandler.cpp +++ b/kresources/slox/webdavhandler.cpp @@ -39,7 +39,7 @@ #include <kdebug.h> #include <kconfig.h> -#include <qfile.h> +#include <tqfile.h> SloxItem::SloxItem() : status( Invalid ) @@ -57,81 +57,81 @@ WebdavHandler::WebdavHandler() kdDebug() << "LOG FILE: " << mLogFile << endl; } -void WebdavHandler::setUserId( const QString &id ) +void WebdavHandler::setUserId( const TQString &id ) { mUserId = id; } -QString WebdavHandler::userId() const +TQString WebdavHandler::userId() const { return mUserId; } -void WebdavHandler::log( const QString &text ) +void WebdavHandler::log( const TQString &text ) { if ( mLogFile.isEmpty() ) return; - QString filename = mLogFile + "-" + QString::number( mLogCount ); - QFile file( filename ); + TQString filename = mLogFile + "-" + TQString::number( mLogCount ); + TQFile file( filename ); if ( !file.open( IO_WriteOnly ) ) { kdWarning() << "Unable to open log file '" << filename << "'" << endl; return; } - QCString textUtf8 = text.utf8(); + TQCString textUtf8 = text.utf8(); file.writeBlock( textUtf8.data(), textUtf8.size() - 1 ); if ( ++mLogCount > 5 ) mLogCount = 0; } -QValueList<SloxItem> WebdavHandler::getSloxItems( SloxBase *res, const QDomDocument &doc ) +TQValueList<SloxItem> WebdavHandler::getSloxItems( SloxBase *res, const TQDomDocument &doc ) { kdDebug() << "getSloxItems" << endl; - QValueList<SloxItem> items; + TQValueList<SloxItem> items; - QDomElement docElement = doc.documentElement(); + TQDomElement docElement = doc.documentElement(); - QDomNode responseNode; + TQDomNode responseNode; for( responseNode = docElement.firstChild(); !responseNode.isNull(); responseNode = responseNode.nextSibling() ) { - QDomElement responseElement = responseNode.toElement(); + TQDomElement responseElement = responseNode.toElement(); if ( responseElement.tagName() == "response" ) { SloxItem item; - QDomNode propstat = responseElement.namedItem( "propstat" ); + TQDomNode propstat = responseElement.namedItem( "propstat" ); if ( propstat.isNull() ) { kdError() << "Unable to find propstat tag." << endl; continue; } - QDomNode prop = propstat.namedItem( "prop" ); + TQDomNode prop = propstat.namedItem( "prop" ); if ( prop.isNull() ) { kdError() << "Unable to find WebDAV property" << endl; continue; } item.domNode = prop; - QDomNode sloxIdNode = prop.namedItem( res->fieldName( SloxBase::ObjectId ) ); + TQDomNode sloxIdNode = prop.namedItem( res->fieldName( SloxBase::ObjectId ) ); if ( sloxIdNode.isNull() ) { kdError() << "Unable to find SLOX id." << endl; continue; } - QDomElement sloxIdElement = sloxIdNode.toElement(); + TQDomElement sloxIdElement = sloxIdNode.toElement(); item.sloxId = sloxIdElement.text(); - QDomNode clientIdNode = prop.namedItem( res->fieldName( SloxBase::ClientId ) ); + TQDomNode clientIdNode = prop.namedItem( res->fieldName( SloxBase::ClientId ) ); if ( !clientIdNode.isNull() ) { - QDomElement clientIdElement = clientIdNode.toElement(); + TQDomElement clientIdElement = clientIdNode.toElement(); item.clientId = clientIdElement.text(); if ( item.clientId != item.sloxId ) item.status = SloxItem::New; } - QDomNode sloxStatus = prop.namedItem( res->fieldName( SloxBase::ObjectStatus ) ); + TQDomNode sloxStatus = prop.namedItem( res->fieldName( SloxBase::ObjectStatus ) ); if ( !sloxStatus.isNull() ) { - QDomElement sloxStatusElement = sloxStatus.toElement(); + TQDomElement sloxStatusElement = sloxStatus.toElement(); if ( sloxStatusElement.text() == "DELETE" ) { item.status = SloxItem::Delete; } else if ( sloxStatusElement.text() == "CREATE" ) { @@ -139,14 +139,14 @@ QValueList<SloxItem> WebdavHandler::getSloxItems( SloxBase *res, const QDomDocum } } - QDomNode status = propstat.namedItem( "status" ); + TQDomNode status = propstat.namedItem( "status" ); if ( status.isNull() ) { kdError() << "Unable to find WebDAV status" << endl; continue; } item.response = status.toElement().text(); - QDomNode desc = propstat.namedItem( "responsedescription" ); + TQDomNode desc = propstat.namedItem( "responsedescription" ); if ( desc.isNull() ) { kdError() << "Unable to find WebDAV responsedescription" << endl; continue; @@ -160,22 +160,22 @@ QValueList<SloxItem> WebdavHandler::getSloxItems( SloxBase *res, const QDomDocum return items; } -QString WebdavHandler::qDateTimeToSlox( const QDateTime &dt ) +TQString WebdavHandler::qDateTimeToSlox( const TQDateTime &dt ) { - uint ticks = -dt.secsTo( QDateTime( QDate( 1970, 1, 1 ), QTime( 0, 0 ) ) ); + uint ticks = -dt.secsTo( TQDateTime( TQDate( 1970, 1, 1 ), TQTime( 0, 0 ) ) ); - return QString::number( ticks ) + "000"; + return TQString::number( ticks ) + "000"; } -QString WebdavHandler::qDateTimeToSlox( const QDateTime &dt, - const QString &timeZoneId ) +TQString WebdavHandler::qDateTimeToSlox( const TQDateTime &dt, + const TQString &timeZoneId ) { - QDateTime utc = KPimPrefs::localTimeToUtc( dt, timeZoneId ); + TQDateTime utc = KPimPrefs::localTimeToUtc( dt, timeZoneId ); // secsTo and toTime_t etc also perform a timezone conversion using the system timezone, // but we want to use the calendar timezone, so we have to convert ourself and spoof the tz to UTC before // converting to ticks to prevent this - QCString origTz = getenv("TZ"); + TQCString origTz = getenv("TZ"); setenv( "TZ", "UTC", 1 ); uint ticks = utc.toTime_t(); if ( origTz.isNull() ) @@ -183,12 +183,12 @@ QString WebdavHandler::qDateTimeToSlox( const QDateTime &dt, else setenv( "TZ", origTz, 1 ); - return QString::number( ticks ) + "000"; + return TQString::number( ticks ) + "000"; } -QDateTime WebdavHandler::sloxToQDateTime( const QString &str ) +TQDateTime WebdavHandler::sloxToQDateTime( const TQString &str ) { - QString s = str.mid( 0, str.length() - 3 ); + TQString s = str.mid( 0, str.length() - 3 ); bool preEpoch = s.startsWith("-"); if (preEpoch) @@ -196,7 +196,7 @@ QDateTime WebdavHandler::sloxToQDateTime( const QString &str ) unsigned long ticks = s.toULong(); - QDateTime dt; + TQDateTime dt; if (preEpoch) { dt.setTime_t( 0, Qt::UTC ); @@ -214,60 +214,60 @@ QDateTime WebdavHandler::sloxToQDateTime( const QString &str ) return dt; } -QDateTime WebdavHandler::sloxToQDateTime( const QString &str, - const QString &timeZoneId ) +TQDateTime WebdavHandler::sloxToQDateTime( const TQString &str, + const TQString &timeZoneId ) { return KPimPrefs::utcToLocalTime( sloxToQDateTime(str), timeZoneId ); } -QDomElement WebdavHandler::addElement( QDomDocument &doc, QDomNode &node, - const QString &tag ) +TQDomElement WebdavHandler::addElement( TQDomDocument &doc, TQDomNode &node, + const TQString &tag ) { - QDomElement el = doc.createElement( tag ); + TQDomElement el = doc.createElement( tag ); node.appendChild( el ); return el; } -QDomElement WebdavHandler::addDavElement( QDomDocument &doc, QDomNode &node, - const QString &tag ) +TQDomElement WebdavHandler::addDavElement( TQDomDocument &doc, TQDomNode &node, + const TQString &tag ) { - QDomElement el = doc.createElementNS( "DAV:", "D:" + tag ); + TQDomElement el = doc.createElementNS( "DAV:", "D:" + tag ); node.appendChild( el ); return el; } -QDomElement WebdavHandler::addSloxElement( SloxBase *res, - QDomDocument &doc, QDomNode &node, - const QString &tag, - const QString &text ) +TQDomElement WebdavHandler::addSloxElement( SloxBase *res, + TQDomDocument &doc, TQDomNode &node, + const TQString &tag, + const TQString &text ) { - QDomElement el; + TQDomElement el; if ( res->resType() == "ox" ) el = doc.createElementNS( "http://www.open-xchange.org", "ox:" + tag ); else el = doc.createElementNS( "SLOX", "S:" + tag ); if ( !text.isEmpty() ) { - QDomText textnode = doc.createTextNode( text ); + TQDomText textnode = doc.createTextNode( text ); el.appendChild( textnode ); } node.appendChild( el ); return el; } -void WebdavHandler::parseSloxAttribute( const QDomElement &e ) +void WebdavHandler::parseSloxAttribute( const TQDomElement &e ) { // kdDebug() << "parseSloxAttribute" << endl; - QString tag = e.tagName(); - QString text = QString::fromUtf8( e.text().latin1() ); + TQString tag = e.tagName(); + TQString text = TQString::fromUtf8( e.text().latin1() ); if ( text.isEmpty() ) return; if ( tag == "owner" ) { if ( text == mUserId ) mWritable = true; } else if ( tag == "writerights" ) { - QDomNode n; + TQDomNode n; for( n = e.firstChild(); !n.isNull(); n = n.nextSibling() ) { - QDomElement e2 = n.toElement(); + TQDomElement e2 = n.toElement(); if ( e2.tagName() == "member" ) { if ( e2.text() == mUserId ) mWritable = true; } |