1 /* 2 SPDX-FileCopyrightText: 2016 Eike Hein <hein@kde.org> 3 4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 5 */ 6 7 #pragma once 8 9 #include <QObject> 10 11 #include "abstracttasksmodeliface.h" 12 #include "taskmanager_export.h" 13 14 namespace TaskManager 15 { 16 /** 17 * @short Pure method interface for tasks model implementations. 18 * 19 * This is the pure method interface implemented by AbstractTasksModel, 20 * as well as other model classes in this library which cannot inherit from 21 * AbstractTasksModel. 22 * 23 * @author Eike Hein <hein@kde.org> 24 **/ 25 26 class TASKMANAGER_EXPORT AbstractTasksProxyModelIface : public AbstractTasksModelIface 27 { 28 public: ~AbstractTasksProxyModelIface()29 ~AbstractTasksProxyModelIface() override 30 { 31 } 32 33 /** 34 * Request activation of the task at the given index. Implementing classes 35 * are free to interpret the meaning of "activate" themselves depending on 36 * the nature and state of the task, e.g. launch or raise a window task. 37 * 38 * @param index An index in this tasks model. 39 **/ 40 void requestActivate(const QModelIndex &index) override; 41 42 /** 43 * Request an additional instance of the application backing the task 44 * at the given index. 45 * 46 * @param index An index in this tasks model. 47 **/ 48 void requestNewInstance(const QModelIndex &index) override; 49 50 /** 51 * Requests to open the given URLs with the application backing the task 52 * at the given index. 53 * 54 * @param index An index in this tasks model. 55 * @param urls The URLs to be passed to the application. 56 **/ 57 void requestOpenUrls(const QModelIndex &index, const QList<QUrl> &urls) override; 58 59 /** 60 * Request the task at the given index be closed. 61 * 62 * @param index An index in this tasks model. 63 **/ 64 void requestClose(const QModelIndex &index) override; 65 66 /** 67 * Request starting an interactive move for the task at the given index. 68 * 69 * This is meant for tasks that have an associated window, and may be 70 * a no-op when there is no window. 71 * 72 * @param index An index in this tasks model. 73 **/ 74 void requestMove(const QModelIndex &index) override; 75 76 /** 77 * Request starting an interactive resize for the task at the given index. 78 * 79 * This is meant for tasks that have an associated window, and may be a 80 * no-op when there is no window. 81 * 82 * @param index An index in this tasks model. 83 **/ 84 void requestResize(const QModelIndex &index) override; 85 86 /** 87 * Request toggling the minimized state of the task at the given index. 88 * 89 * This is meant for tasks that have an associated window, and may be 90 * a no-op when there is no window. 91 * 92 * @param index An index in this tasks model. 93 **/ 94 void requestToggleMinimized(const QModelIndex &index) override; 95 96 /** 97 * Request toggling the maximized state of the task at the given index. 98 * 99 * This is meant for tasks that have an associated window, and may be 100 * a no-op when there is no window. 101 * 102 * @param index An index in this tasks model. 103 **/ 104 void requestToggleMaximized(const QModelIndex &index) override; 105 106 /** 107 * Request toggling the keep-above state of the task at the given index. 108 * 109 * This is meant for tasks that have an associated window, and may be 110 * a no-op when there is no window. 111 * 112 * @param index An index in this tasks model. 113 **/ 114 void requestToggleKeepAbove(const QModelIndex &index) override; 115 116 /** 117 * Request toggling the keep-below state of the task at the given index. 118 * 119 * This is meant for tasks that have an associated window, and may be 120 * a no-op when there is no window. 121 * 122 * @param index An index in this tasks model. 123 **/ 124 void requestToggleKeepBelow(const QModelIndex &index) override; 125 126 /** 127 * Request toggling the fullscreen state of the task at the given index. 128 * 129 * This is meant for tasks that have an associated window, and may be 130 * a no-op when there is no window. 131 * 132 * @param index An index in this tasks model. 133 **/ 134 void requestToggleFullScreen(const QModelIndex &index) override; 135 136 /** 137 * Request toggling the shaded state of the task at the given index. 138 * 139 * This is meant for tasks that have an associated window, and may be 140 * a no-op when there is no window. 141 * 142 * @param index An index in this tasks model. 143 **/ 144 void requestToggleShaded(const QModelIndex &index) override; 145 146 /** 147 * Request entering the window at the given index on the specified virtual desktops, 148 * leaving any other desktops. 149 * 150 * On Wayland, virtual desktop ids are QStrings. On X11, they are uint >0. 151 * 152 * An empty list has a special meaning: The window is entered on all virtual desktops 153 * in the session. 154 * 155 * On X11, a window can only be on one or all virtual desktops. Therefore, only the 156 * first list entry is actually used. 157 * 158 * On X11, the id 0 has a special meaning: The window is entered on all virtual 159 * desktops in the session. 160 * 161 * @param index An index in this window tasks model. 162 * @param desktops A list of virtual desktop ids. 163 **/ 164 void requestVirtualDesktops(const QModelIndex &index, const QVariantList &desktops) override; 165 166 /** 167 * Request entering the window at the given index on a new virtual desktop, 168 * which is created in response to this request. 169 * 170 * @param index An index in this window tasks model. 171 **/ 172 void requestNewVirtualDesktop(const QModelIndex &index) override; 173 174 /** 175 * Request moving the task at the given index to the specified activities. 176 * 177 * This is meant for tasks that have an associated window, and may be 178 * a no-op when there is no window. 179 * 180 * @param index An index in this tasks model. 181 * @param activities The new list of activities. 182 **/ 183 void requestActivities(const QModelIndex &index, const QStringList &activities) override; 184 185 /** 186 * Request informing the window manager of new geometry for a visual 187 * delegate for the task at the given index. The geometry should be in 188 * screen coordinates. 189 * 190 * @param index An index in this tasks model. 191 * @param geometry Visual delegate geometry in screen coordinates. 192 * @param delegate The delegate. Implementations are on their own with 193 * regard to extracting information from this, and should take care to 194 * reject invalid objects. 195 **/ 196 void requestPublishDelegateGeometry(const QModelIndex &index, const QRect &geometry, QObject *delegate = nullptr) override; 197 198 protected: 199 /* 200 * Map the passed QModelIndex to the source model index 201 * so that AbstractTasksModelIface methods can be passed on 202 * Subclasses should override this. 203 */ 204 virtual QModelIndex mapIfaceToSource(const QModelIndex &index) const = 0; 205 }; 206 207 } 208