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

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

class KServiceTypeProfileJBridge : public KServiceTypeProfile
{
public:
	~KServiceTypeProfileJBridge() {QtSupport::qtKeyDeleted(this);}
	KServiceTypeProfileJBridge(const QString& _servicetype, const QString& _genericServiceType) : KServiceTypeProfile(_servicetype, _genericServiceType) {}
	void protected_addService(const QString& _service, int _preference, bool _allow_as_default) {
		KServiceTypeProfile::addService(_service, _preference, _allow_as_default);
		return;
	}
};


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

JNIEXPORT void JNICALL
Java_org_kde_koala_KServiceTypeProfile_dispose(JNIEnv *env, jobject obj)
{
	Java_org_kde_koala_KServiceTypeProfile_finalize(env, obj);
	return;
}

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

JNIEXPORT jint JNICALL
Java_org_kde_koala_KServiceTypeProfile_preference(JNIEnv *env, jobject obj, jstring _service)
{
static QString * _qstring__service = 0;
	return (jint) ((KServiceTypeProfile*) QtSupport::getQt(env, obj))->preference((QString&) * (QString *) QtSupport::toQString(env, _service, &_qstring__service));
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_KServiceTypeProfile_allowAsDefault(JNIEnv *env, jobject obj, jstring _service)
{
static QString * _qstring__service = 0;
	return (jboolean) ((KServiceTypeProfile*) QtSupport::getQt(env, obj))->allowAsDefault((QString&) * (QString *) QtSupport::toQString(env, _service, &_qstring__service));
}

//JNIEXPORT jobject JNICALL
//Java_org_kde_koala_KServiceTypeProfile_offers__(JNIEnv *env, jobject obj)
//{
//	KTrader::OfferList  _qlist;
//	_qlist = ((KServiceTypeProfile*) QtSupport::getQt(env, obj))->offers();
//	return (jobject) KDESupport::arrayWithOfferList(env, (KTrader::OfferList *) &_qlist);
//}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_KServiceTypeProfile_preferredService(JNIEnv *env, jclass obj, jstring serviceType, jstring genericServiceType)
{
static QString * _qstring_genericServiceType = 0;
static QString * _qstring_serviceType = 0;
	return (jobject) QtSupport::objectForQtKey(env, (void *)new  KService::Ptr (KServiceTypeProfileJBridge::preferredService((QString&) * (QString *) QtSupport::toQString(env, serviceType, &_qstring_serviceType), (QString&) * (QString *) QtSupport::toQString(env, genericServiceType, &_qstring_genericServiceType))), "org.kde.koala.KService_Ptr", TRUE);
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_KServiceTypeProfile_serviceTypeProfile__Ljava_lang_String_2Ljava_lang_String_2(JNIEnv *env, jclass obj, jstring servicetype, jstring genericServiceType)
{
static QString * _qstring_genericServiceType = 0;
static QString * _qstring_servicetype = 0;
	return (jobject) QtSupport::objectForQtKey(env, (void *)KServiceTypeProfileJBridge::serviceTypeProfile((QString&) * (QString *) QtSupport::toQString(env, servicetype, &_qstring_servicetype), (QString&) * (QString *) QtSupport::toQString(env, genericServiceType, &_qstring_genericServiceType)), "org.kde.koala.KServiceTypeProfile");
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_KServiceTypeProfile_serviceTypeProfile__Ljava_lang_String_2(JNIEnv *env, jclass obj, jstring servicetype)
{
static QString * _qstring_servicetype = 0;
	return (jobject) QtSupport::objectForQtKey(env, (void *)KServiceTypeProfileJBridge::serviceTypeProfile((QString&) * (QString *) QtSupport::toQString(env, servicetype, &_qstring_servicetype), QString::null), "org.kde.koala.KServiceTypeProfile");
}

//JNIEXPORT jobject JNICALL
//Java_org_kde_koala_KServiceTypeProfile_offers__Ljava_lang_String_2Ljava_lang_String_2(JNIEnv *env, jclass obj, jstring servicetype, jstring genericServiceType)
//{
//	KTrader::OfferList  _qlist;
//static QString * _qstring_genericServiceType = 0;
//static QString * _qstring_servicetype = 0;
//	_qlist = KServiceTypeProfileJBridge::offers((QString&) * (QString *) QtSupport::toQString(env, servicetype, &_qstring_servicetype), (QString&) * (QString *) QtSupport::toQString(env, genericServiceType, &_qstring_genericServiceType));
//	return (jobject) KDESupport::arrayWithOfferList(env, (KTrader::OfferList *) &_qlist);
//}

//JNIEXPORT  JNICALL
//Java_org_kde_koala_KServiceTypeProfile_serviceTypeProfiles(JNIEnv *env, jclass obj)
//{
//	return () KServiceTypeProfileJBridge::serviceTypeProfiles();
//}

JNIEXPORT void JNICALL
Java_org_kde_koala_KServiceTypeProfile_clear(JNIEnv *env, jclass obj)
{
	KServiceTypeProfileJBridge::clear();
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KServiceTypeProfile_setConfigurationMode(JNIEnv *env, jclass obj)
{
	KServiceTypeProfileJBridge::setConfigurationMode();
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_KServiceTypeProfile_configurationMode(JNIEnv *env, jclass obj)
{
	return (jboolean) KServiceTypeProfileJBridge::configurationMode();
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KServiceTypeProfile_newKServiceTypeProfile__Ljava_lang_String_2Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring _servicetype, jstring _genericServiceType)
{
static QString * _qstring__genericServiceType = 0;
static QString * _qstring__servicetype = 0;
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new KServiceTypeProfileJBridge((QString&) * (QString *) QtSupport::toQString(env, _servicetype, &_qstring__servicetype), (QString&) * (QString *) QtSupport::toQString(env, _genericServiceType, &_qstring__genericServiceType)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KServiceTypeProfile_newKServiceTypeProfile__Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring _servicetype)
{
static QString * _qstring__servicetype = 0;
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new KServiceTypeProfileJBridge((QString&) * (QString *) QtSupport::toQString(env, _servicetype, &_qstring__servicetype), QString::null));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KServiceTypeProfile_addService__Ljava_lang_String_2IZ(JNIEnv *env, jobject obj, jstring _service, jint _preference, jboolean _allow_as_default)
{
static QString * _qstring__service = 0;
	((KServiceTypeProfileJBridge*) QtSupport::getQt(env, obj))->protected_addService((QString&) * (QString *) QtSupport::toQString(env, _service, &_qstring__service), (int) _preference, (bool) _allow_as_default);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KServiceTypeProfile_addService__Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring _service)
{
static QString * _qstring__service = 0;
	((KServiceTypeProfileJBridge*) QtSupport::getQt(env, obj))->protected_addService((QString&) * (QString *) QtSupport::toQString(env, _service, &_qstring__service), 1, TRUE);
	return;
}

