Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package kpkpass for openSUSE:Factory checked in at 2021-08-16 10:06:49 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kpkpass (Old) and /work/SRC/openSUSE:Factory/.kpkpass.new.1899 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "kpkpass" Mon Aug 16 10:06:49 2021 rev:37 rq:911728 version:21.08.0 Changes: -------- --- /work/SRC/openSUSE:Factory/kpkpass/kpkpass.changes 2021-07-09 23:59:17.776544590 +0200 +++ /work/SRC/openSUSE:Factory/.kpkpass.new.1899/kpkpass.changes 2021-08-16 10:08:24.231323453 +0200 @@ -1,0 +2,32 @@ +Fri Aug 6 09:40:23 UTC 2021 - Christophe Giboudeaux <[email protected]> + +- Update to 21.08.0 + * New feature release + * For more details please see: + * https://kde.org/announcements/gear/21.08.0 +- No code change since 21.07.90 + +------------------------------------------------------------------- +Fri Jul 30 10:05:24 UTC 2021 - Christophe Giboudeaux <[email protected]> + +- Update to 21.07.90 + * New feature release +- No code change since 21.07.80 + +------------------------------------------------------------------- +Sat Jul 17 20:06:32 UTC 2021 - Christophe Giboudeaux <[email protected]> + +- Update to 21.07.80 + * New feature release +- Changes since 21.04.3: + * Add CI check for REUSE compliance + * Support date-only field formatting + * Make unit test independent of the local timezone + * Add license + * Trim string fields for display + * Add missing SPDX headers + * Implement support for date/time field detection and formatting + * Use more target-centric cmake code +- Only install the license files once + +------------------------------------------------------------------- Old: ---- kpkpass-21.04.3.tar.xz kpkpass-21.04.3.tar.xz.sig New: ---- kpkpass-21.08.0.tar.xz kpkpass-21.08.0.tar.xz.sig ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kpkpass.spec ++++++ --- /var/tmp/diff_new_pack.oGRcuq/_old 2021-08-16 10:08:26.023321310 +0200 +++ /var/tmp/diff_new_pack.oGRcuq/_new 2021-08-16 10:08:26.023321310 +0200 @@ -18,7 +18,7 @@ %bcond_without lang Name: kpkpass -Version: 21.04.3 +Version: 21.08.0 Release: 0 Summary: Library to parse Passbook files License: LGPL-2.1-or-later @@ -82,7 +82,6 @@ %{_datadir}/mime/packages/application-vnd-apple-pkpass.xml %files devel -%license LICENSES/* %dir %{_includedir}/KPim/ %{_includedir}/KPim/KPkPass/ %{_kf5_cmakedir}/KPimPkPass/ ++++++ kpkpass-21.04.3.tar.xz -> kpkpass-21.08.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpkpass-21.04.3/.clang-format new/kpkpass-21.08.0/.clang-format --- old/kpkpass-21.04.3/.clang-format 2021-06-08 21:08:26.000000000 +0200 +++ new/kpkpass-21.08.0/.clang-format 1970-01-01 01:00:00.000000000 +0100 @@ -1,76 +0,0 @@ ---- -# SPDX-FileCopyrightText: 2019 Christoph Cullmann <[email protected]> -# SPDX-FileCopyrightText: 2019 Gernot Gebhard <[email protected]> -# -# SPDX-License-Identifier: MIT - -# Style for C++ -Language: Cpp - -# base is WebKit coding style: https://webkit.org/code-style-guidelines/ -# below are only things set that diverge from this style! -BasedOnStyle: WebKit - -# enforce C++11 (e.g. for std::vector<std::vector<lala>> -Standard: Cpp11 - -# 4 spaces indent -TabWidth: 4 - -# 2 * 80 wide lines -ColumnLimit: 160 - -# sort includes inside line separated groups -SortIncludes: true - -# break before braces on function, namespace and class definitions. -BreakBeforeBraces: Linux - -# CrlInstruction *a; -PointerAlignment: Right - -# horizontally aligns arguments after an open bracket. -AlignAfterOpenBracket: Align - -# don't move all parameters to new line -AllowAllParametersOfDeclarationOnNextLine: false - -# no single line functions -AllowShortFunctionsOnASingleLine: None - -# always break before you encounter multi line strings -AlwaysBreakBeforeMultilineStrings: true - -# don't move arguments to own lines if they are not all on the same -BinPackArguments: false - -# don't move parameters to own lines if they are not all on the same -BinPackParameters: false - -# In case we have an if statement whith multiple lines the operator should be at the beginning of the line -# but we do not want to break assignments -BreakBeforeBinaryOperators: NonAssignment - -# format C++11 braced lists like function calls -Cpp11BracedListStyle: true - -# do not put a space before C++11 braced lists -SpaceBeforeCpp11BracedList: false - -# remove empty lines -KeepEmptyLinesAtTheStartOfBlocks: false - -# no namespace indentation to keep indent level low -NamespaceIndentation: None - -# we use template< without space. -SpaceAfterTemplateKeyword: false - -# macros for which the opening brace stays attached. -ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH, forever, Q_FOREVER, QBENCHMARK, QBENCHMARK_ONCE ] - -# keep lambda formatting multi-line if not empty -AllowShortLambdasOnASingleLine: Empty - -# We do not want clang-format to put all arguments on a new line -AllowAllArgumentsOnNextLine: false diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpkpass-21.04.3/.git-blame-ignore-revs new/kpkpass-21.08.0/.git-blame-ignore-revs --- old/kpkpass-21.04.3/.git-blame-ignore-revs 2021-06-08 21:08:26.000000000 +0200 +++ new/kpkpass-21.08.0/.git-blame-ignore-revs 2021-07-30 14:47:45.000000000 +0200 @@ -1,2 +1,5 @@ +# SPDX-License-Identifier: CC0-1.0 +# SPDX-FileCopyrightText: none + # clang-format fbb28b70194761f7023f03b1b3eb073e5d804261 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpkpass-21.04.3/.gitignore new/kpkpass-21.08.0/.gitignore --- old/kpkpass-21.04.3/.gitignore 2021-06-08 21:08:26.000000000 +0200 +++ new/kpkpass-21.08.0/.gitignore 2021-07-30 14:47:45.000000000 +0200 @@ -1,3 +1,6 @@ +# SPDX-License-Identifier: CC0-1.0 +# SPDX-FileCopyrightText: none + # Ignore the following files *~ *.[oa] @@ -19,3 +22,8 @@ CMakeLists.txt.user* *.unc-backup* compile_commands.json +.clang-format +.clangd +.idea +/cmake-build* +.cache diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpkpass-21.04.3/.gitlab-ci.yml new/kpkpass-21.08.0/.gitlab-ci.yml --- old/kpkpass-21.04.3/.gitlab-ci.yml 2021-06-08 21:08:26.000000000 +0200 +++ new/kpkpass-21.08.0/.gitlab-ci.yml 2021-07-30 14:47:45.000000000 +0200 @@ -5,6 +5,7 @@ include: - https://invent.kde.org/sysadmin/ci-tooling/raw/master/invent/ci-before.yml - https://invent.kde.org/sysadmin/ci-tooling/raw/master/invent/ci-applications-linux.yml + - https://invent.kde.org/sysadmin/ci-tooling/raw/master/invent/ci-reuse.yml build_clazy_clang_tidy: stage: build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpkpass-21.04.3/.kateconfig new/kpkpass-21.08.0/.kateconfig --- old/kpkpass-21.04.3/.kateconfig 2021-06-08 21:08:26.000000000 +0200 +++ new/kpkpass-21.08.0/.kateconfig 2021-07-30 14:47:45.000000000 +0200 @@ -1 +1,3 @@ +// SPDX-License-Identifier: CC0-1.0 +// SPDX-FileCopyrightText: none // kate: space-indent on; indent-width 4; remove-trailing-spaces modified; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpkpass-21.04.3/CMakeLists.txt new/kpkpass-21.08.0/CMakeLists.txt --- old/kpkpass-21.04.3/CMakeLists.txt 2021-06-08 21:08:26.000000000 +0200 +++ new/kpkpass-21.08.0/CMakeLists.txt 2021-07-30 14:47:45.000000000 +0200 @@ -1,8 +1,12 @@ -cmake_minimum_required(VERSION 3.5 FATAL_ERROR) -set(PIM_VERSION "5.17.3") +# SPDX-FileCopyrightText: 2018-2020 Volker Krause <[email protected]> +# SPDX-FileCopyrightText: 2018-2021 Laurent Montel <[email protected]> +# SPDX-License-Identifier: BSD-3-Clause + +cmake_minimum_required(VERSION 3.16 FATAL_ERROR) +set(PIM_VERSION "5.18.0") project(KPkPass VERSION ${PIM_VERSION}) -set(KF5_MIN_VERSION "5.79.0") +set(KF5_MIN_VERSION "5.83.0") find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) @@ -23,27 +27,23 @@ PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KPimPkPassConfigVersion.cmake" ) -set(QT_REQUIRED_VERSION "5.14.0") +set(QT_REQUIRED_VERSION "5.15.0") find_package(Qt5 ${QT_REQUIRED_VERSION} REQUIRED COMPONENTS Gui) find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Archive) find_package(SharedMimeInfo 1.3 REQUIRED) add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050f00) -add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x055000) +add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x055400) -set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) -option(USE_UNITY_CMAKE_SUPPORT "Use UNITY cmake support (speedup compile time)" FALSE) +option(USE_UNITY_CMAKE_SUPPORT "Use UNITY cmake support (speedup compile time)" OFF) -set(COMPILE_WITH_UNITY_CMAKE_SUPPORT false) +set(COMPILE_WITH_UNITY_CMAKE_SUPPORT OFF) if (USE_UNITY_CMAKE_SUPPORT) - if(${CMAKE_VERSION} VERSION_LESS "3.16.0") - message(STATUS "CMAKE version is less than 3.16.0 . We can't use cmake unify build support") - else() - set(COMPILE_WITH_UNITY_CMAKE_SUPPORT true) - endif() + set(COMPILE_WITH_UNITY_CMAKE_SUPPORT ON) endif() add_subdirectory(src) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpkpass-21.04.3/CMakePresets.json new/kpkpass-21.08.0/CMakePresets.json --- old/kpkpass-21.04.3/CMakePresets.json 2021-06-08 21:08:26.000000000 +0200 +++ new/kpkpass-21.08.0/CMakePresets.json 2021-07-30 14:47:45.000000000 +0200 @@ -1,5 +1,5 @@ { - "version": 1, + "version": 2, "configurePresets": [ { "name": "dev", @@ -23,6 +23,20 @@ } }, { + "name": "dev-clang", + "displayName": "dev-clang", + "generator": "Ninja", + "binaryDir": "${sourceDir}/build-clang", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_EXPORT_COMPILE_COMMANDS": "ON" + }, + "environment": { + "CXX": "clang++", + "CCACHE_DISABLE": "ON" + } + }, + { "name": "unity", "displayName": "Build with CMake unity support.", "generator": "Ninja", @@ -51,6 +65,64 @@ "CMAKE_BUILD_TYPE": "RelWithDebInfo", "CMAKE_EXPORT_COMPILE_COMMANDS": "ON" } + }, + { + "name": "clazy", + "displayName": "clazy", + "generator": "Ninja", + "binaryDir": "${sourceDir}/build-clazy", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug" + }, + "environment": { + "CXX": "clazy", + "CCACHE_DISABLE": "ON" + } + } + + ], + "buildPresets": [ + { + "name": "dev", + "configurePreset": "dev" + }, + { + "name": "release", + "configurePreset": "release" + }, + { + "name": "dev-clang", + "configurePreset": "dev-clang" + }, + { + "name": "asan", + "configurePreset": "asan" + }, + { + "name": "unity", + "configurePreset": "unity" + }, + { + "name": "clazy", + "configurePreset": "clazy", + "environment": { + "CLAZY_CHECKS" : "level0,level1,detaching-member,ifndef-define-typo,isempty-vs-count,qrequiredresult-candidates,reserve-candidates,signal-with-return-value,unneeded-cast,function-args-by-ref,function-args-by-value,returning-void-expression,no-ctor-missing-parent-argument,isempty-vs-count,qhash-with-char-pointer-key,raw-environment-function,qproperty-type-mismatch,old-style-connect,qstring-allocations,container-inside-loop,heap-allocated-small-trivial-type,inefficient-qlist,qstring-varargs,level2,detaching-member,heap-allocated-small-trivial-type,isempty-vs-count,qstring-varargs,qvariant-template-instantiation,raw-environment-function,reserve-candidates,signal-with-return-value,thread-with-slots,no-ctor-missing-parent-argument,no-missing-typeinfo", + "CCACHE_DISABLE" : "ON" + } } + ], + "testPresets": [ + { + "name": "dev", + "configurePreset": "dev", + "output": {"outputOnFailure": true}, + "execution": {"noTestsAction": "error", "stopOnFailure": false} + }, + { + "name": "asan", + "configurePreset": "asan", + "output": {"outputOnFailure": true}, + "execution": {"noTestsAction": "error", "stopOnFailure": true} + } ] } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpkpass-21.04.3/KPimPkPassConfig.cmake.in new/kpkpass-21.08.0/KPimPkPassConfig.cmake.in --- old/kpkpass-21.04.3/KPimPkPassConfig.cmake.in 2021-06-08 21:08:26.000000000 +0200 +++ new/kpkpass-21.08.0/KPimPkPassConfig.cmake.in 2021-07-30 14:47:45.000000000 +0200 @@ -1,3 +1,8 @@ +# SPDX-FileCopyrightText: 2018 Volker Krause <[email protected]> +# SPDX-FileCopyrightText: 2018 Jonathan Riddell <[email protected]> +# SPDX-FileCopyrightText: 2019 Laurent Montel <[email protected]> +# SPDX-License-Identifier: BSD-3-Clause + @PACKAGE_INIT@ include(CMakeFindDependencyMacro) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpkpass-21.04.3/LICENSES/BSD-3-Clause.txt new/kpkpass-21.08.0/LICENSES/BSD-3-Clause.txt --- old/kpkpass-21.04.3/LICENSES/BSD-3-Clause.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/kpkpass-21.08.0/LICENSES/BSD-3-Clause.txt 2021-07-30 14:47:45.000000000 +0200 @@ -0,0 +1,11 @@ +Copyright (c) <year> <owner>. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpkpass-21.04.3/README.md.license new/kpkpass-21.08.0/README.md.license --- old/kpkpass-21.04.3/README.md.license 1970-01-01 01:00:00.000000000 +0100 +++ new/kpkpass-21.08.0/README.md.license 2021-07-30 14:47:45.000000000 +0200 @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: 2018 Volker Krause <[email protected]> +SPDX-License-Identifier: CC0-1.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpkpass-21.04.3/autotests/CMakeLists.txt new/kpkpass-21.08.0/autotests/CMakeLists.txt --- old/kpkpass-21.04.3/autotests/CMakeLists.txt 2021-06-08 21:08:26.000000000 +0200 +++ new/kpkpass-21.08.0/autotests/CMakeLists.txt 2021-07-30 14:47:45.000000000 +0200 @@ -1,4 +1,9 @@ +# SPDX-FileCopyrightText: 2018-2021 Volker Krause <[email protected]> +# SPDX-FileCopyrightText: 2021 Laurent Montel <[email protected]> +# SPDX-License-Identifier: BSD-3-Clause + find_package(Qt5Test ${QT_REQUIRED_VERSION} CONFIG REQUIRED) add_definitions(-DSOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}") -ecm_add_test(pkpasstest.cpp LINK_LIBRARIES Qt5::Test KPim::PkPass) +ecm_add_test(pkpasstest.cpp LINK_LIBRARIES Qt::Test KPim::PkPass) +ecm_add_test(fieldtest.cpp LINK_LIBRARIES Qt::Test KPim::PkPass) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpkpass-21.04.3/autotests/data/boardingpass-v1.pkpass.license new/kpkpass-21.08.0/autotests/data/boardingpass-v1.pkpass.license --- old/kpkpass-21.04.3/autotests/data/boardingpass-v1.pkpass.license 1970-01-01 01:00:00.000000000 +0100 +++ new/kpkpass-21.08.0/autotests/data/boardingpass-v1.pkpass.license 2021-07-30 14:47:45.000000000 +0200 @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: 2018 Volker Krause <[email protected]> +SPDX-License-Identifier: CC0-1.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpkpass-21.04.3/autotests/data/boardingpass-v2.pkpass.license new/kpkpass-21.08.0/autotests/data/boardingpass-v2.pkpass.license --- old/kpkpass-21.04.3/autotests/data/boardingpass-v2.pkpass.license 1970-01-01 01:00:00.000000000 +0100 +++ new/kpkpass-21.08.0/autotests/data/boardingpass-v2.pkpass.license 2021-07-30 14:47:45.000000000 +0200 @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: 2018 Volker Krause <[email protected]> +SPDX-License-Identifier: CC0-1.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpkpass-21.04.3/autotests/fieldtest.cpp new/kpkpass-21.08.0/autotests/fieldtest.cpp --- old/kpkpass-21.04.3/autotests/fieldtest.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/kpkpass-21.08.0/autotests/fieldtest.cpp 2021-07-30 14:47:45.000000000 +0200 @@ -0,0 +1,65 @@ +/* + SPDX-FileCopyrightText: 2021 Volker Krause <[email protected]> + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ + +#include <field.h> +#include <pass.h> + +#include <QJsonDocument> +#include <QJsonObject> +#include <QLocale> +#include <QTest> + +#include <cmath> + +void initLocale() +{ + qputenv("TZ", "UTC"); +} + +Q_CONSTRUCTOR_FUNCTION(initLocale) + +namespace KPkPass +{ +class FieldTest : public QObject +{ + Q_OBJECT +private Q_SLOTS: + void initTestCase() + { + QLocale::setDefault(QLocale(QStringLiteral("fr_FR"))); + } + + void testBoardingPass() + { + std::unique_ptr<KPkPass::Pass> pass(KPkPass::Pass::fromFile(QStringLiteral(SOURCE_DIR "/data/boardingpass-v1.pkpass"))); + QVERIFY(pass); + + auto obj = + QJsonDocument::fromJson(R"({"key":"valid-date","label":"Datum","dateStyle":"PKDateStyleShort","value":"2021-06-27T14:30:00+02:00"})").object(); + KPkPass::Field f(obj, pass.get()); + QCOMPARE(f.value().type(), QVariant::DateTime); + QCOMPARE(f.value(), QDateTime({2021, 6, 27}, {14, 30}, Qt::OffsetFromUTC, 7200)); + QCOMPARE(f.valueDisplayString(), QLatin1String("27/06/2021 14:30")); + + obj = QJsonDocument::fromJson(R"({"key":"valid-date","label":"Datum","dateStyle":"PKDateStyleShort","value":"2021-06-27T00:00:00+02:00"})").object(); + f = KPkPass::Field(obj, pass.get()); + QCOMPARE(f.value().type(), QVariant::DateTime); + QCOMPARE(f.value().toDateTime().date(), QDate({2021, 6, 27})); + QCOMPARE(f.valueDisplayString(), QLatin1String("27/06/2021")); + + obj = QJsonDocument::fromJson(R"({"key":"valid-locations","label":"Ort","value":"Freibad Killesberg\n"})").object(); + f = KPkPass::Field(obj, pass.get()); + + QCOMPARE(f.value().type(), QVariant::String); + QCOMPARE(f.value(), QLatin1String("Freibad Killesberg\n")); + QCOMPARE(f.valueDisplayString(), QLatin1String("Freibad Killesberg")); + } +}; +} + +QTEST_GUILESS_MAIN(KPkPass::FieldTest) + +#include "fieldtest.moc" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpkpass-21.04.3/metainfo.yaml.license new/kpkpass-21.08.0/metainfo.yaml.license --- old/kpkpass-21.04.3/metainfo.yaml.license 1970-01-01 01:00:00.000000000 +0100 +++ new/kpkpass-21.08.0/metainfo.yaml.license 2021-07-30 14:47:45.000000000 +0200 @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: none +SPDX-License-Identifier: CC0-1.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpkpass-21.04.3/sanitizers.supp new/kpkpass-21.08.0/sanitizers.supp --- old/kpkpass-21.04.3/sanitizers.supp 2021-06-08 21:08:26.000000000 +0200 +++ new/kpkpass-21.08.0/sanitizers.supp 2021-07-30 14:47:45.000000000 +0200 @@ -1,3 +1,5 @@ +# SPDX-FileCopyrightText: 2021 Laurent Montel <[email protected]> +# SPDX-License-Identifier: CC0-1.0 # Suppression file for ASAN/LSAN leak:libspeechd diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpkpass-21.04.3/src/CMakeLists.txt new/kpkpass-21.08.0/src/CMakeLists.txt --- old/kpkpass-21.04.3/src/CMakeLists.txt 2021-06-08 21:08:26.000000000 +0200 +++ new/kpkpass-21.08.0/src/CMakeLists.txt 2021-07-30 14:47:45.000000000 +0200 @@ -1,5 +1,12 @@ +# SPDX-FileCopyrightText: 2018 Volker Krause <[email protected]> +# SPDX-FileCopyrightText: 2019-2021 Laurent Montel <[email protected]> +# SPDX-License-Identifier: BSD-3-Clause + set(KDE_INSTALL_INCLUDEDIR_PIM ${KDE_INSTALL_INCLUDEDIR}/KPim) -set(pkpass_srcs +add_library(KPimPkPass) +add_library(KPim::PkPass ALIAS KPimPkPass) + +target_sources(KPimPkPass PRIVATE barcode.cpp boardingpass.cpp field.cpp @@ -7,26 +14,23 @@ pass.cpp ) -ecm_qt_declare_logging_category(pkpass_srcs +ecm_qt_declare_logging_category(KPimPkPass HEADER logging.h IDENTIFIER KPkPass::Log CATEGORY_NAME org.kde.pkpass DESCRIPTION "KPkPass" EXPORT KPKPASS) - -add_library(KPimPkPass ${pkpass_srcs}) -add_library(KPim::PkPass ALIAS KPimPkPass) generate_export_header(KPimPkPass BASE_NAME KPkPass) set_target_properties(KPimPkPass PROPERTIES - VERSION ${KPKPASS_VERSION_STRING} + VERSION ${KPKPASS_VERSION} SOVERSION ${KPKPASS_SOVERSION} EXPORT_NAME PkPass ) target_include_directories(KPimPkPass INTERFACE "$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR_PIM}>") target_link_libraries(KPimPkPass PUBLIC - Qt5::Gui + Qt::Gui PRIVATE KF5::Archive ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpkpass-21.04.3/src/application-vnd-apple-pkpass.xml new/kpkpass-21.08.0/src/application-vnd-apple-pkpass.xml --- old/kpkpass-21.04.3/src/application-vnd-apple-pkpass.xml 2021-06-08 21:08:26.000000000 +0200 +++ new/kpkpass-21.08.0/src/application-vnd-apple-pkpass.xml 2021-07-30 14:47:45.000000000 +0200 @@ -1,4 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- +SPDX-FileCopyrightText: 2018 Volker Krause <[email protected]> +SPDX-License-Identifier: CC0-1.0 +--> <mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info"> <mime-type type="application/vnd.apple.pkpass"> <sub-class-of type="application/zip"/> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpkpass-21.04.3/src/barcode.h new/kpkpass-21.08.0/src/barcode.h --- old/kpkpass-21.04.3/src/barcode.h 2021-06-08 21:08:26.000000000 +0200 +++ new/kpkpass-21.08.0/src/barcode.h 2021-07-30 14:47:45.000000000 +0200 @@ -4,8 +4,7 @@ SPDX-License-Identifier: LGPL-2.0-or-later */ -#ifndef KPKPASS_BARCODE_H -#define KPKPASS_BARCODE_H +#pragma once #include "kpkpass_export.h" @@ -58,4 +57,3 @@ Q_DECLARE_METATYPE(KPkPass::Barcode) -#endif // KPKPASS_BARCODE_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpkpass-21.04.3/src/boardingpass.h new/kpkpass-21.08.0/src/boardingpass.h --- old/kpkpass-21.04.3/src/boardingpass.h 2021-06-08 21:08:26.000000000 +0200 +++ new/kpkpass-21.08.0/src/boardingpass.h 2021-07-30 14:47:45.000000000 +0200 @@ -4,8 +4,7 @@ SPDX-License-Identifier: LGPL-2.0-or-later */ -#ifndef KPKPASS_BOARDINGPASS_H -#define KPKPASS_BOARDINGPASS_H +#pragma once #include "pass.h" @@ -28,4 +27,3 @@ } -#endif // KPKPASS_BOARDINGPASS_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpkpass-21.04.3/src/field.cpp new/kpkpass-21.08.0/src/field.cpp --- old/kpkpass-21.04.3/src/field.cpp 2021-06-08 21:08:26.000000000 +0200 +++ new/kpkpass-21.08.0/src/field.cpp 2021-07-30 14:47:45.000000000 +0200 @@ -1,5 +1,5 @@ /* - SPDX-FileCopyrightText: 2017-2018 Volker Krause <[email protected]> + SPDX-FileCopyrightText: 2017-2021 Volker Krause <[email protected]> SPDX-License-Identifier: LGPL-2.0-or-later */ @@ -62,14 +62,39 @@ if (v.isEmpty()) { v = d->pass->d->message(d->obj.value(QLatin1String("value")).toString()); } - // TODO number and date/time detection + + const auto dt = QDateTime::fromString(v, Qt::ISODate); + if (dt.isValid()) { + return dt; + } + + // TODO number detection return v; } QString Field::valueDisplayString() const { - // TODO respect number and date/time formatting options - return value().toString(); + const auto v = value(); + // see + // https://developer.apple.com/library/archive/documentation/UserExperience/Reference/PassKit_Bundle/Chapters/FieldDictionary.html#//apple_ref/doc/uid/TP40012026-CH4-SW6 + // however, real-world data doesn't strictly follow that, so we have to guess a bit here... + if (v.type() == QVariant::DateTime) { + const auto dt = v.toDateTime(); + auto fmt = QLocale::ShortFormat; + const auto dtStyle = d->obj.value(QLatin1String("dateStyle")).toString(); + if (dtStyle == QLatin1String("PKDateStyleLong") || dtStyle == QLatin1String("PKDateStyleFull")) { + fmt = QLocale::LongFormat; + } + const auto timeStyle = d->obj.value(QLatin1String("timeStyle")).toString(); + if (timeStyle == QLatin1String("PKDateStyleNone") || (timeStyle.isEmpty() && !dtStyle.isEmpty() && dt.time() == QTime(0, 0))) { + return QLocale().toString(dt.date(), fmt); + } + + return QLocale().toString(dt, fmt); + } + + // TODO respect number formatting options + return value().toString().trimmed(); } QString Field::changeMessage() const diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpkpass-21.04.3/src/field.h new/kpkpass-21.08.0/src/field.h --- old/kpkpass-21.04.3/src/field.h 2021-06-08 21:08:26.000000000 +0200 +++ new/kpkpass-21.08.0/src/field.h 2021-07-30 14:47:45.000000000 +0200 @@ -4,8 +4,7 @@ SPDX-License-Identifier: LGPL-2.0-or-later */ -#ifndef KPKPASS_FIELD_H -#define KPKPASS_FIELD_H +#pragma once #include "kpkpass_export.h" @@ -21,6 +20,7 @@ class Pass; class PassPrivate; class FieldPrivate; +class FieldTest; /** Field element in a KPkPass::Pass. * @see https://developer.apple.com/library/content/documentation/UserExperience/Reference/PassKit_Bundle/Chapters/FieldDictionary.html @@ -65,6 +65,7 @@ private: friend class PassPrivate; + friend class FieldTest; explicit Field(const QJsonObject &obj, const Pass *pass); std::shared_ptr<FieldPrivate> d; @@ -74,4 +75,3 @@ Q_DECLARE_METATYPE(KPkPass::Field) -#endif // KPKPASS_FIELD_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpkpass-21.04.3/src/location.h new/kpkpass-21.08.0/src/location.h --- old/kpkpass-21.04.3/src/location.h 2021-06-08 21:08:26.000000000 +0200 +++ new/kpkpass-21.08.0/src/location.h 2021-07-30 14:47:45.000000000 +0200 @@ -4,8 +4,7 @@ SPDX-License-Identifier: LGPL-2.0-or-later */ -#ifndef KPKPASS_LOCATION_H -#define KPKPASS_LOCATION_H +#pragma once #include "kpkpass_export.h" @@ -52,4 +51,3 @@ Q_DECLARE_METATYPE(KPkPass::Location) -#endif // KPKPASS_LOCATION_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpkpass-21.04.3/src/pass.h new/kpkpass-21.08.0/src/pass.h --- old/kpkpass-21.04.3/src/pass.h 2021-06-08 21:08:26.000000000 +0200 +++ new/kpkpass-21.08.0/src/pass.h 2021-07-30 14:47:45.000000000 +0200 @@ -4,8 +4,7 @@ SPDX-License-Identifier: LGPL-2.0-or-later */ -#ifndef KPKPASS_PASS_H -#define KPKPASS_PASS_H +#pragma once #include "field.h" #include "kpkpass_export.h" @@ -161,4 +160,3 @@ } -#endif // KPKPASS_PASS_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpkpass-21.04.3/src/pass_p.h new/kpkpass-21.08.0/src/pass_p.h --- old/kpkpass-21.04.3/src/pass_p.h 2021-06-08 21:08:26.000000000 +0200 +++ new/kpkpass-21.08.0/src/pass_p.h 2021-07-30 14:47:45.000000000 +0200 @@ -4,8 +4,7 @@ SPDX-License-Identifier: LGPL-2.0-or-later */ -#ifndef KPKPASS_PASS_P_H -#define KPKPASS_PASS_P_H +#pragma once #include <QHash> #include <QJsonObject> @@ -41,4 +40,3 @@ }; } -#endif // KPKPASS_PASS_H
