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
PimCommon
Commits
ffbfdaf4
Verified
Commit
ffbfdaf4
authored
Oct 24, 2021
by
Marco Rebhan
Browse files
Replace use of removed insertEmail with addEmail
(see KContacts commit 779da83bcfa42ddc55a17a039e2d9ae9370266d0)
parent
06ae9ac5
Pipeline
#91063
passed with stage
in 9 minutes and 26 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/pimcommonakonadi/addressline/addresslineedit/addresseelineedit.cpp
View file @
ffbfdaf4
...
...
@@ -20,6 +20,7 @@
#include
<KLDAP/LdapClientSearch>
#include
<KContacts/VCardConverter>
#include
<kcontacts_version.h>
#include
<Akonadi/Job>
#include
<KConfigGroup>
...
...
@@ -298,7 +299,13 @@ void AddresseeLineEdit::dropEvent(QDropEvent *event)
// email-address.
if
(
url
.
scheme
()
==
QLatin1String
(
"mailto"
))
{
KContacts
::
Addressee
addressee
;
#if KContacts_VERSION < QT_VERSION_CHECK(5, 88, 0)
addressee
.
insertEmail
(
KEmailAddress
::
decodeMailtoUrl
(
url
),
true
/* preferred */
);
#else
KContacts
::
Email
email
(
KEmailAddress
::
decodeMailtoUrl
(
url
));
email
.
setPreferred
(
true
);
addressee
.
addEmail
(
email
);
#endif
list
+=
addressee
;
}
else
{
// Otherwise, download the vCard to which the Url points
KContacts
::
VCardConverter
converter
;
...
...
@@ -380,7 +387,13 @@ void AddresseeLineEdit::dropEvent(QDropEvent *event)
QUrl
url
(
dropData
);
if
(
url
.
scheme
()
==
QLatin1String
(
"mailto"
))
{
KContacts
::
Addressee
addressee
;
#if KContacts_VERSION < QT_VERSION_CHECK(5, 88, 0)
addressee
.
insertEmail
(
KEmailAddress
::
decodeMailtoUrl
(
url
),
true
/* preferred */
);
#else
KContacts
::
Email
email
(
KEmailAddress
::
decodeMailtoUrl
(
url
));
email
.
setPreferred
(
true
);
addressee
.
addEmail
(
email
);
#endif
insertEmails
(
addressee
.
emails
());
}
else
{
setText
(
KEmailAddress
::
normalizeAddressesAndDecodeIdn
(
dropData
));
...
...
@@ -622,7 +635,7 @@ void AddresseeLineEdit::loadContacts()
const
QStringList
recent
=
AddresseeLineEditManager
::
self
()
->
cleanupRecentAddressEmailList
(
PimCommon
::
RecentAddresses
::
self
(
recentAddressConfig
())
->
addresses
());
QString
name
;
QString
email
;
QString
email
String
;
KSharedConfig
::
Ptr
config
=
KSharedConfig
::
openConfig
(
QStringLiteral
(
"kpimcompletionorder"
));
KConfigGroup
group
(
config
,
"CompletionWeights"
);
...
...
@@ -632,8 +645,8 @@ void AddresseeLineEdit::loadContacts()
for
(
const
QString
&
recentAdr
:
recent
)
{
KContacts
::
Addressee
addr
;
KEmailAddress
::
extractEmailAddressAndName
(
recentAdr
,
email
,
name
);
if
(
email
.
isEmpty
())
{
KEmailAddress
::
extractEmailAddressAndName
(
recentAdr
,
email
String
,
name
);
if
(
email
String
.
isEmpty
())
{
continue
;
}
name
=
KEmailAddress
::
quoteNameIfNecessary
(
name
);
...
...
@@ -642,8 +655,14 @@ void AddresseeLineEdit::loadContacts()
name
.
chop
(
1
);
}
addr
.
setNameFromString
(
name
);
addr
.
insertEmail
(
email
,
true
);
addContact
({
email
},
addr
,
weight
,
idx
);
#if KContacts_VERSION < QT_VERSION_CHECK(5, 88, 0)
addr
.
insertEmail
(
emailString
,
true
);
#else
KContacts
::
Email
email
(
emailString
);
email
.
setPreferred
(
true
);
addr
.
addEmail
(
email
);
#endif
addContact
({
emailString
},
addr
,
weight
,
idx
);
}
}
else
{
removeCompletionSource
(
recentAddressGroupName
);
...
...
src/pimcommonakonadi/addressline/recentaddress/recentaddresses.cpp
View file @
ffbfdaf4
...
...
@@ -13,6 +13,7 @@
#include
<KEmailAddress>
#include
<KSharedConfig>
#include
<QCoreApplication>
#include
<kcontacts_version.h>
using
namespace
PimCommon
;
...
...
@@ -54,18 +55,24 @@ RecentAddresses::~RecentAddresses()
void
RecentAddresses
::
load
(
KConfig
*
config
)
{
QString
name
;
QString
email
;
QString
email
String
;
m_addresseeList
.
clear
();
KConfigGroup
cg
(
config
,
"General"
);
m_maxCount
=
cg
.
readEntry
(
"Maximum Recent Addresses"
,
200
);
const
QStringList
addresses
=
cg
.
readEntry
(
"Recent Addresses"
,
QStringList
());
for
(
const
QString
&
address
:
addresses
)
{
KContacts
::
Addressee
::
parseEmailAddress
(
address
,
name
,
email
);
if
(
!
email
.
isEmpty
())
{
KContacts
::
Addressee
::
parseEmailAddress
(
address
,
name
,
email
String
);
if
(
!
email
String
.
isEmpty
())
{
KContacts
::
Addressee
addr
;
addr
.
setNameFromString
(
name
);
addr
.
insertEmail
(
email
,
true
);
#if KContacts_VERSION < QT_VERSION_CHECK(5, 88, 0)
addr
.
insertEmail
(
emailString
,
true
);
#else
KContacts
::
Email
email
(
emailString
);
email
.
setPreferred
(
true
);
addr
.
addEmail
(
email
);
#endif
m_addresseeList
.
append
(
addr
);
}
}
...
...
@@ -88,22 +95,28 @@ void RecentAddresses::add(const QString &entry)
if
(
errorCode
!=
KEmailAddress
::
AddressOk
)
{
continue
;
}
QString
email
;
QString
email
String
;
QString
fullName
;
KContacts
::
Addressee
addr
;
KContacts
::
Addressee
::
parseEmailAddress
(
str
,
fullName
,
email
);
KContacts
::
Addressee
::
parseEmailAddress
(
str
,
fullName
,
email
String
);
KContacts
::
Addressee
::
List
::
Iterator
end
(
m_addresseeList
.
end
());
for
(
KContacts
::
Addressee
::
List
::
Iterator
it
=
m_addresseeList
.
begin
();
it
!=
end
;
++
it
)
{
if
(
email
==
(
*
it
).
preferredEmail
())
{
if
(
email
String
==
(
*
it
).
preferredEmail
())
{
// already inside, remove it here and add it later at pos==1
m_addresseeList
.
erase
(
it
);
break
;
}
}
addr
.
setNameFromString
(
fullName
);
addr
.
insertEmail
(
email
,
true
);
#if KContacts_VERSION < QT_VERSION_CHECK(5, 88, 0)
addr
.
insertEmail
(
emailString
,
true
);
#else
KContacts
::
Email
email
(
emailString
);
email
.
setPreferred
(
true
);
addr
.
addEmail
(
email
);
#endif
m_addresseeList
.
prepend
(
addr
);
adjustSize
();
}
...
...
src/pimcommonakonadi/ldap/ldapsearchdialog.cpp
View file @
ffbfdaf4
...
...
@@ -15,6 +15,7 @@
#include
<KLDAP/LdapSearchClientReadConfigServerJob>
#include
<Libkdepim/LineEditCatchReturnKey>
#include
<Libkdepim/ProgressIndicatorLabel>
#include
<kcontacts_version.h>
#include
<QApplication>
#include
<QCheckBox>
...
...
@@ -161,7 +162,13 @@ static KContacts::Addressee convertLdapAttributesToAddressee(const KLDAP::LdapAt
KLDAP
::
LdapAttrValue
::
ConstIterator
it
=
lst
.
constBegin
();
bool
pref
=
true
;
while
(
it
!=
lst
.
constEnd
())
{
#if KContacts_VERSION < QT_VERSION_CHECK(5, 88, 0)
addr
.
insertEmail
(
asUtf8
(
*
it
),
pref
);
#else
KContacts
::
Email
email
(
asUtf8
(
*
it
));
email
.
setPreferred
(
pref
);
addr
.
addEmail
(
email
);
#endif
pref
=
false
;
++
it
;
}
...
...
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