/***************************************************************************
                            OpenURLEvent.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_OpenURLEvent.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/OpenURLEvent.h>
#include <kdeobjc/KURL.h>
#include <kdeobjc/ReadOnlyPart.h>
#include <kdeobjc/URLArgs.h>


@implementation  OpenURLEvent


- initWithReadOnlyPart: (ReadOnlyPart*)part url: (KURL*)url args: (URLArgs*)args
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_OpenURLEvent((kde_ReadOnlyPart*) [part qt], (kde_KURL*) [url qt], (kde_URLArgs*) [args qt])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

//- initWithReadOnlyPart: (ReadOnlyPart*)part url: (KURL*)url
//{
//	if ([self qt] == 0L) {
//		[self setQt: kde_new_OpenURLEvent((kde_ReadOnlyPart*) [part qt], (kde_KURL*) [url qt], [OpenURLEvent URLArgs])];
//		[self setAllocatedInObjcWorld: YES];
//		[QtSupport setObject: self forQtKey: [self qt]];
//	}
//	[super init];
//	return self;
//}

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

- (ReadOnlyPart*) part
{
	return (ReadOnlyPart*) [QtSupport objectForQtKey: kde_OpenURLEvent_part((kde_OpenURLEvent *)[self qt]) withClass: [ReadOnlyPart class] allocatedInObjcWorld: YES];
}

- (KURL*) url
{
	return (KURL*) [QtSupport objectForQtKey: kde_OpenURLEvent_url((kde_OpenURLEvent *)[self qt]) withClass: [KURL class] allocatedInObjcWorld: YES];
}

- (URLArgs*) args
{
	return (URLArgs*) [QtSupport objectForQtKey: kde_OpenURLEvent_args((kde_OpenURLEvent *)[self qt]) withClass: [URLArgs class] allocatedInObjcWorld: YES];
}

+ (BOOL) test: (QEvent *)event
{
	return (BOOL) kde_OpenURLEvent_test((qt_QEvent *) [event qt]);
}

@end
