/***************************************************************************
                            KTrader.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_KTrader.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/KTrader.h>

@implementation  KTrader


- (void) dealloc
{
	if ([self qt] != 0L) {
		if ([self allocatedInObjcWorld] && [self parent] == nil) {
			kde_del_KTrader((kde_KTrader *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- (NSArray *) query: (NSString *)servicetype constraint: (NSString *)constraint preferences: (NSString *)preferences
{
static kde_OfferList * _qlist = 0L;
static qt_QString * _qstring_preferences = 0L;
static qt_QString * _qstring_constraint = 0L;
static qt_QString * _qstring_servicetype = 0L;
	_qlist = kde_KTrader_query((kde_KTrader *)[self qt], (qt_QString *) [servicetype toQString: &_qstring_servicetype], (qt_QString *) [constraint toQString: &_qstring_constraint], (qt_QString *) [preferences toQString: &_qstring_preferences]);
	return (NSArray *) [NSMutableArray arrayWithOfferList: _qlist];
}

- (NSArray *) query: (NSString *)servicetype genericServiceType: (NSString *)genericServiceType constraint: (NSString *)constraint preferences: (NSString *)preferences
{
static kde_OfferList * _qlist = 0L;
static qt_QString * _qstring_preferences = 0L;
static qt_QString * _qstring_constraint = 0L;
static qt_QString * _qstring_genericServiceType = 0L;
static qt_QString * _qstring_servicetype = 0L;
	_qlist = kde_KTrader_query1((kde_KTrader *)[self qt], (qt_QString *) [servicetype toQString: &_qstring_servicetype], (qt_QString *) [genericServiceType toQString: &_qstring_genericServiceType], (qt_QString *) [constraint toQString: &_qstring_constraint], (qt_QString *) [preferences toQString: &_qstring_preferences]);
	return (NSArray *) [NSMutableArray arrayWithOfferList: _qlist];
}

+ (KTrader*) self
{
	return (KTrader*) [QtSupport objectForQtKey: kde_KTrader_self() withClass: [KTrader class] allocatedInObjcWorld: YES];
}

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

@end
