/***************************************************************************
                            FileCopyJob.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/FileCopyJob.h>

class FileCopyJobJBridge : public KIO::FileCopyJob
{
public:
	FileCopyJobJBridge(const KURL& src, const KURL& dest, int permissions, bool move, bool overwrite, bool resume, bool showProgressInfo) : FileCopyJob(src, dest, permissions, move, overwrite, resume, showProgressInfo) {}
	~FileCopyJobJBridge() {QtSupport::qtKeyDeleted(this);}
	void protected_startCopyJob() {
		FileCopyJob::startCopyJob();
		return;
	}
	void protected_startCopyJob(const KURL& slave_url) {
		FileCopyJob::startCopyJob(slave_url);
		return;
	}
	void protected_startDataPump() {
		FileCopyJob::startDataPump();
		return;
	}
	void protected_connectSubjob(KIO::SimpleJob* job) {
		FileCopyJob::connectSubjob(job);
		return;
	}
	void protected_slotResult(KIO::Job* job) {
		FileCopyJob::slotResult(job);
		return;
	}
	void protected_slotProcessedSize(KIO::Job* arg1, KIO::filesize_t size) {
		FileCopyJob::slotProcessedSize(arg1, size);
		return;
	}
	void protected_slotTotalSize(KIO::Job* arg1, KIO::filesize_t size) {
		FileCopyJob::slotTotalSize(arg1, size);
		return;
	}
	void protected_slotPercent(KIO::Job* arg1, unsigned long pct) {
		FileCopyJob::slotPercent(arg1, pct);
		return;
	}
	void protected_slotCanResume(KIO::Job* arg1, KIO::filesize_t offset) {
		FileCopyJob::slotCanResume(arg1, offset);
		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_FileCopyJob_newFileCopyJob(JNIEnv *env, jobject obj, jobject src, jobject dest, jint permissions, jboolean move, jboolean overwrite, jboolean resume, jboolean showProgressInfo)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new FileCopyJobJBridge((KURL&) *(KURL *) QtSupport::getQt(env, src), (KURL&) *(KURL *) QtSupport::getQt(env, dest), (int) permissions, (bool) move, (bool) overwrite, (bool) resume, (bool) showProgressInfo));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

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

JNIEXPORT void JNICALL
Java_org_kde_koala_FileCopyJob_dispose(JNIEnv *env, jobject obj)
{
	Java_org_kde_koala_FileCopyJob_finalize(env, obj);
	return;
}

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

//JNIEXPORT void JNICALL
//Java_org_kde_koala_FileCopyJob_setSourceSize(JNIEnv *env, jobject obj, j size)
//{
//	((KIO::FileCopyJob*) QtSupport::getQt(env, obj))->setSourceSize((off_t) size);
//	return;
//}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_FileCopyJob_srcURL(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)new KURL (((KIO::FileCopyJob*) QtSupport::getQt(env, obj))->srcURL()), "org.kde.koala.KURL", TRUE);
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_FileCopyJob_destURL(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)new KURL (((KIO::FileCopyJob*) QtSupport::getQt(env, obj))->destURL()), "org.kde.koala.KURL", TRUE);
}

JNIEXPORT void JNICALL
Java_org_kde_koala_FileCopyJob_slotStart(JNIEnv *env, jobject obj)
{
	((KIO::FileCopyJob*) QtSupport::getQt(env, obj))->slotStart();
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_FileCopyJob_slotData(JNIEnv *env, jobject obj, jobject arg1, jbyteArray data)
{
static QByteArray * _qbyteArray_data = 0;
	((KIO::FileCopyJob*) QtSupport::getQt(env, obj))->slotData((KIO::Job*) QtSupport::getQt(env, arg1), (QByteArray&) * (QByteArray *) QtSupport::toQByteArray(env, data, &_qbyteArray_data));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_FileCopyJob_slotDataReq(JNIEnv *env, jobject obj, jobject arg1, jbyteArray data)
{
static QByteArray * _qbyteArray_data = 0;
	((KIO::FileCopyJob*) QtSupport::getQt(env, obj))->slotDataReq((KIO::Job*) QtSupport::getQt(env, arg1), (QByteArray&) * (QByteArray *) QtSupport::toQByteArray(env, data, &_qbyteArray_data));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_FileCopyJob_startCopyJob__(JNIEnv *env, jobject obj)
{
	((FileCopyJobJBridge*) QtSupport::getQt(env, obj))->protected_startCopyJob();
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_FileCopyJob_startCopyJob__Lorg_kde_koala_KURL_2(JNIEnv *env, jobject obj, jobject slave_url)
{
	((FileCopyJobJBridge*) QtSupport::getQt(env, obj))->protected_startCopyJob((KURL&) *(KURL *) QtSupport::getQt(env, slave_url));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_FileCopyJob_startDataPump(JNIEnv *env, jobject obj)
{
	((FileCopyJobJBridge*) QtSupport::getQt(env, obj))->protected_startDataPump();
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_FileCopyJob_connectSubjob(JNIEnv *env, jobject obj, jobject job)
{
	((FileCopyJobJBridge*) QtSupport::getQt(env, obj))->protected_connectSubjob((KIO::SimpleJob*) QtSupport::getQt(env, job));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_FileCopyJob_slotResult(JNIEnv *env, jobject obj, jobject job)
{
	((FileCopyJobJBridge*) QtSupport::getQt(env, obj))->protected_slotResult((KIO::Job*) QtSupport::getQt(env, job));
	return;
}

//JNIEXPORT void JNICALL
//Java_org_kde_koala_FileCopyJob_slotProcessedSize(JNIEnv *env, jobject obj, jobject arg1, j size)
//{
//	((FileCopyJobJBridge*) QtSupport::getQt(env, obj))->protected_slotProcessedSize((KIO::Job*) QtSupport::getQt(env, arg1), (KIO::filesize_t) size);
//	return;
//}

//JNIEXPORT void JNICALL
//Java_org_kde_koala_FileCopyJob_slotTotalSize(JNIEnv *env, jobject obj, jobject arg1, j size)
//{
//	((FileCopyJobJBridge*) QtSupport::getQt(env, obj))->protected_slotTotalSize((KIO::Job*) QtSupport::getQt(env, arg1), (KIO::filesize_t) size);
//	return;
//}

JNIEXPORT void JNICALL
Java_org_kde_koala_FileCopyJob_slotPercent(JNIEnv *env, jobject obj, jobject arg1, jlong pct)
{
	((FileCopyJobJBridge*) QtSupport::getQt(env, obj))->protected_slotPercent((KIO::Job*) QtSupport::getQt(env, arg1), (unsigned long) pct);
	return;
}

//JNIEXPORT void JNICALL
//Java_org_kde_koala_FileCopyJob_slotCanResume(JNIEnv *env, jobject obj, jobject arg1, j offset)
//{
//	((FileCopyJobJBridge*) QtSupport::getQt(env, obj))->protected_slotCanResume((KIO::Job*) QtSupport::getQt(env, arg1), (KIO::filesize_t) offset);
//	return;
//}

