Plasma-workspace

abstracttasksproxymodeliface.cpp
1/*
2 SPDX-FileCopyrightText: 2016 David Edmundson <davidedmundson@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5*/
6
7#include "abstracttasksproxymodeliface.h"
8
9#include <QAbstractItemModel>
10#include <QModelIndex>
11
12namespace TaskManager
13{
15{
16 if (!index.isValid()) {
17 return;
18 }
19
20 const QModelIndex &sourceIndex = mapIfaceToSource(index);
21 const AbstractTasksModelIface *m = dynamic_cast<const AbstractTasksModelIface *>(sourceIndex.model());
22
23 if (m) {
24 const_cast<AbstractTasksModelIface *>(m)->requestActivate(sourceIndex);
25 }
26}
27
29{
30 if (!index.isValid()) {
31 return;
32 }
33
34 const QModelIndex &sourceIndex = mapIfaceToSource(index);
35 const AbstractTasksModelIface *m = dynamic_cast<const AbstractTasksModelIface *>(sourceIndex.model());
36
37 if (m) {
38 const_cast<AbstractTasksModelIface *>(m)->requestNewInstance(sourceIndex);
39 }
40}
41
43{
44 if (!index.isValid()) {
45 return;
46 }
47
48 const QModelIndex &sourceIndex = mapIfaceToSource(index);
49 const AbstractTasksModelIface *m = dynamic_cast<const AbstractTasksModelIface *>(sourceIndex.model());
50
51 if (m) {
52 const_cast<AbstractTasksModelIface *>(m)->requestOpenUrls(sourceIndex, urls);
53 }
54}
55
57{
58 if (!index.isValid()) {
59 return;
60 }
61
62 const QModelIndex &sourceIndex = mapIfaceToSource(index);
63 const AbstractTasksModelIface *m = dynamic_cast<const AbstractTasksModelIface *>(sourceIndex.model());
64
65 if (m) {
66 const_cast<AbstractTasksModelIface *>(m)->requestClose(sourceIndex);
67 }
68}
70{
71 if (!index.isValid()) {
72 return;
73 }
74
75 const QModelIndex &sourceIndex = mapIfaceToSource(index);
76 const AbstractTasksModelIface *m = dynamic_cast<const AbstractTasksModelIface *>(sourceIndex.model());
77
78 if (m) {
79 const_cast<AbstractTasksModelIface *>(m)->requestMove(sourceIndex);
80 }
81}
82
84{
85 if (!index.isValid()) {
86 return;
87 }
88
89 const QModelIndex &sourceIndex = mapIfaceToSource(index);
90 const AbstractTasksModelIface *m = dynamic_cast<const AbstractTasksModelIface *>(sourceIndex.model());
91
92 if (m) {
93 const_cast<AbstractTasksModelIface *>(m)->requestResize(sourceIndex);
94 }
95}
96
98{
99 if (!index.isValid()) {
100 return;
101 }
102
103 const QModelIndex &sourceIndex = mapIfaceToSource(index);
104 const AbstractTasksModelIface *m = dynamic_cast<const AbstractTasksModelIface *>(sourceIndex.model());
105
106 if (m) {
107 const_cast<AbstractTasksModelIface *>(m)->requestToggleMinimized(sourceIndex);
108 }
109}
110
112{
113 if (!index.isValid()) {
114 return;
115 }
116
117 const QModelIndex &sourceIndex = mapIfaceToSource(index);
118 const AbstractTasksModelIface *m = dynamic_cast<const AbstractTasksModelIface *>(sourceIndex.model());
119
120 if (m) {
121 const_cast<AbstractTasksModelIface *>(m)->requestToggleMaximized(sourceIndex);
122 }
123}
124
126{
127 if (!index.isValid()) {
128 return;
129 }
130
131 const QModelIndex &sourceIndex = mapIfaceToSource(index);
132 const AbstractTasksModelIface *m = dynamic_cast<const AbstractTasksModelIface *>(sourceIndex.model());
133
134 if (m) {
135 const_cast<AbstractTasksModelIface *>(m)->requestToggleKeepAbove(sourceIndex);
136 }
137}
138
140{
141 if (!index.isValid()) {
142 return;
143 }
144
145 const QModelIndex &sourceIndex = mapIfaceToSource(index);
146 const AbstractTasksModelIface *m = dynamic_cast<const AbstractTasksModelIface *>(sourceIndex.model());
147
148 if (m) {
149 const_cast<AbstractTasksModelIface *>(m)->requestToggleKeepBelow(sourceIndex);
150 }
151}
152
154{
155 if (!index.isValid()) {
156 return;
157 }
158
159 const QModelIndex &sourceIndex = mapIfaceToSource(index);
160 const AbstractTasksModelIface *m = dynamic_cast<const AbstractTasksModelIface *>(sourceIndex.model());
161
162 if (m) {
163 const_cast<AbstractTasksModelIface *>(m)->requestToggleFullScreen(sourceIndex);
164 }
165}
166
168{
169 if (!index.isValid()) {
170 return;
171 }
172
173 const QModelIndex &sourceIndex = mapIfaceToSource(index);
174 const AbstractTasksModelIface *m = dynamic_cast<const AbstractTasksModelIface *>(sourceIndex.model());
175
176 if (m) {
177 const_cast<AbstractTasksModelIface *>(m)->requestToggleShaded(sourceIndex);
178 }
179}
180
181void AbstractTasksProxyModelIface::requestVirtualDesktops(const QModelIndex &index, const QVariantList &desktops)
182{
183 if (!index.isValid()) {
184 return;
185 }
186
187 const QModelIndex &sourceIndex = mapIfaceToSource(index);
188 const AbstractTasksModelIface *m = dynamic_cast<const AbstractTasksModelIface *>(sourceIndex.model());
189
190 if (m) {
191 const_cast<AbstractTasksModelIface *>(m)->requestVirtualDesktops(sourceIndex, desktops);
192 }
193}
194
196{
197 if (!index.isValid()) {
198 return;
199 }
200
201 const QModelIndex &sourceIndex = mapIfaceToSource(index);
202 const AbstractTasksModelIface *m = dynamic_cast<const AbstractTasksModelIface *>(sourceIndex.model());
203
204 if (m) {
205 const_cast<AbstractTasksModelIface *>(m)->requestNewVirtualDesktop(sourceIndex);
206 }
207}
208
210{
211 if (!index.isValid()) {
212 return;
213 }
214
215 const QModelIndex &sourceIndex = mapIfaceToSource(index);
216 const AbstractTasksModelIface *m = dynamic_cast<const AbstractTasksModelIface *>(sourceIndex.model());
217
218 if (m) {
219 const_cast<AbstractTasksModelIface *>(m)->requestActivities(sourceIndex, activities);
220 }
221}
222
224{
225 if (!index.isValid()) {
226 return;
227 }
228
229 const QModelIndex &sourceIndex = mapIfaceToSource(index);
230 const AbstractTasksModelIface *m = dynamic_cast<const AbstractTasksModelIface *>(sourceIndex.model());
231
232 if (m) {
233 const_cast<AbstractTasksModelIface *>(m)->requestPublishDelegateGeometry(sourceIndex, geometry, delegate);
234 }
235}
236
237}
Pure virtual method interface for tasks model implementations.
void requestToggleShaded(const QModelIndex &index) override
Request toggling the shaded state of the task at the given index.
void requestResize(const QModelIndex &index) override
Request starting an interactive resize for the task at the given index.
void requestToggleKeepBelow(const QModelIndex &index) override
Request toggling the keep-below state of the task at the given index.
void requestOpenUrls(const QModelIndex &index, const QList< QUrl > &urls) override
Requests to open the given URLs with the application backing the task at the given index.
void requestActivities(const QModelIndex &index, const QStringList &activities) override
Request moving the task at the given index to the specified activities.
void requestVirtualDesktops(const QModelIndex &index, const QVariantList &desktops) override
Request entering the window at the given index on the specified virtual desktops, leaving any other d...
void requestNewInstance(const QModelIndex &index) override
Request an additional instance of the application backing the task at the given index.
void requestToggleKeepAbove(const QModelIndex &index) override
Request toggling the keep-above state of the task at the given index.
void requestToggleMinimized(const QModelIndex &index) override
Request toggling the minimized state of the task at the given index.
void requestPublishDelegateGeometry(const QModelIndex &index, const QRect &geometry, QObject *delegate=nullptr) override
Request informing the window manager of new geometry for a visual delegate for the task at the given ...
void requestActivate(const QModelIndex &index) override
Request activation of the task at the given index.
void requestToggleMaximized(const QModelIndex &index) override
Request toggling the maximized state of the task at the given index.
void requestClose(const QModelIndex &index) override
Request the task at the given index be closed.
void requestNewVirtualDesktop(const QModelIndex &index) override
Request entering the window at the given index on a new virtual desktop, which is created in response...
void requestMove(const QModelIndex &index) override
Request starting an interactive move for the task at the given index.
void requestToggleFullScreen(const QModelIndex &index) override
Request toggling the fullscreen state of the task at the given index.
bool isValid() const const
const QAbstractItemModel * model() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:17:42 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.