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
e88d3437
Commit
e88d3437
authored
Oct 24, 2021
by
Laurent Montel
😁
Browse files
Add check version. We depend against 5.87
parent
bcb55478
Pipeline
#91004
passed with stage
in 11 minutes and 12 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/akonadi-contacts/autotests/grantleeprinttest.cpp
View file @
e88d3437
...
...
@@ -7,6 +7,7 @@
#include
"grantleeprinttest.h"
#include
"grantlee/grantleeprint.h"
#include
<QTest>
#include
<kcontacts_version.h>
GrantleePrintTest
::
GrantleePrintTest
(
QObject
*
parent
)
:
QObject
(
parent
)
...
...
@@ -39,9 +40,13 @@ 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"
));
...
...
@@ -53,9 +58,13 @@ 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 %}"
));
...
...
@@ -97,9 +106,13 @@ 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 @
e88d3437
...
...
@@ -18,6 +18,7 @@
#include
<Akonadi/Item>
#include
<KColorScheme>
#include
<kcontacts_version.h>
using
namespace
KAddressBookGrantlee
;
...
...
@@ -94,9 +95,12 @@ 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 @
e88d3437
...
...
@@ -26,6 +26,7 @@
#include
<KMessageBox>
#include
<QPointer>
#include
<kcontacts_version.h>
using
namespace
Akonadi
;
...
...
@@ -182,10 +183,13 @@ 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 @
e88d3437
...
...
@@ -26,7 +26,7 @@
#include
<KMessageBox>
#include
<QPointer>
#include
<kcontacts_version.h>
using
namespace
Akonadi
;
class
Akonadi
::
AddEmailDisplayJobPrivate
...
...
@@ -223,9 +223,13 @@ 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 @
e88d3437
...
...
@@ -12,7 +12,7 @@
#include
<Akonadi/ItemFetchJob>
#include
<Akonadi/ItemFetchScope>
#include
<Akonadi/ItemSearchJob>
#include
<kcontacts_version.h>
using
namespace
Akonadi
;
class
Akonadi
::
ContactGroupExpandJobPrivate
...
...
@@ -37,10 +37,13 @@ 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
);
}
...
...
@@ -100,12 +103,17 @@ 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 @
e88d3437
...
...
@@ -12,7 +12,7 @@
#include
<Akonadi/Item>
#include
<KColorScheme>
#include
<KContacts/Addressee>
#include
<kcontacts_version.h>
using
namespace
Akonadi
;
class
Akonadi
::
StandardContactGroupFormatterPrivate
...
...
@@ -80,9 +80,12 @@ 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
());
...
...
Laurent Montel
😁
@mlaurent
mentioned in merge request
pimcommon!9 (merged)
·
Oct 24, 2021
mentioned in merge request
pimcommon!9 (merged)
mentioned in merge request pimcommon!9
Toggle commit list
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