author | zautrix <zautrix> | 2004-10-05 13:34:33 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-05 13:34:33 (UTC) |
commit | 191ced43b27c047b0a39f0acdc8ba1f8a58817df (patch) (unidiff) | |
tree | d164ae32c16259d9a8d5c9fdfa74f975d1f10075 /libkcal | |
parent | a946c09db6f71f595d8bdcb6b34ba3160c5497dc (diff) | |
download | kdepimpi-191ced43b27c047b0a39f0acdc8ba1f8a58817df.zip kdepimpi-191ced43b27c047b0a39f0acdc8ba1f8a58817df.tar.gz kdepimpi-191ced43b27c047b0a39f0acdc8ba1f8a58817df.tar.bz2 |
fix for filewatch and vcal timezone
-rw-r--r-- | libkcal/vcalformat.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libkcal/vcalformat.cpp b/libkcal/vcalformat.cpp index 4727a7a..309c699 100644 --- a/libkcal/vcalformat.cpp +++ b/libkcal/vcalformat.cpp | |||
@@ -1439,97 +1439,97 @@ QString VCalFormat::qDateToISO(const QDate &qd) | |||
1439 | qd.year(), qd.month(), qd.day()); | 1439 | qd.year(), qd.month(), qd.day()); |
1440 | return tmpStr; | 1440 | return tmpStr; |
1441 | 1441 | ||
1442 | } | 1442 | } |
1443 | 1443 | ||
1444 | QString VCalFormat::qDateTimeToISO(const QDateTime &qdt, bool zulu) | 1444 | QString VCalFormat::qDateTimeToISO(const QDateTime &qdt, bool zulu) |
1445 | { | 1445 | { |
1446 | QString tmpStr; | 1446 | QString tmpStr; |
1447 | 1447 | ||
1448 | ASSERT(qdt.date().isValid()); | 1448 | ASSERT(qdt.date().isValid()); |
1449 | ASSERT(qdt.time().isValid()); | 1449 | ASSERT(qdt.time().isValid()); |
1450 | if (zulu && !useLocalTime ) { | 1450 | if (zulu && !useLocalTime ) { |
1451 | QDateTime tmpDT = qdt.addSecs ( -KGlobal::locale()->localTimeOffset( qdt )*60); | 1451 | QDateTime tmpDT = qdt.addSecs ( -KGlobal::locale()->localTimeOffset( qdt )*60); |
1452 | tmpStr.sprintf("%.2d%.2d%.2dT%.2d%.2d%.2dZ", | 1452 | tmpStr.sprintf("%.2d%.2d%.2dT%.2d%.2d%.2dZ", |
1453 | tmpDT.date().year(), tmpDT.date().month(), | 1453 | tmpDT.date().year(), tmpDT.date().month(), |
1454 | tmpDT.date().day(), tmpDT.time().hour(), | 1454 | tmpDT.date().day(), tmpDT.time().hour(), |
1455 | tmpDT.time().minute(), tmpDT.time().second()); | 1455 | tmpDT.time().minute(), tmpDT.time().second()); |
1456 | } else { | 1456 | } else { |
1457 | tmpStr.sprintf("%.2d%.2d%.2dT%.2d%.2d%.2d", | 1457 | tmpStr.sprintf("%.2d%.2d%.2dT%.2d%.2d%.2d", |
1458 | qdt.date().year(), qdt.date().month(), | 1458 | qdt.date().year(), qdt.date().month(), |
1459 | qdt.date().day(), qdt.time().hour(), | 1459 | qdt.date().day(), qdt.time().hour(), |
1460 | qdt.time().minute(), qdt.time().second()); | 1460 | qdt.time().minute(), qdt.time().second()); |
1461 | } | 1461 | } |
1462 | return tmpStr; | 1462 | return tmpStr; |
1463 | } | 1463 | } |
1464 | 1464 | ||
1465 | QDateTime VCalFormat::ISOToQDateTime(const QString & dtStr) | 1465 | QDateTime VCalFormat::ISOToQDateTime(const QString & dtStr) |
1466 | { | 1466 | { |
1467 | QDate tmpDate; | 1467 | QDate tmpDate; |
1468 | QTime tmpTime; | 1468 | QTime tmpTime; |
1469 | QString tmpStr; | 1469 | QString tmpStr; |
1470 | int year, month, day, hour, minute, second; | 1470 | int year, month, day, hour, minute, second; |
1471 | 1471 | ||
1472 | tmpStr = dtStr; | 1472 | tmpStr = dtStr; |
1473 | year = tmpStr.left(4).toInt(); | 1473 | year = tmpStr.left(4).toInt(); |
1474 | month = tmpStr.mid(4,2).toInt(); | 1474 | month = tmpStr.mid(4,2).toInt(); |
1475 | day = tmpStr.mid(6,2).toInt(); | 1475 | day = tmpStr.mid(6,2).toInt(); |
1476 | hour = tmpStr.mid(9,2).toInt(); | 1476 | hour = tmpStr.mid(9,2).toInt(); |
1477 | minute = tmpStr.mid(11,2).toInt(); | 1477 | minute = tmpStr.mid(11,2).toInt(); |
1478 | second = tmpStr.mid(13,2).toInt(); | 1478 | second = tmpStr.mid(13,2).toInt(); |
1479 | tmpDate.setYMD(year, month, day); | 1479 | tmpDate.setYMD(year, month, day); |
1480 | tmpTime.setHMS(hour, minute, second); | 1480 | tmpTime.setHMS(hour, minute, second); |
1481 | 1481 | ||
1482 | ASSERT(tmpDate.isValid()); | 1482 | ASSERT(tmpDate.isValid()); |
1483 | ASSERT(tmpTime.isValid()); | 1483 | ASSERT(tmpTime.isValid()); |
1484 | QDateTime tmpDT(tmpDate, tmpTime); | 1484 | QDateTime tmpDT(tmpDate, tmpTime); |
1485 | // correct for GMT if string is in Zulu format | 1485 | // correct for GMT if string is in Zulu format |
1486 | if (dtStr.at(dtStr.length()-1) == 'Z') | 1486 | if (dtStr.at(dtStr.length()-1) == 'Z') |
1487 | tmpDT = tmpDT.addSecs(60*mCalendar->getTimeZone()); | 1487 | tmpDT = tmpDT.addSecs (KGlobal::locale()->localTimeOffset( tmpDT )*60); |
1488 | return tmpDT; | 1488 | return tmpDT; |
1489 | } | 1489 | } |
1490 | 1490 | ||
1491 | QDate VCalFormat::ISOToQDate(const QString &dateStr) | 1491 | QDate VCalFormat::ISOToQDate(const QString &dateStr) |
1492 | { | 1492 | { |
1493 | int year, month, day; | 1493 | int year, month, day; |
1494 | 1494 | ||
1495 | year = dateStr.left(4).toInt(); | 1495 | year = dateStr.left(4).toInt(); |
1496 | month = dateStr.mid(4,2).toInt(); | 1496 | month = dateStr.mid(4,2).toInt(); |
1497 | day = dateStr.mid(6,2).toInt(); | 1497 | day = dateStr.mid(6,2).toInt(); |
1498 | 1498 | ||
1499 | return(QDate(year, month, day)); | 1499 | return(QDate(year, month, day)); |
1500 | } | 1500 | } |
1501 | 1501 | ||
1502 | // take a raw vcalendar (i.e. from a file on disk, clipboard, etc. etc. | 1502 | // take a raw vcalendar (i.e. from a file on disk, clipboard, etc. etc. |
1503 | // and break it down from it's tree-like format into the dictionary format | 1503 | // and break it down from it's tree-like format into the dictionary format |
1504 | // that is used internally in the VCalFormat. | 1504 | // that is used internally in the VCalFormat. |
1505 | void VCalFormat::populate(VObject *vcal) | 1505 | void VCalFormat::populate(VObject *vcal) |
1506 | { | 1506 | { |
1507 | // this function will populate the caldict dictionary and other event | 1507 | // this function will populate the caldict dictionary and other event |
1508 | // lists. It turns vevents into Events and then inserts them. | 1508 | // lists. It turns vevents into Events and then inserts them. |
1509 | 1509 | ||
1510 | VObjectIterator i; | 1510 | VObjectIterator i; |
1511 | VObject *curVO, *curVOProp; | 1511 | VObject *curVO, *curVOProp; |
1512 | Event *anEvent; | 1512 | Event *anEvent; |
1513 | 1513 | ||
1514 | if ((curVO = isAPropertyOf(vcal, ICMethodProp)) != 0) { | 1514 | if ((curVO = isAPropertyOf(vcal, ICMethodProp)) != 0) { |
1515 | char *methodType = 0; | 1515 | char *methodType = 0; |
1516 | methodType = fakeCString(vObjectUStringZValue(curVO)); | 1516 | methodType = fakeCString(vObjectUStringZValue(curVO)); |
1517 | kdDebug() << "This calendar is an iTIP transaction of type '" | 1517 | kdDebug() << "This calendar is an iTIP transaction of type '" |
1518 | << methodType << "'" << endl; | 1518 | << methodType << "'" << endl; |
1519 | delete methodType; | 1519 | delete methodType; |
1520 | } | 1520 | } |
1521 | 1521 | ||
1522 | // warn the user that we might have trouble reading non-known calendar. | 1522 | // warn the user that we might have trouble reading non-known calendar. |
1523 | if ((curVO = isAPropertyOf(vcal, VCProdIdProp)) != 0) { | 1523 | if ((curVO = isAPropertyOf(vcal, VCProdIdProp)) != 0) { |
1524 | char *s = fakeCString(vObjectUStringZValue(curVO)); | 1524 | char *s = fakeCString(vObjectUStringZValue(curVO)); |
1525 | if (strcmp(productId().local8Bit(), s) != 0) | 1525 | if (strcmp(productId().local8Bit(), s) != 0) |
1526 | kdDebug() << "This vCalendar file was not created by KOrganizer " | 1526 | kdDebug() << "This vCalendar file was not created by KOrganizer " |
1527 | "or any other product we support. Loading anyway..." << endl; | 1527 | "or any other product we support. Loading anyway..." << endl; |
1528 | mLoadedProductId = s; | 1528 | mLoadedProductId = s; |
1529 | deleteStr(s); | 1529 | deleteStr(s); |
1530 | } | 1530 | } |
1531 | 1531 | ||
1532 | // warn the user we might have trouble reading this unknown version. | 1532 | // warn the user we might have trouble reading this unknown version. |
1533 | if ((curVO = isAPropertyOf(vcal, VCVersionProp)) != 0) { | 1533 | if ((curVO = isAPropertyOf(vcal, VCVersionProp)) != 0) { |
1534 | char *s = fakeCString(vObjectUStringZValue(curVO)); | 1534 | char *s = fakeCString(vObjectUStringZValue(curVO)); |
1535 | if (strcmp(_VCAL_VERSION, s) != 0) | 1535 | if (strcmp(_VCAL_VERSION, s) != 0) |