/***************************************************************************
                            KFileMetaInfoItem.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_KFileMetaInfoItem.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/KFileMetaInfoItem.h>
#include <qtobjc/QVariant.h>


@implementation  KFileMetaInfoItem

- (void *) qt
{
	return _qt;
}

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

- (BOOL) allocatedInObjcWorld
{
	return _allocatedInObjcWorld;
}

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


//- initWithText: (NSString *)key translatedKey: (NSString *)translatedKey value: (QVariant *)value editable: (BOOL)editable prefix: (NSString *)prefix suffix: (NSString *)suffix
//{
//static qt_QString * _qstring_suffix = 0L;
//static qt_QString * _qstring_prefix = 0L;
//static qt_QString * _qstring_translatedKey = 0L;
//static qt_QString * _qstring_key = 0L;
//	if ([self qt] == 0L) {
//		[self setQt: kde_new_KFileMetaInfoItem((qt_QString *) [key toQString: &_qstring_key], (qt_QString *) [translatedKey toQString: &_qstring_translatedKey], (qt_QVariant *) [value qt], (int)editable, (qt_QString *) [prefix toQString: &_qstring_prefix], (qt_QString *) [suffix toQString: &_qstring_suffix])];
//		[self setAllocatedInObjcWorld: YES];
//		[QtSupport setObject: self forQtKey: [self qt]];
//	}
//	[super init];
//	return self;
//}

//- initWithText: (NSString *)key translatedKey: (NSString *)translatedKey value: (QVariant *)value
//{
//static qt_QString * _qstring_translatedKey = 0L;
//static qt_QString * _qstring_key = 0L;
//	if ([self qt] == 0L) {
//		[self setQt: kde_new_KFileMetaInfoItem((qt_QString *) [key toQString: &_qstring_key], (qt_QString *) [translatedKey toQString: &_qstring_translatedKey], (qt_QVariant *) [value qt], 0, qt_QString_null(), qt_QString_null())];
//		[self setAllocatedInObjcWorld: YES];
//		[QtSupport setObject: self forQtKey: [self qt]];
//	}
//	[super init];
//	return self;
//}

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

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

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

- (NSString *) key
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KFileMetaInfoItem_key((kde_KFileMetaInfoItem *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (NSString *) translatedKey
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KFileMetaInfoItem_translatedKey((kde_KFileMetaInfoItem *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (QVariant*) value
{
	return (QVariant*) [QtSupport objectForQtKey: kde_KFileMetaInfoItem_value((kde_KFileMetaInfoItem *)[self qt]) withClass: [QVariant class] allocatedInObjcWorld: YES];
}

- setValue: (QVariant *)value
{
	kde_KFileMetaInfoItem_setValue((kde_KFileMetaInfoItem *)[self qt], (qt_QVariant *) [value qt]);
	return self;
}

- (int) type
{
	return (int) kde_KFileMetaInfoItem_type((kde_KFileMetaInfoItem *)[self qt]);
}

- (BOOL) isEditable
{
	return (BOOL) kde_KFileMetaInfoItem_isEditable((kde_KFileMetaInfoItem *)[self qt]);
}

//- remove
//{
//	kde_KFileMetaInfoItem_remove((kde_KFileMetaInfoItem *)[self qt]);
//	return self;
//}

- (BOOL) isRemoved
{
	return (BOOL) kde_KFileMetaInfoItem_isRemoved((kde_KFileMetaInfoItem *)[self qt]);
}

- (BOOL) isModified
{
	return (BOOL) kde_KFileMetaInfoItem_isModified((kde_KFileMetaInfoItem *)[self qt]);
}

- (NSString *) prefix
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KFileMetaInfoItem_prefix((kde_KFileMetaInfoItem *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (NSString *) suffix
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KFileMetaInfoItem_suffix((kde_KFileMetaInfoItem *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (BOOL) isValid
{
	return (BOOL) kde_KFileMetaInfoItem_isValid((kde_KFileMetaInfoItem *)[self qt]);
}

@end
