diff options
Diffstat (limited to 'libkpimexchange/core/exchangedownload.cpp')
-rw-r--r-- | libkpimexchange/core/exchangedownload.cpp | 186 |
1 files changed, 93 insertions, 93 deletions
diff --git a/libkpimexchange/core/exchangedownload.cpp b/libkpimexchange/core/exchangedownload.cpp index dcf469549..c8a0a2150 100644 --- a/libkpimexchange/core/exchangedownload.cpp +++ b/libkpimexchange/core/exchangedownload.cpp @@ -18,11 +18,11 @@ Boston, MA 02110-1301, USA. */ -#include <qfile.h> -#include <qtextstream.h> -#include <qdatastream.h> -#include <qcstring.h> -#include <qregexp.h> +#include <tqfile.h> +#include <tqtextstream.h> +#include <tqdatastream.h> +#include <tqcstring.h> +#include <tqregexp.h> #include <kapplication.h> #include <kconfig.h> @@ -61,7 +61,7 @@ extern "C" { using namespace KPIM; -ExchangeDownload::ExchangeDownload( ExchangeAccount *account, QWidget *window ) +ExchangeDownload::ExchangeDownload( ExchangeAccount *account, TQWidget *window ) : mWindow( window ) { kdDebug() << "ExchangeDownload()" << endl; @@ -80,8 +80,8 @@ ExchangeDownload::~ExchangeDownload() if ( mEvents ) delete mEvents; } -void ExchangeDownload::download( KCal::Calendar *calendar, const QDate &start, - const QDate &end, bool showProgress ) +void ExchangeDownload::download( KCal::Calendar *calendar, const TQDate &start, + const TQDate &end, bool showProgress ) { mCalendar = calendar; mEvents = 0; @@ -92,14 +92,14 @@ void ExchangeDownload::download( KCal::Calendar *calendar, const QDate &start, mProgress = new ExchangeProgress(); mProgress->show(); - connect( this, SIGNAL( startDownload() ), mProgress, - SLOT( slotTransferStarted() ) ); - connect( this, SIGNAL(finishDownload() ), mProgress, - SLOT( slotTransferFinished() ) ); + connect( this, TQT_SIGNAL( startDownload() ), mProgress, + TQT_SLOT( slotTransferStarted() ) ); + connect( this, TQT_SIGNAL(finishDownload() ), mProgress, + TQT_SLOT( slotTransferFinished() ) ); #endif } - QString sql = dateSelectQuery( start, end.addDays( 1 ) ); + TQString sql = dateSelectQuery( start, end.addDays( 1 ) ); kdDebug() << "Exchange download query: " << endl << sql << endl; @@ -112,43 +112,43 @@ void ExchangeDownload::download( KCal::Calendar *calendar, const QDate &start, sql, false ); KIO::Scheduler::scheduleJob( job ); job->setWindow( mWindow ); - connect( job, SIGNAL( result( KIO::Job * ) ), - SLOT( slotSearchResult( KIO::Job *) ) ); + connect( job, TQT_SIGNAL( result( KIO::Job * ) ), + TQT_SLOT( slotSearchResult( KIO::Job *) ) ); } -void ExchangeDownload::download( const QDate& start, const QDate& end, bool showProgress ) +void ExchangeDownload::download( const TQDate& start, const TQDate& end, bool showProgress ) { mCalendar = 0; - mEvents = new QPtrList<KCal::Event>; + mEvents = new TQPtrList<KCal::Event>; if( showProgress ) { //kdDebug() << "Creating progress dialog" << endl; mProgress = new ExchangeProgress(); mProgress->show(); - connect( this, SIGNAL(startDownload()), mProgress, SLOT(slotTransferStarted()) ); - connect( this, SIGNAL(finishDownload()), mProgress, SLOT(slotTransferFinished()) ); + connect( this, TQT_SIGNAL(startDownload()), mProgress, TQT_SLOT(slotTransferStarted()) ); + connect( this, TQT_SIGNAL(finishDownload()), mProgress, TQT_SLOT(slotTransferFinished()) ); } - QString sql = dateSelectQuery( start, end.addDays( 1 ) ); + TQString sql = dateSelectQuery( start, end.addDays( 1 ) ); increaseDownloads(); KIO::DavJob *job = KIO::davSearch( mAccount->calendarURL(), "DAV:", "sql", sql, false ); KIO::Scheduler::scheduleJob(job); job->setWindow( mWindow ); - connect( job, SIGNAL( result( KIO::Job * ) ), - SLOT( slotSearchResult( KIO::Job * ) ) ); + connect( job, TQT_SIGNAL( result( KIO::Job * ) ), + TQT_SLOT( slotSearchResult( KIO::Job * ) ) ); } // Original query TODO: make query configurable -QString ExchangeDownload::dateSelectQuery( const QDate& start, const QDate& end ) +TQString ExchangeDownload::dateSelectQuery( const TQDate& start, const TQDate& end ) { - QString startString; + TQString startString; startString.sprintf("%04i/%02i/%02i",start.year(),start.month(),start.day()); - QString endString; + TQString endString; endString.sprintf("%04i/%02i/%02i",end.year(),end.month(),end.day()); - QString sql = + TQString sql = "SELECT \"DAV:href\", \"urn:schemas:calendar:instancetype\", \"urn:schemas:calendar:uid\"\r\n" "FROM Scope('shallow traversal of \"\"')\r\n" "WHERE \"urn:schemas:calendar:dtend\" > '" + startString + "'\r\n" @@ -158,15 +158,15 @@ QString ExchangeDownload::dateSelectQuery( const QDate& start, const QDate& end #if 0 // That's the "new" code that breaks with Exchange. It was meant for Opengroupware, but that got its own resource anyway -QString ExchangeDownload::dateSelectQuery( const QDate& start, const QDate& end ) +TQString ExchangeDownload::dateSelectQuery( const TQDate& start, const TQDate& end ) { - QString startString; + TQString startString; startString.sprintf( "%04i-%02i-%02iT00:00:00Z", start.year(), start.month(), start.day() ); - QString endString; + TQString endString; endString.sprintf( "%04i-%02i-%02iT23:59:59Z", end.year(), end.month(), end.day() ); - QString sql = + TQString sql = "SELECT \"DAV:href\", \"urn:schemas:calendar:instancetype\", " "\"urn:schemas:calendar:uid\"\r\n" "FROM Scope('shallow traversal of \"\"')\r\n" @@ -181,14 +181,14 @@ void ExchangeDownload::slotSearchResult( KIO::Job *job ) if ( job->error() ) { kdError() << "ExchangeDownload::slotSearchResult() error: " << job->error() << endl; - QString text = i18n("ExchangeDownload\nError accessing '%1': %2") + TQString text = i18n("ExchangeDownload\nError accessing '%1': %2") .arg( mAccount->calendarURL().prettyURL() ) .arg( job->errorString() ); KMessageBox::error( 0, text ); finishUp( ExchangeClient::CommunicationError, job ); return; } - QDomDocument &response = static_cast<KIO::DavJob *>( job )->response(); + TQDomDocument &response = static_cast<KIO::DavJob *>( job )->response(); kdDebug() << "Search result: " << endl << response.toString() << endl; @@ -205,7 +205,7 @@ void ExchangeDownload::slotMasterResult( KIO::Job *job ) finishUp( ExchangeClient::CommunicationError, job ); return; } - QDomDocument &response = static_cast<KIO::DavJob *>( job )->response(); + TQDomDocument &response = static_cast<KIO::DavJob *>( job )->response(); kdDebug() << "Search (master) result: " << endl << response.toString() << endl; @@ -214,7 +214,7 @@ void ExchangeDownload::slotMasterResult( KIO::Job *job ) decreaseDownloads(); } -void ExchangeDownload::handleAppointments( const QDomDocument &response, +void ExchangeDownload::handleAppointments( const TQDomDocument &response, bool recurrence ) { kdDebug() << "Entering handleAppointments" << endl; @@ -226,21 +226,21 @@ void ExchangeDownload::handleAppointments( const QDomDocument &response, return; } - for( QDomElement item = response.documentElement().firstChild().toElement(); + for( TQDomElement item = response.documentElement().firstChild().toElement(); !item.isNull(); item = item.nextSibling().toElement() ) { //kdDebug() << "Current item:" << item.tagName() << endl; - QDomNodeList propstats = item.elementsByTagNameNS( "DAV:", "propstat" ); + TQDomNodeList propstats = item.elementsByTagNameNS( "DAV:", "propstat" ); // kdDebug() << "Item has " << propstats.count() << " propstat children" << endl; for( uint i=0; i < propstats.count(); i++ ) { - QDomElement propstat = propstats.item(i).toElement(); - QDomElement prop = propstat.namedItem( "prop" ).toElement(); + TQDomElement propstat = propstats.item(i).toElement(); + TQDomElement prop = propstat.namedItem( "prop" ).toElement(); if ( prop.isNull() ) { kdError() << "Error: no <prop> in response" << endl; continue; } - 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; @@ -249,12 +249,12 @@ void ExchangeDownload::handleAppointments( const QDomDocument &response, //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); @@ -263,12 +263,12 @@ void ExchangeDownload::handleAppointments( const QDomDocument &response, continue; } - QDomElement hrefElement = prop.namedItem( "href" ).toElement(); + TQDomElement hrefElement = prop.namedItem( "href" ).toElement(); if ( hrefElement.isNull() ) { kdError() << "Error: no href in Exchange server reply" << endl; continue; } - QString href = hrefElement.text(); + TQString href = hrefElement.text(); KURL url(href); kdDebug() << "Getting appointment from url: " << url.prettyURL() << endl; @@ -283,10 +283,10 @@ void ExchangeDownload::handleAppointments( const QDomDocument &response, } } -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" @@ -301,15 +301,15 @@ 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 * ) ) ); } void ExchangeDownload::readAppointment( const KURL& url ) { - QDomDocument doc; - QDomElement root = addElement( doc, doc, "DAV:", "propfind" ); - QDomElement prop = addElement( doc, root, "DAV:", "prop" ); + TQDomDocument doc; + TQDomElement root = addElement( doc, doc, "DAV:", "propfind" ); + TQDomElement prop = addElement( doc, root, "DAV:", "prop" ); addElement( doc, prop, "urn:schemas:calendar:", "uid" ); addElement( doc, prop, "urn:schemas:calendar:", "timezoneid" ); addElement( doc, prop, "urn:schemas:calendar:", "timezone" ); @@ -349,8 +349,8 @@ void ExchangeDownload::readAppointment( const KURL& url ) KIO::Scheduler::scheduleJob( job ); job->setWindow( mWindow ); job->addMetaData( "errorPage", "false" ); - connect( job, SIGNAL( result( KIO::Job * ) ), - SLOT( slotPropFindResult( KIO::Job * ) ) ); + connect( job, TQT_SIGNAL( result( KIO::Job * ) ), + TQT_SLOT( slotPropFindResult( KIO::Job * ) ) ); } void ExchangeDownload::slotPropFindResult( KIO::Job *job ) @@ -364,16 +364,16 @@ void ExchangeDownload::slotPropFindResult( KIO::Job *job ) return; } - QDomDocument response = static_cast<KIO::DavJob *>( job )->response(); + TQDomDocument response = static_cast<KIO::DavJob *>( job )->response(); kdDebug() << "Response: " << endl; kdDebug() << response.toString() << endl; - QDomElement prop = response.documentElement().namedItem( "response" ) + TQDomElement prop = response.documentElement().namedItem( "response" ) .namedItem( "propstat" ).namedItem( "prop" ).toElement(); KCal::Event* event = new KCal::Event(); - QDomElement uidElement = prop.namedItem( "uid" ).toElement(); + TQDomElement uidElement = prop.namedItem( "uid" ).toElement(); if ( uidElement.isNull() ) { kdError() << "Error: no uid in Exchange server reply" << endl; finishUp( ExchangeClient::IllegalAppointmentError, @@ -383,14 +383,14 @@ void ExchangeDownload::slotPropFindResult( KIO::Job *job ) event->setUid( uidElement.text() ); // kdDebug() << "Got UID: " << uidElement.text() << endl; - QString timezoneid = prop.namedItem( "timezoneid" ).toElement().text(); + TQString timezoneid = prop.namedItem( "timezoneid" ).toElement().text(); // kdDebug() << "DEBUG: timezoneid = " << timezoneid << endl; - QString timezone = prop.namedItem( "timezone" ).toElement().text(); + TQString timezone = prop.namedItem( "timezone" ).toElement().text(); // kdDebug() << "DEBUG: timezone = " << timezone << endl; // mFormat is used for parsing recurrence rules. - QString localTimeZoneId; + TQString localTimeZoneId; if ( mCalendar ) { mFormat->setTimeZone( mCalendar->timeZoneId(), !mCalendar->isLocalTime() ); localTimeZoneId = mCalendar->timeZoneId(); @@ -399,65 +399,65 @@ void ExchangeDownload::slotPropFindResult( KIO::Job *job ) // If no mCalendar, stay in UTC } - QString lastModified = prop.namedItem( "lastmodified" ).toElement().text(); + TQString lastModified = prop.namedItem( "lastmodified" ).toElement().text(); if ( !lastModified.isEmpty() ) { - QDateTime dt = utcAsZone( QDateTime::fromString( lastModified, Qt::ISODate ), localTimeZoneId ); + TQDateTime dt = utcAsZone( TQDateTime::fromString( lastModified, Qt::ISODate ), localTimeZoneId ); event->setLastModified( dt ); kdDebug() << "Got lastModified:" << lastModified << ", " << dt.toString() << endl; } - QString organizer = prop.namedItem( "organizer" ).toElement().text(); + TQString organizer = prop.namedItem( "organizer" ).toElement().text(); // TODO: Does outlook have a common name? Or does the organizer already contain both? event->setOrganizer( organizer ); // kdDebug() << "Got organizer: " << organizer << endl; // Trying to find attendees, not working yet - QString contact = prop.namedItem( "contact" ).toElement().text(); + TQString contact = prop.namedItem( "contact" ).toElement().text(); // event->setOrganizer( organizer ); // kdDebug() << "DEBUG: Got contact: " << contact << endl; // This looks promising for finding attendees // FIXME: get this to work - QString to = prop.namedItem( "to" ).toElement().text(); + TQString to = prop.namedItem( "to" ).toElement().text(); // kdDebug() << "DEBUG: Got to: " << to << endl; - QStringList attn = QStringList::split( ",", to ); // This doesn't work: there can be commas between "" - QStringList::iterator it; + TQStringList attn = TQStringList::split( ",", to ); // This doesn't work: there can be commas between "" + TQStringList::iterator it; for ( it = attn.begin(); it != attn.end(); ++it ) { // kdDebug() << " attendee: " << (*it) << endl; - QString name = ""; + TQString name = ""; // KCal::Attendee* a = new KCal::Attendee( name, email ); // event->addAttendee( a ); } - QString readonly = prop.namedItem( "isreadonly" ).toElement().text(); + TQString readonly = prop.namedItem( "isreadonly" ).toElement().text(); event->setReadOnly( readonly == "1" ); kdDebug() << "Got readonly: " << readonly << ":" << (readonly != "0") << endl; - QString created = prop.namedItem( "created" ).toElement().text(); + TQString created = prop.namedItem( "created" ).toElement().text(); if ( !created.isEmpty() ) { - QDateTime dt = utcAsZone( QDateTime::fromString( created, Qt::ISODate ), + TQDateTime dt = utcAsZone( TQDateTime::fromString( created, Qt::ISODate ), localTimeZoneId ); event->setCreated( dt ); kdDebug() << "got created: " << dt.toString() << endl; } - QString dtstart = prop.namedItem( "dtstart" ).toElement().text(); + TQString dtstart = prop.namedItem( "dtstart" ).toElement().text(); if ( !dtstart.isEmpty() ) { - QDateTime dt = utcAsZone( QDateTime::fromString( dtstart, Qt::ISODate ), + TQDateTime dt = utcAsZone( TQDateTime::fromString( dtstart, Qt::ISODate ), localTimeZoneId ); event->setDtStart( dt ); kdDebug() << "got dtstart: " << dtstart << " becomes in timezone " << dt.toString() << endl; } - QString alldayevent = prop.namedItem( "alldayevent" ).toElement().text(); + TQString alldayevent = prop.namedItem( "alldayevent" ).toElement().text(); bool floats = alldayevent.toInt() != 0; event->setFloats( floats ); kdDebug() << "Got alldayevent: \"" << alldayevent << "\":" << floats << endl; - QString dtend = prop.namedItem( "dtend" ).toElement().text(); + TQString dtend = prop.namedItem( "dtend" ).toElement().text(); if ( !dtend.isEmpty() ) { - QDateTime dt = utcAsZone( QDateTime::fromString( dtend, Qt::ISODate ), + TQDateTime dt = utcAsZone( TQDateTime::fromString( dtend, Qt::ISODate ), localTimeZoneId ); // Outlook thinks differently about floating event timing than libkcal if ( floats ) dt = dt.addDays( -1 ); @@ -465,24 +465,24 @@ void ExchangeDownload::slotPropFindResult( KIO::Job *job ) kdDebug() << "got dtend: " << dtend << " becomes in timezone " << dt.toString() << endl; } - QString transparent = prop.namedItem( "transparent" ).toElement().text(); + TQString transparent = prop.namedItem( "transparent" ).toElement().text(); event->setTransparency( transparent.toInt() > 0 ? KCal::Event::Transparent : KCal::Event::Opaque ); // kdDebug() << "Got transparent: " << transparent << endl; - QString description = prop.namedItem( "textdescription" ).toElement().text(); + TQString description = prop.namedItem( "textdescription" ).toElement().text(); event->setDescription( description ); kdDebug() << "Got description: " << description << endl; - QString subject = prop.namedItem( "subject" ).toElement().text(); + TQString subject = prop.namedItem( "subject" ).toElement().text(); event->setSummary( subject ); kdDebug() << "Got summary: " << subject << endl; - QString location = prop.namedItem( "location" ).toElement().text(); + TQString location = prop.namedItem( "location" ).toElement().text(); event->setLocation( location ); // kdDebug() << "Got location: " << location << endl; - QString rrule = prop.namedItem( "rrule" ).toElement().text(); + TQString rrule = prop.namedItem( "rrule" ).toElement().text(); kdDebug() << "Got rrule: " << rrule << endl; if ( !rrule.isEmpty() ) { // Timezone should be handled automatically @@ -494,23 +494,23 @@ void ExchangeDownload::slotPropFindResult( KIO::Job *job ) } } - QDomElement keywords = prop.namedItem( "Keywords" ).toElement(); - QStringList categories; - QDomNodeList list = keywords.elementsByTagNameNS( "xml:", "v" ); + TQDomElement keywords = prop.namedItem( "Keywords" ).toElement(); + TQStringList categories; + TQDomNodeList list = keywords.elementsByTagNameNS( "xml:", "v" ); for( uint i=0; i < list.count(); i++ ) { - QDomElement item = list.item(i).toElement(); + TQDomElement item = list.item(i).toElement(); categories.append( item.text() ); } event->setCategories( categories ); // kdDebug() << "Got categories: " << categories.join( ", " ) << endl; - QDomElement exdate = prop.namedItem( "exdate" ).toElement(); + TQDomElement exdate = prop.namedItem( "exdate" ).toElement(); KCal::DateList exdates; list = exdate.elementsByTagNameNS( "xml:", "v" ); for( uint i=0; i < list.count(); i++ ) { - QDomElement item = list.item(i).toElement(); - QDate date = utcAsZone( QDateTime::fromString( item.text(), Qt::ISODate ), localTimeZoneId ).date(); + TQDomElement item = list.item(i).toElement(); + TQDate date = utcAsZone( TQDateTime::fromString( item.text(), Qt::ISODate ), localTimeZoneId ).date(); exdates.append( date ); // kdDebug() << "Got exdate: " << date.toString() << endl; } @@ -521,7 +521,7 @@ void ExchangeDownload::slotPropFindResult( KIO::Job *job ) // 1 Personal // 2 Private // 3 Company Confidential - QString sensitivity = prop.namedItem( "sensitivity" ).toElement().text(); + TQString sensitivity = prop.namedItem( "sensitivity" ).toElement().text(); if ( ! sensitivity.isNull() ) switch( sensitivity.toInt() ) { case 0: event->setSecrecy( KCal::Incidence::SecrecyPublic ); break; @@ -533,7 +533,7 @@ void ExchangeDownload::slotPropFindResult( KIO::Job *job ) // kdDebug() << "Got sensitivity: " << sensitivity << endl; - QString reminder = prop.namedItem( "reminderoffset" ).toElement().text(); + TQString reminder = prop.namedItem( "reminderoffset" ).toElement().text(); // kdDebug() << "Reminder offset: " << reminder << endl; if ( !reminder.isEmpty() ) { // Duration before event in seconds @@ -555,10 +555,10 @@ void ExchangeDownload::slotPropFindResult( KIO::Job *job ) //void addRelation(Incidence *); /** set the list of attachments/associated files for this event */ - //void setAttachments(const QStringList &attachments); + //void setAttachments(const TQStringList &attachments); /** set resources used, such as Office, Car, etc. */ - //void setResources(const QStringList &resources); + //void setResources(const TQStringList &resources); /** set the event's priority, 0 is undefined, 1 highest (decreasing order) */ //void setPriority(int priority); @@ -613,7 +613,7 @@ void ExchangeDownload::decreaseDownloads() } } -void ExchangeDownload::finishUp( int result, const QString &moreInfo ) +void ExchangeDownload::finishUp( int result, const TQString &moreInfo ) { kdDebug() << "ExchangeDownload::finishUp() " << result << " " << moreInfo << endl; @@ -635,8 +635,8 @@ void ExchangeDownload::finishUp( int result, const QString &moreInfo ) void ExchangeDownload::finishUp( int result, KIO::Job *job ) { - finishUp( result, QString("WebDAV job error code = ") + - QString::number( job->error() ) + ";\n" + "\"" + + finishUp( result, TQString("WebDAV job error code = ") + + TQString::number( job->error() ) + ";\n" + "\"" + job->errorString() + "\"" ); } |