/***************************************************************************
                            SimpleJob.cpp -  description
                             -------------------
    begin                : Sun Jan 27 16:22:17 2002
    copyright            : (C) 2000-2001 Lost Highway Ltd.
    email                : Richard_Dale@tipitina.demon.co.uk
    generated by         : duke@tipitina on Sun Jan 27 16:22:17 2002, using kalyptus 0.9.
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU 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 <kio/jobclasses.h>
#include <qstring.h>
#include <qcstring.h>

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

class SimpleJobJBridge : public KIO::SimpleJob
{
public:
	SimpleJobJBridge(const KURL& url, int command, const QByteArray& packedArgs, bool showProgressInfo) : SimpleJob(url, command, packedArgs, showProgressInfo) {}
	~SimpleJobJBridge() {QtSupport::qtKeyDeleted(this);}
	void protected_slotFinished() {
		SimpleJob::slotFinished();
		return;
	}
	void protected_slotWarning(const QString& arg1) {
		SimpleJob::slotWarning(arg1);
		return;
	}
	void protected_slotInfoMessage(const QString& arg1) {
		SimpleJob::slotInfoMessage(arg1);
		return;
	}
	void protected_slotConnected() {
		SimpleJob::slotConnected();
		return;
	}
	void protected_slotTotalSize(KIO::filesize_t data_size) {
		SimpleJob::slotTotalSize(data_size);
		return;
	}
	void protected_slotProcessedSize(KIO::filesize_t data_size) {
		SimpleJob::slotProcessedSize(data_size);
		return;
	}
	void protected_slotSpeed(unsigned long bytes_per_second) {
		SimpleJob::slotSpeed(bytes_per_second);
		return;
	}
	void protected_slotMetaData(const KIO::MetaData& _metaData) {
		SimpleJob::slotMetaData(_metaData);
		return;
	}
	void protected_slotNeedProgressId() {
		SimpleJob::slotNeedProgressId();
		return;
	}
	void childEvent(QChildEvent* arg1) {
		if (! QtSupport::eventDelegate(this, "childEvent", arg1, "org.kde.qt.QChildEvent")) {
			QObject::childEvent(arg1);
		}
		return;
	}
	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;
	}
};


JNIEXPORT void JNICALL
Java_org_kde_koala_SimpleJob_newSimpleJob(JNIEnv *env, jobject obj, jobject url, jint command, jbyteArray packedArgs, jboolean showProgressInfo)
{
static QByteArray * _qbyteArray_packedArgs = 0;
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new SimpleJobJBridge((KURL&) *(KURL *) QtSupport::getQt(env, url), (int) command, (QByteArray&) * (QByteArray *) QtSupport::toQByteArray(env, packedArgs, &_qbyteArray_packedArgs), (bool) showProgressInfo));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

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

JNIEXPORT void JNICALL
Java_org_kde_koala_SimpleJob_dispose(JNIEnv *env, jobject obj)
{
	Java_org_kde_koala_SimpleJob_finalize(env, obj);
	return;
}

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

JNIEXPORT jobject JNICALL
Java_org_kde_koala_SimpleJob_url(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)(KURL *) &((KIO::SimpleJob*) QtSupport::getQt(env, obj))->url(), "org.kde.koala.KURL");
}

JNIEXPORT void JNICALL
Java_org_kde_koala_SimpleJob_kill__Z(JNIEnv *env, jobject obj, jboolean quietly)
{
	((KIO::SimpleJob*) QtSupport::getQt(env, obj))->kill((bool) quietly);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_SimpleJob_kill__(JNIEnv *env, jobject obj)
{
	((KIO::SimpleJob*) QtSupport::getQt(env, obj))->kill(true);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_SimpleJob_putOnHold(JNIEnv *env, jobject obj)
{
	((KIO::SimpleJob*) QtSupport::getQt(env, obj))->putOnHold();
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_SimpleJob_start(JNIEnv *env, jobject obj, jobject slave)
{
	((KIO::SimpleJob*) QtSupport::getQt(env, obj))->start((KIO::Slave*) QtSupport::getQt(env, slave));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_SimpleJob_slaveDone(JNIEnv *env, jobject obj)
{
	((KIO::SimpleJob*) QtSupport::getQt(env, obj))->slaveDone();
	return;
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_SimpleJob_slave(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)((KIO::SimpleJob*) QtSupport::getQt(env, obj))->slave(), "org.kde.koala.Slave");
}

JNIEXPORT jint JNICALL
Java_org_kde_koala_SimpleJob_command(JNIEnv *env, jobject obj)
{
	return (jint) ((KIO::SimpleJob*) QtSupport::getQt(env, obj))->command();
}

JNIEXPORT void JNICALL
Java_org_kde_koala_SimpleJob_slotError(JNIEnv *env, jobject obj, jint arg1, jstring arg2)
{
static QString * _qstring_arg2 = 0;
	((KIO::SimpleJob*) QtSupport::getQt(env, obj))->slotError((int) arg1, (QString&) * (QString *) QtSupport::toQString(env, arg2, &_qstring_arg2));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_SimpleJob_removeOnHold(JNIEnv *env, jclass obj)
{
	SimpleJobJBridge::removeOnHold();
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_SimpleJob_slotFinished(JNIEnv *env, jobject obj)
{
	((SimpleJobJBridge*) QtSupport::getQt(env, obj))->protected_slotFinished();
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_SimpleJob_slotWarning(JNIEnv *env, jobject obj, jstring arg1)
{
static QString * _qstring_arg1 = 0;
	((SimpleJobJBridge*) QtSupport::getQt(env, obj))->protected_slotWarning((QString&) * (QString *) QtSupport::toQString(env, arg1, &_qstring_arg1));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_SimpleJob_slotInfoMessage(JNIEnv *env, jobject obj, jstring arg1)
{
static QString * _qstring_arg1 = 0;
	((SimpleJobJBridge*) QtSupport::getQt(env, obj))->protected_slotInfoMessage((QString&) * (QString *) QtSupport::toQString(env, arg1, &_qstring_arg1));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_SimpleJob_slotConnected(JNIEnv *env, jobject obj)
{
	((SimpleJobJBridge*) QtSupport::getQt(env, obj))->protected_slotConnected();
	return;
}

//JNIEXPORT void JNICALL
//Java_org_kde_koala_SimpleJob_slotTotalSize(JNIEnv *env, jobject obj, j data_size)
//{
//	((SimpleJobJBridge*) QtSupport::getQt(env, obj))->protected_slotTotalSize((KIO::filesize_t) data_size);
//	return;
//}

//JNIEXPORT void JNICALL
//Java_org_kde_koala_SimpleJob_slotProcessedSize(JNIEnv *env, jobject obj, j data_size)
//{
//	((SimpleJobJBridge*) QtSupport::getQt(env, obj))->protected_slotProcessedSize((KIO::filesize_t) data_size);
//	return;
//}

JNIEXPORT void JNICALL
Java_org_kde_koala_SimpleJob_slotSpeed(JNIEnv *env, jobject obj, jlong bytes_per_second)
{
	((SimpleJobJBridge*) QtSupport::getQt(env, obj))->protected_slotSpeed((unsigned long) bytes_per_second);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_SimpleJob_slotMetaData(JNIEnv *env, jobject obj, jobject _metaData)
{
	((SimpleJobJBridge*) QtSupport::getQt(env, obj))->protected_slotMetaData((KIO::MetaData&) *(KIO::MetaData *) QtSupport::getQt(env, _metaData));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_SimpleJob_slotNeedProgressId(JNIEnv *env, jobject obj)
{
	((SimpleJobJBridge*) QtSupport::getQt(env, obj))->protected_slotNeedProgressId();
	return;
}

