/***************************************************************************
                            KServiceType.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_KServiceType.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/KServiceType.h>
#include <kdeobjc/KDesktopFile.h>
#include <qtobjc/QDataStream.h>


@implementation  KServiceType


- initWithText: (NSString *)_fullpath _name: (NSString *)_name _icon: (NSString *)_icon _comment: (NSString *)_comment
{
static qt_QString * _qstring__comment = 0L;
static qt_QString * _qstring__icon = 0L;
static qt_QString * _qstring__name = 0L;
static qt_QString * _qstring__fullpath = 0L;
	if ([self qt] == 0L) {
		[self setQt: kde_new_KServiceType((qt_QString *) [_fullpath toQString: &_qstring__fullpath], (qt_QString *) [_name toQString: &_qstring__name], (qt_QString *) [_icon toQString: &_qstring__icon], (qt_QString *) [_comment toQString: &_qstring__comment])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

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

- initWithDesktopFile: (KDesktopFile*)config
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KServiceType2((kde_KDesktopFile*) [config qt])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithDataStream: (QDataStream *)_str offset: (int)offset
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KServiceType3((qt_QDataStream *) [_str qt], (int)offset)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

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

- (NSString *) icon
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KServiceType_icon((kde_KServiceType *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (NSString *) comment
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KServiceType_comment((kde_KServiceType *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (NSString *) name
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KServiceType_name((kde_KServiceType *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (NSString *) desktopEntryPath
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KServiceType_desktopEntryPath((kde_KServiceType *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (BOOL) isDerived
{
	return (BOOL) kde_KServiceType_isDerived((kde_KServiceType *)[self qt]);
}

- (NSString *) parentServiceType
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KServiceType_parentServiceType((kde_KServiceType *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (QVariant*) property: (NSString *)_name
{
static qt_QString * _qstring__name = 0L;
	return (QVariant*) [QtSupport objectForQtKey: kde_KServiceType_property((kde_KServiceType *)[self qt], (qt_QString *) [_name toQString: &_qstring__name]) withClass: [QVariant class] allocatedInObjcWorld: YES];
}

- (NSArray *) propertyNames
{
static qt_QStringList * _qlist = 0L;
	_qlist = kde_KServiceType_propertyNames((kde_KServiceType *)[self qt]);
	return (NSArray *) [NSMutableArray arrayWithQStringList: _qlist];
}

- (BOOL) isValid
{
	return (BOOL) kde_KServiceType_isValid((kde_KServiceType *)[self qt]);
}

- (int) propertyDef: (NSString *)_name
{
static qt_QString * _qstring__name = 0L;
	return (int) kde_KServiceType_propertyDef((kde_KServiceType *)[self qt], (qt_QString *) [_name toQString: &_qstring__name]);
}

- (NSArray *) propertyDefNames
{
static qt_QStringList * _qlist = 0L;
	_qlist = kde_KServiceType_propertyDefNames((kde_KServiceType *)[self qt]);
	return (NSArray *) [NSMutableArray arrayWithQStringList: _qlist];
}

- save: (QDataStream *)arg1
{
	kde_KServiceType_save((kde_KServiceType *)[self qt], (qt_QDataStream *) [arg1 qt]);
	return self;
}

- load: (QDataStream *)arg1
{
	kde_KServiceType_load((kde_KServiceType *)[self qt], (qt_QDataStream *) [arg1 qt]);
	return self;
}

+ (void*) serviceType: (NSString *)_name
{
static qt_QString * _qstring__name = 0L;
	return (void*) kde_KServiceType_serviceType((qt_QString *) [_name toQString: &_qstring__name]);
}

//+ (KService_List*) offers: (NSString *)_servicetype
//{
//static qt_QString * _qstring__servicetype = 0L;
//	return (KService_List*) kde_KServiceType_offers((qt_QString *) [_servicetype toQString: &_qstring__servicetype]);
//}

//+ (List) allServiceTypes
//{
//	return (List) [QtSupport objectForQtKey: kde_KServiceType_allServiceTypes() withClass: [ class] allocatedInObjcWorld: YES];
//}

- init: (KDesktopFile*)config
{
	kde_KServiceType_init((kde_KServiceType *)[self qt], (kde_KDesktopFile*) [config qt]);
	return self;
}

@end
