Akonadi::FreeBusyManager Class
| Header: | #include <Akonadi/FreeBusyManager> |
| CMake: | find_package(KPim6AkonadiCalendar REQUIRED)target_link_libraries(mytarget PRIVATE KPim6::AkonadiCalendar) |
| Inherits: | QObject and |
Public Functions
| void | cancelRetrieval() |
| void | mailFreeBusy(int daysToPublish = 30, QWidget *parentWidget = nullptr) |
| void | publishFreeBusy(QWidget *parentWidget = nullptr) |
| bool | retrieveFreeBusy(const QString &email, bool forceDownload, QWidget *parentWidget = nullptr) |
| void | setCalendar(const Akonadi::ETMCalendar::Ptr &calendar) |
Reimplemented Public Functions
| virtual KCalendarCore::FreeBusy::Ptr | loadFreeBusy(const QString &email) override |
| virtual bool | saveFreeBusy(const KCalendarCore::FreeBusy::Ptr &freebusy, const KCalendarCore::Person &person) override |
Signals
| void | freeBusyRetrieved(const KCalendarCore::FreeBusy::Ptr &, const QString &) |
Static Public Members
| Akonadi::FreeBusyManager * | self() |
Reimplemented Protected Functions
| virtual void | timerEvent(QTimerEvent *event) override |
Detailed Description
Member Function Documentation
void FreeBusyManager::cancelRetrieval()
Clears the retrieval queue, i.e. all retrieval request that are not started yet will not start at all. The freebusy retrieval that currently is downloading (if one) will not be canceled.
See also retrieveFreeBusy.
[signal] void FreeBusyManager::freeBusyRetrieved(const KCalendarCore::FreeBusy::Ptr &, const QString &)
This signal is emitted to return results of free/busy requests.
[override virtual] KCalendarCore::FreeBusy::Ptr FreeBusyManager::loadFreeBusy(const QString &email)
Load freebusy information belonging to an email. The information is loaded from a local file. If the file does not exists or doesn't contain valid information 0 is returned. In that case the information should be retrieved again by calling retrieveFreeBusy.
Implements KCalendarCore::FreeBusyCache::loadFreeBusy
email is a QString containing a email string in the "FirstName LastName <emailaddress>" format.
[invokable] void FreeBusyManager::mailFreeBusy(int daysToPublish = 30, QWidget *parentWidget = nullptr)
Mail the freebusy information.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
[invokable] void FreeBusyManager::publishFreeBusy(QWidget *parentWidget = nullptr)
Publishes the owners freebusy information from the current calendar starting from the current date/time to current date/time + freeBusyPublishDays. If an upload is already in progress nothing happens.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
See also KCalPrefBase::freeBusyPublishUrl(), KCalPrefBase::freeBusyPublishDays(), and ;.
[invokable] bool FreeBusyManager::retrieveFreeBusy(const QString &email, bool forceDownload, QWidget *parentWidget = nullptr)
Retrieve the freebusy information of somebody else, i.e. it will not try to download our own freebusy information.
This method will first try to find Akonadi resource that have the 'FreeBusyProvider' capability set. If none is found then there is a fallback on the URL mechanism (see below). If at least one is found then it will be first queried over D-Bus to know if it can handle free-busy information for that email address. If true then it will be queried for the free-busy data for a period ranging from today to today plus 14 days, defined in FreeBusyManagerPrivate::FreeBusyProvidersRequestsQueue::FreeBusyProvidersRequestsQueue() as hard-coded magic value. If the Akonadi resource responds successfully (still over D-Bus) then the freeBusyRetrieved signal is emitted. If any of those steps then the URL mechanism will be used as a fallback.
The URL mechanism makes use of a local cache, if the information for a given email is already downloaded it will return the information from the cache. The free-busy information must be accessible using HTTP and the URL is build dynamically from the email address and the global groupware settings.
The call is asynchronous, a download is started in the background (if needed) and freeBusyRetrieved will be emitted when the download is finished.
email Address of the person for which the F/B list should be retrieved. forceDownload Set to true to trigger a download even when automatic retrieval of freebusy information is disabled in the configuration. Returns true if a download is initiated, and false otherwise
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
See also KCalPrefs::thatIsMe( const QString &email ), ;, and Akonadi::FreeBusyProviderBase.
[override virtual] bool FreeBusyManager::saveFreeBusy(const KCalendarCore::FreeBusy::Ptr &freebusy, const KCalendarCore::Person &person)
Save freebusy information belonging to an email.
Implements KCalendarCore::FreeBusyCache::saveFreeBusy
freebusy is a pointer to a valid FreeBusy instance. person is a valid Person instance.
[static] Akonadi::FreeBusyManager *FreeBusyManager::self()
Returns the FreeBusyManager
void FreeBusyManager::setCalendar(const Akonadi::ETMCalendar::Ptr &calendar)
Sets the calendar to be used.
[override virtual protected] void FreeBusyManager::timerEvent(QTimerEvent *event)
Reimplements: QObject::timerEvent(QTimerEvent *event).
React on timer events, used for delayed freebusy list uploading