Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
Akonadi Contacts
Commits
2af01e5c
Commit
2af01e5c
authored
Oct 25, 2021
by
Volker Krause
Browse files
Port KContacts::Address::countryToISO to new KI18n API
This function in KContacts is about to be deprecated.
parent
7c822b1a
Pipeline
#91389
passed with stage
in 10 minutes and 43 seconds
Changes
2
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
src/akonadi-contacts/CMakeLists.txt
View file @
2af01e5c
...
...
@@ -175,6 +175,9 @@ target_link_libraries(KF5AkonadiContact
KF5::Prison
Grantlee5::Templates
)
if
(
TARGET KF5::I18nLocaleData
)
target_link_libraries
(
KF5AkonadiContact PRIVATE KF5::I18nLocaleData
)
endif
()
if
(
TARGET KF5::Libkleo
)
target_link_libraries
(
KF5AkonadiContact
...
...
src/akonadi-contacts/actions/showaddressaction.cpp
View file @
2af01e5c
...
...
@@ -13,6 +13,10 @@
#include
<KContacts/Address>
#include
<KDialogJobUiDelegate>
#include
<KIO/CommandLauncherJob>
#include
<ki18n_version.h>
#if KI18N_VERSION >= QT_VERSION_CHECK(5, 88, 0)
#include
<KCountry>
#endif
#include
<QDesktopServices>
...
...
@@ -20,12 +24,22 @@ using namespace Akonadi;
static
void
replaceArguments
(
QString
&
templateStr
,
const
KContacts
::
Address
&
address
)
{
#if KI18N_VERSION >= QT_VERSION_CHECK(5, 88, 0)
const
auto
country
=
KCountry
::
fromName
(
address
.
country
());
// will also handle ISO 3166-1 alpha 2 or 3 codes
templateStr
.
replace
(
QLatin1String
(
"%s"
),
address
.
street
())
.
replace
(
QLatin1String
(
"%r"
),
address
.
region
())
.
replace
(
QLatin1String
(
"%l"
),
address
.
locality
())
.
replace
(
QLatin1String
(
"%z"
),
address
.
postalCode
())
.
replace
(
QLatin1String
(
"%n"
),
country
.
name
())
.
replace
(
QLatin1String
(
"%c"
),
country
.
alpha2
());
#else
templateStr
.
replace
(
QLatin1String
(
"%s"
),
address
.
street
())
.
replace
(
QLatin1String
(
"%r"
),
address
.
region
())
.
replace
(
QLatin1String
(
"%l"
),
address
.
locality
())
.
replace
(
QLatin1String
(
"%z"
),
address
.
postalCode
())
.
replace
(
QLatin1String
(
"%n"
),
address
.
country
())
.
replace
(
QLatin1String
(
"%c"
),
address
.
countryToISO
(
address
.
country
()));
#endif
}
void
ShowAddressAction
::
showAddress
(
const
KContacts
::
Address
&
address
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment