Commit c93acfec authored by Ahmad Samir's avatar Ahmad Samir
Browse files

Use cmakedefine01

This way we get a build time warning if the var isn't defined at all, e.g.
a missing check_include_files() CMake call.
parent 7269caff
Pipeline #188823 passed with stage
in 2 minutes and 36 seconds
......@@ -43,7 +43,7 @@ private Q_SLOTS:
QVERIFY(!img.isNull());
BarcodeDecoder decoder;
#ifdef HAVE_ZXING
#if HAVE_ZXING
QCOMPARE(decoder.decodeString(img, BarcodeDecoder::PDF417), QStringLiteral("PDF417 is a stacked linear barcode symbol format used in a variety of applications, primarily transport, identification cards, and inventory management."));
#endif
}
......@@ -53,18 +53,18 @@ private Q_SLOTS:
QImage img(QStringLiteral(SOURCE_DIR "/barcodes/aztec.png"));
QVERIFY(!img.isNull());
BarcodeDecoder decoder;
#ifdef HAVE_ZXING
#if HAVE_ZXING
QCOMPARE(decoder.decodeString(img, BarcodeDecoder::Aztec), QStringLiteral("This is an example Aztec symbol for Wikipedia."));
#endif
img.load(QStringLiteral(SOURCE_DIR "/barcodes/aztec-partial-quiet-zone.png"));
QVERIFY(!img.isNull());
#ifdef HAVE_ZXING
#if HAVE_ZXING
QCOMPARE(decoder.decodeString(img, BarcodeDecoder::Aztec), QStringLiteral("KF5::Prison - The KDE barcode generation framework."));
#endif
img.load(QStringLiteral(SOURCE_DIR "/barcodes/uic918-3star.png"));
QVERIFY(!img.isNull());
#ifdef HAVE_ZXING
#if HAVE_ZXING
const auto b = decoder.decodeBinary(img, BarcodeDecoder::Aztec);
QCOMPARE(b.size(), 351);
QVERIFY(b.startsWith("OTI010080000020"));
......@@ -91,7 +91,7 @@ private Q_SLOTS:
QVERIFY(!img.isNull());
BarcodeDecoder decoder;
#ifdef HAVE_ZXING
#if HAVE_ZXING
QCOMPARE(decoder.decodeString(img, BarcodeDecoder::QRCode), result);
#endif
......@@ -135,7 +135,7 @@ private Q_SLOTS:
BarcodeDecoder decoder;
QImage img(QStringLiteral(SOURCE_DIR "/barcodes/aztec.png"));
QCOMPARE(decoder.decodeString(img, BarcodeDecoder::PDF417), QString());
#ifdef HAVE_ZXING
#if HAVE_ZXING
QCOMPARE(decoder.decodeString(img, BarcodeDecoder::AnySquare), QStringLiteral("This is an example Aztec symbol for Wikipedia."));
QCOMPARE(decoder.decodeString(img, BarcodeDecoder::Any), QStringLiteral("This is an example Aztec symbol for Wikipedia."));
QCOMPARE(decoder.decodeString(img, BarcodeDecoder::Aztec), QStringLiteral("This is an example Aztec symbol for Wikipedia."));
......@@ -154,7 +154,7 @@ private Q_SLOTS:
{
BarcodeDecoder decoder;
QImage img(QStringLiteral(SOURCE_DIR "/barcodes/aztec.png"));
#ifdef HAVE_ZXING
#if HAVE_ZXING
QCOMPARE(decoder.decodeString(img, BarcodeDecoder::Any), QStringLiteral("This is an example Aztec symbol for Wikipedia."));
QCOMPARE(decoder.decodeBinary(img, BarcodeDecoder::Any), QByteArray("This is an example Aztec symbol for Wikipedia."));
......@@ -185,7 +185,7 @@ private Q_SLOTS:
QVERIFY(!img.isNull());
BarcodeDecoder decoder;
#ifdef HAVE_ZXING
#if HAVE_ZXING
QCOMPARE(decoder.decodeString(img, BarcodeDecoder::Any2D), QString());
QCOMPARE(decoder.decodeString(img, type), QLatin1String("123456789"));
QCOMPARE(decoder.decodeString(img, BarcodeDecoder::Any1D), QLatin1String("123456789"));
......
......@@ -83,7 +83,7 @@ private Q_SLOTS:
QCOMPARE(c1.location().toInt(), 0);
c1.processor()->expandNode(c1, &engine);
#ifndef HAVE_ZXING
#if !HAVE_ZXING
QSKIP("No ZXing support");
#endif
QCOMPARE(c1.childNodes().size(), 1);
......@@ -113,7 +113,7 @@ private Q_SLOTS:
QCOMPARE(c2.location().toInt(), 1);
c2.processor()->expandNode(c2, &engine);
#ifndef HAVE_ZXING
#if !HAVE_ZXING
QSKIP("No ZXing support");
#endif
QCOMPARE(c2.childNodes().size(), 1);
......
......@@ -135,7 +135,7 @@ private Q_SLOTS:
const auto root = engine.rootDocumentNode();
QVERIFY(!root.isNull());
#ifdef HAVE_ZXING
#if HAVE_ZXING
ExtractorFilter filter;
filter.setMimeType(s("internal/iata-bcbp"));
filter.setScope(ExtractorFilter::Descendants);
......
......@@ -56,7 +56,7 @@ private Q_SLOTS:
QTest::newRow("text/plain") << s(SOURCE_DIR "/scriptenginedata/plain-text.txt") << s(SOURCE_DIR "/scriptenginedata/plain-text.txt.json");
QTest::newRow("pkpass") << s(SOURCE_DIR "/pkpassdata/swiss.pkpass") << s(SOURCE_DIR "/scriptenginedata/swiss.pkpass.json");
QTest::newRow("IATA BCBP PDF") << s(SOURCE_DIR "/extractordata/synthetic/iata-bcbp-demo.pdf")
#ifdef HAVE_ZXING
#if HAVE_ZXING
<< s(SOURCE_DIR "/scriptenginedata/iata-bcbp-demo.pdf.json");
#else
<< s(SOURCE_DIR "/scriptenginedata/iata-bcbp-demo.pdf-no-zxing.json");
......
......@@ -111,7 +111,7 @@ private Q_SLOTS:
QSKIP("nothing extracted");
return;
}
#ifndef HAVE_ZXING
#if !HAVE_ZXING
if (jsonResult.isEmpty()) {
QSKIP("nothing extracted, but ZXing is missing!");
return;
......
......@@ -20,7 +20,7 @@ private Q_SLOTS:
{
QFile f(QStringLiteral(SOURCE_DIR "/structureddata/os-two-leg-invalid-microdata.html"));
QVERIFY(f.open(QFile::ReadOnly));
#ifdef HAVE_LIBXML2
#if HAVE_LIBXML2
std::unique_ptr<HtmlDocument> doc(HtmlDocument::fromData(f.readAll()));
QVERIFY(doc);
auto elem = doc->root();
......@@ -64,7 +64,7 @@ private Q_SLOTS:
{
QFile f(QStringLiteral(SOURCE_DIR "/structureddata/hotel-json-ld-fallback.html"));
QVERIFY(f.open(QFile::ReadOnly));
#ifdef HAVE_LIBXML2
#if HAVE_LIBXML2
std::unique_ptr<HtmlDocument> doc(HtmlDocument::fromData(f.readAll()));
QVERIFY(doc);
auto elem = doc->root();
......@@ -89,7 +89,7 @@ private Q_SLOTS:
{
QFile f(QStringLiteral(SOURCE_DIR "/misc/test.html"));
QVERIFY(f.open(QFile::ReadOnly));
#ifdef HAVE_LIBXML2
#if HAVE_LIBXML2
std::unique_ptr<HtmlDocument> doc(HtmlDocument::fromData(f.readAll().replace("<CR>", "\r")));
QVERIFY(doc);
auto elem = doc->root();
......
......@@ -14,8 +14,8 @@
#include <QImage>
#include <QString>
#ifdef HAVE_ZXING
#ifdef ZXING_USE_READBARCODE
#if HAVE_ZXING
#if ZXING_USE_READBARCODE
#include <ZXing/ReadBarcode.h>
#else
#include <ZXing/DecodeHints.h>
......@@ -137,7 +137,7 @@ bool BarcodeDecoder::maybeBarcode(int width, int height, BarcodeDecoder::Barcode
return isPlausibleSize(width, height, hint) && isPlausibleAspectRatio(width, height, hint);
}
#ifdef HAVE_ZXING
#if HAVE_ZXING
struct {
BarcodeDecoder::BarcodeType type;
ZXing::BarcodeFormat zxingType;
......@@ -191,7 +191,7 @@ BarcodeDecoder::BarcodeType formatToType(ZXing::BarcodeFormat format)
return BarcodeDecoder::None;
}
#ifdef ZXING_USE_READBARCODE
#if ZXING_USE_READBARCODE
static ZXing::ImageFormat zxingImageFormat(QImage::Format format)
{
switch (format) {
......@@ -230,7 +230,7 @@ void BarcodeDecoder::decodeZxing(const QImage &img, BarcodeDecoder::BarcodeTypes
hints.setPossibleFormats(typeToFormats(format));
#endif
#ifdef ZXING_USE_READBARCODE
#if ZXING_USE_READBARCODE
hints.setBinarizer(ZXing::Binarizer::FixedThreshold);
hints.setIsPure((format & BarcodeDecoder::IgnoreAspectRatio) == 0);
......@@ -293,7 +293,7 @@ void BarcodeDecoder::decodeIfNeeded(const QImage &img, BarcodeDecoder::BarcodeTy
if (aspectRatio > PDF417_MIN_ASPECT && aspectRatio < PDF417_MAX_ASPECT && (hint & PDF417) && (result.negative & hint & PDF417) != (hint & PDF417)) {
auto normalizedImg = img;
// newer ZXing versions handle rotated/flipped codes themselves correctly
#ifndef ZXING_USE_READBARCODE
#if !ZXING_USE_READBARCODE
if (normalizedImg.width() < normalizedImg.height()) {
QTransform tf;
tf.rotate(-90);
......@@ -302,7 +302,7 @@ void BarcodeDecoder::decodeIfNeeded(const QImage &img, BarcodeDecoder::BarcodeTy
#endif
decodeZxing(normalizedImg, PDF417, result);
#ifndef ZXING_USE_READBARCODE
#if !ZXING_USE_READBARCODE
if (result.positive & PDF417) {
return;
}
......
......@@ -24,7 +24,7 @@
#include <KItinerary/TrainTrip>
#include <KItinerary/Visit>
#ifdef HAVE_KCAL
#if HAVE_KCAL
#include <KCalendarCore/Alarm>
#include <KCalendarCore/Calendar>
#include <KCalendarCore/Event>
......@@ -50,7 +50,7 @@ static QString formatAddressSingleLine(const PostalAddress &addr)
return LocationUtil::toAddress(addr).formatted(KContacts::AddressFormatStyle::SingleLineInternational);
}
#ifdef HAVE_KCAL
#if HAVE_KCAL
using namespace KCalendarCore;
static void fillFlightReservation(const QVector<QVariant> &reservations, const KCalendarCore::Event::Ptr &event);
static void fillTrainReservation(const TrainReservation &reservation, const KCalendarCore::Event::Ptr &event);
......@@ -66,7 +66,7 @@ static void fillTaxiReservation(const TaxiReservation &reservation, const KCalen
QVector<QSharedPointer<KCalendarCore::Event> > CalendarHandler::findEvents(const QSharedPointer<KCalendarCore::Calendar> &calendar, const QVariant &reservation)
{
#ifdef HAVE_KCAL
#if HAVE_KCAL
if (!(JsonLd::canConvert<Reservation>(reservation) || JsonLd::canConvert<KItinerary::Event>(reservation)) || !calendar) {
return {};
}
......@@ -109,7 +109,7 @@ QVector<QSharedPointer<KCalendarCore::Event> > CalendarHandler::findEvents(const
QSharedPointer<KCalendarCore::Event> CalendarHandler::findEvent(const QSharedPointer<KCalendarCore::Calendar> &calendar, const QVariant &reservation)
{
#ifdef HAVE_KCAL
#if HAVE_KCAL
const auto evs = findEvents(calendar, reservation);
return evs.empty() ? KCalendarCore::Event::Ptr() : evs.at(0);
#else
......@@ -121,7 +121,7 @@ QSharedPointer<KCalendarCore::Event> CalendarHandler::findEvent(const QSharedPoi
QVector<QVariant> CalendarHandler::reservationsForEvent(const QSharedPointer<KCalendarCore::Event> &event)
{
#ifdef HAVE_KCAL
#if HAVE_KCAL
const auto payload = event->customProperty("KITINERARY", "RESERVATION").toUtf8();
const auto json = QJsonDocument::fromJson(payload).array();
return JsonLdDocument::fromJson(json);
......@@ -133,7 +133,7 @@ QVector<QVariant> CalendarHandler::reservationsForEvent(const QSharedPointer<KCa
bool CalendarHandler::canCreateEvent(const QVariant &reservation)
{
#ifdef HAVE_KCAL
#if HAVE_KCAL
if (JsonLd::isA<FlightReservation>(reservation)) {
const auto f = reservation.value<FlightReservation>().reservationFor().value<Flight>();
if (f.departureTime().isValid() && f.arrivalTime().isValid()) {
......@@ -153,7 +153,7 @@ void CalendarHandler::fillEvent(const QVector<QVariant> &reservations, const QSh
return;
}
#ifdef HAVE_KCAL
#if HAVE_KCAL
// TODO pass reservationS into all functions below for multi-traveler support
const auto &reservation = reservations.at(0);
const int typeId = reservation.userType();
......@@ -196,7 +196,7 @@ void CalendarHandler::fillEvent(const QVector<QVariant> &reservations, const QSh
#endif
}
#ifdef HAVE_KCAL
#if HAVE_KCAL
static QString airportDisplayCode(const Airport &airport)
{
return airport.iataCode().isEmpty() ? airport.name() : airport.iataCode();
......
......@@ -14,7 +14,7 @@
#define KPOPPLER_VERSION_PATCH @POPPLER_VERSION_PATCH@
#define KPOPPLER_VERSION ((@POPPLER_VERSION_MAJOR@<<16)|(@POPPLER_VERSION_MINOR@<<8)|(@POPPLER_VERSION_PATCH@))
#cmakedefine HAVE_ZXING
#cmakedefine01 HAVE_ZXING
#define ZXING_VERSION_STRING "@ZXing_VERSION@"
#define ZXING_VERSION_MAJOR @ZXing_VERSION_MAJOR@
#define ZXING_VERSION_MINOR @ZXing_VERSION_MINOR@
......@@ -25,16 +25,18 @@
#define K_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch))
// this might compile with older versions too, but it only actually works post 1.1.1
#ifdef HAVE_ZXING
#if ZXING_VERSION > K_VERSION_CHECK(1, 1, 1)
#define ZXING_USE_READBARCODE
#endif
#if HAVE_ZXING
#if ZXING_VERSION > K_VERSION_CHECK(1, 1, 1)
#define ZXING_USE_READBARCODE 1
#else
#define ZXING_USE_READBARCODE 0
#endif
#endif
#cmakedefine HAVE_KCAL
#cmakedefine HAVE_LIBXML2
#cmakedefine HAVE_PHONENUMBER
#cmakedefine01 HAVE_KCAL
#cmakedefine01 HAVE_LIBXML2
#cmakedefine01 HAVE_PHONENUMBER
#define CMAKE_INSTALL_FULL_LIBEXECDIR_KF5 "${CMAKE_INSTALL_FULL_LIBEXECDIR_KF5}"
#endif
#endif // CONFIG_KITINERARY_H
......@@ -11,7 +11,7 @@
#include <KItinerary/ExtractorRepository>
#ifdef HAVE_KCAL
#if HAVE_KCAL
#include <kcalendarcore_version.h>
#endif
......@@ -26,7 +26,7 @@ QString ExtractorCapabilities::capabilitiesString()
"Qt version : " QT_VERSION_STR "\n"
"HTML support : "
#ifdef HAVE_LIBXML2
#if HAVE_LIBXML2
"libxml2"
#else
"not available"
......@@ -36,7 +36,7 @@ QString ExtractorCapabilities::capabilitiesString()
"PDF support : poppler (" KPOPPLER_VERSION_STRING ")\n"
"iCal support : "
#ifdef HAVE_KCAL
#if HAVE_KCAL
"kcal (" KCALENDARCORE_VERSION_STRING ")"
#else
"not available"
......@@ -44,7 +44,7 @@ QString ExtractorCapabilities::capabilitiesString()
"\n"
"Barcode decoder : "
#ifdef HAVE_ZXING
#if HAVE_ZXING
"zxing (" ZXING_VERSION_STRING ")"
#else
"not available"
......@@ -52,7 +52,7 @@ QString ExtractorCapabilities::capabilitiesString()
"\n"
"Phone number decoder: "
#ifdef HAVE_PHONENUMBER
#if HAVE_PHONENUMBER
"libphonenumber"
#else
"not available"
......
......@@ -45,7 +45,7 @@
#include <QTimeZone>
#include <QUrl>
#ifdef HAVE_PHONENUMBER
#if HAVE_PHONENUMBER
#include <phonenumbers/phonenumberutil.h>
#endif
......@@ -510,7 +510,7 @@ PostalAddress ExtractorPostprocessorPrivate::processAddress(PostalAddress addr,
addr.setAddressLocality(addr.addressLocality().simplified());
addr.setAddressRegion(addr.addressRegion().simplified());
#ifdef HAVE_PHONENUMBER
#if HAVE_PHONENUMBER
// recover country from phone number, if we have that
if (!phoneNumber.isEmpty() && addr.addressCountry().size() != 2) {
const auto phoneStr = phoneNumber.toStdString();
......@@ -539,7 +539,7 @@ PostalAddress ExtractorPostprocessorPrivate::processAddress(PostalAddress addr,
QString ExtractorPostprocessorPrivate::processPhoneNumber(const QString &phoneNumber, const PostalAddress &addr)
{
#ifdef HAVE_PHONENUMBER
#if HAVE_PHONENUMBER
// or complete the phone number if we know the country
if (!phoneNumber.isEmpty() && addr.addressCountry().size() == 2) {
auto phoneStr = phoneNumber.toStdString();
......
......@@ -10,7 +10,7 @@
#include <QDebug>
#include <QVariant>
#ifdef HAVE_LIBXML2
#if HAVE_LIBXML2
#include <libxml/HTMLparser.h>
#include <libxml/xpath.h>
#endif
......@@ -20,7 +20,7 @@ using namespace KItinerary;
namespace KItinerary {
class HtmlDocumentPrivate {
public:
#ifdef HAVE_LIBXML2
#if HAVE_LIBXML2
~HtmlDocumentPrivate() {
xmlFreeDoc(m_doc);
}
......@@ -37,7 +37,7 @@ HtmlElement::HtmlElement()
HtmlElement::~HtmlElement() = default;
#ifdef HAVE_LIBXML2
#if HAVE_LIBXML2
HtmlElement::HtmlElement(xmlNode *dd)
: d(dd)
{
......@@ -59,7 +59,7 @@ bool HtmlElement::isNull() const
QString HtmlElement::name() const
{
#ifdef HAVE_LIBXML2
#if HAVE_LIBXML2
if (d) {
return QString::fromUtf8(reinterpret_cast<const char*>(d->name));
}
......@@ -69,7 +69,7 @@ QString HtmlElement::name() const
QString HtmlElement::attribute(const QString &attr) const
{
#ifdef HAVE_LIBXML2
#if HAVE_LIBXML2
if (d) {
const auto val = std::unique_ptr<xmlChar, decltype(xmlFree)>(xmlGetProp(d, reinterpret_cast<const xmlChar*>(attr.toUtf8().constData())), xmlFree);
return QString::fromUtf8(reinterpret_cast<const char*>(val.get()));
......@@ -82,7 +82,7 @@ QString HtmlElement::attribute(const QString &attr) const
HtmlElement HtmlElement::parent() const
{
#ifdef HAVE_LIBXML2
#if HAVE_LIBXML2
if (d && d->parent && d->parent->type == XML_ELEMENT_NODE) {
return HtmlElement(d->parent);
}
......@@ -92,7 +92,7 @@ HtmlElement HtmlElement::parent() const
HtmlElement HtmlElement::firstChild() const
{
#ifdef HAVE_LIBXML2
#if HAVE_LIBXML2
if (d) {
return HtmlElement(xmlFirstElementChild(d));
}
......@@ -102,7 +102,7 @@ HtmlElement HtmlElement::firstChild() const
HtmlElement HtmlElement::nextSibling() const
{
#ifdef HAVE_LIBXML2
#if HAVE_LIBXML2
if (d) {
return HtmlElement(xmlNextElementSibling(d));
}
......@@ -110,7 +110,7 @@ HtmlElement HtmlElement::nextSibling() const
return {};
}
#ifdef HAVE_LIBXML2
#if HAVE_LIBXML2
static QString normalizeSpaces(const QString &in)
{
QString out;
......@@ -151,7 +151,7 @@ static QString normalizeSpaces(const QString &in)
QString HtmlElement::content() const
{
#ifdef HAVE_LIBXML2
#if HAVE_LIBXML2
if (!d) {
return {};
}
......@@ -187,7 +187,7 @@ QString HtmlElement::content() const
return {};
}
#ifdef HAVE_LIBXML2
#if HAVE_LIBXML2
static void recursiveContent(_xmlNode *node, QString &s)
{
switch (node->type) {
......@@ -229,7 +229,7 @@ static void recursiveContent(_xmlNode *node, QString &s)
QString HtmlElement::recursiveContent() const
{
#ifdef HAVE_LIBXML2
#if HAVE_LIBXML2
if (!d) {
return {};
}
......@@ -244,7 +244,7 @@ QString HtmlElement::recursiveContent() const
QVariant HtmlElement::eval(const QString &xpath) const
{
#ifdef HAVE_LIBXML2
#if HAVE_LIBXML2
if (!d) {
return {};
}
......@@ -289,7 +289,7 @@ QVariant HtmlElement::eval(const QString &xpath) const
bool HtmlElement::hasAttribute(const QString& attr) const
{
#ifdef HAVE_LIBXML2
#if HAVE_LIBXML2
if (!d) {
return false;
}
......@@ -311,7 +311,7 @@ bool HtmlElement::hasAttribute(const QString& attr) const
QStringList HtmlElement::attributes() const
{
QStringList l;
#ifdef HAVE_LIBXML2
#if HAVE_LIBXML2
if (!d) {
return l;
}
......@@ -334,7 +334,7 @@ bool HtmlElement::operator==(const HtmlElement &other) const
HtmlElement HtmlDocument::root() const
{
#ifdef HAVE_LIBXML2
#if HAVE_LIBXML2
if (!d->m_doc) {
return {};
}
......@@ -351,7 +351,7 @@ QVariant HtmlDocument::eval(const QString &xpath) const
HtmlDocument* HtmlDocument::fromData(const QByteArray &data, QObject *parent)
{
#ifdef HAVE_LIBXML2
#if HAVE_LIBXML2
auto tree = htmlReadMemory(data.constData(), data.size(), nullptr, nullptr, HTML_PARSE_RECOVER | HTML_PARSE_NOERROR | HTML_PARSE_NOWARNING | HTML_PARSE_NOBLANKS | HTML_PARSE_NONET | HTML_PARSE_COMPACT);
if (!tree) {
return nullptr;
......@@ -369,7 +369,7 @@ HtmlDocument* HtmlDocument::fromData(const QByteArray &data, QObject *parent)
HtmlDocument* HtmlDocument::fromString(const QString &data, QObject *parent)
{
#ifdef HAVE_LIBXML2
#if HAVE_LIBXML2
const auto utf8Data = data.toUtf8();
auto tree = htmlReadMemory(utf8Data.constData(), utf8Data.size(), nullptr, "utf-8", HTML_PARSE_RECOVER | HTML_PARSE_NOERROR | HTML_PARSE_NOWARNING | HTML_PARSE_NOBLANKS | HTML_PARSE_NONET | HTML_PARSE_COMPACT);
if (!tree) {
......
......@@ -13,7 +13,7 @@
#include <KItinerary/ExtractorFilter>
#include <KItinerary/ExtractorResult>
#ifdef HAVE_KCAL
#if HAVE_KCAL
#include <KCalendarCore/ICalFormat>
#include <KCalendarCore/MemoryCalendar>
#endif
......@@ -52,7 +52,7 @@ bool IcalCalendarProcessor::canHandleData(const QByteArray &encodedData, QString
ExtractorDocumentNode IcalCalendarProcessor::createNodeFromData(const QByteArray &encodedData) const
{
#ifdef HAVE_KCAL
#if HAVE_KCAL
KCalendarCore::Calendar::Ptr calendar(new KCalendarCore::MemoryCalendar(QTimeZone::systemTimeZone()));
KCalendarCore::ICalFormat format;
if (format.fromRawString(calendar, encodedData)) {
......@@ -69,7 +69,7 @@ ExtractorDocumentNode IcalCalendarProcessor::createNodeFromData(const QByteArray
void IcalCalendarProcessor::expandNode(ExtractorDocumentNode &node, const ExtractorEngine *engine) const
{
#ifdef HAVE_KCAL
#if HAVE_KCAL
const auto cal = node.content<KCalendarCore::Calendar::Ptr>();
for (const auto &event : cal->events()) {
auto child = engine->documentNodeFactory()->createNode(QVariant::fromValue(event), u"internal/event");
......@@ -81,7 +81,7 @@ void IcalCalendarProcessor::expandNode(ExtractorDocumentNode &node, const Extrac
bool IcalEventProcessor::matches(const ExtractorFilter &filter, const ExtractorDocumentNode &node) const
{
#ifdef HAVE_KCAL
#if HAVE_KCAL
const auto event = node.content<KCalCore::Event::Ptr>();
return matchesGadget(filter, event.data());
#else
......@@ -91,7 +91,7 @@ bool IcalEventProcessor::matches(const ExtractorFilter &filter, const ExtractorD
void IcalEventProcessor::preExtract(ExtractorDocumentNode &node, [[maybe_unused]] const ExtractorEngine *engine) const
{
#ifdef HAVE_KCAL
#if HAVE_KCAL
const auto event = node.content<KCalCore::Event::Ptr>();
const auto data = event->customProperty("KITINERARY", "RESERVATION");
if (!data.isEmpty()) {
......@@ -102,7 +102,7 @@ void IcalEventProcessor::preExtract(ExtractorDocumentNode &node, [[maybe_unused]
QJSValue IcalEventProcessor::contentToScriptValue(const ExtractorDocumentNode &node, QJSEngine *engine) const
{
#ifdef HAVE_KCAL
#if HAVE_KCAL
return engine->toScriptValue(*node.content<KCalendarCore::Event::Ptr>().data());
#else
return {};
......
......@@ -5,7 +5,7 @@
*/
#include "qimagepurebinarizer.h"
#if defined(HAVE_ZXING) && !defined(ZXING_USE_READBARCODE)
#if HAVE_ZXING && !ZXING_USE_READBARCODE
#include <ZXing/BitArray.h>
......
......@@ -7,7 +7,7 @@
#pragma once
#include "config-kitinerary.h"
#if defined(HAVE_ZXING) && !defined(ZXING_USE_READBARCODE)
#if HAVE_ZXING && !ZXING_USE_READBARCODE
#include <QImage>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment