/***************************************************************************
                            FileCopyJob.cpp -  description
                             -------------------
    begin                : Sun Aug 26 09:45:02 2001
    copyright            : (C) 2000-2001 Lost Highway Ltd.
    email                : Richard_Dale@tipitina.demon.co.uk
    generated by         : duke@tipitina on Sun Aug 26 09:45:02 2001, using kdoc parser/custom Java conversion backend.
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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/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, unsigned long size) {
		FileCopyJob::slotProcessedSize(arg1, size);
		return;
	}
	void protected_slotTotalSize(KIO::Job* arg1, unsigned long 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, unsigned long 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 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_setSourceSize(JNIEnv *env, jobject obj, j size)
//{
//	((FileCopyJobJBridge*) 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 (((FileCopyJobJBridge*) 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 (((FileCopyJobJBridge*) QtSupport::getQt(env, obj))->destURL()), "org.kde.koala.KURL", TRUE);
}

JNIEXPORT void JNICALL
Java_org_kde_koala_FileCopyJob_slotData(JNIEnv *env, jobject obj, jobject arg1, jbyteArray data)
{
static QByteArray * _qbyteArray_data = 0;
	((FileCopyJobJBridge*) 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;
	((FileCopyJobJBridge*) 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, jlong size)
{
	((FileCopyJobJBridge*) QtSupport::getQt(env, obj))->protected_slotProcessedSize((KIO::Job*) QtSupport::getQt(env, arg1), (unsigned long) size);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_FileCopyJob_slotTotalSize(JNIEnv *env, jobject obj, jobject arg1, jlong size)
{
	((FileCopyJobJBridge*) QtSupport::getQt(env, obj))->protected_slotTotalSize((KIO::Job*) QtSupport::getQt(env, arg1), (unsigned long) 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, jlong offset)
{
	((FileCopyJobJBridge*) QtSupport::getQt(env, obj))->protected_slotCanResume((KIO::Job*) QtSupport::getQt(env, arg1), (unsigned long) offset);
	return;
}

