/usr/include/akonadi/calendar/etmcalendar.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 | /*
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_ETMCALENDAR_H_
#define _AKONADI_ETMCALENDAR_H_
#include "akonadi-calendar_export.h"
#include "calendarbase.h"
#include <akonadi/collection.h>
class QAbstractItemModel;
class KCheckableProxyModel;
namespace Akonadi {
class EntityTreeModel;
class ETMCalendarPrivate;
class CollectionSelection;
/**
* @short A KCalCore::Calendar that uses an EntityTreeModel to populate itself.
*
* All non-idempotent KCalCore::Calendar methods interact with Akonadi.
* If you need a need a non-persistent calendar use FetchJobCalendar.
*
* ETMCalendar allows to be populated with only a subset of your calendar items,
* by using a KCheckableProxyModel to specify which collections to be used
* and/or by setting a KCalCore::CalFilter.
*
* @see FetchJobCalendar
* @see CalendarBase
*
* @author Sérgio Martins <iamsergio@gmail.com>
* @since 4.11
*/
class AKONADI_CALENDAR_EXPORT ETMCalendar : public CalendarBase
{
Q_OBJECT
public:
enum CollectionColumn {
CollectionTitle = 0,
CollectionColumnCount
};
typedef QSharedPointer<ETMCalendar> Ptr;
/**
* Constructs a new ETMCalendar. Loading begins immediately, asynchronously.
*/
explicit ETMCalendar(QObject *parent = 0);
/**
* Constructs a new ETMCalendar that will only load the specified mime types.
* Use this ctor to ignore journals or to-dos for example.
* If no mime types are specified, all mime types will be used.
*/
explicit ETMCalendar(const QStringList &mimeTypes, QObject *parent = 0);
/**
* Constructs a new ETMCalendar.
*
* This overload exists for optimization reasons, it allows to share an EntityTreeModel across
* several ETMCalendars to save memory.
*
* Usually when having many ETMCalendars, the only bit that's different is the collection
* selection. The memory hungry EntityTreeModel is the same, so should be shared.
*
* @param calendar an existing ETMCalendar who's EntityTreeModel is to be used.
*
* @since 4.13
*/
explicit ETMCalendar(ETMCalendar *calendar, QObject *parent = 0);
/**
* Destroys this ETMCalendar.
*/
~ETMCalendar();
/**
* Returns the collection having @p id.
* Use this instead of creating a new collection, the returned collection will have
* the correct right, name, display name, etc all set.
*/
Akonadi::Collection collection(Akonadi::Collection::Id) const;
/**
* Returns true if the collection owning incidence @p has righ @p right
*/
bool hasRight(const Akonadi::Item &item, Akonadi::Collection::Right right) const;
/**
* This is an overloaded function.
* @param uid the identifier for the incidence to check for rights
* @param right the access right to check for
* @see hasRight()
*/
bool hasRight(const QString &uid, Akonadi::Collection::Right right) const;
/**
* Returns the KCheckableProxyModel used to select from which collections should
* the calendar be populated from.
*/
KCheckableProxyModel *checkableProxyModel() const;
/**
* Convenience method to access the contents of this KCalCore::Calendar through
* a QAIM interface.
*
* Like through calendar interface, the model only items of selected collections.
* To select or unselect collections, see checkableProxyModel().
*
* @see checkableProxyModel()
* @see entityTreeModel()
*/
QAbstractItemModel *model() const;
/**
* Returns the underlying EntityTreeModel.
*
* For most uses, you'll want model() or the KCalCore::Calendar interface instead.
*
* It contains every item and collection with calendar mime type, doesn't have
* KCalCore filtering and doesn't honour any collection selection.
*
* This method is exposed for performance reasons only, so you can reuse it,
* since it's resource savy.
*
* @see model()
*/
Akonadi::EntityTreeModel *entityTreeModel() const;
/**
* Returns all alarms occurring in a specified time interval.
* @param from start date of interval
* @param to end data of interval
* @param exludeBlockedAlarms if true, alarms belonging to blocked collections aren't returned.
* TODO_KDE5: introduce this overload in KCalCore::Calendar, MemoryCalendar, etc. all the way
* up the hierarchy
*/
using KCalCore::MemoryCalendar::alarms;
KCalCore::Alarm::List alarms(const KDateTime &from,
const KDateTime &to,
bool excludeBlockedAlarms) const;
/**
* Enable or disable collection filtering.
* If true, the calendar will only contain items of selected collections.
* @param enable enables collection filtering if set as @c true
* @see checkableProxyModel()
* @see collectionFilteringEnabled()
*/
void setCollectionFilteringEnabled(bool enable);
/**
* Returns whether collection filtering is enabled. Default is true.
* @see setCollectionFilteringEnabled()
*/
bool collectionFilteringEnabled() const;
/**
* Returns if the calendar already finished loading.
* TODO_KDE5: make virtual in base class
*/
bool isLoaded() const;
Q_SIGNALS:
/**
* This signal is emitted if a collection has been changed (properties or attributes).
*
* @param collection The changed collection.
* @param attributeNames The names of the collection attributes that have been changed.
*/
void collectionChanged(const Akonadi::Collection &, const QSet<QByteArray> &attributeNames);
/**
* This signal is emitted when one or more collections are added to the ETM.
*
* @param collection non empty list of collections
*/
void collectionsAdded(const Akonadi::Collection::List &collection);
/**
* This signal is emitted when one or more collections are deleted from the ETM.
*
* @param collection non empty list of collections
*/
void collectionsRemoved(const Akonadi::Collection::List &collection);
/**
* Emitted whenever an Item is inserted, removed or modified.
*/
void calendarChanged();
private:
Q_DECLARE_PRIVATE(ETMCalendar)
};
}
#endif
|