summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp58
-rw-r--r--korganizer/filtereditdialog.cpp7
-rw-r--r--libkcal/calfilter.cpp29
-rw-r--r--libkcal/calfilter.h3
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
@@ -984,271 +984,279 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
else
mLastCalendarSync = eventLSync->dtStart();
// for resyncing if own file has changed
if ( mCurrentSyncDevice == "deleteaftersync" ) {
mLastCalendarSync = loadedFileVersion;
//qDebug("setting mLastCalendarSync ");
}
//qDebug("*************************** ");
qDebug("mLastCalendarSync %s full: %d",mLastCalendarSync.toString().latin1(), fullDateRange);
QPtrList<Incidence> er = remote->rawIncidences();
Incidence* inR = er.first();
Incidence* inL;
QProgressBar bar( er.count(),0 );
bar.setCaption (i18n("Syncing - close to abort!") );
// ************** setting up filter *************
CalFilter *filterIN = 0;
CalFilter *filterOUT = 0;
CalFilter *filter = mFilters.first();
while(filter) {
if ( filter->name() == mSyncManager->mFilterInCal )
filterIN = filter;
if ( filter->name() == mSyncManager->mFilterOutCal )
filterOUT = filter;
filter = mFilters.next();
}
int w = 300;
if ( QApplication::desktop()->width() < 320 )
w = 220;
int h = bar.sizeHint().height() ;
int dw = QApplication::desktop()->width();
int dh = QApplication::desktop()->height();
bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
bar.show();
int modulo = (er.count()/10)+1;
int incCounter = 0;
while ( inR ) {
if ( ! bar.isVisible() )
return false;
if ( incCounter % modulo == 0 )
bar.setProgress( incCounter );
++incCounter;
uid = inR->uid();
bool skipIncidence = false;
if ( uid.left(15) == QString("last-syncEvent-") )
skipIncidence = true;
QString idS;
qApp->processEvents();
if ( !skipIncidence ) {
inL = local->incidence( uid );
if ( inL ) { // maybe conflict - same uid in both calendars
if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) {
//qDebug("take %d %s ", take, inL->summary().latin1());
if ( take == 3 )
return false;
if ( take == 1 ) {// take local **********************
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL )
inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
else
idS = inR->IDStr();
remote->deleteIncidence( inR );
inR = inL->clone();
inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL )
inR->setIDStr( idS );
remote->addIncidence( inR );
if ( mSyncManager->syncWithDesktop() )
inR->setPilotId( 2 );
++changedRemote;
} else {// take remote **********************
idS = inL->IDStr();
int pid = inL->pilotId();
local->deleteIncidence( inL );
inL = inR->clone();
if ( mSyncManager->syncWithDesktop() )
inL->setPilotId( pid );
inL->setIDStr( idS );
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) );
}
local->addIncidence( inL );
++changedLocal;
}
}
} else { // no conflict ********** add or delete remote
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
QString des = eventLSync->description();
QString pref = "e";
if ( inR->type() == "Todo" )
pref = "t";
if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it
inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE );
//remote->deleteIncidence( inR );
++deletedEventR;
} else {
- inR->setLastModified( modifiedCalendar );
- inL = inR->clone();
- inL->setIDStr( ":" );
- inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
- inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) );
- local->addIncidence( inL );
- ++addedEvent;
+ if ( !filterIN || filterIN->filterCalendarItem( inR ) ){
+ inR->setLastModified( modifiedCalendar );
+ inL = inR->clone();
+ inL->setIDStr( ":" );
+ inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
+ inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) );
+ local->addIncidence( inL );
+ ++addedEvent;
+ }
}
} else {
if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) {
- inR->setLastModified( modifiedCalendar );
- inL = inR->clone();
- inL->setIDStr( ":" );
- local->addIncidence( inL );
- ++addedEvent;
+ if ( !filterIN || filterIN->filterCalendarItem( inR ) ){
+ inR->setLastModified( modifiedCalendar );
+ inL = inR->clone();
+ inL->setIDStr( ":" );
+ local->addIncidence( inL );
+ ++addedEvent;
+ }
} else {
checkExternSyncEvent(eventRSyncSharp, inR);
remote->deleteIncidence( inR );
++deletedEventR;
}
}
}
}
inR = er.next();
}
QPtrList<Incidence> el = local->rawIncidences();
inL = el.first();
modulo = (el.count()/10)+1;
bar.setCaption (i18n("Add / remove events") );
bar.setTotalSteps ( el.count() ) ;
bar.show();
incCounter = 0;
while ( inL ) {
qApp->processEvents();
if ( ! bar.isVisible() )
return false;
if ( incCounter % modulo == 0 )
bar.setProgress( incCounter );
++incCounter;
uid = inL->uid();
bool skipIncidence = false;
if ( uid.left(15) == QString("last-syncEvent-") )
skipIncidence = true;
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" )
skipIncidence = true;
if ( !skipIncidence ) {
inR = remote->incidence( uid );
if ( ! inR ) { // no conflict ********** add or delete local
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) {
checkExternSyncEvent(eventLSyncSharp, inL);
local->deleteIncidence( inL );
++deletedEventL;
} else {
if ( ! mSyncManager->mWriteBackExistingOnly ) {
- inL->removeID(mCurrentSyncDevice );
- ++addedEventR;
- //qDebug("remote added Incidence %s ", inL->summary().latin1());
- inL->setLastModified( modifiedCalendar );
- inR = inL->clone();
- inR->setIDStr( ":" );
- inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
- remote->addIncidence( inR );
+ if ( !filterOUT || filterOUT->filterCalendarItem( inL ) ){
+ inL->removeID(mCurrentSyncDevice );
+ ++addedEventR;
+ //qDebug("remote added Incidence %s ", inL->summary().latin1());
+ inL->setLastModified( modifiedCalendar );
+ inR = inL->clone();
+ inR->setIDStr( ":" );
+ inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
+ remote->addIncidence( inR );
+ }
}
}
} else {
if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) {
checkExternSyncEvent(eventLSyncSharp, inL);
local->deleteIncidence( inL );
++deletedEventL;
} else {
if ( ! mSyncManager->mWriteBackExistingOnly ) {
- ++addedEventR;
- inL->setLastModified( modifiedCalendar );
- inR = inL->clone();
- inR->setIDStr( ":" );
- remote->addIncidence( inR );
+ if ( !filterOUT || filterOUT->filterCalendarItem( inL ) ){
+ ++addedEventR;
+ inL->setLastModified( modifiedCalendar );
+ inR = inL->clone();
+ inR->setIDStr( ":" );
+ remote->addIncidence( inR );
+ }
}
}
}
}
}
inL = el.next();
}
int delFut = 0;
int remRem = 0;
if ( mSyncManager->mWriteBackInFuture ) {
er = remote->rawIncidences();
remRem = er.count();
inR = er.first();
QDateTime dt;
QDateTime cur = QDateTime::currentDateTime().addDays( -(mSyncManager->mWriteBackInPast * 7) );
QDateTime end = QDateTime::currentDateTime().addDays( (mSyncManager->mWriteBackInFuture ) *7 );
while ( inR ) {
if ( inR->type() == "Todo" ) {
Todo * t = (Todo*)inR;
if ( t->hasDueDate() )
dt = t->dtDue();
else
dt = cur.addSecs( 62 );
}
else if (inR->type() == "Event" ) {
bool ok;
dt = inR->getNextOccurence( cur, &ok );
if ( !ok )
dt = cur.addSecs( -62 );
}
else
dt = inR->dtStart();
if ( dt < cur || dt > end ) {
remote->deleteIncidence( inR );
++delFut;
}
inR = er.next();
}
}
bar.hide();
mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 );
eventLSync->setReadOnly( false );
eventLSync->setDtStart( mLastCalendarSync );
eventRSync->setDtStart( mLastCalendarSync );
eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ;
eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName );
eventLSync->setReadOnly( true );
qDebug("********** %d %d ", mGlobalSyncMode == SYNC_MODE_NORMAL, mSyncManager->syncWithDesktop() );
if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal...
remote->addEvent( eventRSync );
else
delete eventRSync;
QString mes;
mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR );
QString delmess;
if ( delFut ) {
delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are more\nthan %d weeks in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInPast,mSyncManager->mWriteBackInFuture, remRem-delFut);
mes += delmess;
}
mes = i18n("Local calendar changed!\n") +mes;
mCalendar->checkAlarmForIncidence( 0, true );
qDebug( mes );
if ( mSyncManager->mShowSyncSummary ) {
if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes,
i18n("KO/Pi Synchronization"),i18n("Write back"))) {
qDebug("cancelled ");
return false;
}
}
return syncOK;
}
void CalendarView::setSyncDevice( QString s )
{
mCurrentSyncDevice= s;
}
void CalendarView::setSyncName( QString s )
{
mCurrentSyncName= s;
}
bool CalendarView::syncCalendar(QString filename, int mode)
{
//qDebug("syncCalendar %s ", filename.latin1());
mGlobalSyncMode = SYNC_MODE_NORMAL;
CalendarLocal* calendar = new CalendarLocal();
calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
FileStorage* storage = new FileStorage( calendar );
bool syncOK = false;
storage->setFileName( filename );
// qDebug("loading ... ");
if ( storage->load() ) {
getEventViewerDialog()->setSyncMode( true );
syncOK = synchronizeCalendar( mCalendar, calendar, mode );
getEventViewerDialog()->setSyncMode( false );
diff --git a/korganizer/filtereditdialog.cpp b/korganizer/filtereditdialog.cpp
index ca09844..df84911 100644
--- a/korganizer/filtereditdialog.cpp
+++ b/korganizer/filtereditdialog.cpp
@@ -142,129 +142,136 @@ void FilterEditDialog::updateFilterList()
mRemoveButton->setEnabled( mFilters->count() > 1 );
}
void FilterEditDialog::slotDefault()
{
}
void FilterEditDialog::slotApply()
{
CalFilter *f = mFilters->at(mSelectionCombo->currentItem());
writeFilter(f);
emit filterChanged();
}
void FilterEditDialog::accept()
{
slotOk();
}
void FilterEditDialog::slotOk()
{
CalFilter *f = mFilters->at(mSelectionCombo->currentItem());
writeFilter(f);
emit filterChanged();
QDialog::accept();
}
void FilterEditDialog::slotAdd()
{
KLineEditDlg dlg(i18n("Enter filter name:"), "New Filter", this);
dlg.setCaption(i18n("Add Filter"));
if (dlg.exec()) {
if ( dlg.text().length() > 0 ) {
mFilters->append(new CalFilter(dlg.text()));
updateFilterList();
int num = mSelectionCombo->count() -1 ;
mSelectionCombo->setCurrentItem( num );
readFilter(mFilters->at( num ) );
}
}
}
void FilterEditDialog::slotRemove()
{
int currentItem = mSelectionCombo->currentItem();
if ( currentItem < 0 ) return;
// We need at least a default filter object.
if ( mFilters->count() <= 1 ) return;
int result = KMessageBox::questionYesNo( this,
i18n("This item will be\npermanently deleted.") );
if ( result != KMessageBox::Yes ) {
return;
}
mFilters->remove( currentItem );
updateFilterList();
emit filterChanged();
}
void FilterEditDialog::editCategorySelection()
{
KPIM::CategorySelectDialog *dlg = new KPIM::CategorySelectDialog(
KOPrefs::instance(), this, "filterCatSelect", true );
dlg->setSelected(mCategories);
connect(dlg,SIGNAL(categoriesSelected(const QStringList &)),
SLOT(updateCategorySelection(const QStringList &)));
dlg->exec();
}
void FilterEditDialog::updateCategorySelection(const QStringList &categories)
{
mCategories = categories;
mEditor->mCatList->clear();
mEditor->mCatList->insertStringList(mCategories);
}
void FilterEditDialog::filterSelected()
{
CalFilter *f = mFilters->at(mSelectionCombo->currentItem());
if (f) readFilter(f);
}
void FilterEditDialog::readFilter(CalFilter *filter)
{
int c = filter->criteria();
mEditor->mCompletedCheck->setChecked(c & CalFilter::HideCompleted);
mEditor->mRecurringCheck->setChecked(c & CalFilter::HideRecurring);
mEditor->mPublicCheck->setChecked(c & CalFilter::ShowPublic);
mEditor->mPrivateCheck->setChecked(c & CalFilter::ShowPrivate);
mEditor->mConfidentialCheck->setChecked(c & CalFilter::ShowConfidential);
+
+ mEditor->mEventCheck->setChecked(c & CalFilter::HideEvents);
+ mEditor->mTodoCheck->setChecked(c & CalFilter::HideTodos);
+ mEditor->mJournalCheck->setChecked(c & CalFilter::HideJournals);
if (c & CalFilter::ShowCategories) {
mEditor->mCatShowCheck->setChecked(true);
} else {
mEditor->mCatHideCheck->setChecked(true);
}
mEditor->mCatList->clear();
mEditor->mCatList->insertStringList(filter->categoryList());
mCategories = filter->categoryList();
setCaption( i18n("Filter position: ") + QString::number ( mSelectionCombo->currentItem()+1 ));
}
void FilterEditDialog::writeFilter(CalFilter *filter)
{
int c = 0;
if (mEditor->mCompletedCheck->isChecked()) c |= CalFilter::HideCompleted;
if (mEditor->mRecurringCheck->isChecked()) c |= CalFilter::HideRecurring;
if (mEditor->mCatShowCheck->isChecked()) c |= CalFilter::ShowCategories;
if (mEditor->mPublicCheck->isChecked()) c |= CalFilter::ShowPublic;
if (mEditor->mPrivateCheck->isChecked()) c |= CalFilter::ShowPrivate;
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;
filter->setCriteria(c);
QStringList categoryList;
for(uint i=0;i<mEditor->mCatList->count();++i) {
categoryList.append(mEditor->mCatList->text(i));
}
filter->setCategoryList(categoryList);
}
diff --git a/libkcal/calfilter.cpp b/libkcal/calfilter.cpp
index c182db5..c425dfc 100644
--- a/libkcal/calfilter.cpp
+++ b/libkcal/calfilter.cpp
@@ -1,193 +1,204 @@
/*
This file is part of libkcal.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <kdebug.h>
#include "calfilter.h"
using namespace KCal;
CalFilter::CalFilter()
{
mEnabled = true;
mCriteria = ShowPublic | ShowPrivate| ShowConfidential ;
}
CalFilter::CalFilter(const QString &name)
{
mName = name;
mEnabled = true;
mCriteria = ShowPublic | ShowPrivate| ShowConfidential ;
}
CalFilter::~CalFilter()
{
}
void CalFilter::apply(QPtrList<Event> *eventlist)
{
if (!mEnabled) return;
// kdDebug(5800) << "CalFilter::apply()" << endl;
Event *event = eventlist->first();
while(event) {
if (!filterEvent(event)) {
eventlist->remove();
event = eventlist->current();
} else {
event = eventlist->next();
}
}
// kdDebug(5800) << "CalFilter::apply() done" << endl;
}
// TODO: avoid duplicating apply() code
void CalFilter::apply(QPtrList<Todo> *eventlist)
{
if (!mEnabled) return;
-
-// kdDebug(5800) << "CalFilter::apply()" << endl;
-
Todo *event = eventlist->first();
while(event) {
if (!filterTodo(event)) {
eventlist->remove();
event = eventlist->current();
} else {
event = eventlist->next();
}
}
// kdDebug(5800) << "CalFilter::apply() done" << endl;
}
-
+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) {
if (event->recurrence()->doesRecur()) return false;
}
return filterIncidence(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) {
if (todo->isCompleted()) return false;
}
return filterIncidence(todo);
}
bool CalFilter::showCategories()
{
return mCriteria & ShowCategories;
}
int CalFilter::getSecrecy()
{
if ( (mCriteria & ShowPublic ))
return Incidence::SecrecyPublic;
if ( (mCriteria & ShowPrivate ))
return Incidence::SecrecyPrivate;
if ( (mCriteria & ShowConfidential ))
return Incidence::SecrecyConfidential;
return Incidence::SecrecyPublic;
}
bool CalFilter::filterIncidence(Incidence *incidence)
{
if ( mCriteria > 7 ) {
switch (incidence->secrecy()) {
case Incidence::SecrecyPublic:
if (! (mCriteria & ShowPublic ))
return false;
break;
case Incidence::SecrecyPrivate:
if (! (mCriteria & ShowPrivate ))
return false;
break;
case Incidence::SecrecyConfidential:
if (! (mCriteria & ShowConfidential ))
return false;
break;
default:
return false;
break;
}
}
// kdDebug(5800) << "CalFilter::filterEvent(): " << event->getSummary() << endl;
if (mCriteria & ShowCategories) {
for (QStringList::Iterator it = mCategoryList.begin();
it != mCategoryList.end(); ++it ) {
QStringList incidenceCategories = incidence->categories();
for (QStringList::Iterator it2 = incidenceCategories.begin();
it2 != incidenceCategories.end(); ++it2 ) {
if ((*it) == (*it2)) {
return true;
}
}
}
return false;
} else {
for (QStringList::Iterator it = mCategoryList.begin();
it != mCategoryList.end(); ++it ) {
QStringList incidenceCategories = incidence->categories();
for (QStringList::Iterator it2 = incidenceCategories.begin();
it2 != incidenceCategories.end(); ++it2 ) {
if ((*it) == (*it2)) {
return false;
}
}
}
return true;
}
// kdDebug(5800) << "CalFilter::filterEvent(): passed" << endl;
return true;
}
void CalFilter::setEnabled(bool enabled)
{
mEnabled = enabled;
}
bool CalFilter::isEnabled()
{
return mEnabled;
}
void CalFilter::setCriteria(int criteria)
{
mCriteria = criteria;
}
int CalFilter::criteria()
{
return mCriteria;
}
void CalFilter::setCategoryList(const QStringList &categoryList)
diff --git a/libkcal/calfilter.h b/libkcal/calfilter.h
index 5ad0064..29db441 100644
--- a/libkcal/calfilter.h
+++ b/libkcal/calfilter.h
@@ -1,128 +1,129 @@
/*
This file is part of libkcal.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef _CALFILTER_H
#define _CALFILTER_H
#include <qstring.h>
#include <qptrlist.h>
#include "event.h"
#include "todo.h"
namespace KCal {
/**
Filter for calendar objects.
*/
class CalFilter {
public:
/** Construct filter. */
CalFilter();
/** Construct filter with name */
CalFilter(const QString &name);
/** Destruct filter. */
~CalFilter();
/**
Set name of filter.
*/
void setName(const QString &name) { mName = name; }
/**
Return name of filter.
*/
QString name() const { return mName; }
/**
Apply filter to eventlist, all events not matching filter criterias are
removed from the list.
*/
void apply(QPtrList<Event> *eventlist);
/**
Apply filter to todolist, all todos not matching filter criterias are
removed from the list.
*/
void apply(QPtrList<Todo> *todolist);
-
+ bool CalFilter::filterCalendarItem(Incidence *in);
+ bool CalFilter::filterJournal(Journal *in);
/**
Apply filter criteria on the specified event. Return true, if event passes
criteria, otherwise return false.
*/
bool filterEvent(Event *);
/**
Apply filter criteria on the specified todo. Return true, if event passes
criteria, otherwise return false.
*/
bool filterTodo(Todo *);
/**
Apply filter criteria on the specified incidence. Return true, if event passes
criteria, otherwise return false.
*/
bool filterIncidence(Incidence *);
/**
Enable or disable filter.
*/
void setEnabled(bool);
/**
Return wheter the filter is enabled or not.
*/
bool isEnabled();
bool showCategories();
int getSecrecy();
/**
Set list of categories, which is used for showing/hiding categories of
events.
See related functions.
*/
void setCategoryList(const QStringList &);
/**
Return category list, used for showing/hiding categories of events.
See related functions.
*/
QStringList categoryList();
enum { HideRecurring = 1, HideCompleted = 2, ShowCategories = 4 ,ShowPublic = 8, ShowPrivate = 16, ShowConfidential = 32, HideEvents = 64, HideTodos = 128, HideJournals = 256 };
/**
Set criteria, which have to be fulfilled by events passing the filter.
*/
void setCriteria(int);
/**
Get inclusive filter criteria.
*/
int criteria();
private:
QString mName;
int mCriteria;
bool mEnabled;
QStringList mCategoryList;
};
}
#endif /* _CALFILTER_H */