Commit f2f1973d authored by Glen Ditchfield's avatar Glen Ditchfield 🐛
Browse files

Fix clazy warnings

parent b192873e
Pipeline #53092 skipped
......@@ -193,7 +193,7 @@ QUrl AttachmentIconItem::tempFileForAttachment()
return mTempFile;
}
QMimeData *AttachmentIconView::mimeData(const QList< QListWidgetItem *> items) const
QMimeData *AttachmentIconView::mimeData(const QList< QListWidgetItem *> items) const // clazy:exclude=function-args-by-ref
{
// create a list of the URL:s that we want to drag
QList<QUrl> urls;
......
......@@ -57,7 +57,7 @@ void AttendeeEditor::slotCalculateTotal()
AttendeeData::List AttendeeEditor::attendees() const
{
const QVector<KPIM::MultiplyingLineData::Ptr> dataList = allData();
AttendeeData::List attList;
AttendeeData::List attList; // clazy:exclude=inefficient-qlist
//qCDebug(INCIDENCEEDITOR_LOG) << "num attendees:" << dataList.size();
for (const KPIM::MultiplyingLineData::Ptr &datum : dataList) {
AttendeeData::Ptr att = qSharedPointerDynamicCast<AttendeeData>(datum);
......
......@@ -335,6 +335,7 @@ int AttendeeLine::setColumnWidth(int w)
void AttendeeLine::setActions(AttendeeActions actions)
{
Q_UNUSED(actions);
mStateCombo->clear();
}
......
......@@ -85,21 +85,15 @@ bool AttendeeLineEditDelegate::helpEvent(QHelpEvent *event, QAbstractItemView *v
switch (event->type()) {
#ifndef QT_NO_TOOLTIP
case QEvent::ToolTip:
{
auto *he = static_cast<QHelpEvent *>(event);
QToolTip::showText(he->globalPos(), mToolTip, view);
QToolTip::showText(event->globalPos(), mToolTip, view);
return true;
}
#endif
#ifndef QT_NO_WHATSTHIS
case QEvent::QueryWhatsThis:
return true;
case QEvent::WhatsThis:
{
auto *he = static_cast<QHelpEvent *>(event);
QWhatsThis::showText(he->globalPos(), mWhatsThis, view);
QWhatsThis::showText(event->globalPos(), mWhatsThis, view);
return true;
}
#endif
default:
break;
......
......@@ -98,7 +98,7 @@ bool AttendeeTableModel::setData(const QModelIndex &index, const QVariant &value
{
QString email, name;
if (index.isValid() && role == Qt::EditRole) {
KCalendarCore::Attendee &attendee = mAttendeeList[index.row()];
KCalendarCore::Attendee &attendee = mAttendeeList[index.row()];// clazy:exclude=detaching-member
switch (index.column()) {
case Role:
attendee.setRole(static_cast<KCalendarCore::Attendee::Role>(value.toInt()));
......
......@@ -50,12 +50,12 @@ public:
Q_REQUIRED_RESULT QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
Q_REQUIRED_RESULT Qt::ItemFlags flags(const QModelIndex &index) const override;
Q_REQUIRED_RESULT bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
Q_REQUIRED_RESULT bool insertRows(int position, int rows, const QModelIndex &index = QModelIndex()) override;
Q_REQUIRED_RESULT bool removeRows(int position, int rows, const QModelIndex &index = QModelIndex()) override;
bool insertRows(int position, int rows, const QModelIndex &index = QModelIndex()) override;
bool removeRows(int position, int rows, const QModelIndex &index = QModelIndex()) override;
Q_REQUIRED_RESULT bool insertAttendee(int position, const KCalendarCore::Attendee &attendee);
bool insertAttendee(int position, const KCalendarCore::Attendee &attendee);
void setAttendees(const KCalendarCore::Attendee::List &resources);
Q_REQUIRED_RESULT KCalendarCore::Attendee::List attendees() const;
......
......@@ -327,7 +327,7 @@ void EditorItemManager::save()
KCalendarCore::Incidence::Ptr oldPayload = CalendarSupport::incidence(d->mPrevItem);
if (d->mItem.parentCollection() == d->mItemUi->selectedCollection()
|| d->mItem.storageCollectionId() == d->mItemUi->selectedCollection().id()) {
d->mChanger->modifyIncidence(d->mItem, oldPayload);
(void) d->mChanger->modifyIncidence(d->mItem, oldPayload);
} else {
Q_ASSERT(d->mItemUi->selectedCollection().isValid());
Q_ASSERT(d->mItem.parentCollection().isValid());
......@@ -337,7 +337,7 @@ void EditorItemManager::save()
<< d->mItemUi->selectedCollection().id();
if (d->mItemUi->isDirty()) {
d->mChanger->modifyIncidence(d->mItem, oldPayload);
(void) d->mChanger->modifyIncidence(d->mItem, oldPayload);
} else {
Akonadi::ItemMoveJob *itemMoveJob
= new Akonadi::ItemMoveJob(d->mItem, d->mItemUi->selectedCollection());
......@@ -350,7 +350,7 @@ void EditorItemManager::save()
Q_EMIT itemSaveFinished(EditorItemManager::Modify);
} else {
Q_ASSERT(d->mItemUi->selectedCollection().isValid());
d->mChanger->createFromItem(d->mItem, d->mItemUi->selectedCollection());
(void) d->mChanger->createFromItem(d->mItem, d->mItemUi->selectedCollection());
}
}
}
......
......@@ -169,6 +169,8 @@ void IncidenceAttachment::removeSelectedAttachments()
{
QList<QListWidgetItem *> selected;
QStringList labels;
selected.reserve(mAttachmentView->count());
labels.reserve(mAttachmentView->count());
for (int itemIndex = 0; itemIndex < mAttachmentView->count(); ++itemIndex) {
QListWidgetItem *it = mAttachmentView->item(itemIndex);
......@@ -279,7 +281,7 @@ void IncidenceAttachment::showAttachment(QListWidgetItem *item)
}
}
void IncidenceAttachment::showContextMenu(const QPoint &pos)
void IncidenceAttachment::showContextMenu(const QPoint &pos) // clazy:exclude=function-args-by-value
{
const bool enable = mAttachmentView->itemAt(pos) != nullptr;
......
......@@ -133,7 +133,8 @@ IncidenceAttendee::IncidenceAttendee(QWidget *parent, IncidenceDateTime *dateTim
connect(mConflictResolver->model(), &QAbstractItemModel::rowsInserted,
this, &IncidenceAttendee::slotFreeBusyAdded);
connect(mConflictResolver->model(), SIGNAL(layoutChanged()), SLOT(updateFBStatus()));
connect(mConflictResolver->model(), &QAbstractItemModel::layoutChanged,
this, qOverload<>(&IncidenceAttendee::updateFBStatus));
connect(mConflictResolver->model(), &QAbstractItemModel::dataChanged,
this, &IncidenceAttendee::slotFreeBusyChanged);
......
......@@ -142,7 +142,6 @@ void IncidenceRecurrence::load(const KCalendarCore::Incidence::Ptr &incidence)
mCurrentDate = mLoadedIncidence->dateTime(KCalendarCore::IncidenceBase::RoleRecurrenceStart).date();
mDateTime->load(incidence);
mDateTime->endDate();
fillCombos();
setDefaults();
......
......@@ -35,7 +35,7 @@ void KTimeZoneComboBox::Private::fillComboBox()
const QList<QByteArray> lstTimeZoneIds = QTimeZone::availableTimeZoneIds();
mZones.reserve(lstTimeZoneIds.count());
std::copy(lstTimeZoneIds.begin(), lstTimeZoneIds.end(), std::back_inserter(mZones));
std::sort(mZones.begin(), mZones.end());
std::sort(mZones.begin(), mZones.end()); // clazy:exclude=detaching-member
// Prepend Local, UTC and Floating, for convenience
mZones.prepend("UTC"); // do not use i18n here index=2
......
......@@ -156,11 +156,11 @@ void ResourceModel::startSearch()
if (ldapCollections.contains(rootItem->child(i))) {
QModelIndex parentIndex = index(i, 0, QModelIndex());
beginRemoveRows(parentIndex, 0, rootItem->child(i)->childCount() - 1);
rootItem->child(i)->removeChildren(0, rootItem->child(i)->childCount());
(void) rootItem->child(i)->removeChildren(0, rootItem->child(i)->childCount());
endRemoveRows();
} else {
beginRemoveRows(QModelIndex(), i, i);
rootItem->removeChildren(i, 1);
(void) rootItem->removeChildren(i, 1);
endRemoveRows();
}
}
......@@ -187,7 +187,7 @@ void ResourceModel::slotLDAPCollectionData(const KLDAP::LdapResultObject::List &
result.object.dn(), headers, *result.client, rootItem));
item->setLdapObject(result.object);
rootItem->insertChild(rootItem->childCount(), item);
(void) rootItem->insertChild(rootItem->childCount(), item);
ldapCollections.insert(item);
// Resources in a collection add this link into ldapCollectionsMap
......@@ -221,7 +221,7 @@ void ResourceModel::slotLDAPSearchData(const KLDAP::LdapResultObject::List &resu
parentIndex = index(parent->childNumber(), 0, parentIndex);
}
beginInsertRows(parentIndex, parent->childCount(), parent->childCount());
parent->insertChild(parent->childCount(), item);
(void) parent->insertChild(parent->childCount(), item);
endInsertRows();
}
}
......
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