Plasma-workspace

abstracttasksmodel.cpp
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#include "abstracttasksmodel.h"
8
9#include <QMetaEnum>
10
11namespace TaskManager
12{
13AbstractTasksModel::AbstractTasksModel(QObject *parent)
14 : QAbstractListModel(parent)
15{
16}
17
18AbstractTasksModel::~AbstractTasksModel()
19{
20}
21
22QHash<int, QByteArray> AbstractTasksModel::roleNames() const
23{
25
26 QMetaEnum e = metaObject()->enumerator(metaObject()->indexOfEnumerator("AdditionalRoles"));
27
28 for (int i = 0; i < e.keyCount(); ++i) {
29 roles.insert(e.value(i), e.key(i));
30 }
31
32 return roles;
33}
34
35QVariant AbstractTasksModel::data(const QModelIndex &, int role) const
36{
37 switch (role) {
38 case Qt::DisplayRole:
39 return QString();
41 return QVariant();
42 case AppId:
43 return 0;
44 case AppName:
45 case GenericName:
46 return QString();
47 case LauncherUrl:
48 case LauncherUrlWithoutIcon:
49 return QVariant();
50 case WinIdList:
51 return QVariantList();
52 case MimeType:
53 return QString();
54 case MimeData:
55 return QVariant();
56 case IsWindow:
57 case IsStartup:
58 case IsLauncher:
59 case HasLauncher:
60 case IsGroupParent:
61 return false;
62 case ChildCount:
63 return 0;
64 case IsGroupable:
65 case IsActive:
66 case IsClosable:
67 case IsMovable:
68 case IsResizable:
69 case IsMaximizable:
70 case IsMaximized:
71 case IsMinimizable:
72 case IsMinimized:
73 case IsKeepAbove:
74 case IsKeepBelow:
75 case IsFullScreenable:
76 case IsFullScreen:
77 case IsShadeable:
78 case IsShaded:
79 case IsVirtualDesktopsChangeable:
80 return false;
81 case VirtualDesktops:
82 return QVariantList{0};
83 case IsOnAllVirtualDesktops:
84 return false;
85 case Geometry:
86 case ScreenGeometry:
87 return QVariant();
88 case Activities:
89 return QStringList();
90 case IsDemandingAttention:
91 case SkipTaskbar:
92 case SkipPager:
93 return false;
94 case AppPid:
95 return 0;
96 case StackingOrder:
97 case LastActivated:
98 return QVariant();
99 case ApplicationMenuServiceName:
100 case ApplicationMenuObjectPath:
101 return QString();
102 case IsHidden:
103 case CanLaunchNewInstance:
104 return false;
105 default:
106 return QVariant();
107 }
108 Q_UNREACHABLE();
109}
110
111QModelIndex AbstractTasksModel::index(int row, int column, const QModelIndex &parent) const
112{
113 return hasIndex(row, column, parent) ? createIndex(row, column, nullptr) : QModelIndex();
114}
115
116void AbstractTasksModel::requestActivate(const QModelIndex &index)
117{
118 Q_UNUSED(index)
119}
120
121void AbstractTasksModel::requestNewInstance(const QModelIndex &index)
122{
123 Q_UNUSED(index)
124}
125
126void AbstractTasksModel::requestOpenUrls(const QModelIndex &index, const QList<QUrl> &urls)
127{
128 Q_UNUSED(index)
129 Q_UNUSED(urls)
130}
131
132void AbstractTasksModel::requestClose(const QModelIndex &index)
133{
134 Q_UNUSED(index)
135}
136
137void AbstractTasksModel::requestMove(const QModelIndex &index)
138{
139 Q_UNUSED(index)
140}
141
142void AbstractTasksModel::requestResize(const QModelIndex &index)
143{
144 Q_UNUSED(index)
145}
146
147void AbstractTasksModel::requestToggleMinimized(const QModelIndex &index)
148{
149 Q_UNUSED(index)
150}
151
152void AbstractTasksModel::requestToggleMaximized(const QModelIndex &index)
153{
154 Q_UNUSED(index)
155}
156
157void AbstractTasksModel::requestToggleKeepAbove(const QModelIndex &index)
158{
159 Q_UNUSED(index)
160}
161
162void AbstractTasksModel::requestToggleKeepBelow(const QModelIndex &index)
163{
164 Q_UNUSED(index)
165}
166
167void AbstractTasksModel::requestToggleFullScreen(const QModelIndex &index)
168{
169 Q_UNUSED(index)
170}
171
172void AbstractTasksModel::requestToggleShaded(const QModelIndex &index)
173{
174 Q_UNUSED(index)
175}
176
177void AbstractTasksModel::requestVirtualDesktops(const QModelIndex &index, const QVariantList &desktops)
178{
179 Q_UNUSED(index)
180 Q_UNUSED(desktops)
181}
182
183void AbstractTasksModel::requestNewVirtualDesktop(const QModelIndex &index)
184{
185 Q_UNUSED(index)
186}
187
188void AbstractTasksModel::requestActivities(const QModelIndex &index, const QStringList &activities)
189{
190 Q_UNUSED(index)
191 Q_UNUSED(activities)
192}
193
194void AbstractTasksModel::requestPublishDelegateGeometry(const QModelIndex &index, const QRect &geometry, QObject *delegate)
195{
196 Q_UNUSED(index)
197 Q_UNUSED(geometry)
198 Q_UNUSED(delegate)
199}
200
201}
202
203#include "moc_abstracttasksmodel.cpp"
virtual QHash< int, QByteArray > roleNames() const const
iterator insert(const Key &key, const T &value)
const char * key(int index) const const
int keyCount() const const
int value(int index) const const
DisplayRole
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:58:38 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.