summaryrefslogtreecommitdiff
path: root/src/backends/tdepim/TDEPIMCalendarSource.h
blob: f3f76bf015f95c536792d6351ceac3497992e20c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*
 *
 * Copyright (C) 2016 Emanoil Kotsev emanoil.kotsev@fincom.at
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) version 3.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301  USA
 *
 * $Id: TDEPIMCalendarSource.h,v 1.7 2016/09/08 22:58:08 emanoil Exp $
 *
 */

#ifndef INCL_TDEPIM_CALENDARSOURCE
#define INCL_TDEPIM_CALENDARSOURCE

#include "config.h"

#include "TDEPIMSyncSource.h"

#ifdef ENABLE_TDEPIMCAL

#include <syncevo/TrackingSyncSource.h>

#include <tqstring.h>
#include <libkcal/calendarresources.h>


SE_BEGIN_CXX

// class TimeTrackingObserver;

typedef	enum {
		TDEPIM_TASKS,
		TDEPIM_TODO,
		TDEPIM_JOURNAL
	} TDEPIMCalendarSourceType;

class TDEPIMCalendarSource : public TrackingSyncSource, public SyncSourceLogging
{
public:

//	TDEPIMCalendarSource();
	TDEPIMCalendarSource(TDEPIMCalendarSourceType m_type, const SyncSourceParams &params);

	virtual ~TDEPIMCalendarSource();
	//
	// implementation of SyncSource
	//
	virtual Databases getDatabases();
	virtual void open();
	virtual bool isEmpty();
	virtual void close();
	virtual std::string getMimeType() const;
	virtual std::string getMimeVersion() const;

	/* implementation of TrackingSyncSource interface */
	virtual void listAllItems(RevisionMap_t &revisions);
	virtual InsertItemResult insertItem(const string &luid, const std::string &item, bool raw);
	void readItem(const std::string &luid, std::string &item, bool raw);
	virtual void removeItem(const string &luid);

    /* implementation of SyncSourceLogging interface */
	virtual std::string getDescription(const string &luid);

private:
	TDEPIMCalendarSourceType m_type;         /**< use events, tasks or memos? */
	KCal::CalendarResources *calendarResPtr;
	KCal::ResourceCalendar *calendarPtr;

	TQString m_typeName; //NOTE not really used

	TDEPIMSyncSource *app;

	/**
	* The actual type to be used inside the collection. Set after opening
	* the collection.
	*/
	TQString m_contentMimeType; //NOTE not really used

	/**
	* This functions is used internally to normalize the revision field 
	* If no revision is available, always return the same 0-time stamp
	*/
	TQString lastModifiedNormalized(const KCal::Incidence *e);

	/* All calendar storages must suppport UID/RECURRENCE-ID,
	 * it's part of the API. Therefore we can rely on it.
	 */
	virtual void getSynthesisInfo(SynthesisInfo &info,
					XMLConfigFragments &fragments);

};

SE_END_CXX

#endif // ENABLE_TDEPIMCAL
#endif // INCL_TDEPIM_CALENDARSOURCE