You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tdenetwork/ksirc/puke/pobjfinder.cpp

87 lines
1.7 KiB

#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(), TQT_SIGNAL(inserted(TQObject *)),
this, TQT_SLOT(newObject(TQObject *)));
}
PObjFinder::~PObjFinder()
{
}
void PObjFinder::messageHandler(int fd, PukeMessage *pm)
{
PukeMessage pmRet;
switch(pm->iCommand){
case PUKE_OBJFINDER_ALLOBJECTS:
{
TQString qscArg;
TQStrList 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 = tqstrdup(qscArg);
pmRet.iTextSize = qscArg.length();
emit outputMessage(fd, &pmRet);
delete pmRet.cArg;
break;
}
default:
PObject::messageHandler(fd, pm);
}
}
void PObjFinder::setWidget(TQObject *_obj)
{
PObject::setWidget(_obj);
}
objFinder *PObjFinder::widget()
{
return 0x0;
}
void PObjFinder::newObject(TQObject *name){
TQString 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 = tqstrdup(info);
pmRet.iTextSize = info.length();
emit outputMessage(widgetIden().fd, &pmRet);
delete pmRet.cArg;
}
#include "pobjfinder.moc"