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

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

class KURLDragJBridge : public KURLDrag
{
public:
	KURLDragJBridge(const KURL::List& urls, QWidget* dragSource, const char* name) : KURLDrag(urls, dragSource, name) {}
//	KURLDragJBridge(const KURL::List& urls, const QMap<QString arg1, QString>& metaData, QWidget* dragSource, const char* name) : KURLDrag(urls, arg1, metaData, dragSource, name) {}
	~KURLDragJBridge() {QtSupport::qtKeyDeleted(this);}
//	KURLDragJBridge(const QStrList& urls, const QMap<QString arg1, QString>& metaData, QWidget* dragSource, const char* name) : KURLDrag(urls, arg1, metaData, dragSource, name) {}
	 const char *  protected_format(int i) {
		return ( const char * ) KURLDrag::format(i);
	}
	 QByteArray  protected_encodedData(const char* mime) {
		return ( QByteArray ) KURLDrag::encodedData(mime);
	}
	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_KURLDrag_newKURLDrag__Ljava_util_ArrayList_2Lorg_kde_qt_QWidget_2Ljava_lang_String_2(JNIEnv *env, jobject obj, jobjectArray urls, jobject dragSource, jstring name)
{
static QCString * _qstring_name = 0;
static KURL::List * _qlist_urls = 0;
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new KURLDragJBridge((KURL::List&) * (KURL::List *) KDESupport::toKURLList(env, urls, &_qlist_urls), (QWidget*) QtSupport::getQt(env, dragSource), (char*) QtSupport::toCharString(env, name, &_qstring_name)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

//JNIEXPORT void JNICALL
//Java_org_kde_koala_KURLDrag_newKURLDrag__Ljava_util_ArrayList_2Ljava_lang_String_2Ljava_lang_String_2Lorg_kde_qt_QWidget_2Ljava_lang_String_2(JNIEnv *env, jobject obj, jobjectArray urls, jstring arg1, jstring metaData, jobject dragSource, jstring name)
//{
//static QCString * _qstring_name = 0;
//static KURL::List * _qlist_urls = 0;
//	if (QtSupport::getQt(env, obj) == 0) {
//		QtSupport::setQt(env, obj, new KURLDragJBridge((KURL::List&) * (KURL::List *) KDESupport::toKURLList(env, urls, &_qlist_urls), (QMap<QString) arg1, (QString>) metaData, (QWidget*) QtSupport::getQt(env, dragSource), (char*) QtSupport::toCharString(env, name, &_qstring_name)));
//		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
//	}
//	return;
//}

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

JNIEXPORT void JNICALL
Java_org_kde_koala_KURLDrag_dispose(JNIEnv *env, jobject obj)
{
	Java_org_kde_koala_KURLDrag_finalize(env, obj);
	return;
}

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

//JNIEXPORT jstring JNICALL
//Java_org_kde_koala_KURLDrag_metaData(JNIEnv *env, jobject obj)
//{
//	QString  _qstring;
//	_qcstring = (const char *)((KURLDrag*) QtSupport::getQt(env, obj))->metaData();
//	return QtSupport::fromCharString(env, (char *) _qcstring);
//}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_KURLDrag_newDrag__Ljava_util_ArrayList_2Lorg_kde_qt_QWidget_2Ljava_lang_String_2(JNIEnv *env, jclass obj, jobjectArray urls, jobject dragSource, jstring name)
{
static QCString * _qstring_name = 0;
static KURL::List * _qlist_urls = 0;
	return (jobject) QtSupport::objectForQtKey(env, (void *)KURLDragJBridge::newDrag((KURL::List&) * (KURL::List *) KDESupport::toKURLList(env, urls, &_qlist_urls), (QWidget*) QtSupport::getQt(env, dragSource), (char*) QtSupport::toCharString(env, name, &_qstring_name)), "org.kde.koala.KURLDrag");
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_KURLDrag_newDrag__Ljava_util_ArrayList_2(JNIEnv *env, jclass obj, jobjectArray urls)
{
static KURL::List * _qlist_urls = 0;
	return (jobject) QtSupport::objectForQtKey(env, (void *)KURLDragJBridge::newDrag((KURL::List&) * (KURL::List *) KDESupport::toKURLList(env, urls, &_qlist_urls), 0, 0), "org.kde.koala.KURLDrag");
}

//JNIEXPORT jobject JNICALL
//Java_org_kde_koala_KURLDrag_newDrag__Ljava_util_ArrayList_2Ljava_lang_String_2Ljava_lang_String_2Lorg_kde_qt_QWidget_2Ljava_lang_String_2(JNIEnv *env, jclass obj, jobjectArray urls, jstring arg1, jstring metaData, jobject dragSource, jstring name)
//{
//static QCString * _qstring_name = 0;
//static KURL::List * _qlist_urls = 0;
//	return (jobject) QtSupport::objectForQtKey(env, (void *)KURLDragJBridge::newDrag((KURL::List&) * (KURL::List *) KDESupport::toKURLList(env, urls, &_qlist_urls), (QMap<QString) arg1, (QString>) metaData, (QWidget*) QtSupport::getQt(env, dragSource), (char*) QtSupport::toCharString(env, name, &_qstring_name)), "org.kde.koala.KURLDrag");
//}

//JNIEXPORT jobject JNICALL
//Java_org_kde_koala_KURLDrag_newDrag__Ljava_util_ArrayList_2Ljava_lang_String_2Ljava_lang_String_2(JNIEnv *env, jclass obj, jobjectArray urls, jstring arg1, jstring metaData)
//{
//static KURL::List * _qlist_urls = 0;
//	return (jobject) QtSupport::objectForQtKey(env, (void *)KURLDragJBridge::newDrag((KURL::List&) * (KURL::List *) KDESupport::toKURLList(env, urls, &_qlist_urls), (QMap<QString) arg1, (QString>) metaData, 0, 0), "org.kde.koala.KURLDrag");
//}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_KURLDrag_decode__Lorg_kde_qt_QMimeSourceInterface_2Ljava_util_ArrayList_2(JNIEnv *env, jclass obj, jobject e, jobjectArray urls)
{
static KURL::List * _qlist_urls = 0;
	return (jboolean) KURLDragJBridge::decode((QMimeSource*) QtSupport::getQt(env, e), (KURL::List&) * (KURL::List *) KDESupport::toKURLList(env, urls, &_qlist_urls));
}

//JNIEXPORT jboolean JNICALL
//Java_org_kde_koala_KURLDrag_decode__Lorg_kde_qt_QMimeSourceInterface_2Ljava_util_ArrayList_2Ljava_lang_String_2Ljava_lang_String_2(JNIEnv *env, jclass obj, jobject e, jobjectArray urls, jstring arg1, jstring metaData)
//{
//static KURL::List * _qlist_urls = 0;
//	return (jboolean) KURLDragJBridge::decode((QMimeSource*) QtSupport::getQt(env, e), (KURL::List&) * (KURL::List *) KDESupport::toKURLList(env, urls, &_qlist_urls), (QMap<QString) arg1, (QString>) metaData);
//}

//JNIEXPORT jboolean JNICALL
//Java_org_kde_koala_KURLDrag_decode___3Ljava_lang_String_2Ljava_util_ArrayList_2(JNIEnv *env, jclass obj, jobjectArray e, jobjectArray uris)
//{
//static KURL::List * _qlist_uris = 0;
//static QStringList * _qlist_e = 0;
//	return (jboolean) KURLDragJBridge::decode((QStringList&) * (QStringList *) QtSupport::toQStringList(env, e, &_qlist_e), (KURL::List&) * (KURL::List *) KDESupport::toKURLList(env, uris, &_qlist_uris));
//}

//JNIEXPORT void JNICALL
//Java_org_kde_koala_KURLDrag_newKURLDrag___3Ljava_lang_String_2Ljava_lang_String_2Ljava_lang_String_2Lorg_kde_qt_QWidget_2Ljava_lang_String_2(JNIEnv *env, jobject obj, jobjectArray urls, jstring arg1, jstring metaData, jobject dragSource, jstring name)
//{
//static QCString * _qstring_name = 0;
//static QStrList * _qlist_urls = 0;
//	if (QtSupport::getQt(env, obj) == 0) {
//		QtSupport::setQt(env, obj, new KURLDragJBridge((QStrList&) * (QStrList *) QtSupport::toQStrList(env, urls, &_qlist_urls), (QMap<QString) arg1, (QString>) metaData, (QWidget*) QtSupport::getQt(env, dragSource), (char*) QtSupport::toCharString(env, name, &_qstring_name)));
//		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
//	}
//	return;
//}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_KURLDrag_format(JNIEnv *env, jobject obj, jint i)
{
	 const char *  _qcstring;
	_qcstring = (const char *)((KURLDragJBridge*) QtSupport::getQt(env, obj))->protected_format((int) i);
	return QtSupport::fromCharString(env, (char *) _qcstring);
}

JNIEXPORT jbyteArray JNICALL
Java_org_kde_koala_KURLDrag_encodedData(JNIEnv *env, jobject obj, jstring mime)
{
	QByteArray  _qbyteArray;
static QCString * _qstring_mime = 0;
	_qbyteArray = ((KURLDragJBridge*) QtSupport::getQt(env, obj))->protected_encodedData((char*) QtSupport::toCharString(env, mime, &_qstring_mime));
	return QtSupport::fromQByteArray(env, &_qbyteArray);
}

