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 <tqstring.h>
00043 #include <tqobject.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 TQString &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 TQByteArray &data );
00067
00068 signals:
00069 void freeBusyDownloaded( KCal::FreeBusy *, const TQString& email );
00070 void freeBusyDownloadError( const TQString& email );
00071
00072 private:
00073 FreeBusyManager *mManager;
00074 TQString mEmail;
00075
00076 TQCString mFreeBusyData;
00077 };
00078
00079 class FreeBusyManager : public TQObject, public KCal::FreeBusyCache
00080 {
00081 Q_OBJECT
00082 public:
00083 FreeBusyManager( TQObject *parent, const char *name );
00084
00085 void setCalendar( KCal::Calendar * );
00086
00088 void publishFreeBusy();
00089
00098 bool retrieveFreeBusy( const TQString &email, bool forceDownload );
00099
00100 void cancelRetrieval();
00101
00102 KCal::FreeBusy *iCalToFreeBusy( const TQCString &data );
00103
00107 KCal::FreeBusy *loadFreeBusy( const TQString &email );
00111 bool saveFreeBusy( KCal::FreeBusy *freebusy, const KCal::Person &person );
00112
00113
00117 KURL freeBusyUrl( const TQString &email );
00118
00122 TQString freeBusyDir();
00123
00128 void setBrokenUrl( bool isBroken );
00129
00130 public slots:
00131
00132 void slotPerhapsUploadFB();
00133
00134 signals:
00138 void freeBusyRetrieved( KCal::FreeBusy *, const TQString &email );
00139
00140 protected:
00141 void timerEvent( TQTimerEvent* );
00142
00146 TQString ownerFreeBusyAsString();
00147
00151 KCal::FreeBusy *ownerFreeBusy();
00152
00156 TQString freeBusyToIcal( KCal::FreeBusy * );
00157
00158 protected slots:
00159 bool processRetrieveQueue();
00160
00161 private slots:
00162 void slotUploadFreeBusyResult( KIO::Job * );
00163 void slotFreeBusyDownloadError( const TQString& email );
00164
00165 private:
00166 KCal::Calendar *mCalendar;
00167 KCal::ICalFormat mFormat;
00168
00169 TQStringList mRetrieveQueue;
00170
00171
00172 TQDateTime mNextUploadTime;
00173 int mTimerID;
00174 bool mUploadingFreeBusy;
00175 bool mBrokenUrl;
00176 };
00177
00178 #endif
|