All pastes #406819 Raw Edit

vanRijn

public text v1 · immutable
·published 2007-03-22 18:33 UTC
rendered paste body
void KPilotDeviceLink::customEvent(QCustomEvent *e)
{
	FUNCTIONSETUP;

	if ((int)e->type() == EventDeviceReady)
	{
		DeviceCommEvent* t = dynamic_cast<DeviceCommEvent*>(e);
		if (t)
		{
			fPilotSocket = t->currentSocket();
			emit deviceReady( this );
		}
		else
		{
			DEBUGKPILOT << fname
				<< ": unable to cast event: [" << e << "]" << endl;
		}
	}
	else if ((int)e->type() == EventLogMessage)
	{
		DeviceCommEvent* t = dynamic_cast<DeviceCommEvent*>(e);
		if (t)
		{
			emit logMessage(t->message());
		}
		else
		{
			DEBUGKPILOT << fname
				<< ": unable to cast event: [" << e << "]" << endl;
		}
	}
	else if ((int)e->type() == EventLogError)
	{
		DeviceCommEvent* t = dynamic_cast<DeviceCommEvent*>(e);
		if (t)
		{
			emit logError(t->message());
		}
		else
		{
			DEBUGKPILOT << fname
				<< ": unable to cast event: [" << e << "]" << endl;
		}
	}
	else if ((int)e->type() == EventLogProgress)
	{
		DeviceCommEvent* t = dynamic_cast<DeviceCommEvent*>(e);
		if (t)
		{
			emit logProgress(t->message(), t->progress());
		}
		else
		{
			DEBUGKPILOT << fname
				<< ": unable to cast event: [" << e << "]" << endl;
		}
	}
	else
	{
		KPilotLink::customEvent(e);
	}
}