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

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

class KArchiveEntryJBridge : public KArchiveEntry
{
public:
	KArchiveEntryJBridge(KArchive* archive, const QString& name, int access, int date, const QString& user, const QString& group, const QString& symlink) : KArchiveEntry(archive, name, access, date, user, group, symlink) {}
	~KArchiveEntryJBridge() {QtSupport::qtKeyDeleted(this);}
	KArchive*  protected_archive() {
		return (KArchive* ) KArchiveEntry::archive();
	}
};


JNIEXPORT void JNICALL
Java_org_kde_koala_KArchiveEntry_newKArchiveEntry(JNIEnv *env, jobject obj, jobject archive, jstring name, jint access, jint date, jstring user, jstring group, jstring symlink)
{
static QString * _qstring_symlink = 0;
static QString * _qstring_group = 0;
static QString * _qstring_user = 0;
static QString * _qstring_name = 0;
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new KArchiveEntryJBridge((KArchive*) QtSupport::getQt(env, archive), (QString&) * (QString *) QtSupport::toQString(env, name, &_qstring_name), (int) access, (int) date, (QString&) * (QString *) QtSupport::toQString(env, user, &_qstring_user), (QString&) * (QString *) QtSupport::toQString(env, group, &_qstring_group), (QString&) * (QString *) QtSupport::toQString(env, symlink, &_qstring_symlink)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

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

JNIEXPORT void JNICALL
Java_org_kde_koala_KArchiveEntry_dispose(JNIEnv *env, jobject obj)
{
	Java_org_kde_koala_KArchiveEntry_finalize(env, obj);
	return;
}

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

JNIEXPORT jobject JNICALL
Java_org_kde_koala_KArchiveEntry_datetime(JNIEnv *env, jobject obj)
{
	QDateTime  _qdate;
	_qdate = ((KArchiveEntry*) QtSupport::getQt(env, obj))->datetime();
	return (jobject) QtSupport::fromQDateTime(env, (QDateTime *) &_qdate);
}

JNIEXPORT jint JNICALL
Java_org_kde_koala_KArchiveEntry_date(JNIEnv *env, jobject obj)
{
	return (jint) ((KArchiveEntry*) QtSupport::getQt(env, obj))->date();
}

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

JNIEXPORT jlong JNICALL
Java_org_kde_koala_KArchiveEntry_permissions(JNIEnv *env, jobject obj)
{
	return (jlong) ((KArchiveEntry*) QtSupport::getQt(env, obj))->permissions();
}

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

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

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

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_KArchiveEntry_isFile(JNIEnv *env, jobject obj)
{
	return (jboolean) ((KArchiveEntry*) QtSupport::getQt(env, obj))->isFile();
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_KArchiveEntry_isDirectory(JNIEnv *env, jobject obj)
{
	return (jboolean) ((KArchiveEntry*) QtSupport::getQt(env, obj))->isDirectory();
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_KArchiveEntry_archive(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)((KArchiveEntryJBridge*) QtSupport::getQt(env, obj))->protected_archive(), "org.kde.koala.KArchive");
}

