summaryrefslogtreecommitdiffabout
path: root/libkcal
Side-by-side diff
Diffstat (limited to 'libkcal') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/alarm.cpp10
-rw-r--r--libkcal/alarm.h12
-rw-r--r--libkcal/calendar.cpp66
-rw-r--r--libkcal/calendar.h40
-rw-r--r--libkcal/calendarlocal.cpp66
-rw-r--r--libkcal/calendarlocal.h28
-rw-r--r--libkcal/calfilter.cpp6
-rw-r--r--libkcal/calfilter.h10
-rw-r--r--libkcal/customproperties.cpp32
-rw-r--r--libkcal/customproperties.h22
-rw-r--r--libkcal/dndfactory.cpp9
-rw-r--r--libkcal/dndfactory.h2
-rw-r--r--libkcal/dndfactory_dummy.h2
-rw-r--r--libkcal/dummyscheduler.cpp16
-rw-r--r--libkcal/dummyscheduler.h4
-rw-r--r--libkcal/event.cpp2
-rw-r--r--libkcal/event.h4
-rw-r--r--libkcal/filestorage.cpp2
-rw-r--r--libkcal/freebusy.cpp11
-rw-r--r--libkcal/freebusy.h14
-rw-r--r--libkcal/icaldrag.cpp2
-rw-r--r--libkcal/icaldrag.h4
-rw-r--r--libkcal/icalformat.cpp32
-rw-r--r--libkcal/icalformat.h4
-rw-r--r--libkcal/icalformatimpl.cpp35
-rw-r--r--libkcal/icalformatimpl.h6
-rw-r--r--libkcal/imipscheduler.cpp6
-rw-r--r--libkcal/imipscheduler.h4
-rw-r--r--libkcal/incidence.cpp38
-rw-r--r--libkcal/incidence.h20
-rw-r--r--libkcal/incidencebase.cpp14
-rw-r--r--libkcal/incidencebase.h16
-rw-r--r--libkcal/journal.h4
-rw-r--r--libkcal/kincidenceformatter.cpp10
-rw-r--r--libkcal/libkcal.pro6
-rw-r--r--libkcal/libkcalE.pro2
-rw-r--r--libkcal/listbase.h24
-rw-r--r--libkcal/phoneformat.cpp23
-rw-r--r--libkcal/qtopiaformat.cpp8
-rw-r--r--libkcal/recurrence.cpp187
-rw-r--r--libkcal/recurrence.h26
-rw-r--r--libkcal/scheduler.cpp12
-rw-r--r--libkcal/scheduler.h4
-rw-r--r--libkcal/sharpformat.cpp48
-rw-r--r--libkcal/todo.cpp2
-rw-r--r--libkcal/todo.h4
-rw-r--r--libkcal/vcaldrag.cpp2
-rw-r--r--libkcal/vcaldrag.h4
-rw-r--r--libkcal/vcalformat.cpp52
-rw-r--r--libkcal/vcalformat.h13
50 files changed, 521 insertions, 449 deletions
diff --git a/libkcal/alarm.cpp b/libkcal/alarm.cpp
index 3157214..3c4a81c 100644
--- a/libkcal/alarm.cpp
+++ b/libkcal/alarm.cpp
@@ -13,32 +13,34 @@
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 <klocale.h>
#include "incidence.h"
#include "todo.h"
#include "alarm.h"
+//Added by qt3to4:
+#include <Q3ValueList>
using namespace KCal;
#include <qwidget.h>
Alarm::Alarm(Incidence *parent)
: mParent(parent),
mType(Audio),
mDescription(""), // to make operator==() not fail
mFile(""), // to make operator==() not fail
mMailSubject(""), // to make operator==() not fail
mAlarmSnoozeTime(5),
mAlarmRepeatCount(0),
mEndOffset(false),
mHasTime(false),
mAlarmEnabled(false)
{
@@ -199,70 +201,70 @@ QString Alarm::programFile() const
}
void Alarm::setProgramArguments(const QString &arguments)
{
if (mType == Procedure) {
mDescription = arguments;
mParent->updated();
}
}
QString Alarm::programArguments() const
{
return (mType == Procedure) ? mDescription : QString::null;
}
void Alarm::setEmailAlarm(const QString &subject, const QString &text,
- const QValueList<Person> &addressees, const QStringList &attachments)
+ const Q3ValueList<Person> &addressees, const QStringList &attachments)
{
mType = Email;
mMailSubject = subject;
mDescription = text;
mMailAddresses = addressees;
mMailAttachFiles = attachments;
mParent->updated();
}
void Alarm::setMailAddress(const Person &mailAddress)
{
if (mType == Email) {
mMailAddresses.clear();
mMailAddresses += mailAddress;
mParent->updated();
}
}
-void Alarm::setMailAddresses(const QValueList<Person> &mailAddresses)
+void Alarm::setMailAddresses(const Q3ValueList<Person> &mailAddresses)
{
if (mType == Email) {
mMailAddresses = mailAddresses;
mParent->updated();
}
}
void Alarm::addMailAddress(const Person &mailAddress)
{
if (mType == Email) {
mMailAddresses += mailAddress;
mParent->updated();
}
}
-QValueList<Person> Alarm::mailAddresses() const
+Q3ValueList<Person> Alarm::mailAddresses() const
{
- return (mType == Email) ? mMailAddresses : QValueList<Person>();
+ return (mType == Email) ? mMailAddresses : Q3ValueList<Person>();
}
void Alarm::setMailSubject(const QString &mailAlarmSubject)
{
if (mType == Email) {
mMailSubject = mailAlarmSubject;
mParent->updated();
}
}
QString Alarm::mailSubject() const
{
return (mType == Email) ? mMailSubject : QString::null;
}
void Alarm::setMailAttachment(const QString &mailAttachFile)
diff --git a/libkcal/alarm.h b/libkcal/alarm.h
index ac6ea0d..b24f0f7 100644
--- a/libkcal/alarm.h
+++ b/libkcal/alarm.h
@@ -9,50 +9,50 @@
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_ALARM_H
#define KCAL_ALARM_H
#include <qstring.h>
-#include <qvaluelist.h>
+#include <q3valuelist.h>
#include "customproperties.h"
#include "duration.h"
#include "person.h"
namespace KCal {
class Incidence;
/**
This class represents an alarm notification.
*/
class Alarm : public CustomProperties
{
public:
enum Type { Invalid, Display, Procedure, Email, Audio };
- typedef QValueList<Alarm *> List;
+ typedef Q3ValueList<Alarm *> List;
/** Construct a new alarm with variables initialized to "sane" values. */
explicit Alarm(Incidence *parent);
/** Destruct Alarm object. */
~Alarm();
/** Compare this alarm with another one. */
bool operator==(const Alarm &) const;
bool operator!=(const Alarm &a) const { return !operator==(a); }
/** Set the type of the alarm.
If the specified type is different from the current type of the alarm,
the alarm's type-specific properties are initialised to null.
@param type type of alarm.
*/
void setType(Type type);
@@ -99,49 +99,49 @@ class Alarm : public CustomProperties
QString programFile() const;
/** Set the arguments to the program to execute when the alarm is triggered.
Ignored if the alarm is not a procedure alarm.
*/
void setProgramArguments(const QString &arguments);
/** Return the arguments to the program to run when the alarm is triggered.
@return the program arguments, or QString::null if not a procedure alarm.
*/
QString programArguments() const;
/** Set the alarm to be an email alarm.
@param subject subject line of email.
@param text body of email.
@param addressees email addresses of recipient(s).
@param attachments optional names of files to attach to the email.
*/
- void setEmailAlarm(const QString &subject, const QString &text, const QValueList<Person> &addressees,
+ void setEmailAlarm(const QString &subject, const QString &text, const Q3ValueList<Person> &addressees,
const QStringList &attachments = QStringList());
/** Send mail to this address when the alarm is triggered.
Ignored if the alarm is not an email alarm.
*/
void setMailAddress(const Person &mailAlarmAddress);
/** Send mail to these addresses when the alarm is triggered.
Ignored if the alarm is not an email alarm.
*/
- void setMailAddresses(const QValueList<Person> &mailAlarmAddresses);
+ void setMailAddresses(const Q3ValueList<Person> &mailAlarmAddresses);
/** Add this address to the list of addresses to send mail to when the alarm is triggered.
Ignored if the alarm is not an email alarm.
*/
void addMailAddress(const Person &mailAlarmAddress);
/** return the addresses to send mail to when an alarm goes off */
- QValueList<Person> mailAddresses() const;
+ Q3ValueList<Person> mailAddresses() const;
/** Set the subject line of the mail.
Ignored if the alarm is not an email alarm.
*/
void setMailSubject(const QString &mailAlarmSubject);
/** return the subject line of the mail */
QString mailSubject() const;
/** Attach this filename to the email.
Ignored if the alarm is not an email alarm.
*/
void setMailAttachment(const QString &mailAttachFile);
/** Attach these filenames to the email.
Ignored if the alarm is not an email alarm.
*/
void setMailAttachments(const QStringList &mailAttachFiles);
@@ -213,33 +213,33 @@ class Alarm : public CustomProperties
/** set the alarm enabled status */
void setEnabled(bool enable);
/** get the alarm enabled status */
bool enabled() const;
/** Set the alarm's parent incidence */
void setParent( Incidence * );
/** get the alarm's parent incidence */
Incidence *parent() const { return mParent; }
private:
Incidence *mParent; // the incidence which this alarm belongs to
Type mType; // type of alarm
QString mDescription; // text to display/email body/procedure arguments
QString mFile; // procedure program to run/optional audio file to play
QStringList mMailAttachFiles; // filenames to attach to email
- QValueList<Person> mMailAddresses; // who to mail for reminder
+ Q3ValueList<Person> mMailAddresses; // who to mail for reminder
QString mMailSubject; // subject of email
int mAlarmSnoozeTime; // number of minutes after alarm to
// snooze before ringing again
int mAlarmRepeatCount; // number of times for alarm to repeat
// after the initial time
QDateTime mAlarmTime; // time at which to trigger the alarm
Duration mOffset; // time relative to incidence DTSTART to trigger the alarm
bool mEndOffset; // if true, mOffset relates to DTEND, not DTSTART
bool mHasTime; // use mAlarmTime, not mOffset
bool mAlarmEnabled;
};
}
diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp
index 9b38d3f..bf095cf 100644
--- a/libkcal/calendar.cpp
+++ b/libkcal/calendar.cpp
@@ -17,32 +17,34 @@
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <stdlib.h>
#include <time.h>
#include <kdebug.h>
#include <kglobal.h>
#include <klocale.h>
#include "exceptions.h"
#include "calfilter.h"
#include "calendar.h"
#include "syncdefines.h"
+//Added by qt3to4:
+#include <Q3PtrList>
using namespace KCal;
Calendar::Calendar()
{
init();
setTimeZoneId( " 00:00 Europe/London(UTC)" );
}
Calendar::Calendar( const QString &timeZoneId )
{
init();
setTimeZoneId(timeZoneId);
}
@@ -258,131 +260,131 @@ void Calendar::setEmail(const QString &e)
{
mOwnerEmail = e;
setModified( true );
}
void Calendar::setFilter(CalFilter *filter)
{
mFilter = filter;
}
CalFilter *Calendar::filter()
{
return mFilter;
}
-QPtrList<Incidence> Calendar::incidences()
+Q3PtrList<Incidence> Calendar::incidences()
{
- QPtrList<Incidence> incidences;
+ Q3PtrList<Incidence> incidences;
Incidence *i;
- QPtrList<Event> e = events();
+ Q3PtrList<Event> e = events();
for( i = e.first(); i; i = e.next() ) incidences.append( i );
- QPtrList<Todo> t = todos();
+ Q3PtrList<Todo> t = todos();
for( i = t.first(); i; i = t.next() ) incidences.append( i );
- QPtrList<Journal> j = journals();
+ Q3PtrList<Journal> j = journals();
for( i = j.first(); i; i = j.next() ) incidences.append( i );
return incidences;
}
void Calendar::resetPilotStat(int id )
{
- QPtrList<Incidence> incidences;
+ Q3PtrList<Incidence> incidences;
Incidence *i;
- QPtrList<Event> e = rawEvents();
+ Q3PtrList<Event> e = rawEvents();
for( i = e.first(); i; i = e.next() ) i->setPilotId( id );
- QPtrList<Todo> t = rawTodos();
+ Q3PtrList<Todo> t = rawTodos();
for( i = t.first(); i; i = t.next() ) i->setPilotId( id );
- QPtrList<Journal> j = journals();
+ Q3PtrList<Journal> j = journals();
for( i = j.first(); i; i = j.next() ) i->setPilotId( id );
}
void Calendar::resetTempSyncStat()
{
- QPtrList<Incidence> incidences;
+ Q3PtrList<Incidence> incidences;
Incidence *i;
- QPtrList<Event> e = rawEvents();
+ Q3PtrList<Event> e = rawEvents();
for( i = e.first(); i; i = e.next() ) i->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
- QPtrList<Todo> t = rawTodos();
+ Q3PtrList<Todo> t = rawTodos();
for( i = t.first(); i; i = t.next() ) i->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
- QPtrList<Journal> j = journals();
+ Q3PtrList<Journal> j = journals();
for( i = j.first(); i; i = j.next() ) i->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
}
-QPtrList<Incidence> Calendar::rawIncidences()
+Q3PtrList<Incidence> Calendar::rawIncidences()
{
- QPtrList<Incidence> incidences;
+ Q3PtrList<Incidence> incidences;
Incidence *i;
- QPtrList<Event> e = rawEvents();
+ Q3PtrList<Event> e = rawEvents();
for( i = e.first(); i; i = e.next() ) incidences.append( i );
- QPtrList<Todo> t = rawTodos();
+ Q3PtrList<Todo> t = rawTodos();
for( i = t.first(); i; i = t.next() ) incidences.append( i );
- QPtrList<Journal> j = journals();
+ Q3PtrList<Journal> j = journals();
for( i = j.first(); i; i = j.next() ) incidences.append( i );
return incidences;
}
-QPtrList<Event> Calendar::events( const QDate &date, bool sorted )
+Q3PtrList<Event> Calendar::events( const QDate &date, bool sorted )
{
- QPtrList<Event> el = rawEventsForDate(date,sorted);
+ Q3PtrList<Event> el = rawEventsForDate(date,sorted);
mFilter->apply(&el);
return el;
}
-QPtrList<Event> Calendar::events( const QDateTime &qdt )
+Q3PtrList<Event> Calendar::events( const QDateTime &qdt )
{
- QPtrList<Event> el = rawEventsForDate(qdt);
+ Q3PtrList<Event> el = rawEventsForDate(qdt);
mFilter->apply(&el);
return el;
}
-QPtrList<Event> Calendar::events( const QDate &start, const QDate &end,
+Q3PtrList<Event> Calendar::events( const QDate &start, const QDate &end,
bool inclusive)
{
- QPtrList<Event> el = rawEvents(start,end,inclusive);
+ Q3PtrList<Event> el = rawEvents(start,end,inclusive);
mFilter->apply(&el);
return el;
}
-QPtrList<Event> Calendar::events()
+Q3PtrList<Event> Calendar::events()
{
- QPtrList<Event> el = rawEvents();
+ Q3PtrList<Event> el = rawEvents();
mFilter->apply(&el);
return el;
}
void Calendar::addIncidenceBranch(Incidence *i)
{
addIncidence( i );
Incidence * inc;
- QPtrList<Incidence> Relations = i->relations();
+ Q3PtrList<Incidence> Relations = i->relations();
for (inc=Relations.first();inc;inc=Relations.next()) {
addIncidenceBranch( inc );
}
}
bool Calendar::addIncidence(Incidence *i)
{
Incidence::AddVisitor<Calendar> v(this);
if ( i->calID() == 0 )
i->setCalID_block( mDefaultCalendar );
i->setCalEnabled( true );
return i->accept(v);
}
void Calendar::deleteIncidence(Incidence *in)
{
if ( in->typeID() == eventID )
@@ -394,35 +396,35 @@ void Calendar::deleteIncidence(Incidence *in)
}
Incidence* Calendar::incidence( const QString& uid )
{
Incidence* i;
if( (i = todo( uid )) != 0 )
return i;
if( (i = event( uid )) != 0 )
return i;
if( (i = journal( uid )) != 0 )
return i;
return 0;
}
-QPtrList<Todo> Calendar::todos()
+Q3PtrList<Todo> Calendar::todos()
{
- QPtrList<Todo> tl = rawTodos();
+ Q3PtrList<Todo> tl = rawTodos();
mFilter->apply( &tl );
return tl;
}
// When this is called, the todo have already been added to the calendar.
// This method is only about linking related todos
void Calendar::setupRelations( Incidence *incidence )
{
QString uid = incidence->uid();
qDebug("Calendar::setupRelations %s", incidence->summary().latin1());
// First, go over the list of orphans and see if this is their parent
while( Incidence* i = mOrphans[ uid ] ) {
mOrphans.remove( uid );
i->setRelatedTo( incidence );
qDebug("Add child %s ti inc %s", i->summary().latin1(),incidence->summary().latin1());
incidence->addRelation( i );
@@ -442,65 +444,65 @@ void Calendar::setupRelations( Incidence *incidence )
parent->addRelation( incidence );
} else {
qDebug("NO parent found for for %s", incidence->summary().latin1());
// Not found, put this in the mOrphans list
mOrphans.insert( incidence->relatedToUid(), incidence );
mOrphanUids.insert( incidence->uid(), incidence );
}
}
}
// If a task with subtasks is deleted, move it's subtasks to the orphans list
void Calendar::removeRelations( Incidence *incidence )
{
// qDebug("Calendar::removeRelations ");
QString uid = incidence->uid();
- QPtrList<Incidence> relations = incidence->relations();
+ Q3PtrList<Incidence> relations = incidence->relations();
for( Incidence* i = relations.first(); i; i = relations.next() )
if( !mOrphanUids.find( i->uid() ) ) {
mOrphans.insert( uid, i );
mOrphanUids.insert( i->uid(), i );
i->setRelatedTo( 0 );
i->setRelatedToUid( uid );
}
// If this incidence is related to something else, tell that about it
if( incidence->relatedTo() )
incidence->relatedTo()->removeRelation( incidence );
// Remove this one from the orphans list
if( mOrphanUids.remove( uid ) ) {
QString r2uid = incidence->relatedToUid();
- QPtrList<Incidence> tempList;
+ Q3PtrList<Incidence> tempList;
while( Incidence* i = mOrphans[ r2uid ] ) {
mOrphans.remove( r2uid );
if ( i != incidence ) tempList.append( i );
}
Incidence* inc = tempList.first();
while ( inc ) {
mOrphans.insert( r2uid, inc );
inc = tempList.next();
}
}
// LR: and another big bad bug found
#if 0
// This incidence is located in the orphans list - it should be removed
if( !( incidence->relatedTo() != 0 && mOrphans.remove( incidence->relatedTo()->uid() ) ) ) {
// Removing wasn't that easy
- for( QDictIterator<Incidence> it( mOrphans ); it.current(); ++it ) {
+ for( Q3DictIterator<Incidence> it( mOrphans ); it.current(); ++it ) {
if( it.current()->uid() == uid ) {
mOrphans.remove( it.currentKey() );
break;
}
}
}
#endif
}
void Calendar::registerObserver( Observer *observer )
{
mObserver = observer;
mNewObserver = true;
}
void Calendar::setModified( bool modified )
diff --git a/libkcal/calendar.h b/libkcal/calendar.h
index fbc40ad..5845f44 100644
--- a/libkcal/calendar.h
+++ b/libkcal/calendar.h
@@ -12,34 +12,34 @@
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 CALENDAR_H
#define CALENDAR_H
#include <qobject.h>
#include <qstring.h>
#include <qdatetime.h>
-#include <qptrlist.h>
-#include <qdict.h>
+#include <q3ptrlist.h>
+#include <q3dict.h>
#include "customproperties.h"
#include "event.h"
#include "todo.h"
#include "journal.h"
#include "calfilter.h"
//#define _TIME_ZONE "-0500" /* hardcoded, overridden in config file. */
class KConfig;
namespace KCal {
/**
This is the main "calendar" object class for KOrganizer. It holds
@@ -75,33 +75,33 @@ public:
*/
virtual void close() = 0;
virtual void addCalendar( Calendar* ) = 0;
virtual bool addCalendarFile( QString name, int id ) = 0;
virtual bool mergeCalendarFile( QString name ) = 0;
virtual Incidence* incidenceForUid( const QString& uid, bool doNotCheckDuplicates , bool enabledOnly = false ,int * isDup = 0 ) = 0;
virtual Todo* todoForUid( const QString& uid, bool doNotCheckDuplicates = true, bool enabledOnly = false ,int * isDup = 0) = 0;
virtual void setSyncEventsReadOnly() = 0;
virtual void setSyncEventsEnabled() = 0;
virtual void stopAllTodos() = 0;
virtual void clearUndo( Incidence * newUndo );
/**
Sync changes in memory to persistant storage.
*/
virtual void save() = 0;
- virtual QPtrList<Event> getExternLastSyncEvents() = 0;
+ virtual Q3PtrList<Event> getExternLastSyncEvents() = 0;
virtual void removeSyncInfo( QString syncProfile) = 0;
virtual bool isSaving() { return false; }
/**
Return the owner of the calendar's full name.
*/
const QString &getOwner() const;
/**
Set the owner of the calendar. Should be owner's full name.
*/
void setOwner( const QString &os );
/**
Return the email address of the calendar owner.
*/
const QString &getEmail();
/**
@@ -142,134 +142,134 @@ public:
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();
+ virtual Q3PtrList<Incidence> incidences();
/**
Return unfiltered list of all incidences of this calendar.
*/
- virtual QPtrList<Incidence> rawIncidences();
+ virtual Q3PtrList<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);
+ Q3PtrList<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 );
+ Q3PtrList<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,
+ Q3PtrList<Event> events( const QDate &start, const QDate &end,
bool inclusive = false);
/**
Return filtered list of all events in calendar.
*/
- virtual QPtrList<Event> events();
+ virtual Q3PtrList<Event> events();
/**
Return unfiltered list of all events in calendar.
*/
- virtual QPtrList<Event> rawEvents() = 0;
+ virtual Q3PtrList<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();
+ virtual Q3PtrList<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;
+ virtual Q3PtrList<Todo> todos( const QDate &date ) = 0;
/**
Return unfiltered list of todos.
*/
- virtual QPtrList<Todo> rawTodos() = 0;
+ virtual Q3PtrList<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;
+ virtual Q3PtrList<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;
+ virtual Q3PtrList<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 * );
@@ -322,64 +322,64 @@ public:
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;
+ virtual Q3PtrList<Event> rawEventsForDate( const QDateTime &qdt ) = 0;
/**
Get unfiltered events, which occur on the given date.
*/
- virtual QPtrList<Event> rawEventsForDate( const QDate &date,
+ virtual Q3PtrList<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,
+ virtual Q3PtrList<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;
+ Q3Dict<Incidence> mOrphans;
+ Q3Dict<Incidence> mOrphanUids;
};
}
#endif
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index ce3cd09..cb52b7c 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -9,33 +9,33 @@
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 <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"
#include "icalformat.h"
#include "exceptions.h"
#include "incidence.h"
#include "journal.h"
#include "filestorage.h"
#include "calfilter.h"
#include "calendarlocal.h"
@@ -179,41 +179,41 @@ Incidence* CalendarLocal::incidenceForUid( const QString& uid , bool doNotCheckD
retVal = it;
}
} else {
retVal = it;
}
}
return retVal;
}
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();
inL->setCalID_block( calID );
addIncidence( inL );
}
} else {
inL = inR->clone();
inL->setCalID_block( 0 );// add to default cal
addIncidence( inL );
}
@@ -246,73 +246,73 @@ void CalendarLocal::setSyncEventsEnabled()
void CalendarLocal::setSyncEventsReadOnly()
{
Event * ev;
ev = mEventList.first();
while ( ev ) {
if ( ev->uid().left(15) == QString("last-syncEvent-") ) {
ev->setReadOnly( true );
}
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 );
ev->unRegisterObserver( 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();
}
//TodoList = cal->rawTodos();
ev = TodoList.first();
while ( ev ) {
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 );
ev = JournalList.next();
}
}
{
for (Incidence * inc = incList.first(); inc; inc = incList.next() ) {
deleteIncidence ( inc );
}
}
@@ -468,74 +468,74 @@ bool CalendarLocal::addTodo( Todo *todo )
void CalendarLocal::deleteTodo( Todo *todo )
{
QString uid = todo->uid();
// Handle orphaned children
removeRelations( todo );
clearUndo(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;
}
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;
}
@@ -672,35 +672,35 @@ void CalendarLocal::registerAlarm()
// 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 )
+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 );
}
}
filter()->apply( &todos );
return todos;
}
void CalendarLocal::reInitAlarmSettings()
{
if ( !mNextAlarmIncidence ) {
nextAlarm( 1000 );
@@ -773,52 +773,52 @@ Alarm::List CalendarLocal::alarms( const QDateTime &from, const QDateTime &to )
if ( e->doesRecur() ) appendRecurringAlarms( alarms, e, from, to );
else appendAlarms( alarms, e, from, to );
}
Todo *t;
for( t = mTodoList.first(); t; t = mTodoList.next() ) {
if ( !t->calEnabled() ) continue;
appendAlarms( alarms, t, from, 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 );
}
}
}
}
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();
// qDebug("1 %s %s %s", qdt.toString().latin1(), from.toString().latin1(), to.toString().latin1());
if ( alarm->enabled() ) {
if ( qdt >= from && qdt <= to ) {
alarms.append( alarm );
}
}
}
}
@@ -831,112 +831,112 @@ void CalendarLocal::update( IncidenceBase *incidence )
{
incidence->setSyncStatus( Event::SYNCMOD );
incidence->setLastModified( QDateTime::currentDateTime() );
// we should probably update the revision number here,
// or internally in the Event itself when certain things change.
// need to verify with ical documentation.
setModified( true );
}
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;
for ( i = 0; i <= extraDays; i++ ) {
if ( event->recursOn( qd.addDays( -i ) ) ) {
eventList.append( event );
break;
}
}
} else {
if ( event->recursOn( qd ) )
eventList.append( event );
}
} else {
if ( event->dtStart().date() <= qd && event->dtEnd().date() >= qd ) {
eventList.append( event );
}
}
}
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 ) {
if ( rStart >= start && rStart <= end ) {
// Start date of event is in range. Now check for end date.
// if duration is negative, event recurs forever, so do not include it.
if ( event->recurrence()->duration() == 0 ) { // End date set
QDate rEnd = event->recurrence()->endDate();
if ( rEnd >= start && rEnd <= end ) { // End date within range
found = true;
}
} 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 !!!
if ( rStart <= end ) { // Start date not after range
if ( rStart >= start ) { // Start date within range
found = true;
} else if ( event->recurrence()->duration() == -1 ) { // Recurs forever
found = true;
} else if ( event->recurrence()->duration() == 0 ) { // End date set
QDate rEnd = event->recurrence()->endDate();
if ( rEnd >= start && rEnd <= end ) { // End date within range
@@ -959,131 +959,131 @@ QPtrList<Event> CalendarLocal::rawEvents( const QDate &start, const QDate &end,
if ( inclusive ) {
if ( s >= start && e <= end ) {
eventList.append( event );
}
} else {
if ( ( e >= start && s <= end ) ) {
eventList.append( event );
}
}
}
}
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);
journal->registerObserver( this );
setModified( true );
if ( journal->calID() == 0 )
journal->setCalID_block( mDefaultCalendar );
journal->setCalEnabled( true );
return true;
}
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;
for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
if ( it->calEnabled() && it->dtStart().date() == date )
return it;
return 0;
}
Journal *CalendarLocal::journal( const QString &uid )
{
Journal * retVal = 0;
for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
if ( it->calEnabled() && it->uid() == uid ) {
if ( retVal ) {
if ( retVal->calID() > it->calID() ) {
retVal = it;
}
} 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();
}
}
clearUndo(0);
}
void CalendarLocal::setAllCalendarEnabled( bool enable )
{
for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
it->setCalEnabled( enable );
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h
index 1ceabce..1df65c7 100644
--- a/libkcal/calendarlocal.h
+++ b/libkcal/calendarlocal.h
@@ -10,32 +10,34 @@
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"
+//Added by qt3to4:
+#include <Q3PtrList>
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();
/**
@@ -80,123 +82,123 @@ class CalendarLocal : public 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();
+ Q3PtrList<Event> rawEvents();
+ Q3PtrList<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();
+ Q3PtrList<Todo> rawTodos();
/**
Returns list of todos due on the specified date.
*/
- QPtrList<Todo> todos( const QDate &date );
+ Q3PtrList<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(); }
+ Q3PtrList<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 & );
+ Q3PtrList<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();
+ Q3PtrList<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 );
+ Q3PtrList<Event> rawEventsForDate( const QDate &date, bool sorted = false );
/**
Get unfiltered events for date \a qdt.
*/
- QPtrList<Event> rawEventsForDate( const QDateTime &qdt );
+ Q3PtrList<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,
+ Q3PtrList<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 );
void setAllCalendarEnabled( bool enable );
protected:
// Event* mNextAlarmEvent;
@@ -211,24 +213,24 @@ public slots:
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;
+ Q3PtrList<Event> mEventList;
+ Q3PtrList<Todo> mTodoList;
+ Q3PtrList<Journal> mJournalList;
};
}
#endif
diff --git a/libkcal/calfilter.cpp b/libkcal/calfilter.cpp
index 72f70c2..fa1dbd5 100644
--- a/libkcal/calfilter.cpp
+++ b/libkcal/calfilter.cpp
@@ -8,73 +8,75 @@
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"
+//Added by qt3to4:
+#include <Q3PtrList>
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)
+void CalFilter::apply(Q3PtrList<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)
+void CalFilter::apply(Q3PtrList<Todo> *eventlist)
{
if (!mEnabled) return;
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)
{
diff --git a/libkcal/calfilter.h b/libkcal/calfilter.h
index e349770..821149f 100644
--- a/libkcal/calfilter.h
+++ b/libkcal/calfilter.h
@@ -9,74 +9,74 @@
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 <q3ptrlist.h>
#include "event.h"
#include "todo.h"
#include "journal.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);
+ void apply(Q3PtrList<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);
+ void apply(Q3PtrList<Todo> *todolist);
+ bool filterCalendarItem(Incidence *in);
+ bool 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.
*/
diff --git a/libkcal/customproperties.cpp b/libkcal/customproperties.cpp
index adc1710..16f4a28 100644
--- a/libkcal/customproperties.cpp
+++ b/libkcal/customproperties.cpp
@@ -6,107 +6,109 @@
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 "customproperties.h"
+//Added by qt3to4:
+#include <Q3CString>
using namespace KCal;
CustomProperties::CustomProperties()
{
}
CustomProperties::CustomProperties(const CustomProperties &cp)
: mProperties(cp.mProperties)
{
}
CustomProperties::~CustomProperties()
{
}
-void CustomProperties::setCustomProperty(const QCString &app, const QCString &key,
+void CustomProperties::setCustomProperty(const Q3CString &app, const Q3CString &key,
const QString &value)
{
if (value.isNull() || key.isEmpty() || app.isEmpty())
return;
- QCString property = "X-KDE-" + app + "-" + key;
+ Q3CString property = "X-KDE-" + app + "-" + key;
if (!checkName(property))
return;
mProperties[property] = value;
}
-void CustomProperties::removeCustomProperty(const QCString &app, const QCString &key)
+void CustomProperties::removeCustomProperty(const Q3CString &app, const Q3CString &key)
{
- removeNonKDECustomProperty(QCString("X-KDE-" + app + "-" + key));
+ removeNonKDECustomProperty(Q3CString("X-KDE-" + app + "-" + key));
}
-QString CustomProperties::customProperty(const QCString &app, const QCString &key) const
+QString CustomProperties::customProperty(const Q3CString &app, const Q3CString &key) const
{
- return nonKDECustomProperty(QCString("X-KDE-" + app + "-" + key));
+ return nonKDECustomProperty(Q3CString("X-KDE-" + app + "-" + key));
}
-void CustomProperties::setNonKDECustomProperty(const QCString &name, const QString &value)
+void CustomProperties::setNonKDECustomProperty(const Q3CString &name, const QString &value)
{
if (value.isNull() || !checkName(name))
return;
mProperties[name] = value;
}
-void CustomProperties::removeNonKDECustomProperty(const QCString &name)
+void CustomProperties::removeNonKDECustomProperty(const Q3CString &name)
{
- QMap<QCString, QString>::Iterator it = mProperties.find(name);
+ QMap<Q3CString, QString>::Iterator it = mProperties.find(name);
if (it != mProperties.end())
mProperties.remove(it);
}
-QString CustomProperties::nonKDECustomProperty(const QCString &name) const
+QString CustomProperties::nonKDECustomProperty(const Q3CString &name) const
{
- QMap<QCString, QString>::ConstIterator it = mProperties.find(name);
+ QMap<Q3CString, QString>::ConstIterator it = mProperties.find(name);
if (it == mProperties.end())
return QString::null;
return it.data();
}
-void CustomProperties::setCustomProperties(const QMap<QCString, QString> &properties)
+void CustomProperties::setCustomProperties(const QMap<Q3CString, QString> &properties)
{
- for (QMap<QCString, QString>::ConstIterator it = properties.begin(); it != properties.end(); ++it) {
+ for (QMap<Q3CString, QString>::ConstIterator it = properties.begin(); it != properties.end(); ++it) {
// Validate the property name and convert any null string to empty string
if (checkName(it.key())) {
mProperties[it.key()] = it.data().isNull() ? QString("") : it.data();
}
}
}
-QMap<QCString, QString> CustomProperties::customProperties() const
+QMap<Q3CString, QString> CustomProperties::customProperties() const
{
return mProperties;
}
-bool CustomProperties::checkName(const QCString &name)
+bool CustomProperties::checkName(const Q3CString &name)
{
// Check that the property name starts with 'X-' and contains
// only the permitted characters
const char* n = name;
int len = name.length();
if (len < 2 || n[0] != 'X' || n[1] != '-')
return false;
for (int i = 2; i < len; ++i) {
char ch = n[i];
if (ch >= 'A' && ch <= 'Z'
|| ch >= 'a' && ch <= 'z'
|| ch >= '0' && ch <= '9'
|| ch == '-')
continue;
return false; // invalid character found
}
diff --git a/libkcal/customproperties.h b/libkcal/customproperties.h
index 0cbfdcd..75eb3ad 100644
--- a/libkcal/customproperties.h
+++ b/libkcal/customproperties.h
@@ -10,88 +10,90 @@
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_CUSTOM_PROPERTIES_H
#define KCAL_CUSTOM_PROPERTIES_H
#include <qstring.h>
#include <qmap.h>
+//Added by qt3to4:
+#include <Q3CString>
namespace KCal {
/**
This class represents custom calendar properties.
It is used as a base class for classes which represent calendar components.
A custom property name written by libkcal has the form X-KDE-APP-KEY where
APP represents the application name, and KEY distinguishes individual
properties for the application.
In keeping with RFC2445, property names must be composed only of the
characters A-Z, a-z, 0-9 and '-'.
*/
class CustomProperties
{
public:
/** Construct a new empty custom properties instance */
CustomProperties();
CustomProperties(const CustomProperties &);
~CustomProperties();
/** Create or modify a custom calendar property.
@param app Application name as it appears in the custom property name.
@param key Property identifier specific to the application.
@param value The property's value. A call with a value of QString::null
will be ignored.
*/
- void setCustomProperty(const QCString &app, const QCString &key,
+ void setCustomProperty(const Q3CString &app, const Q3CString &key,
const QString &value);
/** Delete a custom calendar property.
@param app Application name as it appears in the custom property name.
@param key Property identifier specific to the application.
*/
- void removeCustomProperty(const QCString &app, const QCString &key);
+ void removeCustomProperty(const Q3CString &app, const Q3CString &key);
/** Return the value of a custom calendar property.
@param app Application name as it appears in the custom property name.
@param key Property identifier specific to the application.
@return Property value, or QString::null if (and only if) the property does not exist.
*/
- QString customProperty(const QCString &app, const QCString &key) const;
+ QString customProperty(const Q3CString &app, const Q3CString &key) const;
/** Create or modify a non-KDE or non-standard custom calendar property.
@param name Full property name
@param value The property's value. A call with a value of QString::null
will be ignored.
*/
- void setNonKDECustomProperty(const QCString &name, const QString &value);
+ void setNonKDECustomProperty(const Q3CString &name, const QString &value);
/** Delete a non-KDE or non-standard custom calendar property.
@param name Full property name
*/
- void removeNonKDECustomProperty(const QCString &name);
+ void removeNonKDECustomProperty(const Q3CString &name);
/** Return the value of a non-KDE or non-standard custom calendar property.
@param name Full property name
@return Property value, or QString::null if (and only if) the property does not exist.
*/
- QString nonKDECustomProperty(const QCString& name) const;
+ QString nonKDECustomProperty(const Q3CString& name) const;
/** Initialise the alarm's custom calendar properties to the specified
key/value pairs.
*/
- void setCustomProperties(const QMap<QCString, QString> &properties);
+ void setCustomProperties(const QMap<Q3CString, QString> &properties);
/** Return all custom calendar property key/value pairs. */
- QMap<QCString, QString> customProperties() const;
+ QMap<Q3CString, QString> customProperties() const;
private:
- static bool checkName(const QCString& name);
+ static bool checkName(const Q3CString& name);
- QMap<QCString, QString> mProperties; // custom calendar properties
+ QMap<Q3CString, QString> mProperties; // custom calendar properties
};
}
#endif
diff --git a/libkcal/dndfactory.cpp b/libkcal/dndfactory.cpp
index cdcfae4..ca7e212 100644
--- a/libkcal/dndfactory.cpp
+++ b/libkcal/dndfactory.cpp
@@ -9,32 +9,35 @@
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 <qapplication.h>
#include <qclipboard.h>
+//Added by qt3to4:
+#include <QDropEvent>
+#include <Q3PtrList>
#include <kiconloader.h>
#include <kdebug.h>
#include <kmessagebox.h>
#include <klocale.h>
#include "vcaldrag.h"
#include "icaldrag.h"
#include "calendar.h"
#include "vcalformat.h"
#include "icalformat.h"
#include "calendarlocal.h"
#include "dndfactory.h"
using namespace KCal;
@@ -55,52 +58,52 @@ ICalDrag *DndFactory::createDrag( Incidence *incidence, QWidget *owner )
icd->setPixmap( BarIcon( "appointment" ) );
else if ( i->type() == "Todo" )
icd->setPixmap( BarIcon( "todo" ) );
return icd;
}
Event *DndFactory::createDrop(QDropEvent *de)
{
kdDebug(5800) << "DndFactory::createDrop()" << endl;
CalendarLocal cal( mCalendar->timeZoneId() );
if ( ICalDrag::decode( de, &cal ) || VCalDrag::decode( de, &cal ) ) {
de->accept();
- QPtrList<Event> events = cal.events();
+ Q3PtrList<Event> events = cal.events();
if ( !events.isEmpty() ) {
Event *event = new Event( *events.first() );
return event;
}
}
return 0;
}
Todo *DndFactory::createDropTodo(QDropEvent *de)
{
kdDebug(5800) << "VCalFormat::createDropTodo()" << endl;
CalendarLocal cal( mCalendar->timeZoneId() );
if ( ICalDrag::decode( de, &cal ) || VCalDrag::decode( de, &cal ) ) {
de->accept();
- QPtrList<Todo> todos = cal.todos();
+ Q3PtrList<Todo> todos = cal.todos();
if ( !todos.isEmpty() ) {
Todo *todo = new Todo( *todos.first() );
return todo;
}
}
return 0;
}
void DndFactory::cutIncidence( Incidence *selectedInc )
{
if ( copyIncidence( selectedInc ) ) {
mCalendar->deleteIncidence( selectedInc );
}
}
@@ -120,33 +123,33 @@ bool DndFactory::copyIncidence( Incidence *selectedInc )
}
Incidence *DndFactory::pasteIncidence(const QDate &newDate, const QTime *newTime)
{
// kdDebug(5800) << "DnDFactory::pasteEvent()" << endl;
CalendarLocal cal( mCalendar->timeZoneId() );
QClipboard *cb = QApplication::clipboard();
if ( !ICalDrag::decode( cb->data(), &cal ) &&
!VCalDrag::decode( cb->data(), &cal ) ) {
kdDebug(5800) << "Can't parse clipboard" << endl;
return 0;
}
- QPtrList<Incidence> incList = cal.incidences();
+ Q3PtrList<Incidence> incList = cal.incidences();
Incidence *inc = incList.first();
if ( !incList.isEmpty() && inc ) {
inc = inc->clone();
inc->recreate();
if ( inc->type() == "Event" ) {
Event *anEvent = static_cast<Event*>( inc );
// Calculate length of event
int daysOffset = anEvent->dtStart().date().daysTo(
anEvent->dtEnd().date() );
// new end date if event starts at the same time on the new day
QDateTime endDate( newDate.addDays(daysOffset), anEvent->dtEnd().time() );
diff --git a/libkcal/dndfactory.h b/libkcal/dndfactory.h
index 2df5259..a873c37 100644
--- a/libkcal/dndfactory.h
+++ b/libkcal/dndfactory.h
@@ -1,16 +1,18 @@
+//Added by qt3to4:
+#include <QDropEvent>
/*
This file is part of libkcal.
Copyright (c) 1998 Preston Brown
Copyright (c) 2001,2002,2003 Cornelius Schumacher <schumacher@kde.org>
Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
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.
diff --git a/libkcal/dndfactory_dummy.h b/libkcal/dndfactory_dummy.h
index 44cc114..3ab6adf 100644
--- a/libkcal/dndfactory_dummy.h
+++ b/libkcal/dndfactory_dummy.h
@@ -12,32 +12,34 @@
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.
*/
// $Id$
#ifndef KCAL_DNDFACTORY_H
#define KCAL_DNDFACTORY_H
#include "vcalformat.h"
+//Added by qt3to4:
+#include <QDropEvent>
class QDropEvent;
namespace KCal {
/**
This class implements functions to create Drag and Drop objects used for
Drag-and-Drop and Copy-and-Paste.
@short vCalendar Drag-and-Drop object factory.
*/
class DndFactory {
public:
DndFactory( Calendar * ) {}
/** create an object to be used with the Xdnd Drag And Drop protocol. */
diff --git a/libkcal/dummyscheduler.cpp b/libkcal/dummyscheduler.cpp
index ae40e6d..73eb3d0 100644
--- a/libkcal/dummyscheduler.cpp
+++ b/libkcal/dummyscheduler.cpp
@@ -10,33 +10,35 @@
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.
*/
//
// DummyScheduler - iMIP implementation of iTIP methods
//
#include <qfile.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
+//Added by qt3to4:
+#include <Q3PtrList>
#include <kdebug.h>
#include "event.h"
#include "icalformat.h"
#include "dummyscheduler.h"
using namespace KCal;
DummyScheduler::DummyScheduler(Calendar *calendar)
: Scheduler(calendar)
{
}
DummyScheduler::~DummyScheduler()
@@ -55,52 +57,52 @@ bool DummyScheduler::performTransaction(IncidenceBase *incidence,Method method,c
{
QString messageText = mFormat->createScheduleMessage(incidence,method);
return saveMessage(messageText);
}
bool DummyScheduler::performTransaction(IncidenceBase *incidence,Method method)
{
QString messageText = mFormat->createScheduleMessage(incidence,method);
return saveMessage(messageText);
}
bool DummyScheduler::saveMessage(const QString &message)
{
QFile f("dummyscheduler.store");
- if (f.open(IO_WriteOnly | IO_Append)) {
- QTextStream t(&f);
+ if (f.open(QIODevice::WriteOnly | QIODevice::Append)) {
+ Q3TextStream t(&f);
t << message << endl;
f.close();
return true;
} else {
return false;
}
}
-QPtrList<ScheduleMessage> DummyScheduler::retrieveTransactions()
+Q3PtrList<ScheduleMessage> DummyScheduler::retrieveTransactions()
{
- QPtrList<ScheduleMessage> messageList;
+ Q3PtrList<ScheduleMessage> messageList;
QFile f("dummyscheduler.store");
- if (!f.open(IO_ReadOnly)) {
+ if (!f.open(QIODevice::ReadOnly)) {
kdDebug(5800) << "DummyScheduler::retrieveTransactions(): Can't open file"
<< endl;
} else {
- QTextStream t(&f);
+ Q3TextStream t(&f);
QString messageString;
QString messageLine = t.readLine();
while (!messageLine.isNull()) {
// kdDebug(5800) << "++++++++" << messageLine << endl;
messageString += messageLine + "\n";
if (messageLine.find("END:VCALENDAR") >= 0) {
kdDebug(5800) << "---------------" << messageString << endl;
ScheduleMessage *message = mFormat->parseScheduleMessage(mCalendar,
messageString);
kdDebug(5800) << "--Parsed" << endl;
if (message) {
messageList.append(message);
} else {
QString errorMessage;
if (mFormat->exception()) {
errorMessage = mFormat->exception()->message();
diff --git a/libkcal/dummyscheduler.h b/libkcal/dummyscheduler.h
index df42153..f86d583 100644
--- a/libkcal/dummyscheduler.h
+++ b/libkcal/dummyscheduler.h
@@ -11,41 +11,43 @@
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 DUMMYSCHEDULER_H
#define DUMMYSCHEDULER_H
//
// Dummy implementation of iTIP methods
//
#include "scheduler.h"
+//Added by qt3to4:
+#include <Q3PtrList>
namespace KCal {
/**
This class implements the iTIP interface as a primitive local version for
testing. It uses a file dummyscheduler.store as inbox/outbox.
*/
class DummyScheduler : public Scheduler {
public:
DummyScheduler(Calendar *);
virtual ~DummyScheduler();
bool publish (IncidenceBase *incidence,const QString &recipients);
bool performTransaction(IncidenceBase *incidence,Method method);
bool performTransaction(IncidenceBase *incidence,Method method,const QString &recipients);
- QPtrList<ScheduleMessage> retrieveTransactions();
+ Q3PtrList<ScheduleMessage> retrieveTransactions();
protected:
bool saveMessage(const QString &);
};
}
#endif // DUMMYSCHEDULER_H
diff --git a/libkcal/event.cpp b/libkcal/event.cpp
index fdf5657..060df81 100644
--- a/libkcal/event.cpp
+++ b/libkcal/event.cpp
@@ -371,33 +371,33 @@ QDateTime Event::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_
return QDateTime ();
bool yes;
QDateTime incidenceStart = getNextOccurence( start_dt, &yes );
if ( ! yes || cancelled() ) {
*ok = false;
return QDateTime ();
}
bool enabled = false;
Alarm* alarm;
int off = 0;
QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );;
// if ( QDateTime::currentDateTime() > incidenceStart ){
// *ok = false;
// return incidenceStart;
// }
- for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) {
+ for (Q3PtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) {
if (alarm->enabled()) {
if ( alarm->hasTime () ) {
if ( alarm->time() < alarmStart ) {
alarmStart = alarm->time();
enabled = true;
off = alarmStart.secsTo( incidenceStart );
}
} else {
int secs = alarm->startOffset().asSeconds();
if ( incidenceStart.addSecs( secs ) < alarmStart ) {
alarmStart = incidenceStart.addSecs( secs );
enabled = true;
off = -secs;
}
}
diff --git a/libkcal/event.h b/libkcal/event.h
index 6a58618..da44f81 100644
--- a/libkcal/event.h
+++ b/libkcal/event.h
@@ -12,48 +12,50 @@
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 EVENT_H
#define EVENT_H
//
// Event component, representing a VEVENT object
//
#include "incidence.h"
+//Added by qt3to4:
+#include <Q3CString>
namespace KCal {
/**
This class provides an Event in the sense of RFC2445.
*/
class Event : public Incidence
{
public:
enum Transparency { Opaque, Transparent };
typedef ListBase<Event> List;
Event();
Event(const Event &);
~Event();
bool matchTime(QDateTime*startDT, QDateTime* endDT);
- QCString type() const { return "Event"; }
+ Q3CString type() const { return "Event"; }
IncTypeID typeID() const { return eventID; }
Incidence *clone();
QDateTime getNextAlarmDateTime( bool * ok, int * offset ,QDateTime start_dt ) const;
/** for setting an event's ending date/time with a QDateTime. */
void setDtEnd(const QDateTime &dtEnd);
/** Return the event's ending date/time as a QDateTime. */
virtual QDateTime dtEnd() const;
/** returns an event's end time as a string formatted according to the
users locale settings */
QString dtEndTimeStr() const;
/** returns an event's end date as a string formatted according to the
users locale settings */
QString dtEndDateStr(bool shortfmt=true) const;
/** returns an event's end date and time as a string formatted according
diff --git a/libkcal/filestorage.cpp b/libkcal/filestorage.cpp
index a139124..3d1309f 100644
--- a/libkcal/filestorage.cpp
+++ b/libkcal/filestorage.cpp
@@ -9,33 +9,33 @@
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 <stdlib.h>
#include <qdatetime.h>
#include <qstring.h>
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include <kdebug.h>
#include "calendar.h"
#include "vcaldrag.h"
#include "vcalformat.h"
#include "icalformat.h"
#include "filestorage.h"
using namespace KCal;
FileStorage::FileStorage( Calendar *cal, const QString &fileName,
CalFormat *format )
: CalStorage( cal ),
mFileName( fileName ),
diff --git a/libkcal/freebusy.cpp b/libkcal/freebusy.cpp
index ba15d6d..e4e9ec9 100644
--- a/libkcal/freebusy.cpp
+++ b/libkcal/freebusy.cpp
@@ -8,55 +8,58 @@
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 "freebusy.h"
+//Added by qt3to4:
+#include <Q3ValueList>
+#include <Q3PtrList>
using namespace KCal;
FreeBusy::FreeBusy()
{
}
FreeBusy::FreeBusy(const QDateTime &start, const QDateTime &end)
{
setDtStart(start);
setDtEnd(end);
}
FreeBusy::FreeBusy( Calendar *calendar, const QDateTime &start, const QDateTime &end )
{
kdDebug() << "FreeBusy::FreeBusy" << endl;
mCalendar = calendar;
setDtStart(start);
setDtEnd(end);
//Gets all the events in the calendar
- QPtrList<Event> eventList = mCalendar->events();
+ Q3PtrList<Event> eventList = mCalendar->events();
Event *event;
int extraDays, i, x, duration;
duration = start.daysTo(end);
QDate day;
QDateTime tmpStart;
QDateTime tmpEnd;
//Loops through every event in the calendar
for( event = eventList.first(); event; event = eventList.next() ) {
//This whole for loop is for recurring events, it loops through
//each of the days of the freebusy request
//First check if this is transparent. If it is, it shouldn't be in the
//freebusy list
if ( event->transparency() == Event::Transparent )
// Transparent
@@ -100,73 +103,73 @@ FreeBusy::FreeBusy( Calendar *calendar, const QDateTime &start, const QDateTime
FreeBusy::~FreeBusy()
{
}
bool FreeBusy::setDtEnd( const QDateTime &end )
{
mDtEnd = end;
return true;
}
QDateTime FreeBusy::dtEnd() const
{
return mDtEnd;
}
-QValueList<Period> FreeBusy::busyPeriods() const
+Q3ValueList<Period> FreeBusy::busyPeriods() const
{
return mBusyPeriods;
}
bool FreeBusy::addLocalPeriod(const QDateTime &eventStart, const QDateTime &eventEnd ) {
QDateTime tmpStart;
QDateTime tmpEnd;
//Check to see if the start *or* end of the event is
//between the start and end of the freebusy dates.
if (!((((this->dtStart()).secsTo(eventStart)>=0)&&(eventStart.secsTo(this->dtEnd())>=0))
||(((this->dtStart()).secsTo(eventEnd) >= 0)&&(eventEnd.secsTo(this->dtEnd()) >= 0))))
return false;
if ( eventStart.secsTo(this->dtStart())>=0) {
tmpStart = this->dtStart();
} else {
tmpStart = eventStart;
}
if ( eventEnd.secsTo(this->dtEnd())<=0 ) {
tmpEnd = this->dtEnd();
} else {
tmpEnd = eventEnd;
}
Period p(tmpStart, tmpEnd);
mBusyPeriods.append( p );
return true;
}
-FreeBusy::FreeBusy(QValueList<Period> busyPeriods)
+FreeBusy::FreeBusy(Q3ValueList<Period> busyPeriods)
{
mBusyPeriods = busyPeriods;
}
void FreeBusy::sortList()
{
- typedef QValueList<Period> PeriodList;
+ typedef Q3ValueList<Period> PeriodList;
PeriodList::Iterator tmpPeriod, earlyPeriod;
PeriodList sortedList;
QDateTime earlyTime;
while( mBusyPeriods.count() > 0 ) {
earlyTime=(*mBusyPeriods.begin()).start();
for (tmpPeriod=mBusyPeriods.begin(); tmpPeriod!=mBusyPeriods.end(); tmpPeriod++) {
if (earlyTime.secsTo((*tmpPeriod).start()) <= 0) {
earlyTime=(*tmpPeriod).start();
earlyPeriod=tmpPeriod;
}
}
//Move tmpPeriod to sortedList
Period tmpPeriod( (*earlyPeriod).start(), (*earlyPeriod).end() );
sortedList.append( tmpPeriod );
diff --git a/libkcal/freebusy.h b/libkcal/freebusy.h
index d741c72..bd14cb7 100644
--- a/libkcal/freebusy.h
+++ b/libkcal/freebusy.h
@@ -11,63 +11,65 @@
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_FREEBUSY_H
#define KCAL_FREEBUSY_H
//
// FreeBusy - information about free/busy times
//
#include <qdatetime.h>
-#include <qvaluelist.h>
-#include <qptrlist.h>
+#include <q3valuelist.h>
+#include <q3ptrlist.h>
+//Added by qt3to4:
+#include <Q3CString>
#include "period.h"
#include "calendar.h"
#include "incidencebase.h"
namespace KCal {
/**
This class provides information about free/busy time of a calendar user.
*/
class FreeBusy : public IncidenceBase
{
public:
FreeBusy();
FreeBusy(const QDateTime &start, const QDateTime &end);
FreeBusy(Calendar *calendar, const QDateTime &start, const QDateTime &end);
- FreeBusy(QValueList<Period> busyPeriods);
+ FreeBusy(Q3ValueList<Period> busyPeriods);
~FreeBusy();
- QCString type() const { return "FreeBusy"; }
+ Q3CString type() const { return "FreeBusy"; }
IncTypeID typeID() const { return freebusyID; }
virtual QDateTime dtEnd() const;
bool setDtEnd( const QDateTime &end );
- QValueList<Period> busyPeriods() const;
+ Q3ValueList<Period> busyPeriods() const;
void addPeriod(const QDateTime &start, const QDateTime &end);
void sortList();
private:
//This is used for creating a freebusy object for the current user
bool addLocalPeriod(const QDateTime &start, const QDateTime &end);
QDateTime mDtEnd;
- QValueList<Period> mBusyPeriods;
+ Q3ValueList<Period> mBusyPeriods;
Calendar *mCalendar;
};
}
#endif
diff --git a/libkcal/icaldrag.cpp b/libkcal/icaldrag.cpp
index 446a115..7f5a796 100644
--- a/libkcal/icaldrag.cpp
+++ b/libkcal/icaldrag.cpp
@@ -15,33 +15,33 @@
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 "icaldrag.h"
#include "icalformat.h"
#include <kdebug.h>
using namespace KCal;
ICalDrag::ICalDrag( Calendar *cal, QWidget *parent, const char *name )
- : QStoredDrag( "text/calendar", parent, name )
+ : Q3StoredDrag( "text/calendar", parent, name )
{
ICalFormat icf;
QString scal = icf.toString( cal );
setEncodedData( scal.utf8() );
}
bool ICalDrag::canDecode( QMimeSource *me )
{
return me->provides( "text/calendar" );
}
bool ICalDrag::decode( QMimeSource *de, Calendar *cal )
{
bool success = false;
diff --git a/libkcal/icaldrag.h b/libkcal/icaldrag.h
index fdf32b7..c1f73f4 100644
--- a/libkcal/icaldrag.h
+++ b/libkcal/icaldrag.h
@@ -9,38 +9,38 @@
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 ICALDRAG_H
#define ICALDRAG_H
-#include <qdragobject.h>
+#include <q3dragobject.h>
#include "calendar.h"
namespace KCal {
/** iCalendar drag&drop class. */
-class ICalDrag : public QStoredDrag
+class ICalDrag : public Q3StoredDrag
{
public:
/** Create a drag&drop object for iCalendar component \a ical. */
ICalDrag( Calendar *cal, QWidget *parent = 0, const char *name = 0 );
~ICalDrag() {};
/** Return, if drag&drop object can be decode to iCalendar. */
static bool canDecode( QMimeSource * );
/** Decode drag&drop object to iCalendar component \a cal. */
static bool decode( QMimeSource *e, Calendar *cal );
};
}
#endif
diff --git a/libkcal/icalformat.cpp b/libkcal/icalformat.cpp
index 6f3a799..3829bc1 100644
--- a/libkcal/icalformat.cpp
+++ b/libkcal/icalformat.cpp
@@ -7,37 +7,37 @@
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 <qdatetime.h>
#include <qstring.h>
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include <qregexp.h>
#include <qclipboard.h>
#include <qfile.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <qtextcodec.h>
#include <stdlib.h>
#include <kdebug.h>
#include <kglobal.h>
#include <klocale.h>
extern "C" {
#include <ical.h>
#include <icalss.h>
#include <icalparser.h>
#include <icalrestriction.h>
}
#include "calendar.h"
#include "calendarlocal.h"
@@ -57,68 +57,68 @@ ICalFormat::ICalFormat( bool pe )
tzOffsetMin = 0;
//qDebug("new ICalFormat() ");
}
ICalFormat::~ICalFormat()
{
delete mImpl;
//qDebug("delete ICalFormat ");
}
bool ICalFormat::load( Calendar *calendar, const QString &fileName)
{
clearException();
QFile file( fileName );
- if (!file.open( IO_ReadOnly ) ) {
+ if (!file.open( QIODevice::ReadOnly ) ) {
setException(new ErrorFormat(ErrorFormat::LoadError));
return false;
}
- QTextStream ts( &file );
+ Q3TextStream ts( &file );
QString text;
- ts.setEncoding( QTextStream::Latin1 );
+ ts.setEncoding( Q3TextStream::Latin1 );
text = ts.read();
file.close();
return fromString( calendar, text );
}
//#include <qdatetime.h>
bool ICalFormat::save( Calendar *calendar, const QString &fileName )
{
//kdDebug(5800) << "ICalFormat::save(): " << fileName << endl;
//qDebug("ICalFormat::save ");
clearException();
QString text = toString( calendar );
//return false;
// qDebug("to string takes ms: %d ",is.elapsed() );
if ( text.isNull() ) return false;
// TODO: write backup file
//is.restart();
QFile file( fileName );
- if (!file.open( IO_WriteOnly ) ) {
+ if (!file.open( QIODevice::WriteOnly ) ) {
setException(new ErrorFormat(ErrorFormat::SaveError,
i18n("Could not open file '%1'").arg(fileName)));
return false;
}
- QTextStream ts( &file );
+ Q3TextStream ts( &file );
- ts.setEncoding( QTextStream::Latin1 );
+ ts.setEncoding( Q3TextStream::Latin1 );
ts << text;
file.close();
//qDebug("saving file takes ms: %d ", is.elapsed() );
return true;
}
bool ICalFormat::fromString( Calendar *cal, const QString &text )
{
setTimeZone( cal->timeZoneId(), !cal->isLocalTime() );
// qDebug("ICalFormat::fromString tz: %s ", cal->timeZoneId().latin1());
// Get first VCALENDAR component.
// TODO: Handle more than one VCALENDAR or non-VCALENDAR top components
icalcomponent *calendar;
//calendar = icalcomponent_new_from_string( text.local8Bit().data());
// good calendar = icalcomponent_new_from_string( text.utf8().data());
@@ -143,84 +143,84 @@ bool ICalFormat::fromString( Calendar *cal, const QString &text )
} else
mLoadedProductId = mImpl->loadedProductId();
}
icalcomponent_free( calendar );
icalmemory_free_ring();
return success;
}
Incidence *ICalFormat::fromString( const QString &text )
{
CalendarLocal cal( mTimeZoneId );
fromString(&cal, text);
Incidence *ical = 0;
- QPtrList<Event> elist = cal.events();
+ Q3PtrList<Event> elist = cal.events();
if ( elist.count() > 0 ) {
ical = elist.first();
} else {
- QPtrList<Todo> tlist = cal.todos();
+ Q3PtrList<Todo> tlist = cal.todos();
if ( tlist.count() > 0 ) {
ical = tlist.first();
} else {
- QPtrList<Journal> jlist = cal.journals();
+ Q3PtrList<Journal> jlist = cal.journals();
if ( jlist.count() > 0 ) {
ical = jlist.first();
}
}
}
return ical;
}
-#include <qapp.h>
+#include <qapplication.h>
QString ICalFormat::toString( Calendar *cal )
{
setTimeZone( cal->timeZoneId(), !cal->isLocalTime() );
icalcomponent *calendar = mImpl->createCalendarComponent(cal);
icalcomponent *component;
// todos
- QPtrList<Todo> todoList = cal->rawTodos();
- QPtrListIterator<Todo> qlt(todoList);
+ Q3PtrList<Todo> todoList = cal->rawTodos();
+ Q3PtrListIterator<Todo> qlt(todoList);
for (; qlt.current(); ++qlt) {
component = mImpl->writeTodo(qlt.current());
icalcomponent_add_component(calendar,component);
//qDebug(" todos ");
if ( mProcessEvents ) {
//qDebug("mProcessEvents ");
qApp->processEvents();
}
}
// events
- QPtrList<Event> events = cal->rawEvents();
+ Q3PtrList<Event> events = cal->rawEvents();
Event *ev;
for(ev=events.first();ev;ev=events.next()) {
component = mImpl->writeEvent(ev);
icalcomponent_add_component(calendar,component);
//qDebug("events ");
if ( mProcessEvents )
qApp->processEvents();
}
// journals
- QPtrList<Journal> journals = cal->journals();
+ Q3PtrList<Journal> journals = cal->journals();
Journal *j;
for(j=journals.first();j;j=journals.next()) {
component = mImpl->writeJournal(j);
icalcomponent_add_component(calendar,component);
//qDebug("journals ");
if ( mProcessEvents )
qApp->processEvents();
}
const char *text;
QString ret ="";
text = icalcomponent_as_ical_string( calendar );
if ( mProcessEvents )
qApp->processEvents();
// text = "BEGIN:VCALENDAR\nPRODID\n :-//K Desktop Environment//NONSGML libkcal 3.1//EN\nVERSION\n :2.0\nBEGIN:VEVENT\nDTSTAMP\n :20031231T213514Z\nORGANIZER\n :MAILTO:lutz@putz.de\nCREATED\n :20031231T213513Z\nUID\n :libkcal-1295166342.120\nSEQUENCE\n :0\nLAST-MODIFIED\n :20031231T213513Z\nSUMMARY\n :test1\nCLASS\n :PUBLIC\nPRIORITY\n :3\nDTSTART\n :20040101T090000Z\nDTEND\n :20040101T110000Z\nTRANSP\n :OPAQUE\nEND:VEVENT\nEND:VCALENDAR\n";
diff --git a/libkcal/icalformat.h b/libkcal/icalformat.h
index a770dbb..a454b35 100644
--- a/libkcal/icalformat.h
+++ b/libkcal/icalformat.h
@@ -8,32 +8,34 @@
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 ICALFORMAT_H
#define ICALFORMAT_H
#include <qstring.h>
+//Added by qt3to4:
+#include <Q3CString>
#include "scheduler.h"
#include "calformat.h"
namespace KCal {
class ICalFormatImpl;
/**
This class implements the iCalendar format. It provides methods for
loading/saving/converting iCalendar format data into the internal KOrganizer
representation as Calendar and Events.
@short iCalendar format implementation
*/
@@ -93,24 +95,24 @@ class ICalFormat : public CalFormat {
/** Create a scheduling message for event \a e using method \m */
QString createScheduleMessage(IncidenceBase *e,Scheduler::Method m);
/** Parse scheduling message provided as string \s */
ScheduleMessage *parseScheduleMessage( Calendar *, const QString &s);
/** Set id of used time zone and whether this time zone is UTC or not. */
void setTimeZone( const QString &id, bool utc );
QString timeZoneId() const;
int timeOffset();
const char * tzString();
bool utc() const;
private:
bool mProcessEvents;
ICalFormatImpl *mImpl;
QString mTimeZoneId;
- QCString mTzString;
+ Q3CString mTzString;
int tzOffsetMin;
bool mUtc;
};
}
#endif
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp
index 65eabc8..ea144ee 100644
--- a/libkcal/icalformatimpl.cpp
+++ b/libkcal/icalformatimpl.cpp
@@ -7,34 +7,37 @@
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 <qdatetime.h>
#include <qstring.h>
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include <qfile.h>
+//Added by qt3to4:
+#include <Q3ValueList>
+#include <Q3CString>
#include <kdebug.h>
#include <klocale.h>
#include <kglobal.h>
extern "C" {
#include <ical.h>
#include <icalss.h>
#include <icalparser.h>
#include <icalrestriction.h>
}
#include "calendar.h"
#include "journal.h"
#include "icalformat.h"
#include "icalformatimpl.h"
@@ -208,34 +211,34 @@ icalcomponent *ICalFormatImpl::writeFreeBusy(FreeBusy *freebusy,
icalcomponent *vfreebusy = icalcomponent_new(ICAL_VFREEBUSY_COMPONENT);
writeIncidenceBase(vfreebusy,freebusy);
icalcomponent_add_property(vfreebusy, icalproperty_new_dtstart(
writeICalDateTime(freebusy->dtStart())));
icalcomponent_add_property(vfreebusy, icalproperty_new_dtend(
writeICalDateTime(freebusy->dtEnd())));
if (method == Scheduler::Request) {
icalcomponent_add_property(vfreebusy,icalproperty_new_uid(
freebusy->uid().utf8()));
}
//Loops through all the periods in the freebusy object
- QValueList<Period> list = freebusy->busyPeriods();
- QValueList<Period>::Iterator it;
+ Q3ValueList<Period> list = freebusy->busyPeriods();
+ Q3ValueList<Period>::Iterator it;
icalperiodtype period;
for (it = list.begin(); it!= list.end(); ++it) {
period.start = writeICalDateTime((*it).start());
period.end = writeICalDateTime((*it).end());
icalcomponent_add_property(vfreebusy, icalproperty_new_freebusy(period) );
}
return vfreebusy;
}
icalcomponent *ICalFormatImpl::writeJournal(Journal *journal)
{
icalcomponent *vjournal = icalcomponent_new(ICAL_VJOURNAL_COMPONENT);
writeIncidence(vjournal,journal);
@@ -371,38 +374,38 @@ void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence)
incidence->relatedToUid().utf8()));
}
// recurrence rule stuff
if (incidence->doesRecur()) {
icalcomponent_add_property(parent,writeRecurrenceRule(incidence->recurrence()));
// recurrence excpetion dates
DateList dateList = incidence->exDates();
DateList::ConstIterator exIt;
for(exIt = dateList.begin(); exIt != dateList.end(); ++exIt) {
icalcomponent_add_property(parent,icalproperty_new_exdate(
writeICalDate(*exIt)));
}
}
// attachments
- QPtrList<Attachment> attachments = incidence->attachments();
+ Q3PtrList<Attachment> attachments = incidence->attachments();
for (Attachment *at = attachments.first(); at; at = attachments.next())
icalcomponent_add_property(parent,writeAttachment(at));
// alarms
- QPtrList<Alarm> alarms = incidence->alarms();
+ Q3PtrList<Alarm> alarms = incidence->alarms();
Alarm* alarm;
for (alarm = alarms.first(); alarm; alarm = alarms.next()) {
if (alarm->enabled()) {
kdDebug(5800) << "Write alarm for " << incidence->summary() << endl;
icalcomponent_add_component(parent,writeAlarm(alarm));
}
}
if( incidence->hasRecurrenceID() ) {
icalcomponent_add_property(parent,
icalproperty_new_recurrenceid( writeICalDateTime( incidence->recurrenceID())));
}
// duration
// turned off as it always is set to PTS0 (and must not occur together with DTEND
if (incidence->hasDuration()) {
@@ -410,47 +413,47 @@ void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence)
duration = writeICalDuration(incidence->duration());
icalcomponent_add_property(parent,icalproperty_new_duration(duration));
}
}
void ICalFormatImpl::writeIncidenceBase(icalcomponent *parent,IncidenceBase *incidenceBase)
{
icalcomponent_add_property(parent,icalproperty_new_dtstamp(
writeICalDateTime(QDateTime::currentDateTime())));
// organizer stuff
icalcomponent_add_property(parent,icalproperty_new_organizer(
("MAILTO:" + incidenceBase->organizer()).utf8()));
// attendees
if (incidenceBase->attendeeCount() != 0) {
- QPtrList<Attendee> al = incidenceBase->attendees();
- QPtrListIterator<Attendee> ai(al);
+ Q3PtrList<Attendee> al = incidenceBase->attendees();
+ Q3PtrListIterator<Attendee> ai(al);
for (; ai.current(); ++ai) {
icalcomponent_add_property(parent,writeAttendee(ai.current()));
}
}
// custom properties
writeCustomProperties(parent, incidenceBase);
}
void ICalFormatImpl::writeCustomProperties(icalcomponent *parent,CustomProperties *properties)
{
- QMap<QCString, QString> custom = properties->customProperties();
- for (QMap<QCString, QString>::Iterator c = custom.begin(); c != custom.end(); ++c) {
+ QMap<Q3CString, QString> custom = properties->customProperties();
+ for (QMap<Q3CString, QString>::Iterator c = custom.begin(); c != custom.end(); ++c) {
icalproperty *p = icalproperty_new_x(c.data().utf8());
icalproperty_set_x_name(p,c.key());
icalcomponent_add_property(parent,p);
}
}
icalproperty *ICalFormatImpl::writeAttendee(Attendee *attendee)
{
icalproperty *p = icalproperty_new_attendee("mailto:" + attendee->email().utf8());
if (!attendee->name().isEmpty()) {
icalproperty_add_parameter(p,icalparameter_new_cn(attendee->name().utf8()));
}
icalproperty_add_parameter(p,icalparameter_new_rsvp(
@@ -533,34 +536,34 @@ icalproperty *ICalFormatImpl::writeAttachment(Attachment *att)
icalproperty_add_parameter(p,icalparameter_new_encoding(ICAL_ENCODING_BASE64));
}
return p;
}
icalproperty *ICalFormatImpl::writeRecurrenceRule(Recurrence *recur)
{
// kdDebug(5800) << "ICalFormatImpl::writeRecurrenceRule()" << endl;
icalrecurrencetype r;
icalrecurrencetype_clear(&r);
int index = 0;
int index2 = 0;
- QPtrList<Recurrence::rMonthPos> tmpPositions;
- QPtrList<int> tmpDays;
+ Q3PtrList<Recurrence::rMonthPos> tmpPositions;
+ Q3PtrList<int> tmpDays;
int *tmpDay;
Recurrence::rMonthPos *tmpPos;
bool datetime = false;
int day;
int i;
switch(recur->doesRecur()) {
case Recurrence::rMinutely:
r.freq = ICAL_MINUTELY_RECURRENCE;
datetime = true;
break;
case Recurrence::rHourly:
r.freq = ICAL_HOURLY_RECURRENCE;
datetime = true;
break;
case Recurrence::rDaily:
@@ -691,34 +694,34 @@ icalcomponent *ICalFormatImpl::writeAlarm(Alarm *alarm)
icalcomponent_add_property(a,icalproperty_new_attach(attach));
if (!alarm->programArguments().isEmpty()) {
icalcomponent_add_property(a,icalproperty_new_description(alarm->programArguments().utf8()));
}
icalattach_unref( attach );
break;
case Alarm::Audio:
action = ICAL_ACTION_AUDIO;
if (!alarm->audioFile().isEmpty()) {
attach = icalattach_new_from_url(QFile::encodeName( alarm->audioFile() ).data());
icalcomponent_add_property(a,icalproperty_new_attach(attach));
icalattach_unref( attach );
}
break;
case Alarm::Email: {
action = ICAL_ACTION_EMAIL;
- QValueList<Person> addresses = alarm->mailAddresses();
- for (QValueList<Person>::Iterator ad = addresses.begin(); ad != addresses.end(); ++ad) {
+ Q3ValueList<Person> addresses = alarm->mailAddresses();
+ for (Q3ValueList<Person>::Iterator ad = addresses.begin(); ad != addresses.end(); ++ad) {
icalproperty *p = icalproperty_new_attendee("MAILTO:" + (*ad).email().utf8());
if (!(*ad).name().isEmpty()) {
icalproperty_add_parameter(p,icalparameter_new_cn((*ad).name().utf8()));
}
icalcomponent_add_property(a,p);
}
icalcomponent_add_property(a,icalproperty_new_summary(alarm->mailSubject().utf8()));
icalcomponent_add_property(a,icalproperty_new_description(alarm->text().utf8()));
QStringList attachments = alarm->mailAttachments();
if (attachments.count() > 0) {
for (QStringList::Iterator at = attachments.begin(); at != attachments.end(); ++at) {
attach = icalattach_new_from_url(QFile::encodeName( *at ).data());
icalcomponent_add_property(a,icalproperty_new_attach(attach));
icalattach_unref( attach );
}
}
@@ -750,34 +753,34 @@ icalcomponent *ICalFormatImpl::writeAlarm(Alarm *alarm)
offset = alarm->endOffset();
trigger.duration = icaldurationtype_from_int( offset.asSeconds() );
}
icalproperty *p = icalproperty_new_trigger(trigger);
if ( alarm->hasEndOffset() )
icalproperty_add_parameter(p,icalparameter_new_related(ICAL_RELATED_END));
icalcomponent_add_property(a,p);
// Repeat count and duration
if (alarm->repeatCount()) {
icalcomponent_add_property(a,icalproperty_new_repeat(alarm->repeatCount()));
icalcomponent_add_property(a,icalproperty_new_duration(
icaldurationtype_from_int(alarm->snoozeTime()*60)));
}
// Custom properties
- QMap<QCString, QString> custom = alarm->customProperties();
- for (QMap<QCString, QString>::Iterator c = custom.begin(); c != custom.end(); ++c) {
+ QMap<Q3CString, QString> custom = alarm->customProperties();
+ for (QMap<Q3CString, QString>::Iterator c = custom.begin(); c != custom.end(); ++c) {
icalproperty *p = icalproperty_new_x(c.data().utf8());
icalproperty_set_x_name(p,c.key());
icalcomponent_add_property(a,p);
}
return a;
}
Todo *ICalFormatImpl::readTodo(icalcomponent *vtodo)
{
Todo *todo = new Todo;
readIncidence(vtodo,todo);
icalproperty *p = icalcomponent_get_first_property(vtodo,ICAL_ANY_PROPERTY);
@@ -1326,33 +1329,33 @@ void ICalFormatImpl::readIncidenceBase(icalcomponent *parent,IncidenceBase *inci
incidenceBase->addAttendee(readAttendee(p));
break;
default:
break;
}
p = icalcomponent_get_next_property(parent,ICAL_ANY_PROPERTY);
}
// custom properties
readCustomProperties(parent, incidenceBase);
}
void ICalFormatImpl::readCustomProperties(icalcomponent *parent,CustomProperties *properties)
{
- QMap<QCString, QString> customProperties;
+ QMap<Q3CString, QString> customProperties;
icalproperty *p = icalcomponent_get_first_property(parent,ICAL_X_PROPERTY);
while (p) {
QString value = QString::fromUtf8(icalproperty_get_x(p));
customProperties[icalproperty_get_x_name(p)] = value;
//qDebug("ICalFormatImpl::readCustomProperties %s %s",value.latin1(), icalproperty_get_x_name(p) );
p = icalcomponent_get_next_property(parent,ICAL_X_PROPERTY);
}
properties->setCustomProperties(customProperties);
}
void ICalFormatImpl::readRecurrenceRule(struct icalrecurrencetype rrule,Incidence *incidence)
{
diff --git a/libkcal/icalformatimpl.h b/libkcal/icalformatimpl.h
index 203c302..3a35b4c 100644
--- a/libkcal/icalformatimpl.h
+++ b/libkcal/icalformatimpl.h
@@ -8,32 +8,34 @@
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 ICALFORMATIMPL_H
#define ICALFORMATIMPL_H
#include <qstring.h>
+//Added by qt3to4:
+#include <Q3PtrList>
#include "scheduler.h"
#include "freebusy.h"
extern "C" {
#include <ical.h>
#include <icalss.h>
}
namespace KCal {
class Compat;
/**
This class provides the libical dependent functions for ICalFormat.
*/
@@ -80,30 +82,30 @@ class ICalFormatImpl {
icalcomponent *createCalendarComponent(Calendar * = 0);
icalcomponent *createScheduleComponent(IncidenceBase *,Scheduler::Method);
private:
void writeIncidenceBase(icalcomponent *parent,IncidenceBase *);
void readIncidenceBase(icalcomponent *parent,IncidenceBase *);
void writeCustomProperties(icalcomponent *parent,CustomProperties *);
void readCustomProperties(icalcomponent *parent,CustomProperties *);
void dumpIcalRecurrence(icalrecurrencetype);
ICalFormat *mParent;
Calendar *mCalendar;
QString mLoadedProductId; // PRODID string loaded from calendar file
int mCalendarVersion; // determines backward compatibility mode on read
- QPtrList<Event> mEventsRelate; // events with relations
- QPtrList<Todo> mTodosRelate; // todos with relations
+ Q3PtrList<Event> mEventsRelate; // events with relations
+ Q3PtrList<Todo> mTodosRelate; // todos with relations
static const int mSecondsPerWeek;
static const int mSecondsPerDay;
static const int mSecondsPerHour;
static const int mSecondsPerMinute;
Compat *mCompat;
};
}
#endif
diff --git a/libkcal/imipscheduler.cpp b/libkcal/imipscheduler.cpp
index e186f8e..e6d56a6 100644
--- a/libkcal/imipscheduler.cpp
+++ b/libkcal/imipscheduler.cpp
@@ -13,46 +13,48 @@
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.
*/
//
// IMIPScheduler - iMIP implementation of iTIP methods
//
#include "event.h"
#include "icalformat.h"
#include "imipscheduler.h"
+//Added by qt3to4:
+#include <Q3PtrList>
using namespace KCal;
IMIPScheduler::IMIPScheduler(Calendar *calendar)
: Scheduler(calendar)
{
}
IMIPScheduler::~IMIPScheduler()
{
}
bool IMIPScheduler::publish (IncidenceBase *incidence,const QString &recipients)
{
return false;
}
bool IMIPScheduler::performTransaction(IncidenceBase *incidence,Method method)
{
mFormat->createScheduleMessage(incidence,method);
return false;
}
-QPtrList<ScheduleMessage> IMIPScheduler::retrieveTransactions()
+Q3PtrList<ScheduleMessage> IMIPScheduler::retrieveTransactions()
{
- QPtrList<ScheduleMessage> messageList;
+ Q3PtrList<ScheduleMessage> messageList;
return messageList;
}
diff --git a/libkcal/imipscheduler.h b/libkcal/imipscheduler.h
index f142060..5a2d38e 100644
--- a/libkcal/imipscheduler.h
+++ b/libkcal/imipscheduler.h
@@ -10,40 +10,40 @@
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 IMIPSCHEDULER_H
#define IMIPSCHEDULER_H
//
// iMIP implementation of iTIP methods
//
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include "scheduler.h"
namespace KCal {
/*
This class implements the iTIP interface using the email interface specified
as iMIP.
*/
class IMIPScheduler : public Scheduler {
public:
IMIPScheduler(Calendar *);
virtual ~IMIPScheduler();
bool publish (IncidenceBase *incidence,const QString &recipients);
bool performTransaction(IncidenceBase *incidence,Method method);
- QPtrList<ScheduleMessage> retrieveTransactions();
+ Q3PtrList<ScheduleMessage> retrieveTransactions();
};
}
#endif // IMIPSCHEDULER_H
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp
index 7dd9bd2..8fcdc69 100644
--- a/libkcal/incidence.cpp
+++ b/libkcal/incidence.cpp
@@ -13,32 +13,34 @@
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 <kglobal.h>
#include <klocale.h>
#include <kdebug.h>
#include "calformat.h"
#include "incidence.h"
#include "todo.h"
+//Added by qt3to4:
+#include <Q3PtrList>
using namespace KCal;
Incidence::Incidence() :
IncidenceBase(),
mRelatedTo(0), mSecrecy(SecrecyPublic), mPriority(3)
{
mRecurrence = 0;//new Recurrence(this);
mCancelled = false;
recreate();
mHasStartDate = true;
mAlarms.setAutoDelete(true);
mAttachments.setAutoDelete(true);
mHasRecurrenceID = false;
mHoliday = false;
mBirthday = false;
@@ -46,72 +48,72 @@ Incidence::Incidence() :
}
Incidence::Incidence( const Incidence &i ) : IncidenceBase( i )
{
// TODO: reenable attributes currently commented out.
mRevision = i.mRevision;
mCreated = i.mCreated;
mDescription = i.mDescription;
mSummary = i.mSummary;
mCategories = i.mCategories;
// Incidence *mRelatedTo; Incidence *mRelatedTo;
mRelatedTo = 0;
mRelatedToUid = i.mRelatedToUid;
// QPtrList<Incidence> mRelations; QPtrList<Incidence> mRelations;
mExDates = i.mExDates;
- QPtrListIterator<Attachment> itat( i.mAttachments );
+ Q3PtrListIterator<Attachment> itat( i.mAttachments );
Attachment *at;
while( (at = itat.current()) ) {
Attachment *a = new Attachment( *at );
mAttachments.append( a );
++itat;
}
mAttachments.setAutoDelete( true );
mResources = i.mResources;
mSecrecy = i.mSecrecy;
mPriority = i.mPriority;
mLocation = i.mLocation;
mCancelled = i.mCancelled;
mHasStartDate = i.mHasStartDate;
- QPtrListIterator<Alarm> it( i.mAlarms );
+ Q3PtrListIterator<Alarm> it( i.mAlarms );
const Alarm *a;
while( (a = it.current()) ) {
Alarm *b = new Alarm( *a );
b->setParent( this );
mAlarms.append( b );
++it;
}
mAlarms.setAutoDelete(true);
mHasRecurrenceID = i.mHasRecurrenceID;
mRecurrenceID = i.mRecurrenceID;
if ( i.mRecurrence )
mRecurrence = new Recurrence( *(i.mRecurrence), this );
else
mRecurrence = 0;
mHoliday = i.mHoliday ;
mBirthday = i.mBirthday;
mAnniversary = i.mAnniversary;
}
Incidence::~Incidence()
{
Incidence *ev;
- QPtrList<Incidence> Relations = relations();
+ Q3PtrList<Incidence> Relations = relations();
for (ev=Relations.first();ev;ev=Relations.next()) {
if (ev->relatedTo() == this) ev->setRelatedTo(0);
}
if (relatedTo()) relatedTo()->removeRelation(this);
if ( mRecurrence )
delete mRecurrence;
}
QString Incidence::durationText()
{
return "---";
}
QString Incidence::durationText4Time( int offset )
{
int min = offset/60;
int hours = min /60;
@@ -203,34 +205,34 @@ static bool stringCompare( const QString& s1, const QString& s2 )
}
bool KCal::operator==( const Incidence& i1, const Incidence& i2 )
{
if( i1.alarms().count() != i2.alarms().count() ) {
return false; // no need to check further
}
if ( i1.alarms().count() > 0 ) {
if ( !( *(i1.alarms().first()) == *(i2.alarms().first())) )
{
qDebug("alarm not equal ");
return false;
}
}
#if 0
- QPtrListIterator<Alarm> a1( i1.alarms() );
- QPtrListIterator<Alarm> a2( i2.alarms() );
+ Q3PtrListIterator<Alarm> a1( i1.alarms() );
+ Q3PtrListIterator<Alarm> a2( i2.alarms() );
for( ; a1.current() && a2.current(); ++a1, ++a2 ) {
if( *a1.current() == *a2.current() ) {
continue;
}
else {
return false;
}
}
#endif
if ( i1.hasRecurrenceID() == i2.hasRecurrenceID() ) {
if ( i1.hasRecurrenceID() ) {
if ( i1.recurrenceID() != i2.recurrenceID() )
return false;
}
@@ -309,33 +311,33 @@ Incidence* Incidence::recreateCloneException( QDate d )
void Incidence::recreate()
{
setCreated(QDateTime::currentDateTime());
setUid(CalFormat::createUniqueId());
setRevision(0);
setIDStr( ":" );
setLastModified(QDateTime::currentDateTime());
}
void Incidence::cloneRelations( Incidence * newInc )
{
// newInc is already a clone of this incidence
Incidence * inc;
Incidence * cloneInc;
- QPtrList<Incidence> Relations = relations();
+ Q3PtrList<Incidence> Relations = relations();
for (inc=Relations.first();inc;inc=Relations.next()) {
cloneInc = inc->clone();
cloneInc->recreate();
cloneInc->setRelatedTo( newInc );
inc->cloneRelations( cloneInc );
}
}
void Incidence::setReadOnly( bool readOnly )
{
IncidenceBase::setReadOnly( readOnly );
if ( mRecurrence )
mRecurrence->setRecurReadOnly( readOnly);
}
void Incidence::setLastModifiedSubInvalid()
{
mLastModifiedSub = QDateTime();
@@ -343,33 +345,33 @@ void Incidence::setLastModifiedSubInvalid()
mRelatedTo->setLastModifiedSubInvalid();
}
QString Incidence::lastModifiedSubSortKey() const
{
if ( mLastModifiedSubSortKey.isEmpty() )
return lastModifiedSortKey();
return mLastModifiedSubSortKey;
}
QDateTime Incidence::lastModifiedSub()
{
if ( !mRelations.count() )
return lastModified();
if ( mLastModifiedSub.isValid() )
return mLastModifiedSub;
mLastModifiedSub = lastModified();
Incidence * inc;
- QPtrList<Incidence> Relations = relations();
+ Q3PtrList<Incidence> Relations = relations();
for (inc=Relations.first();inc;inc=Relations.next()) {
if ( inc->lastModifiedSub() > mLastModifiedSub )
mLastModifiedSub = inc->lastModifiedSub();
}
mLastModifiedSubSortKey.sprintf("%04d%02d%02d%02d%02d%02d",
mLastModifiedSub.date().year(),
mLastModifiedSub.date().month(),
mLastModifiedSub.date().day(),
mLastModifiedSub.time().hour(),
mLastModifiedSub.time().minute(),
mLastModifiedSub.time().second() );
return mLastModifiedSub;
}
void Incidence::setCreated(QDateTime created)
{
if (mReadOnly) return;
@@ -434,48 +436,48 @@ void Incidence::checkCategories()
mBirthday = mCategories.contains("Birthday") || mCategories.contains(i18n("Birthday"));
mAnniversary = mCategories.contains("Anniversary") || mCategories.contains(i18n("Anniversary"));
}
void Incidence::addCategories(const QStringList &categories, bool addToRelations ) //addToRelations = false
{
if (mReadOnly) return;
int i;
for( i = 0; i < categories.count(); ++i ) {
if ( !mCategories.contains (categories[i]))
mCategories.append( categories[i] );
}
checkCategories();
updated();
if ( addToRelations ) {
Incidence * inc;
- QPtrList<Incidence> Relations = relations();
+ Q3PtrList<Incidence> Relations = relations();
for (inc=Relations.first();inc;inc=Relations.next()) {
inc->addCategories( categories, true );
}
}
}
void Incidence::setCategories(const QStringList &categories, bool setForRelations ) //setForRelations = false
{
if (mReadOnly) return;
mCategories = categories;
checkCategories();
updated();
if ( setForRelations ) {
Incidence * inc;
- QPtrList<Incidence> Relations = relations();
+ Q3PtrList<Incidence> Relations = relations();
for (inc=Relations.first();inc;inc=Relations.next()) {
inc->setCategories( categories, true );
}
}
}
// TODO: remove setCategories(QString) function
void Incidence::setCategories(const QString &catStr)
{
if (mReadOnly) return;
mCategories.clear();
if (catStr.isEmpty()) return;
mCategories = QStringList::split(",",catStr);
@@ -537,41 +539,41 @@ void Incidence::setRelatedTo(Incidence *relatedTo)
mRelatedTo->removeRelation(this);
}
mRelatedTo = relatedTo;
if (mRelatedTo) {
mRelatedTo->addRelation(this);
mRelatedToUid = mRelatedTo->uid();
} else {
mRelatedToUid = "";
}
}
Incidence *Incidence::relatedTo() const
{
return mRelatedTo;
}
-QPtrList<Incidence> Incidence::relations() const
+Q3PtrList<Incidence> Incidence::relations() const
{
return mRelations;
}
-void Incidence::addRelationsToList(QPtrList<Incidence> *rel)
+void Incidence::addRelationsToList(Q3PtrList<Incidence> *rel)
{
Incidence* inc;
- QPtrList<Incidence> Relations = relations();
+ Q3PtrList<Incidence> Relations = relations();
for (inc=Relations.first();inc;inc=Relations.next()) {
inc->addRelationsToList( rel );
}
if ( rel->findRef( this ) == -1 )
rel->append( this );
}
void Incidence::addRelation(Incidence *event)
{
setLastModifiedSubInvalid();
if( mRelations.findRef( event ) == -1 ) {
mRelations.append(event);
//updated();
}
}
@@ -634,41 +636,41 @@ void Incidence::addAttachment(Attachment *attachment)
void Incidence::deleteAttachment(Attachment *attachment)
{
mAttachments.removeRef(attachment);
}
void Incidence::deleteAttachments(const QString& mime)
{
Attachment *at = mAttachments.first();
while (at) {
if (at->mimeType() == mime)
mAttachments.remove();
else
at = mAttachments.next();
}
}
-QPtrList<Attachment> Incidence::attachments() const
+Q3PtrList<Attachment> Incidence::attachments() const
{
return mAttachments;
}
-QPtrList<Attachment> Incidence::attachments(const QString& mime) const
+Q3PtrList<Attachment> Incidence::attachments(const QString& mime) const
{
- QPtrList<Attachment> attachments;
- QPtrListIterator<Attachment> it( mAttachments );
+ Q3PtrList<Attachment> attachments;
+ Q3PtrListIterator<Attachment> it( mAttachments );
Attachment *at;
while ( (at = it.current()) ) {
if (at->mimeType() == mime)
attachments.append(at);
++it;
}
return attachments;
}
void Incidence::setResources(const QStringList &resources)
{
if (mReadOnly) return;
mResources = resources;
updated();
}
@@ -724,33 +726,33 @@ QString Incidence::secrecyName(int secrecy)
return i18n("Undefined");
break;
}
}
QStringList Incidence::secrecyList()
{
QStringList list;
list << secrecyName(SecrecyPublic);
list << secrecyName(SecrecyPrivate);
list << secrecyName(SecrecyConfidential);
return list;
}
-QPtrList<Alarm> Incidence::alarms() const
+Q3PtrList<Alarm> Incidence::alarms() const
{
return mAlarms;
}
Alarm* Incidence::newAlarm()
{
Alarm* alarm = new Alarm(this);
mAlarms.append(alarm);
// updated();
return alarm;
}
void Incidence::addAlarm(Alarm *alarm)
{
mAlarms.append(alarm);
updated();
@@ -758,33 +760,33 @@ void Incidence::addAlarm(Alarm *alarm)
void Incidence::removeAlarm(Alarm *alarm)
{
mAlarms.removeRef(alarm);
updated();
}
void Incidence::clearAlarms()
{
mAlarms.clear();
updated();
}
bool Incidence::isAlarmEnabled() const
{
Alarm* alarm;
- for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) {
+ for (Q3PtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) {
if (alarm->enabled())
return true;
}
return false;
}
#include <stdlib.h>
Recurrence *Incidence::recurrence()
{
if ( ! mRecurrence ) {
mRecurrence = new Recurrence(this);
mRecurrence->setRecurStart( dtStart() );
mRecurrence->setRecurReadOnly( isReadOnly());
//qDebug("creating new recurence ");
//abort();
}
return mRecurrence;
diff --git a/libkcal/incidence.h b/libkcal/incidence.h
index f89942f..2940129 100644
--- a/libkcal/incidence.h
+++ b/libkcal/incidence.h
@@ -12,33 +12,35 @@
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 INCIDENCE_H
#define INCIDENCE_H
//
// Incidence - base class of calendaring components
//
#include <qdatetime.h>
#include <qstringlist.h>
-#include <qvaluelist.h>
+#include <q3valuelist.h>
+//Added by qt3to4:
+#include <Q3PtrList>
#include "recurrence.h"
#include "alarm.h"
#include "attachment.h"
#include "listbase.h"
#include "incidencebase.h"
namespace KCal {
class Event;
class Todo;
class Journal;
/**
This class provides the base class common to all calendar components.
*/
@@ -100,33 +102,33 @@ class Incidence : public IncidenceBase
typedef ListBase<Incidence> List;
Incidence();
Incidence(const Incidence &);
~Incidence();
/**
Accept IncidenceVisitor. A class taking part in the visitor mechanism has to
provide this implementation:
<pre>
bool accept(Visitor &v) { return v.visit(this); }
</pre>
*/
virtual bool accept(Visitor &) { return false; }
virtual Incidence *clone() = 0;
virtual void cloneRelations( Incidence * );
- void addRelationsToList(QPtrList<Incidence> *rel);
+ void addRelationsToList(Q3PtrList<Incidence> *rel);
void clearRelations();
virtual QDateTime getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const = 0;
void setReadOnly( bool );
/**
Recreate event. The event is made a new unique event, but already stored
event information is preserved. Sets uniquie id, creation date, last
modification date and revision number.
*/
void recreate();
Incidence* recreateCloneException(QDate);
/** set creation date */
void setCreated(QDateTime);
/** return time and date of creation. */
QDateTime created() const;
@@ -164,91 +166,91 @@ class Incidence : public IncidenceBase
QString categoriesStrWithSpace();
/** point at some other event to which the event relates. This function should
* only be used when constructing a calendar before the related Event
* exists. */
void setRelatedToUid(const QString &);
/** what event does this one relate to? This function should
* only be used when constructing a calendar before the related Event
* exists. */
QString relatedToUid() const;
/** point at some other event to which the event relates */
void setRelatedTo(Incidence *relatedTo);
void resetRelatedTo();
/** what event does this one relate to? */
Incidence *relatedTo() const;
/** All events that are related to this event */
- QPtrList<Incidence> relations() const;
+ Q3PtrList<Incidence> relations() const;
/** Add an event which is related to this event */
void addRelation(Incidence *);
/** Remove event that is related to this event */
void removeRelation(Incidence *);
/** returns the list of dates which are exceptions to the recurrence rule */
DateList exDates() const;
/** sets the list of dates which are exceptions to the recurrence rule */
void setExDates(const DateList &_exDates);
void setExDates(const char *dates);
/** Add a date to the list of exceptions of the recurrence rule. */
void addExDate(const QDate &date);
/** returns true if there is an exception for this date in the recurrence
rule set, or false otherwise. */
bool isException(const QDate &qd) const;
/** add attachment to this event */
void addAttachment(Attachment *attachment);
/** remove and delete a specific attachment */
void deleteAttachment(Attachment *attachment);
/** remove and delete all attachments with this mime type */
void deleteAttachments(const QString& mime);
/** return list of all associated attachments */
- QPtrList<Attachment> attachments() const;
+ Q3PtrList<Attachment> attachments() const;
/** find a list of attachments with this mime type */
- QPtrList<Attachment> attachments(const QString& mime) const;
+ Q3PtrList<Attachment> attachments(const QString& mime) const;
/** sets the event's status the value specified. See the enumeration
* above for possible values. */
void setSecrecy(int);
/** return the event's secrecy. */
int secrecy() const;
/** return the event's secrecy in string format. */
QString secrecyStr() const;
/** return list of all availbale secrecy classes */
static QStringList secrecyList();
/** return human-readable name of secrecy class */
static QString secrecyName(int);
/** returns TRUE if the date specified is one on which the event will
* recur. */
bool recursOn(const QDate &qd) const;
// VEVENT and VTODO, but not VJOURNAL (move to EventBase class?):
/** set resources used, such as Office, Car, etc. */
void setResources(const QStringList &resources);
/** return list of current resources */
QStringList resources() const;
/** set the event's priority, 0 is undefined, 1 highest (decreasing order) */
void setPriority(int priority);
/** get the event's priority */
int priority() const;
/** All alarms that are associated with this incidence */
- QPtrList<Alarm> alarms() const;
+ Q3PtrList<Alarm> alarms() const;
/** Create a new alarm which is associated with this incidence */
Alarm* newAlarm();
/** Add an alarm which is associated with this incidence */
void addAlarm(Alarm*);
/** Remove an alarm that is associated with this incidence */
void removeAlarm(Alarm*);
/** Remove all alarms that are associated with this incidence */
void clearAlarms();
/** return whether any alarm associated with this incidence is enabled */
bool isAlarmEnabled() const;
/**
Return the recurrence rule associated with this incidence. If there is
none, returns an appropriate (non-0) object.
*/
Recurrence *recurrence();
@@ -275,53 +277,53 @@ class Incidence : public IncidenceBase
void setRecurrenceID(QDateTime);
QDateTime recurrenceID () const;
QDateTime dtStart() const;
bool isHoliday() const;
bool isBirthday() const;
bool isAnniversary() const;
QDateTime lastModifiedSub();
QString lastModifiedSubSortKey() const;
QString recurrenceText() const;
void setLastModifiedSubInvalid();
virtual QString durationText();
QString durationText4Time( int secs );
Recurrence *mRecurrence;
protected:
- QPtrList<Alarm> mAlarms;
- QPtrList<Incidence> mRelations;
+ Q3PtrList<Alarm> mAlarms;
+ Q3PtrList<Incidence> mRelations;
QDateTime mRecurrenceID;
bool mHasRecurrenceID;
private:
void checkCategories();
QString mLastModifiedSubSortKey;
bool mHoliday, mBirthday, mAnniversary;
int mRevision;
bool mCancelled;
// base components of jounal, event and todo
QDateTime mCreated;
QDateTime mLastModifiedSub;
QString mDescription;
QString mSummary;
QStringList mCategories;
Incidence *mRelatedTo;
QString mRelatedToUid;
DateList mExDates;
- QPtrList<Attachment> mAttachments;
+ Q3PtrList<Attachment> mAttachments;
QStringList mResources;
bool mHasStartDate; // if todo has associated start date
int mSecrecy;
int mPriority; // 1 = highest, 2 = less, etc.
//QPtrList<Alarm> mAlarms;
QString mLocation;
};
bool operator==( const Incidence&, const Incidence& );
}
#endif
diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp
index 56c0560..f11ec54 100644
--- a/libkcal/incidencebase.cpp
+++ b/libkcal/incidencebase.cpp
@@ -14,32 +14,34 @@
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 <kglobal.h>
#include <klocale.h>
#include <kdebug.h>
#include <kidmanager.h>
#include "calformat.h"
#include "syncdefines.h"
#include "incidencebase.h"
+//Added by qt3to4:
+#include <Q3PtrList>
using namespace KCal;
IncidenceBase::IncidenceBase() :
mReadOnly(false), mFloats(true), mDuration(0), mHasDuration(false),
mPilotId(0), mSyncStatus(SYNCMOD)
{
blockLastModified = false;
setUid(CalFormat::createUniqueId());
mOrganizer = "";
mFloats = false;
mDuration = 0;
mHasDuration = false;
mPilotId = 0;
mExternalId = ":";
mTempSyncStat = SYNC_TEMPSTATE_INITIAL;
@@ -51,33 +53,33 @@ IncidenceBase::IncidenceBase() :
}
IncidenceBase::IncidenceBase(const IncidenceBase &i) :
CustomProperties( i )
{
blockLastModified = false;
mReadOnly = i.mReadOnly;
mDtStart = i.mDtStart;
mDuration = i.mDuration;
mHasDuration = i.mHasDuration;
mOrganizer = i.mOrganizer;
mUid = i.mUid;
mCalEnabled = i.mCalEnabled;
mAlarmEnabled = i.mAlarmEnabled;
mCalID = i.mCalID;
- QPtrList<Attendee> attendees = i.attendees();
+ Q3PtrList<Attendee> attendees = i.attendees();
for( Attendee *a = attendees.first(); a; a = attendees.next() ) {
mAttendees.append( new Attendee( *a ) );
}
mFloats = i.mFloats;
mLastModified = i.mLastModified;
mPilotId = i.mPilotId;
mTempSyncStat = i.mTempSyncStat;
mSyncStatus = i.mSyncStatus;
mExternalId = i.mExternalId;
// The copied object is a new one, so it isn't observed by the observer
// of the original object.
mObservers.clear();
mAttendees.setAutoDelete( true );
}
@@ -287,33 +289,33 @@ bool IncidenceBase::doesFloat() const
}
void IncidenceBase::setFloats(bool f)
{
if (mReadOnly) return;
mFloats = f;
updated();
}
bool IncidenceBase::addAttendee(Attendee *a, bool doupdate)
{
if (mReadOnly) return false;
if (a->name().left(7).upper() == "MAILTO:")
a->setName(a->name().remove(0,7));
- QPtrListIterator<Attendee> qli(mAttendees);
+ Q3PtrListIterator<Attendee> qli(mAttendees);
qli.toFirst();
while (qli) {
if (*qli.current() == *a)
return false;
++qli;
}
mAttendees.append(a);
if (doupdate) updated();
return true;
}
#if 0
void IncidenceBase::removeAttendee(Attendee *a)
{
if (mReadOnly) return;
@@ -330,60 +332,60 @@ void IncidenceBase::removeAttendee(const char *n)
if (a->getName() == n) {
mAttendees.remove();
break;
}
}
#endif
void IncidenceBase::clearAttendees()
{
if (mReadOnly) return;
mAttendees.clear();
}
#if 0
Attendee *IncidenceBase::getAttendee(const char *n) const
{
- QPtrListIterator<Attendee> qli(mAttendees);
+ Q3PtrListIterator<Attendee> qli(mAttendees);
qli.toFirst();
while (qli) {
if (qli.current()->getName() == n)
return qli.current();
++qli;
}
return 0L;
}
#endif
Attendee *IncidenceBase::attendeeByMail(const QString &email)
{
- QPtrListIterator<Attendee> qli(mAttendees);
+ Q3PtrListIterator<Attendee> qli(mAttendees);
qli.toFirst();
while (qli) {
if (qli.current()->email().lower() == email.lower())
return qli.current();
++qli;
}
return 0L;
}
Attendee *IncidenceBase::attendeeByMails(const QStringList &emails, const QString& email)
{
- QPtrListIterator<Attendee> qli(mAttendees);
+ Q3PtrListIterator<Attendee> qli(mAttendees);
QStringList mails = emails;
if (!email.isEmpty()) {
mails.append(email);
}
qli.toFirst();
while (qli) {
for ( QStringList::Iterator it = mails.begin(); it != mails.end(); ++it ) {
if (qli.current()->email().lower() == (*it).lower())
return qli.current();
}
++qli;
}
return 0L;
}
@@ -478,23 +480,23 @@ void IncidenceBase::setIDStr( const QString & s )
QString IncidenceBase::IDStr() const
{
return mExternalId ;
}
void IncidenceBase::registerObserver( IncidenceBase::Observer *observer )
{
if( !mObservers.contains(observer) ) mObservers.append( observer );
}
void IncidenceBase::unRegisterObserver( IncidenceBase::Observer *observer )
{
mObservers.remove( observer );
}
void IncidenceBase::updated()
{
- QPtrListIterator<Observer> it(mObservers);
+ Q3PtrListIterator<Observer> it(mObservers);
while( it.current() ) {
Observer *o = it.current();
++it;
o->incidenceUpdated( this );
}
}
diff --git a/libkcal/incidencebase.h b/libkcal/incidencebase.h
index 3edc03b..d97f524 100644
--- a/libkcal/incidencebase.h
+++ b/libkcal/incidencebase.h
@@ -12,59 +12,61 @@
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_INCIDENCEBASE_H
#define KCAL_INCIDENCEBASE_H
//
// Incidence - base class of calendaring components
//
#include <qdatetime.h>
#include <qstringlist.h>
-#include <qvaluelist.h>
-#include <qptrlist.h>
+#include <q3valuelist.h>
+#include <q3ptrlist.h>
+//Added by qt3to4:
+#include <Q3CString>
#include "customproperties.h"
#include "attendee.h"
namespace KCal {
-typedef QValueList<QDate> DateList;
+typedef Q3ValueList<QDate> DateList;
enum IncTypeID { eventID,todoID,journalID,freebusyID };
/**
This class provides the base class common to all calendar components.
*/
class IncidenceBase : public CustomProperties
{
public:
class Observer {
public:
virtual void incidenceUpdated( IncidenceBase * ) = 0;
};
IncidenceBase();
IncidenceBase(const IncidenceBase &);
virtual ~IncidenceBase();
- virtual QCString type() const = 0;
+ virtual Q3CString type() const = 0;
virtual IncTypeID typeID() const = 0;
/** Set the unique id for the event */
void setUid(const QString &);
/** Return the unique id for the event */
QString uid() const;
/** Sets the time the incidence was last modified. */
void setLastModified(const QDateTime &lm);
/** Return the time the incidence was last modified. */
QDateTime lastModified() const;
QString lastModifiedSortKey() const;
/** sets the organizer for the event */
void setOrganizer(const QString &o);
QString organizer() const;
@@ -96,33 +98,33 @@ class IncidenceBase : public CustomProperties
/** Return true or false depending on whether the incidence "floats,"
* i.e. has a date but no time attached to it. */
bool doesFloat() const;
/** Set whether the incidence floats, i.e. has a date but no time attached to it. */
void setFloats(bool f);
/**
Add Attendee to this incidence. IncidenceBase takes ownership of the
Attendee object.
*/
bool addAttendee(Attendee *a, bool doupdate=true );
// void removeAttendee(Attendee *a);
// void removeAttendee(const char *n);
/** Remove all Attendees. */
void clearAttendees();
/** Return list of attendees. */
- QPtrList<Attendee> attendees() const { return mAttendees; };
+ Q3PtrList<Attendee> attendees() const { return mAttendees; };
/** Return number of attendees. */
int attendeeCount() const { return mAttendees.count(); };
/** Return the Attendee with this email */
Attendee* attendeeByMail(const QString &);
/** Return first Attendee with one of this emails */
Attendee* attendeeByMails(const QStringList &, const QString& email = QString::null);
/** pilot syncronization states */
enum { SYNCNONE = 0, SYNCMOD = 1, SYNCDEL = 3 };
/** Set synchronisation satus. */
void setSyncStatus(int stat);
/** Return synchronisation status. */
int syncStatus() const;
/** Set Pilot Id. */
void setPilotId(int id);
@@ -155,36 +157,36 @@ class IncidenceBase : public CustomProperties
protected:
bool blockLastModified;
bool mIsTagged;
QDateTime mDtStart;
bool mReadOnly;
QDateTime getEvenTime( QDateTime );
private:
// base components
QString mOrganizer;
QString mLastModifiedKey;
QString mUid;
int mCalID;
bool mCalEnabled;
bool mAlarmEnabled;
QDateTime mLastModified;
- QPtrList<Attendee> mAttendees;
+ Q3PtrList<Attendee> mAttendees;
bool mFloats;
int mDuration;
bool mHasDuration;
QString mExternalId;
int mTempSyncStat;
// PILOT SYNCHRONIZATION STUFF
int mPilotId; // unique id for pilot sync
int mSyncStatus; // status (for sync)
- QPtrList<Observer> mObservers;
+ Q3PtrList<Observer> mObservers;
};
bool operator==( const IncidenceBase&, const IncidenceBase& );
}
#endif
diff --git a/libkcal/journal.h b/libkcal/journal.h
index 1cd0a22..c83356f 100644
--- a/libkcal/journal.h
+++ b/libkcal/journal.h
@@ -11,41 +11,43 @@
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 JOURNAL_H
#define JOURNAL_H
//
// Journal component, representing a VJOURNAL object
//
#include "incidence.h"
+//Added by qt3to4:
+#include <Q3CString>
namespace KCal {
/**
This class provides a Journal in the sense of RFC2445.
*/
class Journal : public Incidence
{
public:
Journal();
~Journal();
- QCString type() const { return "Journal"; }
+ Q3CString type() const { return "Journal"; }
IncTypeID typeID() const { return journalID; }
Incidence *clone();
QDateTime getNextAlarmDateTime( bool * ok, int * offset ,QDateTime start_dt ) const;
private:
bool accept(Visitor &v) { return v.visit(this); }
};
bool operator==( const Journal&, const Journal& );
}
#endif
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp
index 733b897..bce68b0 100644
--- a/libkcal/kincidenceformatter.cpp
+++ b/libkcal/kincidenceformatter.cpp
@@ -1,22 +1,24 @@
#include "kincidenceformatter.h"
#include <kstaticdeleter.h>
#include <kglobal.h>
#include <klocale.h>
#ifdef DEKTOP_VERSION
#include <kabc/stdaddressbook.h>
+//Added by qt3to4:
+#include <Q3PtrList>
#define size count
#endif
KIncidenceFormatter* KIncidenceFormatter::mInstance = 0;
static KStaticDeleter<KIncidenceFormatter> insd;
QString KIncidenceFormatter::getFormattedText( Incidence * inc, bool details, bool created , bool modified )
{
// #ifndef QT_NO_INPUTDIALOG
// return QInputDialog::getItem( caption, label, items, current, editable );
// #else
// return QString::null;
// #endif
mDetails = details;
mCreated = created ;
mModified = modified;
@@ -297,85 +299,85 @@ void KIncidenceFormatter::setTodo(Todo *event )
}
void KIncidenceFormatter::setJournal(Journal* )
{
}
void KIncidenceFormatter::formatCategories(Incidence *event)
{
if (!event->categoriesStr().isEmpty()) {
addTag("p",i18n("<b>Categories: </b>")+event->categoriesStrWithSpace() );
//mText.append(event->categoriesStr());
}
}
void KIncidenceFormatter::addTag(const QString & tag,const QString & text)
{
- int number=text.contains("\n");
+ int number=text.count("\n");
QString str = "<" + tag + ">";
QString tmpText=text;
QString tmpStr=str;
if(number !=-1)
{
if (number > 0) {
int pos=0;
QString tmp;
for(int i=0;i<=number;i++) {
pos=tmpText.find("\n");
tmp=tmpText.left(pos);
tmpText=tmpText.right(tmpText.length()-pos-1);
tmpStr+=tmp+"<br>";
}
}
else tmpStr += tmpText;
tmpStr+="</" + tag + ">";
mText.append(tmpStr);
}
else
{
str += text + "</" + tag + ">";
mText.append(str);
}
}
void KIncidenceFormatter::formatAttendees(Incidence *event)
{
- QPtrList<Attendee> attendees = event->attendees();
+ Q3PtrList<Attendee> attendees = event->attendees();
if (attendees.count()) {
QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small);
QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small);
addTag("h3",i18n("Organizer"));
mText.append("<ul><li>");
#if 0
//ndef KORG_NOKABC
KABC::AddressBook *add_book = KABC::StdAddressBook::self();
KABC::Addressee::List addressList;
addressList = add_book->findByEmail(event->organizer());
KABC::Addressee o = addressList.first();
if (!o.isEmpty() && addressList.size()<2) {
mText += "<a href=\"uid:" + o.uid() + "\">";
mText += o.formattedName();
mText += "</a>\n";
} else {
mText.append(event->organizer());
}
#else
mText.append(event->organizer());
#endif
- if (iconPath) {
+ if (!iconPath.isEmpty()) {
mText += " <a href=\"mailto:" + event->organizer() + "\">";
mText += "<IMG src=\"" + iconPath + "\">";
mText += "</a>\n";
}
mText.append("</li></ul>");
addTag("h3",i18n("Attendees"));
Attendee *a;
mText.append("<ul>");
for(a=attendees.first();a;a=attendees.next()) {
#if 0
//ndef KORG_NOKABC
if (a->name().isEmpty()) {
addressList = add_book->findByEmail(a->email());
KABC::Addressee o = addressList.first();
if (!o.isEmpty() && addressList.size()<2) {
@@ -389,33 +391,33 @@ void KIncidenceFormatter::formatAttendees(Incidence *event)
}
} else {
mText += "<li><a href=\"uid:" + a->uid() + "\">";
if (!a->name().isEmpty()) mText += a->name();
else mText += a->email();
mText += "</a>\n";
}
#else
//qDebug("nokabc ");
mText += "<li><a href=\"uid:" + a->uid() + "\">";
if (!a->name().isEmpty()) mText += a->name();
else mText += a->email();
mText += "</a>\n";
#endif
if (!a->email().isEmpty()) {
- if (iconPath) {
+ if (!iconPath.isEmpty()) {
mText += "<a href=\"mailto:" + a->name() +" "+ "<" + a->email() + ">" + "\">";
if ( a->RSVP() )
mText += "<IMG src=\"" + iconPath + "\">";
else
mText += "<IMG src=\"" + NOiconPath + "\">";
mText += "</a>\n";
}
}
if (a->status() != Attendee::NeedsAction )
mText +="[" + a->statusStr() + "] ";
if (a->role() == Attendee::Chair )
mText +="(" + a->roleStr().left(1) + ".)";
}
mText.append("</li></ul>");
}
}
diff --git a/libkcal/libkcal.pro b/libkcal/libkcal.pro
index 33c63c3..1f43b10 100644
--- a/libkcal/libkcal.pro
+++ b/libkcal/libkcal.pro
@@ -1,19 +1,19 @@
TEMPLATE = lib
CONFIG += qt warn_on
-TARGET = microkcal
+TARGET = xmicrokcal
include( ../variables.pri )
INCLUDEPATH += ../libkdepim ../microkde versit ../microkde/kdecore
#../qtcompat
INCLUDEPATH += ../libical/src/libical
INCLUDEPATH += ../libical/src/libicalss
DESTDIR = ../bin
DEFINES += DESKTOP_VERSION
unix: {
LIBS += ../libical/lib/libical.a
LIBS += ../libical/lib/libicalss.a
OBJECTS_DIR = obj/unix
MOC_DIR = moc/unix
}
win32: {
@@ -93,16 +93,20 @@ SOURCES = \
incidence.cpp \
incidencebase.cpp \
journal.cpp \
period.cpp \
person.cpp \
qtopiaformat.cpp \
recurrence.cpp \
scheduler.cpp \
todo.cpp \
dndfactory.cpp \
vcaldrag.cpp \
vcalformat.cpp \
versit/vcc.c \
versit/vobject.c \
phoneformat.cpp \
+#The following line was inserted by qt3to4
+QT += xml qt3support
+#The following line was inserted by qt3to4
+QT +=
diff --git a/libkcal/libkcalE.pro b/libkcal/libkcalE.pro
index 737be53..fe46656 100644
--- a/libkcal/libkcalE.pro
+++ b/libkcal/libkcalE.pro
@@ -1,19 +1,19 @@
TEMPLATE = lib
CONFIG += qt warn_on
-TARGET = microkcal
+TARGET = xmicrokcal
INCLUDEPATH += ../libkdepim ../microkde ../qtcompat versit ../microkde/kdecore $(QPEDIR)/include
INCLUDEPATH += ../libical/src/libical
INCLUDEPATH += ../libical/src/libicalss
OBJECTS_DIR = obj/$(PLATFORM)
MOC_DIR = moc/$(PLATFORM)
DESTDIR = $(QPEDIR)/lib
#LIBS += ../libical/lib/$(PLATFORM)/libical.a
#LIBS += ../libical/lib/$(PLATFORM)/libicalss.a
LIBS += ../dest$(LIBICAL_PATH)/libical.a
LIBS += ../dest$(LIBICAL_PATH)/libicalss.a
INTERFACES = \
HEADERS = \
alarm.h \
diff --git a/libkcal/listbase.h b/libkcal/listbase.h
index 085b13d..6c942ef 100644
--- a/libkcal/listbase.h
+++ b/libkcal/listbase.h
@@ -8,90 +8,92 @@
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_LISTBASE_H
#define KCAL_LISTBASE_H
-#include <qvaluelist.h>
+#include <q3valuelist.h>
+//Added by qt3to4:
+#include <Q3PtrList>
namespace KCal {
class Event;
class Todo;
/**
This class provides a template for lists of pointers. It extends QValueList<T
*> by auto delete funtionality known from QPtrList.
*/
template<class T>
-class ListBase : public QValueList<T *>
+class ListBase : public Q3ValueList<T *>
{
public:
ListBase()
- : QValueList<T *>(), mAutoDelete( false )
+ : Q3ValueList<T *>(), mAutoDelete( false )
{
}
ListBase( const ListBase &l )
- : QValueList<T *>( l ), mAutoDelete( false )
+ : Q3ValueList<T *>( l ), mAutoDelete( false )
{
}
~ListBase()
{
if ( mAutoDelete ) {
- QValueListIterator<T *> it;
- for( it = QValueList<T*>::begin(); it != QValueList<T*>::end(); ++it ) {
+ Q3ValueListIterator<T *> it;
+ for( it = Q3ValueList<T*>::begin(); it != Q3ValueList<T*>::end(); ++it ) {
delete *it;
}
}
}
ListBase &operator=( const ListBase &l )
{
if ( this == &l ) return *this;
- QValueList<T *>::operator=( l );
+ Q3ValueList<T *>::operator=( l );
return *this;
}
void setAutoDelete( bool autoDelete )
{
mAutoDelete = autoDelete;
}
bool removeRef( T *t )
{
- QValueListIterator<T *> it = find( t );
- if ( it == QValueList<T*>::end() ) {
+ Q3ValueListIterator<T *> it = find( t );
+ if ( it == Q3ValueList<T*>::end() ) {
return false;
} else {
if ( mAutoDelete ) delete t;
remove( it );
return true;
}
}
- void fill ( QPtrList<T> list ) {
- QPtrListIterator<T> it (list);
+ void fill ( Q3PtrList<T> list ) {
+ Q3PtrListIterator<T> it (list);
T *item;
while ( (item = it.current()) != 0 ) {
append( item );
++it;
}
}
private:
bool mAutoDelete;
};
}
#endif
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp
index 900fc04..794e4b4 100644
--- a/libkcal/phoneformat.cpp
+++ b/libkcal/phoneformat.cpp
@@ -9,41 +9,42 @@
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 <qdatetime.h>
#include <qstring.h>
#include <qapplication.h>
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include <qregexp.h>
#include <qmessagebox.h>
#include <qclipboard.h>
#include <qfile.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <qtextcodec.h>
#include <qdir.h>
#include <qlabel.h>
+#include <QDesktopWidget>
#include <kdebug.h>
#include <klocale.h>
#include <kglobal.h>
#include <kmessagebox.h>
#include <phoneaccess.h>
#include "calendar.h"
#include "alarm.h"
#include "recurrence.h"
#include "calendarlocal.h"
#include "phoneformat.h"
#include "syncdefines.h"
using namespace KCal;
@@ -188,33 +189,33 @@ ulong PhoneFormat::getCsumEvent( Event* event )
days += 1 << (i-1);
}
}
list.append( QString::number( days ) );
}
//pending weekdays
writeEndDate = true;
break;
case Recurrence::rMonthlyPos:// 2
list.append( "2" );
list.append( QString::number( rec->frequency()) );//12
writeEndDate = true;
{
int count = 1;
- QPtrList<Recurrence::rMonthPos> rmp;
+ Q3PtrList<Recurrence::rMonthPos> rmp;
rmp = rec->monthPositions();
if ( rmp.first()->negative )
count = 5 - rmp.first()->rPos - 1;
else
count = rmp.first()->rPos - 1;
list.append( QString::number( count ) );
}
list.append( "0" );
break;
case Recurrence::rMonthlyDay:// 3
list.append( "3" );
list.append( QString::number( rec->frequency()) );//12
list.append( "0" );
list.append( "0" );
@@ -228,33 +229,33 @@ ulong PhoneFormat::getCsumEvent( Event* event )
writeEndDate = true;
break;
default:
list.append( "255" );
list.append( QString() );
list.append( "0" );
list.append( QString() );
list.append( "0" );
list.append( "20991231T000000" );
break;
}
if ( writeEndDate ) {
if ( rec->endDate().isValid() ) { // 15 + 16
list.append( "1" );
- list.append( PhoneParser::dtToString( rec->endDate()) );
+ list.append( PhoneParser::dtToString( (QDateTime)rec->endDate()) );
} else {
list.append( "0" );
list.append( "20991231T000000" );
}
}
attList << list.join("");
attList << event->categoriesStr();
//qDebug("csum cat %s", event->categoriesStr().latin1());
attList << event->secrecyStr();
return PhoneFormat::getCsum(attList );
}
ulong PhoneFormat::getCsum( const QStringList & attList)
{
int max = attList.count();
@@ -292,33 +293,33 @@ bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal)
QString fileName;
#ifdef DESKTOP_VERSION
fileName = locateLocal("tmp", "phonefile.vcs");
#else
fileName = "/tmp/phonefile.vcs";
#endif
QString command;
if ( ! PhoneAccess::readFromPhone( fileName )) {
return false;
}
VCalFormat vfload;
vfload.setLocalTime ( true );
qDebug("loading file ...");
if ( ! vfload.load( calendar, fileName ) )
return false;
- QPtrList<Event> er = calendar->rawEvents();
+ Q3PtrList<Event> er = calendar->rawEvents();
Event* ev = er.first();
qDebug("reading events... ");
while ( ev ) {
QStringList cat = ev->categories();
if ( cat.contains( "MeetingDEF" )) {
ev->setCategories( QStringList() );
} else
if ( cat.contains( "Birthday" )) {
ev->setFloats( true );
QDate da = ev->dtStart().date();
ev->setDtStart( QDateTime( da) );
ev->setDtEnd( QDateTime( da.addDays(1)) );
}
uint cSum;
cSum = PhoneFormat::getCsumEvent( ev );
@@ -327,33 +328,33 @@ bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal)
event = existingCal->event( mProfileName ,QString::number( id ) );
if ( event ) {
event = (Event*)event->clone();
copyEvent( event, ev );
calendar->deleteEvent( ev );
calendar->addEvent( event);
}
else
event = ev;
event->setCsum( mProfileName, QString::number( cSum ));
event->setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL );
event->setID( mProfileName,QString::number( id ) );
ev = er.next();
}
{
qDebug("reading todos... ");
- QPtrList<Todo> tr = calendar->rawTodos();
+ Q3PtrList<Todo> tr = calendar->rawTodos();
Todo* ev = tr.first();
while ( ev ) {
QStringList cat = ev->categories();
if ( cat.contains( "MeetingDEF" )) {
ev->setCategories( QStringList() );
}
int id = ev->pilotId();
uint cSum;
cSum = PhoneFormat::getCsumTodo( ev );
Todo *event;
event = existingCal->todo( mProfileName ,QString::number( id ) );
if ( event ) {
//qDebug("copy todo %s ", event->summary().latin1());
event = (Todo*)event->clone();
@@ -452,76 +453,76 @@ void PhoneFormat::copyTodo( Todo* to, Todo* from )
to->setCompleted( true );
if( from->completed().isValid() )
to->setCompleted( from->completed() );
} else {
// set percentcomplete only, if to->isCompleted()
if ( to->isCompleted() )
to->setPercentComplete(from->percentComplete());
}
if( to->priority() == 2 && from->priority() == 1 )
; //skip
else if (to->priority() == 4 && from->priority() == 5 )
;
else
to->setPriority(from->priority());
}
-#include <qcstring.h>
+#include <q3cstring.h>
void PhoneFormat::afterSave( Incidence* inc,const QString& id ,const QString& csum)
{
inc->setID( mProfileName, id );
inc->setCsum( mProfileName, csum);
inc->setTempSyncStat( SYNC_TEMPSTATE_NEW_ID );
}
bool PhoneFormat::writeToPhone( Calendar * calendar)
{
#ifdef DESKTOP_VERSION
QString fileName = locateLocal("tmp", "phonefile.vcs");
#else
QString fileName = "/tmp/phonefile.vcs";
#endif
VCalFormat vfsave;
vfsave.setLocalTime ( true );
QString id = calendar->timeZoneId();
calendar->setLocalTime();
if ( ! vfsave.save( calendar, fileName ) )
return false;
calendar->setTimeZoneId( id );
return PhoneAccess::writeToPhone( fileName );
}
bool PhoneFormat::save( Calendar *calendar)
{
// 1 remove events which should be deleted
- QPtrList<Event> er = calendar->rawEvents();
+ Q3PtrList<Event> er = calendar->rawEvents();
Event* ev = er.first();
while ( ev ) {
if ( ev->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) {
calendar->deleteEvent( ev );
} else {
}
ev = er.next();
}
// 2 remove todos which should be deleted
- QPtrList<Todo> tl = calendar->rawTodos();
+ Q3PtrList<Todo> tl = calendar->rawTodos();
Todo* to = tl.first();
while ( to ) {
if ( to->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) {
calendar->deleteTodo( to );
} else {
if ( to->isCompleted()) {
calendar->deleteTodo( to );
}
}
to = tl.next();
}
// 3 save file
if ( !writeToPhone( calendar ) )
return false;
QLabel status ( i18n(" Opening device ..."), 0 );
int w = status.sizeHint().width()+20 ;
@@ -539,61 +540,61 @@ bool PhoneFormat::save( Calendar *calendar)
message = i18n(" Rereading all data ... ");
status.setText ( message );
qApp->processEvents();
CalendarLocal* calendarTemp = new CalendarLocal();
calendarTemp->setTimeZoneId( calendar->timeZoneId());
if ( ! load( calendarTemp,calendar) ){
qDebug("error reloading calendar ");
delete calendarTemp;
return false;
}
// 6 compare data
//algo 6 compare event
er = calendar->rawEvents();
ev = er.first();
message = i18n(" Comparing event # ");
- QPtrList<Event> er1 = calendarTemp->rawEvents();
+ Q3PtrList<Event> er1 = calendarTemp->rawEvents();
Event* ev1;
int procCount = 0;
while ( ev ) {
//qDebug("event new ID %s",ev->summary().latin1());
status.setText ( message + QString::number ( ++procCount ) );
qApp->processEvents();
ev1 = er1.first();
while ( ev1 ) {
if ( ev->contains( ev1 ) ) {
afterSave( ev ,ev1->getID(mProfileName),ev1->getCsum(mProfileName));
er1.remove( ev1 );
break;
}
ev1 = er1.next();
}
if ( ! ev1 ) {
// ev->removeID(mProfileName);
qDebug("ERROR: No event found on phone for %s ", ev->summary().latin1());
}
ev = er.next();
}
//algo 6 compare todo
tl = calendar->rawTodos();
to = tl.first();
procCount = 0;
- QPtrList<Todo> tl1 = calendarTemp->rawTodos();
+ Q3PtrList<Todo> tl1 = calendarTemp->rawTodos();
Todo* to1 ;
message = i18n(" Comparing todo # ");
while ( to ) {
status.setText ( message + QString::number ( ++procCount ) );
qApp->processEvents();
Todo* to1 = tl1.first();
while ( to1 ) {
if ( to->contains( to1 ) ) {
afterSave( to ,to1->getID(mProfileName),to1->getCsum(mProfileName));
tl1.remove( to1 );
break;
}
to1 = tl1.next();
}
if ( ! to1 ) {
//to->removeID(mProfileName);
diff --git a/libkcal/qtopiaformat.cpp b/libkcal/qtopiaformat.cpp
index 0a4a031..2dfe1a4 100644
--- a/libkcal/qtopiaformat.cpp
+++ b/libkcal/qtopiaformat.cpp
@@ -8,37 +8,37 @@
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 <qdatetime.h>
#include <qstring.h>
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include <qregexp.h>
#include <qclipboard.h>
#include <qfile.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <qxml.h>
#include <kdebug.h>
#include <klocale.h>
#include "calendar.h"
#include "calendarlocal.h"
#include "qtopiaformat.h"
using namespace KCal;
class QtopiaParser : public QXmlDefaultHandler
{
public:
QtopiaParser( Calendar *calendar ) : mCalendar( calendar ) {
@@ -296,38 +296,38 @@ bool QtopiaFormat::load( Calendar *calendar, const QString &fileName )
reader.setContentHandler( &handler );
return reader.parse( source );
}
bool QtopiaFormat::save( Calendar *calendar, const QString &fileName )
{
clearException();
QString text = toString( calendar );
if ( text.isNull() ) return false;
// TODO: write backup file
QFile file( fileName );
- if (!file.open( IO_WriteOnly ) ) {
+ if (!file.open( QIODevice::WriteOnly ) ) {
setException(new ErrorFormat(ErrorFormat::SaveError,
i18n("Could not open file '%1'").arg(fileName)));
return false;
}
- QTextStream ts( &file );
+ Q3TextStream ts( &file );
ts << text;
file.close();
return true;
}
bool QtopiaFormat::fromString( Calendar *, const QString & )
{
return false;
}
QString QtopiaFormat::toString( Calendar * )
{
return QString::null;
}
diff --git a/libkcal/recurrence.cpp b/libkcal/recurrence.cpp
index 6ee5499..9a4e540 100644
--- a/libkcal/recurrence.cpp
+++ b/libkcal/recurrence.cpp
@@ -16,86 +16,89 @@
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 <limits.h>
#include <kdebug.h>
#include <kglobal.h>
#include <klocale.h>
#include "incidence.h"
#include "recurrence.h"
+//Added by qt3to4:
+#include <Q3ValueList>
+#include <Q3PtrList>
using namespace KCal;
Recurrence::Feb29Type Recurrence::mFeb29YearlyDefaultType = Recurrence::rMar1;
Recurrence::Recurrence(Incidence *parent, int compatVersion)
: recurs(rNone), // by default, it's not a recurring event
rWeekStart(1), // default is Monday
rDays(7),
mFloats(parent ? parent->doesFloat() : false),
mRecurReadOnly(false),
mRecurExDatesCount(0),
mFeb29YearlyType(mFeb29YearlyDefaultType),
mCompatVersion(compatVersion ? compatVersion : INT_MAX),
mCompatRecurs(rNone),
mCompatDuration(0),
mParent(parent)
{
rMonthDays.setAutoDelete( true );
rMonthPositions.setAutoDelete( true );
rYearNums.setAutoDelete( true );
}
Recurrence::Recurrence(const Recurrence &r, Incidence *parent)
: recurs(r.recurs),
rWeekStart(r.rWeekStart),
- rDays(r.rDays.copy()),
+ rDays(r.rDays),
rFreq(r.rFreq),
rDuration(r.rDuration),
rEndDateTime(r.rEndDateTime),
mRecurStart(r.mRecurStart),
mFloats(r.mFloats),
mRecurReadOnly(r.mRecurReadOnly),
mRecurExDatesCount(r.mRecurExDatesCount),
mFeb29YearlyType(r.mFeb29YearlyType),
mCompatVersion(r.mCompatVersion),
mCompatRecurs(r.mCompatRecurs),
mCompatDuration(r.mCompatDuration),
mParent(parent)
{
- for (QPtrListIterator<rMonthPos> mp(r.rMonthPositions); mp.current(); ++mp) {
+ for (Q3PtrListIterator<rMonthPos> mp(r.rMonthPositions); mp.current(); ++mp) {
rMonthPos *tmp = new rMonthPos;
tmp->rPos = mp.current()->rPos;
tmp->negative = mp.current()->negative;
- tmp->rDays = mp.current()->rDays.copy();
+ tmp->rDays = mp.current()->rDays;
rMonthPositions.append(tmp);
}
- for (QPtrListIterator<int> md(r.rMonthDays); md.current(); ++md) {
+ for (Q3PtrListIterator<int> md(r.rMonthDays); md.current(); ++md) {
int *tmp = new int;
*tmp = *md.current();
rMonthDays.append(tmp);
}
- for (QPtrListIterator<int> yn(r.rYearNums); yn.current(); ++yn) {
+ for (Q3PtrListIterator<int> yn(r.rYearNums); yn.current(); ++yn) {
int *tmp = new int;
*tmp = *yn.current();
rYearNums.append(tmp);
}
rMonthDays.setAutoDelete( true );
rMonthPositions.setAutoDelete( true );
rYearNums.setAutoDelete( true );
}
Recurrence::~Recurrence()
{
}
bool Recurrence::operator==( const Recurrence& r2 ) const
{
@@ -111,72 +114,72 @@ bool Recurrence::operator==( const Recurrence& r2 ) const
|| rFreq != r2.rFreq
|| rDuration != r2.rDuration
|| !rDuration && rEndDateTime != r2.rEndDateTime
|| mRecurStart != r2.mRecurStart
|| mFloats != r2.mFloats
|| mRecurReadOnly != r2.mRecurReadOnly
|| mRecurExDatesCount != r2.mRecurExDatesCount )
return false;
// no need to compare mCompat* and mParent
// OK to compare the pointers
switch ( recurs )
{
case rWeekly:
return rDays == r2.rDays
&& rWeekStart == r2.rWeekStart;
case rMonthlyPos: {
- QPtrList<rMonthPos> MonthPositions = rMonthPositions;
- QPtrList<rMonthPos> MonthPositions2 = r2.rMonthPositions;
+ Q3PtrList<rMonthPos> MonthPositions = rMonthPositions;
+ Q3PtrList<rMonthPos> MonthPositions2 = r2.rMonthPositions;
if ( !MonthPositions.count() )
return false;
if ( !MonthPositions2.count() )
return false;
return MonthPositions.first()->rPos == MonthPositions2.first()->rPos;
}
case rMonthlyDay: {
- QPtrList<int> MonthDays = rMonthDays ;
- QPtrList<int> MonthDays2 = r2.rMonthDays ;
+ Q3PtrList<int> MonthDays = rMonthDays ;
+ Q3PtrList<int> MonthDays2 = r2.rMonthDays ;
if ( !MonthDays.count() )
return false;
if ( !MonthDays2.count() )
return false;
return *MonthDays.first() == *MonthDays2.first() ;
}
case rYearlyPos: {
- QPtrList<int> YearNums = rYearNums;
- QPtrList<int> YearNums2 = r2.rYearNums;
+ Q3PtrList<int> YearNums = rYearNums;
+ Q3PtrList<int> YearNums2 = r2.rYearNums;
if ( *YearNums.first() != *YearNums2.first() )
return false;
- QPtrList<rMonthPos> MonthPositions = rMonthPositions;
- QPtrList<rMonthPos> MonthPositions2 = r2.rMonthPositions;
+ Q3PtrList<rMonthPos> MonthPositions = rMonthPositions;
+ Q3PtrList<rMonthPos> MonthPositions2 = r2.rMonthPositions;
if ( !MonthPositions.count() )
return false;
if ( !MonthPositions2.count() )
return false;
return MonthPositions.first()->rPos == MonthPositions2.first()->rPos;
}
case rYearlyMonth: {
- QPtrList<int> YearNums = rYearNums;
- QPtrList<int> YearNums2 = r2.rYearNums;
+ Q3PtrList<int> YearNums = rYearNums;
+ Q3PtrList<int> YearNums2 = r2.rYearNums;
return ( *YearNums.first() == *YearNums2.first() && mFeb29YearlyType == r2.mFeb29YearlyType);
}
case rYearlyDay: {
- QPtrList<int> YearNums = rYearNums;
- QPtrList<int> YearNums2 = r2.rYearNums;
+ Q3PtrList<int> YearNums = rYearNums;
+ Q3PtrList<int> YearNums2 = r2.rYearNums;
return ( *YearNums.first() == *YearNums2.first() );
}
case rNone:
case rMinutely:
case rHourly:
case rDaily:
default:
return true;
}
}
/*
bool Recurrence::compareLists( const QPtrList<int> &l1 ,const QPtrList<int> &l2)
{
if ( l1.count() != l2.count() )
return false;
int count = l1.count();
@@ -344,33 +347,33 @@ QDateTime Recurrence::endDateTime() const
QDate end;
if (recurs != rNone) {
if (rDuration < 0)
return QDateTime(); // infinite recurrence
if (rDuration == 0)
return rEndDateTime;
// The end date is determined by the recurrence count
QDate dStart = mRecurStart.date();
switch (recurs)
{
case rMinutely:
return mRecurStart.addSecs((rDuration-1+mRecurExDatesCount)*rFreq*60);
case rHourly:
return mRecurStart.addSecs((rDuration-1+mRecurExDatesCount)*rFreq*3600);
case rDaily:
- return dStart.addDays((rDuration-1+mRecurExDatesCount)*rFreq);
+ return (QDateTime)dStart.addDays((rDuration-1+mRecurExDatesCount)*rFreq);
case rWeekly:
count = weeklyCalc(END_DATE_AND_COUNT, end);
break;
case rMonthlyPos:
case rMonthlyDay:
count = monthlyCalc(END_DATE_AND_COUNT, end);
break;
case rYearlyMonth:
count = yearlyMonthCalc(END_DATE_AND_COUNT, end);
break;
case rYearlyDay:
count = yearlyDayCalc(END_DATE_AND_COUNT, end);
break;
case rYearlyPos:
count = yearlyPosCalc(END_DATE_AND_COUNT, end);
@@ -493,43 +496,43 @@ void Recurrence::setDuration(int _rDuration)
// Compatibility mode is only needed when reading the calendar in ICalFormatImpl,
// so explicitly setting the duration means no backwards compatibility is needed.
mCompatDuration = 0;
}
}
QString Recurrence::endDateStr(bool shortfmt) const
{
return KGlobal::locale()->formatDate(rEndDateTime.date(),shortfmt);
}
const QBitArray &Recurrence::days() const
{
return rDays;
}
-const QPtrList<Recurrence::rMonthPos> &Recurrence::monthPositions() const
+const Q3PtrList<Recurrence::rMonthPos> &Recurrence::monthPositions() const
{
return rMonthPositions;
}
-const QPtrList<Recurrence::rMonthPos> &Recurrence::yearMonthPositions() const
+const Q3PtrList<Recurrence::rMonthPos> &Recurrence::yearMonthPositions() const
{
return rMonthPositions;
}
-const QPtrList<int> &Recurrence::monthDays() const
+const Q3PtrList<int> &Recurrence::monthDays() const
{
return rMonthDays;
}
void Recurrence::setMinutely(int _rFreq, int _rDuration)
{
if (mRecurReadOnly || _rDuration == 0 || _rDuration < -1)
return;
setDailySub(rMinutely, _rFreq, _rDuration);
}
void Recurrence::setMinutely(int _rFreq, const QDateTime &_rEndDateTime)
{
if (mRecurReadOnly) return;
rEndDateTime = _rEndDateTime;
setDailySub(rMinutely, _rFreq, 0);
@@ -746,33 +749,33 @@ void Recurrence::setYearlyByDate(Feb29Type type, int _rFreq, int _rDuration)
void Recurrence::setYearlyByDate(Feb29Type type, int _rFreq, const QDate &_rEndDate)
{
if (mRecurReadOnly) return;
rEndDateTime.setDate(_rEndDate);
rEndDateTime.setTime(mRecurStart.time());
mCompatDuration = 0;
setYearly_(rYearlyMonth, type, _rFreq, 0);
}
void Recurrence::addYearlyMonthPos(short _rPos, const QBitArray &_rDays)
{
if (recurs == rYearlyPos)
addMonthlyPos_(_rPos, _rDays);
}
-const QPtrList<int> &Recurrence::yearNums() const
+const Q3PtrList<int> &Recurrence::yearNums() const
{
return rYearNums;
}
void Recurrence::addYearlyMonth(short _rPos )
{
if (mRecurReadOnly || recurs != rYearlyMonth) // invalid day/month number
return;
rMonthPos *tmpPos = new rMonthPos;
if ( _rPos > 0) {
tmpPos->rPos = _rPos;
tmpPos->negative = false;
} else {
tmpPos->rPos = -_rPos; // take abs()
tmpPos->negative = true;
}
rMonthPositions.append(tmpPos);
@@ -1034,39 +1037,39 @@ bool Recurrence::recursWeekly(const QDate &qd) const
bool Recurrence::recursMonthly(const QDate &qd) const
{
QDate dStart = mRecurStart.date();
int year = qd.year();
int month = qd.month();
int day = qd.day();
// calculate how many months ahead this date is from the original
// event's date
int monthsAhead = (year - dStart.year()) * 12 + (month - dStart.month());
if ((monthsAhead % rFreq) == 0) {
// The date is in a month which recurs
if (qd >= dStart
&& ((rDuration > 0 && qd <= endDate()) ||
(rDuration == 0 && qd <= rEndDateTime.date()) ||
rDuration == -1)) {
// The date queried falls within the range of the event.
- QValueList<int> days;
+ Q3ValueList<int> days;
int daysInMonth = qd.daysInMonth();
if (recurs == rMonthlyDay)
getMonthlyDayDays(days, daysInMonth);
else if (recurs == rMonthlyPos)
getMonthlyPosDays(days, daysInMonth, QDate(year, month, 1).dayOfWeek());
- for (QValueList<int>::Iterator it = days.begin(); it != days.end(); ++it) {
+ for (Q3ValueList<int>::Iterator it = days.begin(); it != days.end(); ++it) {
if (*it == day)
return true;
}
// no dates matched
}
}
return false;
}
bool Recurrence::recursYearlyByMonth(const QDate &qd) const
{
QDate dStart = mRecurStart.date();
int startDay = dStart.day();
int qday = qd.day();
int qmonth = qd.month();
int qyear = qd.year();
@@ -1088,89 +1091,89 @@ bool Recurrence::recursYearlyByMonth(const QDate &qd) const
break;
}
}
if (match) {
// The day of the month matches. Calculate how many years ahead
// this date is from the original event's date.
int yearsAhead = (qyear - dStart.year());
if (yearsAhead % rFreq == 0) {
// The date is in a year which recurs
if (qd >= dStart
&& ((rDuration > 0 && qd <= endDate()) ||
(rDuration == 0 && qd <= rEndDateTime.date()) ||
rDuration == -1)) {
// The date queried falls within the range of the event.
int i = qmonth;
- for (QPtrListIterator<int> qlin(rYearNums); qlin.current(); ++qlin) {
+ for (Q3PtrListIterator<int> qlin(rYearNums); qlin.current(); ++qlin) {
if (i == *qlin.current())
return true;
}
}
}
}
return false;
}
bool Recurrence::recursYearlyByPos(const QDate &qd) const
{
QDate dStart = mRecurStart.date();
int year = qd.year();
int month = qd.month();
int day = qd.day();
// calculate how many years ahead this date is from the original
// event's date
int yearsAhead = (year - dStart.year());
if (yearsAhead % rFreq == 0) {
// The date is in a year which recurs
if (qd >= dStart
&& ((rDuration > 0 && qd <= endDate()) ||
(rDuration == 0 && qd <= rEndDateTime.date()) ||
rDuration == -1)) {
// The date queried falls within the range of the event.
- for (QPtrListIterator<int> qlin(rYearNums); qlin.current(); ++qlin) {
+ for (Q3PtrListIterator<int> qlin(rYearNums); qlin.current(); ++qlin) {
if (month == *qlin.current()) {
// The month recurs
- QValueList<int> days;
+ Q3ValueList<int> days;
getMonthlyPosDays(days, qd.daysInMonth(), QDate(year, month, 1).dayOfWeek());
- for (QValueList<int>::Iterator it = days.begin(); it != days.end(); ++it) {
+ for (Q3ValueList<int>::Iterator it = days.begin(); it != days.end(); ++it) {
if (*it == day)
return true;
}
}
}
}
}
return false;
}
bool Recurrence::recursYearlyByDay(const QDate &qd) const
{
QDate dStart = mRecurStart.date();
// calculate how many years ahead this date is from the original
// event's date
int yearsAhead = (qd.year() - dStart.year());
if (yearsAhead % rFreq == 0) {
// The date is in a year which recurs
if (qd >= dStart
&& ((rDuration > 0 && qd <= endDate()) ||
(rDuration == 0 && qd <= rEndDateTime.date()) ||
rDuration == -1)) {
// The date queried falls within the range of the event.
int i = qd.dayOfYear();
- for (QPtrListIterator<int> qlin(rYearNums); qlin.current(); ++qlin) {
+ for (Q3PtrListIterator<int> qlin(rYearNums); qlin.current(); ++qlin) {
if (i == *qlin.current())
return true;
}
}
}
return false;
}
/* Get the date of the next recurrence, after the specified date.
* If 'last' is non-null, '*last' is set to true if the next recurrence is the
* last recurrence, else false.
* Reply = date of next recurrence, or invalid date if none.
*/
QDate Recurrence::getNextDateNoTime(const QDate &preDate, bool *last) const
{
@@ -1536,33 +1539,33 @@ int Recurrence::recurCalc(PeriodFunc func, QDate &enddate) const
count = yearlyMonthCalc(func, enddate);
break;
case rYearlyPos:
count = yearlyPosCalc(func, enddate);
break;
case rYearlyDay:
count = yearlyDayCalc(func, enddate);
break;
default:
break;
}
switch (func) {
case END_DATE_AND_COUNT:
case NEXT_AFTER_DATE:
if (count == 0)
- endtime = QDate();
+ endtime = QDateTime();
else if (timed)
enddate = endtime.date();
break;
case COUNT_TO_DATE:
break;
}
return count;
}
/* Find count and, depending on 'func', the end date/time of a secondly recurrence.
* Reply = total number of occurrences up to 'endtime', or 0 if error.
* If 'func' = END_DATE_AND_COUNT or NEXT_AFTER_DATE, 'endtime' is updated to the
* recurrence end date/time.
*/
int Recurrence::secondlyCalc(PeriodFunc func, QDateTime &endtime, int freq) const
{
@@ -1780,50 +1783,50 @@ ex:
enddate = dStart.addDays(daysGone);
return countGone;
}
/* Find count and, depending on 'func', the end date of a monthly recurrence.
* Reply = total number of occurrences up to 'enddate', or 0 if error.
* If 'func' = END_DATE_AND_COUNT or NEXT_AFTER_DATE, 'enddate' is updated to the
* recurrence end date.
*/
struct Recurrence::MonthlyData {
const Recurrence *recurrence;
int year; // current year
int month; // current month 0..11
int day; // current day of month 1..31
bool varies; // true if recurring days vary between different months
private:
- QValueList<int> days28, days29, days30, days31; // recurring days in months of each length
- QValueList<int> *recurDays[4];
+ Q3ValueList<int> days28, days29, days30, days31; // recurring days in months of each length
+ Q3ValueList<int> *recurDays[4];
public:
MonthlyData(const Recurrence* r, const QDate &date)
: recurrence(r), year(date.year()), month(date.month()-1), day(date.day())
{ recurDays[0] = &days28;
recurDays[1] = &days29;
recurDays[2] = &days30;
recurDays[3] = &days31;
varies = (recurrence->recurs == rMonthlyPos)
? true : recurrence->getMonthlyDayDays(days31, 31);
}
- const QValueList<int>* dayList() const {
+ const Q3ValueList<int>* dayList() const {
if (!varies)
return &days31;
QDate startOfMonth(year, month + 1, 1);
int daysInMonth = startOfMonth.daysInMonth();
- QValueList<int>* days = recurDays[daysInMonth - 28];
+ Q3ValueList<int>* days = recurDays[daysInMonth - 28];
if (recurrence->recurs == rMonthlyPos)
recurrence->getMonthlyPosDays(*days, daysInMonth, startOfMonth.dayOfWeek());
else if (days->isEmpty())
recurrence->getMonthlyDayDays(*days, daysInMonth);
return days;
}
int yearMonth() const { return year*12 + month; }
void addMonths(int diff) { month += diff; year += month / 12; month %= 12; }
QDate date() const { return QDate(year, month + 1, day); }
};
int Recurrence::monthlyCalc(PeriodFunc func, QDate &enddate) const
{
if (recurs == rMonthlyPos && rMonthPositions.isEmpty()
|| recurs == rMonthlyDay && rMonthDays.isEmpty())
return 0;
@@ -1831,34 +1834,34 @@ int Recurrence::monthlyCalc(PeriodFunc func, QDate &enddate) const
MonthlyData data(this, mRecurStart.date());
switch (func) {
case END_DATE_AND_COUNT:
return monthlyCalcEndDate(enddate, data);
case COUNT_TO_DATE:
return monthlyCalcToDate(enddate, data);
case NEXT_AFTER_DATE:
return monthlyCalcNextAfter(enddate, data);
}
return 0;
}
int Recurrence::monthlyCalcEndDate(QDate &enddate, MonthlyData &data) const
{
uint countTogo = rDuration + mRecurExDatesCount;
int countGone = 0;
- QValueList<int>::ConstIterator it;
- const QValueList<int>* days = data.dayList();
+ Q3ValueList<int>::ConstIterator it;
+ const Q3ValueList<int>* days = data.dayList();
if (data.day > 1) {
// Check what remains of the start month
for (it = days->begin(); it != days->end(); ++it) {
if (*it >= data.day) {
++countGone;
if (--countTogo == 0) {
data.day = *it;
break;
}
}
}
if (countTogo) {
data.day = 1;
data.addMonths(rFreq);
}
@@ -1897,34 +1900,34 @@ int Recurrence::monthlyCalcEndDate(QDate &enddate, MonthlyData &data) const
}
}
}
}
enddate = data.date();
return countGone;
}
int Recurrence::monthlyCalcToDate(const QDate &enddate, MonthlyData &data) const
{
int countGone = 0;
int countMax = (rDuration > 0) ? rDuration + mRecurExDatesCount : INT_MAX;
int endYear = enddate.year();
int endMonth = enddate.month() - 1; // zero-based
int endDay = enddate.day();
int endYearMonth = endYear*12 + endMonth;
- QValueList<int>::ConstIterator it;
- const QValueList<int>* days = data.dayList();
+ Q3ValueList<int>::ConstIterator it;
+ const Q3ValueList<int>* days = data.dayList();
if (data.day > 1) {
// Check what remains of the start month
for (it = days->begin(); it != days->end(); ++it) {
if (*it >= data.day) {
if (data.yearMonth() == endYearMonth && *it > endDay)
return countGone;
if (++countGone >= countMax)
return countMax;
}
}
data.day = 1;
data.addMonths(rFreq);
}
if (data.varies) {
@@ -1956,34 +1959,34 @@ int Recurrence::monthlyCalcToDate(const QDate &enddate, MonthlyData &data) const
for (it = days->begin(); it != days->end(); ++it) {
if (*it > endDay)
return countGone;
if (++countGone >= countMax)
return countMax;
}
return countGone;
}
int Recurrence::monthlyCalcNextAfter(QDate &enddate, MonthlyData &data) const
{
uint countTogo = (rDuration > 0) ? rDuration + mRecurExDatesCount : UINT_MAX;
int countGone = 0;
int endYear = enddate.year();
int endDay = enddate.day();
int endYearMonth = endYear*12 + enddate.month() - 1;
- QValueList<int>::ConstIterator it;
- const QValueList<int>* days = data.dayList();
+ Q3ValueList<int>::ConstIterator it;
+ const Q3ValueList<int>* days = data.dayList();
if (data.day > 1) {
// Check what remains of the start month
for (it = days->begin(); it != days->end(); ++it) {
if (*it >= data.day) {
++countGone;
if (data.yearMonth() == endYearMonth && *it > endDay) {
data.day = *it;
goto ex;
}
if (--countTogo == 0)
return 0;
}
}
data.day = 1;
data.addMonths(rFreq);
@@ -2039,70 +2042,70 @@ ex:
}
/* Find count and, depending on 'func', the end date of an annual recurrence by date.
* Reply = total number of occurrences up to 'enddate', or 0 if error.
* If 'func' = END_DATE_AND_COUNT or NEXT_AFTER_DATE, 'enddate' is updated to the
* recurrence end date.
*/
struct Recurrence::YearlyMonthData {
const Recurrence *recurrence;
int year; // current year
int month; // current month 1..12
int day; // current day of month 1..31
bool leapyear; // true if February 29th recurs and current year is a leap year
bool feb29; // true if February 29th recurs
private:
- QValueList<int> months; // recurring months in non-leap years 1..12
- QValueList<int> leapMonths; // recurring months in leap years 1..12
+ Q3ValueList<int> months; // recurring months in non-leap years 1..12
+ Q3ValueList<int> leapMonths; // recurring months in leap years 1..12
public:
YearlyMonthData(const Recurrence* r, const QDate &date)
: recurrence(r), year(date.year()), month(date.month()), day(date.day())
{ feb29 = recurrence->getYearlyMonthMonths(day, months, leapMonths);
leapyear = feb29 && QDate::leapYear(year);
}
- const QValueList<int>* monthList() const
+ const Q3ValueList<int>* monthList() const
{ return leapyear ? &leapMonths : &months; }
- const QValueList<int>* leapMonthList() const { return &leapMonths; }
+ const Q3ValueList<int>* leapMonthList() const { return &leapMonths; }
QDate date() const { return QDate(year, month, day); }
};
int Recurrence::yearlyMonthCalc(PeriodFunc func, QDate &enddate) const
{
if (rYearNums.isEmpty())
return 0;
YearlyMonthData data(this, mRecurStart.date());
switch (func) {
case END_DATE_AND_COUNT:
return yearlyMonthCalcEndDate(enddate, data);
case COUNT_TO_DATE:
return yearlyMonthCalcToDate(enddate, data);
case NEXT_AFTER_DATE:
return yearlyMonthCalcNextAfter(enddate, data);
}
return 0;
}
// Find total count and end date of an annual recurrence by date.
// Reply = total number of occurrences.
int Recurrence::yearlyMonthCalcEndDate(QDate &enddate, YearlyMonthData &data) const
{
uint countTogo = rDuration + mRecurExDatesCount;
int countGone = 0;
- QValueList<int>::ConstIterator it;
- const QValueList<int>* mons = data.monthList(); // get recurring months for this year
+ Q3ValueList<int>::ConstIterator it;
+ const Q3ValueList<int>* mons = data.monthList(); // get recurring months for this year
if (data.month > 1) {
// Check what remains of the start year
for (it = mons->begin(); it != mons->end(); ++it) {
if (*it >= data.month) {
++countGone;
if (--countTogo == 0) {
data.month = *it;
if (data.month == 2 && data.feb29 && !data.leapyear) {
// The recurrence should end on February 29th, but it's a non-leap year
switch (mFeb29YearlyType) {
case rFeb28:
data.day = 28;
break;
case rMar1:
data.month = 3;
@@ -2186,34 +2189,34 @@ int Recurrence::yearlyMonthCalcToDate(const QDate &enddate, YearlyMonthData &dat
if (endDay < data.day) {
/* The end day of the month is earlier than the recurrence day of the month.
* If Feb 29th recurs and:
* 1) it recurs on Feb 28th in non-leap years, don't adjust the end month
* if enddate is Feb 28th on a non-leap year.
* 2) it recurs on Mar 1st in non-leap years, allow the end month to be
* adjusted to February, to simplify calculations.
*/
if (data.feb29 && !QDate::leapYear(endYear)
&& mFeb29YearlyType == rFeb28 && endDay == 28 && endMonth == 2) {
}
else if (--endMonth == 0) {
endMonth = 12;
--endYear;
}
}
- QValueList<int>::ConstIterator it;
- const QValueList<int>* mons = data.monthList();
+ Q3ValueList<int>::ConstIterator it;
+ const Q3ValueList<int>* mons = data.monthList();
if (data.month > 1) {
// Check what remains of the start year
for (it = mons->begin(); it != mons->end(); ++it) {
if (*it >= data.month) {
if (data.year == endYear && *it > endMonth)
return countGone;
if (++countGone >= countMax)
return countMax;
}
}
data.month = 1;
data.year += rFreq;
}
if (data.feb29 && mFeb29YearlyType == rFeb29) {
// The number of recurrences is different on leap years,
@@ -2257,34 +2260,34 @@ int Recurrence::yearlyMonthCalcNextAfter(QDate &enddate, YearlyMonthData &data)
int countGone = 0;
int endYear = enddate.year();
int endMonth = enddate.month();
int endDay = enddate.day();
bool mar1TooEarly = false;
bool feb28ok = false;
if (endDay < data.day) {
if (data.feb29 && mFeb29YearlyType == rMar1 && endMonth == 3)
mar1TooEarly = true;
if (data.feb29 && mFeb29YearlyType == rFeb28 && endMonth == 2 && endDay == 28)
feb28ok = true;
else if (--endMonth == 0) {
endMonth = 12;
--endYear;
}
}
- QValueList<int>::ConstIterator it;
- const QValueList<int>* mons = data.monthList();
+ Q3ValueList<int>::ConstIterator it;
+ const Q3ValueList<int>* mons = data.monthList();
if (data.month > 1) {
// Check what remains of the start year
for (it = mons->begin(); it != mons->end(); ++it) {
if (*it >= data.month) {
++countGone;
if (data.year == endYear
&& ( *it > endMonth && (*it > 3 || !mar1TooEarly)
|| *it == 2 && feb28ok && data.leapyear)) {
if (*it == 2 && data.feb29 && !data.leapyear) {
// The next recurrence should be on February 29th, but it's a non-leap year
switch (mFeb29YearlyType) {
case rFeb28:
data.month = 2;
data.day = 28;
break;
@@ -2377,139 +2380,139 @@ ex:
/* Find count and, depending on 'func', the end date of an annual recurrence by date.
* Reply = total number of occurrences up to 'enddate', or 0 if error.
* If 'func' = END_DATE_AND_COUNT or NEXT_AFTER_DATE, 'enddate' is updated to the
* recurrence end date.
*/
struct Recurrence::YearlyPosData {
const Recurrence *recurrence;
int year; // current year
int month; // current month 1..12
int day; // current day of month 1..31
int daysPerMonth; // number of days which recur each month, or -1 if variable
int count; // number of days which recur each year, or -1 if variable
bool varies; // true if number of days varies from year to year
private:
- mutable QValueList<int> days;
+ mutable Q3ValueList<int> days;
public:
YearlyPosData(const Recurrence* r, const QDate &date)
: recurrence(r), year(date.year()), month(date.month()), day(date.day()), count(-1)
{ if ((daysPerMonth = r->countMonthlyPosDays()) > 0)
count = daysPerMonth * r->rYearNums.count();
varies = (daysPerMonth < 0);
}
- const QValueList<int>* dayList() const {
+ const Q3ValueList<int>* dayList() const {
QDate startOfMonth(year, month, 1);
recurrence->getMonthlyPosDays(days, startOfMonth.daysInMonth(), startOfMonth.dayOfWeek());
return &days;
}
int yearMonth() const { return year*12 + month - 1; }
void addMonths(int diff) { month += diff - 1; year += month / 12; month = month % 12 + 1; }
QDate date() const { return QDate(year, month, day); }
};
int Recurrence::yearlyPosCalc(PeriodFunc func, QDate &enddate) const
{
if (rYearNums.isEmpty() || rMonthPositions.isEmpty())
return 0;
YearlyPosData data(this, mRecurStart.date());
switch (func) {
case END_DATE_AND_COUNT:
return yearlyPosCalcEndDate(enddate, data);
case COUNT_TO_DATE:
return yearlyPosCalcToDate(enddate, data);
case NEXT_AFTER_DATE:
return yearlyPosCalcNextAfter(enddate, data);
}
return 0;
}
int Recurrence::yearlyPosCalcEndDate(QDate &enddate, YearlyPosData &data) const
{
uint countTogo = rDuration + mRecurExDatesCount;
int countGone = 0;
- QValueList<int>::ConstIterator id;
- const QValueList<int>* days;
+ Q3ValueList<int>::ConstIterator id;
+ const Q3ValueList<int>* days;
if (data.month > 1 || data.day > 1) {
// Check what remains of the start year
- for (QPtrListIterator<int> im(rYearNums); im.current(); ++im) {
+ for (Q3PtrListIterator<int> im(rYearNums); im.current(); ++im) {
if (*im.current() >= data.month) {
// Check what remains of the start month
if (data.day > 1 || data.varies
|| static_cast<uint>(data.daysPerMonth) >= countTogo) {
data.month = *im.current();
days = data.dayList();
for (id = days->begin(); id != days->end(); ++id) {
if (*id >= data.day) {
++countGone;
if (--countTogo == 0) {
data.month = *im.current();
data.day = *id;
goto ex;
}
}
}
data.day = 1;
} else {
// The number of days per month is constant, so skip
// the whole month.
countTogo -= data.daysPerMonth;
countGone += data.daysPerMonth;
}
}
}
data.month = 1;
data.year += rFreq;
}
if (data.varies) {
// The number of recurrences varies from year to year.
for ( ; ; ) {
- for (QPtrListIterator<int> im(rYearNums); im.current(); ++im) {
+ for (Q3PtrListIterator<int> im(rYearNums); im.current(); ++im) {
data.month = *im.current();
days = data.dayList();
int n = days->count();
if (static_cast<uint>(n) >= countTogo) {
// Check the last month in the recurrence
for (id = days->begin(); id != days->end(); ++id) {
++countGone;
if (--countTogo == 0) {
data.day = *id;
goto ex;
}
}
}
countTogo -= n;
countGone += n;
}
data.year += rFreq;
}
} else {
// The number of recurrences is the same every year,
// so skip the year-by-year check.
// Skip the remaining whole years, but leave at least
// 1 recurrence remaining, in order to get its date.
int wholeYears = (countTogo - 1) / data.count;
data.year += wholeYears * rFreq;
countGone += wholeYears * data.count;
countTogo -= wholeYears * data.count;
// Check the last year in the recurrence.
- for (QPtrListIterator<int> im(rYearNums); im.current(); ++im) {
+ for (Q3PtrListIterator<int> im(rYearNums); im.current(); ++im) {
if (static_cast<uint>(data.daysPerMonth) >= countTogo) {
// Check the last month in the recurrence
data.month = *im.current();
days = data.dayList();
for (id = days->begin(); id != days->end(); ++id) {
++countGone;
if (--countTogo == 0) {
data.day = *id;
goto ex;
}
}
}
countTogo -= data.daysPerMonth;
countGone += data.daysPerMonth;
}
data.year += rFreq;
@@ -2518,38 +2521,38 @@ ex:
enddate = data.date();
return countGone;
}
int Recurrence::yearlyPosCalcToDate(const QDate &enddate, YearlyPosData &data) const
{
int countGone = 0;
int countMax = (rDuration > 0) ? rDuration + mRecurExDatesCount : INT_MAX;
int endYear = enddate.year();
int endMonth = enddate.month();
int endDay = enddate.day();
if (endDay < data.day && --endMonth == 0) {
endMonth = 12;
--endYear;
}
int endYearMonth = endYear*12 + endMonth;
- QValueList<int>::ConstIterator id;
- const QValueList<int>* days;
+ Q3ValueList<int>::ConstIterator id;
+ const Q3ValueList<int>* days;
if (data.month > 1 || data.day > 1) {
// Check what remains of the start year
- for (QPtrListIterator<int> im(rYearNums); im.current(); ++im) {
+ for (Q3PtrListIterator<int> im(rYearNums); im.current(); ++im) {
if (*im.current() >= data.month) {
data.month = *im.current();
if (data.yearMonth() > endYearMonth)
return countGone;
// Check what remains of the start month
bool lastMonth = (data.yearMonth() == endYearMonth);
if (lastMonth || data.day > 1 || data.varies) {
days = data.dayList();
if (lastMonth || data.day > 1) {
for (id = days->begin(); id != days->end(); ++id) {
if (*id >= data.day) {
if (lastMonth && *id > endDay)
return countGone;
if (++countGone >= countMax)
return countMax;
}
@@ -2563,33 +2566,33 @@ int Recurrence::yearlyPosCalcToDate(const QDate &enddate, YearlyPosData &data) c
} else {
// The number of days per month is constant, so skip
// the whole month.
countGone += data.daysPerMonth;
if (countGone >= countMax)
return countMax;
}
}
}
data.month = 1;
data.year += rFreq;
}
if (data.varies) {
// The number of recurrences varies from year to year.
for ( ; ; ) {
- for (QPtrListIterator<int> im(rYearNums); im.current(); ++im) {
+ for (Q3PtrListIterator<int> im(rYearNums); im.current(); ++im) {
data.month = *im.current();
days = data.dayList();
if (data.yearMonth() >= endYearMonth) {
if (data.yearMonth() > endYearMonth)
return countGone;
// Check the last month in the recurrence
for (id = days->begin(); id != days->end(); ++id) {
if (*id > endDay)
return countGone;
if (++countGone >= countMax)
return countMax;
}
} else {
countGone += days->count();
if (countGone >= countMax)
return countMax;
@@ -2598,33 +2601,33 @@ int Recurrence::yearlyPosCalcToDate(const QDate &enddate, YearlyPosData &data) c
data.year += rFreq;
}
} else {
// The number of recurrences is the same every year,
// so skip the year-by-year check.
// Skip the remaining whole years, but leave at least
// 1 recurrence remaining, in order to get its date.
int wholeYears = endYear - data.year;
countGone += (wholeYears / rFreq) * data.count;
if (countGone >= countMax)
return countMax;
if (wholeYears % rFreq)
return countGone; // end year isn't a recurrence year
data.year = endYear;
// Check the last year in the recurrence.
- for (QPtrListIterator<int> im(rYearNums); im.current(); ++im) {
+ for (Q3PtrListIterator<int> im(rYearNums); im.current(); ++im) {
data.month = *im.current();
if (data.month >= endMonth) {
if (data.month > endMonth)
return countGone;
// Check the last month in the recurrence
days = data.dayList();
for (id = days->begin(); id != days->end(); ++id) {
if (*id > endDay)
return countGone;
if (++countGone >= countMax)
return countMax;
}
} else {
countGone += data.daysPerMonth;
if (countGone >= countMax)
return countMax;
@@ -2633,40 +2636,40 @@ int Recurrence::yearlyPosCalcToDate(const QDate &enddate, YearlyPosData &data) c
}
return countGone;
}
int Recurrence::yearlyPosCalcNextAfter(QDate &enddate, YearlyPosData &data) const
{
uint countTogo = (rDuration > 0) ? rDuration + mRecurExDatesCount : UINT_MAX;
int countGone = 0;
int endYear = enddate.year();
int endMonth = enddate.month();
int endDay = enddate.day();
if (endDay < data.day && --endMonth == 0) {
endMonth = 12;
--endYear;
}
int endYearMonth = endYear*12 + endMonth;
- QValueList<int>::ConstIterator id;
- const QValueList<int>* days;
+ Q3ValueList<int>::ConstIterator id;
+ const Q3ValueList<int>* days;
if (data.varies) {
// The number of recurrences varies from year to year.
for ( ; ; ) {
// Check the next year
- for (QPtrListIterator<int> im(rYearNums); im.current(); ++im) {
+ for (Q3PtrListIterator<int> im(rYearNums); im.current(); ++im) {
if (*im.current() >= data.month) {
// Check the next month
data.month = *im.current();
int ended = data.yearMonth() - endYearMonth;
days = data.dayList();
if (ended >= 0 || data.day > 1) {
// This is the start or end month, so check each day
for (id = days->begin(); id != days->end(); ++id) {
if (*id >= data.day) {
++countGone;
if (ended > 0 || (ended == 0 && *id > endDay)) {
data.day = *id;
goto ex;
}
if (--countTogo == 0)
return 0;
@@ -2676,33 +2679,33 @@ int Recurrence::yearlyPosCalcNextAfter(QDate &enddate, YearlyPosData &data) cons
// Skip the whole month
uint n = days->count();
if (n >= countTogo)
return 0;
countGone += n;
}
data.day = 1; // we've checked the start month now
}
}
data.month = 1; // we've checked the start year now
data.year += rFreq;
}
} else {
// The number of recurrences is the same every year.
if (data.month > 1 || data.day > 1) {
// Check what remains of the start year
- for (QPtrListIterator<int> im(rYearNums); im.current(); ++im) {
+ for (Q3PtrListIterator<int> im(rYearNums); im.current(); ++im) {
if (*im.current() >= data.month) {
// Check what remains of the start month
data.month = *im.current();
int ended = data.yearMonth() - endYearMonth;
if (ended >= 0 || data.day > 1) {
// This is the start or end month, so check each day
days = data.dayList();
for (id = days->begin(); id != days->end(); ++id) {
if (*id >= data.day) {
++countGone;
if (ended > 0 || (ended == 0 && *id > endDay)) {
data.day = *id;
goto ex;
}
if (--countTogo == 0)
return 0;
@@ -2721,33 +2724,33 @@ int Recurrence::yearlyPosCalcNextAfter(QDate &enddate, YearlyPosData &data) cons
}
// Skip the remaining whole years to at least endYear.
int recurYears = (endYear - data.year + rFreq - 1) / rFreq;
if ((endYear - data.year)%rFreq == 0
&& *rYearNums.getLast() <= endMonth)
++recurYears; // required year is after endYear
if (recurYears) {
int n = recurYears * data.count;
if (static_cast<uint>(n) > countTogo)
return 0; // reached end of recurrence
countTogo -= n;
countGone += n;
data.year += recurYears * rFreq;
}
// Check the last year in the recurrence
- for (QPtrListIterator<int> im(rYearNums); im.current(); ++im) {
+ for (Q3PtrListIterator<int> im(rYearNums); im.current(); ++im) {
data.month = *im.current();
int ended = data.yearMonth() - endYearMonth;
if (ended >= 0) {
// This is the end month, so check each day
days = data.dayList();
for (id = days->begin(); id != days->end(); ++id) {
++countGone;
if (ended > 0 || (ended == 0 && *id > endDay)) {
data.day = *id;
goto ex;
}
if (--countTogo == 0)
return 0;
}
} else {
// Skip the whole month.
@@ -2795,33 +2798,33 @@ int Recurrence::yearlyDayCalc(PeriodFunc func, QDate &enddate) const
case COUNT_TO_DATE:
return yearlyDayCalcToDate(enddate, data);
case NEXT_AFTER_DATE:
return yearlyDayCalcNextAfter(enddate, data);
}
return 0;
}
int Recurrence::yearlyDayCalcEndDate(QDate &enddate, YearlyDayData &data) const
{
uint countTogo = rDuration + mRecurExDatesCount;
int countGone = 0;
if (data.day > 1) {
// Check what remains of the start year
bool leapOK = data.isMaxDayCount();
- for (QPtrListIterator<int> it(rYearNums); it.current(); ++it) {
+ for (Q3PtrListIterator<int> it(rYearNums); it.current(); ++it) {
int d = *it.current();
if (d >= data.day && (leapOK || d < 366)) {
++countGone;
if (--countTogo == 0) {
data.day = d;
goto ex;
}
}
}
data.day = 1;
data.year += rFreq;
}
if (data.varies) {
// The number of recurrences is different in leap years,
// so check year-by-year.
@@ -2833,56 +2836,56 @@ int Recurrence::yearlyDayCalcEndDate(QDate &enddate, YearlyDayData &data) const
countGone += n;
data.year += rFreq;
}
} else {
// The number of recurrences is the same every year,
// so skip the year-by-year check.
// Skip the remaining whole years, but leave at least
// 1 recurrence remaining, in order to get its date.
int daysPerYear = rYearNums.count();
int wholeYears = (countTogo - 1) / daysPerYear;
data.year += wholeYears * rFreq;
countGone += wholeYears * daysPerYear;
countTogo -= wholeYears * daysPerYear;
}
if (countTogo) {
// Check the last year in the recurrence
- for (QPtrListIterator<int> it(rYearNums); it.current(); ++it) {
+ for (Q3PtrListIterator<int> it(rYearNums); it.current(); ++it) {
++countGone;
if (--countTogo == 0) {
data.day = *it.current();
break;
}
}
}
ex:
enddate = data.date();
return countGone;
}
int Recurrence::yearlyDayCalcToDate(const QDate &enddate, YearlyDayData &data) const
{
int countGone = 0;
int countMax = (rDuration > 0) ? rDuration + mRecurExDatesCount : INT_MAX;
int endYear = enddate.year();
int endDay = enddate.dayOfYear();
if (data.day > 1) {
// Check what remains of the start year
bool leapOK = data.isMaxDayCount();
- for (QPtrListIterator<int> it(rYearNums); it.current(); ++it) {
+ for (Q3PtrListIterator<int> it(rYearNums); it.current(); ++it) {
int d = *it.current();
if (d >= data.day && (leapOK || d < 366)) {
if (data.year == endYear && d > endDay)
return countGone;
if (++countGone >= countMax)
return countMax;
}
}
data.day = 1;
data.year += rFreq;
}
if (data.varies) {
// The number of recurrences is different in leap years,
// so check year-by-year.
while (data.year < endYear) {
@@ -2895,53 +2898,53 @@ int Recurrence::yearlyDayCalcToDate(const QDate &enddate, YearlyDayData &data) c
if (data.year > endYear)
return countGone;
} else {
// The number of recurrences is the same every year.
// Skip the remaining whole years.
int wholeYears = endYear - data.year;
countGone += (wholeYears / rFreq) * rYearNums.count();
if (countGone >= countMax)
return countMax;
if (wholeYears % rFreq)
return countGone; // end year isn't a recurrence year
data.year = endYear;
}
if (data.year <= endYear) {
// Check the last year in the recurrence
- for (QPtrListIterator<int> it(rYearNums); it.current(); ++it) {
+ for (Q3PtrListIterator<int> it(rYearNums); it.current(); ++it) {
if (*it.current() > endDay)
return countGone;
if (++countGone >= countMax)
return countMax;
}
}
return countGone;
}
int Recurrence::yearlyDayCalcNextAfter(QDate &enddate, YearlyDayData &data) const
{
uint countTogo = (rDuration > 0) ? rDuration + mRecurExDatesCount : UINT_MAX;
int countGone = 0;
int endYear = enddate.year();
int endDay = enddate.dayOfYear();
if (data.day > 1) {
// Check what remains of the start year
bool leapOK = data.isMaxDayCount();
- for (QPtrListIterator<int> it(rYearNums); it.current(); ++it) {
+ for (Q3PtrListIterator<int> it(rYearNums); it.current(); ++it) {
int d = *it.current();
if (d >= data.day && (leapOK || d < 366)) {
++countGone;
if (data.year == endYear && d > endDay) {
data.day = d;
goto ex;
}
if (--countTogo == 0)
return 0;
}
}
data.day = 1;
data.year += rFreq;
}
if (data.varies) {
@@ -2964,57 +2967,57 @@ int Recurrence::yearlyDayCalcNextAfter(QDate &enddate, YearlyDayData &data) cons
int daysPerYear = rYearNums.count();
int recurYears = (endYear - data.year + rFreq - 1) / rFreq;
if ((endYear - data.year)%rFreq == 0
&& *rYearNums.getLast() <= endDay)
++recurYears; // required year is after endYear
if (recurYears) {
int n = recurYears * daysPerYear;
if (static_cast<uint>(n) > countTogo)
return 0; // reached end of recurrence
countTogo -= n;
countGone += n;
data.year += recurYears * rFreq;
}
}
// Check the last year in the recurrence
- for (QPtrListIterator<int> it(rYearNums); it.current(); ++it) {
+ for (Q3PtrListIterator<int> it(rYearNums); it.current(); ++it) {
++countGone;
int d = *it.current();
if (data.year > endYear || d > endDay) {
data.day = d;
break;
}
if (--countTogo == 0)
return 0;
}
ex:
enddate = data.date();
return countGone;
}
// Get the days in this month which recur, in numerical order.
// Parameters: daysInMonth = number of days in this month
// startDayOfWeek = day of week for first day of month.
-void Recurrence::getMonthlyPosDays(QValueList<int> &list, int daysInMonth, int startDayOfWeek) const
+void Recurrence::getMonthlyPosDays(Q3ValueList<int> &list, int daysInMonth, int startDayOfWeek) const
{
list.clear();
int endDayOfWeek = (startDayOfWeek + daysInMonth - 2) % 7 + 1;
// Go through the list, compiling a bit list of actual day numbers
Q_UINT32 days = 0;
- for (QPtrListIterator<rMonthPos> pos(rMonthPositions); pos.current(); ++pos) {
+ for (Q3PtrListIterator<rMonthPos> pos(rMonthPositions); pos.current(); ++pos) {
int weeknum = pos.current()->rPos - 1; // get 0-based week number
QBitArray &rdays = pos.current()->rDays;
if (pos.current()->negative) {
// nth days before the end of the month
for (uint i = 1; i <= 7; ++i) {
if (rdays.testBit(i - 1)) {
int day = daysInMonth - weeknum*7 - (endDayOfWeek - i + 7) % 7;
if (day > 0)
days |= 1 << (day - 1);
}
}
} else {
// nth days after the start of the month
for (uint i = 1; i <= 7; ++i) {
if (rdays.testBit(i - 1)) {
int day = 1 + weeknum*7 + (i - startDayOfWeek + 7) % 7;
@@ -3026,105 +3029,105 @@ void Recurrence::getMonthlyPosDays(QValueList<int> &list, int daysInMonth, int s
}
// Compile the ordered list
Q_UINT32 mask = 1;
for (int i = 0; i < daysInMonth; mask <<= 1, ++i) {
if (days & mask)
list.append(i + 1);
}
}
// Get the number of days in the month which recur.
// Reply = -1 if the number varies from month to month.
int Recurrence::countMonthlyPosDays() const
{
int count = 0;
Q_UINT8 positive[5] = { 0, 0, 0, 0, 0 };
Q_UINT8 negative[4] = { 0, 0, 0, 0 };
- for (QPtrListIterator<rMonthPos> pos(rMonthPositions); pos.current(); ++pos) {
+ for (Q3PtrListIterator<rMonthPos> pos(rMonthPositions); pos.current(); ++pos) {
int weeknum = pos.current()->rPos;
Q_UINT8* wk;
if (pos.current()->negative) {
// nth days before the end of the month
if (weeknum > 4)
return -1; // days in 5th week are often missing
wk = &negative[4 - weeknum];
} else {
// nth days after the start of the month
if (weeknum > 4)
return -1; // days in 5th week are often missing
wk = &positive[weeknum - 1];
}
QBitArray &rdays = pos.current()->rDays;
for (uint i = 0; i < 7; ++i) {
if (rdays.testBit(i)) {
++count;
*wk |= (1 << i);
}
}
}
// Check for any possible days which could be duplicated by
// a positive and a negative position.
for (int i = 0; i < 4; ++i) {
if (negative[i] & (positive[i] | positive[i+1]))
return -1;
}
return count;
}
// Get the days in this month which recur, in numerical order.
// Reply = true if day numbers varies from month to month.
-bool Recurrence::getMonthlyDayDays(QValueList<int> &list, int daysInMonth) const
+bool Recurrence::getMonthlyDayDays(Q3ValueList<int> &list, int daysInMonth) const
{
list.clear();
bool variable = false;
Q_UINT32 days = 0;
- for (QPtrListIterator<int> it(rMonthDays); it.current(); ++it) {
+ for (Q3PtrListIterator<int> it(rMonthDays); it.current(); ++it) {
int day = *it.current();
if (day > 0) {
// date in the month
if (day <= daysInMonth)
days |= 1 << (day - 1);
if (day > 28 && day <= 31)
variable = true; // this date does not appear in some months
} else if (day < 0) {
// days before the end of the month
variable = true; // this date varies depending on the month length
day = daysInMonth + day; // zero-based day of month
if (day >= 0)
days |= 1 << day;
}
}
// Compile the ordered list
Q_UINT32 mask = 1;
for (int i = 0; i < daysInMonth; mask <<= 1, ++i) {
if (days & mask)
list.append(i + 1);
}
return variable;
}
// Get the months which recur, in numerical order, for both leap years and non-leap years.
// N.B. If February 29th recurs on March 1st in non-leap years, February (not March) is
// included in the non-leap year month list.
// Reply = true if February 29th also recurs.
-bool Recurrence::getYearlyMonthMonths(int day, QValueList<int> &list, QValueList<int> &leaplist) const
+bool Recurrence::getYearlyMonthMonths(int day, Q3ValueList<int> &list, Q3ValueList<int> &leaplist) const
{
list.clear();
leaplist.clear();
bool feb29 = false;
- for (QPtrListIterator<int> it(rYearNums); it.current(); ++it) {
+ for (Q3PtrListIterator<int> it(rYearNums); it.current(); ++it) {
int month = *it.current();
if (month == 2) {
if (day <= 28) {
list.append(month); // date appears in February
leaplist.append(month);
}
else if (day == 29) {
// February 29th
leaplist.append(month);
switch (mFeb29YearlyType) {
case rFeb28:
case rMar1:
list.append(2);
break;
case rFeb29:
break;
@@ -3174,102 +3177,102 @@ int Recurrence::getLastDayInWeek(int endDay, bool useWeekStart) const
if (i == last)
return 0;
}
}
/* From the recurrence monthly day number list or monthly day of week/week of
* month list, get the earliest day in the specified month which is >= the
* earliestDate.
*/
QDate Recurrence::getFirstDateInMonth(const QDate &earliestDate) const
{
int earliestDay = earliestDate.day();
int daysInMonth = earliestDate.daysInMonth();
switch (recurs) {
case rMonthlyDay: {
int minday = daysInMonth + 1;
- for (QPtrListIterator<int> it(rMonthDays); it.current(); ++it) {
+ for (Q3PtrListIterator<int> it(rMonthDays); it.current(); ++it) {
int day = *it.current();
if (day < 0)
day = daysInMonth + day + 1;
if (day >= earliestDay && day < minday)
minday = day;
}
if (minday <= daysInMonth)
return earliestDate.addDays(minday - earliestDay);
break;
}
case rMonthlyPos:
case rYearlyPos: {
QDate monthBegin(earliestDate.addDays(1 - earliestDay));
- QValueList<int> dayList;
+ Q3ValueList<int> dayList;
getMonthlyPosDays(dayList, daysInMonth, monthBegin.dayOfWeek());
- for (QValueList<int>::ConstIterator id = dayList.begin(); id != dayList.end(); ++id) {
+ for (Q3ValueList<int>::ConstIterator id = dayList.begin(); id != dayList.end(); ++id) {
if (*id >= earliestDay)
return monthBegin.addDays(*id - 1);
}
break;
}
}
return QDate();
}
/* From the recurrence monthly day number list or monthly day of week/week of
* month list, get the latest day in the specified month which is <= the
* latestDate.
*/
QDate Recurrence::getLastDateInMonth(const QDate &latestDate) const
{
int latestDay = latestDate.day();
int daysInMonth = latestDate.daysInMonth();
switch (recurs) {
case rMonthlyDay: {
int maxday = -1;
- for (QPtrListIterator<int> it(rMonthDays); it.current(); ++it) {
+ for (Q3PtrListIterator<int> it(rMonthDays); it.current(); ++it) {
int day = *it.current();
if (day < 0)
day = daysInMonth + day + 1;
if (day <= latestDay && day > maxday)
maxday = day;
}
if (maxday > 0)
return QDate(latestDate.year(), latestDate.month(), maxday);
break;
}
case rMonthlyPos:
case rYearlyPos: {
QDate monthBegin(latestDate.addDays(1 - latestDay));
- QValueList<int> dayList;
+ Q3ValueList<int> dayList;
getMonthlyPosDays(dayList, daysInMonth, monthBegin.dayOfWeek());
- for (QValueList<int>::ConstIterator id = dayList.fromLast(); id != dayList.end(); --id) {
+ for (Q3ValueList<int>::ConstIterator id = dayList.fromLast(); id != dayList.end(); --id) {
if (*id <= latestDay)
return monthBegin.addDays(*id - 1);
}
break;
}
}
return QDate();
}
/* From the recurrence yearly month list or yearly day list, get the earliest
* month or day in the specified year which is >= the earliestDate.
* Note that rYearNums is sorted in numerical order.
*/
QDate Recurrence::getFirstDateInYear(const QDate &earliestDate) const
{
- QPtrListIterator<int> it(rYearNums);
+ Q3PtrListIterator<int> it(rYearNums);
switch (recurs) {
case rYearlyMonth: {
int day = recurStart().date().day();
int earliestYear = earliestDate.year();
int earliestMonth = earliestDate.month();
int earliestDay = earliestDate.day();
if (earliestDay > day) {
// The earliest date is later in the month than the recurrence date,
// so skip to the next month before starting to check
if (++earliestMonth > 12)
return QDate();
}
for ( ; it.current(); ++it) {
int month = *it.current();
if (month >= earliestMonth) {
if (day <= 28 || QDate::isValid(earliestYear, month, day))
@@ -3279,70 +3282,70 @@ QDate Recurrence::getFirstDateInYear(const QDate &earliestDate) const
switch (mFeb29YearlyType) {
case rMar1:
return QDate(earliestYear, 3, 1);
case rFeb28:
if (earliestDay <= 28)
return QDate(earliestYear, 2, 28);
break;
case rFeb29:
break;
}
}
}
}
break;
}
case rYearlyPos: {
- QValueList<int> dayList;
+ Q3ValueList<int> dayList;
int earliestYear = earliestDate.year();
int earliestMonth = earliestDate.month();
int earliestDay = earliestDate.day();
for ( ; it.current(); ++it) {
int month = *it.current();
if (month >= earliestMonth) {
QDate monthBegin(earliestYear, month, 1);
getMonthlyPosDays(dayList, monthBegin.daysInMonth(), monthBegin.dayOfWeek());
- for (QValueList<int>::ConstIterator id = dayList.begin(); id != dayList.end(); ++id) {
+ for (Q3ValueList<int>::ConstIterator id = dayList.begin(); id != dayList.end(); ++id) {
if (*id >= earliestDay)
return monthBegin.addDays(*id - 1);
}
earliestDay = 1;
}
}
break;
}
case rYearlyDay: {
int earliestDay = earliestDate.dayOfYear();
for ( ; it.current(); ++it) {
int day = *it.current();
if (day >= earliestDay && (day <= 365 || day <= earliestDate.daysInYear()))
return earliestDate.addDays(day - earliestDay);
}
break;
}
}
return QDate();
}
/* From the recurrence yearly month list or yearly day list, get the latest
* month or day in the specified year which is <= the latestDate.
* Note that rYearNums is sorted in numerical order.
*/
QDate Recurrence::getLastDateInYear(const QDate &latestDate) const
{
- QPtrListIterator<int> it(rYearNums);
+ Q3PtrListIterator<int> it(rYearNums);
switch (recurs) {
case rYearlyMonth: {
int day = recurStart().date().day();
int latestYear = latestDate.year();
int latestMonth = latestDate.month();
if (latestDate.day() > day) {
// The latest date is earlier in the month than the recurrence date,
// so skip to the previous month before starting to check
if (--latestMonth <= 0)
return QDate();
}
for (it.toLast(); it.current(); --it) {
int month = *it.current();
if (month <= latestMonth) {
if (day <= 28 || QDate::isValid(latestYear, month, day))
return QDate(latestYear, month, day);
@@ -3351,42 +3354,42 @@ QDate Recurrence::getLastDateInYear(const QDate &latestDate) const
switch (mFeb29YearlyType) {
case rMar1:
if (latestMonth >= 3)
return QDate(latestYear, 3, 1);
break;
case rFeb28:
return QDate(latestYear, 2, 28);
case rFeb29:
break;
}
}
}
}
break;
}
case rYearlyPos: {
- QValueList<int> dayList;
+ Q3ValueList<int> dayList;
int latestYear = latestDate.year();
int latestMonth = latestDate.month();
int latestDay = latestDate.day();
for (it.toLast(); it.current(); --it) {
int month = *it.current();
if (month <= latestMonth) {
QDate monthBegin(latestYear, month, 1);
getMonthlyPosDays(dayList, monthBegin.daysInMonth(), monthBegin.dayOfWeek());
- for (QValueList<int>::ConstIterator id = dayList.fromLast(); id != dayList.end(); --id) {
+ for (Q3ValueList<int>::ConstIterator id = dayList.fromLast(); id != dayList.end(); --id) {
if (*id <= latestDay)
return monthBegin.addDays(*id - 1);
}
latestDay = 31;
}
}
break;
}
case rYearlyDay: {
int latestDay = latestDate.dayOfYear();
for (it.toLast(); it.current(); --it) {
int day = *it.current();
if (day <= latestDay)
return latestDate.addDays(day - latestDay);
}
break;
diff --git a/libkcal/recurrence.h b/libkcal/recurrence.h
index b13d14f..5b5aab1 100644
--- a/libkcal/recurrence.h
+++ b/libkcal/recurrence.h
@@ -11,33 +11,35 @@
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_RECURRENCE_H
#define KCAL_RECURRENCE_H
#include <qstring.h>
#include <qbitarray.h>
-#include <qptrlist.h>
+#include <q3ptrlist.h>
+//Added by qt3to4:
+#include <Q3ValueList>
namespace KCal {
class Incidence;
/**
This class represents a recurrence rule for a calendar incidence.
*/
class Recurrence
{
public:
/** enumeration for describing how an event recurs, if at all. */
enum { rNone = 0, rMinutely = 0x001, rHourly = 0x0002, rDaily = 0x0003,
rWeekly = 0x0004, rMonthlyPos = 0x0005, rMonthlyDay = 0x0006,
rYearlyMonth = 0x0007, rYearlyDay = 0x0008, rYearlyPos = 0x0009 };
@@ -235,80 +237,80 @@ class Recurrence
/** same as above, but with ending date not number of recurrences */
void setMonthly(short type, int _rFreq, const QDate &endDate);
/** Adds a position to the recursMonthlyPos recurrence rule, if it is
* set.
* @var _rPos the position in the month for the recurrence, with valid
* values being 1-5 (5 weeks max in a month).
* @var _rDays the days for the position to recur on (bit 0 = Monday).
* Example: _rPos = 2, and bits 0 and 2 are set in _rDays:
* the rule is to repeat every 2nd Monday and Wednesday in the month.
*/
void addMonthlyPos(short _rPos, const QBitArray &_rDays);
/** Adds a position the the recursMonthlyDay list.
* @var _rDay the date in the month to recur.
*/
void addMonthlyDay(short _rDay);
/** Returns list of day positions in months. */
- const QPtrList<rMonthPos> &monthPositions() const;
+ const Q3PtrList<rMonthPos> &monthPositions() const;
/** Returns list of day numbers of a month. */
- const QPtrList<int> &monthDays() const;
+ const Q3PtrList<int> &monthDays() const;
/** Sets an event to recur yearly.
* @var type rYearlyMonth, rYearlyPos or rYearlyDay
* @var freq the frequency to recur, e.g. 3 for every third year.
* @var duration the number of times the event is to occur, or -1 to recur indefinitely.
*/
void setYearly(int type, int freq, int duration);
/** Sets an event to recur yearly ending at \a endDate. */
void setYearly(int type, int freq, const QDate &endDate);
/** Sets an event to recur yearly on specified dates.
* The dates must be specified by calling addYearlyNum().
* @var type the way recurrences of February 29th are to be handled in non-leap years.
* @var freq the frequency to recur, e.g. 3 for every third year.
* @var duration the number of times the event is to occur, or -1 to recur indefinitely.
*/
void setYearlyByDate(Feb29Type type, int freq, int duration);
/** Sets an event to recur yearly ending at \a endDate. */
void setYearlyByDate(Feb29Type type, int freq, const QDate &endDate);
/** Adds position of day or month in year.
* N.B. for recursYearlyPos, addYearlyMonthPos() must also be called
* to add positions within the month. */
void addYearlyNum(short _rNum);
/** Adds a position to the recursYearlyPos recurrence rule, if it is set.
* N.B. addYearlyNum() must also be called to add recurrence months.
* Parameters are the same as for addMonthlyPos().
*/
void addYearlyMonthPos(short _rPos, const QBitArray &_rDays);
/** Returns positions of days or months in year. */
- const QPtrList<int> &yearNums() const;
+ const Q3PtrList<int> &yearNums() const;
/** Returns list of day positions in months, for a recursYearlyPos recurrence rule. */
- const QPtrList<rMonthPos> &yearMonthPositions() const;
+ const Q3PtrList<rMonthPos> &yearMonthPositions() const;
/** Returns how yearly recurrences of February 29th are handled. */
Feb29Type feb29YearlyType() const { return mFeb29YearlyType; }
/** Sets the default method for handling yearly recurrences of February 29th. */
static void setFeb29YearlyTypeDefault(Feb29Type t) { mFeb29YearlyDefaultType = t; }
/** Returns the default method for handling yearly recurrences of February 29th. */
static Feb29Type setFeb29YearlyTypeDefault() { return mFeb29YearlyDefaultType; }
void addYearlyMonth(short _rPos ); // added LR
/**
Debug output.
*/
void dump() const;
QString recurrenceText() const;
- bool getYearlyMonthMonths(int day, QValueList<int>&,
- QValueList<int> &leaplist) const;
+ bool getYearlyMonthMonths(int day, Q3ValueList<int>&,
+ Q3ValueList<int> &leaplist) const;
protected:
enum PeriodFunc { END_DATE_AND_COUNT, COUNT_TO_DATE, NEXT_AFTER_DATE };
struct MonthlyData; friend struct MonthlyData;
struct YearlyMonthData; friend struct YearlyMonthData;
struct YearlyPosData; friend struct YearlyPosData;
struct YearlyDayData; friend struct YearlyDayData;
bool recursSecondly(const QDate &, int secondFreq) const;
bool recursMinutelyAt(const QDateTime &dt, int minuteFreq) const;
bool recursDaily(const QDate &) const;
bool recursWeekly(const QDate &) const;
bool recursMonthly(const QDate &) const;
bool recursYearlyByMonth(const QDate &) const;
bool recursYearlyByPos(const QDate &) const;
bool recursYearlyByDay(const QDate &) const;
@@ -332,60 +334,60 @@ class Recurrence
int monthlyCalcToDate(const QDate& enddate, MonthlyData&) const;
int monthlyCalcNextAfter(QDate& enddate, MonthlyData&) const;
int yearlyMonthCalc(PeriodFunc, QDate &enddate) const;
int yearlyMonthCalcEndDate(QDate& enddate, YearlyMonthData&) const;
int yearlyMonthCalcToDate(const QDate& enddate, YearlyMonthData&) const;
int yearlyMonthCalcNextAfter(QDate& enddate, YearlyMonthData&) const;
int yearlyPosCalc(PeriodFunc, QDate &enddate) const;
int yearlyPosCalcEndDate(QDate& enddate, YearlyPosData&) const;
int yearlyPosCalcToDate(const QDate& enddate, YearlyPosData&) const;
int yearlyPosCalcNextAfter(QDate& enddate, YearlyPosData&) const;
int yearlyDayCalc(PeriodFunc, QDate &enddate) const;
int yearlyDayCalcEndDate(QDate& enddate, YearlyDayData&) const;
int yearlyDayCalcToDate(const QDate& enddate, YearlyDayData&) const;
int yearlyDayCalcNextAfter(QDate& enddate, YearlyDayData&) const;
int countMonthlyPosDays() const;
- void getMonthlyPosDays(QValueList<int>&, int daysInMonth,
+ void getMonthlyPosDays(Q3ValueList<int>&, int daysInMonth,
int startDayOfWeek) const;
- bool getMonthlyDayDays(QValueList<int>&, int daysInMonth) const;
+ bool getMonthlyDayDays(Q3ValueList<int>&, int daysInMonth) const;
int getFirstDayInWeek(int startDay, bool useWeekStart = true) const;
int getLastDayInWeek(int endDay, bool useWeekStart = true) const;
QDate getFirstDateInMonth(const QDate& earliestDate) const;
QDate getLastDateInMonth(const QDate& latestDate) const;
QDate getFirstDateInYear(const QDate& earliestDate) const;
QDate getLastDateInYear(const QDate& latestDate) const;
private:
// Prohibit copying
Recurrence(const Recurrence&);
Recurrence &operator=(const Recurrence&);
short recurs; // should be one of the enums.
int rWeekStart; // day which starts the week, Monday=1 .. Sunday=7
QBitArray rDays; // array of days during week it recurs
- QPtrList<rMonthPos> rMonthPositions; // list of positions during a month
+ Q3PtrList<rMonthPos> rMonthPositions; // list of positions during a month
// on which an event recurs
- QPtrList<int> rMonthDays; // list of days during a month on
+ Q3PtrList<int> rMonthDays; // list of days during a month on
// which the event recurs
- QPtrList<int> rYearNums; // either months/days to recur on for rYearly,
+ Q3PtrList<int> rYearNums; // either months/days to recur on for rYearly,
// sorted in numerical order
int rFreq; // frequency of period
// one of the following must be specified
int rDuration; // num times to recur (inc. first occurrence), -1 = infinite
QDateTime rEndDateTime; // date/time at which to end recurrence
QDateTime mRecurStart; // date/time of first recurrence
bool mFloats; // the recurrence has no time, just a date
bool mRecurReadOnly;
int mRecurExDatesCount; // number of recurrences (in addition to rDuration) which are excluded
Feb29Type mFeb29YearlyType; // how to handle yearly recurrences of February 29th
static Feb29Type mFeb29YearlyDefaultType; // default value for mFeb29YearlyType
// Backwards compatibility for KDE < 3.1.
diff --git a/libkcal/scheduler.cpp b/libkcal/scheduler.cpp
index 253d8b7..234cfcf 100644
--- a/libkcal/scheduler.cpp
+++ b/libkcal/scheduler.cpp
@@ -7,33 +7,35 @@
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 <qdir.h>
#include <qfile.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
+//Added by qt3to4:
+#include <Q3PtrList>
#include <klocale.h>
#include <kdebug.h>
#include <kstandarddirs.h>
#include "event.h"
#include "todo.h"
#include "freebusy.h"
#include "icalformat.h"
#include "calendar.h"
#include "scheduler.h"
using namespace KCal;
ScheduleMessage::ScheduleMessage(IncidenceBase *incidence,int method,ScheduleMessage::Status status)
@@ -251,34 +253,34 @@ bool Scheduler::acceptDeclineCounter(IncidenceBase *incidence,ScheduleMessage::S
//{
// deleteTransaction(incidence);
// return false;
//}
bool Scheduler::acceptReply(IncidenceBase *incidence,ScheduleMessage::Status status, Method method)
{
if(incidence->type()=="FreeBusy") {
return acceptFreeBusy(incidence, method);
}
bool ret = false;
Event *ev = mCalendar->event(incidence->uid());
Todo *to = mCalendar->todo(incidence->uid());
if (ev || to) {
//get matching attendee in calendar
kdDebug(5800) << "Scheduler::acceptTransaction match found!" << endl;
- QPtrList<Attendee> attendeesIn = incidence->attendees();
- QPtrList<Attendee> attendeesEv;
+ Q3PtrList<Attendee> attendeesIn = incidence->attendees();
+ Q3PtrList<Attendee> attendeesEv;
if (ev) attendeesEv = ev->attendees();
if (to) attendeesEv = to->attendees();
Attendee *attIn;
Attendee *attEv;
for ( attIn = attendeesIn.first(); attIn; attIn = attendeesIn.next() ) {
for ( attEv = attendeesEv.first(); attEv; attEv = attendeesEv.next() ) {
if (attIn->email()==attEv->email()) {
//update attendee-info
kdDebug(5800) << "Scheduler::acceptTransaction update attendee" << endl;
attEv->setStatus(attIn->status());
attEv->setRSVP(false);
// better to not update the sequence number with replys
//if (ev) ev->setRevision(ev->revision()+1);
//if (to) to->setRevision(to->revision()+1);
ret = true;
}
@@ -329,27 +331,27 @@ bool Scheduler::acceptFreeBusy(IncidenceBase *incidence, Method method)
}
}
QString filename(freeBusyDirName);
filename += "/";
filename += from;
filename += ".ifb";
QFile f(filename);
kdDebug() << "acceptFreeBusy: filename" << filename << endl;
freebusy->clearAttendees();
freebusy->setOrganizer(from);
QString messageText = mFormat->createScheduleMessage(freebusy, Publish);
- if (!f.open(IO_ReadWrite)) {
+ if (!f.open(QIODevice::ReadWrite)) {
kdDebug() << "acceptFreeBusy: Can't open:" << filename << " for writing" << endl;
return false;
}
- QTextStream t(&f);
+ Q3TextStream t(&f);
t << messageText;
f.close();
deleteTransaction(incidence);
return true;
}
diff --git a/libkcal/scheduler.h b/libkcal/scheduler.h
index a9f43b9..357e98e 100644
--- a/libkcal/scheduler.h
+++ b/libkcal/scheduler.h
@@ -10,33 +10,33 @@
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 SCHEDULER_H
#define SCHEDULER_H
// iTIP transactions base class
#include <qstring.h>
-#include <qptrlist.h>
+#include <q3ptrlist.h>
namespace KCal {
class IncidenceBase;
class Event;
class Calendar;
class ICalFormat;
/**
This class provides an encapsulation of a scheduling message. It associates an
incidence with a method and status information. This class is used by the
Scheduler class.
@short A Scheduling message
*/
class ScheduleMessage {
@@ -82,33 +82,33 @@ class Scheduler {
Declinecounter,NoMethod };
/** Create scheduler for calendar specified as argument. */
Scheduler(Calendar *calendar);
virtual ~Scheduler();
/** iTIP publish action */
virtual bool publish (IncidenceBase *incidence,const QString &recipients) = 0;
/** Perform iTIP transaction on incidence. The method is specified as the
method argumanet and can be any valid iTIP method. */
virtual bool performTransaction(IncidenceBase *incidence,Method method) = 0;
/** Perform iTIP transaction on incidence to specified recipient(s). The
method is specified as the method argumanet and can be any valid iTIP
method. */
virtual bool performTransaction(IncidenceBase *incidence,Method method,const QString &recipients) = 0;
/** Retrieve incoming iTIP transactions */
- virtual QPtrList<ScheduleMessage> retrieveTransactions() = 0;
+ virtual Q3PtrList<ScheduleMessage> retrieveTransactions() = 0;
/**
Accept transaction. The incidence argument specifies the iCal compoennt
on which the transaction acts. The status is the result of processing a
iTIP message with the current calendar and specifies the action to be
taken for this incidence.
*/
bool acceptTransaction(IncidenceBase *,Method method,ScheduleMessage::Status status);
/** Return a machine-readable name for a iTIP method. */
static QString methodName(Method);
/** Return a translated and human-readable name for a iTIP method. */
static QString translatedMethodName(Method);
virtual bool deleteTransaction(IncidenceBase *incidence);
diff --git a/libkcal/sharpformat.cpp b/libkcal/sharpformat.cpp
index 9b757f7..b8c2aa7 100644
--- a/libkcal/sharpformat.cpp
+++ b/libkcal/sharpformat.cpp
@@ -9,38 +9,38 @@
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 <qdatetime.h>
#include <qstring.h>
#include <qapplication.h>
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include <qregexp.h>
#include <qmessagebox.h>
#include <qclipboard.h>
#include <qfile.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <qtextcodec.h>
#include <qxml.h>
#include <qlabel.h>
#include <kdebug.h>
#include <klocale.h>
#include <kglobal.h>
#include "calendar.h"
#include "alarm.h"
#include "recurrence.h"
#include "calendarlocal.h"
#include "sharpformat.h"
#include "syncdefines.h"
@@ -353,55 +353,55 @@ bool SharpFormat::load( Calendar *calendar, Calendar *existngCal )
int dh = QApplication::desktop()->height();
status.setCaption(i18n("Reading DTM Data") );
status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
status.show();
status.raise();
qApp->processEvents();
QString fileName;
if ( ! debug ) {
fileName = "/tmp/kopitempout";
QString command ="db2file datebook -r -c "+ codec + " > " + fileName;
system ( command.latin1() );
} else {
fileName = "/tmp/events.txt";
}
QFile file( fileName );
- if (!file.open( IO_ReadOnly ) ) {
+ if (!file.open( QIODevice::ReadOnly ) ) {
return false;
}
- QTextStream ts( &file );
+ Q3TextStream ts( &file );
ts.setCodec( QTextCodec::codecForName("utf8") );
text = ts.read();
file.close();
status.setText( i18n("Processing events ...") );
status.raise();
qApp->processEvents();
fromString2Cal( calendar, existngCal, text, "Event" );
status.setText( i18n("Reading todos ...") );
qApp->processEvents();
if ( ! debug ) {
fileName = "/tmp/kopitempout";
QString command = "db2file todo -r -c " + codec+ " > " + fileName;
system ( command.latin1() );
} else {
fileName = "/tmp/todo.txt";
}
file.setName( fileName );
- if (!file.open( IO_ReadOnly ) ) {
+ if (!file.open( QIODevice::ReadOnly ) ) {
return false;
}
ts.setDevice( &file );
text = ts.read();
file.close();
status.setText( i18n("Processing todos ...") );
status.raise();
qApp->processEvents();
fromString2Cal( calendar, existngCal, text, "Todo" );
return true;
}
int SharpFormat::getNumFromRecord( QString answer, Incidence* inc )
{
int retval = -1;
@@ -462,222 +462,222 @@ bool SharpFormat::save( Calendar *calendar)
int w = status.sizeHint().width()+20 ;
if ( w < 200 ) w = 200;
int h = status.sizeHint().height()+20 ;
int dw = QApplication::desktop()->width();
int dh = QApplication::desktop()->height();
status.setCaption(i18n("Writing DTM Data") );
status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
status.show();
status.raise();
qApp->processEvents();
bool debug = DEBUGMODE;
QString codec = "utf8";
QString answer;
QString ePrefix = "CARDID,CATEGORY,DSRP,PLCE,MEM1,TIM1,TIM2,ADAY,ARON,ARMN,ARSD,RTYP,RFRQ,RPOS,RDYS,REND,REDT,ALSD,ALED,MDAY\n";
QString tPrefix = "CARDID,CATEGORY,ETDY,LTDY,FNDY,MARK,PRTY,TITL,MEM1\n";
QString command;
- QPtrList<Event> er = calendar->rawEvents();
+ Q3PtrList<Event> er = calendar->rawEvents();
Event* ev = er.first();
QString fileName = "/tmp/kopitempout";
int i = 0;
QString changeString = ePrefix;
QString deleteString = ePrefix;
bool deleteEnt = false;
bool changeEnt = false;
QString message = i18n("Processing event # ");
int procCount = 0;
while ( ev ) {
//qDebug("i %d ", ++i);
if ( ev->tempSyncStat() != SYNC_TEMPSTATE_NEW_EXTERNAL ) {
status.setText ( message + QString::number ( ++procCount ) );
qApp->processEvents();
QString eString = getEventString( ev );
if ( ev->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { // delete
// deleting empty strings does not work.
// we write first and x and then delete the record with the x
eString = eString.replace( QRegExp(",\"\""),",\"x\"" );
changeString += eString + "\n";
deleteString += eString + "\n";
deleteEnt = true;
changeEnt = true;
}
else if ( ev->getID("Sharp_DTM").isEmpty() ) { // add new
QString fileNameIn = "/tmp/kopitempin";
QFile fileIn( fileNameIn );
- if (!fileIn.open( IO_WriteOnly ) ) {
+ if (!fileIn.open( QIODevice::WriteOnly ) ) {
return false;
}
- QTextStream tsIn( &fileIn );
+ Q3TextStream tsIn( &fileIn );
tsIn.setCodec( QTextCodec::codecForName("utf8") );
tsIn << ePrefix << eString ;
fileIn.close();
//command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName;
command = "(cat /tmp/kopitempin | db2file datebook -w -g -c " + codec+ ") > "+ fileName;
//qDebug("command ++++++++ ");
//qDebug("%s ",command.latin1());
//qDebug("command -------- ");
system ( command.utf8() );
QFile file( fileName );
- if (!file.open( IO_ReadOnly ) ) {
+ if (!file.open( QIODevice::ReadOnly ) ) {
return false;
}
- QTextStream ts( &file );
+ Q3TextStream ts( &file );
ts.setCodec( QTextCodec::codecForName("utf8") );
answer = ts.read();
file.close();
//qDebug("answer \n%s ", answer.latin1());
getNumFromRecord( answer, ev ) ;
}
else { // change existing
//qDebug("canging %d %d",ev->zaurusStat() ,ev->zaurusId() );
//command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName;
changeString += eString + "\n";
changeEnt = true;
}
}
ev = er.next();
}
status.setText ( i18n("Changing events ...") );
qApp->processEvents();
//qDebug("changing... ");
if ( changeEnt ) {
QFile file( fileName );
- if (!file.open( IO_WriteOnly ) ) {
+ if (!file.open( QIODevice::WriteOnly ) ) {
return false;
}
- QTextStream ts( &file );
+ Q3TextStream ts( &file );
ts.setCodec( QTextCodec::codecForName("utf8") );
ts << changeString ;
file.close();
command = "db2file datebook -w -g -c " + codec+ " < "+ fileName;
system ( command.latin1() );
//qDebug("command %s file :\n%s ", command.latin1(), changeString.latin1());
}
status.setText ( i18n("Deleting events ...") );
qApp->processEvents();
//qDebug("deleting... ");
if ( deleteEnt ) {
QFile file( fileName );
- if (!file.open( IO_WriteOnly ) ) {
+ if (!file.open( QIODevice::WriteOnly ) ) {
return false;
}
- QTextStream ts( &file );
+ Q3TextStream ts( &file );
ts.setCodec( QTextCodec::codecForName("utf8") );
ts << deleteString;
file.close();
command = "db2file datebook -d -c " + codec+ " < "+ fileName;
system ( command.latin1() );
// qDebug("command %s file :\n%s ", command.latin1(), deleteString.latin1());
}
changeString = tPrefix;
deleteString = tPrefix;
status.setText ( i18n("Processing todos ...") );
qApp->processEvents();
- QPtrList<Todo> tl = calendar->rawTodos();
+ Q3PtrList<Todo> tl = calendar->rawTodos();
Todo* to = tl.first();
i = 0;
message = i18n("Processing todo # ");
procCount = 0;
while ( to ) {
if ( to->tempSyncStat() != SYNC_TEMPSTATE_NEW_EXTERNAL ) {
status.setText ( message + QString::number ( ++procCount ) );
qApp->processEvents();
QString eString = getTodoString( to );
if ( to->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { // delete
// deleting empty strings does not work.
// we write first and x and then delete the record with the x
eString = eString.replace( QRegExp(",\"\""),",\"x\"" );
changeString += eString + "\n";
deleteString += eString + "\n";
deleteEnt = true;
changeEnt = true;
}
else if ( to->getID("Sharp_DTM").isEmpty() ) { // add new
QString fileNameIn = "/tmp/kopitempin";
QFile fileIn( fileNameIn );
- if (!fileIn.open( IO_WriteOnly ) ) {
+ if (!fileIn.open( QIODevice::WriteOnly ) ) {
return false;
}
- QTextStream tsIn( &fileIn );
+ Q3TextStream tsIn( &fileIn );
tsIn.setCodec( QTextCodec::codecForName("utf8") );
tsIn << tPrefix << eString ;
fileIn.close();
command = "(cat /tmp/kopitempin | db2file todo -w -g -c " + codec+ ") > "+ fileName;
system ( command.utf8() );
QFile file( fileName );
- if (!file.open( IO_ReadOnly ) ) {
+ if (!file.open( QIODevice::ReadOnly ) ) {
return false;
}
- QTextStream ts( &file );
+ Q3TextStream ts( &file );
ts.setCodec( QTextCodec::codecForName("utf8") );
answer = ts.read();
file.close();
//qDebug("answer \n%s ", answer.latin1());
getNumFromRecord( answer, to ) ;
}
else { // change existing
//qDebug("canging %d %d",to->zaurusStat() ,to->zaurusId() );
//command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName;
changeString += eString + "\n";
changeEnt = true;
}
}
to = tl.next();
}
status.setText ( i18n("Changing todos ...") );
qApp->processEvents();
//qDebug("changing... ");
if ( changeEnt ) {
QFile file( fileName );
- if (!file.open( IO_WriteOnly ) ) {
+ if (!file.open( QIODevice::WriteOnly ) ) {
return false;
}
- QTextStream ts( &file );
+ Q3TextStream ts( &file );
ts.setCodec( QTextCodec::codecForName("utf8") );
ts << changeString ;
file.close();
command = "db2file todo -w -g -c " + codec+ " < "+ fileName;
system ( command.latin1() );
//qDebug("command %s file :\n%s ", command.latin1(), changeString.latin1());
}
status.setText ( i18n("Deleting todos ...") );
qApp->processEvents();
//qDebug("deleting... ");
if ( deleteEnt ) {
QFile file( fileName );
- if (!file.open( IO_WriteOnly ) ) {
+ if (!file.open( QIODevice::WriteOnly ) ) {
return false;
}
- QTextStream ts( &file );
+ Q3TextStream ts( &file );
ts.setCodec( QTextCodec::codecForName("utf8") );
ts << deleteString;
file.close();
command = "db2file todo -d -c " + codec+ " < "+ fileName;
system ( command.latin1() );
// qDebug("command %s file :\n%s ", command.latin1(), deleteString.latin1());
}
return true;
}
QString SharpFormat::dtToString( const QDateTime& dti, bool useTZ )
{
QString datestr;
QString timestr;
int offset = KGlobal::locale()->localTimeOffset( dti );
QDateTime dt;
@@ -770,33 +770,33 @@ QString SharpFormat::getEventString( Event* event )
days += 1 << (i-1);
}
}
list.append( QString::number( days ) );
}
//pending weekdays
writeEndDate = true;
break;
case Recurrence::rMonthlyPos:// 2
list.append( "2" );
list.append( QString::number( rec->frequency()) );//12
writeEndDate = true;
{
int count = 1;
- QPtrList<Recurrence::rMonthPos> rmp;
+ Q3PtrList<Recurrence::rMonthPos> rmp;
rmp = rec->monthPositions();
if ( rmp.first()->negative )
count = 5 - rmp.first()->rPos - 1;
else
count = rmp.first()->rPos - 1;
list.append( QString::number( count ) );
}
list.append( "0" );
break;
case Recurrence::rMonthlyDay:// 3
list.append( "3" );
list.append( QString::number( rec->frequency()) );//12
list.append( "0" );
list.append( "0" );
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index cc1c5ae..5a0c32e 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -610,33 +610,33 @@ QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_d
iscompleted = false;
}
}
if ( iscompleted ) {
return QDateTime ();
}
QDateTime incidenceStart;
incidenceStart = dtDue();
bool enabled = false;
Alarm* alarm;
int off = 0;
QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );;
// if ( QDateTime::currentDateTime() > incidenceStart ){
// *ok = false;
// return incidenceStart;
// }
- for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) {
+ for (Q3PtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) {
if (alarm->enabled()) {
if ( alarm->hasTime () ) {
if ( alarm->time() < alarmStart ) {
alarmStart = alarm->time();
enabled = true;
off = alarmStart.secsTo( incidenceStart );
}
} else {
int secs = alarm->startOffset().asSeconds();
if ( incidenceStart.addSecs( secs ) < alarmStart ) {
alarmStart = incidenceStart.addSecs( secs );
enabled = true;
off = -secs;
}
}
diff --git a/libkcal/todo.h b/libkcal/todo.h
index 2131732..cea976c 100644
--- a/libkcal/todo.h
+++ b/libkcal/todo.h
@@ -13,47 +13,49 @@
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 TODO_H
#define TODO_H
//
// Todo component, representing a VTODO object
//
#include "incidence.h"
#include <qtimer.h>
+//Added by qt3to4:
+#include <Q3CString>
namespace KCal {
/**
This class provides a Todo in the sense of RFC2445.
*/
class Todo : public QObject,public Incidence
{
Q_OBJECT
public:
Todo();
Todo(const Todo &);
~Todo();
typedef ListBase<Todo> List;
- QCString type() const { return "Todo"; }
+ Q3CString type() const { return "Todo"; }
IncTypeID typeID() const { return todoID; }
/** Return an exact copy of this todo. */
Incidence *clone();
QDateTime getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const;
/** for setting the todo's due date/time with a QDateTime. */
void setDtDue(const QDateTime &dtDue);
/** returns an event's Due date/time as a QDateTime. */
QDateTime dtDue() const;
/** returns an event's due time as a string formatted according to the
users locale settings */
QString dtDueTimeStr() const;
/** returns an event's due date as a string formatted according to the
users locale settings */
QString dtDueDateStr(bool shortfmt=true) const;
diff --git a/libkcal/vcaldrag.cpp b/libkcal/vcaldrag.cpp
index f01f332..324981e 100644
--- a/libkcal/vcaldrag.cpp
+++ b/libkcal/vcaldrag.cpp
@@ -13,33 +13,33 @@
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 "vcaldrag.h"
#include "vcalformat.h"
using namespace KCal;
VCalDrag::VCalDrag( Calendar *cal, QWidget *parent, const char *name )
- : QStoredDrag( "text/x-vCalendar", parent, name )
+ : Q3StoredDrag( "text/x-vCalendar", parent, name )
{
VCalFormat format;
setEncodedData( format.toString( cal ).utf8() );
}
bool VCalDrag::canDecode( QMimeSource *me )
{
return me->provides( "text/x-vCalendar" );
}
bool VCalDrag::decode( QMimeSource *de, Calendar *cal )
{
bool success = false;
QByteArray payload = de->encodedData( "text/x-vCalendar" );
if ( payload.size() ) {
diff --git a/libkcal/vcaldrag.h b/libkcal/vcaldrag.h
index 3048124..68a320d 100644
--- a/libkcal/vcaldrag.h
+++ b/libkcal/vcaldrag.h
@@ -9,39 +9,39 @@
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 VCALDRAG_H
#define VCALDRAG_H
-#include <qdragobject.h>
+#include <q3dragobject.h>
namespace KCal {
class Calendar;
/** vCalendar drag&drop class. */
-class VCalDrag : public QStoredDrag {
+class VCalDrag : public Q3StoredDrag {
public:
/** Create a drag&drop object for vCalendar component \a vcal. */
VCalDrag( Calendar *vcal, QWidget *parent = 0, const char *name = 0 );
~VCalDrag() {};
/** Return, if drag&drop object can be decode to vCalendar. */
static bool canDecode( QMimeSource * );
/** Decode drag&drop object to vCalendar component \a vcal. */
static bool decode( QMimeSource *e, Calendar *cal );
};
}
#endif
diff --git a/libkcal/vcalformat.cpp b/libkcal/vcalformat.cpp
index 2e19740..9cbaf16 100644
--- a/libkcal/vcalformat.cpp
+++ b/libkcal/vcalformat.cpp
@@ -9,37 +9,39 @@
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 <qapplication.h>
#include <qdatetime.h>
#include <qstring.h>
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include <qregexp.h>
#include <qclipboard.h>
#include <qdialog.h>
#include <qfile.h>
+//Added by qt3to4:
+#include <Q3CString>
#include <kdebug.h>
#include <kglobal.h>
#include <kmessagebox.h>
#include <kiconloader.h>
#include <klocale.h>
#include "vcc.h"
#include "vobject.h"
#include "vcaldrag.h"
#include "calendar.h"
#include "vcalformat.h"
using namespace KCal;
@@ -95,63 +97,63 @@ bool VCalFormat::save(Calendar *calendar, const QString &fileName)
useLocalTime = mCalendar->isLocalTime();
QString tmpStr;
VObject *vcal, *vo;
vcal = newVObject(VCCalProp);
// addPropValue(vcal,VCLocationProp, "0.0");
addPropValue(vcal,VCProdIdProp, productId());
tmpStr = mCalendar->getTimeZoneStr();
//qDebug("mCalendar->getTimeZoneStr() %s",tmpStr.latin1() );
addPropValue(vcal,VCTimeZoneProp, tmpStr.local8Bit());
addPropValue(vcal,VCVersionProp, _VCAL_VERSION);
// TODO STUFF
- QPtrList<Todo> todoList = mCalendar->rawTodos();
- QPtrListIterator<Todo> qlt(todoList);
+ Q3PtrList<Todo> todoList = mCalendar->rawTodos();
+ Q3PtrListIterator<Todo> qlt(todoList);
for (; qlt.current(); ++qlt) {
vo = eventToVTodo(qlt.current());
addVObjectProp(vcal, vo);
}
// EVENT STUFF
- QPtrList<Event> events = mCalendar->rawEvents();
+ Q3PtrList<Event> events = mCalendar->rawEvents();
Event *ev;
for(ev=events.first();ev;ev=events.next()) {
vo = eventToVEvent(ev);
addVObjectProp(vcal, vo);
}
writeVObjectToFile(QFile::encodeName(fileName).data() ,vcal);
cleanVObjects(vcal);
cleanStrTbl();
if (QFile::exists(fileName)) {
return true;
} else {
return false; // error
}
}
bool VCalFormat::fromString( Calendar *calendar, const QString &text )
{
// TODO: Factor out VCalFormat::fromString()
- QCString data = text.utf8();
+ Q3CString data = text.utf8();
if ( !data.size() ) return false;
VObject *vcal = Parse_MIME( data.data(), data.size());
if ( !vcal ) return false;
VObjectIterator i;
VObject *curvo;
initPropIterator( &i, vcal );
// we only take the first object. TODO: parse all incidences.
do {
curvo = nextVObject( &i );
} while ( strcmp( vObjectName( curvo ), VCEventProp ) &&
strcmp( vObjectName( curvo ), VCTodoProp ) );
@@ -197,33 +199,33 @@ QString VCalFormat::todoToString( Todo * todo, Calendar *calendar, bool useLocal
useLocalTime = useL;
return result;
}
QString VCalFormat::toString( Calendar *calendar )
{
// TODO: Factor out VCalFormat::asString()
VObject *vcal = newVObject(VCCalProp);
addPropValue( vcal, VCProdIdProp, CalFormat::productId() );
QString tmpStr = mCalendar->getTimeZoneStr();
addPropValue( vcal, VCTimeZoneProp, tmpStr.local8Bit() );
addPropValue( vcal, VCVersionProp, _VCAL_VERSION );
// TODO: Use all data.
- QPtrList<Event> events = calendar->events();
+ Q3PtrList<Event> events = calendar->events();
Event *event = events.first();
if ( !event ) return QString::null;
VObject *vevent = eventToVEvent( event );
addVObjectProp( vcal, vevent );
char *buf = writeMemVObject( 0, 0, vcal );
QString result( buf );
cleanVObject( vcal );
return result;
}
@@ -258,34 +260,34 @@ VObject *VCalFormat::eventToVTodo(const Todo *anEvent)
anEvent->uid().local8Bit());
// revision
tmpStr.sprintf("%i", anEvent->revision());
addPropValue(vtodo, VCSequenceProp, tmpStr.local8Bit());
// last modification date
tmpStr = qDateTimeToISO(anEvent->lastModified());
addPropValue(vtodo, VCLastModifiedProp, tmpStr.local8Bit());
// organizer stuff
tmpStr = "MAILTO:" + anEvent->organizer();
addPropValue(vtodo, ICOrganizerProp, tmpStr.local8Bit());
// attendees
if (anEvent->attendeeCount() != 0) {
- QPtrList<Attendee> al = anEvent->attendees();
- QPtrListIterator<Attendee> ai(al);
+ Q3PtrList<Attendee> al = anEvent->attendees();
+ Q3PtrListIterator<Attendee> ai(al);
Attendee *curAttendee;
for (; ai.current(); ++ai) {
curAttendee = ai.current();
if (!curAttendee->email().isEmpty() &&
!curAttendee->name().isEmpty())
tmpStr = "MAILTO:" + curAttendee->name() + " <" +
curAttendee->email() + ">";
else if (curAttendee->name().isEmpty())
tmpStr = "MAILTO: " + curAttendee->email();
else if (curAttendee->email().isEmpty())
tmpStr = "MAILTO: " + curAttendee->name();
else if (curAttendee->name().isEmpty() &&
curAttendee->email().isEmpty())
kdDebug(5800) << "warning! this Event has an attendee w/o name or email!" << endl;
VObject *aProp = addPropValue(vtodo, VCAttendeeProp, tmpStr.local8Bit());
@@ -313,62 +315,62 @@ VObject *VCalFormat::eventToVTodo(const Todo *anEvent)
// completed
// status
// backward compatibility, KOrganizer used to interpret only these two values
addPropValue(vtodo, VCStatusProp, anEvent->isCompleted() ? "COMPLETED" :
"NEEDS_ACTION");
// completion date
if (anEvent->hasCompletedDate()) {
tmpStr = qDateTimeToISO(anEvent->completed());
addPropValue(vtodo, VCCompletedProp, tmpStr.local8Bit());
}
// priority
tmpStr.sprintf("%i",anEvent->priority());
addPropValue(vtodo, VCPriorityProp, tmpStr.local8Bit());
// related event
- if (anEvent->relatedToUid()) {
+ if (!anEvent->relatedToUid().isEmpty()) {
addPropValue(vtodo, VCRelatedToProp,
anEvent->relatedToUid().local8Bit());
}
// categories
QStringList tmpStrList = anEvent->categories();
tmpStr = "";
QString catStr;
for ( QStringList::Iterator it = tmpStrList.begin();
it != tmpStrList.end();
++it ) {
catStr = *it;
if (catStr[0] == ' ')
tmpStr += catStr.mid(1);
else
tmpStr += catStr;
// this must be a ';' character as the vCalendar specification requires!
// vcc.y has been hacked to translate the ';' to a ',' when the vcal is
// read in.
tmpStr += ";";
}
if (!tmpStr.isEmpty()) {
tmpStr.truncate(tmpStr.length()-1);
addPropValue(vtodo, VCCategoriesProp, tmpStr.local8Bit());
}
// alarm stuff
kdDebug(5800) << "vcalformat::eventToVTodo was called" << endl;
- QPtrList<Alarm> alarms = anEvent->alarms();
+ Q3PtrList<Alarm> alarms = anEvent->alarms();
Alarm* alarm;
for (alarm = alarms.first(); alarm; alarm = alarms.next()) {
if (alarm->enabled()) {
VObject *a;
tmpStr = qDateTimeToISO(alarm->time());
if (alarm->type() == Alarm::Audio) {
a = addProp(vtodo, VCAAlarmProp);
addPropValue(a, VCRunTimeProp, tmpStr.local8Bit());
addPropValue(a, VCRepeatCountProp, "1");
addPropValue(a, VCAudioContentProp, QFile::encodeName(alarm->audioFile()));
}
else if (alarm->type() == Alarm::Procedure) {
a = addProp(vtodo, VCPAlarmProp);
addPropValue(a, VCRunTimeProp, tmpStr.local8Bit());
addPropValue(a, VCRepeatCountProp, "1");
addPropValue(a, VCProcedureNameProp, QFile::encodeName(alarm->programFile()));
@@ -420,62 +422,62 @@ VObject* VCalFormat::eventToVEvent(Event *anEvent)
addPropValue(vevent, VCUniqueStringProp,
anEvent->uid().local8Bit());
// revision
tmpStr.sprintf("%i", anEvent->revision());
addPropValue(vevent, VCSequenceProp, tmpStr.local8Bit());
// last modification date
tmpStr = qDateTimeToISO(anEvent->lastModified());
addPropValue(vevent, VCLastModifiedProp, tmpStr.local8Bit());
// attendee and organizer stuff
tmpStr = "MAILTO:" + anEvent->organizer();
addPropValue(vevent, ICOrganizerProp, tmpStr.local8Bit());
if (anEvent->attendeeCount() != 0) {
- QPtrList<Attendee> al = anEvent->attendees();
- QPtrListIterator<Attendee> ai(al);
+ Q3PtrList<Attendee> al = anEvent->attendees();
+ Q3PtrListIterator<Attendee> ai(al);
Attendee *curAttendee;
// TODO: Put this functionality into Attendee class
for (; ai.current(); ++ai) {
curAttendee = ai.current();
if (!curAttendee->email().isEmpty() &&
!curAttendee->name().isEmpty())
tmpStr = "MAILTO:" + curAttendee->name() + " <" +
curAttendee->email() + ">";
else if (curAttendee->name().isEmpty())
tmpStr = "MAILTO: " + curAttendee->email();
else if (curAttendee->email().isEmpty())
tmpStr = "MAILTO: " + curAttendee->name();
else if (curAttendee->name().isEmpty() &&
curAttendee->email().isEmpty())
kdDebug(5800) << "warning! this Event has an attendee w/o name or email!" << endl;
VObject *aProp = addPropValue(vevent, VCAttendeeProp, tmpStr.local8Bit());
addPropValue(aProp, VCRoleProp, writeRole(curAttendee->role()));
addPropValue(aProp, VCRSVPProp, curAttendee->RSVP() ? "TRUE" : "FALSE");
addPropValue(aProp, VCStatusProp, writeStatus(curAttendee->status()));
}
}
// recurrence rule stuff
if (anEvent->doesRecur()) {
// some more variables
- QPtrList<Recurrence::rMonthPos> tmpPositions;
- QPtrList<int> tmpDays;
+ Q3PtrList<Recurrence::rMonthPos> tmpPositions;
+ Q3PtrList<int> tmpDays;
int *tmpDay;
Recurrence::rMonthPos *tmpPos;
QString tmpStr2;
int i;
switch(anEvent->recurrence()->doesRecur()) {
case Recurrence::rDaily:
tmpStr.sprintf("D%i ",anEvent->recurrence()->frequency());
// if (anEvent->rDuration > 0)
// tmpStr += "#";
break;
case Recurrence::rWeekly:
tmpStr.sprintf("W%i ",anEvent->recurrence()->frequency());
for (i = 0; i < 7; i++) {
if (anEvent->recurrence()->days().testBit(i))
tmpStr += dayFromNum(i);
@@ -532,33 +534,33 @@ VObject* VCalFormat::eventToVEvent(Event *anEvent)
tmpDay = tmpDays.next()) {
tmpStr2.sprintf("%i ", *tmpDay);
tmpStr += tmpStr2;
}
break;
default:
kdDebug(5800) << "ERROR, it should never get here in eventToVEvent!" << endl;
break;
} // switch
if (anEvent->recurrence()->duration() > 0) {
tmpStr2.sprintf("#%i",anEvent->recurrence()->duration());
tmpStr += tmpStr2;
} else if (anEvent->recurrence()->duration() == -1) {
tmpStr += "#0"; // defined as repeat forever
} else {
- tmpStr += qDateTimeToISO(anEvent->recurrence()->endDate(), FALSE);
+ tmpStr += qDateTimeToISO((QDateTime)anEvent->recurrence()->endDate(), FALSE);
}
addPropValue(vevent,VCRRuleProp, tmpStr.local8Bit());
} // event repeats
// exceptions to recurrence
DateList dateList = anEvent->exDates();
DateList::ConstIterator it;
QString tmpStr2;
for (it = dateList.begin(); it != dateList.end(); ++it) {
tmpStr = qDateToISO(*it) + ";";
tmpStr2 += tmpStr;
}
if (!tmpStr2.isEmpty()) {
tmpStr2.truncate(tmpStr2.length()-1);
@@ -612,44 +614,44 @@ VObject* VCalFormat::eventToVEvent(Event *anEvent)
if (catStr[0] == ' ')
tmpStr += catStr.mid(1);
else
tmpStr += catStr;
// this must be a ';' character as the vCalendar specification requires!
// vcc.y has been hacked to translate the ';' to a ',' when the vcal is
// read in.
tmpStr += ";";
}
if (!tmpStr.isEmpty()) {
tmpStr.truncate(tmpStr.length()-1);
addPropValue(vevent, VCCategoriesProp, tmpStr.local8Bit());
}
// attachments
// TODO: handle binary attachments!
- QPtrList<Attachment> attachments = anEvent->attachments();
+ Q3PtrList<Attachment> attachments = anEvent->attachments();
for ( Attachment *at = attachments.first(); at; at = attachments.next() )
addPropValue(vevent, VCAttachProp, at->uri().local8Bit());
// resources
tmpStrList = anEvent->resources();
tmpStr = tmpStrList.join(";");
if (!tmpStr.isEmpty())
addPropValue(vevent, VCResourcesProp, tmpStr.local8Bit());
// alarm stuff
- QPtrList<Alarm> alarms = anEvent->alarms();
+ Q3PtrList<Alarm> alarms = anEvent->alarms();
Alarm* alarm;
for (alarm = alarms.first(); alarm; alarm = alarms.next()) {
if (alarm->enabled()) {
VObject *a ;
tmpStr = qDateTimeToISO(alarm->time());
if (alarm->type() == Alarm::Audio) {
a = addProp(vevent, VCAAlarmProp);
addPropValue(a, VCRunTimeProp, tmpStr.local8Bit());
addPropValue(a, VCRepeatCountProp, "1");
addPropValue(a, VCAudioContentProp, QFile::encodeName(alarm->audioFile()));
}
if (alarm->type() == Alarm::Procedure) {
a = addProp(vevent, VCPAlarmProp);
addPropValue(a, VCRunTimeProp, tmpStr.local8Bit());
addPropValue(a, VCRepeatCountProp, "1");
addPropValue(a, VCProcedureNameProp, QFile::encodeName(alarm->programFile()));
@@ -659,33 +661,33 @@ VObject* VCalFormat::eventToVEvent(Event *anEvent)
addPropValue(a, VCRepeatCountProp, "1");
addPropValue(a, VCDisplayStringProp, "beep!");
}
}
}
// priority
tmpStr.sprintf("%i",anEvent->priority());
addPropValue(vevent, VCPriorityProp, tmpStr.local8Bit());
// transparency
tmpStr.sprintf("%i",anEvent->transparency());
addPropValue(vevent, VCTranspProp, tmpStr.local8Bit());
// related event
- if (anEvent->relatedToUid()) {
+ if (!anEvent->relatedToUid().isEmpty()) {
addPropValue(vevent, VCRelatedToProp,
anEvent->relatedToUid().local8Bit());
}
if (anEvent->pilotId()) {
// pilot sync stuff
tmpStr.sprintf("%i",anEvent->pilotId());
addPropValue(vevent, XPilotIdProp, tmpStr.local8Bit());
tmpStr.sprintf("%i",anEvent->syncStatus());
addPropValue(vevent, XPilotStatusProp, tmpStr.local8Bit());
}
return vevent;
}
Todo *VCalFormat::VTodoToEvent(VObject *vtodo)
@@ -1395,80 +1397,80 @@ Event* VCalFormat::VEventToEvent(VObject *vevent)
if ((vo = isAPropertyOf(vevent, XPilotStatusProp))) {
anEvent->setSyncStatus(atoi(s = fakeCString(vObjectUStringZValue(vo))));
deleteStr(s);
}
else
anEvent->setSyncStatus(Event::SYNCMOD);
return anEvent;
}
QString VCalFormat::qDateToISO(const QDate &qd)
{
QString tmpStr;
- ASSERT(qd.isValid());
+ Q_ASSERT(qd.isValid());
tmpStr.sprintf("%.2d%.2d%.2d",
qd.year(), qd.month(), qd.day());
return tmpStr;
}
QString VCalFormat::qDateTimeToISO(const QDateTime &qdt, bool zulu)
{
QString tmpStr;
- ASSERT(qdt.date().isValid());
- ASSERT(qdt.time().isValid());
+ Q_ASSERT(qdt.date().isValid());
+ Q_ASSERT(qdt.time().isValid());
if (zulu && !useLocalTime ) {
QDateTime tmpDT = qdt.addSecs ( -KGlobal::locale()->localTimeOffset( qdt )*60);
tmpStr.sprintf("%.2d%.2d%.2dT%.2d%.2d%.2dZ",
tmpDT.date().year(), tmpDT.date().month(),
tmpDT.date().day(), tmpDT.time().hour(),
tmpDT.time().minute(), tmpDT.time().second());
} else {
tmpStr.sprintf("%.2d%.2d%.2dT%.2d%.2d%.2d",
qdt.date().year(), qdt.date().month(),
qdt.date().day(), qdt.time().hour(),
qdt.time().minute(), qdt.time().second());
}
return tmpStr;
}
QDateTime VCalFormat::ISOToQDateTime(const QString & dtStr)
{
QDate tmpDate;
QTime tmpTime;
QString tmpStr;
int year, month, day, hour, minute, second;
tmpStr = dtStr;
year = tmpStr.left(4).toInt();
month = tmpStr.mid(4,2).toInt();
day = tmpStr.mid(6,2).toInt();
hour = tmpStr.mid(9,2).toInt();
minute = tmpStr.mid(11,2).toInt();
second = tmpStr.mid(13,2).toInt();
tmpDate.setYMD(year, month, day);
tmpTime.setHMS(hour, minute, second);
- ASSERT(tmpDate.isValid());
- ASSERT(tmpTime.isValid());
+ Q_ASSERT(tmpDate.isValid());
+ Q_ASSERT(tmpTime.isValid());
QDateTime tmpDT(tmpDate, tmpTime);
// correct for GMT if string is in Zulu format
if (dtStr.at(dtStr.length()-1) == 'Z')
tmpDT = tmpDT.addSecs (KGlobal::locale()->localTimeOffset( tmpDT )*60);
return tmpDT;
}
QDate VCalFormat::ISOToQDate(const QString &dateStr)
{
int year, month, day;
year = dateStr.left(4).toInt();
month = dateStr.mid(4,2).toInt();
day = dateStr.mid(6,2).toInt();
return(QDate(year, month, day));
@@ -1635,33 +1637,33 @@ int VCalFormat::numFromDay(const QString &day)
return -1; // something bad happened. :)
}
Attendee::Role VCalFormat::readRole(const char *s) const
{
QString statStr = s;
statStr = statStr.upper();
Attendee::Role role = Attendee::ReqParticipant;
if ( statStr == "OWNER")
role = Attendee::Chair;
// enum Role { ReqParticipant, OptParticipant, NonParticipant, Chair };
return role;
}
-QCString VCalFormat::writeRole(Attendee::Role role) const
+Q3CString VCalFormat::writeRole(Attendee::Role role) const
{
if ( role == Attendee::Chair )
return "OWNER";
return "ATTENDEE";
}
Attendee::PartStat VCalFormat::readStatus(const char *s) const
{
QString statStr = s;
statStr = statStr.upper();
Attendee::PartStat status;
if (statStr == "X-ACTION")
status = Attendee::NeedsAction;
else if (statStr == "NEEDS ACTION")
status = Attendee::NeedsAction;
else if (statStr== "ACCEPTED")
@@ -1673,33 +1675,33 @@ Attendee::PartStat VCalFormat::readStatus(const char *s) const
else if (statStr== "CONFIRMED")
status = Attendee::Accepted;
else if (statStr== "DECLINED")
status = Attendee::Declined;
else if (statStr== "COMPLETED")
status = Attendee::Completed;
else if (statStr== "DELEGATED")
status = Attendee::Delegated;
else {
kdDebug(5800) << "error setting attendee mStatus, unknown mStatus!" << endl;
status = Attendee::NeedsAction;
}
return status;
}
-QCString VCalFormat::writeStatus(Attendee::PartStat status) const
+Q3CString VCalFormat::writeStatus(Attendee::PartStat status) const
{
switch(status) {
default:
case Attendee::NeedsAction:
return "NEEDS ACTION";
break;
case Attendee::Accepted:
return "ACCEPTED";
break;
case Attendee::Declined:
return "DECLINED";
break;
case Attendee::Tentative:
return "TENTATIVE";
break;
case Attendee::Delegated:
diff --git a/libkcal/vcalformat.h b/libkcal/vcalformat.h
index 6dae3d2..cac9634 100644
--- a/libkcal/vcalformat.h
+++ b/libkcal/vcalformat.h
@@ -10,32 +10,35 @@
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 _VCALFORMAT_H
#define _VCALFORMAT_H
#include "calformat.h"
+//Added by qt3to4:
+#include <Q3CString>
+#include <Q3PtrList>
#define _VCAL_VERSION "1.0"
class VObject;
namespace KCal {
/**
This class implements the vCalendar format. It provides methods for
loading/saving/converting vCalendar format data into the internal KOrganizer
representation as Calendar and Events.
@short vCalendar format implementation
*/
class VCalFormat : public CalFormat {
public:
@@ -82,32 +85,32 @@ class VCalFormat : public CalFormat {
QString qDateTimeToISO(const QDateTime &, bool zulu=TRUE);
/** takes a string in the format YYYYMMDDTHHMMSS and returns a
* valid QDateTime. */
QDateTime ISOToQDateTime(const QString & dtStr);
/** takes a string in the format YYYYMMDD and returns a
* valid QDate. */
QDate ISOToQDate(const QString & dtStr);
/** takes a vCalendar tree of VObjects, and puts all of them that have
* the "event" property into the dictionary, todos in the todo-list, etc. */
void populate(VObject *vcal);
/** takes a number 0 - 6 and returns the two letter string of that day,
* i.e. MO, TU, WE, etc. */
const char *dayFromNum(int day);
/** the reverse of the above function. */
int numFromDay(const QString &day);
- Attendee::Role VCalFormat::readRole(const char *s) const;
- QCString writeRole(Attendee::Role role) const;
+ Attendee::Role readRole(const char *s) const;
+ Q3CString writeRole(Attendee::Role role) const;
Attendee::PartStat readStatus(const char *s) const;
- QCString writeStatus(Attendee::PartStat status) const;
+ Q3CString writeStatus(Attendee::PartStat status) const;
private:
Calendar *mCalendar;
bool useLocalTime;
- QPtrList<Event> mEventsRelate; // events with relations
- QPtrList<Todo> mTodosRelate; // todos with relations
+ Q3PtrList<Event> mEventsRelate; // events with relations
+ Q3PtrList<Todo> mTodosRelate; // todos with relations
};
}
#endif