File indexing completed on 2024-05-05 05:38:34

0001 /*
0002     SPDX-FileCopyrightText: 2016 Eike Hein <hein@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #pragma once
0008 
0009 #include <QObject>
0010 
0011 #include "abstracttasksmodeliface.h"
0012 #include "taskmanager_export.h"
0013 
0014 namespace TaskManager
0015 {
0016 /**
0017  * @short Pure method interface for tasks model implementations.
0018  *
0019  * This is the pure method interface implemented by AbstractTasksModel,
0020  * as well as other model classes in this library which cannot inherit from
0021  * AbstractTasksModel.
0022  *
0023  * @author Eike Hein <hein@kde.org>
0024  **/
0025 
0026 class TASKMANAGER_EXPORT AbstractTasksProxyModelIface : public AbstractTasksModelIface
0027 {
0028 public:
0029     ~AbstractTasksProxyModelIface() override
0030     {
0031     }
0032 
0033     /**
0034      * Request activation of the task at the given index. Implementing classes
0035      * are free to interpret the meaning of "activate" themselves depending on
0036      * the nature and state of the task, e.g. launch or raise a window task.
0037      *
0038      * @param index An index in this tasks model.
0039      **/
0040     void requestActivate(const QModelIndex &index) override;
0041 
0042     /**
0043      * Request an additional instance of the application backing the task
0044      * at the given index.
0045      *
0046      * @param index An index in this tasks model.
0047      **/
0048     void requestNewInstance(const QModelIndex &index) override;
0049 
0050     /**
0051      * Requests to open the given URLs with the application backing the task
0052      * at the given index.
0053      *
0054      * @param index An index in this tasks model.
0055      * @param urls The URLs to be passed to the application.
0056      **/
0057     void requestOpenUrls(const QModelIndex &index, const QList<QUrl> &urls) override;
0058 
0059     /**
0060      * Request the task at the given index be closed.
0061      *
0062      * @param index An index in this tasks model.
0063      **/
0064     void requestClose(const QModelIndex &index) override;
0065 
0066     /**
0067      * Request starting an interactive move for the task at the given index.
0068      *
0069      * This is meant for tasks that have an associated window, and may be
0070      * a no-op when there is no window.
0071      *
0072      * @param index An index in this tasks model.
0073      **/
0074     void requestMove(const QModelIndex &index) override;
0075 
0076     /**
0077      * Request starting an interactive resize for the task at the given index.
0078      *
0079      * This is meant for tasks that have an associated window, and may be a
0080      * no-op when there is no window.
0081      *
0082      * @param index An index in this tasks model.
0083      **/
0084     void requestResize(const QModelIndex &index) override;
0085 
0086     /**
0087      * Request toggling the minimized state of the task at the given index.
0088      *
0089      * This is meant for tasks that have an associated window, and may be
0090      * a no-op when there is no window.
0091      *
0092      * @param index An index in this tasks model.
0093      **/
0094     void requestToggleMinimized(const QModelIndex &index) override;
0095 
0096     /**
0097      * Request toggling the maximized state of the task at the given index.
0098      *
0099      * This is meant for tasks that have an associated window, and may be
0100      * a no-op when there is no window.
0101      *
0102      * @param index An index in this tasks model.
0103      **/
0104     void requestToggleMaximized(const QModelIndex &index) override;
0105 
0106     /**
0107      * Request toggling the keep-above state of the task at the given index.
0108      *
0109      * This is meant for tasks that have an associated window, and may be
0110      * a no-op when there is no window.
0111      *
0112      * @param index An index in this tasks model.
0113      **/
0114     void requestToggleKeepAbove(const QModelIndex &index) override;
0115 
0116     /**
0117      * Request toggling the keep-below state of the task at the given index.
0118      *
0119      * This is meant for tasks that have an associated window, and may be
0120      * a no-op when there is no window.
0121      *
0122      * @param index An index in this tasks model.
0123      **/
0124     void requestToggleKeepBelow(const QModelIndex &index) override;
0125 
0126     /**
0127      * Request toggling the fullscreen state of the task at the given index.
0128      *
0129      * This is meant for tasks that have an associated window, and may be
0130      * a no-op when there is no window.
0131      *
0132      * @param index An index in this tasks model.
0133      **/
0134     void requestToggleFullScreen(const QModelIndex &index) override;
0135 
0136     /**
0137      * Request toggling the shaded state of the task at the given index.
0138      *
0139      * This is meant for tasks that have an associated window, and may be
0140      * a no-op when there is no window.
0141      *
0142      * @param index An index in this tasks model.
0143      **/
0144     void requestToggleShaded(const QModelIndex &index) override;
0145 
0146     /**
0147      * Request entering the window at the given index on the specified virtual desktops,
0148      * leaving any other desktops.
0149      *
0150      * On Wayland, virtual desktop ids are QStrings. On X11, they are uint >0.
0151      *
0152      * An empty list has a special meaning: The window is entered on all virtual desktops
0153      * in the session.
0154      *
0155      * On X11, a window can only be on one or all virtual desktops. Therefore, only the
0156      * first list entry is actually used.
0157      *
0158      * On X11, the id 0 has a special meaning: The window is entered on all virtual
0159      * desktops in the session.
0160      *
0161      * @param index An index in this window tasks model.
0162      * @param desktops A list of virtual desktop ids.
0163      **/
0164     void requestVirtualDesktops(const QModelIndex &index, const QVariantList &desktops) override;
0165 
0166     /**
0167      * Request entering the window at the given index on a new virtual desktop,
0168      * which is created in response to this request.
0169      *
0170      * @param index An index in this window tasks model.
0171      **/
0172     void requestNewVirtualDesktop(const QModelIndex &index) override;
0173 
0174     /**
0175      * Request moving the task at the given index to the specified activities.
0176      *
0177      * This is meant for tasks that have an associated window, and may be
0178      * a no-op when there is no window.
0179      *
0180      * @param index An index in this tasks model.
0181      * @param activities The new list of activities.
0182      **/
0183     void requestActivities(const QModelIndex &index, const QStringList &activities) override;
0184 
0185     /**
0186      * Request informing the window manager of new geometry for a visual
0187      * delegate for the task at the given index. The geometry should be in
0188      * screen coordinates.
0189      *
0190      * @param index An index in this tasks model.
0191      * @param geometry Visual delegate geometry in screen coordinates.
0192      * @param delegate The delegate. Implementations are on their own with
0193      * regard to extracting information from this, and should take care to
0194      * reject invalid objects.
0195      **/
0196     void requestPublishDelegateGeometry(const QModelIndex &index, const QRect &geometry, QObject *delegate = nullptr) override;
0197 
0198 protected:
0199     /*
0200      * Map the passed QModelIndex to the source model index
0201      * so that AbstractTasksModelIface methods can be passed on
0202      * Subclasses should override this.
0203      */
0204     virtual QModelIndex mapIfaceToSource(const QModelIndex &index) const = 0;
0205 };
0206 
0207 }