summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2017-04-24 07:42:04 +0200
committerMontel Laurent <[email protected]>2017-04-24 07:42:04 +0200
commit881fccd4a1a205ecc660ee0ae4081f0cf2276fde (patch)
treede0ee8bde8270acf3f35e089d9bf2dbbfc2b3a0d
parent22b27f85361a2b823afd61a888f836be22fd315c (diff)
Port some foreach
-rw-r--r--autotests/conflictresolvertest.cpp2
-rw-r--r--src/attendeecomboboxdelegate.cpp3
-rw-r--r--src/incidencealarm.cpp2
-rw-r--r--src/incidencedefaults.cpp8
4 files changed, 7 insertions, 8 deletions
diff --git a/autotests/conflictresolvertest.cpp b/autotests/conflictresolvertest.cpp
index c800c72..ed404a4 100644
--- a/autotests/conflictresolvertest.cpp
+++ b/autotests/conflictresolvertest.cpp
@@ -33,7 +33,7 @@ using namespace IncidenceEditorNG;
void ConflictResolverTest::insertAttendees()
{
- foreach (CalendarSupport::FreeBusyItem::Ptr item, attendees) {
+ foreach (const CalendarSupport::FreeBusyItem::Ptr &item, qAsConst(attendees)) {
resolver->insertAttendee(item);
}
}
diff --git a/src/attendeecomboboxdelegate.cpp b/src/attendeecomboboxdelegate.cpp
index fc92e68..1aa9e3d 100644
--- a/src/attendeecomboboxdelegate.cpp
+++ b/src/attendeecomboboxdelegate.cpp
@@ -71,9 +71,8 @@ void AttendeeComboBoxDelegate::setStandardIndex(int index)
QWidget *AttendeeComboBoxDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &/* option */, const QModelIndex &/* index */) const
{
AttendeeComboBox *editor = new AttendeeComboBox(parent);
- QPair<QIcon, QString> pair;
- foreach (pair, mEntries) {
+ for (const QPair<QIcon, QString> &pair : qAsConst(mEntries)) {
editor->addItem(pair.first, pair.second);
}
diff --git a/src/incidencealarm.cpp b/src/incidencealarm.cpp
index 69d923c..b82187d 100644
--- a/src/incidencealarm.cpp
+++ b/src/incidencealarm.cpp
@@ -238,7 +238,7 @@ void IncidenceAlarm::updateAlarmList()
const QModelIndex currentIndex = mUi->mAlarmList->currentIndex();
mUi->mAlarmList->clear();
- foreach (const KCalCore::Alarm::Ptr &alarm, mAlarms) {
+ for (const KCalCore::Alarm::Ptr &alarm : qAsConst(mAlarms)) {
mUi->mAlarmList->addItem(stringForAlarm(alarm));
if (alarm->enabled()) {
++mEnabledAlarmCount;
diff --git a/src/incidencedefaults.cpp b/src/incidencedefaults.cpp
index e0f7ef8..e76a3f3 100644
--- a/src/incidencedefaults.cpp
+++ b/src/incidencedefaults.cpp
@@ -94,7 +94,7 @@ KCalCore::Person::Ptr IncidenceDefaultsPrivate::organizerAsPerson() const
if (!mGroupWareDomain.isEmpty()) {
// Check if we have an identity with an email that ends with the groupware
// domain.
- foreach (const QString &fullEmail, mEmails) {
+ for (const QString &fullEmail : qAsConst(mEmails)) {
QString name;
QString email;
const bool success = KEmailAddress::extractEmailAddressAndName(fullEmail, email, name);
@@ -109,7 +109,7 @@ KCalCore::Person::Ptr IncidenceDefaultsPrivate::organizerAsPerson() const
if (organizer->email() == invalidEmail) {
// Either, no groupware was used, or we didn't find a groupware email address.
// Now try to
- foreach (const QString &fullEmail, mEmails) {
+ for (const QString &fullEmail : qAsConst(mEmails)) {
QString name;
QString email;
const bool success = KEmailAddress::extractEmailAddressAndName(fullEmail, email, name);
@@ -380,7 +380,7 @@ void IncidenceDefaults::setDefaults(const KCalCore::Incidence::Ptr &incidence) c
#ifdef KDEPIM_ENTERPRISE_BUILD
incidence->addAttendee(d->organizerAsAttendee(organizerAsPerson));
#endif
- foreach (const KCalCore::Attendee::Ptr &attendee, d->mAttendees) {
+ for (const KCalCore::Attendee::Ptr &attendee : qAsConst(d->mAttendees)) {
incidence->addAttendee(attendee);
}
// Ical standard: No attendees -> must not have an organizer!
@@ -388,7 +388,7 @@ void IncidenceDefaults::setDefaults(const KCalCore::Incidence::Ptr &incidence) c
incidence->setOrganizer(organizerAsPerson);
}
- foreach (const KCalCore::Attachment::Ptr &attachment, d->mAttachments) {
+ for (const KCalCore::Attachment::Ptr &attachment : qAsConst(d->mAttachments)) {
incidence->addAttachment(attachment);
}