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

@implementation  KServiceTypeProfile

- (void *) qt
{
	return _qt;
}

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

- (BOOL) allocatedInObjcWorld
{
	return _allocatedInObjcWorld;
}

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


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

- (int) preference: (NSString *)_service
{
static qt_QString * _qstring__service = 0L;
	return (int) kde_KServiceTypeProfile_preference((kde_KServiceTypeProfile *)[self qt], (qt_QString *) [_service toQString: &_qstring__service]);
}

- (BOOL) allowAsDefault: (NSString *)_service
{
static qt_QString * _qstring__service = 0L;
	return (BOOL) kde_KServiceTypeProfile_allowAsDefault((kde_KServiceTypeProfile *)[self qt], (qt_QString *) [_service toQString: &_qstring__service]);
}

//- (NSArray *) offers
//{
//static kde_OfferList * _qlist = 0L;
//	_qlist = kde_KServiceTypeProfile_offers((kde_KServiceTypeProfile *)[self qt]);
//	return (NSArray *) [NSMutableArray arrayWithOfferList: _qlist];
//}

//+ (KService_Ptr*) preferredService: (NSString *)serviceType genericServiceType: (NSString *)genericServiceType
//{
//static qt_QString * _qstring_genericServiceType = 0L;
//static qt_QString * _qstring_serviceType = 0L;
//	return (KService_Ptr*) kde_KServiceTypeProfile_preferredService((qt_QString *) [serviceType toQString: &_qstring_serviceType], (qt_QString *) [genericServiceType toQString: &_qstring_genericServiceType]);
//}

+ (KServiceTypeProfile*) serviceTypeProfile: (NSString *)servicetype genericServiceType: (NSString *)genericServiceType
{
static qt_QString * _qstring_genericServiceType = 0L;
static qt_QString * _qstring_servicetype = 0L;
	return (KServiceTypeProfile*) [QtSupport objectForQtKey: kde_KServiceTypeProfile_serviceTypeProfile((qt_QString *) [servicetype toQString: &_qstring_servicetype], (qt_QString *) [genericServiceType toQString: &_qstring_genericServiceType]) withClass: [KServiceTypeProfile class] allocatedInObjcWorld: YES];
}

+ (KServiceTypeProfile*) serviceTypeProfile: (NSString *)servicetype 
{
static qt_QString * _qstring_servicetype = 0L;
	return (KServiceTypeProfile*) [QtSupport objectForQtKey: kde_KServiceTypeProfile_serviceTypeProfile((qt_QString *) [servicetype toQString: &_qstring_servicetype], qt_QString_null()) withClass: [KServiceTypeProfile class] allocatedInObjcWorld: YES];
}

//+ (NSArray *) offers: (NSString *)servicetype genericServiceType: (NSString *)genericServiceType
//{
//static kde_OfferList * _qlist = 0L;
//static qt_QString * _qstring_genericServiceType = 0L;
//static qt_QString * _qstring_servicetype = 0L;
//	_qlist = kde_KServiceTypeProfile_offers1((qt_QString *) [servicetype toQString: &_qstring_servicetype], (qt_QString *) [genericServiceType toQString: &_qstring_genericServiceType]);
//	return (NSArray *) [NSMutableArray arrayWithOfferList: _qlist];
//}

+ clear
{
	kde_KServiceTypeProfile_clear();
	return self;
}

+ setConfigurationMode
{
	kde_KServiceTypeProfile_setConfigurationMode();
	return self;
}

+ (BOOL) configurationMode
{
	return (BOOL) kde_KServiceTypeProfile_configurationMode();
}

- initWithText: (NSString *)_servicetype _genericServiceType: (NSString *)_genericServiceType
{
static qt_QString * _qstring__genericServiceType = 0L;
static qt_QString * _qstring__servicetype = 0L;
	if ([self qt] == 0L) {
		[self setQt: kde_new_KServiceTypeProfile((qt_QString *) [_servicetype toQString: &_qstring__servicetype], (qt_QString *) [_genericServiceType toQString: &_qstring__genericServiceType])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithText: (NSString *)_servicetype 
{
static qt_QString * _qstring__servicetype = 0L;
	if ([self qt] == 0L) {
		[self setQt: kde_new_KServiceTypeProfile((qt_QString *) [_servicetype toQString: &_qstring__servicetype], qt_QString_null())];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- addService: (NSString *)_service _preference: (int)_preference _allow_as_default: (BOOL)_allow_as_default
{
static qt_QString * _qstring__service = 0L;
	kde_KServiceTypeProfile_addService((kde_KServiceTypeProfile *)[self qt], (qt_QString *) [_service toQString: &_qstring__service], (int)_preference, (int)_allow_as_default);
	return self;
}

- addService: (NSString *)_service 
{
static qt_QString * _qstring__service = 0L;
	kde_KServiceTypeProfile_addService((kde_KServiceTypeProfile *)[self qt], (qt_QString *) [_service toQString: &_qstring__service], 1, 1);
	return self;
}

@end
