OpenAB  1.0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
EDSCalendarStorage.hpp
Go to the documentation of this file.
1 /*
2  * This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this
4  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5  */
12 #include <string>
13 #include <fstream>
14 #include <set>
15 
16 #ifndef OpenAB_PLUGIN_EDS_CALENDAR_HPP_
17 #define OPENAB_PLUGIN_EDS_CALENDAR_HPP_
18 
37 {
38  public:
44  EDSCalendarStorage(const std::string& sourceName,
45  OpenAB::PIMItemType type);
46 
48 
50 
52 
54 
56 
58 
59  int getTotalCount() const;
60 
61  enum eAddItem addObject( const std::string& iCal,
62  OpenAB::PIMItem::ID& newId,
63  OpenAB::PIMItem::Revision& revision);
64 
65  enum eAddItem addObjects( const std::vector<std::string> &iCals,
66  OpenAB::PIMItem::IDs& newIds,
67  OpenAB::PIMItem::Revisions& revisions);
68 
69  enum eModifyItem modifyObject( const std::string& iCal,
70  const OpenAB::PIMItem::ID& id,
71  OpenAB::PIMItem::Revision& revision);
72 
73  enum eModifyItem modifyObjects( const std::vector<std::string> &iCals,
74  const OpenAB::PIMItem::IDs& ids,
75  OpenAB::PIMItem::Revisions& revisions);
76 
78 
80 
81  enum eGetItem getEvent (const OpenAB::PIMItem::ID & id,
83 
84  enum eGetItem getEvents(const OpenAB::PIMItem::IDs & ids,
86 
87  enum eGetItem getTask (const OpenAB::PIMItem::ID & id,
89 
90  enum eGetItem getTasks(const OpenAB::PIMItem::IDs & ids,
91  std::vector<OpenAB::SmartPtr<OpenAB::PIMCalendarTaskItem> > & items);
92 
93  enum OpenAB_Storage::Storage::eGetRevisions getRevisions(std::map<std::string, std::string>& revisions);
94 
95  enum OpenAB_Storage::Storage::eGetRevisions getChangedRevisions(const std::string& token,
96  std::map<std::string, std::string>& revisions,
97  std::vector<OpenAB::PIMItem::ID>& removed);
98 
100 
102 
103  private:
109  OpenAB::PIMItem::Revision getRevision(const OpenAB::PIMItem::ID& id);
110 
117 
126  GSList* toICalComponentsList(const std::vector<std::string> & iCals,
127  const OpenAB::PIMItem::IDs& ids,
128  std::vector<icaltimezone*>& timezones);
129 
130  std::string database;
131  ESourceRegistry * registry;
132  ESource * source;
133  ECalClient * client;
134  EDSCalendarStorageItemIterator* sourceIterator;
135  std::string databaseFileName;
136  std::ifstream databaseFile;
137 
138  static void findTimeZonesCb(icalparameter* param, void* data);
139 
140  static std::set<std::string> currentEventTimeZones;
141 };
142 #endif /* OpenAB_PLUGIN_EDS_CALENDAR_HPP_ */
int getTotalCount() const
Returns total count of items available from Source, if such information is available.
Definition: EDSCalendarStorage.cpp:161
Documentation for class EDSCalendarStorageItemIterator.
Definition: EDSCalendarStorageItemIterator.hpp:22
std::string Revision
Definition: PIMItem.hpp:89
enum OpenAB_Source::Source::eInit init()
Initializes Source.
Definition: EDSCalendarStorage.cpp:49
enum eRemoveItem removeObjects(const OpenAB::PIMItem::IDs &ids)
Removes contacts from the ContactsStorage.
Definition: EDSCalendarStorage.cpp:394
enum eAddItem addObjects(const std::vector< std::string > &iCals, OpenAB::PIMItem::IDs &newIds, OpenAB::PIMItem::Revisions &revisions)
Adds new contacts to the ContactsStorage.
Definition: EDSCalendarStorage.cpp:258
eCancelRet
Definition: Source.hpp:138
eResumeRet
Definition: Source.hpp:123
enum OpenAB_Source::Source::eResumeRet resume()
Resumes Source, if such operation is supported.
Definition: EDSCalendarStorage.cpp:151
enum OpenAB_Storage::Storage::eGetRevisions getChangedRevisions(const std::string &token, std::map< std::string, std::string > &revisions, std::vector< OpenAB::PIMItem::ID > &removed)
Gets revisions of items changed since Storage was in state identified by token.
Definition: EDSCalendarStorage.cpp:609
EDSCalendarStorage(const std::string &sourceName, OpenAB::PIMItemType type)
Constructor.
Definition: EDSCalendarStorage.cpp:19
eModifyItem
Definition: Storage.hpp:164
enum eGetItem getTask(const OpenAB::PIMItem::ID &id, OpenAB::SmartPtr< OpenAB::PIMCalendarTaskItem > &item)
Get the contact from the Storage.
Definition: EDSCalendarStorage.cpp:467
std::vector< OpenAB::PIMItem::Revision > Revisions
Definition: PIMItem.hpp:111
eAddItem
Definition: Storage.hpp:126
enum OpenAB_Storage::Storage::eGetSyncToken getLatestSyncToken(std::string &)
If storage supports tracking of items changes, it returns latest status identifier of the storage...
Definition: EDSCalendarStorage.cpp:617
Documentation for ContactsStorage interface. Provides functionalities specific to Storage of OpenAB::...
Definition: CalendarStorage.hpp:28
enum eGetItem getTasks(const OpenAB::PIMItem::IDs &ids, std::vector< OpenAB::SmartPtr< OpenAB::PIMCalendarTaskItem > > &items)
Get the contacts from the Storage.
Definition: EDSCalendarStorage.cpp:492
Definition: EDSCalendarStorage.hpp:36
enum OpenAB_Source::Source::eGetItemRet getItem(OpenAB::SmartPtr< OpenAB::PIMItem > &item)
Gets PIM Item from Source. If Source is suspended getItem() should block until Source will be resumed...
Definition: EDSCalendarStorage.cpp:122
enum eAddItem addObject(const std::string &iCal, OpenAB::PIMItem::ID &newId, OpenAB::PIMItem::Revision &revision)
Adds a new contact to the ContactsStorage.
Definition: EDSCalendarStorage.cpp:232
eSuspendRet
Definition: Source.hpp:108
The StorageItemIterator is mainly used to quickly browse the Storage contents.
Definition: StorageItem.hpp:97
std::vector< OpenAB::PIMItem::ID > IDs
Definition: PIMItem.hpp:110
enum eModifyItem modifyObjects(const std::vector< std::string > &iCals, const OpenAB::PIMItem::IDs &ids, OpenAB::PIMItem::Revisions &revisions)
Modifies contacts in the ContactsStorage.
Definition: EDSCalendarStorage.cpp:342
enum OpenAB_Storage::Storage::eGetRevisions getRevisions(std::map< std::string, std::string > &revisions)
Gets revision of the items from the Storage.
Definition: EDSCalendarStorage.cpp:550
enum OpenAB_Source::Source::eCancelRet cancel()
Cancels Source, if such operation is supported. After canceling Source next call to getVCard() should...
Definition: EDSCalendarStorage.cpp:156
enum eGetItem getEvents(const OpenAB::PIMItem::IDs &ids, std::vector< OpenAB::SmartPtr< OpenAB::PIMCalendarEventItem > > &items)
Get the contacts from the Storage.
Definition: EDSCalendarStorage.cpp:451
~EDSCalendarStorage()
Definition: EDSCalendarStorage.cpp:31
eGetItemRet
Definition: Source.hpp:155
enum eModifyItem modifyObject(const std::string &iCal, const OpenAB::PIMItem::ID &id, OpenAB::PIMItem::Revision &revision)
Modifies contact in the ContactsStorage.
Definition: EDSCalendarStorage.cpp:316
PIMItemType
Definition: PIMItemIndex.hpp:24
eGetItem
Definition: Storage.hpp:226
eGetRevisions
Definition: Storage.hpp:265
eGetSyncToken
Definition: Storage.hpp:251
eInit
Definition: Source.hpp:94
std::string ID
Definition: PIMItem.hpp:64
OpenAB_Storage::StorageItemIterator * newStorageItemIterator()
Retrieve an new Iterator to quickly parse the list of items.
Definition: EDSCalendarStorage.cpp:622
eRemoveItem
Definition: Storage.hpp:201
enum eGetItem getEvent(const OpenAB::PIMItem::ID &id, OpenAB::SmartPtr< OpenAB::PIMCalendarEventItem > &item)
Get the contact from the Storage.
Definition: EDSCalendarStorage.cpp:418
enum OpenAB_Source::Source::eSuspendRet suspend()
Suspends Source, if such operation is supported.
Definition: EDSCalendarStorage.cpp:146
enum eRemoveItem removeObject(const OpenAB::PIMItem::ID &id)
Removes contact from the ContactsStorage.
Definition: EDSCalendarStorage.cpp:379