Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
PIM
Akonadi Contacts
Commits
e1a21557
Commit
e1a21557
authored
Mar 01, 2017
by
Laurent Montel
😁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Port last foreach
parent
7675441f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
8 deletions
+10
-8
src/standardcontactformatter.cpp
src/standardcontactformatter.cpp
+5
-4
src/standardcontactgroupformatter.cpp
src/standardcontactgroupformatter.cpp
+3
-2
tests/emailaddressselectiondialogtest.cpp
tests/emailaddressselectiondialogtest.cpp
+1
-1
tests/emailaddressselectionwidgettest.cpp
tests/emailaddressselectionwidgettest.cpp
+1
-1
No files found.
src/standardcontactformatter.cpp
View file @
e1a21557
...
...
@@ -121,7 +121,8 @@ QString StandardContactFormatter::toHtml(HtmlForm form) const
// Phone Numbers
int
counter
=
0
;
foreach
(
const
KContacts
::
PhoneNumber
&
number
,
rawContact
.
phoneNumbers
())
{
for
(
const
KContacts
::
PhoneNumber
&
number
:
rawContact
.
phoneNumbers
())
{
QString
dispLabel
=
number
.
typeLabel
().
replace
(
QLatin1Char
(
' '
),
QStringLiteral
(
" "
));
QString
dispValue
=
QStringLiteral
(
"<a href=
\"
phone:?index=%1
\"
>%2</a>"
).
arg
(
counter
).
arg
(
number
.
number
().
toHtmlEscaped
());
...
...
@@ -143,7 +144,7 @@ QString StandardContactFormatter::toHtml(HtmlForm form) const
}
// EMails
for
each
(
const
QString
&
email
,
rawContact
.
emails
())
{
for
(
const
QString
&
email
:
rawContact
.
emails
())
{
const
QString
type
=
i18nc
(
"a contact's email address"
,
"Email"
);
const
QString
fullEmail
=
QString
::
fromLatin1
(
QUrl
::
toPercentEncoding
(
rawContact
.
fullEmail
(
email
)));
...
...
@@ -172,7 +173,7 @@ QString StandardContactFormatter::toHtml(HtmlForm form) const
// Addresses
counter
=
0
;
for
each
(
const
KContacts
::
Address
&
address
,
rawContact
.
addresses
())
{
for
(
const
KContacts
::
Address
&
address
:
rawContact
.
addresses
())
{
QString
formattedAddress
;
if
(
address
.
label
().
isEmpty
())
{
...
...
@@ -254,7 +255,7 @@ QString StandardContactFormatter::toHtml(HtmlForm form) const
key
=
keyIt
.
value
();
}
else
{
// check whether it is a custom local field
for
each
(
const
QVariantMap
&
description
,
customFieldDescriptions
())
{
for
(
const
QVariantMap
&
description
:
customFieldDescriptions
())
{
if
(
description
.
value
(
QStringLiteral
(
"key"
)).
toString
()
==
key
)
{
key
=
description
.
value
(
QStringLiteral
(
"title"
)).
toString
();
const
QString
descriptionType
=
description
.
value
(
QStringLiteral
(
"type"
)).
toString
();
...
...
src/standardcontactgroupformatter.cpp
View file @
e1a21557
...
...
@@ -59,7 +59,8 @@ QString StandardContactGroupFormatter::toHtml(HtmlForm form) const
ContactGroupExpandJob
*
job
=
new
ContactGroupExpandJob
(
group
);
if
(
job
->
exec
())
{
group
.
removeAllContactData
();
foreach
(
const
KContacts
::
Addressee
&
contact
,
job
->
contacts
())
{
const
KContacts
::
Addressee
::
List
listContact
=
job
->
contacts
();
for
(
const
KContacts
::
Addressee
&
contact
:
listContact
)
{
group
.
append
(
KContacts
::
ContactGroup
::
Data
(
contact
.
realName
(),
contact
.
preferredEmail
()));
}
}
...
...
@@ -101,7 +102,7 @@ QString StandardContactGroupFormatter::toHtml(HtmlForm form) const
}
}
for
each
(
const
QVariantMap
&
map
,
additionalFields
())
{
for
(
const
QVariantMap
&
map
:
additionalFields
())
{
strGroup
.
append
(
QStringLiteral
(
"<tr><td colspan=
\"
2
\"
> </td></tr><tr><td align=
\"
right
\"
width=
\"
30%
\"
><b><font color=
\"
grey
\"
>%1</font></b></td>"
"<td valign=
\"
bottom
\"
align=
\"
left
\"
width=
\"
50%
\"
><font>%2</font></td></tr>"
)
.
arg
(
map
.
value
(
QStringLiteral
(
"title"
)).
toString
())
...
...
tests/emailaddressselectiondialogtest.cpp
View file @
e1a21557
...
...
@@ -34,7 +34,7 @@ int main(int argc, char **argv)
Akonadi
::
EmailAddressSelectionDialog
dlg
;
if
(
dlg
.
exec
())
{
for
each
(
const
Akonadi
::
EmailAddressSelection
&
selection
,
dlg
.
selectedAddresses
())
{
for
(
const
Akonadi
::
EmailAddressSelection
&
selection
:
dlg
.
selectedAddresses
())
{
qDebug
(
"%s: %s"
,
qPrintable
(
selection
.
name
()),
qPrintable
(
selection
.
email
()));
}
}
...
...
tests/emailaddressselectionwidgettest.cpp
View file @
e1a21557
...
...
@@ -62,7 +62,7 @@ void MainWidget::showSelection()
mInfo
->
append
(
QStringLiteral
(
"===========================
\n
"
));
mInfo
->
append
(
QStringLiteral
(
"Current selection:
\n
"
));
for
each
(
const
Akonadi
::
EmailAddressSelection
&
selection
,
mAddressesWidget
->
selectedAddresses
())
{
for
(
const
Akonadi
::
EmailAddressSelection
&
selection
:
mAddressesWidget
->
selectedAddresses
())
{
mInfo
->
append
(
QStringLiteral
(
"%1: %2
\n
"
).
arg
(
selection
.
name
()).
arg
(
selection
.
email
()));
}
}
...
...
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