author | ulf69 <ulf69> | 2004-10-18 03:01:17 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-10-18 03:01:17 (UTC) |
commit | 1712d92ea25b220273859d985bc7211fa7a97a39 (patch) (unidiff) | |
tree | 00b603af10b0da8d757ffec5c29f73953fbf03e0 | |
parent | 2fd3f09238a624b1a91793d43b5f3653e2b34763 (diff) | |
download | kdepimpi-1712d92ea25b220273859d985bc7211fa7a97a39.zip kdepimpi-1712d92ea25b220273859d985bc7211fa7a97a39.tar.gz kdepimpi-1712d92ea25b220273859d985bc7211fa7a97a39.tar.bz2 |
return a real empty value in readDateTime
-rw-r--r-- | microkde/kdecore/klocale.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/microkde/kdecore/klocale.cpp b/microkde/kdecore/klocale.cpp index 8b4513e..27acfec 100644 --- a/microkde/kdecore/klocale.cpp +++ b/microkde/kdecore/klocale.cpp | |||
@@ -338,10 +338,14 @@ QString KLocale::formatDateTime(const QDateTime &pDateTime, | |||
338 | format = "%1 %2"; | 338 | format = "%1 %2"; |
339 | else if ( intIntDateFormat == ISODate ) | 339 | else if ( intIntDateFormat == ISODate ) |
340 | format = "%1T%2"; | 340 | format = "%1T%2"; |
341 | 341 | ||
342 | return format.arg(formatDate( pDateTime.date(), shortFormat, intIntDateFormat )) | 342 | QString res = format.arg(formatDate( pDateTime.date(), shortFormat, intIntDateFormat )) |
343 | .arg(formatTime( pDateTime.time(), includeSeconds , intIntDateFormat )); | 343 | .arg(formatTime( pDateTime.time(), includeSeconds , intIntDateFormat )); |
344 | |||
345 | //qDebug("KLocale::formatDateTime transformed %s, into %s", pDateTime.toString().latin1(), res.latin1() ); | ||
346 | |||
347 | return res; | ||
344 | } | 348 | } |
345 | 349 | ||
346 | QString KLocale::formatDateTime(const QDateTime &pDateTime, IntDateFormat intIntDateFormat) const | 350 | QString KLocale::formatDateTime(const QDateTime &pDateTime, IntDateFormat intIntDateFormat) const |
347 | { | 351 | { |
@@ -600,20 +604,26 @@ QDateTime KLocale::readDateTime(const QString &intstr, | |||
600 | 604 | ||
601 | QDate m_date = readDate(date, dformat, &ok1); | 605 | QDate m_date = readDate(date, dformat, &ok1); |
602 | QTime m_time = readTime(time, tformat, &ok2); | 606 | QTime m_time = readTime(time, tformat, &ok2); |
603 | 607 | ||
608 | QDateTime m_dt; | ||
609 | |||
604 | if (ok) | 610 | if (ok) |
605 | { | 611 | { |
606 | if ((ok1 == false) || (ok2 == false)) | 612 | if ((ok1 == false) || (ok2 == false)) |
607 | *ok = false; | 613 | *ok = false; |
608 | else | 614 | else |
609 | *ok = true; | 615 | *ok = true; |
610 | } | 616 | } |
611 | QDateTime m_dt; | ||
612 | m_dt.setDate(m_date); | ||
613 | m_dt.setTime(m_time); | ||
614 | 617 | ||
615 | qDebug("KLocale::readDateTime() transformed %s into %s (%s), %s (%s) : err1=%i, err2=%i", intstr.latin1(), date.latin1(), dformat.latin1(), time.latin1(), tformat.latin1(), ok1, ok2); | 618 | //only set values if both operations returned true. |
619 | if ((ok1 == true) && (ok2 == true)) | ||
620 | { | ||
621 | m_dt.setDate(m_date); | ||
622 | m_dt.setTime(m_time); | ||
623 | } | ||
624 | |||
625 | //qDebug("KLocale::readDateTime() transformed %s into %s (%s), %s (%s) : err1=%i, err2=%i", intstr.latin1(), date.latin1(), dformat.latin1(), time.latin1(), tformat.latin1(), ok1, ok2); | ||
616 | return m_dt; | 626 | return m_dt; |
617 | } | 627 | } |
618 | 628 | ||
619 | QDate KLocale::readDate(const QString &intstr, | 629 | QDate KLocale::readDate(const QString &intstr, |