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;
void setEmailList(const TQStringList &)
Set list of email addresses which are to be considered when finding incidences which the current user...
CalFilter()
Construct filter.
This class provides a Todo in the sense of RFC2445.
TQDateTime dtStart(bool first=false) const
Returns the startdate of the todo.
TQStringList categories() const
Return categories as a list of strings.
void setCompletedTimeSpan(int timespan)
Set the number of days for "Hide completed todos", after which todos are not shown any more...
bool hasStartDate() const
Returns true if the todo has a start date, otherwise return false.
int criteria() const
Get inclusive filter criteria.
bool isCompleted() const
Returns true if the todo is 100% completed, otherwise return false.
bool doesRecur() const
Forward to Recurrence::doesRecur().
TQStringList emailList() const
Return list of email addresses which are to be considered when finding incidences which the current u...
TQStringList categoryList() const
Return category list, used for showing/hiding categories of events.
void setCategoryList(const TQStringList &)
Set list of categories, which is used for showing/hiding categories of events.
bool filterIncidence(Incidence *) const
Apply filter criteria on the specified incidence.
This class provides the base class common to all calendar components.
TQDateTime completed() const
Returns date and time when todo was completed.
~CalFilter()
Destruct filter.
void apply(Event::List *eventlist) const
Apply filter to eventlist, all events not matching filter criterias are removed from the list...
Namespace KCal is for global classes, objects and/or functions in libkcal.
bool isEnabled() const
Return wheter the filter is enabled or not.
const Attendee::List & attendees() const
Return list of attendees.
void setCriteria(int)
Set criteria, which have to be fulfilled by events passing the filter.
TQString name() const
Return name of filter.
void setEnabled(bool)
Enable or disable filter.
int completedTimeSpan() const
Return the number of days for "Hide completed todos", after which todos are not shown any more...