kalarm
collectionmodel.cpp
Go to the documentation of this file.
47 static Collection::Rights writableRights = Collection::CanChangeItem | Collection::CanCreateItem | Collection::CanDeleteItem;
117 bool CollectionMimeTypeFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex& sourceParent) const
130 if (mAlarmType != CalEvent::EMPTY && !collection.contentMimeTypes().contains(CalEvent::mimeType(mAlarmType)))
147 return static_cast<AkonadiModel*>(sourceModel())->data(mapToSource(index(row, 0)), EntityTreeModel::CollectionRole).value<Collection>();
152 return static_cast<AkonadiModel*>(sourceModel())->data(mapToSource(index), EntityTreeModel::CollectionRole).value<Collection>();
191 return mapFromSource(static_cast<CollectionMimeTypeFilterModel*>(sourceModel())->collectionIndex(collection));
209 bool CollectionListModel::isDescendantOf(const QModelIndex& ancestor, const QModelIndex& descendant) const
257 connect(mModel, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)), SIGNAL(layoutAboutToBeChanged()));
258 connect(mModel, SIGNAL(rowsInserted(QModelIndex,int,int)), SLOT(slotRowsInserted(QModelIndex,int,int)));
261 connect(mModel, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), SIGNAL(layoutAboutToBeChanged()));
264 connect(AkonadiModel::instance(), SIGNAL(collectionStatusChanged(Akonadi::Collection,AkonadiModel::Change,QVariant,bool)),
345 bool CollectionCheckListModel::setData(const QModelIndex& index, const QVariant& value, int role)
409 void CollectionCheckListModel::selectionChanged(const QItemSelection& selected, const QItemSelection& deselected)
428 void CollectionCheckListModel::collectionStatusChanged(const Collection& collection, AkonadiModel::Change change, const QVariant&, bool inserted)
453 void CollectionCheckListModel::setSelectionStatus(const Collection& collection, const QModelIndex& sourceIndex)
476 connect(mActiveModel, SIGNAL(collectionTypeChange(CollectionCheckListModel*)), SLOT(collectionTypeChanged(CollectionCheckListModel*)));
477 connect(mArchivedModel, SIGNAL(collectionTypeChange(CollectionCheckListModel*)), SLOT(collectionTypeChanged(CollectionCheckListModel*)));
478 connect(mTemplateModel, SIGNAL(collectionTypeChange(CollectionCheckListModel*)), SLOT(collectionTypeChanged(CollectionCheckListModel*)));
505 return static_cast<CollectionCheckListModel*>(sourceModel())->collection(mapToSource(index(row, 0)));
530 bool CollectionFilterCheckListModel::filterAcceptsRow(int sourceRow, const QModelIndex& sourceParent) const
598 QVariant value = static_cast<CollectionFilterCheckListModel*>(model())->data(index, Qt::ToolTipRole);
615 int checkWidth = QApplication::style()->subElementRect(QStyle::SE_ViewItemCheckIndicator, &opt).width();
616 int left = spacing() + 3*margin + checkWidth + viewOptions().decorationSize.width(); // left offset of text
661 : FavoriteCollectionsModel(AkonadiModel::instance(), KConfigGroup(KGlobal::config(), "Collections"), parent),
672 connect(AkonadiModel::instance(), SIGNAL(collectionStatusChanged(Akonadi::Collection,AkonadiModel::Change,QVariant,bool)),
688 void CollectionControlModel::findEnabledCollections(const EntityMimeTypeFilterModel* filter, const QModelIndex& parent, Collection::List& collections) const
694 const Collection collection = model->data(filter->mapToSource(ix), AkonadiModel::CollectionRole).value<Collection>();
705 model->setData(model->collectionIndex(collection), static_cast<int>(canEnable), AkonadiModel::EnabledTypesRole);
735 CalEvent::Types CollectionControlModel::setEnabled(const Collection& collection, CalEvent::Types types, bool enabled)
745 alarmTypes |= static_cast<CalEvent::Types>(types & (CalEvent::ACTIVE | CalEvent::ARCHIVED | CalEvent::TEMPLATE));
757 CalEvent::Types CollectionControlModel::setEnabledStatus(const Collection& collection, CalEvent::Types types, bool inserted)
826 model->setData(ix, static_cast<int>(stdTypes & ~disallowedStdTypes), AkonadiModel::IsStandardRole);
837 void CollectionControlModel::statusChanged(const Collection& collection, AkonadiModel::Change change, const QVariant& value, bool inserted)
915 CalEvent::Types CollectionControlModel::checkTypesToEnable(const Collection& collection, const Collection::List& collections, CalEvent::Types types)
948 list += QLatin1String("<item>") + i18nc("@info/plain", "Active Alarms") + QLatin1String("</item>");
950 list += QLatin1String("<item>") + i18nc("@info/plain", "Archived Alarms") + QLatin1String("</item>");
952 list += QLatin1String("<item>") + i18nc("@info/plain", "Alarm Templates") + QLatin1String("</item>");
966 int CollectionControlModel::isWritableEnabled(const Akonadi::Collection& collection, CalEvent::Type type)
971 int CollectionControlModel::isWritableEnabled(const Akonadi::Collection& collection, CalEvent::Type type, KACalendar::Compat& format)
1030 CalEvent::Types CollectionControlModel::standardTypes(const Collection& collection, bool useDefault)
1064 void CollectionControlModel::setStandard(Akonadi::Collection& collection, CalEvent::Type type, bool standard)
1122 void CollectionControlModel::setStandard(Akonadi::Collection& collection, CalEvent::Types types)
1178 Collection CollectionControlModel::destination(CalEvent::Type type, QWidget* promptParent, bool noPrompt, bool* cancelled)
1227 Collection::List CollectionControlModel::enabledCollections(CalEvent::Type type, bool writable)
void collectionTypeChange(CollectionCheckListModel *)
static Akonadi::Collection getStandard(CalEvent::Type, bool useDefault=false)
Return the standard collection for a specified mime type.
Definition: collectionmodel.cpp:991
virtual bool viewportEvent(QEvent *)
Definition: collectionmodel.cpp:592
CollectionCheckListModel(CalEvent::Type, QObject *parent=0)
Definition: collectionmodel.cpp:245
static void setStandard(Akonadi::Collection &, CalEvent::Type, bool standard)
Set or clear a collection as the standard collection for a specified mime type.
Definition: collectionmodel.cpp:1064
static int isWritableEnabled(const Akonadi::Collection &, CalEvent::Type)
Return whether a collection is both enabled and fully writable for a given alarm type, i.e.
Definition: collectionmodel.cpp:966
Akonadi::Collection collection(int row) const
Definition: collectionmodel.cpp:179
virtual void mouseReleaseEvent(QMouseEvent *)
Definition: collectionmodel.cpp:582
virtual bool isDescendantOf(const QModelIndex &ancestor, const QModelIndex &descendant) const
Definition: collectionmodel.cpp:209
CollectionView(CollectionFilterCheckListModel *, QWidget *parent=0)
Definition: collectionmodel.cpp:554
Definition: akonadimodel.h:64
Definition: collectionmodel.h:78
static bool isStandard(Akonadi::Collection &, CalEvent::Type)
Return whether a collection is the standard collection for a specified mime type. ...
Definition: collectionmodel.cpp:1016
bool refresh(Akonadi::Collection &) const
Refresh the specified collection instance with up to date data.
Definition: akonadimodel.cpp:1744
Definition: akonadimodel.h:52
QModelIndex collectionIndex(const Akonadi::Collection &) const
Definition: collectionmodel.cpp:189
bool isCollectionBeingDeleted(Akonadi::Collection::Id) const
Definition: akonadimodel.cpp:1069
QModelIndex collectionIndex(Akonadi::Collection::Id id) const
Definition: akonadimodel.h:119
Definition: akonadimodel.h:61
static Akonadi::Collection collectionForResource(const QString &resourceId)
Return the collection ID for a given resource ID.
Definition: collectionmodel.cpp:1245
static bool isEnabled(const Akonadi::Collection &, CalEvent::Type)
Return whether a collection is enabled (and valid).
Definition: collectionmodel.cpp:714
static QString typeListForDisplay(CalEvent::Types)
Return a bulleted list of alarm types for inclusion in an i18n message.
Definition: collectionmodel.cpp:944
Akonadi::Collection collection(int row) const
Definition: collectionmodel.cpp:287
void useCollectionColour(bool use)
Definition: collectionmodel.h:58
static CollectionControlModel * instance()
Definition: collectionmodel.cpp:653
CollectionListModel(QObject *parent=0)
Definition: collectionmodel.cpp:168
static Akonadi::Collection destination(CalEvent::Type, QWidget *promptParent=0, bool noPrompt=false, bool *cancelled=0)
Find the collection to be used to store an event of a given type.
Definition: collectionmodel.cpp:1178
virtual QVariant data(const QModelIndex &, int role=Qt::DisplayRole) const
Definition: collectionmodel.cpp:1314
void setFilterWritable(bool writable)
Definition: collectionmodel.cpp:199
Definition: collectionmodel.h:168
static CalEvent::Types standardTypes(const Akonadi::Collection &, bool useDefault=false)
Return the alarm type(s) for which a collection is the standard collection.
Definition: collectionmodel.cpp:1030
QString tooltip(const Akonadi::Collection &, CalEvent::Types) const
Get the tooltip for a collection.
Definition: akonadimodel.cpp:894
void setEventTypeFilter(CalEvent::Type)
Definition: collectionmodel.cpp:481
Definition: akonadimodel.h:52
virtual QVariant data(const QModelIndex &, int role=Qt::DisplayRole) const
Definition: collectionmodel.cpp:300
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
Definition: collectionmodel.cpp:530
virtual QVariant data(const QModelIndex &, int role=Qt::DisplayRole) const
Definition: akonadimodel.cpp:177
Definition: akonadimodel.h:52
static Akonadi::Collection::List enabledCollections(CalEvent::Type, bool writable)
Return the enabled collections which contain a specified mime type.
Definition: collectionmodel.cpp:1227
static CalEvent::Types types(const Akonadi::Collection &)
Definition: akonadimodel.cpp:1863
static int warningContinueCancel(QWidget *parent, ButtonCode defaultButton, const QString &text, const QString &caption=QString(), const KGuiItem &buttonContinue=KStandardGuiItem::cont(), const QString &dontAskAgainName=QString())
static bool isCompatible(const Akonadi::Collection &)
Check whether a collection is stored in the current KAlarm calendar format.
Definition: akonadimodel.cpp:1821
static void sorry(QWidget *parent, const QString &text, const QString &caption=QString(), Options options=Options(Notify|WindowModal))
CollectionFilterCheckListModel(QObject *parent=0)
Definition: collectionmodel.cpp:468
Definition: akonadimodel.h:62
virtual QVariant data(const QModelIndex &, int role=Qt::DisplayRole) const
Definition: collectionmodel.cpp:218
Akonadi::Collection collection(int row) const
Definition: collectionmodel.cpp:568
Akonadi::Collection collection(int row) const
Definition: collectionmodel.cpp:503
Definition: collectionmodel.h:50
virtual bool setData(const QModelIndex &, const QVariant &value, int role)
Definition: collectionmodel.cpp:345
virtual QVariant data(const QModelIndex &, int role=Qt::DisplayRole) const
Definition: collectionmodel.cpp:513
~CollectionCheckListModel()
Definition: collectionmodel.cpp:274
virtual void setModel(QAbstractItemModel *)
Definition: collectionmodel.cpp:560
static QColor foregroundColor(const Akonadi::Collection &, const QStringList &mimeTypes)
Get the foreground color for a collection, based on specified mime types.
Definition: akonadimodel.cpp:821
void setEventTypeFilter(CalEvent::Type)
Definition: collectionmodel.cpp:194
Definition: akonadimodel.h:48
static int isWritable(const Akonadi::Collection &)
Return whether a collection is fully writable, i.e.
Definition: akonadimodel.cpp:1830
void setFilterEnabled(bool enabled)
Definition: collectionmodel.cpp:204
virtual bool setData(const QModelIndex &, const QVariant &value, int role)
Definition: akonadimodel.cpp:496
static void information(QWidget *parent, const QString &text, const QString &caption=QString(), const QString &dontShowAgainName=QString(), Options options=Options(Notify|WindowModal))
static CalEvent::Types setEnabled(const Akonadi::Collection &, CalEvent::Types, bool enabled)
Enable or disable a collection (if it is valid) for specified alarm types.
Definition: collectionmodel.cpp:735
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:59:10 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:59:10 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.