Commit cfb1e5cb authored by Volker Krause's avatar Volker Krause

Show the full country name

parent 448047d1
......@@ -21,8 +21,9 @@ ecm_setup_version(PROJECT VARIABLE_PREFIX ITINERARY VERSION_HEADER itinerary_ver
# build-time dependencies
find_package(Qt5 REQUIRED COMPONENTS Test Quick)
find_package(KF5 REQUIRED COMPONENTS I18n)
find_package(KPimPkPass REQUIRED)
find_package(KPimItinerary REQUIRED)
find_package(KF5Contacts CONFIG REQUIRED)
find_package(KPimPkPass CONFIG REQUIRED)
find_package(KPimItinerary CONFIG REQUIRED)
find_package(QmlLint)
set_package_properties(QmlLint PROPERTIES URL "https://qt.io" PURPOSE "Validate QML code.")
find_package(SharedMimeInfo 1.0 REQUIRED)
......@@ -34,7 +35,6 @@ ecm_find_qmlmodule(org.kde.prison 1.0)
if (ANDROID)
find_package(Qt5 REQUIRED COMPONENTS AndroidExtras Svg)
find_package(KF5 REQUIRED COMPONENTS Archive Kirigami2 Prison)
find_package(GammaRay)
if (NOT DEFINED BREEZEICONS_DIR AND EXISTS ${CMAKE_SOURCE_DIR}/../breeze-icons)
set(BREEZEICONS_DIR ${CMAKE_SOURCE_DIR}/../breeze-icons)
endif()
......
......@@ -28,6 +28,7 @@ target_include_directories(itinerary-app PRIVATE ${CMAKE_BINARY_DIR})
target_link_libraries(itinerary-app PRIVATE
itinerary
Qt5::Quick
KF5::Contacts
)
if (ANDROID)
# explicitly add runtime dependencies and transitive link dependencies,
......
......@@ -43,7 +43,7 @@ Kirigami.AbstractCard {
anchors.margins: Kirigami.Units.largeSpacing
QQC2.Label {
text: qsTr("⚠ Entering %1").arg(countryInfo.isoCode) // TODO human readable country name
text: qsTr("⚠ Entering %1").arg(Localizer.countryName(countryInfo.isoCode))
color: Kirigami.Theme.negativeTextColor
}
}
......
......@@ -19,6 +19,8 @@
#include <KItinerary/JsonLdDocument>
#include <KContacts/Address>
#include <QDateTime>
#include <QLocale>
#include <QTimeZone>
......@@ -32,6 +34,11 @@ Localizer::Localizer(QObject *parent)
Localizer::~Localizer() = default;
QString Localizer::countryName(const QString& isoCode) const
{
return KContacts::Address::ISOtoCountry(isoCode);
}
static bool needsTimeZone(const QDateTime &dt)
{
if (dt.timeSpec() == Qt::TimeZone && dt.timeZone().abbreviation(dt) != QTimeZone::systemTimeZone().abbreviation(dt)) {
......
......@@ -33,6 +33,7 @@ public:
explicit Localizer(QObject *parent = nullptr);
~Localizer();
Q_INVOKABLE QString countryName(const QString &isoCode) const;
Q_INVOKABLE QString formatTime(const QVariant &obj, const QString &propertyName) const;
Q_INVOKABLE QString formatDateTime(const QVariant &obj, const QString &propertyName) const;
};
......
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