-rw-r--r-- | libkcal/phoneformat.cpp | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp index bc1b863..596148e 100644 --- a/libkcal/phoneformat.cpp +++ b/libkcal/phoneformat.cpp @@ -343,7 +343,7 @@ public: #endif QString recurString = "no"; - if ( repeating ) { + if ( repeating && repeat_frequency != -1) { recurString = "y"; if ( repeat_dayofweek >= 0 ) recurString += "dow" + QString::number (repeat_dayofweek); @@ -359,10 +359,12 @@ public: 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 ) { @@ -371,7 +373,7 @@ public: } uint weekDaysNum = repeat_dayofweek ; - + // 1 == monday, 7 == sunday QBitArray weekDays( 7 ); int i; int bb = 1; @@ -398,16 +400,30 @@ public: */ 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 ); |