From b363d2579af0a11b77e698aed2e1021c2233b644 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sat, 26 Jan 2013 13:17:50 -0600 Subject: Rename a number of libraries and executables to avoid conflicts with KDE4 --- .../newexchange/exchangecalendaradaptor.cpp | 183 +++++++++++++++++++++ 1 file changed, 183 insertions(+) create mode 100644 tderesources/newexchange/exchangecalendaradaptor.cpp (limited to 'tderesources/newexchange/exchangecalendaradaptor.cpp') diff --git a/tderesources/newexchange/exchangecalendaradaptor.cpp b/tderesources/newexchange/exchangecalendaradaptor.cpp new file mode 100644 index 000000000..89c9b742e --- /dev/null +++ b/tderesources/newexchange/exchangecalendaradaptor.cpp @@ -0,0 +1,183 @@ +/* + This file is part of tdepim. + + Copyright (C) 2004 Reinhold Kainhofer + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "exchangecalendaradaptor.h" +#include "exchangeglobals.h" +#include "exchangeconvertercalendar.h" +#include +#include +#include +#include +#include +#include +#include "davcalendaradaptor.h" + +using namespace KCal; + +ExchangeCalendarUploadItem::ExchangeCalendarUploadItem( CalendarAdaptor *adaptor, KCal::Incidence *incidence, KPIM::GroupwareUploadItem::UploadType type ) + : GroupwareUploadItem( type ) +{ + if ( incidence && adaptor ) { + if ( incidence->type() == "Event" ) mItemType = KPIM::FolderLister::Event; + else if ( incidence->type() == "Todo" ) mItemType = KPIM::FolderLister::Todo; + else if ( incidence->type() == "Journal" ) mItemType = KPIM::FolderLister::Journal; +kdDebug()<<"mItemType=="<customProperty( adaptor->identifier(), "storagelocation" ) ); + setUid( incidence->uid() ); + + ExchangeConverterCalendar format; + format.setTimeZone( adaptor->resource()->timeZoneId() ); + mDavData = format.createWebDAV( incidence ); + } +} + +TDEIO::TransferJob *ExchangeCalendarUploadItem::createUploadJob( KPIM::GroupwareDataAdaptor *adaptor, const KURL &baseUrl ) +{ +kdDebug()<<"ExchangeCalendarUploadItem::createUploadJob, adaptor="<calendarURL(), "DAV:", "sql", query, false ); + job->setWindow( mWindow ); + connect(job, TQT_SIGNAL(result( TDEIO::Job * )), this, TQT_SLOT(slotFindUidResult(TDEIO::Job *))); +} + +*/ + + +TQString ExchangeCalendarAdaptor::defaultNewItemName( KPIM::GroupwareUploadItem *item ) { + if ( item ) return item->uid()+".EML"; + else return TQString(); +} + +KPIM::GroupwareUploadItem *ExchangeCalendarAdaptor::newUploadItem( KCal::Incidence*it, + KPIM::GroupwareUploadItem::UploadType type ) +{ + return new ExchangeCalendarUploadItem( this, it, type ); +} + +bool ExchangeCalendarAdaptor::interpretUploadJob( TDEIO::Job *job, const TQString &/*jobData*/ ) +{ + kdDebug(7000) << "ExchangeCalendarAdaptor::interpretUploadJob " << endl; + TDEIO::DavJob *davjob = dynamic_cast(job); + bool error = job->error(); + const TQString err = job->errorString(); + + if ( davjob ) { + if ( error ) { + emit itemUploadError( davjob->url(), err ); + return false; + } else { + TQDomDocument doc( davjob->response() ); + // TODO: extract the href and the items that got a 404. If there's + // something important among them, issue the "usual" not-all-settings-uploaded + // warning to the user. + + // We don't know the local id here (and we don't want to extract it from + // the idMapper, that's the task of the receiver + emit itemUploaded( uidFromJob( job ), davjob->url() ); + } + return true; + } else { + return false; + } +} + +bool ExchangeCalendarAdaptor::interpretUploadNewJob( TDEIO::Job *job, const TQString &/*jobData*/ ) +{ +// TODO: How does the incidence mapper know the old/new ids??? + kdDebug(7000) << "ExchangeCalendarAdaptor::interpretUploadNewJob " << endl; + TDEIO::DavJob *davjob = dynamic_cast(job); + bool error = job->error(); + const TQString err = job->errorString(); + + if ( davjob ) { + if ( error ) { + emit itemUploadNewError( idMapper()->localId( davjob->url().path() ), err ); + return false; + } else { + TQDomDocument doc( davjob->response() ); + // TODO: extract the href and the items that got a 404. If there's + // something important among them, issue the "usual" not-all-settings-uploaded + // warning to the user. + + // We don't know the local id here (and we don't want to extract it from + // the idMapper, that's the task of the receiver + emit itemUploadedNew( uidFromJob( job ), davjob->url() ); + } + return true; + } else { + return false; + } +} + -- cgit v1.2.1