1 /*****************************************************************
3 Copyright 2008 Christian Mollekopf <chrigi_1@hotmail.com>
5 Permission is hereby granted, free of charge, to any person obtaining a copy
6 of this software and associated documentation files (the "Software"), to deal
7 in the Software without restriction, including without limitation the rights
8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 copies of the Software, and to permit persons to whom the Software is
10 furnished to do so, subject to the following conditions:
12 The above copyright notice and this permission notice shall be included in
13 all copies or substantial portions of the Software.
15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
19 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 ******************************************************************/
33 class TaskItem::Private
43 StartupPtr startupTask
;
47 TaskItem::TaskItem(QObject
*parent
,TaskPtr task
)
48 : AbstractGroupableItem(parent
),
52 connect(task
.data(), SIGNAL(changed(::TaskManager::TaskChanges
)),
53 this, SIGNAL(changed(::TaskManager::TaskChanges
)));
54 connect(task
.data(), SIGNAL(destroyed()), this, SLOT(deleteLater())); //this item isn't useful anymore if the Task was closed
58 TaskItem::TaskItem(QObject
*parent
, StartupPtr task
)
59 : AbstractGroupableItem(parent
),
62 d
->startupTask
= task
;
63 connect(task
.data(), SIGNAL(changed(::TaskManager::TaskChanges
)), this, SIGNAL(changed(::TaskManager::TaskChanges
)));
64 connect(task
.data(), SIGNAL(destroyed()), this, SLOT(deleteLater())); //this item isn't useful anymore if the Task was closed
70 /* if (parentGroup()){
71 parentGroup()->remove(this);
76 void TaskItem::setTaskPointer(TaskPtr task
)
79 disconnect(d
->startupTask
.data(), 0, 0, 0);
83 connect(task
.data(), SIGNAL(changed(::TaskManager::TaskChanges
)),
84 this, SIGNAL(changed(::TaskManager::TaskChanges
)));
85 connect(task
.data(), SIGNAL(destroyed()), this, SLOT(deleteLater()));
86 emit
gotTaskPointer();
89 TaskPtr
TaskItem::task() const
92 if (d->task.isNull()) {
93 kDebug() << "pointer is Null";
99 StartupPtr
TaskItem::startup() const
102 if (d->startupTask.isNull()) {
103 kDebug() << "pointer is Null";
106 return d
->startupTask
;
109 QIcon
TaskItem::icon() const
114 return d
->task
->icon();
117 QString
TaskItem::name() const
122 return d
->task
->visibleName();
125 void TaskItem::setShaded(bool state
)
130 d
->task
->setShaded(state
);
133 void TaskItem::toggleShaded()
138 d
->task
->toggleShaded();
141 bool TaskItem::isShaded() const
146 return d
->task
->isShaded();
149 void TaskItem::toDesktop(int desk
)
154 d
->task
->toDesktop(desk
);
157 bool TaskItem::isOnCurrentDesktop() const
159 return d
->task
&& d
->task
->isOnCurrentDesktop();
162 bool TaskItem::isOnAllDesktops() const
164 return d
->task
&& d
->task
->isOnAllDesktops();
167 int TaskItem::desktop() const
172 return d
->task
->desktop();
175 void TaskItem::setMaximized(bool state
)
180 d
->task
->setMaximized(state
);
183 void TaskItem::toggleMaximized()
188 d
->task
->toggleMaximized();
191 bool TaskItem::isMaximized() const
193 return d
->task
&& d
->task
->isMaximized();
196 void TaskItem::setMinimized(bool state
)
201 d
->task
->setIconified(state
);
204 void TaskItem::toggleMinimized()
209 d
->task
->toggleIconified();
212 bool TaskItem::isMinimized() const
217 return d
->task
->isMinimized();
220 void TaskItem::setFullScreen(bool state
)
225 d
->task
->setFullScreen(state
);
228 void TaskItem::toggleFullScreen()
233 d
->task
->toggleFullScreen();
236 bool TaskItem::isFullScreen() const
241 return d
->task
->isFullScreen();
244 void TaskItem::setKeptBelowOthers(bool state
)
249 d
->task
->setKeptBelowOthers(state
);
252 void TaskItem::toggleKeptBelowOthers()
257 d
->task
->toggleKeptBelowOthers();
260 bool TaskItem::isKeptBelowOthers() const
265 return d
->task
->isKeptBelowOthers();
268 void TaskItem::setAlwaysOnTop(bool state
)
273 d
->task
->setAlwaysOnTop(state
);
276 void TaskItem::toggleAlwaysOnTop()
281 d
->task
->toggleAlwaysOnTop();
284 bool TaskItem::isAlwaysOnTop() const
289 return d
->task
->isAlwaysOnTop();
292 bool TaskItem::isActionSupported(NET::Action action
) const
294 return d
->task
&& d
->task
->info().actionSupported(action
);
297 void TaskItem::addMimeData(QMimeData
*mimeData
) const
303 d
->task
->addMimeData(mimeData
);
306 void TaskItem::close()
314 bool TaskItem::isActive() const
319 return d
->task
->isActive();
322 bool TaskItem::demandsAttention() const
327 return d
->task
->demandsAttention();
330 } // TaskManager namespace
332 #include "taskitem.moc"