/***************************************************************************
                            KURIFilterData.m -  description
                             -------------------
    begin                : Fri Mar  8 13:55:08 2002
    copyright            : (C) 2000-2002 Lost Highway Ltd. All rights reserved.
    email                : Lost_Highway@tipitina.demon.co.uk
    generated by         : duke@tipitina on Fri Mar  8 13:55:08 2002, using kalyptus 0.9.
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This library is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU Library General Public License as       *
 *   published by the Free Software Foundation; either version 2 of the    *
 *   License, or (at your option) any later version.                       *
 *                                                                         *
 ***************************************************************************/

#include <qtc/qt_QString.h>
#include <qtc/qt_QCString.h>
#include <kdec/kde_KURIFilterData.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/KURIFilterData.h>
#include <kdeobjc/KURL.h>


@implementation  KURIFilterData

- (void *) qt
{
	return _qt;
}

- setQt: (void *) qt
{
	_qt = qt;
	return self;
}

- (BOOL) allocatedInObjcWorld
{
	return _allocatedInObjcWorld;
}

- setAllocatedInObjcWorld: (BOOL) yn
{
	_allocatedInObjcWorld = yn;
	return self;
}


- init
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KURIFilterData()];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithURL: (KURL*)url
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KURIFilterData1((kde_KURL*) [url qt])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithText: (NSString *)url
{
static qt_QString * _qstring_url = 0L;
	if ([self qt] == 0L) {
		[self setQt: kde_new_KURIFilterData2((qt_QString *) [url toQString: &_qstring_url])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- copyWithZone: (NSZone *) zone
{
	KURIFilterData * aCopy;
	aCopy = [[(KURIFilterData *)[[self class] allocWithZone: zone] setQt: kde_new_KURIFilterData3([self qt])] init];
	[aCopy setAllocatedInObjcWorld: YES];
	[QtSupport setObject: aCopy forQtKey: [aCopy qt]];
	return aCopy;
}

- (void) dealloc
{
	if ([self qt] != 0L) {
		if ([self allocatedInObjcWorld]) {
			kde_del_KURIFilterData((kde_KURIFilterData *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- (BOOL) hasBeenFiltered
{
	return (BOOL) kde_KURIFilterData_hasBeenFiltered((kde_KURIFilterData *)[self qt]);
}

- (KURL*) uri
{
	return (KURL*) [QtSupport objectForQtKey: kde_KURIFilterData_uri((kde_KURIFilterData *)[self qt]) withClass: [KURL class] allocatedInObjcWorld: YES];
}

- (NSString *) errorMsg
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KURIFilterData_errorMsg((kde_KURIFilterData *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (int) uriType
{
	return (int) kde_KURIFilterData_uriType((kde_KURIFilterData *)[self qt]);
}

- setData: (NSString *)url
{
static qt_QString * _qstring_url = 0L;
	kde_KURIFilterData_setData((kde_KURIFilterData *)[self qt], (qt_QString *) [url toQString: &_qstring_url]);
	return self;
}

- setDataFromURL: (KURL*)url
{
	kde_KURIFilterData_setData1((kde_KURIFilterData *)[self qt], (kde_KURL*) [url qt]);
	return self;
}

- (BOOL) setAbsolutePath: (NSString *)arg1
{
static qt_QString * _qstring_arg1 = 0L;
	return (BOOL) kde_KURIFilterData_setAbsolutePath((kde_KURIFilterData *)[self qt], (qt_QString *) [arg1 toQString: &_qstring_arg1]);
}

- (NSString *) absolutePath
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KURIFilterData_absolutePath((kde_KURIFilterData *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (BOOL) hasAbsolutePath
{
	return (BOOL) kde_KURIFilterData_hasAbsolutePath((kde_KURIFilterData *)[self qt]);
}

- (NSString *) argsAndOptions
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KURIFilterData_argsAndOptions((kde_KURIFilterData *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (BOOL) hasArgsAndOptions
{
	return (BOOL) kde_KURIFilterData_hasArgsAndOptions((kde_KURIFilterData *)[self qt]);
}

- (NSString *) iconName
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KURIFilterData_iconName((kde_KURIFilterData *)[self qt]);
	return [NSString fromQString: _qstring];
}

- init: (KURL*)url
{
	kde_KURIFilterData_init((kde_KURIFilterData *)[self qt], (kde_KURL*) [url qt]);
	return self;
}

//- init
//{
//	kde_KURIFilterData_init((kde_KURIFilterData *)[self qt], qt_QString_null());
//	return self;
//}

+ (int) NET_PROTOCOL
{
	return (int) KURIFILTERDATA_NET_PROTOCOL;
}

+ (int) LOCAL_FILE
{
	return (int) KURIFILTERDATA_LOCAL_FILE;
}

+ (int) LOCAL_DIR
{
	return (int) KURIFILTERDATA_LOCAL_DIR;
}

+ (int) EXECUTABLE
{
	return (int) KURIFILTERDATA_EXECUTABLE;
}

+ (int) HELP
{
	return (int) KURIFILTERDATA_HELP;
}

+ (int) SHELL
{
	return (int) KURIFILTERDATA_SHELL;
}

+ (int) BLOCKED
{
	return (int) KURIFILTERDATA_BLOCKED;
}

+ (int) ERROR
{
	return (int) KURIFILTERDATA_ERROR;
}

+ (int) UNKNOWN
{
	return (int) KURIFILTERDATA_UNKNOWN;
}

@end
