Hello community,

here is the log from the commit of package libkgapi for openSUSE:Factory 
checked in at 2019-02-28 21:33:50
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libkgapi (Old)
 and      /work/SRC/openSUSE:Factory/.libkgapi.new.28833 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libkgapi"

Thu Feb 28 21:33:50 2019 rev:43 rq:678885 version:18.12.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/libkgapi/libkgapi.changes        2019-02-14 
14:21:17.687990128 +0100
+++ /work/SRC/openSUSE:Factory/.libkgapi.new.28833/libkgapi.changes     
2019-02-28 21:33:51.481725964 +0100
@@ -1,0 +2,7 @@
+Mon Feb 25 06:48:10 UTC 2019 - [email protected]
+
+- Add Contacts-fix-email-type-deserialization.patch to fix broken
+  email fields in google contacts (boo#1126614, kde#398847)
+- Use < %{version} again for obsoleting sasl2-kdexoauth2-3
+
+-------------------------------------------------------------------

New:
----
  Contacts-fix-email-type-deserialization.patch

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

Other differences:
------------------
++++++ libkgapi.spec ++++++
--- /var/tmp/diff_new_pack.1KNlx6/_old  2019-02-28 21:33:52.089725773 +0100
+++ /var/tmp/diff_new_pack.1KNlx6/_new  2019-02-28 21:33:52.093725772 +0100
@@ -27,6 +27,8 @@
 Group:          System/GUI/KDE
 URL:            http://www.kde.org
 Source0:        %{name}-%{version}.tar.xz
+# PATCH-FIX-UPSTREAM
+Patch0:         Contacts-fix-email-type-deserialization.patch
 BuildRequires:  cyrus-sasl-devel
 BuildRequires:  extra-cmake-modules >= 1.0.0
 BuildRequires:  kcalcore-devel
@@ -115,7 +117,7 @@
 Group:          System/GUI/KDE
 Conflicts:      kdepim-runtime < %{_kapp_version}
 Provides:       sasl2-kdexoauth2-3 = %{version}
-Obsoletes:      sasl2-kdexoauth2-3 <= %{version}
+Obsoletes:      sasl2-kdexoauth2-3 < %{version}
 
 %description -n sasl2-kdexoauth2
 This package provides a Cyrus SASL plugin to use Google's XOAUTH 
authentication for receiving
@@ -146,6 +148,7 @@
 
 %prep
 %setup -q -n libkgapi-%{version}
+%autopatch -p1
 
 %build
   %cmake_kf5 -d build -- -DBUILD_TESTING=ON

++++++ Contacts-fix-email-type-deserialization.patch ++++++
>From 2a85825b3a15a6d87fd9d79a61af31927d716641 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20Vr=C3=A1til?= <[email protected]>
Date: Sun, 24 Feb 2019 22:38:38 +0100
Subject: Contacts: fix email type deserialization

BUG: 398847
FIXED-IN: 5.10.3
---
 src/contacts/contact.cpp         | 14 ++++++++++++++
 src/contacts/contact.h           |  5 +++++
 src/contacts/contactsservice.cpp |  6 ++++--
 3 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/src/contacts/contact.cpp b/src/contacts/contact.cpp
index e2d2aee..d9617ce 100644
--- a/src/contacts/contact.cpp
+++ b/src/contacts/contact.cpp
@@ -482,3 +482,17 @@ KContacts::PhoneNumber::Type 
Contact::phoneSchemeToType(const QString& scheme)
 
     return type;
 }
+
+QString Contact::emailSchemeToProtocolName(const QString &scheme)
+{
+    QString type = scheme.mid(scheme.lastIndexOf(QLatin1Char('#')) + 1);
+    if (type == QLatin1String("work")) {
+        return QStringLiteral("WORK");
+    } else if (type == QLatin1String("home")) {
+        return QStringLiteral("HOME");
+    } else if (type == QLatin1String("other")) {
+        return QStringLiteral("OTHER");
+    }
+    return type;
+}
+
diff --git a/src/contacts/contact.h b/src/contacts/contact.h
index db77df1..913b951 100644
--- a/src/contacts/contact.h
+++ b/src/contacts/contact.h
@@ -320,6 +320,11 @@ class KGAPICONTACTS_EXPORT Contact : public KGAPI2::Object,
      */
     static KContacts::Address::Type addressSchemeToType(const QString &scheme, 
bool primary = false);
 
+    /**
+     * @brief Contacts Google scheme URL to email type.
+     */
+    static QString emailSchemeToProtocolName(const QString &scheme);
+
   private:
     class Private;
     Private * const d;
diff --git a/src/contacts/contactsservice.cpp b/src/contacts/contactsservice.cpp
index 6798c60..ec6b974 100644
--- a/src/contacts/contactsservice.cpp
+++ b/src/contacts/contactsservice.cpp
@@ -453,7 +453,8 @@ ObjectPtr Private::JSONToContact(const QVariantMap& data)
     const QVariantList emails = 
data.value(QStringLiteral("gd$email")).toList();
     for (const QVariant & em : emails) {
         const QVariantMap email = em.toMap();
-        const QMap<QString, QStringList> params({ { QStringLiteral("TYPE"), { 
email.value(QStringLiteral("rel")).toString() } } });
+        const auto emailType = 
Contact::emailSchemeToProtocolName(email.value(QStringLiteral("rel")).toString());
+        const QMap<QString, QStringList> params({ { QStringLiteral("TYPE"), { 
emailType } } });
         contact->insertEmail(email.value(QStringLiteral("address")).toString(),
                              email.value(QStringLiteral("primary")).toBool(), 
params);
     }
@@ -1026,7 +1027,8 @@ ContactPtr XMLToContact(const QByteArray& xmlData)
 
         /* Emails */
         if (e.tagName() == QLatin1String("gd:email")) {
-            const QMap<QString, QStringList> params({ { 
QStringLiteral("TYPE"), { e.attribute(QStringLiteral("rel"), {}) } } });
+            const auto emailType = 
Contact::emailSchemeToProtocolName(e.attribute(QStringLiteral("rel"), {}));
+            const QMap<QString, QStringList> params({ { 
QStringLiteral("TYPE"), { emailType } } });
             contact->insertEmail(e.attribute(QStringLiteral("address")),
                                  
(e.attribute(QStringLiteral("primary")).toLower() == QLatin1String("true")), 
params);
             continue;
-- 
cgit v1.1


Reply via email to