• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.13.3 API Reference
  • KDE Home
  • Contact Us
 

akonadi

  • akonadi
  • calendar
etmcalendar.cpp
1 /*
2  Copyright (C) 2011-2013 Sérgio Martins <iamsergio@gmail.com>
3 
4  This library is free software; you can redistribute it and/or modify it
5  under the terms of the GNU Library General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or (at your
7  option) any later version.
8 
9  This library is distributed in the hope that it will be useful, but WITHOUT
10  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12  License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to the
16  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  02110-1301, USA.
18 */
19 
20 #include "etmcalendar.h"
21 #include "etmcalendar_p.h"
22 #include "blockalarmsattribute.h"
23 #include "incidencefetchjob_p.h"
24 #include "calendarmodel_p.h"
25 #include "kcolumnfilterproxymodel_p.h"
26 #include "calfilterproxymodel_p.h"
27 #include "utils_p.h"
28 
29 #include <akonadi/item.h>
30 #include <akonadi/session.h>
31 #include <akonadi/collection.h>
32 #include <akonadi/changerecorder.h>
33 #include <akonadi/itemfetchscope.h>
34 #include <akonadi/entitydisplayattribute.h>
35 #include <akonadi/entitymimetypefiltermodel.h>
36 #include <akonadi/collectionfilterproxymodel.h>
37 #include <KSelectionProxyModel>
38 #include <KDescendantsProxyModel>
39 
40 #include <QItemSelectionModel>
41 #include <QTreeView>
42 
43 using namespace Akonadi;
44 using namespace KCalCore;
45 
46 //TODO: implement batchAdding
47 
48 ETMCalendarPrivate::ETMCalendarPrivate(ETMCalendar *qq) : CalendarBasePrivate(qq)
49  , mETM(0)
50  , mFilteredETM(0)
51  , mCheckableProxyModel(0)
52  , mCollectionProxyModel(0)
53  , mCalFilterProxyModel(0)
54  , mSelectionProxy(0)
55  , mCollectionFilteringEnabled(true)
56  , q(qq)
57 {
58  mListensForNewItems = true;
59 }
60 
61 void ETMCalendarPrivate::init()
62 {
63  if (!mETM) {
64  Akonadi::Session *session = new Akonadi::Session("ETMCalendar", q);
65  Akonadi::ChangeRecorder *monitor = new Akonadi::ChangeRecorder(q);
66  connect(monitor, SIGNAL(collectionChanged(Akonadi::Collection,QSet<QByteArray>)),
67  SLOT(onCollectionChanged(Akonadi::Collection,QSet<QByteArray>)));
68 
69  Akonadi::ItemFetchScope scope;
70  scope.fetchFullPayload(true);
71  scope.fetchAttribute<Akonadi::EntityDisplayAttribute>();
72 
73  monitor->setSession(session);
74  monitor->setCollectionMonitored(Akonadi::Collection::root());
75  monitor->fetchCollection(true);
76  monitor->setItemFetchScope(scope);
77 
78  QStringList allMimeTypes;
79  allMimeTypes << KCalCore::Event::eventMimeType() << KCalCore::Todo::todoMimeType()
80  << KCalCore::Journal::journalMimeType();
81 
82  foreach(const QString &mimetype, allMimeTypes) {
83  monitor->setMimeTypeMonitored(mimetype, mMimeTypes.isEmpty() || mMimeTypes.contains(mimetype));
84  }
85 
86  mETM = CalendarModel::create(monitor);
87  mETM->setObjectName("ETM");
88  }
89 
90  setupFilteredETM();
91 
92  connect(q, SIGNAL(filterChanged()), SLOT(onFilterChanged()));
93 
94  connect(mETM.data(), SIGNAL(collectionPopulated(Akonadi::Collection::Id)),
95  SLOT(onCollectionPopulated(Akonadi::Collection::Id)));
96  connect(mETM.data(), SIGNAL(rowsInserted(QModelIndex,int,int)),
97  SLOT(onRowsInserted(QModelIndex,int,int)));
98  connect(mETM.data(), SIGNAL(dataChanged(QModelIndex,QModelIndex)),
99  SLOT(onDataChanged(QModelIndex,QModelIndex)));
100  connect(mETM.data(), SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)),
101  SLOT(onRowsMoved(QModelIndex,int,int,QModelIndex,int)));
102  connect(mETM.data(), SIGNAL(rowsRemoved(QModelIndex,int,int)),
103  SLOT(onRowsRemoved(QModelIndex,int,int)));
104 
105  connect(mFilteredETM, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
106  SLOT(onDataChangedInFilteredModel(QModelIndex,QModelIndex)));
107  connect(mFilteredETM, SIGNAL(layoutChanged()),
108  SLOT(onLayoutChangedInFilteredModel()));
109  connect(mFilteredETM, SIGNAL(modelReset()),
110  SLOT(onModelResetInFilteredModel()));
111  connect(mFilteredETM, SIGNAL(rowsInserted(QModelIndex,int,int)),
112  SLOT(onRowsInsertedInFilteredModel(QModelIndex,int,int)));
113  connect(mFilteredETM, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
114  SLOT(onRowsAboutToBeRemovedInFilteredModel(QModelIndex,int,int)));
115 
116  loadFromETM();
117 }
118 
119 void ETMCalendarPrivate::onCollectionChanged(const Akonadi::Collection &collection,
120  const QSet<QByteArray> &attributeNames)
121 {
122  Q_ASSERT(collection.isValid());
123  // Is the collection changed to read-only, we update all Incidences
124  if (attributeNames.contains("AccessRights")) {
125  Akonadi::Item::List items = q->items();
126  foreach(const Akonadi::Item &item, items) {
127  if (item.storageCollectionId() == collection.id()) {
128  KCalCore::Incidence::Ptr incidence = CalendarUtils::incidence(item);
129  if (incidence)
130  incidence->setReadOnly(!(collection.rights() & Akonadi::Collection::CanChangeItem));
131  }
132  }
133  }
134 
135  emit q->collectionChanged(collection, attributeNames);
136 }
137 
138 void ETMCalendarPrivate::setupFilteredETM()
139 {
140  // We're only interested in the CollectionTitle column
141  KColumnFilterProxyModel *columnFilterProxy = new KColumnFilterProxyModel(this);
142  columnFilterProxy->setSourceModel(mETM.data());
143  columnFilterProxy->setVisibleColumn(CalendarModel::CollectionTitle);
144  columnFilterProxy->setObjectName("Remove columns");
145 
146  mCollectionProxyModel = new Akonadi::CollectionFilterProxyModel(this);
147  mCollectionProxyModel->setObjectName("Only show collections");
148  mCollectionProxyModel->setDynamicSortFilter(true);
149  mCollectionProxyModel->addMimeTypeFilter(QString::fromLatin1("text/calendar"));
150  mCollectionProxyModel->setExcludeVirtualCollections(true);
151  mCollectionProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
152  mCollectionProxyModel->setSourceModel(columnFilterProxy);
153 
154  // Keep track of selected items.
155  QItemSelectionModel* selectionModel = new QItemSelectionModel(mCollectionProxyModel);
156  selectionModel->setObjectName("Calendar Selection Model");
157 
158  // Make item selection work by means of checkboxes.
159  mCheckableProxyModel = new CheckableProxyModel(this);
160  mCheckableProxyModel->setSelectionModel(selectionModel);
161  mCheckableProxyModel->setSourceModel(mCollectionProxyModel);
162  mCheckableProxyModel->setObjectName("Add checkboxes");
163 
164  mSelectionProxy = new KSelectionProxyModel(selectionModel, this);
165  mSelectionProxy->setObjectName("Only show items of selected collection");
166  mSelectionProxy->setFilterBehavior(KSelectionProxyModel::ChildrenOfExactSelection);
167  mSelectionProxy->setSourceModel(mETM.data());
168 
169  mCalFilterProxyModel = new CalFilterProxyModel(this);
170  mCalFilterProxyModel->setFilter(q->filter());
171  mCalFilterProxyModel->setSourceModel(mSelectionProxy);
172  mCalFilterProxyModel->setObjectName("KCalCore::CalFilter filtering");
173 
174  mFilteredETM = new Akonadi::EntityMimeTypeFilterModel(this);
175  mFilteredETM->setSourceModel(mCalFilterProxyModel);
176  mFilteredETM->setHeaderGroup(Akonadi::EntityTreeModel::ItemListHeaders);
177  mFilteredETM->setSortRole(CalendarModel::SortRole);
178  mFilteredETM->setObjectName("Show headers");
179 
180 #ifdef AKONADI_CALENDAR_DEBUG_MODEL
181  QTreeView *view = new QTreeView;
182  view->setModel(mFilteredETM);
183  view->show();
184 #endif
185 }
186 
187 ETMCalendarPrivate::~ETMCalendarPrivate()
188 {
189 }
190 
191 void ETMCalendarPrivate::loadFromETM()
192 {
193  itemsAdded(itemsFromModel(mFilteredETM));
194 }
195 
196 void ETMCalendarPrivate::clear()
197 {
198  mCollectionMap.clear();
199  mItemsByCollection.clear();
200 
201  itemsRemoved(mItemById.values());
202 
203  if (!mItemById.isEmpty()) {
204  // This never happens
205  kDebug() << "This shouldnt happen: !mItemById.isEmpty()";
206  foreach(Akonadi::Item::Id id, mItemById.keys()) {
207  kDebug() << "Id = " << id;
208  }
209 
210  mItemById.clear();
211  //Q_ASSERT(false); // TODO: discover why this happens
212  }
213 
214  if (!mItemIdByUid.isEmpty()) {
215  // This never happens
216  kDebug() << "This shouldnt happen: !mItemIdByUid.isEmpty()";
217  foreach(const QString &uid, mItemIdByUid.keys()) {
218  kDebug() << "uid: " << uid;
219  }
220  mItemIdByUid.clear();
221  //Q_ASSERT(false);
222  }
223  mParentUidToChildrenUid.clear();
224  //m_virtualItems.clear();
225 }
226 
227 Akonadi::Item::List ETMCalendarPrivate::itemsFromModel(const QAbstractItemModel *model,
228  const QModelIndex &parentIndex,
229  int start, int end)
230 {
231  const int endRow = end >= 0 ? end : model->rowCount(parentIndex) - 1;
232  Akonadi::Item::List items;
233  int row = start;
234  QModelIndex i = model->index(row, 0, parentIndex);
235  while (row <= endRow) {
236  const Akonadi::Item item = itemFromIndex(i);
237  if (item.hasPayload<KCalCore::Incidence::Ptr>()) {
238  items << item;
239  } else {
240  const QModelIndex childIndex = i.child(0, 0);
241  if (childIndex.isValid()) {
242  items << itemsFromModel(model, i);
243  }
244  }
245  ++row;
246  i = i.sibling(row, 0);
247  }
248  return items;
249 }
250 
251 Akonadi::Collection::List ETMCalendarPrivate::collectionsFromModel(const QAbstractItemModel *model,
252  const QModelIndex &parentIndex,
253  int start, int end)
254 {
255  const int endRow = end >= 0 ? end : model->rowCount(parentIndex) - 1;
256  Akonadi::Collection::List collections;
257  int row = start;
258  QModelIndex i = model->index(row, 0, parentIndex);
259  while (row <= endRow) {
260  const Akonadi::Collection collection = collectionFromIndex(i);
261  if (collection.isValid()) {
262  collections << collection;
263  QModelIndex childIndex = i.child(0, 0);
264  if (childIndex.isValid()) {
265  collections << collectionsFromModel(model, i);
266  }
267  }
268  ++row;
269  i = i.sibling(row, 0);
270  }
271  return collections;
272 }
273 
274 Akonadi::Item ETMCalendarPrivate::itemFromIndex(const QModelIndex &idx)
275 {
276  Akonadi::Item item = idx.data(Akonadi::EntityTreeModel::ItemRole).value<Akonadi::Item>();
277  item.setParentCollection(
278  idx.data(Akonadi::EntityTreeModel::ParentCollectionRole).value<Akonadi::Collection>());
279  return item;
280 }
281 
282 void ETMCalendarPrivate::itemsAdded(const Akonadi::Item::List &items)
283 {
284  if (!items.isEmpty()) {
285  foreach(const Akonadi::Item &item, items) {
286  internalInsert(item);
287  }
288 
289  Akonadi::Collection::Id id = items.first().storageCollectionId();
290  if (mPopulatedCollectionIds.contains(id)) {
291  // If the collection isn't populated yet, it will be sent later
292  // Saves some cpu cycles
293  emit q->calendarChanged();
294  }
295  }
296 }
297 
298 void ETMCalendarPrivate::itemsRemoved(const Akonadi::Item::List &items)
299 {
300  foreach(const Akonadi::Item &item, items) {
301  internalRemove(item);
302  }
303  emit q->calendarChanged();
304 }
305 
306 Akonadi::Collection ETMCalendarPrivate::collectionFromIndex(const QModelIndex &index)
307 {
308  return index.data(Akonadi::EntityTreeModel::CollectionRole).value<Akonadi::Collection>();
309 }
310 
311 void ETMCalendarPrivate::onRowsInserted(const QModelIndex &index,
312  int start, int end)
313 {
314  Akonadi::Collection::List collections = collectionsFromModel(mETM.data(), index,
315  start, end);
316 
317  foreach(const Akonadi::Collection &collection, collections) {
318  mCollectionMap[collection.id()] = collection;
319  }
320 
321  if (!collections.isEmpty())
322  emit q->collectionsAdded(collections);
323 }
324 
325 void ETMCalendarPrivate::onCollectionPopulated(Akonadi::Collection::Id id)
326 {
327  mPopulatedCollectionIds.insert(id);
328  emit q->calendarChanged();
329 }
330 
331 void ETMCalendarPrivate::onRowsRemoved(const QModelIndex &index, int start, int end)
332 {
333  Akonadi::Collection::List collections = collectionsFromModel(mETM.data(), index, start, end);
334  foreach(const Akonadi::Collection &collection, collections) {
335  mCollectionMap.remove(collection.id());
336  }
337 
338  if (!collections.isEmpty())
339  emit q->collectionsRemoved(collections);
340 }
341 
342 void ETMCalendarPrivate::onDataChanged(const QModelIndex &topLeft,
343  const QModelIndex &bottomRight)
344 {
345  // We only update collections, because items are handled in the filtered model
346  Q_ASSERT(topLeft.row() <= bottomRight.row());
347  const int endRow = bottomRight.row();
348  QModelIndex i(topLeft);
349  int row = i.row();
350  while (row <= endRow) {
351  const Akonadi::Collection col = collectionFromIndex(i);
352  if (col.isValid()) {
353  // Attributes might have changed, store the new collection and discard the old one
354  mCollectionMap.insert(col.id(), col);
355  }
356  ++row;
357  }
358 }
359 
360 void ETMCalendarPrivate::onRowsMoved(const QModelIndex &sourceParent,
361  int sourceStart,
362  int sourceEnd,
363  const QModelIndex &destinationParent,
364  int destinationRow)
365 {
366  //TODO
367  Q_UNUSED(sourceParent);
368  Q_UNUSED(sourceStart);
369  Q_UNUSED(sourceEnd);
370  Q_UNUSED(destinationParent);
371  Q_UNUSED(destinationRow);
372 }
373 
374 void ETMCalendarPrivate::onLayoutChangedInFilteredModel()
375 {
376  clear();
377  loadFromETM();
378 }
379 
380 void ETMCalendarPrivate::onModelResetInFilteredModel()
381 {
382  clear();
383  loadFromETM();
384 }
385 
386 void ETMCalendarPrivate::onDataChangedInFilteredModel(const QModelIndex &topLeft,
387  const QModelIndex &bottomRight)
388 {
389  Q_ASSERT(topLeft.row() <= bottomRight.row());
390  const int endRow = bottomRight.row();
391  QModelIndex i(topLeft);
392  int row = i.row();
393  while (row <= endRow) {
394  const Akonadi::Item item = itemFromIndex(i);
395  if (item.isValid() && item.hasPayload<KCalCore::Incidence::Ptr>())
396  updateItem(item);
397 
398  ++row;
399  i = i.sibling(row, topLeft.column());
400  }
401 
402  emit q->calendarChanged();
403 }
404 
405 void ETMCalendarPrivate::updateItem(const Akonadi::Item &item)
406 {
407  Incidence::Ptr newIncidence = CalendarUtils::incidence(item);
408  Q_ASSERT(newIncidence);
409  Q_ASSERT(!newIncidence->uid().isEmpty());
410  newIncidence->setCustomProperty("VOLATILE", "AKONADI-ID", QString::number(item.id()));
411  IncidenceBase::Ptr existingIncidence = q->incidence(newIncidence->uid(), newIncidence->recurrenceId());
412 
413  if (!existingIncidence && !mItemById.contains(item.id())) {
414  // We don't know about this one because it was discarded, for example because of not having DTSTART
415  return;
416  }
417 
418  mItemsByCollection.insert(item.storageCollectionId(), item);
419  Akonadi::Item oldItem = mItemById.value(item.id());
420 
421  if (existingIncidence) {
422  // We set the payload so that the internal incidence pointer and the one in mItemById stay the same
423  Akonadi::Item updatedItem = item;
424  updatedItem.setPayload<KCalCore::Incidence::Ptr>(existingIncidence.staticCast<KCalCore::Incidence>());
425  mItemById.insert(item.id(), updatedItem); // The item needs updating too, revision changed.
426 
427  // Check if RELATED-TO changed, updating parenting information
428  handleParentChanged(newIncidence);
429  *(existingIncidence.data()) = *(newIncidence.data());
430  } else {
431  mItemById.insert(item.id(), item); // The item needs updating too, revision changed.
432  // The item changed it's UID, update our maps, the Google resource changes the UID when we create incidences.
433  handleUidChange(oldItem, item, newIncidence->instanceIdentifier());
434  }
435 }
436 
437 void ETMCalendarPrivate::onRowsInsertedInFilteredModel(const QModelIndex &index,
438  int start, int end)
439 {
440  itemsAdded(itemsFromModel(mFilteredETM, index, start, end));
441 }
442 
443 void ETMCalendarPrivate::onRowsAboutToBeRemovedInFilteredModel(const QModelIndex &index,
444  int start, int end)
445 {
446  itemsRemoved(itemsFromModel(mFilteredETM, index, start, end));
447 }
448 
449 void ETMCalendarPrivate::onFilterChanged()
450 {
451  mCalFilterProxyModel->setFilter(q->filter());
452 }
453 
454 ETMCalendar::ETMCalendar(QObject *parent) : CalendarBase(new ETMCalendarPrivate(this), parent)
455 {
456  Q_D(ETMCalendar);
457  d->init();
458 }
459 
460 ETMCalendar::ETMCalendar(const QStringList &mimeTypes, QObject *parent) : CalendarBase(new ETMCalendarPrivate(this), parent)
461 {
462  Q_D(ETMCalendar);
463  d->mMimeTypes = mimeTypes;
464  d->init();
465 }
466 
467 ETMCalendar::ETMCalendar(ETMCalendar *other, QObject *parent)
468  : CalendarBase(new ETMCalendarPrivate(this), parent)
469 {
470  Q_D(ETMCalendar);
471 
472  CalendarModel *model = qobject_cast<Akonadi::CalendarModel*>(other->entityTreeModel());
473  if (model) {
474  d->mETM = model->weakPointer().toStrongRef();
475  }
476 
477  d->init();
478 }
479 
480 ETMCalendar::~ETMCalendar()
481 {
482 }
483 
484 //TODO: move this up?
485 Akonadi::Collection ETMCalendar::collection(Akonadi::Collection::Id id) const
486 {
487  Q_D(const ETMCalendar);
488  return d->mCollectionMap.value(id);
489 }
490 
491 bool ETMCalendar::hasRight(const QString &uid, Akonadi::Collection::Right right) const
492 {
493  return hasRight(item(uid), right);
494 }
495 
496 bool ETMCalendar::hasRight(const Akonadi::Item &item, Akonadi::Collection::Right right) const
497 {
498  // if the users changes the rights, item.parentCollection()
499  // can still have the old rights, so we use call collection()
500  // which returns the updated one
501  const Akonadi::Collection col = collection(item.storageCollectionId());
502  return col.rights() & right;
503 }
504 
505 QAbstractItemModel *ETMCalendar::model() const
506 {
507  Q_D(const ETMCalendar);
508  return d->mFilteredETM;
509 }
510 
511 KCheckableProxyModel *ETMCalendar::checkableProxyModel() const
512 {
513  Q_D(const ETMCalendar);
514  return d->mCheckableProxyModel;
515 }
516 
517 KCalCore::Alarm::List ETMCalendar::alarms(const KDateTime &from,
518  const KDateTime &to,
519  bool excludeBlockedAlarms) const
520 {
521  Q_D(const ETMCalendar);
522  KCalCore::Alarm::List alarmList;
523  QHashIterator<Akonadi::Item::Id, Akonadi::Item> i(d->mItemById);
524  while (i.hasNext()) {
525  const Akonadi::Item item = i.next().value();
526 
527  BlockAlarmsAttribute *blockedAttr = 0;
528 
529  if (excludeBlockedAlarms) {
530  // take the collection from m_collectionMap, because we need the up-to-date collection attrs
531  Akonadi::Collection parentCollection = d->mCollectionMap.value(item.storageCollectionId());
532  if (parentCollection.isValid() && parentCollection.hasAttribute<BlockAlarmsAttribute>()) {
533  blockedAttr = parentCollection.attribute<BlockAlarmsAttribute>();
534  if (blockedAttr->isAlarmTypeBlocked(Alarm::Audio) && blockedAttr->isAlarmTypeBlocked(Alarm::Display)
535  && blockedAttr->isAlarmTypeBlocked(Alarm::Email) && blockedAttr->isAlarmTypeBlocked(Alarm::Procedure))
536  {
537  continue;
538  }
539  }
540  }
541 
542  KCalCore::Incidence::Ptr incidence;
543  if (item.isValid() && item.hasPayload<KCalCore::Incidence::Ptr>()) {
544  incidence = KCalCore::Incidence::Ptr(item.payload<KCalCore::Incidence::Ptr>()->clone());
545  } else {
546  continue;
547  }
548 
549  if (!incidence) {
550  continue;
551  }
552 
553  if (blockedAttr) {
554  // Remove all blocked types of alarms
555  Q_FOREACH(const KCalCore::Alarm::Ptr &alarm, incidence->alarms()) {
556  if (blockedAttr->isAlarmTypeBlocked(alarm->type())) {
557  incidence->removeAlarm(alarm);
558  }
559  }
560  }
561 
562  if (incidence->alarms().isEmpty()) {
563  continue;
564  }
565 
566  Alarm::List tmpList;
567  if (incidence->recurs()) {
568  appendRecurringAlarms(tmpList, incidence, from, to);
569  } else {
570  appendAlarms(tmpList, incidence, from, to);
571  }
572 
573  // We need to tag them with the incidence uid in case
574  // the caller will need it, because when we get out of
575  // this scope the incidence will be destroyed.
576  QVectorIterator<Alarm::Ptr> a(tmpList);
577  while (a.hasNext()) {
578  a.next()->setCustomProperty("ETMCalendar", "parentUid", incidence->uid());
579  }
580  alarmList += tmpList;
581  }
582  return alarmList;
583 }
584 
585 Akonadi::EntityTreeModel *ETMCalendar::entityTreeModel() const
586 {
587  Q_D(const ETMCalendar);
588  return d->mETM.data();
589 }
590 
591 void ETMCalendar::setCollectionFilteringEnabled(bool enable)
592 {
593  Q_D(ETMCalendar);
594  if (d->mCollectionFilteringEnabled != enable) {
595  d->mCollectionFilteringEnabled = enable;
596  if (enable) {
597  d->mSelectionProxy->setSourceModel(d->mETM.data());
598  QAbstractItemModel *oldModel = d->mCalFilterProxyModel->sourceModel();
599  d->mCalFilterProxyModel->setSourceModel(d->mSelectionProxy);
600  delete qobject_cast<KDescendantsProxyModel *>(oldModel);
601  } else {
602  KDescendantsProxyModel *flatner = new KDescendantsProxyModel(this);
603  flatner->setSourceModel(d->mETM.data());
604  d->mCalFilterProxyModel->setSourceModel(flatner);
605  }
606  }
607 }
608 
609 bool ETMCalendar::collectionFilteringEnabled() const
610 {
611  Q_D(const ETMCalendar);
612  return d->mCollectionFilteringEnabled;
613 }
614 
615 #include "moc_etmcalendar.cpp"
616 #include "moc_etmcalendar_p.cpp"
Akonadi::ItemFetchScope::fetchAttribute
void fetchAttribute(const QByteArray &type, bool fetch=true)
Sets whether the attribute of the given type should be fetched.
Definition: itemfetchscope.cpp:78
Akonadi::CollectionFilterProxyModel
A proxy model that filters collections by mime type.
Definition: collectionfilterproxymodel.h:54
Akonadi::Monitor::setSession
void setSession(Akonadi::Session *session)
Sets the session used by the Monitor to communicate with the Akonadi server.
Definition: monitor.cpp:332
Akonadi::Monitor::setMimeTypeMonitored
void setMimeTypeMonitored(const QString &mimetype, bool monitored=true)
Sets whether items of the specified mime type shall be monitored for changes.
Definition: monitor.cpp:126
Akonadi::Monitor::setCollectionMonitored
void setCollectionMonitored(const Collection &collection, bool monitored=true)
Sets whether the specified collection shall be monitored for changes.
Definition: monitor.cpp:66
Akonadi::ETMCalendar::entityTreeModel
Akonadi::EntityTreeModel * entityTreeModel() const
Returns the underlying EntityTreeModel.
Definition: etmcalendar.cpp:585
Akonadi::Collection
Represents a collection of PIM items.
Definition: collection.h:75
Akonadi::KColumnFilterProxyModel
Filter model to make only certain columns of a model visible.
Definition: kcolumnfilterproxymodel_p.h:38
Akonadi::Monitor::setItemFetchScope
void setItemFetchScope(const ItemFetchScope &fetchScope)
Sets the item fetch scope.
Definition: monitor.cpp:233
Akonadi::Entity::Id
qint64 Id
Describes the unique id type.
Definition: entity.h:65
Akonadi::CalendarBase::item
Akonadi::Item item(const QString &uid) const
Returns the Item containing the incidence with uid uid or an invalid Item if the incidence isn't foun...
Definition: calendarbase.cpp:402
Akonadi::Collection::CanChangeItem
Can change items in this collection.
Definition: collection.h:88
Akonadi::EntityMimeTypeFilterModel
A proxy model that filters entities by mime type.
Definition: entitymimetypefiltermodel.h:61
Akonadi::ItemFetchScope::fetchFullPayload
void fetchFullPayload(bool fetch=true)
Sets whether the full payload shall be fetched.
Definition: itemfetchscope.cpp:68
Akonadi::Entity::attribute
Attribute * attribute(const QByteArray &name) const
Returns the attribute of the given type name if available, 0 otherwise.
Definition: entity.cpp:165
Akonadi::ETMCalendar::collectionFilteringEnabled
bool collectionFilteringEnabled() const
Returns whether collection filtering is enabled.
Definition: etmcalendar.cpp:609
Akonadi::ETMCalendar::model
QAbstractItemModel * model() const
Convenience method to access the contents of this KCalCore::Calendar through a QAIM interface...
Definition: etmcalendar.cpp:505
Akonadi::ETMCalendar::checkableProxyModel
KCheckableProxyModel * checkableProxyModel() const
Returns the KCheckableProxyModel used to select from which collections should the calendar be populat...
Definition: etmcalendar.cpp:511
Akonadi::Collection::root
static Collection root()
Returns the root collection.
Definition: collection.cpp:192
Akonadi::ETMCalendar::ETMCalendar
ETMCalendar(QObject *parent=0)
Constructs a new ETMCalendar.
Definition: etmcalendar.cpp:454
Akonadi::Session
A communication session with the Akonadi storage.
Definition: session.h:59
Akonadi::EntityTreeModel::CollectionRole
The collection.
Definition: entitytreemodel.h:335
Akonadi::EntityTreeModel::ParentCollectionRole
The parent collection of the entity.
Definition: entitytreemodel.h:340
Akonadi::Monitor::fetchCollection
void fetchCollection(bool enable)
Enables automatic fetching of changed collections from the Akonadi storage.
Definition: monitor.cpp:221
Akonadi::Entity::id
Id id() const
Returns the unique identifier of the entity.
Definition: entity.cpp:72
Akonadi::Collection::rights
Rights rights() const
Returns the rights the user has on the collection.
Definition: collection.cpp:99
Akonadi::ItemFetchScope
Specifies which parts of an item should be fetched from the Akonadi storage.
Definition: itemfetchscope.h:68
Akonadi::EntityTreeModel::ItemListHeaders
Header information for a list of items.
Definition: entitytreemodel.h:384
Akonadi::ETMCalendar::collection
Akonadi::Collection collection(Akonadi::Collection::Id) const
Returns the collection having id.
Definition: etmcalendar.cpp:485
Akonadi::BlockAlarmsAttribute::isAlarmTypeBlocked
bool isAlarmTypeBlocked(KCalCore::Alarm::Type type) const
Returns whether given alarm type is blocked or not.
Definition: blockalarmsattribute.cpp:77
Akonadi::Collection::Right
Right
Describes rights of a collection.
Definition: collection.h:86
Akonadi::EntityTreeModel::ItemRole
The Item.
Definition: entitytreemodel.h:331
Akonadi::Entity::hasAttribute
bool hasAttribute(const QByteArray &name) const
Returns true if the entity has an attribute of the given type name, false otherwise.
Definition: entity.cpp:146
Akonadi::EntityTreeModel
A model for collections and items together.
Definition: entitytreemodel.h:317
Akonadi::ETMCalendar::~ETMCalendar
~ETMCalendar()
Destroys this ETMCalendar.
Definition: etmcalendar.cpp:480
Akonadi::CalendarBase
The base class for all akonadi aware calendars.
Definition: calendarbase.h:50
Akonadi::Entity::isValid
bool isValid() const
Returns whether the entity is valid.
Definition: entity.cpp:97
Akonadi::Collection::List
QList< Collection > List
Describes a list of collections.
Definition: collection.h:81
Akonadi::EntityDisplayAttribute
Attribute that stores the properties that are used to display an entity.
Definition: entitydisplayattribute.h:39
Akonadi::ETMCalendar
A KCalCore::Calendar that uses an EntityTreeModel to populate itself.
Definition: etmcalendar.h:54
Akonadi::KColumnFilterProxyModel::setVisibleColumn
void setVisibleColumn(int column)
Convenience function.
Definition: kcolumnfilterproxymodel.cpp:52
Akonadi::ETMCalendar::hasRight
bool hasRight(const Akonadi::Item &item, Akonadi::Collection::Right right) const
Returns true if the collection owning incidence has righ right.
Definition: etmcalendar.cpp:496
Akonadi::ETMCalendar::setCollectionFilteringEnabled
void setCollectionFilteringEnabled(bool enable)
Enable or disable collection filtering.
Definition: etmcalendar.cpp:591
Akonadi::ChangeRecorder
Records and replays change notification.
Definition: changerecorder.h:47
Akonadi::BlockAlarmsAttribute
An Attribute that marks that alarms from a calendar collection are blocked.
Definition: blockalarmsattribute.h:41
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Mon Jul 21 2014 08:03:52 by doxygen 1.8.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

akonadi

Skip menu "akonadi"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Modules
  • Related Pages

kdepimlibs-4.13.3 API Reference

Skip menu "kdepimlibs-4.13.3 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal