Make it possible to disable filter-bypass by demands-attention tasks.

Summary:
Tasks which demand attention usually bypass the filters by activity
and desktop, i.e. the Task Manager will show a window that's
demanding attention even when filtering is enabled and we're on a
different activity or desktop.

This behavior is however not suitable for the Pager, which shouldn't
show windows demanding attention on all workspace delegates. This
patch adds a prop that allows the Pager to disable the filter bypass.

Reviewers: #plasma, davidedmundson

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D2802
wilder-5.14
Eike Hein 10 years ago
parent 587178df2b
commit 1c0593f8ec
  1. 22
      libtaskmanager/taskfilterproxymodel.cpp
  2. 21
      libtaskmanager/taskfilterproxymodel.h

@ -42,6 +42,8 @@ public:
bool filterSkipTaskbar = true;
bool filterSkipPager = false;
bool demandingAttentionSkipsFilters = true;
private:
TaskFilterProxyModel *q;
};
@ -218,6 +220,22 @@ void TaskFilterProxyModel::setFilterSkipPager(bool filter)
}
}
bool TaskFilterProxyModel::demandingAttentionSkipsFilters() const
{
return d->demandingAttentionSkipsFilters;
}
void TaskFilterProxyModel::setDemandingAttentionSkipsFilters(bool skip)
{
if (d->demandingAttentionSkipsFilters != skip) {
d->demandingAttentionSkipsFilters = skip;
invalidateFilter();
emit demandingAttentionSkipsFiltersChanged();
}
}
QModelIndex TaskFilterProxyModel::mapIfaceToSource(const QModelIndex &index) const
{
return mapToSource(index);
@ -242,7 +260,7 @@ bool TaskFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &so
// Filter by virtual desktop.
if (d->filterByVirtualDesktop && d->virtualDesktop != 0) {
if (!sourceIdx.data(AbstractTasksModel::IsOnAllVirtualDesktops).toBool()
&& !sourceIdx.data(AbstractTasksModel::IsDemandingAttention).toBool()) {
&& (!d->demandingAttentionSkipsFilters || !sourceIdx.data(AbstractTasksModel::IsDemandingAttention).toBool())) {
const QVariant &virtualDesktop = sourceIdx.data(AbstractTasksModel::VirtualDesktop);
if (!virtualDesktop.isNull()) {
@ -267,7 +285,7 @@ bool TaskFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &so
// Filter by activity.
if (d->filterByActivity && !d->activity.isEmpty()) {
if (!sourceIdx.data(AbstractTasksModel::IsDemandingAttention).toBool()) {
if (!d->demandingAttentionSkipsFilters || !sourceIdx.data(AbstractTasksModel::IsDemandingAttention).toBool()) {
const QVariant &activities = sourceIdx.data(AbstractTasksModel::Activities);
if (!activities.isNull()) {

@ -56,6 +56,8 @@ class TASKMANAGER_EXPORT TaskFilterProxyModel : public QSortFilterProxyModel, pu
Q_PROPERTY(bool filterSkipTaskbar READ filterSkipTaskbar WRITE setFilterSkipTaskbar NOTIFY filterSkipTaskbarChanged)
Q_PROPERTY(bool filterSkipPager READ filterSkipPager WRITE setFilterSkipPager NOTIFY filterSkipPagerChanged)
Q_PROPERTY(bool demandingAttentionSkipsFilters READ demandingAttentionSkipsFilters WRITE setDemandingAttentionSkipsFilters NOTIFY demandingAttentionSkipsFiltersChanged)
public:
explicit TaskFilterProxyModel(QObject *parent = 0);
virtual ~TaskFilterProxyModel();
@ -251,6 +253,24 @@ public:
**/
void setFilterSkipPager(bool filter);
/**
* Whether tasks which demand attention skip filters by virtual desktop
* or activity. Defaults to @c true.
*
* @see setDemandingAttentionSkipsFilters
* @returns @c true if tasks which demand attention skip filters.
**/
bool demandingAttentionSkipsFilters() const;
/**
* Sets whether tasks which demand attention should bypass filters by
* virtual desktop or activity.
*
* @see demandingAttentionSkipsFilters
* @param skip Whether tasks which demand attention should skip filters.
**/
void setDemandingAttentionSkipsFilters(bool skip);
Q_SIGNALS:
void virtualDesktopChanged() const;
void screenGeometryChanged() const;
@ -261,6 +281,7 @@ Q_SIGNALS:
void filterNotMinimizedChanged() const;
void filterSkipTaskbarChanged() const;
void filterSkipPagerChanged() const;
void demandingAttentionSkipsFiltersChanged() const;
protected:
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;

Loading…
Cancel
Save