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

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