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
123 const Collection collection = model->data(ix, AkonadiModel::CollectionRole).value<Collection>();
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)),
689 void CollectionControlModel::findEnabledCollections(const EntityMimeTypeFilterModel* filter, const QModelIndex& parent, Collection::List& collections) const
695 const Collection collection = model->data(filter->mapToSource(ix), AkonadiModel::CollectionRole).value<Collection>();
698 const CalEvent::Types enabled = !collection.hasAttribute<CollectionAttribute>() ? CalEvent::EMPTY
706 model->setData(model->collectionIndex(collection), static_cast<int>(canEnable), AkonadiModel::EnabledTypesRole);
736 CalEvent::Types CollectionControlModel::setEnabled(const Collection& collection, CalEvent::Types types, bool enabled)
746 alarmTypes |= static_cast<CalEvent::Types>(types & (CalEvent::ACTIVE | CalEvent::ARCHIVED | CalEvent::TEMPLATE));
758 CalEvent::Types CollectionControlModel::setEnabledStatus(const Collection& collection, CalEvent::Types types, bool inserted)
827 model->setData(ix, static_cast<int>(stdTypes & ~disallowedStdTypes), AkonadiModel::IsStandardRole);
838 void CollectionControlModel::statusChanged(const Collection& collection, AkonadiModel::Change change, const QVariant& value, bool inserted)
916 CalEvent::Types CollectionControlModel::checkTypesToEnable(const Collection& collection, const Collection::List& collections, CalEvent::Types types)
950 list += QLatin1String("<item>") + i18nc("@info/plain", "Active Alarms") + QLatin1String("</item>");
952 list += QLatin1String("<item>") + i18nc("@info/plain", "Archived Alarms") + QLatin1String("</item>");
954 list += QLatin1String("<item>") + i18nc("@info/plain", "Alarm Templates") + QLatin1String("</item>");
968 int CollectionControlModel::isWritableEnabled(const Akonadi::Collection& collection, CalEvent::Type type)
973 int CollectionControlModel::isWritableEnabled(const Akonadi::Collection& collection, CalEvent::Type type, KACalendar::Compat& format)
1032 CalEvent::Types CollectionControlModel::standardTypes(const Collection& collection, bool useDefault)
1066 void CollectionControlModel::setStandard(Akonadi::Collection& collection, CalEvent::Type type, bool standard)
1124 void CollectionControlModel::setStandard(Akonadi::Collection& collection, CalEvent::Types types)
1180 Collection CollectionControlModel::destination(CalEvent::Type type, QWidget* promptParent, bool noPrompt, bool* cancelled)
1229 Collection::List CollectionControlModel::enabledCollections(CalEvent::Type type, bool writable)
void collectionTypeChange(CollectionCheckListModel *)
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const
void invalidate()
QModelIndexList indexes() const
int indexOf(QChar ch, int from, Qt::CaseSensitivity cs) const
static Akonadi::Collection getStandard(CalEvent::Type, bool useDefault=false)
Return the standard collection for a specified mime type.
Definition: collectionmodel.cpp:993
virtual bool viewportEvent(QEvent *)
Definition: collectionmodel.cpp:592
Type type() const
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:1066
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:968
Akonadi::Collection collection(int row) const
Definition: collectionmodel.cpp:179
virtual void setSourceModel(QAbstractItemModel *sourceModel)
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:62
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const =0
virtual void setModel(QAbstractItemModel *model)
virtual void mouseReleaseEvent(QMouseEvent *e)
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:1018
bool contains(const QString &str, Qt::CaseSensitivity cs) const
bool refresh(Akonadi::Collection &) const
Refresh the specified collection instance with up to date data.
Definition: akonadimodel.cpp:1807
Definition: akonadimodel.h:50
const QPoint & pos() const
T value() const
QModelIndex collectionIndex(const Akonadi::Collection &) const
Definition: collectionmodel.cpp:189
bool isCollectionBeingDeleted(Akonadi::Collection::Id) const
Definition: akonadimodel.cpp:1105
QString & remove(int position, int n)
QModelIndex collectionIndex(Akonadi::Collection::Id id) const
Definition: akonadimodel.h:119
Definition: akonadimodel.h:59
static Akonadi::Collection collectionForResource(const QString &resourceId)
Return the collection ID for a given resource ID.
Definition: collectionmodel.cpp:1247
void showText(const QPoint &pos, const QString &text, QWidget *w)
static bool isEnabled(const Akonadi::Collection &, CalEvent::Type)
Return whether a collection is enabled (and valid).
Definition: collectionmodel.cpp:715
int width() const
void setBold(bool enable)
static QString typeListForDisplay(CalEvent::Types)
Return a bulleted list of alarm types for inclusion in an i18n message.
Definition: collectionmodel.cpp:946
Akonadi::Collection collection(int row) const
Definition: collectionmodel.cpp:287
const char * name() const
bool isValid() const
QRect boundingRect(QChar ch) const
virtual bool viewportEvent(QEvent *event)
void useCollectionColour(bool use)
Definition: collectionmodel.h:58
static CollectionControlModel * instance()
Definition: collectionmodel.cpp:653
int toInt(bool *ok) const
CollectionListModel(QObject *parent=0)
Definition: collectionmodel.cpp:168
int exec(QFlags< QEventLoop::ProcessEventsFlag > flags)
const QPoint & globalPos() const
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:1180
virtual QVariant data(const QModelIndex &, int role=Qt::DisplayRole) const
Definition: collectionmodel.cpp:1330
void setFilterWritable(bool writable)
Definition: collectionmodel.cpp:199
void exit(int returnCode)
virtual void select(const QModelIndex &index, QFlags< QItemSelectionModel::SelectionFlag > command)
bool isEmpty() const
Definition: collectionmodel.h:168
void invalidateFilter()
void setDynamicSortFilter(bool enable)
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:1032
virtual int horizontalOffset() const
virtual QVariant data(const QModelIndex &index, int role) const =0
QString tooltip(const Akonadi::Collection &, CalEvent::Types) const
Get the tooltip for a collection.
Definition: akonadimodel.cpp:930
bool isActiveWindow() const
QRect rectForIndex(const QModelIndex &index) const
void setEventTypeFilter(CalEvent::Type)
Definition: collectionmodel.cpp:481
Definition: akonadimodel.h:50
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:213
const QFont & font() const
Definition: akonadimodel.h:50
static Akonadi::Collection::List enabledCollections(CalEvent::Type, bool writable)
Return the enabled collections which contain a specified mime type.
Definition: collectionmodel.cpp:1229
virtual QStyleOptionViewItem viewOptions() const
int spacing() const
static CalEvent::Types types(const Akonadi::Collection &)
Definition: akonadimodel.cpp:1926
QAbstractItemModel * sourceModel() const
virtual QModelIndex mapToSource(const QModelIndex &proxyIndex) const
static bool isCompatible(const Akonadi::Collection &)
Check whether a collection is stored in the current KAlarm calendar format.
Definition: akonadimodel.cpp:1884
virtual QModelIndex indexAt(const QPoint &p) const
int width() const
QString mid(int position, int n) const
int frameWidth() const
QStyle * style()
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:60
virtual QVariant data(const QModelIndex &, int role=Qt::DisplayRole) const
Definition: collectionmodel.cpp:218
Akonadi::Collection collection(int row) const
Definition: collectionmodel.cpp:568
bool toBool() const
Akonadi::Collection collection(int row) const
Definition: collectionmodel.cpp:503
Definition: collectionmodel.h:50
static int warningContinueCancel(QWidget *parent, const QString &text, const QString &caption=QString(), const KGuiItem &buttonContinue=KStandardGuiItem::cont(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Options(Notify|WindowModal))
virtual bool setData(const QModelIndex &, const QVariant &value, int role)
Definition: collectionmodel.cpp:345
virtual QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const =0
const QPoint & pos() const
QString toolTip() const
virtual QVariant data(const QModelIndex &, int role=Qt::DisplayRole) const
Definition: collectionmodel.cpp:513
~CollectionCheckListModel()
Definition: collectionmodel.cpp:274
QAbstractItemModel * model() const
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:857
void setEventTypeFilter(CalEvent::Type)
Definition: collectionmodel.cpp:194
void clearSelection()
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QObject * parent() const
typedef SelectionFlags
Definition: akonadimodel.h:46
virtual QVariant data(const QModelIndex &index, int role) const
static int isWritable(const Akonadi::Collection &)
Return whether a collection is fully writable, i.e.
Definition: akonadimodel.cpp:1893
void setFilterEnabled(bool enabled)
Definition: collectionmodel.cpp:204
virtual bool setData(const QModelIndex &, const QVariant &value, int role)
Definition: akonadimodel.cpp:532
singleShot
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:736
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:34:51 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:34:51 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.