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
a867645b
Commit
a867645b
authored
Jan 12, 2022
by
Laurent Montel
😁
Browse files
We depend against kf5.90
parent
823dbfd3
Pipeline
#122383
passed with stage
in 2 minutes and 37 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/akonadi-contacts/actions/showaddressaction.cpp
View file @
a867645b
...
...
@@ -13,10 +13,7 @@
#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>
...
...
@@ -24,7 +21,6 @@ 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
())
...
...
@@ -32,14 +28,6 @@ static void replaceArguments(QString &templateStr, const KContacts::Address &add
.
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
)
...
...
src/akonadi-contacts/autotests/grantleeprinttest.cpp
View file @
a867645b
...
...
@@ -7,7 +7,6 @@
#include "grantleeprinttest.h"
#include "grantlee/grantleeprint.h"
#include <QTest>
#include <kcontacts_version.h>
GrantleePrintTest
::
GrantleePrintTest
(
QObject
*
parent
)
:
QObject
(
parent
)
...
...
@@ -38,13 +37,9 @@ void GrantleePrintTest::shouldReturnStringWhenAddContentAndContacts()
KContacts
::
Addressee
::
List
lst
;
KContacts
::
Addressee
address
;
address
.
setName
(
QStringLiteral
(
"foo1"
));
#if KContacts_VERSION < QT_VERSION_CHECK(5, 88, 0)
address
.
insertEmail
(
QStringLiteral
(
"foo@kde.org"
),
true
);
#else
KContacts
::
Email
email
(
QStringLiteral
(
"foo@kde.org"
));
email
.
setPreferred
(
true
);
address
.
addEmail
(
email
);
#endif
lst
<<
address
;
QCOMPARE
(
grantleePrint
.
contactsToHtml
(
lst
),
QStringLiteral
(
"foo"
));
...
...
@@ -56,13 +51,9 @@ void GrantleePrintTest::shouldReturnEmails()
KContacts
::
Addressee
::
List
lst
;
KContacts
::
Addressee
address
;
address
.
setName
(
QStringLiteral
(
"foo1"
));
#if KContacts_VERSION < QT_VERSION_CHECK(5, 88, 0)
address
.
insertEmail
(
QStringLiteral
(
"foo@kde.org"
),
true
);
#else
KContacts
::
Email
email
(
QStringLiteral
(
"foo@kde.org"
));
email
.
setPreferred
(
true
);
address
.
addEmail
(
email
);
#endif
lst
<<
address
;
grantleePrint
.
setTemplateContent
(
QStringLiteral
(
"{% if contacts %}{% for contact in contacts %}{% if contact.name %}{{ contact.name }}{% endif %}{% endfor %}{% endif %}"
));
...
...
@@ -104,13 +95,9 @@ void GrantleePrintTest::shouldDisplayContactInfo()
address
.
setGivenName
(
QStringLiteral
(
"foo-givenname"
));
address
.
setAdditionalName
(
QStringLiteral
(
"foo-additionalname"
));
address
.
setName
(
QStringLiteral
(
"foo1"
));
#if KContacts_VERSION < QT_VERSION_CHECK(5, 88, 0)
address
.
insertEmail
(
QStringLiteral
(
"foo@kde.org"
),
true
);
#else
KContacts
::
Email
email
(
QStringLiteral
(
"foo@kde.org"
));
email
.
setPreferred
(
true
);
address
.
addEmail
(
email
);
#endif
address
.
setOrganization
(
QStringLiteral
(
"kde"
));
address
.
insertLang
(
KContacts
::
Lang
(
QStringLiteral
(
"fr"
)));
address
.
setNote
(
QStringLiteral
(
"foo-note"
));
...
...
src/akonadi-contacts/grantlee/grantleecontactgroupformatter.cpp
View file @
a867645b
...
...
@@ -18,7 +18,6 @@
#include <Akonadi/Item>
#include <KColorScheme>
#include <kcontacts_version.h>
using
namespace
KAddressBookGrantlee
;
...
...
@@ -95,12 +94,8 @@ static QVariantHash memberHash(const KContacts::ContactGroup::Data &data)
KContacts
::
Addressee
contact
;
contact
.
setFormattedName
(
data
.
name
());
#if KContacts_VERSION < QT_VERSION_CHECK(5, 88, 0)
contact
.
insertEmail
(
data
.
email
());
#else
KContacts
::
Email
email
(
data
.
email
());
contact
.
addEmail
(
email
);
#endif
const
QString
emailLink
=
QStringLiteral
(
"<a href=
\"
mailto:"
)
+
QString
::
fromLatin1
(
QUrl
::
toPercentEncoding
(
contact
.
fullEmail
()))
+
QStringLiteral
(
"
\"
>%1</a>"
).
arg
(
contact
.
preferredEmail
());
...
...
src/akonadi-contacts/job/addemailaddressjob.cpp
View file @
a867645b
...
...
@@ -26,7 +26,6 @@
#include <KMessageBox>
#include <QPointer>
#include <kcontacts_version.h>
using
namespace
Akonadi
;
...
...
@@ -185,13 +184,9 @@ public:
}
KContacts
::
Addressee
contact
;
contact
.
setNameFromString
(
mName
);
#if KContacts_VERSION < QT_VERSION_CHECK(5, 88, 0)
contact
.
insertEmail
(
mEmail
,
true
);
#else
KContacts
::
Email
email
(
mEmail
);
email
.
setPreferred
(
true
);
contact
.
addEmail
(
email
);
#endif
// create the new item
Akonadi
::
Item
item
;
item
.
setMimeType
(
KContacts
::
Addressee
::
mimeType
());
...
...
src/akonadi-contacts/job/addemaildisplayjob.cpp
View file @
a867645b
...
...
@@ -25,7 +25,6 @@
#include <KMessageBox>
#include <QPointer>
#include <kcontacts_version.h>
using
namespace
Akonadi
;
class
Akonadi
::
AddEmailDisplayJobPrivate
...
...
@@ -224,13 +223,9 @@ public:
}
KContacts
::
Addressee
contact
;
contact
.
setNameFromString
(
mName
);
#if KContacts_VERSION < QT_VERSION_CHECK(5, 88, 0)
contact
.
insertEmail
(
mEmail
,
true
);
#else
KContacts
::
Email
email
(
mEmail
);
email
.
setPreferred
(
true
);
contact
.
addEmail
(
email
);
#endif
contact
.
insertCustom
(
QStringLiteral
(
"KADDRESSBOOK"
),
QStringLiteral
(
"MailPreferedFormatting"
),
mShowAsHTML
?
QStringLiteral
(
"HTML"
)
:
QStringLiteral
(
"TEXT"
));
...
...
src/akonadi-contacts/job/contactgroupexpandjob.cpp
View file @
a867645b
...
...
@@ -12,7 +12,6 @@
#include <Akonadi/ItemFetchJob>
#include <Akonadi/ItemFetchScope>
#include <Akonadi/ItemSearchJob>
#include <kcontacts_version.h>
using
namespace
Akonadi
;
class
Akonadi
::
ContactGroupExpandJobPrivate
...
...
@@ -37,13 +36,9 @@ public:
KContacts
::
Addressee
contact
;
contact
.
setNameFromString
(
data
.
name
());
#if KContacts_VERSION < QT_VERSION_CHECK(5, 88, 0)
contact
.
insertEmail
(
data
.
email
(),
true
);
#else
KContacts
::
Email
email
(
data
.
email
());
email
.
setPreferred
(
true
);
contact
.
addEmail
(
email
);
#endif
mContacts
.
append
(
contact
);
}
...
...
@@ -103,17 +98,11 @@ public:
const
Item
item
=
items
.
first
();
if
(
item
.
hasPayload
<
KContacts
::
Addressee
>
())
{
auto
contact
=
item
.
payload
<
KContacts
::
Addressee
>
();
#if KContacts_VERSION < QT_VERSION_CHECK(5, 88, 0)
if
(
!
preferredEmail
.
isEmpty
())
{
contact
.
insertEmail
(
preferredEmail
,
true
);
}
#else
if
(
!
preferredEmail
.
isEmpty
())
{
KContacts
::
Email
email
(
preferredEmail
);
email
.
setPreferred
(
true
);
contact
.
addEmail
(
email
);
}
#endif
mContacts
.
append
(
contact
);
}
else
{
qCWarning
(
AKONADICONTACT_LOG
)
<<
"Contact for Akonadi item"
<<
item
.
id
()
<<
"does not exist anymore!"
;
...
...
src/akonadi-contacts/standardcontactgroupformatter.cpp
View file @
a867645b
...
...
@@ -12,7 +12,6 @@
#include <Akonadi/Item>
#include <KColorScheme>
#include <KContacts/Addressee>
#include <kcontacts_version.h>
using
namespace
Akonadi
;
class
Akonadi
::
StandardContactGroupFormatterPrivate
...
...
@@ -78,12 +77,8 @@ QString StandardContactGroupFormatter::toHtml(HtmlForm form) const
}
else
{
KContacts
::
Addressee
contact
;
contact
.
setFormattedName
(
data
.
name
());
#if KContacts_VERSION < QT_VERSION_CHECK(5, 88, 0)
contact
.
insertEmail
(
data
.
email
());
#else
KContacts
::
Email
email
(
data
.
email
());
contact
.
addEmail
(
email
);
#endif
const
QString
fullEmail
=
QLatin1String
(
"<a href=
\"
mailto:"
)
+
QString
::
fromLatin1
(
QUrl
::
toPercentEncoding
(
contact
.
fullEmail
()))
+
QStringLiteral
(
"
\"
>%1</a>"
).
arg
(
contact
.
preferredEmail
());
...
...
Write
Preview
Markdown
is supported
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