Commit a8545b05 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Minor optimization

parent 3300c230
......@@ -685,8 +685,7 @@ QList<AgendaItem::QPtr> &AgendaItem::conflictItems()
void AgendaItem::setConflictItems(const QList<AgendaItem::QPtr> &ci)
{
mConflictItems = ci;
QList<AgendaItem::QPtr>::iterator it;
for (it = mConflictItems.begin(); it != mConflictItems.end(); ++it) {
for (QList<AgendaItem::QPtr>::iterator it = mConflictItems.begin(), end(mConflictItems.end()); it != end; ++it) {
(*it)->addConflictItem(this);
}
}
......
......@@ -1449,7 +1449,7 @@ void AgendaView::updateTimeBarWidth()
QFontMetrics fm(labelFont);
int width = d->mTimeLabelsZone->preferedTimeLabelsWidth();
foreach (QLabel *l, d->mTimeBarHeaders) {
for (QLabel *l : qAsConst(d->mTimeBarHeaders)) {
foreach (const QString &word, l->text().split(QLatin1Char(' '))) {
width = qMax(width, fm.width(word));
}
......
......@@ -38,7 +38,7 @@ DecorationLabel::DecorationLabel(CalendarDecoration::Element *e,
{
mPixmap = e->newPixmap(size());
mUrl = e->url();
setUrl(e->url());
setUrl(mUrl);
connect(e, &CalendarDecoration::Element::gotNewExtensiveText,
this, &DecorationLabel::setExtensiveText);
......
......@@ -361,8 +361,9 @@ QString TimeLabels::headerToolTip() const
toolTip += abbreviations;
toolTip += QLatin1String("<br/>");
}
if (!mTimezone.comment().isEmpty()) {
toolTip += i18n("<i>Comment:</i> %1", mTimezone.comment());
const QString timeZoneComment(mTimezone.comment());
if (!timeZoneComment.isEmpty()) {
toolTip += i18n("<i>Comment:</i> %1", timeZoneComment);
}
toolTip += QLatin1String("</qt>");
......
......@@ -60,7 +60,7 @@ int MultiViewCalendar::calendars() const
ViewCalendar::Ptr MultiViewCalendar::findCalendar(const KCalCore::Incidence::Ptr &incidence) const
{
foreach (const ViewCalendar::Ptr &cal, mSubCalendars) {
for (const ViewCalendar::Ptr &cal : qAsConst(mSubCalendars)) {
if (cal->isValid(incidence)) {
return cal;
}
......@@ -70,7 +70,7 @@ ViewCalendar::Ptr MultiViewCalendar::findCalendar(const KCalCore::Incidence::Ptr
ViewCalendar::Ptr MultiViewCalendar::findCalendar(const QString &incidenceIdentifier) const
{
foreach (const ViewCalendar::Ptr &cal, mSubCalendars) {
for (const ViewCalendar::Ptr &cal : qAsConst(mSubCalendars)) {
if (cal->isValid(incidenceIdentifier)) {
return cal;
}
......
......@@ -163,7 +163,7 @@ public:
bool visit(const FreeBusy::Ptr &) override {
// to inhibit hidden virtual compile warning
return true;
};
}
private:
ListViewItem *mItem;
......
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