Hello community,

here is the log from the commit of package plasma-framework for 
openSUSE:Factory checked in at 2018-06-05 12:51:21
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/plasma-framework (Old)
 and      /work/SRC/openSUSE:Factory/.plasma-framework.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "plasma-framework"

Tue Jun  5 12:51:21 2018 rev:61 rq:613907 version:5.46.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/plasma-framework/plasma-framework.changes        
2018-05-18 14:25:11.808329732 +0200
+++ /work/SRC/openSUSE:Factory/.plasma-framework.new/plasma-framework.changes   
2018-06-05 12:51:22.505014625 +0200
@@ -1,0 +2,6 @@
+Mon Jun  4 08:37:00 UTC 2018 - [email protected]
+
+- Add upstream patch use-qdatetime-with-qml.patch:
+  * Fixes wrong dates being shown in Plasma calendar (kde#394423)
+
+-------------------------------------------------------------------

New:
----
  use-qdatetime-with-qml.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ plasma-framework.spec ++++++
--- /var/tmp/diff_new_pack.bBknHD/_old  2018-06-05 12:51:23.212988693 +0200
+++ /var/tmp/diff_new_pack.bBknHD/_new  2018-06-05 12:51:23.216988547 +0200
@@ -32,6 +32,8 @@
 Url:            https://projects.kde.org/plasma-framework
 Source:         
http://download.kde.org/stable/frameworks/%{_tar_path}/%{name}-%{version}.tar.xz
 Source1:        baselibs.conf
+# PATCH-FIX-UPSTREAM
+Patch0:         use-qdatetime-with-qml.patch
 BuildRequires:  extra-cmake-modules >= %{_kf5_bugfix_version}
 BuildRequires:  fdupes
 BuildRequires:  kactivities5-devel >= 5.19.0
@@ -128,6 +130,7 @@
 %lang_package
 %prep
 %setup -q
+%autopatch -p1
 
 %build
   %cmake_kf5 -d build

++++++ use-qdatetime-with-qml.patch ++++++
>From d15f0fa8322dc2632f15024457bea41e7dd058d7 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <[email protected]>
Date: Wed, 30 May 2018 21:27:30 +0200
Subject: Use QDateTime for interfacing with QML

Summary:
QDate from/to JS Date has unexpected results, so use QDateTime to have a
timezone assigned to prevent conversions. That way the date values are
consistent.

The behaviour got changed with Qt 5.11 (see the linked bug report) which
lead to plasma showing the wrong dates in the calendar.

BUG: 394423

Test Plan:
Tested with and without this patch on Qt 5.10.1 and 5.11.0.
Now the correct date is displayed for -0004 and +0001 timezones.

Reviewers: #plasma, #frameworks, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: ngraham, Zren, sharvey, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D13222
---
 src/declarativeimports/calendar/calendar.cpp | 20 +++++++++++++-------
 src/declarativeimports/calendar/calendar.h   | 17 ++++++++++++-----
 2 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/src/declarativeimports/calendar/calendar.cpp 
b/src/declarativeimports/calendar/calendar.cpp
index ea63694..46b19ba 100644
--- a/src/declarativeimports/calendar/calendar.cpp
+++ b/src/declarativeimports/calendar/calendar.cpp
@@ -39,9 +39,9 @@ Calendar::Calendar(QObject *parent)
 //   connect(m_dayHelper, SIGNAL(calendarChanged()), this, SLOT(updateData()));
 }
 
-QDate Calendar::displayedDate() const
+QDateTime Calendar::displayedDate() const
 {
-    return m_displayedDate;
+    return QDateTime(m_displayedDate);
 }
 
 void Calendar::setDisplayedDate(const QDate &dateTime)
@@ -67,18 +67,24 @@ void Calendar::setDisplayedDate(const QDate &dateTime)
     }
 }
 
-QDate Calendar::today() const
+void Calendar::setDisplayedDate(const QDateTime &dateTime)
 {
-    return m_today;
+    setDisplayedDate(dateTime.date());
 }
 
-void Calendar::setToday(const QDate &dateTime)
+QDateTime Calendar::today() const
 {
-    if (dateTime == m_today) {
+    return QDateTime(m_today);
+}
+
+void Calendar::setToday(const QDateTime &dateTime)
+{
+    QDate date = dateTime.date();
+    if (date == m_today) {
         return;
     }
 
-    m_today = dateTime;
+    m_today = date;
     if (m_displayedDate.isNull()) {
         resetToToday();
     } else {
diff --git a/src/declarativeimports/calendar/calendar.h 
b/src/declarativeimports/calendar/calendar.h
index a746bd9..95755e6 100644
--- a/src/declarativeimports/calendar/calendar.h
+++ b/src/declarativeimports/calendar/calendar.h
@@ -32,17 +32,23 @@
 class Calendar : public QObject
 {
     Q_OBJECT
+    /* The conversion between QDate and JS Date is broken. The specification 
says that a date
+     * is represented by the start of the UTC day, but for negative to UTC 
timezones this results
+     * in wrong dates: Jan 2 in C++ -> Jan 2 (00:00) UTC -> Jan 1 (23:00) 
UTC-1 in JS.
+     * So use QDateTime for interfacing to always carry a timezone around.
+     * https://bugreports.qt.io/browse/QTBUG-29328 */
+
     /**
      * This property is used to determine which data from which month to show, 
it ensures
      * the day passed in the QDate is visible
      */
-    Q_PROPERTY(QDate displayedDate READ displayedDate WRITE setDisplayedDate 
NOTIFY displayedDateChanged)
+    Q_PROPERTY(QDateTime displayedDate READ displayedDate WRITE 
setDisplayedDate NOTIFY displayedDateChanged)
 
     /**
      * This property is used to determine which data from which month to show, 
it ensures
      * the day passed in the QDate is visible
      */
-    Q_PROPERTY(QDate today READ today WRITE setToday NOTIFY todayChanged)
+    Q_PROPERTY(QDateTime today READ today WRITE setToday NOTIFY todayChanged)
 
     /**
      * This determines which kind of data types should be contained in
@@ -140,12 +146,13 @@ public:
     explicit Calendar(QObject *parent = nullptr);
 
     // Displayed date
-    QDate displayedDate() const;
+    QDateTime displayedDate() const;
     void setDisplayedDate(const QDate &dateTime);
+    void setDisplayedDate(const QDateTime &dateTime);
 
     // The day that represents "today"
-    QDate today() const;
-    void setToday(const QDate &dateTime);
+    QDateTime today() const;
+    void setToday(const QDateTime &dateTime);
 
     // Types
     int types() const;
-- 
cgit v0.11.2


Reply via email to