summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-01-16 11:22:49 (UTC)
committer zautrix <zautrix>2005-01-16 11:22:49 (UTC)
commitd57ed4438bbd6e3d9a7a0e46283d3e7645b4e47b (patch) (side-by-side diff)
tree522438ce187845f6d74d7888be203759138615fa
parent92b8de5ff678bddf69b9f0a45c1d90829c50c592 (diff)
downloadkdepimpi-d57ed4438bbd6e3d9a7a0e46283d3e7645b4e47b.zip
kdepimpi-d57ed4438bbd6e3d9a7a0e46283d3e7645b4e47b.tar.gz
kdepimpi-d57ed4438bbd6e3d9a7a0e46283d3e7645b4e47b.tar.bz2
filter impl
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--korganizer/calendarview.cpp8
-rw-r--r--korganizer/filtereditdialog.cpp7
-rw-r--r--libkcal/calfilter.cpp29
-rw-r--r--libkcal/calfilter.h3
4 files changed, 37 insertions, 10 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 8258c74..02c5e45 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1079,2 +1079,3 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
} else {
+ if ( !filterIN || filterIN->filterCalendarItem( inR ) ){
inR->setLastModified( modifiedCalendar );
@@ -1087,4 +1088,6 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
}
+ }
} else {
if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) {
+ if ( !filterIN || filterIN->filterCalendarItem( inR ) ){
inR->setLastModified( modifiedCalendar );
@@ -1094,2 +1097,3 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
++addedEvent;
+ }
} else {
@@ -1136,2 +1140,3 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
if ( ! mSyncManager->mWriteBackExistingOnly ) {
+ if ( !filterOUT || filterOUT->filterCalendarItem( inL ) ){
inL->removeID(mCurrentSyncDevice );
@@ -1146,2 +1151,3 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
}
+ }
} else {
@@ -1153,2 +1159,3 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
if ( ! mSyncManager->mWriteBackExistingOnly ) {
+ if ( !filterOUT || filterOUT->filterCalendarItem( inL ) ){
++addedEventR;
@@ -1163,2 +1170,3 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
}
+ }
inL = el.next();
diff --git a/korganizer/filtereditdialog.cpp b/korganizer/filtereditdialog.cpp
index ca09844..df84911 100644
--- a/korganizer/filtereditdialog.cpp
+++ b/korganizer/filtereditdialog.cpp
@@ -238,2 +238,6 @@ void FilterEditDialog::readFilter(CalFilter *filter)
+ mEditor->mEventCheck->setChecked(c & CalFilter::HideEvents);
+ mEditor->mTodoCheck->setChecked(c & CalFilter::HideTodos);
+ mEditor->mJournalCheck->setChecked(c & CalFilter::HideJournals);
+
if (c & CalFilter::ShowCategories) {
@@ -261,2 +265,5 @@ void FilterEditDialog::writeFilter(CalFilter *filter)
if (mEditor->mConfidentialCheck->isChecked()) c |= CalFilter::ShowConfidential;
+ if (mEditor->mEventCheck->isChecked()) c |= CalFilter::HideEvents;
+ if (mEditor->mTodoCheck->isChecked()) c |= CalFilter::HideTodos;
+ if (mEditor->mJournalCheck->isChecked()) c |= CalFilter::HideJournals;
diff --git a/libkcal/calfilter.cpp b/libkcal/calfilter.cpp
index c182db5..c425dfc 100644
--- a/libkcal/calfilter.cpp
+++ b/libkcal/calfilter.cpp
@@ -66,5 +66,2 @@ void CalFilter::apply(QPtrList<Todo> *eventlist)
if (!mEnabled) return;
-
-// kdDebug(5800) << "CalFilter::apply()" << endl;
-
Todo *event = eventlist->first();
@@ -81,7 +78,16 @@ void CalFilter::apply(QPtrList<Todo> *eventlist)
}
-
+bool CalFilter::filterCalendarItem(Incidence *in)
+{
+ if ( in->type() == "Event" )
+ return filterEvent( (Event*) in );
+ else if ( in->type() =="Todo" )
+ return filterTodo( (Todo*) in);
+ else if ( in->type() =="Journal" )
+ return filterJournal( (Journal*) in );
+ return false;
+}
bool CalFilter::filterEvent(Event *event)
{
-// kdDebug(5800) << "CalFilter::filterEvent(): " << event->getSummary() << endl;
-
+ if (mCriteria & HideEvents)
+ return false;
if (mCriteria & HideRecurring) {
@@ -92,7 +98,12 @@ bool CalFilter::filterEvent(Event *event)
}
-
+bool CalFilter::filterJournal(Journal *j)
+{
+ if (mCriteria & HideJournals)
+ return false;
+ return true;
+}
bool CalFilter::filterTodo(Todo *todo)
{
-// kdDebug(5800) << "CalFilter::filterEvent(): " << event->getSummary() << endl;
-
+ if (mCriteria & HideTodos)
+ return false;
if (mCriteria & HideCompleted) {
diff --git a/libkcal/calfilter.h b/libkcal/calfilter.h
index 5ad0064..29db441 100644
--- a/libkcal/calfilter.h
+++ b/libkcal/calfilter.h
@@ -63,3 +63,4 @@ class CalFilter {
void apply(QPtrList<Todo> *todolist);
-
+ bool CalFilter::filterCalendarItem(Incidence *in);
+ bool CalFilter::filterJournal(Journal *in);
/**