/***************************************************************************
                            KConfigINIBackEnd.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_KConfigINIBackEnd.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/KConfigINIBackEnd.h>
#include <kdeobjc/KConfigBase.h>


@implementation  KConfigINIBackEnd


- initWithConfigBase: (KConfigBase*)_config _fileName: (NSString *)_fileName _resType: (NSString *)_resType _useKDEGlobals: (BOOL)_useKDEGlobals
{
static qt_QString * _qstring__fileName = 0L;
	if ([self qt] == 0L) {
		[self setQt: kde_new_KConfigINIBackEnd((kde_KConfigBase*) [_config qt], (qt_QString *) [_fileName toQString: &_qstring__fileName], (char*) [_resType cString], (int)_useKDEGlobals)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithConfigBase: (KConfigBase*)_config _fileName: (NSString *)_fileName _resType: (NSString *)_resType 
{
static qt_QString * _qstring__fileName = 0L;
	if ([self qt] == 0L) {
		[self setQt: kde_new_KConfigINIBackEnd((kde_KConfigBase*) [_config qt], (qt_QString *) [_fileName toQString: &_qstring__fileName], (char*) [_resType cString], 1)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

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

- (BOOL) parseConfigFiles
{
	return (BOOL) kde_KConfigINIBackEnd_parseConfigFiles((kde_KConfigINIBackEnd *)[self qt]);
}

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

- sync
{
	kde_KConfigINIBackEnd_sync((kde_KConfigINIBackEnd *)[self qt], 1);
	return self;
}

//- parseSingleConfigFile: (QFile *)rFile pWriteBackMap: (KEntryMap*)pWriteBackMap bGlobal: (BOOL)bGlobal bDefault: (BOOL)bDefault
//{
//	kde_KConfigINIBackEnd_parseSingleConfigFile((kde_KConfigINIBackEnd *)[self qt], (qt_QFile *) [rFile qt], (kde_KEntryMap*) [pWriteBackMap qt], (int)bGlobal, (int)bDefault);
//	return self;
//}

//- parseSingleConfigFile: (QFile *)rFile
//{
//	kde_KConfigINIBackEnd_parseSingleConfigFile((kde_KConfigINIBackEnd *)[self qt], (qt_QFile *) [rFile qt], 0L, 0, 0);
//	return self;
//}

- (BOOL) writeConfigFile: (NSString *)filename bGlobal: (BOOL)bGlobal bMerge: (BOOL)bMerge
{
static qt_QString * _qstring_filename = 0L;
	return (BOOL) kde_KConfigINIBackEnd_writeConfigFile((kde_KConfigINIBackEnd *)[self qt], (qt_QString *) [filename toQString: &_qstring_filename], (int)bGlobal, (int)bMerge);
}

- (BOOL) writeConfigFile: (NSString *)filename 
{
static qt_QString * _qstring_filename = 0L;
	return (BOOL) kde_KConfigINIBackEnd_writeConfigFile((kde_KConfigINIBackEnd *)[self qt], (qt_QString *) [filename toQString: &_qstring_filename], 0, 1);
}

@end
