not quite so much needs to be delayed to the init() function
[personal-kdebase.git] / workspace / plasma / applets / systemtray / protocols / fdo / fdotask.cpp
blob983eb366e35cafa90773f26a42ce85a359f2a181
1 /***************************************************************************
2 * fdotask.cpp *
3 * *
4 * Copyright (C) 2008 Jason Stubbs <jasonbstubbs@gmail.com> *
5 * *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the *
18 * Free Software Foundation, Inc., *
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
20 ***************************************************************************/
22 #include "fdographicswidget.h"
23 #include "fdotask.h"
25 #include <KWindowSystem>
26 #include <Plasma/Applet>
28 namespace SystemTray
31 class FdoTask::Private
33 public:
34 Private(WId winId)
35 : winId(winId)
37 KWindowInfo info = KWindowSystem::windowInfo(winId, NET::WMName, NET::WM2WindowClass);
39 // FIXME: This isn't unique
40 typeId = info.windowClassName();
42 name = info.name();
43 if (name.isEmpty()) {
44 name = typeId;
47 icon = KWindowSystem::icon(winId);
50 WId winId;
51 QString name;
52 QString typeId;
53 QIcon icon;
57 FdoTask::FdoTask(WId winId)
58 : d(new Private(winId))
63 FdoTask::~FdoTask()
65 emit taskDeleted(d->winId);
66 delete d;
70 bool FdoTask::isEmbeddable() const
72 return associatedWidgets().count() == 0;
76 QString FdoTask::name() const
78 return d->name;
82 QString FdoTask::typeId() const
84 return d->typeId;
88 QIcon FdoTask::icon() const
90 return d->icon;
94 QGraphicsWidget* FdoTask::createWidget(Plasma::Applet *applet)
96 QGraphicsWidget *widget = new FdoGraphicsWidget(d->winId, applet);
97 connect(widget, SIGNAL(clientClosed()), this, SLOT(deleteLater()));
98 return widget;
104 #include "fdotask.moc"