summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kdecore/klocale.cpp44
-rw-r--r--microkde/kdecore/klocale.h1
2 files changed, 34 insertions, 11 deletions
diff --git a/microkde/kdecore/klocale.cpp b/microkde/kdecore/klocale.cpp
index 7bd8a70..17031c7 100644
--- a/microkde/kdecore/klocale.cpp
+++ b/microkde/kdecore/klocale.cpp
@@ -581,4 +581,2 @@ QTime KLocale::readTime(const QString &intstr, bool seconds, bool *ok) const
QDateTime KLocale::readDateTime(const QString &intstr,
- bool shortFormat,
- bool includeSeconds,
IntDateFormat intIntDateFormat,
@@ -588,7 +586,32 @@ QDateTime KLocale::readDateTime(const QString &intstr,
- QDate m_date = readDate(date, &ok1);
- QTime m_time = KGlobal::locale()->readTime(time, &ok2);
- if ((ok1 == false) || (ok2 == false))
- qDebug("Serializer::extractMeta invalid date or time !!!!!!!!!!!!!");
+ // AT the moment we can not read any other format then ISODate
+ if ( intIntDateFormat != ISODate )
+ {
+ qDebug("KLocale::readDateTime, only ISODate is supported.");
+ return QDateTime();
+ }
+
+ int pos = intstr.find("T");
+ QString date = intstr.left(pos);
+ QString time = intstr.mid(pos+1);
+ QString dformat = dateFormat(intIntDateFormat);
+ QString tformat = timeFormat(intIntDateFormat);
+
+ QDate m_date = readDate(date, dformat, &ok1);
+ QTime m_time = readTime(time, tformat, &ok2);
+
+ if (ok)
+ {
+ if ((ok1 == false) || (ok2 == false))
+ *ok = false;
+ else
+ *ok = true;
+ }
+ QDateTime m_dt;
+ m_dt.setDate(m_date);
+ m_dt.setTime(m_time);
+
+ 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);
+ return m_dt;
}
@@ -688,2 +711,5 @@ QString KLocale::dateFormat(IntDateFormat intIntDateFormat) const
+ if ( dformat == ISODate )
+ return "%Y-%m-%d";
+
if ( QApplication::desktop()->width() < 480 ) {
@@ -693,6 +719,3 @@ QString KLocale::dateFormat(IntDateFormat intIntDateFormat) const
return "%a %b %d %Y";
- else if ( dformat == ISODate )
- return "%a %Y %b %d";
} else {
-
if ( dformat == Default )
@@ -701,4 +724,3 @@ QString KLocale::dateFormat(IntDateFormat intIntDateFormat) const
return "%A %B %d %Y";
- else if ( dformat == ISODate )
- return "%A %Y %B %d";
+
}
diff --git a/microkde/kdecore/klocale.h b/microkde/kdecore/klocale.h
index 153b12a..949301a 100644
--- a/microkde/kdecore/klocale.h
+++ b/microkde/kdecore/klocale.h
@@ -55,2 +55,3 @@ class KLocale
QTime readTime(const QString &str, bool* ok = 0) const;
+ QDateTime readDateTime(const QString &intstr, IntDateFormat intIntDateFormat, bool* ok) const;