summaryrefslogtreecommitdiffabout
path: root/libkcal
authorzautrix <zautrix>2004-09-14 01:03:08 (UTC)
committer zautrix <zautrix>2004-09-14 01:03:08 (UTC)
commit30762fe125216362e1a6c1d5ec5d22d9525aa336 (patch) (side-by-side diff)
tree4ff0fbf43efa921c86d64ff3f50baa9e59d207d9 /libkcal
parent8ce7eae438dcd20f9c79fc0a36dfef0a6d3931eb (diff)
downloadkdepimpi-30762fe125216362e1a6c1d5ec5d22d9525aa336.zip
kdepimpi-30762fe125216362e1a6c1d5ec5d22d9525aa336.tar.gz
kdepimpi-30762fe125216362e1a6c1d5ec5d22d9525aa336.tar.bz2
Many bugfixes
Diffstat (limited to 'libkcal') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/alarm.cpp36
-rw-r--r--libkcal/recurrence.cpp56
-rw-r--r--libkcal/sharpformat.cpp7
3 files changed, 83 insertions, 16 deletions
diff --git a/libkcal/alarm.cpp b/libkcal/alarm.cpp
index 29e6205..1fc7169 100644
--- a/libkcal/alarm.cpp
+++ b/libkcal/alarm.cpp
@@ -46,28 +46,62 @@ Alarm::Alarm(Incidence *parent)
Alarm::~Alarm()
{
}
bool Alarm::operator==( const Alarm& rhs ) const
{
+
if ( mType != rhs.mType ||
mAlarmSnoozeTime != rhs.mAlarmSnoozeTime ||
mAlarmRepeatCount != rhs.mAlarmRepeatCount ||
mAlarmEnabled != rhs.mAlarmEnabled ||
mHasTime != rhs.mHasTime)
return false;
+#if 0
+ if ( mType != rhs.mType ) {
+
+ qDebug("aaa1 ");
+ return false;
+ }
+
+ if ( mAlarmSnoozeTime != rhs.mAlarmSnoozeTime ) {
+
+ qDebug("aaa2 ");
+ return false;
+ }
+
+
+ if ( mAlarmRepeatCount != rhs.mAlarmRepeatCount ) {
+
+ qDebug("aaa3 ");
+ return false;
+ }
+
+ if ( mAlarmEnabled != rhs.mAlarmEnabled ) {
+
+ qDebug("aaa4 ");
+ return false;
+ }
+
+ if ( mHasTime != rhs.mHasTime ) {
+
+ qDebug("aaa5 ");
+ return false;
+ }
+#endif
+
+
if (mHasTime) {
if (mAlarmTime != rhs.mAlarmTime)
return false;
} else {
if (mOffset != rhs.mOffset ||
mEndOffset != rhs.mEndOffset)
return false;
}
-
switch (mType) {
case Display:
return mDescription == rhs.mDescription;
case Email:
return mDescription == rhs.mDescription &&
diff --git a/libkcal/recurrence.cpp b/libkcal/recurrence.cpp
index dd74e10..e84f672 100644
--- a/libkcal/recurrence.cpp
+++ b/libkcal/recurrence.cpp
@@ -103,12 +103,13 @@ bool Recurrence::operator==( const Recurrence& r2 ) const
// the following line is obvious
if ( recurs == rNone && r2.recurs == rNone )
return true;
// we need the above line, because two non recurring events may
// differ in the other settings, because one (or both)
// may be not initialized properly
+
if ( recurs != r2.recurs
|| rFreq != r2.rFreq
|| rDuration != r2.rDuration
|| !rDuration && rEndDateTime != r2.rEndDateTime
|| mRecurStart != r2.mRecurStart
|| mFloats != r2.mFloats
@@ -119,24 +120,55 @@ bool Recurrence::operator==( const Recurrence& r2 ) const
// OK to compare the pointers
switch ( recurs )
{
case rWeekly:
return rDays == r2.rDays
&& rWeekStart == r2.rWeekStart;
- case rMonthlyPos:
- return rMonthPositions.count() == r2.rMonthPositions.count();
- case rMonthlyDay:
- return rMonthDays.count() == r2.rMonthDays.count();
- case rYearlyPos:
- return rYearNums.count() == r2.rYearNums.count()
- && rMonthPositions.count() == r2.rMonthPositions.count();
- case rYearlyMonth:
- return rYearNums.count() == r2.rYearNums.count()
- && mFeb29YearlyType == r2.mFeb29YearlyType;
- case rYearlyDay:
- return rYearNums == r2.rYearNums;
+ case rMonthlyPos: {
+ QPtrList<rMonthPos> MonthPositions = rMonthPositions;
+ QPtrList<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 ;
+ 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;
+ if ( *YearNums.first() != *YearNums2.first() )
+ return false;
+ QPtrList<rMonthPos> MonthPositions = rMonthPositions;
+ QPtrList<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;
+ return ( *YearNums.first() == *YearNums2.first() && mFeb29YearlyType == r2.mFeb29YearlyType);
+ }
+ case rYearlyDay: {
+ QPtrList<int> YearNums = rYearNums;
+ QPtrList<int> YearNums2 = r2.rYearNums;
+ return ( *YearNums.first() == *YearNums2.first() );
+ }
case rNone:
case rMinutely:
case rHourly:
case rDaily:
default:
return true;
diff --git a/libkcal/sharpformat.cpp b/libkcal/sharpformat.cpp
index defdb09..89eb72f 100644
--- a/libkcal/sharpformat.cpp
+++ b/libkcal/sharpformat.cpp
@@ -177,14 +177,15 @@ class SharpParser : public QObject
Alarm *alarm;
if ( event->alarms().count() > 0 )
alarm = event->alarms().first();
else {
alarm = new Alarm( event );
event->addAlarm( alarm );
+ alarm->setType( Alarm::Audio );
}
- alarm->setType( Alarm::Audio );
+ //alarm->setType( Alarm::Audio );
alarm->setEnabled( true );
int alarmOffset = attList[9].toInt();
alarm->setStartOffset( alarmOffset * -60 );
} else {
Alarm *alarm;
if ( event->alarms().count() > 0 ) {
@@ -365,19 +366,19 @@ ulong SharpFormat::getCsum( const QStringList & attList)
}
}
return cSum;
}
#include <stdlib.h>
-#define DEBUGMODE false
+//#define DEBUGMODE false
+#define DEBUGMODE true
bool SharpFormat::load( Calendar *calendar, Calendar *existngCal )
{
bool debug = DEBUGMODE;
- //debug = true;
QString text;
QString codec = "utf8";
QLabel status ( i18n("Reading events ..."), 0 );
int w = status.sizeHint().width()+20 ;
if ( w < 200 ) w = 200;