diff options
author | Päivi Rajala <paivi.rajala@nokia.com> | 2012-03-15 10:16:13 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-05 10:49:28 +0200 |
commit | a089c93eae4824a7687eee0a47ce4813c9a2b941 (patch) | |
tree | a4e2707928d219f493541c578257fedbaa2fcf4b /src/imports/organizer/qdeclarativeorganizeritemfilter.cpp | |
parent | dfdf15cb6cfb079cbf7f31fd6c65529111c6f3de (diff) |
Fixing the handling of "date-only" parameters in Organizer QML API
Setters and getters of some Organizer item detail fields, such as
originalDate in Parent detail, have "date-only" parameters. The type
of the parameter is JavaScript Date, but since only date part of the
Date object was needed, the type of the C++ parameter was QDate.
This resulted in implicit conversions from QDateTime to QDate where
timezone offsets were not handled correctly. Now type of C++
parameters has been changed to QDateTime in order to allow more
control over the conversion between QDateTime and QDate.
Change-Id: I9357b0935bf6a041829bcaaa273dcf9bb662d72e
Reviewed-by: Iiro Kause <iiro.kause@nokia.com>
Diffstat (limited to 'src/imports/organizer/qdeclarativeorganizeritemfilter.cpp')
-rw-r--r-- | src/imports/organizer/qdeclarativeorganizeritemfilter.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/imports/organizer/qdeclarativeorganizeritemfilter.cpp b/src/imports/organizer/qdeclarativeorganizeritemfilter.cpp index dcd33f6bd..7ec94ee5a 100644 --- a/src/imports/organizer/qdeclarativeorganizeritemfilter.cpp +++ b/src/imports/organizer/qdeclarativeorganizeritemfilter.cpp @@ -439,21 +439,18 @@ void QDeclarativeOrganizerItemDetailFilter::setField(int field) */ QVariant QDeclarativeOrganizerItemDetailFilter::value() const { - // UTC time is used with details internally - if (QVariant::DateTime == d.value().type()) - return d.value().toDateTime().toLocalTime(); - else - return d.value(); + return d.value(); } void QDeclarativeOrganizerItemDetailFilter::setValue(const QVariant &newValue) { - if (newValue != value()) { - // UTC time is used with details internally - if (QVariant::DateTime == newValue.type()) + if (newValue != value()) { + if (QVariant::DateTime == newValue.type()) { + // handling dates and datetimes internally as UTC d.setValue(newValue.toDateTime().toUTC()); - else + } else { d.setValue(newValue); + } emit valueChanged(); } } |