00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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
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
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
00086
00087
QString detailedErrorString();
00088
00089
public slots:
00090
00091
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
00107
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, Error };
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