diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:53:50 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:53:50 +0000 |
commit | 7be55ffa061c026e35e2d6a0effe1161ddb0d41f (patch) | |
tree | 8474f9b444b2756228600050f07a7ff25de532b2 /kresources/newexchange/exchangeconvertercalendar.cpp | |
parent | f587f20a6d09f1729dd0a8c1cd8ee0110aec7451 (diff) | |
download | tdepim-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/newexchange/exchangeconvertercalendar.cpp')
-rw-r--r-- | kresources/newexchange/exchangeconvertercalendar.cpp | 152 |
1 files changed, 76 insertions, 76 deletions
diff --git a/kresources/newexchange/exchangeconvertercalendar.cpp b/kresources/newexchange/exchangeconvertercalendar.cpp index bc0481daf..be32291be 100644 --- a/kresources/newexchange/exchangeconvertercalendar.cpp +++ b/kresources/newexchange/exchangeconvertercalendar.cpp @@ -56,7 +56,7 @@ ExchangeConverterCalendar::ExchangeConverterCalendar() { } -void ExchangeConverterCalendar::setTimeZone( const QString &id ) +void ExchangeConverterCalendar::setTimeZone( const TQString &id ) { // kdDebug() << "Setting timezone to: " << id << endl; mFormat.setTimeZone( id, true ); @@ -75,7 +75,7 @@ void ExchangeConverterCalendar::setTimeZone( const QString &id ) #define property( prop ) \ WebdavHandler::addElement( doc, root, prop ) -void ExchangeConverterCalendar::createRequestIncidence( QDomDocument &doc, QDomElement &root ) +void ExchangeConverterCalendar::createRequestIncidence( TQDomDocument &doc, TQDomElement &root ) { propertyDAV( "contentclass" ); propertyDAV( "getcontenttype" ); @@ -98,10 +98,10 @@ void ExchangeConverterCalendar::createRequestIncidence( QDomDocument &doc, QDomE propertyHTTPMail( "hasattachment" ); } -void ExchangeConverterCalendar::createRequestAppointment( QDomDocument &doc, QDomElement &root ) +void ExchangeConverterCalendar::createRequestAppointment( TQDomDocument &doc, TQDomElement &root ) { createRequestIncidence( doc, root ); - QDomAttr att_c = doc.createAttribute( "xmlns:c" ); + TQDomAttr att_c = doc.createAttribute( "xmlns:c" ); att_c.setValue( "urn:schemas:calendar:" ); doc.documentElement().setAttributeNode( att_c ); propertyCalendar( "uid" ); @@ -132,17 +132,17 @@ void ExchangeConverterCalendar::createRequestAppointment( QDomDocument &doc, QDo #define propertyTask2( prop ) \ WebdavHandler::addElement( doc, props, "t2:"prop ) -void ExchangeConverterCalendar::createRequestTask( QDomDocument &doc, QDomElement &props ) +void ExchangeConverterCalendar::createRequestTask( TQDomDocument &doc, TQDomElement &props ) { createRequestIncidence( doc, props ); - QDomElement root = doc.documentElement(); + TQDomElement root = doc.documentElement(); - QDomAttr att_t1 = doc.createAttribute( "xmlns:t1" ); + TQDomAttr att_t1 = doc.createAttribute( "xmlns:t1" ); att_t1.setValue( TaskNamespace1 ); root.setAttributeNode( att_t1 ); - QDomAttr att_t2 = doc.createAttribute( "xmlns:t2" ); + TQDomAttr att_t2 = doc.createAttribute( "xmlns:t2" ); att_t2.setValue( TaskNamespace2 ); root.setAttributeNode( att_t2 ); @@ -169,7 +169,7 @@ void ExchangeConverterCalendar::createRequestTask( QDomDocument &doc, QDomElemen #undef propertyTask1 #undef propertyTask2 -void ExchangeConverterCalendar::createRequestJournal( QDomDocument &doc, QDomElement &root ) +void ExchangeConverterCalendar::createRequestJournal( TQDomDocument &doc, TQDomElement &root ) { createRequestIncidence( doc, root ); propertyDAV( "uid" ); @@ -183,21 +183,21 @@ void ExchangeConverterCalendar::createRequestJournal( QDomDocument &doc, QDomEle #undef propertyMailHeader #undef property -bool ExchangeConverterCalendar::readTZ( const QDomElement &node, Incidence */*incidence*/ ) +bool ExchangeConverterCalendar::readTZ( const TQDomElement &node, Incidence */*incidence*/ ) { - QString timezoneid; + TQString timezoneid; if ( WebdavHandler::extractString( node, "timezoneid", timezoneid ) ) { // kdDebug() << "DEBUG: timezoneid = " << timezoneid << endl; } - QString timezone; + TQString timezone; if ( WebdavHandler::extractString( node, "timezone", timezone ) ) { // kdDebug() << "DEBUG: timezone = " << timezone << endl; } // TODO: /* // mFormat is used for parsing recurrence rules. - QString localTimeZoneId; + TQString localTimeZoneId; if ( mCalendar ) { mFormat.setTimeZone( mCalendar->timeZoneId(), !mCalendar->isLocalTime() ); localTimeZoneId = mCalendar->timeZoneId(); @@ -209,14 +209,14 @@ bool ExchangeConverterCalendar::readTZ( const QDomElement &node, Incidence */*in return true; } -bool ExchangeConverterCalendar::readIncidence( const QDomElement &node, Incidence *incidence ) +bool ExchangeConverterCalendar::readIncidence( const TQDomElement &node, Incidence *incidence ) { kdDebug()<<"ExchangeConverterCalendar::readIncidencd"<<endl; - QDateTime tmpdt; + TQDateTime tmpdt; bool tmpbool; - QString tmpstr; + TQString tmpstr; long tmplng; - QStringList tmplst; + TQStringList tmplst; readTZ( node, incidence ); @@ -264,9 +264,9 @@ kdDebug()<<"ExchangeConverterCalendar::readIncidencd"<<endl; if ( WebdavHandler::extractString( node, "from", tmpstr ) ) incidence->setOrganizer( tmpstr ); if ( WebdavHandler::extractString( node, "to", tmpstr ) ) { - QStringList atts( KPIM::splitEmailAddrList( tmpstr ) ); - for ( QStringList::Iterator it = atts.begin(); it != atts.end(); ++it ) { - QString name, email; + TQStringList atts( KPIM::splitEmailAddrList( tmpstr ) ); + for ( TQStringList::Iterator it = atts.begin(); it != atts.end(); ++it ) { + TQString name, email; KPIM::getNameAndMail( *it, name, email ); Attendee *att = new Attendee( name, email ); att->setRole( KCal::Attendee::ReqParticipant ); @@ -279,9 +279,9 @@ kdDebug()<<"ExchangeConverterCalendar::readIncidencd"<<endl; } } if ( WebdavHandler::extractString( node, "cc", tmpstr ) ) { - QStringList atts( KPIM::splitEmailAddrList( tmpstr ) ); - for ( QStringList::Iterator it = atts.begin(); it != atts.end(); ++it ) { - QString name, email; + TQStringList atts( KPIM::splitEmailAddrList( tmpstr ) ); + for ( TQStringList::Iterator it = atts.begin(); it != atts.end(); ++it ) { + TQString name, email; KPIM::getNameAndMail( *it, name, email ); Attendee *att = new Attendee( name, email ); att->setRole( KCal::Attendee::OptParticipant ); @@ -298,10 +298,10 @@ kdDebug()<<"ExchangeConverterCalendar::readIncidencd"<<endl; } /* FIXME: Handle recurrences -void ExchangeDownload::handleRecurrence( QString uid ) +void ExchangeDownload::handleRecurrence( TQString uid ) { // kdDebug() << "Handling recurrence info for uid=" << uid << endl; - QString query = + TQString query = "SELECT \"DAV:href\", \"urn:schemas:calendar:instancetype\"\r\n" "FROM Scope('shallow traversal of \"\"')\r\n" "WHERE \"urn:schemas:calendar:uid\" = '" + uid + "'\r\n" @@ -314,18 +314,18 @@ void ExchangeDownload::handleRecurrence( QString uid ) query, false ); KIO::Scheduler::scheduleJob( job ); job->setWindow( mWindow ); - connect( job, SIGNAL( result( KIO::Job * ) ), - SLOT( slotMasterResult( KIO::Job * ) ) ); + connect( job, TQT_SIGNAL( result( KIO::Job * ) ), + TQT_SLOT( slotMasterResult( KIO::Job * ) ) ); } */ -bool ExchangeConverterCalendar::readEvent( const QDomElement &node, Event *event ) +bool ExchangeConverterCalendar::readEvent( const TQDomElement &node, Event *event ) { if ( !readIncidence( node, event ) ) return false; kdDebug()<<"ExchangeConverterCalendar::readEvent"<<endl; - QDateTime tmpdt; - QString tmpstr; + TQDateTime tmpdt; + TQString tmpstr; long tmplng; bool tmpbool; @@ -405,19 +405,19 @@ kdDebug()<<"ExchangeConverterCalendar::readIncidence: ERROR: No UID given"<<endl } } - QStringList tmplst; + TQStringList tmplst; if ( WebdavHandler::extractStringList( node, "exdate", tmplst ) ) { - QStringList::Iterator it = tmplst.begin(); + TQStringList::Iterator it = tmplst.begin(); KCal::DateList exdates; for ( ; it != tmplst.end(); ++it ) { - exdates.append( /*utcAsZone(*/ QDateTime::fromString( *it, Qt::ISODate )/*, + exdates.append( /*utcAsZone(*/ TQDateTime::fromString( *it, Qt::ISODate )/*, localTimeZoneId )*/.date() ); } event->recurrence()->setExDates( exdates ); } // FIXME: use rdate and exrule! /* FIXME: Recurring events, they are split up - QDomElement instancetypeElement = prop.namedItem( "instancetype" ).toElement(); + TQDomElement instancetypeElement = prop.namedItem( "instancetype" ).toElement(); if ( instancetypeElement.isNull() ) { kdError() << "Error: no instance type in Exchange server reply" << endl; continue; @@ -426,12 +426,12 @@ kdDebug()<<"ExchangeConverterCalendar::readIncidence: ERROR: No UID given"<<endl //kdDebug() << "Instance type: " << instanceType << endl; if ( recurrence && instanceType > 0 ) { - QDomElement uidElement = prop.namedItem( "uid" ).toElement(); + TQDomElement uidElement = prop.namedItem( "uid" ).toElement(); if ( uidElement.isNull() ) { kdError() << "Error: no uid in Exchange server reply" << endl; continue; } - QString uid = uidElement.text(); + TQString uid = uidElement.text(); if ( ! m_uids.contains( uid ) ) { m_uids[uid] = 1; handleRecurrence(uid); @@ -448,7 +448,7 @@ kdDebug()<<"ExchangeConverterCalendar::readIncidence: ERROR: No UID given"<<endl return true; } -bool ExchangeConverterCalendar::readTodo( const QDomElement &node, Todo *todo ) +bool ExchangeConverterCalendar::readTodo( const TQDomElement &node, Todo *todo ) { if ( !readIncidence( node, todo ) ) return false; kdDebug()<<"ExchangeConverterCalendar::readTodo"<<endl; @@ -456,11 +456,11 @@ kdDebug()<<"ExchangeConverterCalendar::readTodo"<<endl; // FIXME: Retrieve time zone: "timezone" // FIXME: What to with TaskProp_Owner and TaskProp_ContactNames? - QDateTime tmpdt; + TQDateTime tmpdt; float tmpfloat; long tmplong; bool tmpbool; - QString tmpstr; + TQString tmpstr; // The UID is absolutely required! // FIXME: Which field shall be used as uid??? @@ -503,12 +503,12 @@ kdDebug()<<"ExchangeConverterCalendar::readIncidence: ERROR: No UID given"<<endl return true; } -bool ExchangeConverterCalendar::readJournal( const QDomElement &node, Journal *journal ) +bool ExchangeConverterCalendar::readJournal( const TQDomElement &node, Journal *journal ) { if ( !readIncidence( node, journal ) ) return false; kdDebug()<<"ExchangeConverterCalendar::readJournal"<<endl; - QDateTime tmpdt; - QString tmpstr; + TQDateTime tmpdt; + TQString tmpstr; // The UID is absolutely required! // FIXME: Which field shall be used as UID? if ( WebdavHandler::extractString( node, "uid", tmpstr ) ) { @@ -528,13 +528,13 @@ kdDebug()<<"ExchangeConverterCalendar::readJournal: ERROR: No UID given"<<endl; return true; } -Incidence::List ExchangeConverterCalendar::parseWebDAV( const QDomDocument& davdata ) +Incidence::List ExchangeConverterCalendar::parseWebDAV( const TQDomDocument& davdata ) { - QDomElement prop = davdata.documentElement().namedItem( "response" ) + TQDomElement prop = davdata.documentElement().namedItem( "response" ) .namedItem( "propstat" ).namedItem( "prop" ).toElement(); if ( prop.isNull() ) return Incidence::List(); - QString contentclass; + TQString contentclass; bool success = WebdavHandler::extractString( prop, "contentclass", contentclass ); if ( !success ) return Incidence::List(); @@ -581,7 +581,7 @@ class ExchangeConverterCalendar::createWebDAVVisitor : public IncidenceBase::Vis { public: createWebDAVVisitor() : Visitor() {} - bool act( QDomDocument doc, QDomElement el, IncidenceBase *incidence, const QString &timeZoneId ) + bool act( TQDomDocument doc, TQDomElement el, IncidenceBase *incidence, const TQString &timeZoneId ) { mDoc = doc; mElement = el; @@ -589,15 +589,15 @@ class ExchangeConverterCalendar::createWebDAVVisitor : public IncidenceBase::Vis return incidence->accept( *this ); } protected: - void addBoolProp( QDomElement &el ) { el.setAttribute( "b:dt", "boolean" ); } - void addDateProp( QDomElement &el ) { el.setAttribute( "b:dt", "dateTime.tz" ); } - void addFloatProp( QDomElement &el ) { el.setAttribute( "b:dt", "float" ); } - void addIntProp( QDomElement &el ) { el.setAttribute( "b:dt", "int" ); } - QString timePropString( const QDateTime &dt ) { return dt.toString( Qt::ISODate )+"Z"; } + void addBoolProp( TQDomElement &el ) { el.setAttribute( "b:dt", "boolean" ); } + void addDateProp( TQDomElement &el ) { el.setAttribute( "b:dt", "dateTime.tz" ); } + void addFloatProp( TQDomElement &el ) { el.setAttribute( "b:dt", "float" ); } + void addIntProp( TQDomElement &el ) { el.setAttribute( "b:dt", "int" ); } + TQString timePropString( const TQDateTime &dt ) { return dt.toString( Qt::ISODate )+"Z"; } bool visitIncidence( Incidence *incidence ) { - QString tmpstr; + TQString tmpstr; domDavProperty( "isreadonly", (incidence->isReadOnly())?"1":"0" ); // FIXME: scheduling ID // domProperty( "http://schemas.microsoft.com/repl/", "repl-uid", ??? ); @@ -607,7 +607,7 @@ class ExchangeConverterCalendar::createWebDAVVisitor : public IncidenceBase::Vis // domHTTPMailProperty( "date", ??? ); // timestamp not available in libkcal // domDavProperty( "comment", incidence->comments() ); // libkcal has a QStringlist, not one string // domProperty( "urn:schemas-microsoft-com:office:office", "Keywords", ??? ); // It's a <v>entyr1</v><v>entry2</v> String list! - tmpstr = QString::null; + tmpstr = TQString::null; switch ( incidence->secrecy() ) { case KCal::Incidence::SecrecyPublic: tmpstr = "0"; break; case KCal::Incidence::SecrecyPrivate: tmpstr = "2"; break; @@ -617,14 +617,14 @@ class ExchangeConverterCalendar::createWebDAVVisitor : public IncidenceBase::Vis if ( !tmpstr.isEmpty() ) domProperty( "http://schemas.microsoft.com/exchange/", "sensitivity", tmpstr ); - domHTTPMailProperty( "priority", QString::number(incidence->priority()) ); + domHTTPMailProperty( "priority", TQString::number(incidence->priority()) ); domMailHeaderProperty( "from", incidence->organizer().fullName() ); // Attendees: - tmpstr = QString::null; - QStringList reqattnames; - QStringList optattnames; + tmpstr = TQString::null; + TQStringList reqattnames; + TQStringList optattnames; Attendee::List atts = incidence->attendees(); for ( Attendee::List::Iterator it = atts.begin(); it != atts.end(); ++it ) { switch ( (*it)->role() ) { @@ -652,7 +652,7 @@ class ExchangeConverterCalendar::createWebDAVVisitor : public IncidenceBase::Vis { if ( !visitIncidence(event) ) return false; - QDomAttr att_c = mDoc.createAttribute( "xmlns:c" ); + TQDomAttr att_c = mDoc.createAttribute( "xmlns:c" ); att_c.setValue( "urn:schemas:calendar:" ); mDoc.documentElement().setAttributeNode( att_c ); @@ -660,7 +660,7 @@ class ExchangeConverterCalendar::createWebDAVVisitor : public IncidenceBase::Vis domProperty( "http://schemas.microsoft.com/exchange/", "outlookmessageclass", "IPM.Appointment" ); domCalendarProperty( "uid", event->uid() ); - QDomElement el = domCalendarProperty( "created", timePropString( WebdavHandler::zoneAsUtc( event->created(), mTimeZoneId ) ) ); + TQDomElement el = domCalendarProperty( "created", timePropString( WebdavHandler::zoneAsUtc( event->created(), mTimeZoneId ) ) ); addDateProp( el ); el = domCalendarProperty( "lastmodified", timePropString( WebdavHandler::zoneAsUtc( event->lastModified(), mTimeZoneId ) ) ); addDateProp( el ); @@ -668,7 +668,7 @@ class ExchangeConverterCalendar::createWebDAVVisitor : public IncidenceBase::Vis // FIXME: domCalendarProperty( "sequence", event->sequence() ); domCalendarProperty( "location", event->location() ); - QString tmpstr( QString::null ); + TQString tmpstr( TQString::null ); switch ( event->transparency() ) { case KCal::Event::Transparent: tmpstr = "FREE"; break; case KCal::Event::Opaque: tmpstr = "BUSY"; break; @@ -684,7 +684,7 @@ class ExchangeConverterCalendar::createWebDAVVisitor : public IncidenceBase::Vis el = domCalendarProperty( "dtend", timePropString( WebdavHandler::zoneAsUtc( event->dtEnd(), mTimeZoneId ) ) ); addDateProp( el ); } else { - domCalendarProperty( "duration", QString::number( event->duration() ) ); + domCalendarProperty( "duration", TQString::number( event->duration() ) ); } // FIXME: Convert the recurrence rule to a string: if ( event->doesRecur() ) { @@ -703,7 +703,7 @@ class ExchangeConverterCalendar::createWebDAVVisitor : public IncidenceBase::Vis Alarm::List alarms = event->alarms(); for( it = alarms.begin(); it != alarms.end(); ++it ) { if ((*it)->hasStartOffset()) { - domCalendarProperty( "reminderoffset", QString::number( (*it)->startOffset().asSeconds() * -1 ) ); + domCalendarProperty( "reminderoffset", TQString::number( (*it)->startOffset().asSeconds() * -1 ) ); } else { kdDebug() << "ExchangeConverterCalendar::createWebDAVVisitor: Alarm type not supported\n"; } @@ -715,11 +715,11 @@ class ExchangeConverterCalendar::createWebDAVVisitor : public IncidenceBase::Vis { if ( !visitIncidence(todo) ) return false; - QDomAttr att_t1 = mDoc.createAttribute( "xmlns:t1" ); + TQDomAttr att_t1 = mDoc.createAttribute( "xmlns:t1" ); att_t1.setValue( TaskNamespace1 ); mDoc.documentElement().setAttributeNode( att_t1 ); - QDomAttr att_t2 = mDoc.createAttribute( "xmlns:t2" ); + TQDomAttr att_t2 = mDoc.createAttribute( "xmlns:t2" ); att_t2.setValue( TaskNamespace2 ); mDoc.documentElement().setAttributeNode( att_t2 ); @@ -765,9 +765,9 @@ class ExchangeConverterCalendar::createWebDAVVisitor : public IncidenceBase::Vis } protected: - QDomDocument mDoc; - QDomElement mElement; - QString mTimeZoneId; + TQDomDocument mDoc; + TQDomElement mElement; + TQString mTimeZoneId; }; // Prefixes for the namespaces: @@ -780,27 +780,27 @@ class ExchangeConverterCalendar::createWebDAVVisitor : public IncidenceBase::Vis // o... office // -QDomDocument ExchangeConverterCalendar::createWebDAV( Incidence *incidence ) +TQDomDocument ExchangeConverterCalendar::createWebDAV( Incidence *incidence ) { // TODO - QDomDocument doc; - QDomElement root = WebdavHandler::addDavElement( doc, doc, "d:propertyupdate" ); - QDomElement set = WebdavHandler::addElement( doc, root, "d:set" ); - QDomElement prop = WebdavHandler::addElement( doc, set, "d:prop" ); + TQDomDocument doc; + TQDomElement root = WebdavHandler::addDavElement( doc, doc, "d:propertyupdate" ); + TQDomElement set = WebdavHandler::addElement( doc, root, "d:set" ); + TQDomElement prop = WebdavHandler::addElement( doc, set, "d:prop" ); - QDomAttr att_b = doc.createAttribute( "xmlns:b" ); + TQDomAttr att_b = doc.createAttribute( "xmlns:b" ); att_b.setValue( "urn:schemas-microsoft-com:datatypes" ); root.setAttributeNode( att_b ); - QDomAttr att_h = doc.createAttribute( "xmlns:h" ); + TQDomAttr att_h = doc.createAttribute( "xmlns:h" ); att_h.setValue( "urn:schemas:mailheader:" ); root.setAttributeNode( att_h ); - QDomAttr att_m = doc.createAttribute( "xmlns:m" ); + TQDomAttr att_m = doc.createAttribute( "xmlns:m" ); att_m.setValue( "urn:schemas:httpmail:" ); root.setAttributeNode( att_m ); -// QDomAttr att1 = doc.createAttributeNS( "do:whatever:you:like", "x:attname"); +// TQDomAttr att1 = doc.createAttributeNS( "do:whatever:you:like", "x:attname"); // att1.setValue( "value" ); // prop.setAttributeNodeNS( att1 ); // root.setAttributeNodeNS( att1 ); |