/usr/include/taskmanager/taskgroupingproxymodel.h is in plasma-workspace-dev 4:5.12.4-0ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 | /********************************************************************
Copyright 2016 Eike Hein <hein.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) version 3, or any
later version accepted by the membership of KDE e.V. (or its
successor approved by the membership of KDE e.V.), which shall
act as a proxy defined in Section 6 of version 3 of the license.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#ifndef TASKGROUPINGPROXYMODEL_H
#define TASKGROUPINGPROXYMODEL_H
#include <QAbstractProxyModel>
#include "abstracttasksmodeliface.h"
#include "tasksmodel.h"
#include "taskmanager_export.h"
namespace TaskManager
{
/**
* @short A proxy tasks model for grouping tasks, forming a tree.
*
* This proxy model groups tasks in its source tasks model, forming a tree
* of tasks. Gouping behavior is influenced by various properties set on
* the proxy model instance.
*
* @author Eike Hein <hein@kde.org>
**/
class TASKMANAGER_EXPORT TaskGroupingProxyModel : public QAbstractProxyModel, public AbstractTasksModelIface
{
Q_OBJECT
Q_PROPERTY(TasksModel::GroupMode groupMode READ groupMode WRITE setGroupMode NOTIFY groupModeChanged)
Q_PROPERTY(bool groupDemandingAttention READ groupDemandingAttention WRITE setGroupDemandingAttention
NOTIFY groupDemandingAttentionChanged)
Q_PROPERTY(int windowTasksThreshold READ windowTasksThreshold WRITE setWindowTasksThreshold NOTIFY windowTasksThresholdChanged)
Q_PROPERTY(QStringList blacklistedAppIds READ blacklistedAppIds WRITE setBlacklistedAppIds NOTIFY blacklistedAppIdsChanged)
Q_PROPERTY(QStringList blacklistedLauncherUrls READ blacklistedLauncherUrls WRITE setBlacklistedLauncherUrls
NOTIFY blacklistedLauncherUrlsChanged)
public:
explicit TaskGroupingProxyModel(QObject *parent = 0);
virtual ~TaskGroupingProxyModel();
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
QModelIndex parent(const QModelIndex &child) const override;
QModelIndex mapFromSource(const QModelIndex &sourceIndex) const override;
QModelIndex mapToSource(const QModelIndex &proxyIndex) const override;
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
bool hasChildren(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &proxyIndex, int role) const override;
void setSourceModel(QAbstractItemModel *sourceModel) override;
/**
* Returns the current group mode, i.e. the criteria by which tasks should
* be grouped.
*
* Defaults to TasksModel::GroupApplication, which groups tasks backed by
* the same application.
*
* If the group mode is TasksModel::GroupDisabled, no grouping is done.
*
* @see TasksModel
* @see setGroupMode
* @returns the active group mode.
**/
TasksModel::GroupMode groupMode() const;
/**
* Sets the group mode, i.e. the criteria by which tasks should be grouped.
*
* The group mode can be set to TasksModel::GroupDisabled to disable grouping
* entirely, breaking apart any existing groups.
*
* @see TasksModel
* @see groupMode
* @param mode A TasksModel group mode.
**/
void setGroupMode(TasksModel::GroupMode mode);
/**
* Whether new tasks which demand attention
* (AbstractTasksModel::IsDemandingAttention) should be grouped immediately,
* or only once they have stopped demanding attention. Defaults to @c false.
*
* @see setGroupDemandingAttention
* @returns whether tasks which demand attention are grouped immediately.
**/
bool groupDemandingAttention() const;
/**
* Sets whether new tasks which demand attention
* (AbstractTasksModel::IsDemandingAttention) should be grouped immediately,
* or only once they have stopped demanding attention.
*
* @see groupDemandingAttention
* @param group Whether tasks with demand attention should be grouped immediately.
**/
void setGroupDemandingAttention(bool group);
/**
* As window tasks (AbstractTasksModel::IsWindow) come and go in the source
* model, groups will be formed when this threshold value is exceeded, and
* broken apart when it matches or falls below.
*
* Defaults to @c -1, which means grouping is done regardless of the number
* of window tasks in the source model.
*
* @see setWindowTasksThreshold
* @return the threshold number of source window tasks used in grouping
* decisions.
**/
int windowTasksThreshold() const;
/**
* Sets the number of source model window tasks (AbstractTasksModel::IsWindow)
* above which groups will be formed, and at or below which groups will be broken
* apart.
*
* If set to -1, grouping will be done regardless of the number of window tasks
* in the source model.
*
* @see windowTasksThreshold
* @param threshold A threshold number of source window tasks used in grouping
* decisions.
**/
void setWindowTasksThreshold(int threshold);
/**
* A blacklist of app ids (AbstractTasksModel::AppId) that is consulted before
* grouping a task. If a task's app id is found on the blacklist, it is not
* grouped.
*
* The default app id blacklist is empty.
*
* @see setBlacklistedAppIds
* @returns the blacklist of app ids consulted before grouping a task.
**/
QStringList blacklistedAppIds() const;
/**
* Sets the blacklist of app ids (AbstractTasksModel::AppId) that is consulted
* before grouping a task. If a task's app id is found on the blacklist, it is
* not grouped.
*
* When set, groups will be formed and broken apart as necessary.
*
* @see blacklistedAppIds
* @param list a blacklist of app ids to be consulted before grouping a task.
**/
void setBlacklistedAppIds(const QStringList &list);
/**
* A blacklist of launcher URLs (AbstractTasksModel::LauncherUrl) that is
* consulted before grouping a task. If a task's launcher URL is found on the
* blacklist, it is not grouped.
*
* The default launcher URL blacklist is empty.
*
* @see setBlacklistedLauncherUrls
* @returns the blacklist of launcher URLs consulted before grouping a task.
**/
QStringList blacklistedLauncherUrls() const;
/**
* Sets the blacklist of launcher URLs (AbstractTasksModel::LauncherUrl) that
* is consulted before grouping a task. If a task's launcher URL is found on
* the blacklist, it is not grouped.
*
* When set, groups will be formed and broken apart as necessary.
*
* @see blacklistedLauncherUrls
* @param list a blacklist of launcher URLs to be consulted before grouping a task.
**/
void setBlacklistedLauncherUrls(const QStringList &list);
/**
* Request activation of the task at the given index. Derived classes are
* free to interpret the meaning of "activate" themselves depending on
* the nature and state of the task, e.g. launch or raise a window task.
*
* @param index An index in this tasks model.
**/
void requestActivate(const QModelIndex &index) override;
/**
* Request an additional instance of the application backing the task
* at the given index.
*
* @param index An index in this tasks model.
**/
void requestNewInstance(const QModelIndex &index) override;
/**
* Requests to open the given URLs with the application backing the task
* at the given index.
*
* @param index An index in this tasks model.
* @param urls The URLs to be passed to the application.
**/
void requestOpenUrls(const QModelIndex &index, const QList<QUrl> &urls) override;
/**
* Request the task at the given index be closed.
*
* @param index An index in this tasks model.
**/
void requestClose(const QModelIndex &index) override;
/**
* Request starting an interactive move for the task at the given index.
*
* This is meant for tasks that have an associated window, and may be
* a no-op when there is no window.
*
* This base implementation does nothing.
*
* @param index An index in this tasks model.
**/
void requestMove(const QModelIndex &index) override;
/**
* Request starting an interactive resize for the task at the given index.
*
* This is meant for tasks that have an associated window, and may be a
* no-op when there is no window.
*
* @param index An index in this tasks model.
**/
void requestResize(const QModelIndex &index) override;
/**
* Request toggling the minimized state of the task at the given index.
*
* This is meant for tasks that have an associated window, and may be
* a no-op when there is no window.
*
* This base implementation does nothing.
*
* @param index An index in this tasks model.
**/
void requestToggleMinimized(const QModelIndex &index) override;
/**
* Request toggling the maximized state of the task at the given index.
*
* This is meant for tasks that have an associated window, and may be
* a no-op when there is no window.
*
* @param index An index in this tasks model.
**/
void requestToggleMaximized(const QModelIndex &index) override;
/**
* Request toggling the keep-above state of the task at the given index.
*
* This is meant for tasks that have an associated window, and may be
* a no-op when there is no window.
*
* @param index An index in this tasks model.
**/
void requestToggleKeepAbove(const QModelIndex &index) override;
/**
* Request toggling the keep-below state of the task at the given index.
*
* This is meant for tasks that have an associated window, and may be
* a no-op when there is no window.
*
* @param index An index in this tasks model.
**/
void requestToggleKeepBelow(const QModelIndex &index) override;
/**
* Request toggling the fullscreen state of the task at the given index.
*
* This is meant for tasks that have an associated window, and may be
* a no-op when there is no window.
*
* This base implementation does nothing.
*
* @param index An index in this tasks model.
**/
void requestToggleFullScreen(const QModelIndex &index) override;
/**
* Request toggling the shaded state of the task at the given index.
*
* This is meant for tasks that have an associated window, and may be
* a no-op when there is no window.
*
* @param index An index in this tasks model.
**/
void requestToggleShaded(const QModelIndex &index) override;
/**
* Request moving the task at the given index to the specified virtual
* desktop.
*
* This is meant for tasks that have an associated window, and may be
* a no-op when there is no window.
*
* @param index An index in this tasks model.
* @param desktop A virtual desktop number.
**/
void requestVirtualDesktop(const QModelIndex &index, qint32 desktop) override;
/**
* Request moving the task at the given index to the specified activities.
*
* This is meant for tasks that have an associated window, and may be
* a no-op when there is no window.
*
* This base implementation does nothing.
*
* @param index An index in this tasks model.
* @param activities The new list of activities.
**/
virtual void requestActivities(const QModelIndex &index, const QStringList &activities) override;
/**
* Request informing the window manager of new geometry for a visual
* delegate for the task at the given index. The geometry should be in
* screen coordinates.
*
* If the task at the given index is a group parent, the geometry is
* set for all of its children. If the task at the given index is a
* group member, the geometry is set for all of its siblings.
*
* @param index An index in this tasks model.
* @param geometry Visual delegate geometry in screen coordinates.
* @param delegate The delegate. Implementations are on their own with
* regard to extracting information from this, and should take care to
* reject invalid objects.
**/
void requestPublishDelegateGeometry(const QModelIndex &index, const QRect &geometry,
QObject *delegate = nullptr) override;
/**
* Request toggling whether the task at the given index, along with any
* tasks matching its kind, should be grouped or not. Task groups will be
* formed or broken apart as needed, along with affecting future grouping
* decisions as new tasks appear in the source model.
*
* As grouping is toggled for a task, updates are made to the blacklisted*
* properties of the model instance.
*
* @see blacklistedAppIds
* @see blacklistedLauncherUrls
*
* @param index An index in this tasks model.
**/
void requestToggleGrouping(const QModelIndex &index);
Q_SIGNALS:
void groupModeChanged() const;
void groupDemandingAttentionChanged() const;
void windowTasksThresholdChanged() const;
void blacklistedAppIdsChanged() const;
void blacklistedLauncherUrlsChanged() const;
private:
class Private;
QScopedPointer<Private> d;
Q_PRIVATE_SLOT(d, void sourceRowsAboutToBeInserted(const QModelIndex &parent, int first, int last))
Q_PRIVATE_SLOT(d, void sourceRowsInserted(const QModelIndex &parent, int start, int end))
Q_PRIVATE_SLOT(d, void sourceRowsAboutToBeRemoved(const QModelIndex &parent, int first, int last))
Q_PRIVATE_SLOT(d, void sourceRowsRemoved(const QModelIndex &parent, int start, int end))
Q_PRIVATE_SLOT(d, void sourceModelAboutToBeReset())
Q_PRIVATE_SLOT(d, void sourceModelReset())
Q_PRIVATE_SLOT(d, void sourceDataChanged(QModelIndex,QModelIndex,QVector<int>))
};
}
#endif
|