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

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

class KRootPropJBridge : public KRootProp
{
public:
	KRootPropJBridge(const QString& rProp) : KRootProp(rProp) {}
	~KRootPropJBridge() {QtSupport::qtKeyDeleted(this);}
};


JNIEXPORT void JNICALL
Java_org_kde_koala_KRootProp_newKRootProp__Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring rProp)
{
static QString * _qstring_rProp = 0;
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new KRootPropJBridge((QString&) * (QString *) QtSupport::toQString(env, rProp, &_qstring_rProp)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

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

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

JNIEXPORT void JNICALL
Java_org_kde_koala_KRootProp_dispose(JNIEnv *env, jobject obj)
{
	Java_org_kde_koala_KRootProp_finalize(env, obj);
	return;
}

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

JNIEXPORT void JNICALL
Java_org_kde_koala_KRootProp_setProp__Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring rProp)
{
static QString * _qstring_rProp = 0;
	((KRootProp*) QtSupport::getQt(env, obj))->setProp((QString&) * (QString *) QtSupport::toQString(env, rProp, &_qstring_rProp));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KRootProp_setProp__(JNIEnv *env, jobject obj)
{
	((KRootProp*) QtSupport::getQt(env, obj))->setProp("");
	return;
}

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

JNIEXPORT void JNICALL
Java_org_kde_koala_KRootProp_destroy(JNIEnv *env, jobject obj)
{
	((KRootProp*) QtSupport::getQt(env, obj))->destroy();
	return;
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_KRootProp_readEntry__Ljava_lang_String_2Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring rKey, jstring pDefault)
{
	QString  _qstring;
static QString * _qstring_pDefault = 0;
static QString * _qstring_rKey = 0;
	_qstring = ((KRootProp*) QtSupport::getQt(env, obj))->readEntry((QString&) * (QString *) QtSupport::toQString(env, rKey, &_qstring_rKey), (QString&) * (QString *) QtSupport::toQString(env, pDefault, &_qstring_pDefault));
	return QtSupport::fromQString(env, &_qstring);
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_KRootProp_readEntry__Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring rKey)
{
static QString * _qstring_rKey = 0;
	QString _qstring;
	_qstring = ((KRootProp*) QtSupport::getQt(env, obj))->readEntry((QString&) * (QString *) QtSupport::toQString(env, rKey, &_qstring_rKey), QString::null);
	return QtSupport::fromQString(env, &_qstring);
}

JNIEXPORT jint JNICALL
Java_org_kde_koala_KRootProp_readNumEntry__Ljava_lang_String_2I(JNIEnv *env, jobject obj, jstring rKey, jint nDefault)
{
static QString * _qstring_rKey = 0;
	return (jint) ((KRootProp*) QtSupport::getQt(env, obj))->readNumEntry((QString&) * (QString *) QtSupport::toQString(env, rKey, &_qstring_rKey), (int) nDefault);
}

JNIEXPORT jint JNICALL
Java_org_kde_koala_KRootProp_readNumEntry__Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring rKey)
{
static QString * _qstring_rKey = 0;
	return (jint) ((KRootProp*) QtSupport::getQt(env, obj))->readNumEntry((QString&) * (QString *) QtSupport::toQString(env, rKey, &_qstring_rKey), 0);
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_KRootProp_readFontEntry__Ljava_lang_String_2Lorg_kde_qt_QFont_2(JNIEnv *env, jobject obj, jstring rKey, jobject pDefault)
{
static QString * _qstring_rKey = 0;
	return (jobject) QtSupport::objectForQtKey(env, (void *)new QFont (((KRootProp*) QtSupport::getQt(env, obj))->readFontEntry((QString&) * (QString *) QtSupport::toQString(env, rKey, &_qstring_rKey), (QFont*) QtSupport::getQt(env, pDefault))), "org.kde.qt.QFont", TRUE);
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_KRootProp_readFontEntry__Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring rKey)
{
static QString * _qstring_rKey = 0;
	return (jobject) QtSupport::objectForQtKey(env, (void *)new QFont(((KRootProp*) QtSupport::getQt(env, obj))->readFontEntry((QString&) * (QString *) QtSupport::toQString(env, rKey, &_qstring_rKey), 0)), "org.kde.qt.QFont", TRUE);
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_KRootProp_readColorEntry__Ljava_lang_String_2Lorg_kde_qt_QColor_2(JNIEnv *env, jobject obj, jstring rKey, jobject pDefault)
{
static QString * _qstring_rKey = 0;
	return (jobject) QtSupport::objectForQtKey(env, (void *)new QColor (((KRootProp*) QtSupport::getQt(env, obj))->readColorEntry((QString&) * (QString *) QtSupport::toQString(env, rKey, &_qstring_rKey), (QColor*) QtSupport::getQt(env, pDefault))), "org.kde.qt.QColor", TRUE);
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_KRootProp_readColorEntry__Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring rKey)
{
static QString * _qstring_rKey = 0;
	return (jobject) QtSupport::objectForQtKey(env, (void *)new QColor(((KRootProp*) QtSupport::getQt(env, obj))->readColorEntry((QString&) * (QString *) QtSupport::toQString(env, rKey, &_qstring_rKey), 0)), "org.kde.qt.QColor", TRUE);
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_KRootProp_writeEntry__Ljava_lang_String_2Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring rKey, jstring rValue)
{
	QString  _qstring;
static QString * _qstring_rValue = 0;
static QString * _qstring_rKey = 0;
	_qstring = ((KRootProp*) QtSupport::getQt(env, obj))->writeEntry((QString&) * (QString *) QtSupport::toQString(env, rKey, &_qstring_rKey), (QString&) * (QString *) QtSupport::toQString(env, rValue, &_qstring_rValue));
	return QtSupport::fromQString(env, &_qstring);
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_KRootProp_writeEntry__Ljava_lang_String_2I(JNIEnv *env, jobject obj, jstring rKey, jint nValue)
{
	QString  _qstring;
static QString * _qstring_rKey = 0;
	_qstring = ((KRootProp*) QtSupport::getQt(env, obj))->writeEntry((QString&) * (QString *) QtSupport::toQString(env, rKey, &_qstring_rKey), (int) nValue);
	return QtSupport::fromQString(env, &_qstring);
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_KRootProp_writeEntry__Ljava_lang_String_2Lorg_kde_qt_QFont_2(JNIEnv *env, jobject obj, jstring rKey, jobject rFont)
{
	QString  _qstring;
static QString * _qstring_rKey = 0;
	_qstring = ((KRootProp*) QtSupport::getQt(env, obj))->writeEntry((QString&) * (QString *) QtSupport::toQString(env, rKey, &_qstring_rKey), (QFont&) *(QFont *) QtSupport::getQt(env, rFont));
	return QtSupport::fromQString(env, &_qstring);
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_KRootProp_writeEntry__Ljava_lang_String_2Lorg_kde_qt_QColor_2(JNIEnv *env, jobject obj, jstring rKey, jobject rColor)
{
	QString  _qstring;
static QString * _qstring_rKey = 0;
	_qstring = ((KRootProp*) QtSupport::getQt(env, obj))->writeEntry((QString&) * (QString *) QtSupport::toQString(env, rKey, &_qstring_rKey), (QColor&) *(QColor *) QtSupport::getQt(env, rColor));
	return QtSupport::fromQString(env, &_qstring);
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_KRootProp_removeEntry(JNIEnv *env, jobject obj, jstring rKey)
{
	QString  _qstring;
static QString * _qstring_rKey = 0;
	_qstring = ((KRootProp*) QtSupport::getQt(env, obj))->removeEntry((QString&) * (QString *) QtSupport::toQString(env, rKey, &_qstring_rKey));
	return QtSupport::fromQString(env, &_qstring);
}

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

JNIEXPORT void JNICALL
Java_org_kde_koala_KRootProp_sync(JNIEnv *env, jobject obj)
{
	((KRootProp*) QtSupport::getQt(env, obj))->sync();
	return;
}

