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
PIM IncidenceEditor
Commits
b35283ae
Commit
b35283ae
authored
Mar 29, 2019
by
Laurent Montel
😁
Browse files
Compile without foreach
parent
c72951a0
Changes
7
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
b35283ae
...
...
@@ -110,6 +110,10 @@ install(FILES
feature_summary
(
WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES
)
install
(
FILES incidenceeditor.categories incidenceeditor.renamecategories DESTINATION
${
KDE_INSTALL_CONFDIR
}
)
if
(
${
KF5Config_VERSION
}
STRGREATER
"5.56.0"
)
add_definitions
(
-DQT_NO_FOREACH
)
MESSAGE
(
STATUS
"compile without foreach"
)
endif
()
add_subdirectory
(
src
)
if
(
BUILD_TESTING
)
...
...
autotests/conflictresolvertest.cpp
View file @
b35283ae
...
...
@@ -32,7 +32,7 @@ using namespace IncidenceEditorNG;
void
ConflictResolverTest
::
insertAttendees
()
{
for
each
(
const
CalendarSupport
::
FreeBusyItem
::
Ptr
&
item
,
qAsConst
(
attendees
))
{
for
(
const
CalendarSupport
::
FreeBusyItem
::
Ptr
&
item
:
qAsConst
(
attendees
))
{
resolver
->
insertAttendee
(
item
);
}
}
...
...
src/combinedincidenceeditor.cpp
View file @
b35283ae
...
...
@@ -52,7 +52,7 @@ bool CombinedIncidenceEditor::isDirty() const
bool
CombinedIncidenceEditor
::
isValid
()
const
{
for
each
(
IncidenceEditor
*
editor
,
mCombinedEditors
)
{
for
(
IncidenceEditor
*
editor
:
qAsConst
(
mCombinedEditors
)
)
{
if
(
!
editor
->
isValid
())
{
const
QString
reason
=
editor
->
lastErrorString
();
editor
->
focusInvalidField
();
...
...
@@ -91,7 +91,7 @@ void CombinedIncidenceEditor::handleDirtyStatusChange(bool isDirty)
void
CombinedIncidenceEditor
::
load
(
const
KCalCore
::
Incidence
::
Ptr
&
incidence
)
{
mLoadedIncidence
=
incidence
;
for
each
(
IncidenceEditor
*
editor
,
mCombinedEditors
)
{
for
(
IncidenceEditor
*
editor
:
qAsConst
(
mCombinedEditors
)
)
{
// load() may fire dirtyStatusChanged(), reset mDirtyEditorCount to make sure
// we don't end up with an invalid dirty count.
editor
->
blockSignals
(
true
);
...
...
@@ -117,7 +117,7 @@ void CombinedIncidenceEditor::load(const KCalCore::Incidence::Ptr &incidence)
void
CombinedIncidenceEditor
::
load
(
const
Akonadi
::
Item
&
item
)
{
for
each
(
IncidenceEditor
*
editor
,
mCombinedEditors
)
{
for
(
IncidenceEditor
*
editor
:
qAsConst
(
mCombinedEditors
)
)
{
// load() may fire dirtyStatusChanged(), reset mDirtyEditorCount to make sure
// we don't end up with an invalid dirty count.
editor
->
blockSignals
(
true
);
...
...
@@ -142,14 +142,14 @@ void CombinedIncidenceEditor::load(const Akonadi::Item &item)
void
CombinedIncidenceEditor
::
save
(
const
KCalCore
::
Incidence
::
Ptr
&
incidence
)
{
for
each
(
IncidenceEditor
*
editor
,
mCombinedEditors
)
{
for
(
IncidenceEditor
*
editor
:
qAsConst
(
mCombinedEditors
)
)
{
editor
->
save
(
incidence
);
}
}
void
CombinedIncidenceEditor
::
save
(
Akonadi
::
Item
&
item
)
{
for
each
(
IncidenceEditor
*
editor
,
mCombinedEditors
)
{
for
(
IncidenceEditor
*
editor
:
qAsConst
(
mCombinedEditors
)
)
{
editor
->
save
(
item
);
}
}
src/conflictresolver.cpp
View file @
b35283ae
...
...
@@ -318,7 +318,7 @@ void ConflictResolver::findAllFreeSlots()
// etareti
// append the allocated array to <fbTable>
// etareti
for
each
(
const
KCalCore
::
FreeBusy
::
Ptr
&
currentFB
,
filteredFBItems
)
{
for
(
const
KCalCore
::
FreeBusy
::
Ptr
&
currentFB
:
qAsConst
(
filteredFBItems
)
)
{
Q_ASSERT
(
currentFB
);
// sanity check
const
KCalCore
::
Period
::
List
busyPeriods
=
currentFB
->
busyPeriods
();
QVector
<
int
>
fbArray
(
range
);
...
...
src/incidencealarm.cpp
View file @
b35283ae
...
...
@@ -67,7 +67,8 @@ void IncidenceAlarm::load(const KCalCore::Incidence::Ptr &incidence)
mDateTime
->
load
(
incidence
);
mAlarms
.
clear
();
foreach
(
const
KCalCore
::
Alarm
::
Ptr
&
alarm
,
incidence
->
alarms
())
{
const
auto
lstAlarms
=
incidence
->
alarms
();
for
(
const
KCalCore
::
Alarm
::
Ptr
&
alarm
:
lstAlarms
)
{
mAlarms
.
append
(
KCalCore
::
Alarm
::
Ptr
(
new
KCalCore
::
Alarm
(
*
alarm
.
data
())));
}
...
...
@@ -118,9 +119,9 @@ bool IncidenceAlarm::isDirty() const
// if all currently enabled alarms are also in the incidence. The
// disabled alarms are not changed by our code at all, so we assume that
// they're still there.
for
each
(
const
KCalCore
::
Alarm
::
Ptr
&
alarm
,
mAlarms
)
{
for
(
const
KCalCore
::
Alarm
::
Ptr
&
alarm
:
qAsConst
(
mAlarms
)
)
{
bool
found
=
false
;
for
each
(
const
KCalCore
::
Alarm
::
Ptr
&
initialAlarm
,
initialAlarms
)
{
for
(
const
KCalCore
::
Alarm
::
Ptr
&
initialAlarm
:
qAsConst
(
initialAlarms
)
)
{
if
(
*
alarm
==
*
initialAlarm
)
{
found
=
true
;
break
;
...
...
src/incidenceattendee.cpp
View file @
b35283ae
...
...
@@ -295,7 +295,8 @@ bool IncidenceAttendee::isDirty() const
const
KCalCore
::
Attendee
::
List
originalList
=
mLoadedIncidence
->
attendees
();
KCalCore
::
Attendee
::
List
newList
;
foreach
(
KCalCore
::
Attendee
::
Ptr
attendee
,
mDataModel
->
attendees
())
{
const
auto
lstAttendees
=
mDataModel
->
attendees
();
for
(
const
KCalCore
::
Attendee
::
Ptr
&
attendee
:
lstAttendees
)
{
if
(
!
attendee
->
fullName
().
isEmpty
())
{
newList
.
append
(
attendee
);
}
...
...
@@ -309,7 +310,7 @@ bool IncidenceAttendee::isDirty() const
// Okay, again not the most efficient algorithm, but I'm assuming that in the
// bulk of the use cases, the number of attendees is not much higher than 10 or so.
for
each
(
const
KCalCore
::
Attendee
::
Ptr
&
attendee
,
originalList
)
{
for
(
const
KCalCore
::
Attendee
::
Ptr
&
attendee
:
originalList
)
{
bool
found
=
false
;
for
(
int
i
=
0
;
i
<
newList
.
count
();
++
i
)
{
if
(
*
(
newList
[
i
])
==
*
attendee
)
{
...
...
@@ -998,7 +999,8 @@ void IncidenceAttendee::printDebugInfo() const
KCalCore
::
Attendee
::
List
newList
;
qCDebug
(
INCIDENCEEDITOR_LOG
)
<<
"List sizes: "
<<
originalList
.
count
()
<<
newList
.
count
();
foreach
(
KCalCore
::
Attendee
::
Ptr
attendee
,
mDataModel
->
attendees
())
{
const
auto
lstAttendees
=
mDataModel
->
attendees
();
for
(
const
KCalCore
::
Attendee
::
Ptr
&
attendee
:
lstAttendees
)
{
if
(
!
attendee
->
fullName
().
isEmpty
())
{
newList
.
append
(
attendee
);
}
...
...
@@ -1006,7 +1008,7 @@ void IncidenceAttendee::printDebugInfo() const
// Okay, again not the most efficient algorithm, but I'm assuming that in the
// bulk of the use cases, the number of attendees is not much higher than 10 or so.
for
each
(
const
KCalCore
::
Attendee
::
Ptr
&
attendee
,
originalList
)
{
for
(
const
KCalCore
::
Attendee
::
Ptr
&
attendee
:
originalList
)
{
bool
found
=
false
;
for
(
int
i
=
0
;
i
<
newList
.
count
();
++
i
)
{
if
(
newList
[
i
]
==
attendee
)
{
...
...
src/resourcemodel.cpp
View file @
b35283ae
...
...
@@ -207,7 +207,7 @@ void ResourceModel::slotLDAPCollectionData(const KLDAP::LdapResultObject::List &
// Resources in a collection add this link into ldapCollectionsMap
const
auto
members
=
result
.
object
.
attributes
()[
QStringLiteral
(
"uniqueMember"
)];
for
each
(
const
QByteArray
&
member
,
members
)
{
for
(
const
QByteArray
&
member
:
members
)
{
ldapCollectionsMap
.
insert
(
QString
::
fromLatin1
(
member
),
item
);
}
}
...
...
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