korganizer
freebusymanager.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef FREEBUSYMANAGER_H
00037 #define FREEBUSYMANAGER_H
00038
00039 #include <kurl.h>
00040 #include <libkcal/icalformat.h>
00041 #include <libkcal/freebusycache.h>
00042 #include <qstring.h>
00043 #include <qobject.h>
00044
00045 namespace KIO { class Job; }
00046 namespace KCal {
00047 class Calendar;
00048 class FreeBusy;
00049 }
00050 class FreeBusyManager;
00051
00055 class FreeBusyDownloadJob : public QObject
00056 {
00057 Q_OBJECT
00058 public:
00059 FreeBusyDownloadJob( const QString &email, const KURL &url,
00060 FreeBusyManager *manager, const char *name = 0 );
00061
00062 virtual ~FreeBusyDownloadJob();
00063
00064 protected slots:
00065 void slotResult( KIO::Job * );
00066 void slotData( KIO::Job *, const QByteArray &data );
00067
00068 signals:
00069 void freeBusyDownloaded( KCal::FreeBusy *, const QString& );
00070
00071 private:
00072 FreeBusyManager *mManager;
00073 QString mEmail;
00074
00075 QCString mFreeBusyData;
00076 };
00077
00078 class FreeBusyManager : public QObject, public KCal::FreeBusyCache
00079 {
00080 Q_OBJECT
00081 public:
00082 FreeBusyManager( QObject *parent, const char *name );
00083
00084 void setCalendar( KCal::Calendar * );
00085
00087 void publishFreeBusy();
00088
00097 bool retrieveFreeBusy( const QString &email, bool forceDownload );
00098
00099 void cancelRetrieval();
00100
00101 KCal::FreeBusy *iCalToFreeBusy( const QCString &data );
00102
00106 KCal::FreeBusy *loadFreeBusy( const QString &email );
00110 bool saveFreeBusy( KCal::FreeBusy *freebusy, const KCal::Person &person );
00111
00112
00116 KURL freeBusyUrl( const QString &email );
00117
00121 QString freeBusyDir();
00122
00127 void setBrokenUrl( bool isBroken );
00128
00129 public slots:
00130
00131 void slotPerhapsUploadFB();
00132
00133 signals:
00137 void freeBusyRetrieved( KCal::FreeBusy *, const QString &email );
00138
00139 protected:
00140 void timerEvent( QTimerEvent* );
00141
00145 QString ownerFreeBusyAsString();
00146
00150 KCal::FreeBusy *ownerFreeBusy();
00151
00155 QString freeBusyToIcal( KCal::FreeBusy * );
00156
00157 protected slots:
00158 bool processRetrieveQueue();
00159
00160 private slots:
00161 void slotUploadFreeBusyResult( KIO::Job * );
00162
00163 private:
00164 KCal::Calendar *mCalendar;
00165 KCal::ICalFormat mFormat;
00166
00167 QStringList mRetrieveQueue;
00168
00169
00170 QDateTime mNextUploadTime;
00171 int mTimerID;
00172 bool mUploadingFreeBusy;
00173 bool mBrokenUrl;
00174
00175 };
00176
00177 #endif
|