libkpimexchange Library API Documentation

exchangeclient.h

00001 /*
00002     This file is part of libkpimexchange
00003     Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org>
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public License
00016     along with this library; see the file COPYING.LIB.  If not, write to
00017     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018     Boston, MA 02111-1307, USA.
00019 */
00020 #ifndef KDEPIM_EXCHANGE_CLIENT_H
00021 #define KDEPIM_EXCHANGE_CLIENT_H
00022 
00023 #include <qstring.h>
00024 #include <qdatetime.h>
00025 #include <qobject.h>
00026 #include <qhostaddress.h>
00027 #include <qptrlist.h>
00028 
00029 namespace KCal { 
00030   class Event;
00031   class Calendar;
00032 }
00033 
00034 namespace KIO { 
00035   class Job; 
00036 }
00037 
00038 namespace KPIM {
00039 
00040 class ExchangeAccount;
00041 class ExchangeDownload;
00042 class ExchangeUpload;
00043 class ExchangeDelete;
00044 //class ExchangeMonitor;
00045 
00046 class ExchangeClient : public QObject {
00047     Q_OBJECT
00048   public:
00049     ExchangeClient( ExchangeAccount* account, const QString& mTimeZoneId=QString::null );
00050     ~ExchangeClient();
00051 
00055     void setWindow(QWidget *window);
00056 
00060     QWidget *window() const;
00061 
00065     void setTimeZoneId( const QString& timeZoneId );
00066     QString timeZoneId();
00067         
00068     // synchronous functions
00069     enum { 
00070       ResultOK,  
00071       UnknownError, 
00072       CommunicationError, 
00073       ServerResponseError,  
00075       IllegalAppointmentError, 
00076       NonEventError, 
00077       EventWriteError, 
00078       DeleteUnknownEventError 
00079     };
00080 
00081     int downloadSynchronous( KCal::Calendar* calendar, const QDate& start, const QDate& end, bool showProgress=false);
00082     int uploadSynchronous( KCal::Event* event );
00083     int removeSynchronous( KCal::Event* event );
00084 
00085     // ExchangeMonitor* monitor( int pollMode, const QHostAddress& ownInterface );
00086 
00087     QString detailedErrorString();
00088 
00089   public slots:
00090     // Asynchronous functions, wait for "finished" signals for result
00091     // Deprecated: use download() without the Calendar* argument instead
00092     void download( KCal::Calendar* calendar, const QDate& start, const QDate& end, bool showProgress=false);
00093     void download( const QDate& start, const QDate& end, bool showProgress=false);
00094     void upload( KCal::Event* event );
00095     void remove( KCal::Event* event );
00096     void test();
00097 
00098   private slots:
00099     void slotDownloadFinished( ExchangeDownload* worker, int result, const QString& moreInfo );
00100     void slotDownloadFinished( ExchangeDownload* worker, int result, const QString& moreInfo, QPtrList<KCal::Event>& );
00101     void slotUploadFinished( ExchangeUpload* worker, int result, const QString& moreInfo );
00102     void slotRemoveFinished( ExchangeDelete* worker, int result, const QString& moreInfo );
00103     void slotSyncFinished( int result, const QString& moreInfo );
00104 
00105   signals:
00106     // Useful for progress dialogs, shows how much still needs to be done.
00107     // Not used right now, since ExchangeDownload provides its own progress dialog
00108     void startDownload();
00109     void finishDownload();
00110 
00111     void downloadFinished( int result, const QString& moreInfo );
00112     void event( KCal::Event* event, const KURL& url);
00113     void downloadFinished( int result, const QString& moreInfo, QPtrList<KCal::Event>& events );
00114     void uploadFinished( int result, const QString& moreInfo );
00115     void removeFinished( int result, const QString& moreInfo );
00116 
00117   private:
00118     void test2();
00119 
00120     enum { WaitingForResult, HaveResult };
00121    
00122     int mClientState;
00123     int mSyncResult;
00124     QString mDetailedErrorString;
00125     QWidget* mWindow;
00126     ExchangeAccount* mAccount;
00127     QString mTimeZoneId;
00128 };
00129 
00130 }
00131 
00132 #endif
KDE Logo
This file is part of the documentation for libkpimexchange Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat May 1 11:38:09 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003