summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-08-09 12:44:25 (UTC)
committer zautrix <zautrix>2004-08-09 12:44:25 (UTC)
commit48f53b2d2e7ed189e88f924259693ab66ff44b7f (patch) (side-by-side diff)
tree19bcb263aef667ee236b4d49cea89985331805bd
parente0ba2d4770094974ec4a2a48af436a7df9a055bc (diff)
downloadkdepimpi-48f53b2d2e7ed189e88f924259693ab66ff44b7f.zip
kdepimpi-48f53b2d2e7ed189e88f924259693ab66ff44b7f.tar.gz
kdepimpi-48f53b2d2e7ed189e88f924259693ab66ff44b7f.tar.bz2
recurrence fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--Makefile2
-rw-r--r--libkcal/phoneformat.cpp34
2 files changed, 26 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index c1d07e4..ac1d5b7 100644
--- a/Makefile
+++ b/Makefile
@@ -1,27 +1,27 @@
#############################################################################
# Makefile for building: kopi-desktop
-# Generated by qmake (1.07a) (Qt 3.3.3) on: Mon Aug 9 12:10:32 2004
+# Generated by qmake (1.07a) (Qt 3.3.3) on: Mon Aug 9 13:18:13 2004
# Project: kopi-desktop.pro
# Template: subdirs
# Command: $(QMAKE) "CONFIG+=thread" "CONFIG+=debug" -o Makefile kopi-desktop.pro
#############################################################################
MAKEFILE = Makefile
QMAKE = qmake
DEL_FILE = rm -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
INSTALL_FILE=
INSTALL_DIR =
SUBTARGETS = \
sub-gammu-emb-common \
sub-libical \
sub-libkcal \
sub-microkde \
sub-libkdepim \
sub-kabc \
sub-korganizer \
sub-kaddressbook \
sub-kabc-plugins-file \
sub-kabc-plugins-dir
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp
index bc1b863..596148e 100644
--- a/libkcal/phoneformat.cpp
+++ b/libkcal/phoneformat.cpp
@@ -322,113 +322,129 @@ public:
case CAL_REPEAT_STARTDATE:
repeat_startdate = Note->Entries[i].Date;
repeating = true;
break;
case CAL_REPEAT_STOPDATE:
repeat_stopdate = Note->Entries[i].Date;
repeating = true;
break;
}
}
#if 0
event->setDescription( attList[4] );
bool repeating = false;
int repeat_dayofweek = -1;
int repeat_day = -1;
int repeat_weekofmonth = -1;
int repeat_month = -1;
int repeat_frequency = -1;
GSM_DateTime repeat_startdate = {0,0,0,0,0,0,0};
GSM_DateTime repeat_stopdate = {0,0,0,0,0,0,0};
#endif
QString recurString = "no";
- if ( repeating ) {
+ if ( repeating && repeat_frequency != -1) {
recurString = "y";
if ( repeat_dayofweek >= 0 )
recurString += "dow" + QString::number (repeat_dayofweek);
if ( repeat_day >= 0 )
recurString += "d" + QString::number (repeat_day);
if ( repeat_weekofmonth >= 0 )
recurString += "w" + QString::number (repeat_weekofmonth);
if ( repeat_month >= 0 )
recurString += "m" + QString::number ( repeat_month );
if ( repeat_frequency >= 0 )
recurString += "f" + QString::number (repeat_frequency );
int rtype = 0;
// qDebug("recurs ");
QDate startDate, endDate;
- if ( repeat_startdate.Day > 0 )
+ if ( repeat_startdate.Day > 0 ) {
startDate = datefromGSM ( &repeat_startdate );
- else
+ event->setDtStart(QDateTime ( startDate, event->dtStart().time()));
+ } else {
startDate = event->dtStart().date();
+ }
int freq = repeat_frequency;
bool hasEndDate = false;
if ( repeat_stopdate.Day > 0 ) {
endDate = datefromGSM ( &repeat_stopdate );
hasEndDate = true;
}
uint weekDaysNum = repeat_dayofweek ;
-
+ // 1 == monday, 7 == sunday
QBitArray weekDays( 7 );
int i;
int bb = 1;
for( i = 1; i <= 7; ++i ) {
weekDays.setBit( i - 1, ( bb & weekDaysNum ));
bb = 2 << (i-1);
//qDebug(" %d bit %d ",i-1,weekDays.at(i-1) );
}
// qDebug("next ");
int pos = 0;
Recurrence *r = event->recurrence();
/*
0 daily;
1 weekly;x
2 monthpos;x
3 monthlyday;
4 rYearlyMont
bool repeating = false;
int repeat_dayofweek = -1;
int repeat_day = -1;
int repeat_weekofmonth = -1;
int repeat_month = -1;
int repeat_frequency = -1;
*/
int dayOfWeek = startDate.dayOfWeek();
if ( repeat_weekofmonth >= 0 ) {
- rtype = 2;
+ rtype = 2; // ************************ 2 MonthlyPos
pos = repeat_weekofmonth;
if ( repeat_dayofweek >= 0 )
dayOfWeek = repeat_dayofweek;
+ if (repeat_month > 0) {
+ if ( repeat_month != event->dtStart().date().month() ) {
+ QDate date (event->dtStart().date().year(),repeat_month,event->dtStart().date().day() );
+ event->setDtStart(QDateTime ( date , event->dtStart().time()) );
+ }
+ if ( freq == 1 )
+ freq = 12;
+ }
} else if ( repeat_dayofweek >= 0 ) {
- rtype = 1;
- } if ( repeat_dayofweek >= 0 ) {
- rtype = 1;
+ rtype = 1;// ************************ 1 Weekly
+ } else if ( repeat_day >= 0 ) {
+ if ( repeat_month > 0) {
+ rtype = 4;
+ } else {
+ rtype = 3;
+ }
+ } else {
+ rtype = 0 ;
}
-
+
if ( rtype == 0 ) {
if ( hasEndDate ) r->setDaily( freq, endDate );
else r->setDaily( freq, -1 );
} else if ( rtype == 1 ) {
if ( hasEndDate ) r->setWeekly( freq, weekDays, endDate );
else r->setWeekly( freq, weekDays, -1 );
} else if ( rtype == 3 ) {
if ( hasEndDate )
r->setMonthly( Recurrence::rMonthlyDay, freq, endDate );
else
r->setMonthly( Recurrence::rMonthlyDay, freq, -1 );
r->addMonthlyDay( startDate.day() );
} else if ( rtype == 2 ) {
if ( hasEndDate )
r->setMonthly( Recurrence::rMonthlyPos, freq, endDate );
else
r->setMonthly( Recurrence::rMonthlyPos, freq, -1 );
QBitArray days( 7 );
days.fill( false );
days.setBit( dayOfWeek - 1 );
r->addMonthlyPos( pos, days );
} else if ( rtype == 4 ) {
if ( hasEndDate )
r->setYearly( Recurrence::rYearlyMonth, freq, endDate );