summaryrefslogtreecommitdiffabout
path: root/libkcal
Side-by-side diff
Diffstat (limited to 'libkcal') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/calendar.h2
-rw-r--r--libkcal/calendarlocal.cpp26
-rw-r--r--libkcal/calendarlocal.h1
3 files changed, 28 insertions, 1 deletions
diff --git a/libkcal/calendar.h b/libkcal/calendar.h
index 3f6895d..4b8b3ff 100644
--- a/libkcal/calendar.h
+++ b/libkcal/calendar.h
@@ -130,251 +130,253 @@ public:
void setTimeZoneId( const QString & );
/**
Return time zone id.
*/
QString timeZoneId() const;
/**
Use local time, not UTC or a time zone.
*/
void setLocalTime();
/**
Return whether local time is being used.
*/
bool isLocalTime() const;
/**
Add an incidence to calendar.
@return true on success, false on error.
*/
virtual bool addIncidence( Incidence * );
// Adds an incidence and all relatedto incidences to the cal
void addIncidenceBranch( Incidence * );
/**
Return filtered list of all incidences of this calendar.
*/
virtual QPtrList<Incidence> incidences();
/**
Return unfiltered list of all incidences of this calendar.
*/
virtual QPtrList<Incidence> rawIncidences();
/**
Adds a Event to this calendar object.
@param anEvent a pointer to the event to add
@return true on success, false on error.
*/
virtual bool addEventNoDup( Event *event ) = 0;
virtual bool addAnniversaryNoDup( Event *event ) = 0;
virtual bool addEvent( Event *anEvent ) = 0;
/**
Delete event from calendar.
*/
virtual void deleteEvent( Event * ) = 0;
/**
Retrieves an event on the basis of the unique string ID.
*/
virtual Event *event( const QString &UniqueStr ) = 0;
virtual Event *event( QString, QString ) = 0;
/**
Builds and then returns a list of all events that match for the
date specified. useful for dayView, etc. etc.
The calendar filter is applied.
*/
QPtrList<Event> events( const QDate &date, bool sorted = false);
/**
Get events, which occur on the given date.
The calendar filter is applied.
*/
QPtrList<Event> events( const QDateTime &qdt );
/**
Get events in a range of dates. If inclusive is set to true, only events
are returned, which are completely included in the range.
The calendar filter is applied.
*/
QPtrList<Event> events( const QDate &start, const QDate &end,
bool inclusive = false);
/**
Return filtered list of all events in calendar.
*/
virtual QPtrList<Event> events();
/**
Return unfiltered list of all events in calendar.
*/
virtual QPtrList<Event> rawEvents() = 0;
/**
Add a todo to the todolist.
@return true on success, false on error.
*/
virtual bool addTodo( Todo *todo ) = 0;
virtual bool addTodoNoDup( Todo *todo ) = 0;
/**
Remove a todo from the todolist.
*/
virtual void deleteTodo( Todo * ) = 0;
virtual void deleteJournal( Journal * ) = 0;
/**
Return filterd list of todos.
*/
virtual QPtrList<Todo> todos();
/**
Searches todolist for an event with this unique string identifier,
returns a pointer or null.
*/
virtual Todo *todo( const QString &uid ) = 0;
virtual Todo *todo( QString, QString ) = 0;
/**
Returns list of todos due on the specified date.
*/
virtual QPtrList<Todo> todos( const QDate &date ) = 0;
/**
Return unfiltered list of todos.
*/
virtual QPtrList<Todo> rawTodos() = 0;
/**
Add a Journal entry to calendar.
@return true on success, false on error.
*/
virtual bool addJournal( Journal * ) = 0;
/**
Return Journal for given date.
*/
virtual Journal *journal( const QDate & ) = 0;
virtual QPtrList<Journal> journals4Date( const QDate & ) = 0;
/**
Return Journal with given UID.
*/
virtual Journal *journal( const QString &UID ) = 0;
/**
Return list of all Journal entries.
*/
virtual QPtrList<Journal> journals() = 0;
/**
Searches all incidence types for an incidence with this unique
string identifier, returns a pointer or null.
*/
Incidence* incidence( const QString&UID );
/**
Setup relations for an incidence.
*/
virtual void setupRelations( Incidence * );
/**
Remove all relations to an incidence
*/
virtual void removeRelations( Incidence * );
/**
Set calendar filter, which filters events for the events() functions.
The Filter object is owned by the caller.
*/
void setFilter( CalFilter * );
/**
Return calendar filter.
*/
CalFilter *filter();
virtual QDateTime nextAlarm( int daysTo ) = 0;
virtual QString nextSummary( ) const = 0;
virtual void reInitAlarmSettings() = 0;
virtual QDateTime nextAlarmEventDateTime() const = 0;
virtual void checkAlarmForIncidence( Incidence *, bool ) = 0;
/**
Return all alarms, which ocur in the given time interval.
*/
virtual Alarm::List alarms( const QDateTime &from,
const QDateTime &to ) = 0;
class Observer {
public:
virtual void calendarModified( bool, Calendar * ) = 0;
};
void registerObserver( Observer * );
void setModified( bool );
/**
Set product id returned by loadedProductId(). This function is only
useful for the calendar loading code.
*/
void setLoadedProductId( const QString & );
/**
Return product id taken from file that has been loaded. Returns
QString::null, if no calendar has been loaded.
*/
QString loadedProductId();
int defaultCalendar();
void setDontDeleteIncidencesOnClose ();
public slots:
void setDefaultCalendar( int );
virtual void setCalendarEnabled( int id, bool enable ) = 0;
virtual void setAlarmEnabled( int id, bool enable ) = 0;
virtual void setReadOnly( int id, bool enable ) = 0;
virtual void setDefaultCalendarEnabledOnly() = 0;
virtual void setCalendarRemove( int id ) = 0;
+ virtual void getIncidenceCount( int calId, int& events, int & todos, int & journals) = 0;
+
signals:
void calendarChanged();
void calendarSaved();
void calendarLoaded();
void addAlarm(const QDateTime &qdt, const QString &noti );
void removeAlarm(const QDateTime &qdt, const QString &noti );
protected:
/**
Get unfiltered events, which occur on the given date.
*/
virtual QPtrList<Event> rawEventsForDate( const QDateTime &qdt ) = 0;
/**
Get unfiltered events, which occur on the given date.
*/
virtual QPtrList<Event> rawEventsForDate( const QDate &date,
bool sorted = false ) = 0;
/**
Get events in a range of dates. If inclusive is set to true, only events
are returned, which are completely included in the range.
*/
virtual QPtrList<Event> rawEvents( const QDate &start, const QDate &end,
bool inclusive = false ) = 0;
Incidence *mNextAlarmIncidence;
Incidence *mUndoIncidence;
int mDefaultCalendar;
bool mDeleteIncidencesOnClose;
private:
void init();
QString mOwner; // who the calendar belongs to
QString mOwnerEmail; // email address of the owner
int mTimeZone; // timezone OFFSET from GMT (MINUTES)
bool mLocalTime; // use local time, not UTC or a time zone
CalFilter *mFilter;
CalFilter *mDefaultFilter;
QString mTimeZoneId;
Observer *mObserver;
bool mNewObserver;
bool mModified;
QString mLoadedProductId;
// This list is used to put together related todos
QDict<Incidence> mOrphans;
QDict<Incidence> mOrphanUids;
};
}
#endif
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index 1a1c6be..0ddfeca 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -263,399 +263,423 @@ void CalendarLocal::close()
mJournalList.clear();
mEventList.setAutoDelete( false );
mTodoList.setAutoDelete( false );
mJournalList.setAutoDelete( false );
setModified( false );
}
bool CalendarLocal::addAnniversaryNoDup( Event *event )
{
QString cat;
bool isBirthday = true;
if( event->categoriesStr() == i18n( "Anniversary" ) ) {
isBirthday = false;
cat = i18n( "Anniversary" );
} else if( event->categoriesStr() == i18n( "Birthday" ) ) {
isBirthday = true;
cat = i18n( "Birthday" );
} else {
qDebug("addAnniversaryNoDup called without fitting category! ");
return false;
}
Event * eve;
for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) {
if ( !(eve->categories().contains( cat ) ))
continue;
// now we have an event with fitting category
if ( eve->dtStart().date() != event->dtStart().date() )
continue;
// now we have an event with fitting category+date
if ( eve->summary() != event->summary() )
continue;
// now we have an event with fitting category+date+summary
return false;
}
return addEvent( event );
}
bool CalendarLocal::addEventNoDup( Event *event )
{
Event * eve;
for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) {
if ( *eve == *event ) {
//qDebug("CalendarLocal::Duplicate event found! Not inserted! ");
return false;
}
}
return addEvent( event );
}
bool CalendarLocal::addEvent( Event *event )
{
insertEvent( event );
event->registerObserver( this );
setModified( true );
if ( event->calID() == 0 )
event->setCalID( mDefaultCalendar );
event->setCalEnabled( true );
return true;
}
void CalendarLocal::deleteEvent( Event *event )
{
clearUndo(event);
if ( mEventList.removeRef( event ) ) {
setModified( true );
}
}
Event *CalendarLocal::event( const QString &uid )
{
Event *event;
Event *retVal = 0;
for ( event = mEventList.first(); event; event = mEventList.next() ) {
if ( event->calEnabled() && event->uid() == uid ) {
if ( retVal ) {
if ( retVal->calID() > event->calID() ) {
retVal = event;
}
} else {
retVal = event;
}
}
}
return retVal;
}
bool CalendarLocal::addTodoNoDup( Todo *todo )
{
Todo * eve;
for ( eve = mTodoList.first(); eve ; eve = mTodoList.next() ) {
if ( *eve == *todo ) {
//qDebug("duplicate todo found! not inserted! ");
return false;
}
}
return addTodo( todo );
}
bool CalendarLocal::addTodo( Todo *todo )
{
mTodoList.append( todo );
todo->registerObserver( this );
// Set up subtask relations
setupRelations( todo );
setModified( true );
if ( todo->calID() == 0 )
todo->setCalID( mDefaultCalendar );
todo->setCalEnabled( true );
return true;
}
void CalendarLocal::deleteTodo( Todo *todo )
{
// Handle orphaned children
removeRelations( todo );
clearUndo(todo);
if ( mTodoList.removeRef( todo ) ) {
setModified( true );
}
}
QPtrList<Todo> CalendarLocal::rawTodos()
{
QPtrList<Todo> el;
for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() )
if ( it->calEnabled() ) el.append( it );
return el;
}
Todo *CalendarLocal::todo( QString syncProf, QString id )
{
Todo *todo;
for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) {
if ( todo->calEnabled() && todo->getID( syncProf ) == id ) return todo;
}
return 0;
}
void CalendarLocal::removeSyncInfo( QString syncProfile)
{
QPtrList<Incidence> all = rawIncidences() ;
Incidence *inc;
for ( inc = all.first(); inc; inc = all.next() ) {
inc->removeID( syncProfile );
}
if ( syncProfile.isEmpty() ) {
QPtrList<Event> el;
Event *todo;
for ( todo = mEventList.first(); todo; todo = mEventList.next() ) {
if ( todo->uid().left( 15 ) == QString("last-syncEvent-") )
el.append( todo );
}
for ( todo = el.first(); todo; todo = el.next() ) {
deleteIncidence ( todo );
}
} else {
Event *lse = event( "last-syncEvent-"+ syncProfile);
if ( lse )
deleteIncidence ( lse );
}
}
QPtrList<Event> CalendarLocal::getExternLastSyncEvents()
{
QPtrList<Event> el;
Event *todo;
for ( todo = mEventList.first(); todo; todo = mEventList.next() ) {
if ( todo->uid().left( 15 ) == QString("last-syncEvent-") )
if ( todo->summary().left(3) == "E: " )
el.append( todo );
}
return el;
}
Event *CalendarLocal::event( QString syncProf, QString id )
{
Event *todo;
for ( todo = mEventList.first(); todo; todo = mEventList.next() ) {
if ( todo->calEnabled() && todo->getID( syncProf ) == id ) return todo;
}
return 0;
}
Todo *CalendarLocal::todo( const QString &uid )
{
- Todo *todo;;
+ Todo *todo;
Todo *retVal = 0;
for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) {
if ( todo->calEnabled() && todo->uid() == uid ) {
if ( retVal ) {
if ( retVal->calID() > todo->calID() ) {
retVal = todo;
}
} else {
retVal = todo;
}
}
}
return retVal;
}
+void CalendarLocal::getIncidenceCount( int calId, int& events, int & todos, int & journals)
+{
+ events = 0;
+ todos = 0;
+ journals = 0;
+ {
+ Todo *todo;
+ for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) {
+ if ( todo->calID() == calId )
+ ++todos;
+ }
+ }
+ {
+ Event *todo;
+ for ( todo = mEventList.first(); todo; todo = mEventList.next() ) {
+ if ( todo->calID() == calId )
+ ++events;
+
+ }
+ }
+ for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
+ if ( it->calID() == calId ) ++journals;
+
+}
QString CalendarLocal::nextSummary() const
{
return mNextSummary;
}
QDateTime CalendarLocal::nextAlarmEventDateTime() const
{
return mNextAlarmEventDateTime;
}
void CalendarLocal::checkAlarmForIncidence( Incidence * incidence, bool deleted)
{
//mNextAlarmIncidence
//mNextAlarmDateTime
//return mNextSummary;
//return mNextAlarmEventDateTime;
bool newNextAlarm = false;
bool computeNextAlarm = false;
bool ok;
int offset;
QDateTime nextA;
// QString nextSum;
//QDateTime nextEvent;
if ( mNextAlarmIncidence == 0 || incidence == 0 ) {
computeNextAlarm = true;
} else {
if ( ! deleted ) {
nextA = incidence->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ;
if ( ok ) {
if ( nextA < mNextAlarmDateTime ) {
deRegisterAlarm();
mNextAlarmDateTime = nextA;
mNextSummary = incidence->summary();
mNextAlarmEventDateTime = nextA.addSecs(offset ) ;
mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime);
newNextAlarm = true;
mNextAlarmIncidence = incidence;
} else {
if ( incidence == mNextAlarmIncidence ) {
computeNextAlarm = true;
}
}
} else {
if ( mNextAlarmIncidence == incidence ) {
computeNextAlarm = true;
}
}
} else { // deleted
if ( incidence == mNextAlarmIncidence ) {
computeNextAlarm = true;
}
}
}
if ( computeNextAlarm ) {
deRegisterAlarm();
nextA = nextAlarm( 1000 );
if (! mNextAlarmIncidence ) {
return;
}
newNextAlarm = true;
}
if ( newNextAlarm )
registerAlarm();
}
QString CalendarLocal:: getAlarmNotification()
{
QString ret;
// this should not happen
if (! mNextAlarmIncidence )
return "cal_alarm"+ mNextSummary.left( 25 )+"\n"+mNextAlarmEventDateTimeString;
Alarm* alarm = mNextAlarmIncidence->alarms().first();
if ( alarm->type() == Alarm::Procedure ) {
ret = "proc_alarm" + alarm->programFile()+"+++";
} else {
ret = "audio_alarm" +alarm->audioFile() +"+++";
}
ret += "cal_alarm"+ mNextSummary.left( 25 );
if ( mNextSummary.length() > 25 )
ret += "\n" + mNextSummary.mid(25, 25 );
ret+= "\n"+mNextAlarmEventDateTimeString;
return ret;
}
void CalendarLocal::registerAlarm()
{
mLastAlarmNotificationString = getAlarmNotification();
// qDebug("++ register Alarm %s %s",mNextAlarmDateTime.toString().latin1(), mLastAlarmNotificationString.latin1() );
emit addAlarm ( mNextAlarmDateTime, mLastAlarmNotificationString );
// #ifndef DESKTOP_VERSION
// AlarmServer::addAlarm ( mNextAlarmDateTime,"koalarm", mLastAlarmNotificationString.latin1() );
// #endif
}
void CalendarLocal::deRegisterAlarm()
{
if ( mLastAlarmNotificationString.isNull() )
return;
//qDebug("-- deregister Alarm %s ", mLastAlarmNotificationString.latin1() );
emit removeAlarm ( mNextAlarmDateTime, mLastAlarmNotificationString );
mNextAlarmEventDateTime = QDateTime();
// #ifndef DESKTOP_VERSION
// AlarmServer::deleteAlarm (mNextAlarmDateTime ,"koalarm" ,mLastAlarmNotificationString.latin1() );
// #endif
}
QPtrList<Todo> CalendarLocal::todos( const QDate &date )
{
QPtrList<Todo> todos;
Todo *todo;
for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) {
if ( !todo->calEnabled() ) continue;
if ( todo->hasDueDate() && todo->dtDue().date() == date ) {
todos.append( todo );
}
}
filter()->apply( &todos );
return todos;
}
void CalendarLocal::reInitAlarmSettings()
{
if ( !mNextAlarmIncidence ) {
nextAlarm( 1000 );
}
deRegisterAlarm();
mNextAlarmIncidence = 0;
checkAlarmForIncidence( 0, false );
}
QDateTime CalendarLocal::nextAlarm( int daysTo )
{
QDateTime nextA = QDateTime::currentDateTime().addDays( daysTo );
QDateTime start = QDateTime::currentDateTime().addSecs( 30 );
QDateTime next;
Event *e;
bool ok;
bool found = false;
int offset;
mNextAlarmIncidence = 0;
for( e = mEventList.first(); e; e = mEventList.next() ) {
if ( !e->calEnabled() ) continue;
next = e->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ;
if ( ok ) {
if ( next < nextA ) {
nextA = next;
found = true;
mNextSummary = e->summary();
mNextAlarmEventDateTime = next.addSecs(offset ) ;
mNextAlarmIncidence = (Incidence *) e;
}
}
}
Todo *t;
for( t = mTodoList.first(); t; t = mTodoList.next() ) {
if ( !t->calEnabled() ) continue;
next = t->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ;
if ( ok ) {
if ( next < nextA ) {
nextA = next;
found = true;
mNextSummary = t->summary();
mNextAlarmEventDateTime = next.addSecs(offset );
mNextAlarmIncidence = (Incidence *) t;
}
}
}
if ( mNextAlarmIncidence ) {
mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime);
mNextAlarmDateTime = nextA;
}
return nextA;
}
Alarm::List CalendarLocal::alarmsTo( const QDateTime &to )
{
return alarms( QDateTime( QDate( 1900, 1, 1 ) ), to );
}
Alarm::List CalendarLocal::alarms( const QDateTime &from, const QDateTime &to )
{
Alarm::List alarms;
Event *e;
for( e = mEventList.first(); e; e = mEventList.next() ) {
if ( !e->calEnabled() ) continue;
if ( e->doesRecur() ) appendRecurringAlarms( alarms, e, from, to );
else appendAlarms( alarms, e, from, to );
}
Todo *t;
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h
index a7a85c8..ca0bd98 100644
--- a/libkcal/calendarlocal.h
+++ b/libkcal/calendarlocal.h
@@ -1,230 +1,231 @@
/*
This file is part of libkcal.
Copyright (c) 1998 Preston Brown
Copyright (c) 2001,2003 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 KCAL_CALENDARLOCAL_H
#define KCAL_CALENDARLOCAL_H
#include "calendar.h"
namespace KCal {
class CalFormat;
/**
This class provides a calendar stored as a local file.
*/
class CalendarLocal : public Calendar
{
public:
/**
Constructs a new calendar, with variables initialized to sane values.
*/
CalendarLocal();
/**
Constructs a new calendar, with variables initialized to sane values.
*/
CalendarLocal( const QString &timeZoneId );
~CalendarLocal();
void addCalendar( Calendar* );
bool addCalendarFile( QString name, int id );
bool mergeCalendarFile( QString name );
bool mergeCalendar( Calendar* cal );
Incidence* incidenceForUid( const QString& uid, bool doNotCheckDuplicates );
void setSyncEventsReadOnly();
void stopAllTodos();
/**
Loads a calendar on disk in vCalendar or iCalendar format into the current
calendar. Any information already present is lost.
@return true, if successfull, false on error.
@param fileName the name of the calendar on disk.
*/
bool load( const QString &fileName );
/**
Writes out the calendar to disk in the specified \a format.
CalendarLocal takes ownership of the CalFormat object.
@return true, if successfull, false on error.
@param fileName the name of the file
*/
bool save( const QString &fileName, CalFormat *format = 0 );
/**
Clears out the current calendar, freeing all used memory etc. etc.
*/
void close();
void save() {}
/**
Add Event to calendar.
*/
void removeSyncInfo( QString syncProfile);
bool addAnniversaryNoDup( Event *event );
bool addEventNoDup( Event *event );
bool addEvent( Event *event );
/**
Deletes an event from this calendar.
*/
void deleteEvent( Event *event );
/**
Retrieves an event on the basis of the unique string ID.
*/
Event *event( const QString &uid );
/**
Return unfiltered list of all events in calendar.
*/
QPtrList<Event> rawEvents();
QPtrList<Event> getExternLastSyncEvents();
/**
Add a todo to the todolist.
*/
bool addTodo( Todo *todo );
bool addTodoNoDup( Todo *todo );
/**
Remove a todo from the todolist.
*/
void deleteTodo( Todo * );
/**
Searches todolist for an event with this unique string identifier,
returns a pointer or null.
*/
Todo *todo( const QString &uid );
/**
Return list of all todos.
*/
QPtrList<Todo> rawTodos();
/**
Returns list of todos due on the specified date.
*/
QPtrList<Todo> todos( const QDate &date );
/**
Return list of all todos.
Workaround because compiler does not recognize function of base class.
*/
QPtrList<Todo> todos() { return Calendar::todos(); }
/**
Add a Journal entry to calendar.
*/
bool addJournal( Journal * );
/**
Remove a Journal from the calendar.
*/
void deleteJournal( Journal * );
/**
Return Journal for given date.
*/
Journal *journal( const QDate & );
QPtrList<Journal> journals4Date( const QDate & );
/**
Return Journal with given UID.
*/
Journal *journal( const QString &uid );
/**
Return list of all Journals stored in calendar.
*/
QPtrList<Journal> journals();
/**
Return all alarms, which ocur in the given time interval.
*/
Alarm::List alarms( const QDateTime &from, const QDateTime &to );
/**
Return all alarms, which ocur before given date.
*/
Alarm::List alarmsTo( const QDateTime &to );
QDateTime nextAlarm( int daysTo ) ;
QDateTime nextAlarmEventDateTime() const;
void checkAlarmForIncidence( Incidence *, bool deleted ) ;
void registerAlarm();
void deRegisterAlarm();
QString getAlarmNotification();
QString nextSummary() const ;
/**
This method should be called whenever a Event is modified directly
via it's pointer. It makes sure that the calendar is internally
consistent.
*/
void update( IncidenceBase *incidence );
/**
Builds and then returns a list of all events that match for the
date specified. useful for dayView, etc. etc.
*/
QPtrList<Event> rawEventsForDate( const QDate &date, bool sorted = false );
/**
Get unfiltered events for date \a qdt.
*/
QPtrList<Event> rawEventsForDate( const QDateTime &qdt );
/**
Get unfiltered events in a range of dates. If inclusive is set to true,
only events are returned, which are completely included in the range.
*/
QPtrList<Event> rawEvents( const QDate &start, const QDate &end,
bool inclusive = false );
Todo *todo( QString, QString );
Event *event( QString, QString );
+ void getIncidenceCount( int calId, int& events, int & todos, int & journals);
public slots:
void setCalendarEnabled( int id, bool enable );
void setAlarmEnabled( int id, bool enable );
void setReadOnly( int id, bool enable );
void setDefaultCalendarEnabledOnly();
void setCalendarRemove( int id );
protected:
// Event* mNextAlarmEvent;
QString mNextSummary;
QString mNextAlarmEventDateTimeString;
QString mLastAlarmNotificationString;
QDateTime mNextAlarmEventDateTime;
QDateTime mNextAlarmDateTime;
void reInitAlarmSettings();
/** Notification function of IncidenceBase::Observer. */
void incidenceUpdated( IncidenceBase *i ) { update( i ); }
/** inserts an event into its "proper place" in the calendar. */
void insertEvent( Event *event );
/** Append alarms of incidence in interval to list of alarms. */
void appendAlarms( Alarm::List &alarms, Incidence *incidence,
const QDateTime &from, const QDateTime &to );
/** Append alarms of recurring events in interval to list of alarms. */
void appendRecurringAlarms( Alarm::List &alarms, Incidence *incidence,
const QDateTime &from, const QDateTime &to );
private:
void init();
QPtrList<Event> mEventList;
QPtrList<Todo> mTodoList;
QPtrList<Journal> mJournalList;
};
}
#endif