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

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

class KFileMetaInfoJBridge : public KFileMetaInfo
{
public:
	KFileMetaInfoJBridge(const QString& path, const QString& mimeType) : KFileMetaInfo(path, mimeType) {}
	KFileMetaInfoJBridge() : KFileMetaInfo() {}
	KFileMetaInfoJBridge(const KFileMetaInfo& original) : KFileMetaInfo(original) {}
	~KFileMetaInfoJBridge() {QtSupport::qtKeyDeleted(this);}
	KFilePlugin * const  protected_plugin() {
		return (KFilePlugin * const ) KFileMetaInfo::plugin();
	}
};


JNIEXPORT void JNICALL
Java_org_kde_koala_KFileMetaInfo_newKFileMetaInfo__Ljava_lang_String_2Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring path, jstring mimeType)
{
static QString * _qstring_mimeType = 0;
static QString * _qstring_path = 0;
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new KFileMetaInfoJBridge((QString&) * (QString *) QtSupport::toQString(env, path, &_qstring_path), (QString&) * (QString *) QtSupport::toQString(env, mimeType, &_qstring_mimeType)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KFileMetaInfo_newKFileMetaInfo__Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring path)
{
static QString * _qstring_path = 0;
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new KFileMetaInfoJBridge((QString&) * (QString *) QtSupport::toQString(env, path, &_qstring_path), QString::null));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

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

//JNIEXPORT void JNICALL
//Java_org_kde_koala_KFileMetaInfo_newKFileMetaInfo__(JNIEnv *env, jobject obj, j original)
//{
//	if (QtSupport::getQt(env, obj) == 0) {
//		QtSupport::setQt(env, obj, new KFileMetaInfoJBridge((KFileMetaInfo) original));
//		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
//	}
//	return;
//}

JNIEXPORT void JNICALL
Java_org_kde_koala_KFileMetaInfo_finalize(JNIEnv *env, jobject obj)
{
	if (QtSupport::allocatedInJavaWorld(env, obj)) {
		delete (KFileMetaInfo*)QtSupport::getQt(env, obj);
		QtSupport::setQt(env, obj, 0);
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KFileMetaInfo_dispose(JNIEnv *env, jobject obj)
{
	Java_org_kde_koala_KFileMetaInfo_finalize(env, obj);
	return;
}

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

//JNIEXPORT  JNICALL
//Java_org_kde_koala_KFileMetaInfo_item(JNIEnv *env, jobject obj, jstring key)
//{
//static QString * _qstring_key = 0;
//	return () ((KFileMetaInfo*) QtSupport::getQt(env, obj))->item((QString&) * (QString *) QtSupport::toQString(env, key, &_qstring_key));
//}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_KFileMetaInfo_value(JNIEnv *env, jobject obj, jstring key)
{
static QString * _qstring_key = 0;
	return (jobject) QtSupport::objectForQtKey(env, (void *)new const QVariant (((KFileMetaInfo*) QtSupport::getQt(env, obj))->value((QString&) * (QString *) QtSupport::toQString(env, key, &_qstring_key))), "org.kde.qt.QVariant", TRUE);
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_KFileMetaInfo_contains(JNIEnv *env, jobject obj, jstring key)
{
static QString * _qstring_key = 0;
	return (jboolean) ((KFileMetaInfo*) QtSupport::getQt(env, obj))->contains((QString&) * (QString *) QtSupport::toQString(env, key, &_qstring_key));
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_KFileMetaInfo_supportedKeys(JNIEnv *env, jobject obj)
{
	QStringList  _qlist;
	_qlist = ((KFileMetaInfo*) QtSupport::getQt(env, obj))->supportedKeys();
	return (jobject) QtSupport::arrayWithQStringList(env, (QStringList *) &_qlist);
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_KFileMetaInfo_preferredKeys(JNIEnv *env, jobject obj)
{
	QStringList  _qlist;
	_qlist = ((KFileMetaInfo*) QtSupport::getQt(env, obj))->preferredKeys();
	return (jobject) QtSupport::arrayWithQStringList(env, (QStringList *) &_qlist);
}

//JNIEXPORT jboolean JNICALL
//Java_org_kde_koala_KFileMetaInfo_supportsVariableKeys(JNIEnv *env, jobject obj)
//{
//	pd
//	return (jboolean) ((KFileMetaInfo*) QtSupport::getQt(env, obj))->supportsVariableKeys();
//	return false;
//}

//JNIEXPORT  JNICALL
//Java_org_kde_koala_KFileMetaInfo_addItem(JNIEnv *env, jobject obj, jstring key, jobject value)
//{
//static QString * _qstring_key = 0;
//	return () ((KFileMetaInfo*) QtSupport::getQt(env, obj))->addItem((QString&) * (QString *) QtSupport::toQString(env, key, &_qstring_key), (QVariant&) *(QVariant *) QtSupport::getQt(env, value));
//}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_KFileMetaInfo_applyChanges(JNIEnv *env, jobject obj)
{
	return (jboolean) ((KFileMetaInfo*) QtSupport::getQt(env, obj))->applyChanges();
}

//JNIEXPORT jobject JNICALL
//Java_org_kde_koala_KFileMetaInfo_createValidator__Ljava_lang_String_2Lorg_kde_qt_QObject_2Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring key, jobject parent, jstring name)
//{
//static QCString * _qstring_name = 0;
//static QString * _qstring_key = 0;
//	pd
//	return (jobject) QtSupport::objectForQtKey(env, (void *)((KFileMetaInfo*) QtSupport::getQt(env, obj))->createValidator((QString&) * (QString *) QtSupport::toQString(env, key, &_qstring_key), (QObject*) QtSupport::getQt(env, parent), (char*) QtSupport::toCharString(env, name, &_qstring_name)), "org.kde.qt.QValidator");
//	return NULL;
//}

//JNIEXPORT jobject JNICALL
//Java_org_kde_koala_KFileMetaInfo_createValidator__Ljava_lang_String_2Lorg_kde_qt_QObject_2(JNIEnv *env, jobject obj, jstring key, jobject parent)
//{
//static QString * _qstring_key = 0;
//	pd
//	return (jobject) QtSupport::objectForQtKey(env, (void *)((KFileMetaInfo*) QtSupport::getQt(env, obj))->createValidator((QString&) * (QString *) QtSupport::toQString(env, key, &_qstring_key), (QObject*) QtSupport::getQt(env, parent), 0), "org.kde.qt.QValidator");
//	pd
//	return NULL;
//}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_KFileMetaInfo_isValid(JNIEnv *env, jobject obj)
{
	return (jboolean) ((KFileMetaInfo*) QtSupport::getQt(env, obj))->isValid();
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_KFileMetaInfo_plugin(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)((KFileMetaInfoJBridge*) QtSupport::getQt(env, obj))->protected_plugin(), "org.kde.koala.KFilePlugin");
}

