/***************************************************************************
                            KProcessController.cpp -  description
                             -------------------
    begin                : Fri Nov 15 11:45:52 2002
    copyright            : (C) 2000-2002 Lost Highway Ltd.
    email                : Richard_Dale@tipitina.demon.co.uk
    generated by         : duke@tipitina on Fri Nov 15 11:45:52 2002, using kalyptus 0.9.
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU Library General Public License as published by*
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
***************************************************************************/

#define _BOOL_H_
#include <kprocctrl.h>
#include <qstring.h>
#include <qcstring.h>

#include <qtjava/QtSupport.h>
#include <kdejava/KDESupport.h>
#include <kdejava/KProcessController.h>

class KProcessControllerJBridge : public KProcessController
{
public:
	KProcessControllerJBridge() : KProcessController() {}
	~KProcessControllerJBridge() {QtSupport::qtKeyDeleted(this);}
	void customEvent(QCustomEvent* arg1) {
		if (! QtSupport::eventDelegate(this, "customEvent", arg1, "org.kde.qt.QCustomEvent")) {
			QObject::customEvent(arg1);
		}
		return;
	}
	void timerEvent(QTimerEvent* arg1) {
		if (! QtSupport::eventDelegate(this, "timerEvent", arg1, "org.kde.qt.QTimerEvent")) {
			QObject::timerEvent(arg1);
		}
		return;
	}
	void childEvent(QChildEvent* arg1) {
		if (! QtSupport::eventDelegate(this, "childEvent", arg1, "org.kde.qt.QChildEvent")) {
			QObject::childEvent(arg1);
		}
		return;
	}
};


JNIEXPORT void JNICALL
Java_org_kde_koala_KProcessController_newKProcessController(JNIEnv *env, jobject obj)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new KProcessControllerJBridge());
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KProcessController_finalize(JNIEnv *env, jobject obj)
{
	if (QtSupport::allocatedInJavaWorld(env, obj) && ((KProcessController*)QtSupport::getQt(env, obj))->parent() == (QObject *) 0) {
		delete (KProcessController*)QtSupport::getQt(env, obj);
		QtSupport::setQt(env, obj, 0);
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KProcessController_dispose(JNIEnv *env, jobject obj)
{
	Java_org_kde_koala_KProcessController_finalize(env, obj);
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_KProcessController_isDisposed(JNIEnv *env, jobject obj)
{
	return (QtSupport::getQt(env, obj) == 0);
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KProcessController_addKProcess(JNIEnv *env, jobject obj, jobject arg1)
{
	((KProcessController*) QtSupport::getQt(env, obj))->addKProcess((KProcess*) QtSupport::getQt(env, arg1));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KProcessController_removeKProcess(JNIEnv *env, jobject obj, jobject arg1)
{
	((KProcessController*) QtSupport::getQt(env, obj))->removeKProcess((KProcess*) QtSupport::getQt(env, arg1));
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_KProcessController_waitForProcessExit(JNIEnv *env, jobject obj, jint timeout)
{
	return (jboolean) ((KProcessController*) QtSupport::getQt(env, obj))->waitForProcessExit((int) timeout);
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KProcessController_slotDoHousekeeping(JNIEnv *env, jobject obj, jint socket)
{
	((KProcessController*) QtSupport::getQt(env, obj))->slotDoHousekeeping((int) socket);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KProcessController_theSigCHLDHandler(JNIEnv *env, jclass obj, jint signal)
{
	KProcessControllerJBridge::theSigCHLDHandler((int) signal);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KProcessController_setupHandlers(JNIEnv *env, jclass obj)
{
	KProcessControllerJBridge::setupHandlers();
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KProcessController_resetHandlers(JNIEnv *env, jclass obj)
{
	KProcessControllerJBridge::resetHandlers();
	return;
}

