1 /***************************************************************************
2 * plasmoidprotocol.cpp *
4 * Copyright (C) 2008 Jason Stubbs <jasonbstubbs@gmail.com> *
5 * Copyright (C) 2008 Sebastian Kügler <sebas@kde.org> *
7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. *
12 * This program is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
17 * You should have received a copy of the GNU General Public License *
18 * along with this program; if not, write to the *
19 * Free Software Foundation, Inc., *
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
21 ***************************************************************************/
23 #include "plasmoidtask.h"
24 #include "plasmoidtaskprotocol.h"
31 PlasmoidProtocol::PlasmoidProtocol(QObject
*parent
)
37 PlasmoidProtocol::~PlasmoidProtocol()
42 void PlasmoidProtocol::init()
44 // TODO: Load plasmoids from config
47 //newTask("kuiserver");
48 //newTask("mid_control");
52 void PlasmoidProtocol::newTask(QString appletName
)
54 if (m_tasks
.contains(appletName
)) {
55 kDebug() << "Task " << appletName
<< "is already in here.";
59 kDebug() << "Registering task with the manager" << appletName
;
60 PlasmoidTask
*task
= new PlasmoidTask(appletName
);
62 if (!task
->isValid()) {
63 // we failed to load our applet *sob*
68 m_tasks
[appletName
] = task
;
69 connect(task
, SIGNAL(taskDeleted(QString
)), this, SLOT(cleanupTask(QString
)));
70 emit
taskCreated(task
);
74 void PlasmoidProtocol::cleanupTask(QString typeId
)
76 kDebug() << "task with typeId" << typeId
<< "removed";
77 m_tasks
.remove(typeId
);
82 #include "plasmoidtaskprotocol.moc"