/***************************************************************************
                            KDirWatch.cpp -  description
                             -------------------
    begin                : Fri Mar 15 15:14:30 2002
    copyright            : (C) 2000-2002 Lost Highway Ltd.
    email                : Richard_Dale@tipitina.demon.co.uk
    generated by         : duke@tipitina on Fri Mar 15 15:14:30 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 <kdirwatch.h>
#include <qstring.h>
#include <qcstring.h>

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

class KDirWatchJBridge : public KDirWatch
{
public:
	KDirWatchJBridge(QObject* parent, const char* name) : KDirWatch(parent, name) {}
	~KDirWatchJBridge() {QtSupport::qtKeyDeleted(this);}
	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_KDirWatch_newKDirWatch__Lorg_kde_qt_QObject_2Ljava_lang_String_2(JNIEnv *env, jobject obj, jobject parent, jstring name)
{
static QCString * _qstring_name = 0;
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new KDirWatchJBridge((QObject*) QtSupport::getQt(env, parent), (char*) QtSupport::toCharString(env, name, &_qstring_name)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

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

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

JNIEXPORT void JNICALL
Java_org_kde_koala_KDirWatch_dispose(JNIEnv *env, jobject obj)
{
	Java_org_kde_koala_KDirWatch_finalize(env, obj);
	return;
}

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

JNIEXPORT void JNICALL
Java_org_kde_koala_KDirWatch_addDir__Ljava_lang_String_2ZZ(JNIEnv *env, jobject obj, jstring path, jboolean watchFiles, jboolean recursive)
{
static QString * _qstring_path = 0;
	((KDirWatch*) QtSupport::getQt(env, obj))->addDir((QString&) * (QString *) QtSupport::toQString(env, path, &_qstring_path), (bool) watchFiles, (bool) recursive);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KDirWatch_addDir__Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring path)
{
static QString * _qstring_path = 0;
	((KDirWatch*) QtSupport::getQt(env, obj))->addDir((QString&) * (QString *) QtSupport::toQString(env, path, &_qstring_path), false, false);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KDirWatch_addFile(JNIEnv *env, jobject obj, jstring file)
{
static QString * _qstring_file = 0;
	((KDirWatch*) QtSupport::getQt(env, obj))->addFile((QString&) * (QString *) QtSupport::toQString(env, file, &_qstring_file));
	return;
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_KDirWatch_ctime(JNIEnv *env, jobject obj, jstring path)
{
	QDateTime  _qdate;
static QString * _qstring_path = 0;
	_qdate = ((KDirWatch*) QtSupport::getQt(env, obj))->ctime((QString&) * (QString *) QtSupport::toQString(env, path, &_qstring_path));
	return (jobject) QtSupport::fromQDateTime(env, (QDateTime *) &_qdate);
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KDirWatch_removeDir(JNIEnv *env, jobject obj, jstring path)
{
static QString * _qstring_path = 0;
	((KDirWatch*) QtSupport::getQt(env, obj))->removeDir((QString&) * (QString *) QtSupport::toQString(env, path, &_qstring_path));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KDirWatch_removeFile(JNIEnv *env, jobject obj, jstring file)
{
static QString * _qstring_file = 0;
	((KDirWatch*) QtSupport::getQt(env, obj))->removeFile((QString&) * (QString *) QtSupport::toQString(env, file, &_qstring_file));
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_KDirWatch_stopDirScan(JNIEnv *env, jobject obj, jstring path)
{
static QString * _qstring_path = 0;
	return (jboolean) ((KDirWatch*) QtSupport::getQt(env, obj))->stopDirScan((QString&) * (QString *) QtSupport::toQString(env, path, &_qstring_path));
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_KDirWatch_restartDirScan(JNIEnv *env, jobject obj, jstring path)
{
static QString * _qstring_path = 0;
	return (jboolean) ((KDirWatch*) QtSupport::getQt(env, obj))->restartDirScan((QString&) * (QString *) QtSupport::toQString(env, path, &_qstring_path));
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KDirWatch_startScan__ZZ(JNIEnv *env, jobject obj, jboolean notify, jboolean skippedToo)
{
	((KDirWatch*) QtSupport::getQt(env, obj))->startScan((bool) notify, (bool) skippedToo);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KDirWatch_startScan__(JNIEnv *env, jobject obj)
{
	((KDirWatch*) QtSupport::getQt(env, obj))->startScan(false, false);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KDirWatch_stopScan(JNIEnv *env, jobject obj)
{
	((KDirWatch*) QtSupport::getQt(env, obj))->stopScan();
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_KDirWatch_isStopped(JNIEnv *env, jobject obj)
{
	return (jboolean) ((KDirWatch*) QtSupport::getQt(env, obj))->isStopped();
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_KDirWatch_contains(JNIEnv *env, jobject obj, jstring path)
{
static QString * _qstring_path = 0;
	return (jboolean) ((KDirWatch*) QtSupport::getQt(env, obj))->contains((QString&) * (QString *) QtSupport::toQString(env, path, &_qstring_path));
}

//JNIEXPORT void JNICALL
//Java_org_kde_koala_KDirWatch_setDirCreated(JNIEnv *env, jobject obj, jstring arg1)
//{
//static QString * _qstring_arg1 = 0;
//pd
//	((KDirWatch*) QtSupport::getQt(env, obj))->setDirCreated((QString&) * (QString *) QtSupport::toQString(env, arg1, &_qstring_arg1));
//	return;
//}

//JNIEXPORT void JNICALL
//Java_org_kde_koala_KDirWatch_setDirDirty(JNIEnv *env, jobject obj, jstring arg1)
//{
//static QString * _qstring_arg1 = 0;
//pd
//	((KDirWatch*) QtSupport::getQt(env, obj))->setDirDirty((QString&) * (QString *) QtSupport::toQString(env, arg1, &_qstring_arg1));
//	return;
//}

//JNIEXPORT void JNICALL
//Java_org_kde_koala_KDirWatch_setDirDeleted(JNIEnv *env, jobject obj, jstring arg1)
//{
//static QString * _qstring_arg1 = 0;
//pd
//	((KDirWatch*) QtSupport::getQt(env, obj))->setDirDeleted((QString&) * (QString *) QtSupport::toQString(env, arg1, &_qstring_arg1));
//	return;
//}

//JNIEXPORT void JNICALL
//Java_org_kde_koala_KDirWatch_setFileCreated(JNIEnv *env, jobject obj, jstring arg1)
//{
//static QString * _qstring_arg1 = 0;
//pd
//	((KDirWatch*) QtSupport::getQt(env, obj))->setFileCreated((QString&) * (QString *) QtSupport::toQString(env, arg1, &_qstring_arg1));
//	return;
//}

//JNIEXPORT void JNICALL
//Java_org_kde_koala_KDirWatch_setFileDirty(JNIEnv *env, jobject obj, jstring arg1)
//{
//static QString * _qstring_arg1 = 0;
//pd
//	((KDirWatch*) QtSupport::getQt(env, obj))->setFileDirty((QString&) * (QString *) QtSupport::toQString(env, arg1, &_qstring_arg1));
//	return;
//}

//JNIEXPORT void JNICALL
//Java_org_kde_koala_KDirWatch_setFileDeleted(JNIEnv *env, jobject obj, jstring arg1)
//{
//static QString * _qstring_arg1 = 0;
//pd
//	((KDirWatch*) QtSupport::getQt(env, obj))->setFileDeleted((QString&) * (QString *) QtSupport::toQString(env, arg1, &_qstring_arg1));
//	return;
//}

JNIEXPORT void JNICALL
Java_org_kde_koala_KDirWatch_statistics(JNIEnv *env, jclass obj)
{
	KDirWatchJBridge::statistics();
	return;
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_KDirWatch_self(JNIEnv *env, jclass obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)KDirWatchJBridge::self(), "org.kde.koala.KDirWatch");
}

