/usr/include/akonadi/calendar/calendarbase.h is in kdepimlibs5-dev 4:4.14.10-7+b2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 | /*
Copyright (C) 2011 Sérgio Martins <sergio.martins@kdab.com>
Copyright (C) 2012 Sérgio Martins <iamsergio@gmail.com>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
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 Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#ifndef _AKONADI_CALENDARBASE_H_
#define _AKONADI_CALENDARBASE_H_
#include "akonadi-calendar_export.h"
#include <akonadi/item.h>
#include <akonadi/collection.h>
#include <kcalcore/memorycalendar.h>
#include <kcalcore/incidence.h>
#include <KDE/KDateTime>
namespace Akonadi {
class CalendarBasePrivate;
class IncidenceChanger;
/**
* @short The base class for all akonadi aware calendars.
*
* Because it inherits KCalCore::Calendar, it provides seamless integration
* with KCalCore and KCalUtils libraries eliminating any need for adapter
* ( akonadi<->KCalCore ) classes.
*
* @see ETMCalendar
* @see FetchJobCalendar
*
* @author Sérgio Martins <sergio.martins@kdab.com>
* @since 4.11
*/
class AKONADI_CALENDAR_EXPORT CalendarBase : public KCalCore::MemoryCalendar
{
Q_OBJECT
public:
typedef QSharedPointer<CalendarBase> Ptr;
/**
* Constructs a CalendarBase object.
*/
explicit CalendarBase(QObject *parent = 0);
/**
* Destroys the calendar.
*/
~CalendarBase();
/**
* Returns the Item containing the incidence with uid @p uid or an invalid Item
* if the incidence isn't found.
* @see Use item(Incidence::Ptr) instead where possible. This function doesn't take exceptions (recurrenceId) into account (and thus always returns the main event).
*/
Akonadi::Item item(const QString &uid) const;
/**
* Returns the Item containing the incidence with uid @p uid or an invalid Item
* if the incidence isn't found.
*/
Akonadi::Item item(const KCalCore::Incidence::Ptr &incidence) const;
/**
* Returns the Item with @p id or an invalid Item if not found.
*/
Akonadi::Item item(Akonadi::Item::Id) const;
/**
* Returns the list of items contained in this calendar.
* @see incidences()
*/
Akonadi::Item::List items() const;
/**
* Returns the list of items contained in this calendar that belong to the specified collection.
* @see incidences()
* // TODO_KDE5: merge with items() overload
* @since 4.12
*/
Akonadi::Item::List items(Akonadi::Collection::Id) const;
/**
* Returns the item list that corresponds to the @p incidenceList.
*/
Akonadi::Item::List itemList(const KCalCore::Incidence::List &incidenceList) const;
/**
* Returns the child incidences of the parent identified by @p parentUid.
* Only the direct childs are returned
* @param parentUid identifier of the parent incidence
*/ //TODO: unit-test
KCalCore::Incidence::List childIncidences(const QString &parentUid) const;
/**
* Returns the child incidences of the parent identified by @p parentId.
* Only the direct childs are returned
* @param parentId identifier of the parent item
*/
KCalCore::Incidence::List childIncidences(const Akonadi::Item::Id &parentId) const;
/**
* Returns the child items of the parent identified by @p parentUid.
* Only the direct childs are returned
* @param parentUid identifier of the parent incidence
*/
Akonadi::Item::List childItems(const QString &parentUid) const;
/**
* Returns the child items of the parent identified by @p parentId.
* Only the direct childs are returned
* @param parentId identifier of the parent item
*/
Akonadi::Item::List childItems(const Akonadi::Item::Id &parentId) const;
/**
* Sets the weak pointer that's associated with this instance.
* Use this if later on you need to cast sender() into a QSharedPointer
*
* @code
* QWeakPointer<CalendarBase> weakPtr = qobject_cast<CalendarBase*>( sender() )->weakPointer();
* CalendarBase::Ptr calendar( weakPtr.toStrongRef() );
* @endcode
*
* @see weakPointer()
*/
void setWeakPointer(const QWeakPointer<Akonadi::CalendarBase> &pointer);
/**
* Returns the weak pointer set with setWeakPointer().
* The default is an invalid weak pointer.
* @see setWeakPointer()
*/
QWeakPointer<CalendarBase> weakPointer() const;
/**
* Adds an Event to the calendar.
* It's added to akonadi in the background @see createFinished().
* @param event the event to be added
*/
/**reimp*/ bool addEvent(const KCalCore::Event::Ptr &event);
/**
* Deletes an Event from the calendar.
* It's removed from akonadi in the background @see deleteFinished().
* @param event the event to be deleted
*/
/**reimp*/ bool deleteEvent(const KCalCore::Event::Ptr &event);
/**
* Reimplementation of KCalCore::Calendar::deleteAllEvents() that
* does nothing. Do not use this.
*
* A convenience function that makes it easy to have a massive data-loss
* is a bad idea.
*
* @deprecated
*/
/**reimp*/ void deleteAllEvents();
/**
* Adds a Todo to the calendar.
* It's added to akonadi in the background @see createFinished().
* @param todo the todo to add
*/
/**reimp*/ bool addTodo(const KCalCore::Todo::Ptr &todo);
/**
* Deletes a Todo from the calendar.
* It's removed from akonadi in the background @see deleteFinished().
* @param todo the todo to delete
*/
/**reimp*/ bool deleteTodo(const KCalCore::Todo::Ptr &todo);
/**
* Reimplementation of KCalCore::Calendar::deleteAllTodos() that
* does nothing. Do not use this.
*
* A convenience function that makes it easy to have a massive data-loss
* is a bad idea.
*
* @deprecated
*/
/**reimp*/ void deleteAllTodos();
/**
* Adds a Journal to the calendar.
* It's added to akonadi in the background @see createFinished().
* @param journal the journal to add
*/
/**reimp*/ bool addJournal(const KCalCore::Journal::Ptr &journal);
/**
* Deletes a Journal from the calendar.
* It's removed from akonadi in the background @see deleteFinished().
* @param journal the journal to delete
*/
/**reimp*/ bool deleteJournal(const KCalCore::Journal::Ptr &journal);
/**
* Reimplementation of KCalCore::Calendar::deleteAllJournals() that
* does nothing. Do not use this.
*
* A convenience function that makes it easy to have a massive data-loss
* is a bad idea.
*
* @deprecated
*/
/**reimp*/ void deleteAllJournals();
/**
* Adds an incidence to the calendar.
* It's added to akonadi in the background @see createFinished().
* @param incidence the incidence to add
*/
/**reimp*/ bool addIncidence(const KCalCore::Incidence::Ptr &incidence);
/**
* Deletes an incidence from the calendar.
* It's removed from akonadi in the background @see deleteFinished().
* @param incidence the incidence to delete
*/
/**reimp*/ bool deleteIncidence(const KCalCore::Incidence::Ptr &);
/**
Call this to tell the calendar that you're adding a batch of incidences.
So it doesn't, for example, ask the destination for each incidence.
@see endBatchAdding()
*/
/**reimp*/ void startBatchAdding();
/**
* Tells the Calendar that you stoped adding a batch of incidences.
* @see startBatchAdding()
*/
/**reimp*/ void endBatchAdding();
/**
* Returns the IncidenceChanger used by this calendar to make changes in akonadi.
* Use this if you need the defaults used by CalendarBase.
*/
Akonadi::IncidenceChanger *incidenceChanger() const;
/**
* Modifies an incidence.
* The incidence with the same uid as @p newIncidence will be updated with the contents of
* @param newIncidence the incidence to modify
*/
bool modifyIncidence(const KCalCore::Incidence::Ptr &newIncidence);
Q_SIGNALS:
/**
* This signal is emitted when an incidence is created in akonadi through
* add{Incidence,Event,Todo,Journal}
* @param success the success of the operation
* @param errorMessage if @p success is false, contains the error message
*/
void createFinished(bool success, const QString &errorMessage);
/**
* This signal is emitted when an incidence is deleted in akonadi through
* delete{Incidence,Event,Todo,Journal} or deleteAll{Events,Todos,Journals}
* @param success the success of the operation
* @param errorMessage if @p success is false, contains the error message
*/
void deleteFinished(bool success, const QString &errorMessage);
/**
* This signal is emitted when an incidence is modified in akonadi through
* modifyIncidence().
* @param success the success of the operation
* @param errorMessage if @p success is false, contains the error message
*/
void modifyFinished(bool success, const QString &errorMessage);
protected:
Q_DECLARE_PRIVATE(CalendarBase)
QScopedPointer<CalendarBasePrivate> d_ptr;
CalendarBase(CalendarBasePrivate *const d, QObject *parent);
friend class Scheduler;
};
}
#endif
|