servicehandler.h
Go to the documentation of this file.
1 #ifndef MKCAL_SERVICEHANDLER_H
2 #define MKCAL_SERVICEHANDLER_H
3 /*
4  This file is part of the libextendedkcal library.
5 
6  Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
7  Contact: Alvaro Manera <alvaro.manera@nokia.com>
8 
9  This library is free software; you can redistribute it and/or
10  modify it under the terms of the GNU Library General Public
11  License as published by the Free Software Foundation; either
12  version 2 of the License, or (at your option) any later version.
13 
14  This library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  Library General Public License for more details.
18 
19  You should have received a copy of the GNU Library General Public License
20  along with this library; see the file COPYING.LIB. If not, write to
21  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22  Boston, MA 02110-1301, USA.
23 */
24 
25 #include <KCalendarCore/Incidence>
26 #include <QObject>
27 #include "mkcal_export.h"
28 #include "notebook.h"
29 #include "extendedcalendar.h"
30 #include "extendedstorage.h"
31 #include "servicehandlerif.h"
32 
33 const QString defaultName = "DefaultInvitationPlugin";
34 
35 class ServiceHandlerPrivate;
36 
37 namespace mKCal {
38 
42 {
43  Q_OBJECT
44 private:
48  ~ServiceHandler();
49 
50  ServiceHandlerPrivate *const d;
51 
52 public:
53 
55  //Right now they are the same as defined in ServiceHandlerIf
56  //But semantically it doesn't make sense that they are defined
57  //there and at some point they might be different.
58  enum ErrorCode {
59  ErrorOk = 0,
64  ErrorInternal
65  };
66 
71  {
72  static ServiceHandler singleton;
73  return singleton;
74  }
75 
86  bool sendInvitation(const KCalendarCore::Incidence::Ptr &invitation, const QString &body,
87  const ExtendedCalendar::Ptr &calendar, const ExtendedStorage::Ptr &storage,
88  const Notebook::Ptr &notebook = Notebook::Ptr());
89 
100  bool sendUpdate(const KCalendarCore::Incidence::Ptr &invitation, const QString &body, const ExtendedCalendar::Ptr &calendar,
101  const ExtendedStorage::Ptr &storage, const Notebook::Ptr &notebook = Notebook::Ptr());
102 
113  bool sendResponse(const KCalendarCore::Incidence::Ptr &invitation, const QString &body,
114  const ExtendedCalendar::Ptr &calendar, const ExtendedStorage::Ptr &storage,
115  const Notebook::Ptr &notebook = Notebook::Ptr());
116 
123  QString icon(const Notebook::Ptr &notebook, const ExtendedStorage::Ptr &storage);
124 
131  bool multiCalendar(const Notebook::Ptr &notebook, const ExtendedStorage::Ptr &storage);
132 
139  QString emailAddress(const Notebook::Ptr &notebook, const ExtendedStorage::Ptr &storage);
140 
147  QString displayName(const Notebook::Ptr &notebook, const ExtendedStorage::Ptr &storage);
148 
158  int downloadAttachment(const Notebook::Ptr &notebook, const ExtendedStorage::Ptr &storage, const QString &uri,
159  const QString &path);
160 
169  bool deleteAttachment(const KCalendarCore::Incidence::Ptr &incidence, const Notebook::Ptr &notebook,
170  const ExtendedStorage::Ptr &storage, const QString &uri);
171 
179  bool shareNotebook(const Notebook::Ptr &notebook, const QStringList &sharedWith, const ExtendedStorage::Ptr &storage);
180 
187  QStringList sharedWith(const Notebook::Ptr &notebook, const ExtendedStorage::Ptr &storage);
188 
195  QString defaultNotebook(const QString &productId);
196 
205  ServiceHandler::ErrorCode error() const;
206 
207 
209 
217  QStringList availableServices();
218 
225  QString icon(QString serviceId);
226 
233  QString uiName(QString serviceId);
234 
235 signals:
237  void downloadProgress(int id, int percentage);
238 
240  void downloadFinished(int id);
241 
243  void downloadError(int id, ErrorCode error);
244 };
245 
246 }
247 #endif // MKCAL_SERVICEHANDLER_H
QSharedPointer< ExtendedStorage > Ptr
A shared pointer to a ExtendedStorage.
Definition: extendedstorage.h:92
QSharedPointer< Notebook > Ptr
A shared pointer to a Notebook object.
Definition: notebook.h:51
Singleton class to get the exact handler (plugin) of the service.
Definition: servicehandler.h:42
void downloadError(int id, ErrorCode error)
Informs that the download is finished with errors.
static ServiceHandler & instance()
Obtain an instance of the ServiceHandler.
Definition: servicehandler.h:70
void downloadProgress(int id, int percentage)
Monitors the progress of the download.
ErrorCode
Error Codes that can be returned by the plugins.
Definition: servicehandler.h:58
@ ErrorInvalidParameters
Definition: servicehandler.h:63
@ ErrorNoAccount
Definition: servicehandler.h:60
@ ErrorNotSupported
Definition: servicehandler.h:61
@ ErrorNoConnectivity
Definition: servicehandler.h:62
void downloadFinished(int id)
Informs that the download is over.
This file is part of the API for handling calendar data and defines the ExtendedCalendar class.
This file is part of the API for handling calendar data and defines the ExtendedStorage interface.
#define MKCAL_EXPORT
Definition: mkcal_export.h:27
Definition: extendedstorage.h:47
This file is part of the API for handling calendar data and defines the Notebook class.
const QString defaultName
Definition: servicehandler.h:33
This file defines the common Interface to be inherited by all processes that handle service informati...

Generated on Wed Jun 9 2021 13:59:25 for libextendedkcal by doxygen 1.9.1