2
Requires the Qt and KDE widget libraries, available at no cost at
3
http://www.trolltech.com and http://www.kde.org respectively
5
Copyright (c) 2002-2004 Klarälvdalens Datakonsult AB
6
<info@klaralvdalens-datakonsult.se>
8
This program is free software; you can redistribute it and/or modify
9
it under the terms of the GNU General Public License as published by
10
the Free Software Foundation; either version 2 of the License, or
11
(at your option) any later version.
13
This program is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
GNU General Public License for more details.
18
You should have received a copy of the GNU General Public License along
19
with this program; if not, write to the Free Software Foundation, Inc.,
20
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22
In addition, as a special exception, the copyright holders give
23
permission to link the code of this program with any edition of
24
the Qt library by Trolltech AS, Norway (or with modified versions
25
of Qt that use the same license as Qt), and distribute linked
26
combinations including the two. You must obey the GNU General
27
Public License in all respects for all of the code used other than
28
Qt. If you modify this file, you may extend this exception to
29
your version of the file, but you are not obligated to do so. If
30
you do not wish to do so, delete this exception statement from
33
#ifndef CALENDARSUPPORT_FREEBUSYMANAGER_H
34
#define CALENDARSUPPORT_FREEBUSYMANAGER_H
36
#include "calendarsupport_export.h"
38
#include <KCalCore/FreeBusyCache>
40
namespace CalendarSupport {
43
class FreeBusyManagerPrivate;
44
class FreeBusyManagerStatic;
46
class CALENDARSUPPORT_EXPORT FreeBusyManager : public QObject, public KCalCore::FreeBusyCache
51
* Returns the FreeBusyManager
53
static FreeBusyManager *self();
55
void setCalendar( CalendarSupport::Calendar * );
58
Publishes the owners freebusy information from the current calendar
59
starting from the current date/time to current date/time + freeBusyPublishDays.
60
If an upload is already in progress nothing happens.
62
@see KCalPrefBase::freeBusyPublishUrl()
63
@see KCalPrefBase::freeBusyPublishDays();
65
void publishFreeBusy( QWidget *parentWidget = 0 );
68
Mail the freebusy information.
70
void mailFreeBusy( int daysToPublish = 30, QWidget *parentWidget = 0 );
73
Retrieve the freebusy information of somebody else, i.e. it will not try
74
to download our own freebusy information. This method makes use of a local
75
cache, if the information for a given email is already downloaded it will
76
return the information from the cache.
78
The call is asynchronous, a download is started in the background (if
79
needed) and freeBusyRetrieved will be emitted when the download is finished.
81
@see KCalPrefs::thatIsMe( const QString &email );
83
@param email Address of the person for which the F/B list should be
85
@param forceDownload Set to true to trigger a download even when automatic
86
retrieval of freebusy information is disabled in the configuration.
87
@return true if a download is initiated, and false otherwise
89
bool retrieveFreeBusy( const QString &email, bool forceDownload,
90
QWidget *parentWidget = 0 );
93
Clears the retrieval queue, i.e. all retrieval request that are not started
94
yet will not start at all. The freebusy retrieval that currently is
95
downloading (if one) will not be canceled.
99
void cancelRetrieval();
102
Load freebusy information belonging to an email. The information is loaded
103
from a local file. If the file does not exists or doesn't contain valid
104
information 0 is returned. In that case the information should be retrieved
105
again by calling retrieveFreeBusy.
107
Implements KCalCore::FreeBusyCache::loadFreeBusy
109
@param email is a QString containing a email string in the
110
"FirstName LastName <emailaddress>" format.
112
virtual KCalCore::FreeBusy::Ptr loadFreeBusy( const QString &email );
115
Save freebusy information belonging to an email.
117
Implements KCalCore::FreeBusyCache::saveFreeBusy
119
@param freebusy is a pointer to a valid FreeBusy instance.
120
@param person is a valid Person instance.
122
virtual bool saveFreeBusy( const KCalCore::FreeBusy::Ptr &freebusy,
123
const KCalCore::Person::Ptr &person );
127
This signal is emitted to return results of free/busy requests.
129
void freeBusyRetrieved( const KCalCore::FreeBusy::Ptr &,
130
const QString &email );
133
/** React on timer events, used for delayed freebusy list uploading */
134
virtual void timerEvent( QTimerEvent * );
138
Creates a new FreeBusyManager, private because FreeBusyManager is a
142
virtual ~FreeBusyManager();
145
friend class FreeBusyManagerStatic;
147
FreeBusyManagerPrivate * const d_ptr;
148
Q_DECLARE_PRIVATE( FreeBusyManager )
149
Q_DISABLE_COPY( FreeBusyManager )
150
Q_PRIVATE_SLOT( d_ptr, void checkFreeBusyUrl() )
151
Q_PRIVATE_SLOT( d_ptr, void processFreeBusyDownloadResult( KJob * ) )
152
Q_PRIVATE_SLOT( d_ptr, void processFreeBusyUploadResult( KJob * ) )
153
Q_PRIVATE_SLOT( d_ptr, void processRetrieveQueue() )
154
Q_PRIVATE_SLOT( d_ptr, void uploadFreeBusy() )