/***************************************************************************
                            Observer.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/observer.h>
#include <qstring.h>
#include <qcstring.h>

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

class ObserverJBridge : public Observer
{
public:
	ObserverJBridge() : Observer() {}
	~ObserverJBridge() {QtSupport::qtKeyDeleted(this);}
	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 jint JNICALL
Java_org_kde_koala_Observer_newJob(JNIEnv *env, jobject obj, jobject job, jboolean showProgress)
{
	return (jint) ((Observer*) QtSupport::getQt(env, obj))->newJob((KIO::Job*) QtSupport::getQt(env, job), (bool) showProgress);
}

JNIEXPORT void JNICALL
Java_org_kde_koala_Observer_jobFinished(JNIEnv *env, jobject obj, jint progressId)
{
	((Observer*) QtSupport::getQt(env, obj))->jobFinished((int) progressId);
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_Observer_openPassDlg__Ljava_lang_String_2Ljava_lang_String_2Ljava_lang_String_2Z(JNIEnv *env, jobject obj, jstring prompt, jstring user, jstring pass, jboolean readOnly)
{
static QString * _qstring_pass = 0;
static QString * _qstring_user = 0;
static QString * _qstring_prompt = 0;
	return (jboolean) ((Observer*) QtSupport::getQt(env, obj))->openPassDlg((QString&) * (QString *) QtSupport::toQString(env, prompt, &_qstring_prompt), (QString&) * (QString *) QtSupport::toQString(env, user, &_qstring_user), (QString&) * (QString *) QtSupport::toQString(env, pass, &_qstring_pass), (bool) readOnly);
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_Observer_openPassDlg__Lorg_kde_koala_AuthInfo_2(JNIEnv *env, jobject obj, jobject info)
{
	return (jboolean) ((Observer*) QtSupport::getQt(env, obj))->openPassDlg((KIO::AuthInfo&) *(KIO::AuthInfo *) QtSupport::getQt(env, info));
}

JNIEXPORT jint JNICALL
Java_org_kde_koala_Observer_messageBox(JNIEnv *env, jobject obj, jint progressId, jint type, jstring text, jstring caption, jstring buttonYes, jstring buttonNo)
{
static QString * _qstring_buttonNo = 0;
static QString * _qstring_buttonYes = 0;
static QString * _qstring_caption = 0;
static QString * _qstring_text = 0;
	return (jint) ((Observer*) QtSupport::getQt(env, obj))->messageBox((int) progressId, (int) type, (QString&) * (QString *) QtSupport::toQString(env, text, &_qstring_text), (QString&) * (QString *) QtSupport::toQString(env, caption, &_qstring_caption), (QString&) * (QString *) QtSupport::toQString(env, buttonYes, &_qstring_buttonYes), (QString&) * (QString *) QtSupport::toQString(env, buttonNo, &_qstring_buttonNo));
}

//JNIEXPORT jint JNICALL
//Java_org_kde_koala_Observer_open_RenameDlg__Lorg_kde_koala_Job_2Ljava_lang_String_2Ljava_lang_String_2Ljava_lang_String_2ILjava_lang_String_2(JNIEnv *env, jobject obj, jobject job, jstring caption, jstring src, jstring dest, jint mode, jstring newDest, j arg1, j arg2, j arg3, j arg4, j arg5, j arg6)
//{
//static QString * _qstring_newDest = 0;
//static QString * _qstring_dest = 0;
//static QString * _qstring_src = 0;
//static QString * _qstring_caption = 0;
//	return (jint) ((Observer*) QtSupport::getQt(env, obj))->open_RenameDlg((KIO::Job*) QtSupport::getQt(env, job), (QString&) * (QString *) QtSupport::toQString(env, caption, &_qstring_caption), (QString&) * (QString *) QtSupport::toQString(env, src, &_qstring_src), (QString&) * (QString *) QtSupport::toQString(env, dest, &_qstring_dest), (KIO::RenameDlg_Mode) mode, (QString&) * (QString *) QtSupport::toQString(env, newDest, &_qstring_newDest), (KIO::filesize_t sizeSrc (KIO::filesize_t) -1) arg1, (KIO::filesize_t sizeDest (KIO::filesize_t) -1) arg2, (time_t ctimeSrc  -1) arg3, (time_t ctimeDest  -1) arg4, (time_t mtimeSrc  -1) arg5, (time_t mtimeDest  -1) arg6);
//}

//JNIEXPORT jint JNICALL
//Java_org_kde_koala_Observer_open_RenameDlg__Lorg_kde_koala_Job_2Ljava_lang_String_2Ljava_lang_String_2Ljava_lang_String_2ILjava_lang_String_2(JNIEnv *env, jobject obj, jobject job, jstring caption, jstring src, jstring dest, jint mode, jstring newDest)
//{
//static QString * _qstring_newDest = 0;
//static QString * _qstring_dest = 0;
//static QString * _qstring_src = 0;
//static QString * _qstring_caption = 0;
//	return (jint) ((Observer*) QtSupport::getQt(env, obj))->open_RenameDlg((KIO::Job*) QtSupport::getQt(env, job), (QString&) * (QString *) QtSupport::toQString(env, caption, &_qstring_caption), (QString&) * (QString *) QtSupport::toQString(env, src, &_qstring_src), (QString&) * (QString *) QtSupport::toQString(env, dest, &_qstring_dest), (KIO::RenameDlg_Mode) mode, (QString&) * (QString *) QtSupport::toQString(env, newDest, &_qstring_newDest), , , (time_t), (time_t), (time_t), (time_t));
//}

JNIEXPORT jint JNICALL
Java_org_kde_koala_Observer_open_1SkipDlg(JNIEnv *env, jobject obj, jobject job, jboolean multi, jstring error_text)
{
static QString * _qstring_error_text = 0;
	return (jint) ((Observer*) QtSupport::getQt(env, obj))->open_SkipDlg((KIO::Job*) QtSupport::getQt(env, job), (bool) multi, (QString&) * (QString *) QtSupport::toQString(env, error_text, &_qstring_error_text));
}

//JNIEXPORT  JNICALL
//Java_org_kde_koala_Observer_Server(JNIEnv *env, jobject obj, j progressId)
//{
//	return () ((Observer*) QtSupport::getQt(env, obj))->Server((using DCOP) if the user presses cancel* / void killJob( int) progressId);
//}

//JNIEXPORT  JNICALL
//Java_org_kde_koala_Observer_metadata(JNIEnv *env, jobject obj, jint progressId)
//{
//	return () ((Observer*) QtSupport::getQt(env, obj))->metadata((int) progressId);
//}

JNIEXPORT void JNICALL
Java_org_kde_koala_Observer_stating(JNIEnv *env, jobject obj, jobject arg1, jobject url)
{
	((Observer*) QtSupport::getQt(env, obj))->stating((KIO::Job*) QtSupport::getQt(env, arg1), (KURL&) *(KURL *) QtSupport::getQt(env, url));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_Observer_mounting(JNIEnv *env, jobject obj, jobject arg1, jstring dev, jstring point)
{
static QString * _qstring_point = 0;
static QString * _qstring_dev = 0;
	((Observer*) QtSupport::getQt(env, obj))->mounting((KIO::Job*) QtSupport::getQt(env, arg1), (QString&) * (QString *) QtSupport::toQString(env, dev, &_qstring_dev), (QString&) * (QString *) QtSupport::toQString(env, point, &_qstring_point));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_Observer_unmounting(JNIEnv *env, jobject obj, jobject arg1, jstring point)
{
static QString * _qstring_point = 0;
	((Observer*) QtSupport::getQt(env, obj))->unmounting((KIO::Job*) QtSupport::getQt(env, arg1), (QString&) * (QString *) QtSupport::toQString(env, point, &_qstring_point));
	return;
}

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

JNIEXPORT void JNICALL
Java_org_kde_koala_Observer_slotTotalFiles(JNIEnv *env, jobject obj, jobject arg1, jlong files)
{
	((Observer*) QtSupport::getQt(env, obj))->slotTotalFiles((KIO::Job*) QtSupport::getQt(env, arg1), (unsigned long) files);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_Observer_slotTotalDirs(JNIEnv *env, jobject obj, jobject arg1, jlong dirs)
{
	((Observer*) QtSupport::getQt(env, obj))->slotTotalDirs((KIO::Job*) QtSupport::getQt(env, arg1), (unsigned long) dirs);
	return;
}

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

JNIEXPORT void JNICALL
Java_org_kde_koala_Observer_slotProcessedFiles(JNIEnv *env, jobject obj, jobject arg1, jlong files)
{
	((Observer*) QtSupport::getQt(env, obj))->slotProcessedFiles((KIO::Job*) QtSupport::getQt(env, arg1), (unsigned long) files);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_Observer_slotProcessedDirs(JNIEnv *env, jobject obj, jobject arg1, jlong dirs)
{
	((Observer*) QtSupport::getQt(env, obj))->slotProcessedDirs((KIO::Job*) QtSupport::getQt(env, arg1), (unsigned long) dirs);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_Observer_slotSpeed(JNIEnv *env, jobject obj, jobject arg1, jlong bytes_per_second)
{
	((Observer*) QtSupport::getQt(env, obj))->slotSpeed((KIO::Job*) QtSupport::getQt(env, arg1), (unsigned long) bytes_per_second);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_Observer_slotPercent(JNIEnv *env, jobject obj, jobject arg1, jlong percent)
{
	((Observer*) QtSupport::getQt(env, obj))->slotPercent((KIO::Job*) QtSupport::getQt(env, arg1), (unsigned long) percent);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_Observer_slotInfoMessage(JNIEnv *env, jobject obj, jobject arg1, jstring msg)
{
static QString * _qstring_msg = 0;
	((Observer*) QtSupport::getQt(env, obj))->slotInfoMessage((KIO::Job*) QtSupport::getQt(env, arg1), (QString&) * (QString *) QtSupport::toQString(env, msg, &_qstring_msg));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_Observer_slotCopying(JNIEnv *env, jobject obj, jobject arg1, jobject from, jobject to)
{
	((Observer*) QtSupport::getQt(env, obj))->slotCopying((KIO::Job*) QtSupport::getQt(env, arg1), (KURL&) *(KURL *) QtSupport::getQt(env, from), (KURL&) *(KURL *) QtSupport::getQt(env, to));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_Observer_slotMoving(JNIEnv *env, jobject obj, jobject arg1, jobject from, jobject to)
{
	((Observer*) QtSupport::getQt(env, obj))->slotMoving((KIO::Job*) QtSupport::getQt(env, arg1), (KURL&) *(KURL *) QtSupport::getQt(env, from), (KURL&) *(KURL *) QtSupport::getQt(env, to));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_Observer_slotDeleting(JNIEnv *env, jobject obj, jobject arg1, jobject url)
{
	((Observer*) QtSupport::getQt(env, obj))->slotDeleting((KIO::Job*) QtSupport::getQt(env, arg1), (KURL&) *(KURL *) QtSupport::getQt(env, url));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_Observer_slotCreatingDir(JNIEnv *env, jobject obj, jobject arg1, jobject dir)
{
	((Observer*) QtSupport::getQt(env, obj))->slotCreatingDir((KIO::Job*) QtSupport::getQt(env, arg1), (KURL&) *(KURL *) QtSupport::getQt(env, dir));
	return;
}

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

JNIEXPORT jobject JNICALL
Java_org_kde_koala_Observer_self(JNIEnv *env, jclass obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)ObserverJBridge::self(), "org.kde.koala.Observer");
}

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

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

//JNIEXPORT void JNICALL
//Java_org_kde_koala_Observer_dispose(JNIEnv *env, jobject obj)
//{
//	Java_org_kde_koala_Observer_finalize(env, obj);
//	return;
//}

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

JNIEXPORT jstring JNICALL
Java_org_kde_koala_Observer_objId(JNIEnv *env, jobject obj)
{
	QCString  _qcstring;
	_qcstring = ((ObserverJBridge*) QtSupport::getQt(env, obj))->objId();
	return QtSupport::fromQCString(env, &_qcstring);
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_Observer_process(JNIEnv *env, jobject obj, jstring fun, jbyteArray data, jstring replyType, jbyteArray replyData)
{
static QByteArray * _qbyteArray_replyData = 0;
static QCString * _qcstring_replyType = 0;
static QByteArray * _qbyteArray_data = 0;
static QCString * _qcstring_fun = 0;
	return (jboolean) ((ObserverJBridge*) QtSupport::getQt(env, obj))->process((QCString&) * (QCString *) QtSupport::toQCString(env, fun, &_qcstring_fun), (QByteArray&) * (QByteArray *) QtSupport::toQByteArray(env, data, &_qbyteArray_data), (QCString&) * (QCString *) QtSupport::toQCString(env, replyType, &_qcstring_replyType), (QByteArray&) * (QByteArray *) QtSupport::toQByteArray(env, replyData, &_qbyteArray_replyData));
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_Observer_processDynamic(JNIEnv *env, jobject obj, jstring fun, jbyteArray data, jstring replyType, jbyteArray replyData)
{
static QByteArray * _qbyteArray_replyData = 0;
static QCString * _qcstring_replyType = 0;
static QByteArray * _qbyteArray_data = 0;
static QCString * _qcstring_fun = 0;
	return (jboolean) ((ObserverJBridge*) QtSupport::getQt(env, obj))->processDynamic((QCString&) * (QCString *) QtSupport::toQCString(env, fun, &_qcstring_fun), (QByteArray&) * (QByteArray *) QtSupport::toQByteArray(env, data, &_qbyteArray_data), (QCString&) * (QCString *) QtSupport::toQCString(env, replyType, &_qcstring_replyType), (QByteArray&) * (QByteArray *) QtSupport::toQByteArray(env, replyData, &_qbyteArray_replyData));
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_Observer_interfaces(JNIEnv *env, jobject obj)
{
	QCStringList  _qlist;
	_qlist = ((ObserverJBridge*) QtSupport::getQt(env, obj))->interfaces();
	return (jobject) KDESupport::arrayWithQCStringList(env, (QCStringList *) &_qlist);
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_Observer_functions(JNIEnv *env, jobject obj)
{
	QCStringList  _qlist;
	_qlist = ((ObserverJBridge*) QtSupport::getQt(env, obj))->functions();
	return (jobject) KDESupport::arrayWithQCStringList(env, (QCStringList *) &_qlist);
}

JNIEXPORT void JNICALL
Java_org_kde_koala_Observer_emitDCOPSignal(JNIEnv *env, jobject obj, jstring signal, jbyteArray data)
{
static QByteArray * _qbyteArray_data = 0;
static QCString * _qcstring_signal = 0;
	((ObserverJBridge*) QtSupport::getQt(env, obj))->emitDCOPSignal((QCString&) * (QCString *) QtSupport::toQCString(env, signal, &_qcstring_signal), (QByteArray&) * (QByteArray *) QtSupport::toQByteArray(env, data, &_qbyteArray_data));
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_Observer_connectDCOPSignal(JNIEnv *env, jobject obj, jstring sender, jstring senderObj, jstring signal, jstring slot, jboolean Volatile)
{
static QCString * _qcstring_slot = 0;
static QCString * _qcstring_signal = 0;
static QCString * _qcstring_senderObj = 0;
static QCString * _qcstring_sender = 0;
	return (jboolean) ((ObserverJBridge*) QtSupport::getQt(env, obj))->connectDCOPSignal((QCString&) * (QCString *) QtSupport::toQCString(env, sender, &_qcstring_sender), (QCString&) * (QCString *) QtSupport::toQCString(env, senderObj, &_qcstring_senderObj), (QCString&) * (QCString *) QtSupport::toQCString(env, signal, &_qcstring_signal), (QCString&) * (QCString *) QtSupport::toQCString(env, slot, &_qcstring_slot), (bool) Volatile);
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_Observer_disconnectDCOPSignal(JNIEnv *env, jobject obj, jstring sender, jstring senderObj, jstring signal, jstring slot)
{
static QCString * _qcstring_slot = 0;
static QCString * _qcstring_signal = 0;
static QCString * _qcstring_senderObj = 0;
static QCString * _qcstring_sender = 0;
	return (jboolean) ((ObserverJBridge*) QtSupport::getQt(env, obj))->disconnectDCOPSignal((QCString&) * (QCString *) QtSupport::toQCString(env, sender, &_qcstring_sender), (QCString&) * (QCString *) QtSupport::toQCString(env, senderObj, &_qcstring_senderObj), (QCString&) * (QCString *) QtSupport::toQCString(env, signal, &_qcstring_signal), (QCString&) * (QCString *) QtSupport::toQCString(env, slot, &_qcstring_slot));
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_Observer_hasObject(JNIEnv *env, jclass obj, jstring objId)
{
static QCString * _qcstring_objId = 0;
	return (jboolean) ObserverJBridge::hasObject((QCString&) * (QCString *) QtSupport::toQCString(env, objId, &_qcstring_objId));
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_Observer_find(JNIEnv *env, jclass obj, jstring objId)
{
static QCString * _qcstring_objId = 0;
	return (jobject) QtSupport::objectForQtKey(env, (void *)ObserverJBridge::find((QCString&) * (QCString *) QtSupport::toQCString(env, objId, &_qcstring_objId)), "org.kde.koala.Observer");
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_Observer_objectName(JNIEnv *env, jclass obj, jobject _obj)
{
	QCString  _qcstring;
	_qcstring = ObserverJBridge::objectName((QObject*) QtSupport::getQt(env, _obj));
	return QtSupport::fromQCString(env, &_qcstring);
}


