Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
PIM Messagelib
Commits
53e34da7
Commit
53e34da7
authored
Feb 07, 2017
by
Laurent Montel
Browse files
Port to for(...:...)
parent
22ba9df9
Changes
8
Hide whitespace changes
Inline
Side-by-side
messagecomposer/src/attachment/attachmentmodel.cpp
View file @
53e34da7
...
...
@@ -142,7 +142,7 @@ QMimeData *AttachmentModel::mimeData(const QModelIndexList &indexes) const
{
qCDebug
(
MESSAGECOMPOSER_LOG
);
QList
<
QUrl
>
urls
;
for
each
(
const
QModelIndex
&
index
,
indexes
)
{
for
(
const
QModelIndex
&
index
:
indexes
)
{
if
(
index
.
column
()
!=
0
)
{
// Avoid processing the same attachment more than once, since the entire
// row is selected.
...
...
messagecomposer/src/helper/helper_p.h
0 → 100644
View file @
53e34da7
/*
Copyright (c) 2017 Laurent Montel <montel@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#ifndef _HELPER_H
#define _HELPER_H
#include
<qglobal.h>
#if QT_VERSION < QT_VERSION_CHECK(5,7,0)
namespace
QtPrivate
{
template
<
typename
T
>
struct
QAddConst
{
typedef
const
T
Type
;
};
}
// this adds const to non-const objects (like std::as_const)
template
<
typename
T
>
Q_DECL_CONSTEXPR
typename
QtPrivate
::
QAddConst
<
T
>::
Type
&
qAsConst
(
T
&
t
)
Q_DECL_NOTHROW
{
return
t
;
}
// prevent rvalue arguments:
template
<
typename
T
>
void
qAsConst
(
const
T
&&
)
Q_DECL_EQ_DELETE
;
#endif
#endif
messagecomposer/src/helper/messagehelper.cpp
View file @
53e34da7
...
...
@@ -90,7 +90,7 @@ void applyIdentity(const KMime::Message::Ptr &message, const KIdentityManagement
message
->
removeHeader
<
KMime
::
Headers
::
Bcc
>
();
}
else
{
const
auto
mailboxes
=
KMime
::
Types
::
Mailbox
::
listFromUnicodeString
(
ident
.
bcc
());
for
each
(
const
KMime
::
Types
::
Mailbox
&
mailbox
,
mailboxes
)
{
for
(
const
KMime
::
Types
::
Mailbox
&
mailbox
:
mailboxes
)
{
message
->
bcc
()
->
addAddress
(
mailbox
);
}
}
...
...
@@ -99,7 +99,7 @@ void applyIdentity(const KMime::Message::Ptr &message, const KIdentityManagement
message
->
removeHeader
<
KMime
::
Headers
::
Cc
>
();
}
else
{
const
auto
mailboxes
=
KMime
::
Types
::
Mailbox
::
listFromUnicodeString
(
ident
.
cc
());
for
each
(
const
KMime
::
Types
::
Mailbox
&
mailbox
,
mailboxes
)
{
for
(
const
KMime
::
Types
::
Mailbox
&
mailbox
:
mailboxes
)
{
message
->
cc
()
->
addAddress
(
mailbox
);
}
}
...
...
messagecomposer/src/imagescaling/imagescalingutils.cpp
View file @
53e34da7
...
...
@@ -186,7 +186,7 @@ bool Utils::hasImage(const QByteArray &mimetype)
bool
Utils
::
containsImage
(
const
MessageCore
::
AttachmentPart
::
List
&
parts
)
{
for
each
(
const
MessageCore
::
AttachmentPart
::
Ptr
&
part
,
parts
)
{
for
(
const
MessageCore
::
AttachmentPart
::
Ptr
&
part
:
parts
)
{
if
(
hasImage
(
part
->
mimeType
()))
{
return
true
;
}
...
...
messagecomposer/src/job/aliasesexpandjob.cpp
View file @
53e34da7
...
...
@@ -21,6 +21,7 @@
*/
#include
"aliasesexpandjob.h"
#include
"helper/helper_p.h"
#include
"distributionlistexpandjob.h"
#include
<Akonadi/Contact/ContactSearchJob>
...
...
@@ -48,7 +49,7 @@ void AliasesExpandJob::start()
{
// At first we try to expand the recipient to a distribution list
// or nick name and save the results in a map for later lookup
for
each
(
const
QString
&
recipient
,
mRecipients
)
{
for
(
const
QString
&
recipient
:
qAsConst
(
mRecipients
)
)
{
// speedup: assume aliases and list names don't contain '@'
if
(
recipient
.
isEmpty
()
||
recipient
.
contains
(
QLatin1Char
(
'@'
)))
{
...
...
@@ -123,7 +124,7 @@ void AliasesExpandJob::slotNicknameExpansionDone(KJob *job)
const
KContacts
::
Addressee
::
List
contacts
=
searchJob
->
contacts
();
const
QString
recipient
=
searchJob
->
property
(
"recipient"
).
toString
();
for
each
(
const
KContacts
::
Addressee
&
contact
,
contacts
)
{
for
(
const
KContacts
::
Addressee
&
contact
:
contacts
)
{
if
(
contact
.
nickName
().
toLower
()
==
recipient
.
toLower
())
{
mNicknameExpansionResults
.
insert
(
recipient
,
contact
.
fullEmail
());
break
;
...
...
@@ -138,7 +139,7 @@ void AliasesExpandJob::slotNicknameExpansionDone(KJob *job)
void
AliasesExpandJob
::
finishExpansion
()
{
for
each
(
const
QString
&
recipient
,
mRecipients
)
{
for
(
const
QString
&
recipient
:
qAsConst
(
mRecipients
)
)
{
if
(
recipient
.
isEmpty
())
{
continue
;
}
...
...
messagecomposer/src/recipient/distributionlistdialog.cpp
View file @
53e34da7
...
...
@@ -20,7 +20,7 @@
*/
#include
"distributionlistdialog.h"
#include
"helper/helper_p.h"
#include
<AkonadiWidgets/collectiondialog.h>
#include
<Akonadi/Contact/ContactGroupSearchJob>
#include
<Akonadi/Contact/ContactSearchJob>
...
...
@@ -208,7 +208,7 @@ void DistributionListDialog::slotDelayedSetRecipients(KJob *job)
item
->
setCheckState
(
0
,
Qt
::
Checked
);
}
else
{
bool
isFirst
=
true
;
for
each
(
const
Akonadi
::
Item
&
akItem
,
akItems
)
{
for
(
const
Akonadi
::
Item
&
akItem
:
qAsConst
(
akItems
)
)
{
if
(
akItem
.
hasPayload
<
KContacts
::
Addressee
>
())
{
const
KContacts
::
Addressee
contact
=
akItem
.
payload
<
KContacts
::
Addressee
>
();
...
...
messagecomposer/src/recipient/recipientseditor.cpp
View file @
53e34da7
...
...
@@ -146,9 +146,9 @@ void RecipientsEditor::setRecipientString(const QVector< KMime::Types::Mailbox >
Recipient
::
List
RecipientsEditor
::
recipients
()
const
{
QList
<
MultiplyingLineData
::
Ptr
>
dataList
=
allData
();
const
QList
<
MultiplyingLineData
::
Ptr
>
dataList
=
allData
();
Recipient
::
List
recList
;
for
each
(
const
MultiplyingLineData
::
Ptr
&
datum
,
dataList
)
{
for
(
const
MultiplyingLineData
::
Ptr
&
datum
:
dataList
)
{
Recipient
::
Ptr
rec
=
qSharedPointerDynamicCast
<
Recipient
>
(
datum
);
if
(
!
rec
)
{
continue
;
...
...
messagecomposer/src/recipient/recipientspicker.cpp
View file @
53e34da7
...
...
@@ -166,7 +166,7 @@ void RecipientsPicker::pick(Recipient::Type type)
}
bool
tooManyAddress
=
false
;
for
each
(
const
Akonadi
::
EmailAddressSelection
&
selection
,
selections
)
{
for
(
const
Akonadi
::
EmailAddressSelection
&
selection
:
selections
)
{
Recipient
recipient
;
recipient
.
setType
(
type
);
recipient
.
setEmail
(
selection
.
quotedEmail
());
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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