KCalendarCore::CalFilter Class
class KCalendarCore::CalFilterProvides a filter for calendars. More...
Header: | #include <KCalendarCore/CalFilter> |
CMake: | find_package(KF6 REQUIRED COMPONENTS CalendarCore) target_link_libraries(mytarget PRIVATE KF6::CalendarCore) |
Public Types
enum | Criteria { HideRecurring, HideCompletedTodos, ShowCategories, HideInactiveTodos, HideNoMatchingAttendeeTodos } |
Public Functions
CalFilter() | |
CalFilter(const QString &name) | |
~CalFilter() | |
void | apply(KCalendarCore::Event::List *eventList) const |
void | apply(KCalendarCore::Journal::List *journalList) const |
void | apply(KCalendarCore::Todo::List *todoList) const |
QStringList | categoryList() const |
int | completedTimeSpan() const |
int | criteria() const |
QStringList | emailList() const |
bool | filterIncidence(const KCalendarCore::Incidence::Ptr &incidence) const |
bool | isEnabled() const |
QString | name() const |
void | setCategoryList(const QStringList &categoryList) |
void | setCompletedTimeSpan(int timespan) |
void | setCriteria(int criteria) |
void | setEmailList(const QStringList &emailList) |
void | setEnabled(bool enabled) |
void | setName(const QString &name) |
bool | operator==(const KCalendarCore::CalFilter &filter) const |
Detailed Description
This class provides a means for filtering calendar incidences by a list of email addresses, a list of categories, or other Criteria.
The following Criteria are available:
- remove recurring Incidences
- keep Incidences with a matching category (see setCategoryList())
- remove completed To-dos (see setCompletedTimeSpan())
- remove inactive To-dos
- remove To-dos without a matching attendee (see setEmailList())
Member Type Documentation
enum CalFilter::Criteria
Filtering Criteria.
Constant | Value | Description |
---|---|---|
KCalendarCore::CalFilter::HideRecurring | 1 | Remove incidences that recur. |
KCalendarCore::CalFilter::HideCompletedTodos | 2 | Remove completed to-dos. |
KCalendarCore::CalFilter::ShowCategories | 4 | Show incidences with at least one matching category. |
KCalendarCore::CalFilter::HideInactiveTodos | 8 | Remove to-dos that haven't started yet. |
KCalendarCore::CalFilter::HideNoMatchingAttendeeTodos | 16 | Remove to-dos without a matching attendee. |
Member Function Documentation
CalFilter::CalFilter()
Constructs an empty filter – a filter without a name or criteria.
[explicit]
CalFilter::CalFilter(const QString &name)
Constructs a filter with name.
name is the name of this filter.
[noexcept]
CalFilter::~CalFilter()
Destroys this filter.
void CalFilter::apply(KCalendarCore::Event::List *eventList) const
Applies the filter to a list of Events. All events not matching the filter criteria are removed from the list.
eventList is a list of Events to filter.
void CalFilter::apply(KCalendarCore::Journal::List *journalList) const
Applies the filter to a list of Journals. All journals not matching the filter criteria are removed from the list.
journalList is a list of Journals to filter.
void CalFilter::apply(KCalendarCore::Todo::List *todoList) const
Applies the filter to a list of To-dos. All to-dos not matching the filter criteria are removed from the list.
todoList is a list of To-dos to filter.
QStringList CalFilter::categoryList() const
Returns the category list for this filter.
See also setCategoryList().
int CalFilter::completedTimeSpan() const
Returns the completed time span for this filter.
See also setCompletedTimeSpan().
int CalFilter::criteria() const
Returns the inclusive filter criteria.
See also setCriteria().
QStringList CalFilter::emailList() const
Returns the email list for this filter.
See also setEmailList().
bool CalFilter::filterIncidence(const KCalendarCore::Incidence::Ptr &incidence) const
Applies the filter criteria to the specified Incidence.
incidence is the Incidence to filter.
Returns true if the Incidence passes the criteria; false otherwise.
bool CalFilter::isEnabled() const
Returns whether the filter is enabled or not.
See also setEnabled().
QString CalFilter::name() const
Returns the filter name.
See also setName().
void CalFilter::setCategoryList(const QStringList &categoryList)
Sets the list of categories to be considered when filtering incidences according to the ShowCategories criteria.
categoryList is a QStringList of categories.
See also categoryList().
void CalFilter::setCompletedTimeSpan(int timespan)
Sets the number of days for the HideCompletedTodos criteria. If a to-do has been completed within the recent timespan days, then that to-do will be removed during filtering. If a time span is not specified in the filter, then all completed to-dos will be removed if the HideCompletedTodos criteria is set.
timespan is an integer representing a time span in days.
See also completedTimeSpan().
void CalFilter::setCriteria(int criteria)
Sets the criteria which must be fulfilled for an Incidence to pass the filter.
criteria is a combination of CalFilter::Criteria.
See also criteria().
void CalFilter::setEmailList(const QStringList &emailList)
Sets the list of email addresses to be considered when filtering incidences according to the HideNoMatchingAttendeeTodos criteria.
emailList is a QStringList of email addresses.
See also emailList().
void CalFilter::setEnabled(bool enabled)
Enables or disables the filter.
enabled is true if the filter is to be enabled; false otherwise.
See also isEnabled().
void CalFilter::setName(const QString &name)
Sets the filter name.
name is the name of this filter.
See also name().
bool CalFilter::operator==(const KCalendarCore::CalFilter &filter) const
Compares this with filter for equality.
filter the CalFilter to compare.
Returns true if filter is equal to this object, or false if they are different.