summaryrefslogtreecommitdiffabout
path: root/libkcal/calendarlocal.cpp
Side-by-side diff
Diffstat (limited to 'libkcal/calendarlocal.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/calendarlocal.cpp66
1 files changed, 33 insertions, 33 deletions
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index ce3cd09..cb52b7c 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -17,17 +17,17 @@
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 <qdatetime.h>
#include <qstring.h>
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include <kdebug.h>
#include <kconfig.h>
#include <kglobal.h>
#include <klocale.h>
#include "vcaldrag.h"
#include "vcalformat.h"
@@ -187,25 +187,25 @@ Incidence* CalendarLocal::incidenceForUid( const QString& uid , bool doNotCheckD
bool CalendarLocal::mergeCalendar( Calendar* remote )
{
// 1 look for raw inc in local
// if inc not in remote, delete in local
// 2 look for raw inc in remote
// if inc in local, replace it
// if not in local, add it to default calendar
- QPtrList<Incidence> localInc = rawIncidences();
+ Q3PtrList<Incidence> localInc = rawIncidences();
Incidence* inL = localInc.first();
while ( inL ) {
if ( ! inL->isReadOnly () )
if ( !remote->incidenceForUid( inL->uid(), true ))
deleteIncidence( inL );
inL = localInc.next();
}
- QPtrList<Incidence> er = remote->rawIncidences();
+ Q3PtrList<Incidence> er = remote->rawIncidences();
Incidence* inR = er.first();
while ( inR ) {
inL = incidenceForUid( inR->uid(),false );
if ( inL ) {
if ( ! inL->isReadOnly () || inL->uid().left(15) == QString("last-syncEvent-") ) {
int calID = inL->calID();
deleteIncidence( inL );
inL = inR->clone();
@@ -254,19 +254,19 @@ void CalendarLocal::setSyncEventsReadOnly()
ev = mEventList.next();
}
}
void CalendarLocal::addCalendar( Calendar* cal )
{
cal->setDontDeleteIncidencesOnClose();
setSyncEventsEnabled();
- QPtrList<Incidence> incList;
+ Q3PtrList<Incidence> incList;
{
- QPtrList<Event> EventList = cal->rawEvents();
+ Q3PtrList<Event> EventList = cal->rawEvents();
Event * ev = EventList.first();
while ( ev ) {
if ( ev->uid().left( 15 ) == QString("last-syncEvent-") ) {
ev->setCalID_block( 1 );
}
Event * se = event( ev->uid() );
if ( se )
incList.append( se );
@@ -274,17 +274,17 @@ void CalendarLocal::addCalendar( Calendar* cal )
ev->registerObserver( this );
mEventList.append( ev );
ev = EventList.next();
}
}
{
- QPtrList<Todo> TodoList = cal->rawTodos();
+ Q3PtrList<Todo> TodoList = cal->rawTodos();
Todo * ev = TodoList.first();
while ( ev ) {
ev->resetRelatedTo();
Todo * se = todo( ev->uid() );
if ( se )
deleteTodo( se );
ev = TodoList.next();
}
@@ -294,17 +294,17 @@ void CalendarLocal::addCalendar( Calendar* cal )
ev->unRegisterObserver( cal );
ev->registerObserver( this );
mTodoList.append( ev );
setupRelations( ev );
ev = TodoList.next();
}
}
{
- QPtrList<Journal> JournalList = cal->journals();
+ Q3PtrList<Journal> JournalList = cal->journals();
Journal * ev = JournalList.first();
while ( ev ) {
Journal * se = journal( ev->uid() );
if ( se )
incList.append( se );
ev->unRegisterObserver( cal );
ev->registerObserver( this );
mJournalList.append( ev );
@@ -476,58 +476,58 @@ void CalendarLocal::deleteTodo( Todo *todo )
if ( mTodoList.removeRef( todo ) ) {
setModified( true );
}
Todo* dup = todoForUid( uid );
if ( dup )
setupRelations( dup );
}
-QPtrList<Todo> CalendarLocal::rawTodos()
+Q3PtrList<Todo> CalendarLocal::rawTodos()
{
- QPtrList<Todo> el;
+ Q3PtrList<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() ;
+ Q3PtrList<Incidence> all = rawIncidences() ;
Incidence *inc;
for ( inc = all.first(); inc; inc = all.next() ) {
inc->removeID( syncProfile );
}
if ( syncProfile.isEmpty() ) {
- QPtrList<Event> el;
+ Q3PtrList<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()
+Q3PtrList<Event> CalendarLocal::getExternLastSyncEvents()
{
- QPtrList<Event> el;
+ Q3PtrList<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;
@@ -680,19 +680,19 @@ void CalendarLocal::deRegisterAlarm()
emit removeAlarm ( mNextAlarmDateTime, mLastAlarmNotificationString );
mNextAlarmEventDateTime = QDateTime();
// #ifndef DESKTOP_VERSION
// AlarmServer::deleteAlarm (mNextAlarmDateTime ,"koalarm" ,mLastAlarmNotificationString.latin1() );
// #endif
}
-QPtrList<Todo> CalendarLocal::todos( const QDate &date )
+Q3PtrList<Todo> CalendarLocal::todos( const QDate &date )
{
- QPtrList<Todo> todos;
+ Q3PtrList<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 );
}
}
@@ -781,17 +781,17 @@ Alarm::List CalendarLocal::alarms( const QDateTime &from, const QDateTime &to )
}
return alarms;
}
void CalendarLocal::appendAlarms( Alarm::List &alarms, Incidence *incidence,
const QDateTime &from, const QDateTime &to )
{
- QPtrList<Alarm> alarmList = incidence->alarms();
+ Q3PtrList<Alarm> alarmList = incidence->alarms();
Alarm *alarm;
for( alarm = alarmList.first(); alarm; alarm = alarmList.next() ) {
// kdDebug(5800) << "CalendarLocal::appendAlarms() '" << alarm->text()
// << "': " << alarm->time().toString() << " - " << alarm->enabled() << endl;
if ( alarm->enabled() ) {
if ( alarm->time() >= from && alarm->time() <= to ) {
alarms.append( alarm );
}
@@ -800,17 +800,17 @@ void CalendarLocal::appendAlarms( Alarm::List &alarms, Incidence *incidence,
}
void CalendarLocal::appendRecurringAlarms( Alarm::List &alarms,
Incidence *incidence,
const QDateTime &from,
const QDateTime &to )
{
- QPtrList<Alarm> alarmList = incidence->alarms();
+ Q3PtrList<Alarm> alarmList = incidence->alarms();
Alarm *alarm;
QDateTime qdt;
for( alarm = alarmList.first(); alarm; alarm = alarmList.next() ) {
if (incidence->recursOn(from.date())) {
qdt.setTime(alarm->time().time());
qdt.setDate(from.date());
}
else qdt = alarm->time();
@@ -839,19 +839,19 @@ void CalendarLocal::update( IncidenceBase *incidence )
}
void CalendarLocal::insertEvent( Event *event )
{
if ( mEventList.findRef( event ) < 0 ) mEventList.append( event );
}
-QPtrList<Event> CalendarLocal::rawEventsForDate( const QDate &qd, bool sorted )
+Q3PtrList<Event> CalendarLocal::rawEventsForDate( const QDate &qd, bool sorted )
{
- QPtrList<Event> eventList;
+ Q3PtrList<Event> eventList;
Event *event;
for( event = mEventList.first(); event; event = mEventList.next() ) {
if ( !event->calEnabled() ) continue;
if ( event->doesRecur() ) {
if ( event->isMultiDay() ) {
int extraDays = event->dtStart().date().daysTo( event->dtEnd().date() );
int i;
@@ -873,38 +873,38 @@ QPtrList<Event> CalendarLocal::rawEventsForDate( const QDate &qd, bool sorted )
}
if ( !sorted ) {
return eventList;
}
// kdDebug(5800) << "Sorting events for date\n" << endl;
// now, we have to sort it based on dtStart.time()
- QPtrList<Event> eventListSorted;
+ Q3PtrList<Event> eventListSorted;
Event *sortEvent;
for ( event = eventList.first(); event; event = eventList.next() ) {
sortEvent = eventListSorted.first();
int i = 0;
while ( sortEvent && event->dtStart().time()>=sortEvent->dtStart().time() )
{
i++;
sortEvent = eventListSorted.next();
}
eventListSorted.insert( i, event );
}
return eventListSorted;
}
-QPtrList<Event> CalendarLocal::rawEvents( const QDate &start, const QDate &end,
+Q3PtrList<Event> CalendarLocal::rawEvents( const QDate &start, const QDate &end,
bool inclusive )
{
Event *event = 0;
- QPtrList<Event> eventList;
+ Q3PtrList<Event> eventList;
// Get non-recurring events
for( event = mEventList.first(); event; event = mEventList.next() ) {
if ( !event->calEnabled() ) continue;
if ( event->doesRecur() ) {
QDate rStart = event->dtStart().date();
bool found = false;
if ( inclusive ) {
@@ -918,17 +918,17 @@ QPtrList<Event> CalendarLocal::rawEvents( const QDate &start, const QDate &end,
}
} else if ( event->recurrence()->duration() > 0 ) { // Duration set
// TODO: Calculate end date from duration. Should be done in Event
// For now exclude all events with a duration.
}
}
} else {
bool founOne;
- QDate next = event->getNextOccurence( start, &founOne ).date();
+ QDate next = event->getNextOccurence( (QDateTime)start, &founOne ).date();
if ( founOne ) {
if ( next <= end ) {
found = true;
}
}
/*
// crap !!!
@@ -967,24 +967,24 @@ QPtrList<Event> CalendarLocal::rawEvents( const QDate &start, const QDate &end,
}
}
}
}
return eventList;
}
-QPtrList<Event> CalendarLocal::rawEventsForDate( const QDateTime &qdt )
+Q3PtrList<Event> CalendarLocal::rawEventsForDate( const QDateTime &qdt )
{
return rawEventsForDate( qdt.date() );
}
-QPtrList<Event> CalendarLocal::rawEvents()
+Q3PtrList<Event> CalendarLocal::rawEvents()
{
- QPtrList<Event> el;
+ Q3PtrList<Event> el;
for ( Event *it = mEventList.first(); it; it = mEventList.next() )
if ( it->calEnabled() ) el.append( it );
return el;
}
bool CalendarLocal::addJournal(Journal *journal)
{
mJournalList.append(journal);
@@ -1001,19 +1001,19 @@ bool CalendarLocal::addJournal(Journal *journal)
void CalendarLocal::deleteJournal( Journal *journal )
{
clearUndo(journal);
if ( mJournalList.removeRef(journal) ) {
setModified( true );
}
}
-QPtrList<Journal> CalendarLocal::journals4Date( const QDate & date )
+Q3PtrList<Journal> CalendarLocal::journals4Date( const QDate & date )
{
- QPtrList<Journal> el;
+ Q3PtrList<Journal> el;
for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
if ( it->calEnabled() && it->dtStart().date() == date) el.append( it );
return el;
}
Journal *CalendarLocal::journal( const QDate &date )
{
// kdDebug(5800) << "CalendarLocal::journal() " << date.toString() << endl;
@@ -1035,47 +1035,47 @@ Journal *CalendarLocal::journal( const QString &uid )
}
} else {
retVal = it;
}
}
return retVal;
}
-QPtrList<Journal> CalendarLocal::journals()
+Q3PtrList<Journal> CalendarLocal::journals()
{
- QPtrList<Journal> el;
+ Q3PtrList<Journal> el;
for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
if ( it->calEnabled() ) el.append( it );
return el;
}
void CalendarLocal::setCalendarRemove( int id )
{
{
- QPtrList<Event> EventList = mEventList;
+ Q3PtrList<Event> EventList = mEventList;
Event * ev = EventList.first();
while ( ev ) {
if ( ev->calID() == id && ev->uid().left( 15 ) != QString("last-syncEvent-") )
deleteEvent( ev );
ev = EventList.next();
}
}
{
- QPtrList<Todo> TodoList = mTodoList;
+ Q3PtrList<Todo> TodoList = mTodoList;
Todo * ev = TodoList.first();
while ( ev ) {
if ( ev->calID() == id )
deleteTodo( ev );
ev = TodoList.next();
}
}
{
- QPtrList<Journal> JournalList = mJournalList;
+ Q3PtrList<Journal> JournalList = mJournalList;
Journal * ev = JournalList.first();
while ( ev ) {
if ( ev->calID() == id )
deleteJournal( ev );
ev = JournalList.next();
}
}