/***************************************************************************
                            NetAccess.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 <kio/netaccess.h>
#include <qstring.h>
#include <qcstring.h>

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

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_NetAccess_download(JNIEnv *env, jclass obj, jobject src, jobject target)
{
static QString * _qstring_target = 0;
	jboolean result = (jboolean) KIO::NetAccess::download((KURL&) *(KURL *) QtSupport::getQt(env, src), (QString&) * (QString *) QtSupport::toQStringFromStringBuffer(env, target, &_qstring_target));
	QtSupport::fromQStringToStringBuffer(env, _qstring_target, target);
	return result;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_NetAccess_removeTempFile(JNIEnv *env, jclass obj, jstring name)
{
static QString * _qstring_name = 0;
	KIO::NetAccess::removeTempFile((QString&) * (QString *) QtSupport::toQString(env, name, &_qstring_name));
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_NetAccess_upload(JNIEnv *env, jclass obj, jstring src, jobject target)
{
static QString * _qstring_src = 0;
	return (jboolean) KIO::NetAccess::upload((QString&) * (QString *) QtSupport::toQString(env, src, &_qstring_src), (KURL&) *(KURL *) QtSupport::getQt(env, target));
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_NetAccess_copy(JNIEnv *env, jclass obj, jobject src, jobject target)
{
	return (jboolean) KIO::NetAccess::copy((KURL&) *(KURL *) QtSupport::getQt(env, src), (KURL&) *(KURL *) QtSupport::getQt(env, target));
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_NetAccess_dircopy(JNIEnv *env, jclass obj, jobject src, jobject target)
{
	return (jboolean) KIO::NetAccess::dircopy((KURL&) *(KURL *) QtSupport::getQt(env, src), (KURL&) *(KURL *) QtSupport::getQt(env, target));
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_NetAccess_exists(JNIEnv *env, jclass obj, jobject url)
{
	return (jboolean) KIO::NetAccess::exists((KURL&) *(KURL *) QtSupport::getQt(env, url));
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_NetAccess_stat(JNIEnv *env, jclass obj, jobject url, jobject entry)
{
	return (jboolean) KIO::NetAccess::stat((KURL&) *(KURL *) QtSupport::getQt(env, url), (KIO::UDSEntry&) *(KIO::UDSEntry *) QtSupport::getQt(env, entry));
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_NetAccess_del(JNIEnv *env, jclass obj, jobject url)
{
	return (jboolean) KIO::NetAccess::del((KURL&) *(KURL *) QtSupport::getQt(env, url));
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_NetAccess_mkdir__Lorg_kde_koala_KURL_2I(JNIEnv *env, jclass obj, jobject url, jint permissions)
{
	return (jboolean) KIO::NetAccess::mkdir((KURL&) *(KURL *) QtSupport::getQt(env, url), (int) permissions);
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_NetAccess_mkdir__Lorg_kde_koala_KURL_2(JNIEnv *env, jclass obj, jobject url)
{
	return (jboolean) KIO::NetAccess::mkdir((KURL&) *(KURL *) QtSupport::getQt(env, url), -1);
}

//JNIEXPORT jstring JNICALL
//Java_org_kde_koala_NetAccess_mimetype(JNIEnv *env, jclass obj, jobject url)
//{
//	QString  _qstring;
//	_qstring = KIO::NetAccess::mimetype((KURL&) *(KURL *) QtSupport::getQt(env, url));
//	return QtSupport::fromQString(env, &_qstring);
//}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_NetAccess_lastErrorString(JNIEnv *env, jclass obj)
{
	QString  _qstring;
	_qstring = KIO::NetAccess::lastErrorString();
	return QtSupport::fromQString(env, &_qstring);
}

