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

@implementation  KConfigBackEnd

- (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_KConfigBackEnd((kde_KConfigBackEnd *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- (BOOL) parseConfigFiles
{
	return (BOOL) kde_KConfigBackEnd_parseConfigFiles((kde_KConfigBackEnd *)[self qt]);
}

- sync: (BOOL)bMerge
{
	kde_KConfigBackEnd_sync((kde_KConfigBackEnd *)[self qt], (int)bMerge);
	return self;
}

- sync
{
	kde_KConfigBackEnd_sync((kde_KConfigBackEnd *)[self qt], 1);
	return self;
}

- changeFileName: (NSString *)_fileName _resType: (NSString *)_resType _useKDEGlobals: (BOOL)_useKDEGlobals
{
static qt_QString * _qstring__fileName = 0L;
	kde_KConfigBackEnd_changeFileName((kde_KConfigBackEnd *)[self qt], (qt_QString *) [_fileName toQString: &_qstring__fileName], (char*) [_resType cString], (int)_useKDEGlobals);
	return self;
}

//- (int) getConfigState
//{
//	return (int) kde_KConfigBackEnd_getConfigState((kde_KConfigBackEnd *)[self qt]);
//}

- (NSString *) fileName
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KConfigBackEnd_fileName((kde_KConfigBackEnd *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (NSString *) resource
{
	return (NSString *) [NSString stringWithCString: kde_KConfigBackEnd_resource((kde_KConfigBackEnd *)[self qt])];
}

- setLocaleString: (NSString *)_localeString
{
static qt_QCString * _qcstring__localeString = 0L;
	kde_KConfigBackEnd_setLocaleString((kde_KConfigBackEnd *)[self qt], (qt_QCString*) [_localeString toQCString: &_qcstring__localeString]);
	return self;
}

@end
