21 #ifndef COLLECTIONMODEL_H
22 #define COLLECTIONMODEL_H
26 #include <kalarmcal/kacalendar.h>
28 #include <akonadi/favoritecollectionsmodel.h>
29 #include <kcheckableproxymodel.h>
30 #include <kdescendantsproxymodel.h>
31 #include <kdeversion.h>
33 #include <QSortFilterProxyModel>
36 using namespace KAlarmCal;
41 class EntityMimeTypeFilterModel;
55 void setEventTypeFilter(CalEvent::Type);
56 void setFilterWritable(
bool writable);
57 void setFilterEnabled(
bool enabled);
59 Akonadi::Collection collection(
int row)
const;
60 Akonadi::Collection collection(
const QModelIndex&)
const;
61 QModelIndex collectionIndex(
const Akonadi::Collection&)
const;
62 virtual bool isDescendantOf(
const QModelIndex& ancestor,
const QModelIndex& descendant)
const;
63 virtual QVariant data(
const QModelIndex&,
int role = Qt::DisplayRole)
const;
66 bool mUseCollectionColour;
84 Akonadi::Collection collection(
int row)
const;
85 Akonadi::Collection collection(
const QModelIndex&)
const;
86 virtual QVariant data(
const QModelIndex&,
int role = Qt::DisplayRole)
const;
87 virtual bool setData(
const QModelIndex&,
const QVariant& value,
int role);
93 void selectionChanged(
const QItemSelection& selected,
const QItemSelection& deselected);
94 void slotRowsInserted(
const QModelIndex& parent,
int start,
int end);
95 void collectionStatusChanged(
const Akonadi::Collection&,
AkonadiModel::Change,
const QVariant& value,
bool inserted);
98 void setSelectionStatus(
const Akonadi::Collection&,
const QModelIndex&);
101 static int mInstanceCount;
102 CalEvent::Type mAlarmType;
103 QItemSelectionModel* mSelectionModel;
118 void setEventTypeFilter(CalEvent::Type);
119 Akonadi::Collection collection(
int row)
const;
120 Akonadi::Collection collection(
const QModelIndex&)
const;
121 virtual QVariant data(
const QModelIndex&,
int role = Qt::DisplayRole)
const;
124 bool filterAcceptsRow(
int sourceRow,
const QModelIndex& sourceParent)
const;
133 CalEvent::Type mAlarmType;
147 Akonadi::Collection collection(
int row)
const;
148 Akonadi::Collection collection(
const QModelIndex&)
const;
151 virtual void setModel(QAbstractItemModel*);
152 virtual void mouseReleaseEvent(QMouseEvent*);
153 virtual bool viewportEvent(QEvent*);
175 static bool isEnabled(
const Akonadi::Collection&, CalEvent::Type);
181 static CalEvent::Types setEnabled(
const Akonadi::Collection&, CalEvent::Types,
bool enabled);
193 static int isWritableEnabled(
const Akonadi::Collection&, CalEvent::Type);
212 static int isWritableEnabled(
const Akonadi::Collection&, CalEvent::Type, KACalendar::Compat& format);
219 static Akonadi::Collection getStandard(CalEvent::Type,
bool useDefault =
false);
223 static bool isStandard(Akonadi::Collection&, CalEvent::Type);
230 static CalEvent::Types standardTypes(
const Akonadi::Collection&,
bool useDefault =
false);
235 static void setStandard(Akonadi::Collection&, CalEvent::Type,
bool standard);
240 static void setStandard(Akonadi::Collection&, CalEvent::Types);
256 static Akonadi::Collection destination(CalEvent::Type,
QWidget* promptParent = 0,
bool noPrompt =
false,
bool* cancelled = 0);
261 static Akonadi::Collection::List enabledCollections(CalEvent::Type,
bool writable);
266 static Akonadi::Collection collectionForResource(
const QString& resourceId);
268 #if KDE_IS_VERSION(4,9,80)
272 static bool isPopulated(Akonadi::Collection::Id);
280 bool waitUntilPopulated(Akonadi::Collection::Id colId = -1,
int timeout = 0);
283 virtual QVariant data(
const QModelIndex&,
int role = Qt::DisplayRole)
const;
286 static QString typeListForDisplay(CalEvent::Types);
289 void statusChanged(
const Akonadi::Collection&,
AkonadiModel::Change,
const QVariant& value,
bool inserted);
290 void collectionPopulated();
294 void findEnabledCollections(
const Akonadi::EntityMimeTypeFilterModel*,
const QModelIndex& parent, Akonadi::Collection::List&)
const;
295 CalEvent::Types setEnabledStatus(
const Akonadi::Collection&, CalEvent::Types,
bool inserted);
296 static CalEvent::Types checkTypesToEnable(
const Akonadi::Collection&,
const Akonadi::Collection::List&, CalEvent::Types);
299 static bool mAskDestination;
300 QEventLoop* mPopulatedCheckLoop;
303 #endif // COLLECTIONMODEL_H
static void setAskDestinationPolicy(bool ask)
Set whether the user should be prompted for the destination collection to add alarms to...
void useCollectionColour(bool use)
CollectionFilterCheckListModel * collectionModel() const