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

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

class KServiceTypeJBridge : public KServiceType
{
public:
	KServiceTypeJBridge(const QString& _fullpath, const QString& _name, const QString& _icon, const QString& _comment) : KServiceType(_fullpath, _name, _icon, _comment) {}
	KServiceTypeJBridge(const QString& _fullpath) : KServiceType(_fullpath) {}
	KServiceTypeJBridge(KDesktopFile* config) : KServiceType(config) {}
	KServiceTypeJBridge(QDataStream& _str, int offset) : KServiceType(_str, offset) {}
	~KServiceTypeJBridge() {QtSupport::qtKeyDeleted(this);}
	void protected_init(KDesktopFile* config) {
		KServiceType::init(config);
		return;
	}
};


JNIEXPORT void JNICALL
Java_org_kde_koala_KServiceType_newKServiceType__Ljava_lang_String_2Ljava_lang_String_2Ljava_lang_String_2Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring _fullpath, jstring _name, jstring _icon, jstring _comment)
{
static QString * _qstring__comment = 0;
static QString * _qstring__icon = 0;
static QString * _qstring__name = 0;
static QString * _qstring__fullpath = 0;
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new KServiceTypeJBridge((QString&) * (QString *) QtSupport::toQString(env, _fullpath, &_qstring__fullpath), (QString&) * (QString *) QtSupport::toQString(env, _name, &_qstring__name), (QString&) * (QString *) QtSupport::toQString(env, _icon, &_qstring__icon), (QString&) * (QString *) QtSupport::toQString(env, _comment, &_qstring__comment)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KServiceType_newKServiceType__Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring _fullpath)
{
static QString * _qstring__fullpath = 0;
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new KServiceTypeJBridge((QString&) * (QString *) QtSupport::toQString(env, _fullpath, &_qstring__fullpath)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

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

JNIEXPORT void JNICALL
Java_org_kde_koala_KServiceType_newKServiceType__Lorg_kde_qt_QDataStream_2I(JNIEnv *env, jobject obj, jobject _str, jint offset)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new KServiceTypeJBridge((QDataStream&) *(QDataStream *) QtSupport::getQt(env, _str), (int) offset));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

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

JNIEXPORT void JNICALL
Java_org_kde_koala_KServiceType_dispose(JNIEnv *env, jobject obj)
{
	Java_org_kde_koala_KServiceType_finalize(env, obj);
	return;
}

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

JNIEXPORT jstring JNICALL
Java_org_kde_koala_KServiceType_icon(JNIEnv *env, jobject obj)
{
	QString  _qstring;
	_qstring = ((KServiceType*) QtSupport::getQt(env, obj))->icon();
	return QtSupport::fromQString(env, &_qstring);
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_KServiceType_comment(JNIEnv *env, jobject obj)
{
	QString  _qstring;
	_qstring = ((KServiceType*) QtSupport::getQt(env, obj))->comment();
	return QtSupport::fromQString(env, &_qstring);
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_KServiceType_name(JNIEnv *env, jobject obj)
{
	QString  _qstring;
	_qstring = ((KServiceType*) QtSupport::getQt(env, obj))->name();
	return QtSupport::fromQString(env, &_qstring);
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_KServiceType_desktopEntryPath(JNIEnv *env, jobject obj)
{
	QString  _qstring;
	_qstring = ((KServiceType*) QtSupport::getQt(env, obj))->desktopEntryPath();
	return QtSupport::fromQString(env, &_qstring);
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_KServiceType_isDerived(JNIEnv *env, jobject obj)
{
	return (jboolean) ((KServiceType*) QtSupport::getQt(env, obj))->isDerived();
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_KServiceType_parentServiceType(JNIEnv *env, jobject obj)
{
	QString  _qstring;
	_qstring = ((KServiceType*) QtSupport::getQt(env, obj))->parentServiceType();
	return QtSupport::fromQString(env, &_qstring);
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_KServiceType_property(JNIEnv *env, jobject obj, jstring _name)
{
static QString * _qstring__name = 0;
	return (jobject) QtSupport::objectForQtKey(env, (void *)new  QVariant (((KServiceType*) QtSupport::getQt(env, obj))->property((QString&) * (QString *) QtSupport::toQString(env, _name, &_qstring__name))), "org.kde.qt.QVariant", TRUE);
}

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

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

JNIEXPORT jint JNICALL
Java_org_kde_koala_KServiceType_propertyDef(JNIEnv *env, jobject obj, jstring _name)
{
static QString * _qstring__name = 0;
	return (jint) ((KServiceType*) QtSupport::getQt(env, obj))->propertyDef((QString&) * (QString *) QtSupport::toQString(env, _name, &_qstring__name));
}

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

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

JNIEXPORT void JNICALL
Java_org_kde_koala_KServiceType_save(JNIEnv *env, jobject obj, jobject arg1)
{
	((KServiceType*) QtSupport::getQt(env, obj))->save((QDataStream&) *(QDataStream *) QtSupport::getQt(env, arg1));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KServiceType_load(JNIEnv *env, jobject obj, jobject arg1)
{
	((KServiceType*) QtSupport::getQt(env, obj))->load((QDataStream&) *(QDataStream *) QtSupport::getQt(env, arg1));
	return;
}

//JNIEXPORT jint JNICALL
//Java_org_kde_koala_KServiceType_serviceType(JNIEnv *env, jclass obj, jstring _name)
//{
//static QString * _qstring__name = 0;
//	return (jint) KServiceTypeJBridge::serviceType((QString&) * (QString *) QtSupport::toQString(env, _name, &_qstring__name));
//}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_KServiceType_offers(JNIEnv *env, jclass obj, jstring _servicetype)
{
static QString * _qstring__servicetype = 0;
	return (jobject) QtSupport::objectForQtKey(env, (void *)new  KService::List (KServiceTypeJBridge::offers((QString&) * (QString *) QtSupport::toQString(env, _servicetype, &_qstring__servicetype))), "org.kde.koala.KService_List", TRUE);
}

//JNIEXPORT jobject JNICALL
//Java_org_kde_koala_KServiceType_allServiceTypes(JNIEnv *env, jclass obj)
//{
//	return (jobject) QtSupport::objectForQtKey(env, (void *)new  KURL::List (KServiceTypeJBridge::allServiceTypes()), "org.kde.koala.List", TRUE);
//}

JNIEXPORT void JNICALL
Java_org_kde_koala_KServiceType_init(JNIEnv *env, jobject obj, jobject config)
{
	((KServiceTypeJBridge*) QtSupport::getQt(env, obj))->protected_init((KDesktopFile*) QtSupport::getQt(env, config));
	return;
}

