Classes | Public Types | Signals | Public Member Functions | Static Public Member Functions

mKCal::ServiceHandler Class Reference

Singleton class to get the exact handler (plugin) of the service. More...

#include <servicehandler.h>

List of all members.

Classes

class  Private

Public Types

enum  ErrorCode {
  ErrorOk = 0, ErrorNoAccount, ErrorNotSupported, ErrorNoConnectivity,
  ErrorInvalidParameters, ErrorInternal
}
 

Error Codes that can be returned by the plugins.

More...
enum  ExecutedPlugin { None = 0, SendInvitation, SendResponse, SendUpdate }
 

Executed plugins.

More...

Signals

void downloadProgress (int id, int percentage)
 Monitors the progress of the download.
void downloadFinished (int id)
 Informs that the download is over.
void downloadError (int id, ErrorCode error)
 Informs that the download is finished with errors.

Public Member Functions

bool sendInvitation (const KCalCore::Incidence::Ptr &invitation, const QString &body, const ExtendedCalendar::Ptr &calendar, const ExtendedStorage::Ptr &storage)
 Send the invitation to the list of people stated as attendees.
bool sendUpdate (const KCalCore::Incidence::Ptr &invitation, const QString &body, const ExtendedCalendar::Ptr &calendar, const ExtendedStorage::Ptr &storage)
 Send the updated invitation to the list of people stated as attendees.
bool sendResponse (const KCalCore::Incidence::Ptr &invitation, const QString &body, const ExtendedCalendar::Ptr &calendar, const ExtendedStorage::Ptr &storage)
 Send the updated invitation to the organiser.
bool responseClaimed (const KCalCore::Incidence::Ptr &response, const ExtendedCalendar::Ptr &calendar, const ExtendedStorage::Ptr &storage)
 Notify the service that the user accepts/declined the invitation, but declined to send the response.
QString icon (const Notebook::Ptr &notebook, const ExtendedStorage::Ptr &storage)
 Icon It would load the appropiate plugin to do it.
bool multiCalendar (const Notebook::Ptr &notebook, const ExtendedStorage::Ptr &storage)
 multiCalendar It would load the appropiate plugin to do it
QString emailAddress (const Notebook::Ptr &notebook, const ExtendedStorage::Ptr &storage)
 emailAddress It would load the appropiate plugin to do it
QString displayName (const Notebook::Ptr &notebook, const ExtendedStorage::Ptr &storage)
 displayName It would load the appropiate plugin to do it
int downloadAttachment (const Notebook::Ptr &notebook, const ExtendedStorage::Ptr &storage, const QString &uri, const QString &path)
 downloadAttachment It would load the appropiate plugin to do it
bool deleteAttachment (const KCalCore::Incidence::Ptr &incidence, const Notebook::Ptr &notebook, const ExtendedStorage::Ptr &storage, const QString &uri)
 deleteAttachment It would load the appropiate plugin to do it
bool shareNotebook (const Notebook::Ptr &notebook, const QStringList &sharedWith, const ExtendedStorage::Ptr &storage)
 Share notebook It would load the appropiate plugin to do it.
QStringList sharedWith (const Notebook::Ptr &notebook, const ExtendedStorage::Ptr &storage)
 sharedWith It would load the appropiate plugin to do it
QString defaultNotebook (const QString &productId)
 Try to get the notebook where to put the inviatation.
ServiceHandler::ErrorCode error () const
 In case of error, more detailed information can be provided Sometimes the true/false is not enough, so in case of false more details can be obtained.
QStringList availableServices ()
 MultiCalendar services.
QString icon (QString serviceId)
 Get the Icon of a service based on the id of the plugin.
QString uiName (QString serviceId)
 Get the Name tp be shown on the UI of a service based on the id of the plugin.
QString defaultEmailAddress ()
 defaultEmailAddress Returns the default email address if available

Static Public Member Functions

static ServiceHandlerinstance ()
 Obtain an instance of the ServiceHandler.
static void destroy ()
 Destroy the ServiceHandler.

Detailed Description

Singleton class to get the exact handler (plugin) of the service.


Member Enumeration Documentation

Error Codes that can be returned by the plugins.

Enumerator:
ErrorOk 
ErrorNoAccount 
ErrorNotSupported 
ErrorNoConnectivity 
ErrorInvalidParameters 
ErrorInternal 

Executed plugins.

Enumerator:
None 
SendInvitation 
SendResponse 
SendUpdate 

Member Function Documentation

QStringList ServiceHandler::availableServices (  ) 

MultiCalendar services.

List available Services There can be many available services. This method returns the ids of the plugins that handle those services.

Note:
this id can be used in the Notebook creation to "attach" a notebook to a certain service.
Returns:
list of the ids of the plugins available
QString ServiceHandler::defaultEmailAddress (  ) 

defaultEmailAddress Returns the default email address if available

Returns:
email addresses
QString ServiceHandler::defaultNotebook ( const QString &  productId  ) 

Try to get the notebook where to put the inviatation.

This is done based on the product Id of the invitation received. (in the iCal file).

Parameters:
productId the id of the generator of the iCal
Returns:
a string with the id of the notebook. it can be null
bool ServiceHandler::deleteAttachment ( const KCalCore::Incidence::Ptr &  incidence,
const Notebook::Ptr notebook,
const ExtendedStorage::Ptr storage,
const QString &  uri 
)

deleteAttachment It would load the appropiate plugin to do it

Parameters:
incience incidence of attachment to be deleted
notebook notebook
storage Pointer to the storage in use
uri uri of attachment to be deleted
Returns:
True if OK, false in case of error
void ServiceHandler::destroy (  )  [static]

Destroy the ServiceHandler.

It should be done before the QCoreApplication is closed

