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 
00027 namespace KCal { 
00028   class Event;
00029   class Calendar;
00030 }
00031 
00032 namespace KIO { 
00033   class Job; 
00034 }
00035 
00036 namespace KPIM {
00037 
00038 class ExchangeAccount;
00039 class ExchangeDownload;
00040 class ExchangeUpload;
00041 class ExchangeDelete;
00042 
00043 class ExchangeClient : public QObject {
00044     Q_OBJECT
00045   public:
00046     ExchangeClient( ExchangeAccount* account, const QString& mTimeZoneId=QString::null );
00047     ~ExchangeClient();
00048 
00052     void setWindow(QWidget *window);
00053 
00057     QWidget *window() const;
00058 
00062     void setTimeZoneId( const QString& timeZoneId );
00063     QString timeZoneId();
00064         
00065     // synchronous functions
00066     enum { 
00067       ResultOK,  
00068       UnknownError, 
00069       CommunicationError, 
00070       ServerResponseError,  
00072       IllegalAppointmentError, 
00073       NonEventError, 
00074       EventWriteError, 
00075       DeleteUnknownEventError 
00076     };
00077 
00078     int downloadSynchronous( KCal::Calendar* calendar, const QDate& start, const QDate& end, bool showProgress=false);
00079     int uploadSynchronous( KCal::Event* event );
00080     int removeSynchronous( KCal::Event* event );
00081 
00082     QString detailedErrorString();
00083 
00084   public slots:
00085     // Asynchronous functions, wait for "finished" signals for result
00086     void download( KCal::Calendar* calendar, const QDate& start, const QDate& end, bool showProgress=false);
00087     void upload( KCal::Event* event );
00088     void remove( KCal::Event* event );
00089     void test();
00090 
00091   private slots:
00092     void slotDownloadFinished( ExchangeDownload* worker, int result, const QString& moreInfo );
00093     void slotUploadFinished( ExchangeUpload* worker, int result, const QString& moreInfo );
00094     void slotRemoveFinished( ExchangeDelete* worker, int result, const QString& moreInfo );
00095     void slotSyncFinished( int result, const QString& moreInfo );
00096 
00097   signals:
00098     // Useful for progress dialogs, shows how much still needs to be done.
00099     // Not used right now, since ExchangeDownload provides its own progress dialog
00100     void startDownload();
00101     void finishDownload();
00102 
00103     void uploadFinished( int result, const QString& moreInfo );
00104     void downloadFinished( int result, const QString& moreInfo );
00105     void removeFinished( int result, const QString& moreInfo );
00106 
00107   private:
00108     void test2();
00109 
00110     enum { WaitingForResult, HaveResult };
00111    
00112     int mClientState;
00113     int mSyncResult;
00114     QString mDetailedErrorString;
00115     QWidget* mWindow;
00116     ExchangeAccount* mAccount;
00117     QString mTimeZoneId;
00118 };
00119 
00120 }
00121 
00122 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sun Feb 15 11:40:58 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2001