Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit c81205cc authored by Eike Hein's avatar Eike Hein

Do ignore-filtered-siblings properly

Summary:
Turns out c8358c20 only worked accidentally. We can't do this
via filterModel->mapFromSource, because in a lambda connected to
its source model's rowsInserted signal, the proxy hasn't seen that
row yet.

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D15462
parent a057edc7
......@@ -239,12 +239,14 @@ QModelIndex TaskFilterProxyModel::mapIfaceToSource(const QModelIndex &index) con
return mapToSource(index);
}
bool TaskFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
bool TaskFilterProxyModel::acceptsRow(int sourceRow) const
{
Q_UNUSED(sourceParent)
const QModelIndex &sourceIdx = sourceModel()->index(sourceRow, 0);
if (!sourceIdx.isValid()) {
return false;
}
// Filter tasks that are not to be shown on the task bar.
if (d->filterSkipTaskbar && sourceIdx.data(AbstractTasksModel::SkipTaskbar).toBool()) {
return false;
......@@ -308,4 +310,11 @@ bool TaskFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &so
return true;
}
bool TaskFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
{
Q_UNUSED(sourceParent)
return acceptsRow(sourceRow);
}
}
......@@ -271,6 +271,13 @@ public:
**/
void setDemandingAttentionSkipsFilters(bool skip);
/**
* Returns whether the filter model accepts this source row.
*
* @param int A row in the source model.
*/
bool acceptsRow(int sourceRow) const;
Q_SIGNALS:
void virtualDesktopChanged() const;
void screenGeometryChanged() const;
......
......@@ -626,16 +626,9 @@ void TasksModel::Private::updateManualSortMap()
for (int i = (row - 1); i >= 0; --i) {
const QModelIndex &concatProxyIndex = concatProxyModel->index(sortedPreFilterRows.at(i), 0);
if (appsMatch(concatProxyIndex, idx)) {
// Our sort map contains row indices prior to any filtering, but we don't
// want to sort new tasks in next to siblings we're filtering out higher up
// in the proxy chain, so check in with the filter model.
const QModelIndex &filterProxyIndex = filterProxyModel->mapFromSource(concatProxyIndex);
if (filterProxyIndex.isValid()) {
if (appsMatch(concatProxyIndex, idx) && filterProxyModel->acceptsRow(concatProxyIndex.row())) {
sortedPreFilterRows.move(row, i + 1);
moved = true;
}
break;
}
......
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