summaryrefslogtreecommitdiffstats
path: root/ksirc/puke/pobjfinder.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ksirc/puke/pobjfinder.cpp')
-rw-r--r--ksirc/puke/pobjfinder.cpp86
1 files changed, 86 insertions, 0 deletions
diff --git a/ksirc/puke/pobjfinder.cpp b/ksirc/puke/pobjfinder.cpp
new file mode 100644
index 00000000..0f510ea4
--- /dev/null
+++ b/ksirc/puke/pobjfinder.cpp
@@ -0,0 +1,86 @@
+#include "pobjfinder.h"
+#include "pobjfinder-cmd.h"
+
+
+PObject *
+PObjFinder::createWidget(CreateArgs &ca)
+{
+ PObjFinder *pw = new PObjFinder(ca.parent);
+ pw->setWidget(0x0);
+ pw->setWidgetId(ca.pwI);
+ pw->setPukeController(ca.pc);
+ return pw;
+}
+
+
+PObjFinder::PObjFinder(PObject *parent)
+ : PObject(parent)
+{
+ // We don't actually encase a widget since all the ObjFinder interface
+ // is static
+ setWidget(0x0);
+ connect(controller(), SIGNAL(inserted(QObject *)),
+ this, SLOT(newObject(QObject *)));
+}
+
+PObjFinder::~PObjFinder()
+{
+}
+
+void PObjFinder::messageHandler(int fd, PukeMessage *pm)
+{
+ PukeMessage pmRet;
+ switch(pm->iCommand){
+ case PUKE_OBJFINDER_ALLOBJECTS:
+ {
+ QString qscArg;
+ QStrList allObj = controller()->allObjects();
+ for(uint i = 0; i <= allObj.count(); i++){
+ qscArg += allObj.at(i);
+ qscArg += "\n";
+ }
+
+ pmRet.iCommand = - pm->iCommand;
+ pmRet.iWinId = pm->iWinId;
+ pmRet.iArg = 0;
+ pmRet.cArg = qstrdup(qscArg);
+ pmRet.iTextSize = qscArg.length();
+ emit outputMessage(fd, &pmRet);
+ delete pmRet.cArg;
+ break;
+ }
+ default:
+ PObject::messageHandler(fd, pm);
+ }
+}
+
+void PObjFinder::setWidget(QObject *_obj)
+{
+ PObject::setWidget(_obj);
+}
+
+
+objFinder *PObjFinder::widget()
+{
+ return 0x0;
+}
+
+
+void PObjFinder::newObject(QObject *name){
+ QString info;
+
+ info = name->className();
+ info += "::";
+ info += name->name("unnamed");
+
+ PukeMessage pmRet;
+ pmRet.iCommand = - PUKE_OBJFINDER_NEWOBJECT_ACK;
+ pmRet.iWinId = widgetIden().iWinId;
+ pmRet.iArg = 0;
+ pmRet.cArg = qstrdup(info);
+ pmRet.iTextSize = info.length();
+ emit outputMessage(widgetIden().fd, &pmRet);
+ delete pmRet.cArg;
+}
+
+#include "pobjfinder.moc"