Commit 6ff073c5 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Remove some Q_FOREACH

parent 48508b91
......@@ -187,7 +187,7 @@ QStringList extractEmailAndNormalize(const QString &email)
const QStringList splittedEmail = KEmailAddress::splitAddressList(email);
QStringList normalizedEmail;
normalizedEmail.reserve(splittedEmail.count());
Q_FOREACH (const QString &email, splittedEmail) {
for (const QString &email : splittedEmail) {
const QString str = KEmailAddress::extractEmailAddress(KEmailAddress::normalizeAddressesAndEncodeIdn(email));
normalizedEmail << str;
}
......
......@@ -513,7 +513,7 @@ void CalendarView::writeFilterSettings(KConfig *config)
const QStringList oldFilterList = config->groupList().filter(QRegularExpression(QStringLiteral("^Filter_.*")));
//Delete Old Group
Q_FOREACH (const QString &conf, oldFilterList) {
for (const QString &conf : oldFilterList) {
KConfigGroup group = config->group(conf);
group.deleteGroup();
}
......
......@@ -171,8 +171,8 @@ void SearchDialog::search(const QRegExp &re)
if (m_ui->todosCheck->isChecked()) {
if (m_ui->includeUndatedTodos->isChecked()) {
KDateTime::Spec spec = CalendarSupport::KCalPrefs::instance()->timeSpec();
KCalCore::Todo::List alltodos = m_calendarview->calendar()->todos();
Q_FOREACH (const KCalCore::Todo::Ptr &todo, alltodos) {
const KCalCore::Todo::List alltodos = m_calendarview->calendar()->todos();
for (const KCalCore::Todo::Ptr &todo : alltodos) {
Q_ASSERT(todo);
if ((!todo->hasStartDate() && !todo->hasDueDate()) || // undated
(todo->hasStartDate() &&
......@@ -206,9 +206,9 @@ void SearchDialog::search(const QRegExp &re)
}
mMatchedEvents.clear();
KCalCore::Incidence::List incidences =
const KCalCore::Incidence::List incidences =
Akonadi::ETMCalendar::mergeIncidenceList(events, todos, journals);
Q_FOREACH (const KCalCore::Incidence::Ptr &ev, incidences) {
for (const KCalCore::Incidence::Ptr &ev : incidences) {
Q_ASSERT(ev);
Akonadi::Item item = m_calendarview->calendar()->item(ev->uid());
if (m_ui->summaryCheck->isChecked()) {
......
......@@ -86,8 +86,7 @@ public:
allowedTypes.insert(QStringLiteral("KDatePicker"), i18n("Date"));
const QList<QWidget *> list = wdg->findChildren<QWidget *>();
QWidget *it;
Q_FOREACH (it, list) {
for (QWidget *it : list) {
if (allowedTypes.contains(QLatin1String(it->metaObject()->className()))) {
const QString name = it->objectName();
if (name.startsWith(QStringLiteral("X_"))) {
......
......@@ -346,10 +346,10 @@ void KODayMatrix::updateEvents()
// No point in wasting cpu, all days are bold already
return;
}
KCalCore::Event::List eventlist = mCalendar->events(mDays[0], mDays[NUMDAYS - 1],
const KCalCore::Event::List eventlist = mCalendar->events(mDays[0], mDays[NUMDAYS - 1],
mCalendar->timeSpec());
Q_FOREACH (const KCalCore::Event::Ptr &event, eventlist) {
for (const KCalCore::Event::Ptr &event : eventlist) {
if (mEvents.count() == NUMDAYS) {
// No point in wasting cpu, all days are bold already
break;
......
......@@ -338,7 +338,7 @@ void Controller::onCollectionsFound(KJob *job)
void Controller::onPersonsFound(const QVector<KPIM::Person> &persons)
{
Q_FOREACH (const KPIM::Person &p, persons) {
for (const KPIM::Person &p : persons) {
PersonNode *personNode = new PersonNode(*mSearchModel, p);
personNode->isSearchNode = true;
//toggled by the checkbox, results in person getting added to main model
......
......@@ -324,7 +324,7 @@ void ReparentingModel::removeNode(const ReparentingModel::Node &node)
void ReparentingModel::setNodes(const QList<Node::Ptr> &nodes)
{
Q_FOREACH (const ReparentingModel::Node::Ptr &node, nodes) {
for (const ReparentingModel::Node::Ptr &node : nodes) {
addNode(node);
}
Q_FOREACH (const ReparentingModel::Node::Ptr &node, mProxyNodes) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment