Commit 8a3f420d authored by Volker Krause's avatar Volker Krause
Browse files

Use the new KContacts address formatting API properly

This also restores compatibility with KF 5.91, which is the minimum
required version for the stable branch still.
parent 44beb5a2
Pipeline #151838 skipped
......@@ -8,6 +8,7 @@
#include <KContacts/Address>
#include <KItinerary/Place>
#include <kcontacts_version.h>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <grantlee/exception.h>
......@@ -37,7 +38,11 @@ QVariant AddressFormatter::doFilter(const QVariant &input, const QVariant &arg,
address.setRegion(a.addressRegion());
address.setCountry(a.addressCountry());
auto s = escape(address.formatted(KContacts::AddressFormatStyle::Postal).trimmed().replace(QLatin1String("\n\n"), QLatin1String("\n")));
#if KContacts_VERSION < QT_VERSION_CHECK(5, 92, 0)
auto s = escape(address.formattedAddress().trimmed().replace(QLatin1String("\n\n"), QLatin1String("\n")));
#else
auto s = escape(address.formatted(KContacts::AddressFormatStyle::MultiLineInternational));
#endif
return s.get().replace(QLatin1Char('\n'), QLatin1String("<br/>"));
}
......
Markdown is supported
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