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
KDE PIM Runtime
Commits
22b78f5c
Commit
22b78f5c
authored
Sep 21, 2021
by
Laurent Montel
😁
Browse files
Port some foreach
parent
9f8120a1
Pipeline
#81988
failed with stage
in 25 minutes and 56 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
resources/imap/changecollectiontask.cpp
View file @
22b78f5c
...
...
@@ -116,7 +116,8 @@ void ChangeCollectionTask::doStart(KIMAP::Session *session)
QMap
<
QByteArray
,
QByteArray
>
annotations
=
annotationsAttribute
->
annotations
();
qCDebug
(
IMAPRESOURCE_LOG
)
<<
"All annotations: "
<<
annotations
;
foreach
(
const
QByteArray
&
entry
,
annotations
.
keys
())
{
// krazy:exclude=foreach
const
auto
annotationKeys
{
annotations
.
keys
()};
for
(
const
QByteArray
&
entry
:
annotationKeys
)
{
auto
job
=
new
KIMAP
::
SetMetaDataJob
(
session
);
if
(
serverCapabilities
().
contains
(
QLatin1String
(
"METADATA"
)))
{
job
->
setServerCapability
(
KIMAP
::
MetaDataJobBase
::
Metadata
);
...
...
resources/imap/messagehelper.cpp
View file @
22b78f5c
...
...
@@ -48,8 +48,8 @@ Akonadi::Item MessageHelper::createItemFromMessage(const KMime::Message::Ptr &me
i
.
setSize
(
size
);
Akonadi
::
MessageFlags
::
copyMessageFlags
(
*
message
,
i
);
for
each
(
const
QByteArray
&
flag
,
ResourceTask
::
toAkonadiFlags
(
flags
)
)
{
const
auto
flagsLst
=
ResourceTask
::
toAkonadiFlags
(
flags
);
for
(
const
QByteArray
&
flag
:
flagsLst
)
{
i
.
setFlag
(
flag
);
}
}
...
...
resources/imap/retrieveitemtask.cpp
View file @
22b78f5c
...
...
@@ -98,7 +98,8 @@ void RetrieveItemTask::onMessagesReceived(const QMap<qint64, KIMAP::Message> &me
}
i
.
setMimeType
(
remoteItem
.
mimeType
());
i
.
setPayload
(
remoteItem
.
payload
<
KMime
::
Message
::
Ptr
>
());
foreach
(
const
QByteArray
&
flag
,
remoteItem
.
flags
())
{
const
auto
flags
{
remoteItem
.
flags
()};
for
(
const
QByteArray
&
flag
:
flags
)
{
i
.
setFlag
(
flag
);
}
...
...
resources/kolab/autotests/imaptestbase.cpp
View file @
22b78f5c
...
...
@@ -66,7 +66,7 @@ QList<QByteArray> ImapTestBase::defaultPoolConnectionScenario(const QList<QByteA
QList
<
QByteArray
>
scenario
;
QByteArray
caps
=
"S: * CAPABILITY IMAP4 IMAP4rev1 UIDPLUS IDLE"
;
Q_FOREACH
(
const
QByteArray
&
cap
,
customCapabilities
)
{
for
(
const
QByteArray
&
cap
:
customCapabilities
)
{
caps
+=
" "
+
cap
;
}
...
...
@@ -105,7 +105,7 @@ Akonadi::Collection ImapTestBase::createCollectionChain(const QString &remoteId)
Akonadi
::
Collection
collection
=
parent
;
const
QStringList
collections
=
remoteId
.
split
(
separator
,
Qt
::
SkipEmptyParts
);
Q_FOREACH
(
const
QString
&
colId
,
collections
)
{
for
(
const
QString
&
colId
:
collections
)
{
collection
=
Akonadi
::
Collection
(
id
);
collection
.
setRemoteId
(
separator
+
colId
);
collection
.
setParentCollection
(
parent
);
...
...
resources/kolab/pimkolab/autotests/calendaringtest.cpp
View file @
22b78f5c
...
...
@@ -299,11 +299,11 @@ void CalendaringTest::testCalendar()
QFETCH
(
std
::
vector
<
Kolab
::
Event
>
,
expectedResult
);
Kolab
::
Calendaring
::
Calendar
cal
;
for
each
(
const
Kolab
::
Event
&
event
,
inputevents
)
{
for
(
const
Kolab
::
Event
&
event
:
std
::
as_const
(
inputevents
)
)
{
cal
.
addEvent
(
event
);
}
const
std
::
vector
<
Kolab
::
Event
>
result
=
cal
.
getEvents
(
start
,
end
,
true
);
for
each
(
const
Kolab
::
Event
&
event
,
result
)
{
for
(
const
Kolab
::
Event
&
event
:
result
)
{
qDebug
()
<<
QTest
::
toString
(
event
.
start
())
<<
QTest
::
toString
(
event
.
end
());
}
compareEvents
(
result
,
expectedResult
);
...
...
resources/kolab/pimkolab/autotests/kcalconversiontest.cpp
View file @
22b78f5c
...
...
@@ -559,7 +559,8 @@ void KCalConversionTest::testContactConversion()
QCOMPARE
(
e
.
formattedName
(),
kcal
.
formattedName
());
QCOMPARE
(
e
.
emails
(),
kcal
.
emails
());
QCOMPARE
(
e
.
preferredEmail
(),
kcal
.
preferredEmail
());
foreach
(
const
QString
&
mail
,
e
.
emails
())
{
const
auto
mails
{
e
.
emails
()};
for
(
const
QString
&
mail
:
mails
)
{
QCOMPARE
(
e
.
custom
(
QLatin1String
(
"KOLAB"
),
QString
::
fromLatin1
(
"EmailTypes%1"
).
arg
(
mail
)),
kcal
.
custom
(
QLatin1String
(
"KOLAB"
),
QString
::
fromLatin1
(
"EmailTypes%1"
).
arg
(
mail
)));
}
...
...
resources/kolab/pimkolab/conversion/kolabconversion.cpp
View file @
22b78f5c
...
...
@@ -84,7 +84,8 @@ KMime::Message::Ptr toNote(const Note &n)
note
.
setClassification
(
Akonadi
::
NoteUtils
::
NoteMessageWrapper
::
Public
);
}
foreach
(
const
Kolab
::
Attachment
&
a
,
n
.
attachments
())
{
const
auto
attachments
{
n
.
attachments
()};
for
(
const
Kolab
::
Attachment
&
a
:
attachments
)
{
if
(
!
a
.
uri
().
empty
())
{
Akonadi
::
NoteUtils
::
Attachment
attachment
(
QUrl
(
fromStdString
(
a
.
uri
())),
fromStdString
(
a
.
mimetype
()));
attachment
.
setLabel
(
fromStdString
(
a
.
label
()));
...
...
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