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
1033d0fc
Commit
1033d0fc
authored
Jan 10, 2017
by
Laurent Montel
Browse files
Port some code to for(...:...)
parent
fc4b7ea5
Changes
17
Hide whitespace changes
Inline
Side-by-side
messagecomposer/src/composer/composerviewbase.cpp
View file @
1033d0fc
...
...
@@ -156,19 +156,19 @@ void MessageComposer::ComposerViewBase::setMessage(const KMime::Message::Ptr &ms
// If we are loading from a draft, load unexpanded aliases as well
if
(
auto
hrd
=
m_msg
->
headerByType
(
"X-KMail-UnExpanded-To"
))
{
const
QStringList
spl
=
hrd
->
asUnicodeString
().
split
(
QLatin1Char
(
','
));
for
each
(
const
QString
&
addr
,
spl
)
{
for
(
const
QString
&
addr
:
spl
)
{
m_recipientsEditor
->
addRecipient
(
addr
,
MessageComposer
::
Recipient
::
To
);
}
}
if
(
auto
hrd
=
m_msg
->
headerByType
(
"X-KMail-UnExpanded-CC"
))
{
const
QStringList
spl
=
hrd
->
asUnicodeString
().
split
(
QLatin1Char
(
','
));
for
each
(
const
QString
&
addr
,
spl
)
{
for
(
const
QString
&
addr
:
spl
)
{
m_recipientsEditor
->
addRecipient
(
addr
,
MessageComposer
::
Recipient
::
Cc
);
}
}
if
(
auto
hrd
=
m_msg
->
headerByType
(
"X-KMail-UnExpanded-BCC"
))
{
const
QStringList
spl
=
hrd
->
asUnicodeString
().
split
(
QLatin1Char
(
','
));
for
each
(
const
QString
&
addr
,
spl
)
{
for
(
const
QString
&
addr
:
spl
)
{
m_recipientsEditor
->
addRecipient
(
addr
,
MessageComposer
::
Recipient
::
Bcc
);
}
}
...
...
@@ -1096,11 +1096,11 @@ void MessageComposer::ComposerViewBase::cleanupAutoSave()
autoSaveDir
.
setNameFilters
(
autoSaveFilter
);
// Return the files to be removed
QStringList
autoSaveFiles
=
autoSaveDir
.
entryList
();
const
QStringList
autoSaveFiles
=
autoSaveDir
.
entryList
();
qCDebug
(
MESSAGECOMPOSER_LOG
)
<<
"There are"
<<
autoSaveFiles
.
count
()
<<
"to be deleted."
;
// Delete each file
for
each
(
const
QString
&
file
,
autoSaveFiles
)
{
for
(
const
QString
&
file
:
autoSaveFiles
)
{
autoSaveDir
.
remove
(
file
);
}
m_autoSaveUUID
.
clear
();
...
...
messagecomposer/src/helper/messagefactory.cpp
View file @
1033d0fc
...
...
@@ -1021,7 +1021,7 @@ void MessageFactory::applyCharset(const KMime::Message::Ptr msg)
QList
<
QByteArray
>
chars
;
chars
.
reserve
(
charsets
.
count
());
for
each
(
const
QString
&
charset
,
charsets
)
{
for
(
const
QString
&
charset
:
charsets
)
{
chars
<<
charset
.
toLatin1
();
}
...
...
messagecomposer/src/job/distributionlistexpandjob.cpp
View file @
1033d0fc
...
...
@@ -88,7 +88,7 @@ void DistributionListExpandJob::slotExpansionDone(KJob *job)
const
KContacts
::
Addressee
::
List
contacts
=
expandJob
->
contacts
();
for
each
(
const
KContacts
::
Addressee
&
contact
,
contacts
)
{
for
(
const
KContacts
::
Addressee
&
contact
:
contacts
)
{
mEmailAddresses
<<
contact
.
fullEmail
();
}
...
...
messagecomposer/src/job/emailaddressresolvejob.cpp
View file @
1033d0fc
...
...
@@ -70,7 +70,7 @@ static inline bool containsAliases(const QString &address)
static
bool
containsAliases
(
const
QStringList
&
addresses
)
{
for
each
(
const
QString
&
address
,
addresses
)
{
for
(
const
QString
&
address
:
addresses
)
{
if
(
containsAliases
(
address
))
{
return
true
;
}
...
...
messagecomposer/src/recipient/recipientspicker.cpp
View file @
1033d0fc
...
...
@@ -218,7 +218,7 @@ void RecipientsPicker::slotSearchLDAP()
void
RecipientsPicker
::
ldapSearchResult
()
{
const
KContacts
::
Addressee
::
List
contacts
=
mLdapSearchDialog
->
selectedContacts
();
for
each
(
const
KContacts
::
Addressee
&
contact
,
contacts
)
{
for
(
const
KContacts
::
Addressee
&
contact
:
contacts
)
{
bool
tooManyAddress
=
false
;
Q_EMIT
pickedRecipient
(
Recipient
(
contact
.
fullEmail
(),
Recipient
::
Undefined
),
tooManyAddress
);
if
(
tooManyAddress
)
{
...
...
messagecomposer/src/utils/util.cpp
View file @
1033d0fc
...
...
@@ -224,7 +224,7 @@ bool MessageComposer::Util::makeMultiMime(Kleo::CryptoMessageFormat format, bool
QByteArray
MessageComposer
::
Util
::
selectCharset
(
const
QList
<
QByteArray
>
&
charsets
,
const
QString
&
text
)
{
for
each
(
const
QByteArray
&
name
,
charsets
)
{
for
(
const
QByteArray
&
name
:
charsets
)
{
// We use KCharsets::codecForName() instead of QTextCodec::codecForName() here, because
// the former knows us-ascii is latin1.
QTextCodec
*
codec
=
KCharsets
::
charsets
()
->
codecForName
(
QString
::
fromLatin1
(
name
));
...
...
messagecore/src/attachment/attachmentfromfolderjob.cpp
View file @
1033d0fc
...
...
@@ -94,7 +94,7 @@ void AttachmentFromFolderJob::Private::compressFolder()
void
AttachmentFromFolderJob
::
Private
::
addEntity
(
const
QFileInfoList
&
f
,
const
QString
&
path
)
{
for
each
(
const
QFileInfo
&
info
,
f
)
{
for
(
const
QFileInfo
&
info
:
f
)
{
qCDebug
(
MESSAGECORE_LOG
)
<<
q
->
maximumAllowedSize
()
<<
"Attachment size : "
<<
mZip
->
device
()
->
size
();
if
(
q
->
maximumAllowedSize
()
!=
-
1
&&
mZip
->
device
()
->
size
()
>
q
->
maximumAllowedSize
())
{
...
...
messagelist/src/core/sortorder.cpp
View file @
1033d0fc
...
...
@@ -163,7 +163,7 @@ typedef QList< Pair > OptionList;
static
bool
optionListHasOption
(
const
OptionList
&
optionList
,
int
optionValue
,
int
defaultOptionValue
)
{
for
each
(
const
Pair
&
pair
,
optionList
)
{
for
(
const
Pair
&
pair
:
optionList
)
{
if
(
pair
.
second
==
optionValue
)
{
return
true
;
}
...
...
messagelist/src/core/themedelegate.cpp
View file @
1033d0fc
...
...
@@ -480,7 +480,7 @@ static inline void paint_tag_list(const QList< MessageItem::Tag * > &tagList, QP
int
&
left
,
int
top
,
int
&
right
,
bool
alignOnRight
,
int
iconSize
)
{
if
(
alignOnRight
)
{
for
each
(
const
MessageItem
::
Tag
*
tag
,
tagList
)
{
for
(
const
MessageItem
::
Tag
*
tag
:
tagList
)
{
right
-=
iconSize
;
// this icon is always present
if
(
right
<
0
)
{
return
;
...
...
@@ -489,7 +489,7 @@ static inline void paint_tag_list(const QList< MessageItem::Tag * > &tagList, QP
right
-=
gHorizontalItemSpacing
;
}
}
else
{
for
each
(
const
MessageItem
::
Tag
*
tag
,
tagList
)
{
for
(
const
MessageItem
::
Tag
*
tag
:
tagList
)
{
if
(
left
>
right
-
iconSize
)
{
return
;
}
...
...
messagelist/src/core/view.cpp
View file @
1033d0fc
...
...
@@ -1441,8 +1441,8 @@ void View::growOrShrinkExistingSelection(const QModelIndex &newSelectedIndex, bo
selectionModel
()
->
select
(
newSelectedIndex
,
QItemSelectionModel
::
Rows
|
QItemSelectionModel
::
Select
);
}
else
{
// selecting something below the top: shrink selection
QModelIndexList
selectedIndexes
=
selection
.
indexes
();
for
each
(
const
QModelIndex
&
idx
,
selectedIndexes
)
{
const
QModelIndexList
selectedIndexes
=
selection
.
indexes
();
for
(
const
QModelIndex
&
idx
:
selectedIndexes
)
{
if
((
idx
.
column
()
==
0
)
&&
(
visualRect
(
idx
).
top
()
>
selectedVisualCoordinate
))
{
selectionModel
()
->
select
(
idx
,
QItemSelectionModel
::
Rows
|
QItemSelectionModel
::
Deselect
);
}
...
...
@@ -1454,8 +1454,8 @@ void View::growOrShrinkExistingSelection(const QModelIndex &newSelectedIndex, bo
selectionModel
()
->
select
(
newSelectedIndex
,
QItemSelectionModel
::
Rows
|
QItemSelectionModel
::
Select
);
}
else
{
// selecting something above bottom: shrink selection
QModelIndexList
selectedIndexes
=
selection
.
indexes
();
for
each
(
const
QModelIndex
&
idx
,
selectedIndexes
)
{
const
QModelIndexList
selectedIndexes
=
selection
.
indexes
();
for
(
const
QModelIndex
&
idx
:
selectedIndexes
)
{
if
((
idx
.
column
()
==
0
)
&&
(
visualRect
(
idx
).
top
()
<
selectedVisualCoordinate
))
{
selectionModel
()
->
select
(
idx
,
QItemSelectionModel
::
Rows
|
QItemSelectionModel
::
Deselect
);
}
...
...
messagelist/src/messagelistutil.cpp
View file @
1033d0fc
...
...
@@ -154,7 +154,7 @@ QString MessageList::Util::contentSummary(const Akonadi::Item &item)
const
int
maxLines
=
5
;
const
QStringList
lines
=
content
.
split
(
QLatin1Char
(
'\n'
));
QString
ret
;
for
each
(
const
QString
&
line
,
lines
)
{
for
(
const
QString
&
line
:
lines
)
{
const
QString
lineTrimmed
=
line
.
trimmed
();
const
bool
isQuoted
=
lineTrimmed
.
startsWith
(
QLatin1Char
(
'>'
))
||
lineTrimmed
.
startsWith
(
QLatin1Char
(
'|'
));
if
(
!
isQuoted
&&
!
lineTrimmed
.
isEmpty
())
{
...
...
messagelist/src/storagemodel.cpp
View file @
1033d0fc
...
...
@@ -144,9 +144,9 @@ StorageModel::~StorageModel()
Collection
::
List
StorageModel
::
displayedCollections
()
const
{
Collection
::
List
collections
;
QModelIndexList
indexes
=
d
->
mSelectionModel
->
selectedRows
();
const
QModelIndexList
indexes
=
d
->
mSelectionModel
->
selectedRows
();
for
each
(
const
QModelIndex
&
index
,
indexes
)
{
for
(
const
QModelIndex
&
index
:
indexes
)
{
Collection
c
=
index
.
data
(
EntityTreeModel
::
CollectionRole
).
value
<
Collection
>
();
if
(
c
.
isValid
())
{
collections
<<
c
;
...
...
@@ -159,9 +159,9 @@ Collection::List StorageModel::displayedCollections() const
QString
StorageModel
::
id
()
const
{
QStringList
ids
;
QModelIndexList
indexes
=
d
->
mSelectionModel
->
selectedRows
();
const
QModelIndexList
indexes
=
d
->
mSelectionModel
->
selectedRows
();
for
each
(
const
QModelIndex
&
index
,
indexes
)
{
for
(
const
QModelIndex
&
index
:
indexes
)
{
Collection
c
=
index
.
data
(
EntityTreeModel
::
CollectionRole
).
value
<
Collection
>
();
if
(
c
.
isValid
())
{
ids
<<
QString
::
number
(
c
.
id
());
...
...
@@ -183,9 +183,9 @@ bool StorageModel::isOutBoundFolder(const Akonadi::Collection &c) const
bool
StorageModel
::
containsOutboundMessages
()
const
{
QModelIndexList
indexes
=
d
->
mSelectionModel
->
selectedRows
();
const
QModelIndexList
indexes
=
d
->
mSelectionModel
->
selectedRows
();
for
each
(
const
QModelIndex
&
index
,
indexes
)
{
for
(
const
QModelIndex
&
index
:
indexes
)
{
Collection
c
=
index
.
data
(
EntityTreeModel
::
CollectionRole
).
value
<
Collection
>
();
if
(
c
.
isValid
())
{
return
isOutBoundFolder
(
c
);
...
...
@@ -197,11 +197,11 @@ bool StorageModel::containsOutboundMessages() const
int
StorageModel
::
initialUnreadRowCountGuess
()
const
{
QModelIndexList
indexes
=
d
->
mSelectionModel
->
selectedRows
();
const
QModelIndexList
indexes
=
d
->
mSelectionModel
->
selectedRows
();
int
unreadCount
=
0
;
for
each
(
const
QModelIndex
&
index
,
indexes
)
{
for
(
const
QModelIndex
&
index
:
indexes
)
{
Collection
c
=
index
.
data
(
EntityTreeModel
::
CollectionRole
).
value
<
Collection
>
();
if
(
c
.
isValid
())
{
unreadCount
+=
c
.
statistics
().
unreadCount
();
...
...
@@ -409,7 +409,7 @@ QMimeData *StorageModel::mimeData(const QList< MessageList::Core::MessageItem *
QMimeData
*
data
=
new
QMimeData
();
QList
<
QUrl
>
urls
;
urls
.
reserve
(
items
.
count
());
for
each
(
MessageList
::
Core
::
MessageItem
*
mi
,
items
)
{
for
(
MessageList
::
Core
::
MessageItem
*
mi
:
items
)
{
Akonadi
::
Item
item
=
itemForRow
(
mi
->
currentModelIndexRow
());
urls
<<
item
.
url
(
Item
::
UrlWithMimeType
);
}
...
...
messagelist/src/widget.cpp
View file @
1033d0fc
...
...
@@ -118,7 +118,7 @@ bool Widget::canAcceptDrag(const QDropEvent *e)
}
const
QList
<
QUrl
>
urls
=
e
->
mimeData
()
->
urls
();
for
each
(
const
QUrl
&
url
,
urls
)
{
for
(
const
QUrl
&
url
:
urls
)
{
const
Collection
collection
=
Collection
::
fromUrl
(
url
);
if
(
collection
.
isValid
())
{
// You're not supposed to drop collections here
return
false
;
...
...
messageviewer/src/viewer/mimeparttree/mimeparttreeview.cpp
View file @
1033d0fc
...
...
@@ -89,9 +89,9 @@ KMime::Content::List MimePartTreeView::selectedContents()
{
KMime
::
Content
::
List
contents
;
QItemSelectionModel
*
selectModel
=
selectionModel
();
QModelIndexList
selectedRows
=
selectModel
->
selectedRows
();
const
QModelIndexList
selectedRows
=
selectModel
->
selectedRows
();
Q_FOREACH
(
const
QModelIndex
&
index
,
selectedRows
)
{
for
(
const
QModelIndex
&
index
:
selectedRows
)
{
KMime
::
Content
*
content
=
static_cast
<
KMime
::
Content
*>
(
index
.
internalPointer
());
if
(
content
)
{
contents
.
append
(
content
);
...
...
messageviewer/src/viewer/pluginloaderbase.cpp
View file @
1033d0fc
...
...
@@ -53,8 +53,8 @@ void PluginLoaderBase::doScan(const char *path)
{
mPluginMap
.
clear
();
const
auto
list
=
QStandardPaths
::
locateAll
(
QStandardPaths
::
GenericDataLocation
,
QString
::
fromLatin1
(
path
),
QStandardPaths
::
LocateDirectory
);
for
each
(
const
auto
&
folder
,
list
)
{
const
QStringList
list
=
QStandardPaths
::
locateAll
(
QStandardPaths
::
GenericDataLocation
,
QString
::
fromLatin1
(
path
),
QStandardPaths
::
LocateDirectory
);
for
(
const
QString
&
folder
:
list
)
{
doScanOneFolder
(
folder
);
}
}
...
...
messageviewer/src/viewer/viewer_p.cpp
View file @
1033d0fc
...
...
@@ -918,10 +918,10 @@ void ViewerPrivate::collectionFetchedForStoringDecryptedMessage(KJob *job)
if
(
!
col
.
isValid
())
{
return
;
}
Akonadi
::
AgentInstance
::
List
instances
=
Akonadi
::
AgentManager
::
self
()
->
instances
();
const
Akonadi
::
AgentInstance
::
List
instances
=
Akonadi
::
AgentManager
::
self
()
->
instances
();
const
QString
itemResource
=
col
.
resource
();
Akonadi
::
AgentInstance
resourceInstance
;
for
each
(
const
Akonadi
::
AgentInstance
&
instance
,
instances
)
{
for
(
const
Akonadi
::
AgentInstance
&
instance
:
instances
)
{
if
(
instance
.
identifier
()
==
itemResource
)
{
resourceInstance
=
instance
;
break
;
...
...
mimetreeparser/src/viewer/nodehelper.cpp
View file @
1033d0fc
...
...
@@ -827,8 +827,8 @@ void NodeHelper::mergeExtraNodes(KMime::Content *node)
return
;
}
QList
<
KMime
::
Content
*
>
extraNodes
=
extraContents
(
node
);
Q_FOREACH
(
KMime
::
Content
*
extra
,
extraNodes
)
{
const
QList
<
KMime
::
Content
*
>
extraNodes
=
extraContents
(
node
);
for
(
KMime
::
Content
*
extra
:
extraNodes
)
{
if
(
node
->
bodyIsMessage
())
{
qCWarning
(
MIMETREEPARSER_LOG
)
<<
"Asked to attach extra content to a kmime::message, this does not make sense. Attaching to:"
<<
node
<<
node
->
encodedContent
()
<<
"
\n
====== with =======
\n
"
<<
extra
<<
extra
->
encodedContent
();
...
...
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