26 #include "calfilter.h"
34 mCompletedTimeSpan = 0;
42 mCompletedTimeSpan = 0;
51 if ( !mEnabled )
return;
55 Event::List::Iterator it = eventlist->begin();
56 while( it != eventlist->end() ) {
58 it = eventlist->remove( it );
70 if ( !mEnabled )
return;
74 Todo::List::Iterator it = todolist->begin();
75 while( it != todolist->end() ) {
77 it = todolist->remove( it );
88 if ( !mEnabled )
return;
90 Journal::List::Iterator it = journallist->begin();
91 while( it != journallist->end() ) {
93 it = journallist->remove( it );
104 if ( !mEnabled )
return true;
106 Todo *todo =
dynamic_cast<Todo *
>(incidence);
108 if ( (mCriteria & HideCompleted) && todo->
isCompleted() ) {
110 if ( todo->
completed().addDays( mCompletedTimeSpan ) <
111 TQDateTime::currentDateTime() ) {
116 if( ( mCriteria & HideInactiveTodos ) &&
118 TQDateTime::currentDateTime() < todo->
dtStart() ||
122 if ( mCriteria & HideTodosWithoutAttendeeInEmailList ) {
123 bool iAmOneOfTheAttendees =
false;
126 Attendee::List::ConstIterator it;
127 for( it = attendees.begin(); it != attendees.end(); ++it ) {
128 if ( mEmailList.find( (*it)->email() ) != mEmailList.end() ) {
129 iAmOneOfTheAttendees =
true;
135 iAmOneOfTheAttendees =
true;
137 if ( !iAmOneOfTheAttendees )
143 if (mCriteria & HideRecurring) {
144 if (incidence->
doesRecur())
return false;
147 if (mCriteria & ShowCategories) {
148 for (TQStringList::ConstIterator it = mCategoryList.constBegin();
149 it != mCategoryList.constEnd(); ++it ) {
150 TQStringList incidenceCategories = incidence->
categories();
151 for (TQStringList::ConstIterator it2 = incidenceCategories.constBegin();
152 it2 != incidenceCategories.constEnd(); ++it2 ) {
153 if ((*it) == (*it2)) {
160 for (TQStringList::ConstIterator it = mCategoryList.constBegin();
161 it != mCategoryList.constEnd(); ++it ) {
162 TQStringList incidenceCategories = incidence->
categories();
163 for (TQStringList::ConstIterator it2 = incidenceCategories.constBegin();
164 it2 != incidenceCategories.constEnd(); ++it2 ) {
165 if ((*it) == (*it2)) {
205 return mCategoryList;
220 mCompletedTimeSpan = timespan;
225 return mCompletedTimeSpan;
TQStringList emailList() const
Return list of email addresses which are to be considered when finding incidences which the current u...
void setCompletedTimeSpan(int timespan)
Set the number of days for "Hide completed todos", after which todos are not shown any more.
TQStringList categoryList() const
Return category list, used for showing/hiding categories of events.
TQString name() const
Return name of filter.
void apply(Event::List *eventlist) const
Apply filter to eventlist, all events not matching filter criterias are removed from the list.
void setEnabled(bool)
Enable or disable filter.
void setCategoryList(const TQStringList &)
Set list of categories, which is used for showing/hiding categories of events.
int criteria() const
Get inclusive filter criteria.
bool isEnabled() const
Return wheter the filter is enabled or not.
bool filterIncidence(Incidence *) const
Apply filter criteria on the specified incidence.
void setCriteria(int)
Set criteria, which have to be fulfilled by events passing the filter.
~CalFilter()
Destruct filter.
CalFilter()
Construct filter.
void setEmailList(const TQStringList &)
Set list of email addresses which are to be considered when finding incidences which the current user...
int completedTimeSpan() const
Return the number of days for "Hide completed todos", after which todos are not shown any more.
const Attendee::List & attendees() const
Return list of attendees.
This class provides the base class common to all calendar components.
TQStringList categories() const
Return categories as a list of strings.
bool doesRecur() const
Forward to Recurrence::doesRecur().
This class provides a Todo in the sense of RFC2445.
bool isCompleted() const
Returns true if the todo is 100% completed, otherwise return false.
bool hasStartDate() const
Returns true if the todo has a start date, otherwise return false.
TQDateTime dtStart(bool first=false) const
Returns the startdate of the todo.
TQDateTime completed() const
Returns date and time when todo was completed.
Namespace KCal is for global classes, objects and/or functions in libkcal.