Commit c3dab9af authored by Alexander Lohnau's avatar Alexander Lohnau 💬

Clazy fixes in libtaskmanager

parent 84b54791
......@@ -41,7 +41,7 @@ AbstractWindowTasksModel::AbstractWindowTasksModel(QObject *parent)
auto screenAdded = [this](const QScreen *screen) {
connect(screen, &QScreen::geometryChanged, this,
[this]() {
dataChanged(index(0, 0), index(rowCount() - 1, 0), QVector<int>{ScreenGeometry});
Q_EMIT dataChanged(index(0, 0), index(rowCount() - 1, 0), QVector<int>{ScreenGeometry});
}
);
};
......
......@@ -108,11 +108,11 @@ void LauncherTasksModel::Private::init()
appDataCache.clear();
// Emit changes of all roles satisfied from app data cache.
q->dataChanged(q->index(0, 0), q->index(launchersOrder.count() - 1, 0),
QVector<int>{Qt::DisplayRole, Qt::DecorationRole,
AbstractTasksModel::AppId, AbstractTasksModel::AppName,
AbstractTasksModel::GenericName, AbstractTasksModel::LauncherUrl,
AbstractTasksModel::LauncherUrlWithoutIcon});
Q_EMIT q->dataChanged(q->index(0, 0), q->index(launchersOrder.count() - 1, 0),
QVector<int>{Qt::DisplayRole, Qt::DecorationRole,
AbstractTasksModel::AppId, AbstractTasksModel::AppName,
AbstractTasksModel::GenericName, AbstractTasksModel::LauncherUrl,
AbstractTasksModel::LauncherUrlWithoutIcon});
}
);
......@@ -252,7 +252,8 @@ bool LauncherTasksModel::Private::requestRemoveLauncherFromActivities(const QUrl
remove = true;
} else {
for (const auto& activity: activitiesConsumer.activities()) {
const auto _activities = activitiesConsumer.activities();
for (const auto& activity: _activities) {
if (!activities.contains(activity)) {
newActivities << activity;
} else {
......@@ -372,7 +373,7 @@ QStringList LauncherTasksModel::launcherList() const
// Serializing the launchers
QStringList result;
for (const auto &launcher: d->launchersOrder) {
for (const auto &launcher: qAsConst(d->launchersOrder)) {
const auto &activities = d->activitiesForLauncher[launcher];
QString serializedLauncher;
......@@ -398,7 +399,6 @@ void LauncherTasksModel::setLauncherList(const QStringList &serializedLaunchers)
QHash<QUrl, ActivitiesSet> newActivitiesForLauncher;
// Loading the activity to launchers map
QHash<QString, QList<QUrl>> launchersForActivitiesCandidates;
for (const auto& serializedLauncher: serializedLaunchers) {
QStringList _activities;
QUrl url;
......@@ -422,7 +422,7 @@ void LauncherTasksModel::setLauncherList(const QStringList &serializedLaunchers)
// Filter out invalid activities
const auto allActivities = d->activitiesConsumer.activities();
ActivitiesSet validActivities;
for (const auto& activity: activities) {
for (const auto& activity: qAsConst(activities)) {
if (allActivities.contains(activity)) {
validActivities << activity;
}
......
......@@ -170,7 +170,7 @@ void TaskGroupingProxyModel::Private::sourceRowsAboutToBeRemoved(const QModelInd
q->endRemoveRows();
// We're no longer a group parent.
q->dataChanged(parent, parent);
Q_EMIT q->dataChanged(parent, parent);
// Remove group member.
} else {
const QModelIndex parent = q->index(j, 0);
......@@ -180,7 +180,7 @@ void TaskGroupingProxyModel::Private::sourceRowsAboutToBeRemoved(const QModelInd
// Various roles of the parent evaluate child data, and the
// child list has changed.
q->dataChanged(parent, parent);
Q_EMIT q->dataChanged(parent, parent);
}
break;
......@@ -230,7 +230,7 @@ void TaskGroupingProxyModel::Private::sourceDataChanged(QModelIndex topLeft, QMo
// TODO: Some roles do not need to bubble up as they fall through to the first
// child in data(); it _might_ be worth adding constraints here later.
if (parent.isValid()) {
q->dataChanged(parent, parent, roles);
Q_EMIT q->dataChanged(parent, parent, roles);
}
// When Private::groupDemandingAttention is false, tryToGroup() exempts tasks
......@@ -245,10 +245,10 @@ void TaskGroupingProxyModel::Private::sourceDataChanged(QModelIndex topLeft, QMo
delete rowMap.takeAt(proxyIndex.row());
q->endRemoveRows();
} else {
q->dataChanged(proxyIndex, proxyIndex, roles);
Q_EMIT q->dataChanged(proxyIndex, proxyIndex, roles);
}
} else {
q->dataChanged(proxyIndex, proxyIndex, roles);
Q_EMIT q->dataChanged(proxyIndex, proxyIndex, roles);
}
}
}
......@@ -412,7 +412,7 @@ bool TaskGroupingProxyModel::Private::tryToGroup(const QModelIndex &sourceIndex,
if (!silent) {
q->endInsertRows();
q->dataChanged(parent, parent);
Q_EMIT q->dataChanged(parent, parent);
}
return true;
......@@ -474,7 +474,7 @@ void TaskGroupingProxyModel::Private::breakGroupFor(const QModelIndex &index, bo
q->endRemoveRows();
// We're no longer a group parent.
q->dataChanged(index, index);
Q_EMIT q->dataChanged(index, index);
q->beginInsertRows(QModelIndex(), rowMap.count(),
rowMap.count() + (extraChildren.count() - 1));
......@@ -1028,7 +1028,7 @@ void TaskGroupingProxyModel::requestToggleMaximized(const QModelIndex &index)
}
);
for (const QModelIndex &sourceChild : inStackingOrder) {
for (const QModelIndex &sourceChild : qAsConst(inStackingOrder)) {
d->abstractTasksSourceModel->requestToggleMaximized(sourceChild);
}
}
......@@ -1242,7 +1242,7 @@ void TaskGroupingProxyModel::requestToggleGrouping(const QModelIndex &index)
if (idx.data(AbstractTasksModel::AppId).toString() == appId
|| launcherUrlsMatch(idx.data(AbstractTasksModel::LauncherUrlWithoutIcon).toUrl(), launcherUrl,
IgnoreQueryItems)) {
dataChanged(idx, idx, QVector<int>{AbstractTasksModel::IsGroupable});
Q_EMIT dataChanged(idx, idx, QVector<int>{AbstractTasksModel::IsGroupable});
}
}
}
......
......@@ -376,7 +376,7 @@ void TasksModel::Private::initModels()
}
if (appsMatch(sourceIndex, filterIndex)) {
filterProxyModel->dataChanged(filterIndex, filterIndex);
Q_EMIT filterProxyModel->dataChanged(filterIndex, filterIndex);
}
}
}
......@@ -432,7 +432,7 @@ void TasksModel::Private::initModels()
const QModelIndex &idx = filterProxyModel->index(i, 0);
if (idx.data(AbstractTasksModel::IsLauncher).toBool()) {
filterProxyModel->dataChanged(idx, idx);
Q_EMIT filterProxyModel->dataChanged(idx, idx);
}
}
......@@ -477,7 +477,7 @@ void TasksModel::Private::initModels()
}
if (appsMatch(sourceIndex, filterIndex)) {
filterProxyModel->dataChanged(filterIndex, filterIndex);
Q_EMIT filterProxyModel->dataChanged(filterIndex, filterIndex);
}
}
}
......@@ -528,8 +528,8 @@ void TasksModel::Private::initLauncherTasksModel()
// to-be-removed launcherTasksModel rows using TaskTools::appsMatch().
QObject::connect(launcherTasksModel, &LauncherTasksModel::launcherListChanged,
q, [this]() {
q->dataChanged(q->index(0, 0), q->index(q->rowCount() - 1, 0),
QVector<int>{AbstractTasksModel::HasLauncher});
Q_EMIT q->dataChanged(q->index(0, 0), q->index(q->rowCount() - 1, 0),
QVector<int>{AbstractTasksModel::HasLauncher});
}
);
......@@ -542,7 +542,7 @@ void TasksModel::Private::initLauncherTasksModel()
const QModelIndex &index = q->index(i, 0);
if (!index.data(AbstractTasksModel::IsLauncher).toBool()) {
q->dataChanged(index, index, QVector<int>{AbstractTasksModel::HasLauncher});
Q_EMIT q->dataChanged(index, index, QVector<int>{AbstractTasksModel::HasLauncher});
}
}
}
......
......@@ -244,7 +244,7 @@ QUrl windowUrlFromMetadata(const QString &appId, quint32 pid,
return;
}
for (const auto service : services) {
for (const auto &service : services) {
if (service->menuId().startsWith(key, Qt::CaseInsensitive)) {
services.prepend(service);
return;
......
......@@ -114,12 +114,12 @@ void XWindowTasksModel::Private::init()
appDataCache.clear();
// Emit changes of all roles satisfied from app data cache.
q->dataChanged(q->index(0, 0), q->index(windows.count() - 1, 0),
QVector<int>{Qt::DecorationRole, AbstractTasksModel::AppId,
AbstractTasksModel::AppName, AbstractTasksModel::GenericName,
AbstractTasksModel::LauncherUrl,
AbstractTasksModel::LauncherUrlWithoutIcon,
AbstractTasksModel::SkipTaskbar});
Q_EMIT q->dataChanged(q->index(0, 0), q->index(windows.count() - 1, 0),
QVector<int>{Qt::DecorationRole, AbstractTasksModel::AppId,
AbstractTasksModel::AppName, AbstractTasksModel::GenericName,
AbstractTasksModel::LauncherUrl,
AbstractTasksModel::LauncherUrlWithoutIcon,
AbstractTasksModel::SkipTaskbar});
};
cachedStackingOrder = KWindowSystem::stackingOrder();
......@@ -200,8 +200,8 @@ void XWindowTasksModel::Private::init()
QObject::connect(KWindowSystem::self(), &KWindowSystem::stackingOrderChanged, q,
[this]() {
cachedStackingOrder = KWindowSystem::stackingOrder();
q->dataChanged(q->index(0, 0), q->index(q->rowCount() - 1, 0),
QVector<int>{StackingOrder});
Q_EMIT q->dataChanged(q->index(0, 0), q->index(q->rowCount() - 1, 0),
QVector<int>{StackingOrder});
}
);
......
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