diff --git a/0001-Port-deprecations-and-little-refactoring-of-the-QrCo.patch b/0001-Port-deprecations-and-little-refactoring-of-the-QrCo.patch new file mode 100644 index 0000000..ae46ea6 --- /dev/null +++ b/0001-Port-deprecations-and-little-refactoring-of-the-QrCo.patch @@ -0,0 +1,95 @@ +From ed31a672465bc19b43e6c204ee8b5172fc96eacf Mon Sep 17 00:00:00 2001 +From: Linus Jahn +Date: Fri, 31 Jul 2020 14:59:28 +0200 +Subject: [PATCH] Port deprecations and little refactoring of the QrCodeDecoder + +--- + src/QrCodeDecoder.cpp | 42 +++++++++++++------------------------ + src/RegistrationManager.cpp | 8 +++++-- + 2 files changed, 21 insertions(+), 29 deletions(-) + +diff --git a/src/QrCodeDecoder.cpp b/src/QrCodeDecoder.cpp +index 38df5f9..b2b4437 100644 +--- a/src/QrCodeDecoder.cpp ++++ b/src/QrCodeDecoder.cpp +@@ -41,6 +41,10 @@ + #include + #include + #include ++#include ++ ++#define ZXING_VERSION \ ++ QT_VERSION_CHECK(ZXING_VERSION_MAJOR, ZXING_VERSION_MINOR, ZXING_VERSION_PATCH) + + using namespace ZXing; + +@@ -51,36 +55,20 @@ QrCodeDecoder::QrCodeDecoder(QObject *parent) + + void QrCodeDecoder::decodeImage(const QImage &image) + { +- // options for decoding +- DecodeHints decodeHints; +- +- // Advise the decoder to also decode rotated QR codes. +- decodeHints.setTryRotate(true); +- +- // Advise the decoder to only decode QR codes. +- std::vector allowedFormats; +- allowedFormats.emplace_back(BarcodeFormat::QR_CODE); +- decodeHints.setPossibleFormats(allowedFormats); +- +- MultiFormatReader reader(decodeHints); +- +- // Create an image source to be decoded later. +- GenericLuminanceSource source( +- image.width(), +- image.height(), +- image.bits(), +- image.width(), +- 1, +- 0, +- 1, +- 2 +- ); ++ // Advise the decoder to check for QR codes and to try decoding rotated versions of the image. ++#if ZXING_VERSION >= QT_VERSION_CHECK(1, 1, 0) ++ const auto decodeHints = DecodeHints().setTryRotate(true).setFormats(BarcodeFormat::QR_CODE); ++#else ++ const auto decodeHints = ++ DecodeHints().setTryRotate(true).setPossibleFormats({BarcodeFormat::QR_CODE}); ++#endif + +- // Create an image source specific for decoding black data on white background. +- HybridBinarizer binImage(std::shared_ptr(&source, [](void*) {})); ++ // Create a binarized image by the luminance of the image. ++ HybridBinarizer binImage(std::make_shared(GenericLuminanceSource( ++ image.width(), image.height(), image.bits(), image.width(), 1, 0, 1, 2))); + + // Decode the specific image source. +- auto result = reader.read(binImage); ++ auto result = MultiFormatReader(decodeHints).read(binImage); + + // If a QR code could be found and decoded, emit a signal with the decoded string. + // Otherwise, emit a signal for failed decoding. +diff --git a/src/RegistrationManager.cpp b/src/RegistrationManager.cpp +index 3014e0f..f095343 100644 +--- a/src/RegistrationManager.cpp ++++ b/src/RegistrationManager.cpp +@@ -258,8 +258,12 @@ void RegistrationManager::copyUserDefinedValuesToNewForm(const QXmppDataForm &ol + // Copy values from the last form. + const QList oldFields = oldForm.fields(); + for (const auto &field : oldFields) { +- // Only copy fields which are required, visible to the user and do not have a media element (e.g. CAPTCHA). +- if (field.isRequired() && field.type() != QXmppDataForm::Field::HiddenField && field.media().isNull()) { ++ // Only copy fields which: ++ // * are required, ++ // * are visible to the user ++ // * do not have a media element (e.g. CAPTCHA) ++ if (field.isRequired() && field.type() != QXmppDataForm::Field::HiddenField && ++ field.mediaSources().isEmpty()) { + for (auto &fieldFromNewForm : newForm.fields()) { + if (fieldFromNewForm.key() == field.key()) { + fieldFromNewForm.setValue(field.value()); +-- +2.28.0 + diff --git a/kaidan.changes b/kaidan.changes index 773b686..2f921cb 100644 --- a/kaidan.changes +++ b/kaidan.changes @@ -27,6 +27,8 @@ Sun Aug 16 18:02:07 UTC 2020 - Christophe Giboudeaux * Improve build scripts for better cross-platform support * Refactor code for better performance and stability * Add documentation to achieve easier maintenance +- Add upstream patch: + * 0001-Port-deprecations-and-little-refactoring-of-the-QrCo.patch ------------------------------------------------------------------- Wed Jul 17 19:19:46 UTC 2019 - Wolfgang Bauer diff --git a/kaidan.spec b/kaidan.spec index 8affb1c..53b1ea5 100644 --- a/kaidan.spec +++ b/kaidan.spec @@ -24,6 +24,8 @@ License: GPL-3.0-or-later AND SUSE-GPL-3.0+-with-openssl-exception AND MI Group: Productivity/Networking/Instant Messenger URL: https://www.kaidan.im/ Source: https://download.kde.org/stable/%{name}/%{version}/%{name}-%{version}.tar.xz +# PATCH-FIX-UPSTREAM +Patch0: 0001-Port-deprecations-and-little-refactoring-of-the-QrCo.patch BuildRequires: cmake >= 3.3 BuildRequires: extra-cmake-modules >= 5.40.0 BuildRequires: libqxmpp-devel >= 0.8.3 @@ -52,7 +54,7 @@ Kirigami and QtQuick. The back-end of Kaidan is entirely written in C++ using the qxmpp XMPP client library and Qt 5. %prep -%setup -q +%autosetup -p1 %build %cmake_kf5 -d build '-DI18N:BOOL=ON'