Applets
plasmoidtaskprotocol.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "plasmoidtask.h"
00024 #include "plasmoidtaskprotocol.h"
00025
00026 #include <KDebug>
00027
00028 namespace SystemTray
00029 {
00030
00031 PlasmoidProtocol::PlasmoidProtocol(QObject *parent)
00032 : Protocol(parent)
00033 {
00034 }
00035
00036
00037 PlasmoidProtocol::~PlasmoidProtocol()
00038 {
00039 }
00040
00041
00042 void PlasmoidProtocol::init()
00043 {
00044
00045
00046
00047
00048
00049 }
00050
00051
00052 void PlasmoidProtocol::newTask(QString appletName)
00053 {
00054 if (m_tasks.contains(appletName)) {
00055 kDebug() << "Task " << appletName << "is already in here.";
00056 return;
00057 }
00058
00059 kDebug() << "Registering task with the manager" << appletName;
00060 PlasmoidTask *task = new PlasmoidTask(appletName);
00061
00062 if (!task->isValid()) {
00063
00064 delete task;
00065 return;
00066 }
00067
00068 m_tasks[appletName] = task;
00069 connect(task, SIGNAL(taskDeleted(QString)), this, SLOT(cleanupTask(QString)));
00070 emit taskCreated(task);
00071 }
00072
00073
00074 void PlasmoidProtocol::cleanupTask(QString typeId)
00075 {
00076 kDebug() << "task with typeId" << typeId << "removed";
00077 m_tasks.remove(typeId);
00078 }
00079
00080 }
00081
00082 #include "plasmoidtaskprotocol.moc"