-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: | |||
343 | #endif | 343 | #endif |
344 | 344 | ||
345 | QString recurString = "no"; | 345 | QString recurString = "no"; |
346 | if ( repeating ) { | 346 | if ( repeating && repeat_frequency != -1) { |
347 | recurString = "y"; | 347 | recurString = "y"; |
348 | if ( repeat_dayofweek >= 0 ) | 348 | if ( repeat_dayofweek >= 0 ) |
349 | recurString += "dow" + QString::number (repeat_dayofweek); | 349 | recurString += "dow" + QString::number (repeat_dayofweek); |
@@ -359,10 +359,12 @@ public: | |||
359 | int rtype = 0; | 359 | int rtype = 0; |
360 | // qDebug("recurs "); | 360 | // qDebug("recurs "); |
361 | QDate startDate, endDate; | 361 | QDate startDate, endDate; |
362 | if ( repeat_startdate.Day > 0 ) | 362 | if ( repeat_startdate.Day > 0 ) { |
363 | startDate = datefromGSM ( &repeat_startdate ); | 363 | startDate = datefromGSM ( &repeat_startdate ); |
364 | else | 364 | event->setDtStart(QDateTime ( startDate, event->dtStart().time())); |
365 | } else { | ||
365 | startDate = event->dtStart().date(); | 366 | startDate = event->dtStart().date(); |
367 | } | ||
366 | int freq = repeat_frequency; | 368 | int freq = repeat_frequency; |
367 | bool hasEndDate = false; | 369 | bool hasEndDate = false; |
368 | if ( repeat_stopdate.Day > 0 ) { | 370 | if ( repeat_stopdate.Day > 0 ) { |
@@ -371,7 +373,7 @@ public: | |||
371 | } | 373 | } |
372 | 374 | ||
373 | uint weekDaysNum = repeat_dayofweek ; | 375 | uint weekDaysNum = repeat_dayofweek ; |
374 | 376 | // 1 == monday, 7 == sunday | |
375 | QBitArray weekDays( 7 ); | 377 | QBitArray weekDays( 7 ); |
376 | int i; | 378 | int i; |
377 | int bb = 1; | 379 | int bb = 1; |
@@ -398,16 +400,30 @@ public: | |||
398 | */ | 400 | */ |
399 | int dayOfWeek = startDate.dayOfWeek(); | 401 | int dayOfWeek = startDate.dayOfWeek(); |
400 | if ( repeat_weekofmonth >= 0 ) { | 402 | if ( repeat_weekofmonth >= 0 ) { |
401 | rtype = 2; | 403 | rtype = 2; // ************************ 2 MonthlyPos |
402 | pos = repeat_weekofmonth; | 404 | pos = repeat_weekofmonth; |
403 | if ( repeat_dayofweek >= 0 ) | 405 | if ( repeat_dayofweek >= 0 ) |
404 | dayOfWeek = repeat_dayofweek; | 406 | dayOfWeek = repeat_dayofweek; |
407 | if (repeat_month > 0) { | ||
408 | if ( repeat_month != event->dtStart().date().month() ) { | ||
409 | QDate date (event->dtStart().date().year(),repeat_month,event->dtStart().date().day() ); | ||
410 | event->setDtStart(QDateTime ( date , event->dtStart().time()) ); | ||
411 | } | ||
412 | if ( freq == 1 ) | ||
413 | freq = 12; | ||
414 | } | ||
405 | } else if ( repeat_dayofweek >= 0 ) { | 415 | } else if ( repeat_dayofweek >= 0 ) { |
406 | rtype = 1; | 416 | rtype = 1;// ************************ 1 Weekly |
407 | } if ( repeat_dayofweek >= 0 ) { | 417 | } else if ( repeat_day >= 0 ) { |
408 | rtype = 1; | 418 | if ( repeat_month > 0) { |
419 | rtype = 4; | ||
420 | } else { | ||
421 | rtype = 3; | ||
422 | } | ||
423 | } else { | ||
424 | rtype = 0 ; | ||
409 | } | 425 | } |
410 | 426 | ||
411 | if ( rtype == 0 ) { | 427 | if ( rtype == 0 ) { |
412 | if ( hasEndDate ) r->setDaily( freq, endDate ); | 428 | if ( hasEndDate ) r->setDaily( freq, endDate ); |
413 | else r->setDaily( freq, -1 ); | 429 | else r->setDaily( freq, -1 ); |