author | zautrix <zautrix> | 2005-01-16 11:22:49 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-16 11:22:49 (UTC) |
commit | d57ed4438bbd6e3d9a7a0e46283d3e7645b4e47b (patch) (unidiff) | |
tree | 522438ce187845f6d74d7888be203759138615fa | |
parent | 92b8de5ff678bddf69b9f0a45c1d90829c50c592 (diff) | |
download | kdepimpi-d57ed4438bbd6e3d9a7a0e46283d3e7645b4e47b.zip kdepimpi-d57ed4438bbd6e3d9a7a0e46283d3e7645b4e47b.tar.gz kdepimpi-d57ed4438bbd6e3d9a7a0e46283d3e7645b4e47b.tar.bz2 |
filter impl
-rw-r--r-- | korganizer/calendarview.cpp | 58 | ||||
-rw-r--r-- | korganizer/filtereditdialog.cpp | 7 | ||||
-rw-r--r-- | libkcal/calfilter.cpp | 29 | ||||
-rw-r--r-- | libkcal/calfilter.h | 3 |
4 files changed, 62 insertions, 35 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 8258c74..02c5e45 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1079,9 +1079,11 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1079 | } else { | 1079 | } else { |
1080 | inR->setLastModified( modifiedCalendar ); | 1080 | if ( !filterIN || filterIN->filterCalendarItem( inR ) ){ |
1081 | inL = inR->clone(); | 1081 | inR->setLastModified( modifiedCalendar ); |
1082 | inL->setIDStr( ":" ); | 1082 | inL = inR->clone(); |
1083 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1083 | inL->setIDStr( ":" ); |
1084 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); | 1084 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1085 | local->addIncidence( inL ); | 1085 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); |
1086 | ++addedEvent; | 1086 | local->addIncidence( inL ); |
1087 | ++addedEvent; | ||
1088 | } | ||
1087 | } | 1089 | } |
@@ -1089,7 +1091,9 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1089 | if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { | 1091 | if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { |
1090 | inR->setLastModified( modifiedCalendar ); | 1092 | if ( !filterIN || filterIN->filterCalendarItem( inR ) ){ |
1091 | inL = inR->clone(); | 1093 | inR->setLastModified( modifiedCalendar ); |
1092 | inL->setIDStr( ":" ); | 1094 | inL = inR->clone(); |
1093 | local->addIncidence( inL ); | 1095 | inL->setIDStr( ":" ); |
1094 | ++addedEvent; | 1096 | local->addIncidence( inL ); |
1097 | ++addedEvent; | ||
1098 | } | ||
1095 | } else { | 1099 | } else { |
@@ -1136,10 +1140,12 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1136 | if ( ! mSyncManager->mWriteBackExistingOnly ) { | 1140 | if ( ! mSyncManager->mWriteBackExistingOnly ) { |
1137 | inL->removeID(mCurrentSyncDevice ); | 1141 | if ( !filterOUT || filterOUT->filterCalendarItem( inL ) ){ |
1138 | ++addedEventR; | 1142 | inL->removeID(mCurrentSyncDevice ); |
1139 | //qDebug("remote added Incidence %s ", inL->summary().latin1()); | 1143 | ++addedEventR; |
1140 | inL->setLastModified( modifiedCalendar ); | 1144 | //qDebug("remote added Incidence %s ", inL->summary().latin1()); |
1141 | inR = inL->clone(); | 1145 | inL->setLastModified( modifiedCalendar ); |
1142 | inR->setIDStr( ":" ); | 1146 | inR = inL->clone(); |
1143 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 1147 | inR->setIDStr( ":" ); |
1144 | remote->addIncidence( inR ); | 1148 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
1149 | remote->addIncidence( inR ); | ||
1150 | } | ||
1145 | } | 1151 | } |
@@ -1153,7 +1159,9 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1153 | if ( ! mSyncManager->mWriteBackExistingOnly ) { | 1159 | if ( ! mSyncManager->mWriteBackExistingOnly ) { |
1154 | ++addedEventR; | 1160 | if ( !filterOUT || filterOUT->filterCalendarItem( inL ) ){ |
1155 | inL->setLastModified( modifiedCalendar ); | 1161 | ++addedEventR; |
1156 | inR = inL->clone(); | 1162 | inL->setLastModified( modifiedCalendar ); |
1157 | inR->setIDStr( ":" ); | 1163 | inR = inL->clone(); |
1158 | remote->addIncidence( inR ); | 1164 | inR->setIDStr( ":" ); |
1165 | remote->addIncidence( inR ); | ||
1166 | } | ||
1159 | } | 1167 | } |
diff --git a/korganizer/filtereditdialog.cpp b/korganizer/filtereditdialog.cpp index ca09844..df84911 100644 --- a/korganizer/filtereditdialog.cpp +++ b/korganizer/filtereditdialog.cpp | |||
@@ -237,2 +237,6 @@ void FilterEditDialog::readFilter(CalFilter *filter) | |||
237 | mEditor->mConfidentialCheck->setChecked(c & CalFilter::ShowConfidential); | 237 | mEditor->mConfidentialCheck->setChecked(c & CalFilter::ShowConfidential); |
238 | |||
239 | mEditor->mEventCheck->setChecked(c & CalFilter::HideEvents); | ||
240 | mEditor->mTodoCheck->setChecked(c & CalFilter::HideTodos); | ||
241 | mEditor->mJournalCheck->setChecked(c & CalFilter::HideJournals); | ||
238 | 242 | ||
@@ -261,2 +265,5 @@ void FilterEditDialog::writeFilter(CalFilter *filter) | |||
261 | if (mEditor->mConfidentialCheck->isChecked()) c |= CalFilter::ShowConfidential; | 265 | if (mEditor->mConfidentialCheck->isChecked()) c |= CalFilter::ShowConfidential; |
266 | if (mEditor->mEventCheck->isChecked()) c |= CalFilter::HideEvents; | ||
267 | if (mEditor->mTodoCheck->isChecked()) c |= CalFilter::HideTodos; | ||
268 | if (mEditor->mJournalCheck->isChecked()) c |= CalFilter::HideJournals; | ||
262 | 269 | ||
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) | |||
66 | if (!mEnabled) return; | 66 | if (!mEnabled) return; |
67 | |||
68 | // kdDebug(5800) << "CalFilter::apply()" << endl; | ||
69 | |||
70 | Todo *event = eventlist->first(); | 67 | Todo *event = eventlist->first(); |
@@ -81,7 +78,16 @@ void CalFilter::apply(QPtrList<Todo> *eventlist) | |||
81 | } | 78 | } |
82 | 79 | bool CalFilter::filterCalendarItem(Incidence *in) | |
80 | { | ||
81 | if ( in->type() == "Event" ) | ||
82 | return filterEvent( (Event*) in ); | ||
83 | else if ( in->type() =="Todo" ) | ||
84 | return filterTodo( (Todo*) in); | ||
85 | else if ( in->type() =="Journal" ) | ||
86 | return filterJournal( (Journal*) in ); | ||
87 | return false; | ||
88 | } | ||
83 | bool CalFilter::filterEvent(Event *event) | 89 | bool CalFilter::filterEvent(Event *event) |
84 | { | 90 | { |
85 | // kdDebug(5800) << "CalFilter::filterEvent(): " << event->getSummary() << endl; | 91 | if (mCriteria & HideEvents) |
86 | 92 | return false; | |
87 | if (mCriteria & HideRecurring) { | 93 | if (mCriteria & HideRecurring) { |
@@ -92,7 +98,12 @@ bool CalFilter::filterEvent(Event *event) | |||
92 | } | 98 | } |
93 | 99 | bool CalFilter::filterJournal(Journal *j) | |
100 | { | ||
101 | if (mCriteria & HideJournals) | ||
102 | return false; | ||
103 | return true; | ||
104 | } | ||
94 | bool CalFilter::filterTodo(Todo *todo) | 105 | bool CalFilter::filterTodo(Todo *todo) |
95 | { | 106 | { |
96 | // kdDebug(5800) << "CalFilter::filterEvent(): " << event->getSummary() << endl; | 107 | if (mCriteria & HideTodos) |
97 | 108 | return false; | |
98 | if (mCriteria & HideCompleted) { | 109 | 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 { | |||
63 | void apply(QPtrList<Todo> *todolist); | 63 | void apply(QPtrList<Todo> *todolist); |
64 | 64 | bool CalFilter::filterCalendarItem(Incidence *in); | |
65 | bool CalFilter::filterJournal(Journal *in); | ||
65 | /** | 66 | /** |