QString ServiceHandler::displayName ( const Notebook::Ptr notebook,
const ExtendedStorage::Ptr storage 
)

displayName It would load the appropiate plugin to do it

Parameters:
notebook notebook
storage Pointer to the storage in use
Returns:
display name
int ServiceHandler::downloadAttachment ( const Notebook::Ptr notebook,
const ExtendedStorage::Ptr storage,
const QString &  uri,
const QString &  path 
)

downloadAttachment It would load the appropiate plugin to do it

Parameters:
notebook notebook
storage Pointer to the storage in use
uri uri of attachment to be downloaded
path path whre attachment to be downloaded to
Returns:
Id of the attachment download. It will be used to notify changes about it. If < 0 there was an error.
void mKCal::ServiceHandler::downloadError ( int  id,
ErrorCode  error 
) [signal]

Informs that the download is finished with errors.

The id is the return value got when download started

void mKCal::ServiceHandler::downloadFinished ( int  id  )  [signal]

Informs that the download is over.

The id is the return value got when download started

void mKCal::ServiceHandler::downloadProgress ( int  id,
int  percentage 
) [signal]

Monitors the progress of the download.

The id is the return value got when download started

QString ServiceHandler::emailAddress ( const Notebook::Ptr notebook,
const ExtendedStorage::Ptr storage 
)

emailAddress It would load the appropiate plugin to do it

Parameters:
notebook notebook
storage Pointer to the storage in use
Returns:
email address
ServiceHandler::ErrorCode ServiceHandler::error (  )  const

In case of error, more detailed information can be provided Sometimes the true/false is not enough, so in case of false more details can be obtained.

Parameters:
notebook notebook
storage Pointer to the storage in use
Returns:
the ErrorCode of what happened
QString ServiceHandler::icon ( QString  serviceId  ) 

Get the Icon of a service based on the id of the plugin.

Returns:
Path to the icon
See also:
availableMulticalendarServices
QString ServiceHandler::icon ( const Notebook::Ptr notebook,
const ExtendedStorage::Ptr storage 
)

Icon It would load the appropiate plugin to do it.

Parameters:
notebook notebook
storage Pointer to the storage in use
Returns:
Icon
ServiceHandler & ServiceHandler::instance (  )  [static]

Obtain an instance of the ServiceHandler.

Returns:
The instance that handles all the services
bool ServiceHandler::multiCalendar ( const Notebook::Ptr notebook,
const ExtendedStorage::Ptr storage 
)

multiCalendar It would load the appropiate plugin to do it

Parameters:
notebook notebook
storage Pointer to the storage in use
Returns:
True if multicalendar otherwise false
bool ServiceHandler::responseClaimed ( const KCalCore::Incidence::Ptr &  response,
const ExtendedCalendar::Ptr &  calendar,
const ExtendedStorage::Ptr storage 
)

Notify the service that the user accepts/declined the invitation, but declined to send the response.

Parameters:
[in] response The incidence representing the user response
[in] storage Pointer to the storage in use
Returns:
True if OK, false in case of an error
bool mKCal::ServiceHandler::sendInvitation ( const KCalCore::Incidence::Ptr &  invitation,
const QString &  body,
const ExtendedCalendar::Ptr &  calendar,
const ExtendedStorage::Ptr storage 
)

Send the invitation to the list of people stated as attendees.

It would load the appropiate plugin to do it, and if there is no plugin it would use the default fall back plugin.

Parameters:
invitation The Incidence to send
body The body of the reply if any
calendar Pointer to the calendar in use
storage Pointer to the storage in use
Returns:
True if OK, false in case of error
bool mKCal::ServiceHandler::sendResponse ( const KCalCore::Incidence::Ptr &  invitation,
const QString &  body,
const ExtendedCalendar::Ptr &  calendar,
const ExtendedStorage::Ptr storage 
)

Send the updated invitation to the organiser.

It would load the appropiate plugin to do it, and if there is no plugin it would use the default fall back plugin.

Parameters:
invitation The Incidence to udpate
body The body of the reply if any
calendar Pointer to the calendar in use
storage Pointer to the storage in use
Returns:
True if OK, false in case of error
bool mKCal::ServiceHandler::sendUpdate ( const KCalCore::Incidence::Ptr &  invitation,
const QString &  body,
const ExtendedCalendar::Ptr &  calendar,
const ExtendedStorage::Ptr storage 
)

Send the updated invitation to the list of people stated as attendees.

It would load the appropiate plugin to do it, and if there is no plugin it would use the default fall back plugin.

Parameters:
invitation The Incidence to udpate
body The body of the reply if any
calendar Pointer to the calendar in use
storage Pointer to the storage in use
Returns:
True if OK, false in case of error
QStringList ServiceHandler::sharedWith ( const Notebook::Ptr notebook,
const ExtendedStorage::Ptr storage 
)

sharedWith It would load the appropiate plugin to do it

Parameters:
notebook notebook
storage Pointer to the storage in use
Returns:
list of users to share with
bool ServiceHandler::shareNotebook ( const Notebook::Ptr notebook,
const QStringList &  sharedWith,
const ExtendedStorage::Ptr storage 
)

Share notebook It would load the appropiate plugin to do it.

Parameters:
notebook Shared notebook
sharedWith The list of email addresses or phone numbers of users
storage Pointer to the storage in use
Returns:
True if OK, false in case of error
QString ServiceHandler::uiName ( QString  serviceId  ) 

Get the Name tp be shown on the UI of a service based on the id of the plugin.

Returns:
Name of the service
See also:
availableMulticalendarServices

The documentation for this class was generated from the following files:

Generated on Tue Jul 5 2011 16:40:27 for libmkcal by doxygen 1.7.1