/***************************************************************************
                            KHTMLSettings.m -  description
                             -------------------
    begin                : Thu Mar 21 01:01:29 2002
    copyright            : (C) 2000-2002 Lost Highway Ltd. All rights reserved.
    email                : Lost_Highway@tipitina.demon.co.uk
    generated by         : duke@tipitina on Thu Mar 21 01:01:29 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_KHTMLSettings.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/KHTMLSettings.h>
#include <kdeobjc/KConfig.h>


@implementation  KHTMLSettings

- (void *) qt
{
	return _qt;
}

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

- (BOOL) allocatedInObjcWorld
{
	return _allocatedInObjcWorld;
}

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


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

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

- initSettings
{
	kde_KHTMLSettings_init((kde_KHTMLSettings *)[self qt]);
	return self;
}

- initSettings: (KConfig*)config reset: (BOOL)reset
{
	kde_KHTMLSettings_init1((kde_KHTMLSettings *)[self qt], (kde_KConfig*) [config qt], (int)reset);
	return self;
}

- initSettings: (KConfig*)config
{
	kde_KHTMLSettings_init1((kde_KHTMLSettings *)[self qt], (kde_KConfig*) [config qt], 1);
	return self;
}

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

- (BOOL) changeCursor
{
	return (BOOL) kde_KHTMLSettings_changeCursor((kde_KHTMLSettings *)[self qt]);
}

- (BOOL) underlineLink
{
	return (BOOL) kde_KHTMLSettings_underlineLink((kde_KHTMLSettings *)[self qt]);
}

- (BOOL) hoverLink
{
	return (BOOL) kde_KHTMLSettings_hoverLink((kde_KHTMLSettings *)[self qt]);
}

- (int) showAnimations
{
	return (int) kde_KHTMLSettings_showAnimations((kde_KHTMLSettings *)[self qt]);
}

- (NSString *) stdFontName
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KHTMLSettings_stdFontName((kde_KHTMLSettings *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (NSString *) fixedFontName
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KHTMLSettings_fixedFontName((kde_KHTMLSettings *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (NSString *) serifFontName
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KHTMLSettings_serifFontName((kde_KHTMLSettings *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (NSString *) sansSerifFontName
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KHTMLSettings_sansSerifFontName((kde_KHTMLSettings *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (NSString *) cursiveFontName
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KHTMLSettings_cursiveFontName((kde_KHTMLSettings *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (NSString *) fantasyFontName
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KHTMLSettings_fantasyFontName((kde_KHTMLSettings *)[self qt]);
	return [NSString fromQString: _qstring];
}

- setStdFontName: (NSString *)n
{
static qt_QString * _qstring_n = 0L;
	kde_KHTMLSettings_setStdFontName((kde_KHTMLSettings *)[self qt], (qt_QString *) [n toQString: &_qstring_n]);
	return self;
}

- setFixedFontName: (NSString *)n
{
static qt_QString * _qstring_n = 0L;
	kde_KHTMLSettings_setFixedFontName((kde_KHTMLSettings *)[self qt], (qt_QString *) [n toQString: &_qstring_n]);
	return self;
}

- (int) minFontSize
{
	return (int) kde_KHTMLSettings_minFontSize((kde_KHTMLSettings *)[self qt]);
}

- (int) mediumFontSize
{
	return (int) kde_KHTMLSettings_mediumFontSize((kde_KHTMLSettings *)[self qt]);
}

- (NSString *) encoding
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KHTMLSettings_encoding((kde_KHTMLSettings *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (QColor*) textColor
{
	return (QColor*) [QtSupport objectForQtKey: kde_KHTMLSettings_textColor((kde_KHTMLSettings *)[self qt]) withClass: [QColor class] allocatedInObjcWorld: YES];
}

- (QColor*) linkColor
{
	return (QColor*) [QtSupport objectForQtKey: kde_KHTMLSettings_linkColor((kde_KHTMLSettings *)[self qt]) withClass: [QColor class] allocatedInObjcWorld: YES];
}

- (QColor*) vLinkColor
{
	return (QColor*) [QtSupport objectForQtKey: kde_KHTMLSettings_vLinkColor((kde_KHTMLSettings *)[self qt]) withClass: [QColor class] allocatedInObjcWorld: YES];
}

- (BOOL) autoLoadImages
{
	return (BOOL) kde_KHTMLSettings_autoLoadImages((kde_KHTMLSettings *)[self qt]);
}

- (BOOL) isJavaEnabled: (NSString *)hostname
{
static qt_QString * _qstring_hostname = 0L;
	return (BOOL) kde_KHTMLSettings_isJavaEnabled((kde_KHTMLSettings *)[self qt], (qt_QString *) [hostname toQString: &_qstring_hostname]);
}

- (BOOL) isJavaEnabled
{
	return (BOOL) kde_KHTMLSettings_isJavaEnabled((kde_KHTMLSettings *)[self qt], qt_QString_null());
}

- (BOOL) isJavaScriptEnabled: (NSString *)hostname
{
static qt_QString * _qstring_hostname = 0L;
	return (BOOL) kde_KHTMLSettings_isJavaScriptEnabled((kde_KHTMLSettings *)[self qt], (qt_QString *) [hostname toQString: &_qstring_hostname]);
}

- (BOOL) isJavaScriptEnabled
{
	return (BOOL) kde_KHTMLSettings_isJavaScriptEnabled((kde_KHTMLSettings *)[self qt], qt_QString_null());
}

- (BOOL) isJavaScriptDebugEnabled: (NSString *)hostname
{
static qt_QString * _qstring_hostname = 0L;
	return (BOOL) kde_KHTMLSettings_isJavaScriptDebugEnabled((kde_KHTMLSettings *)[self qt], (qt_QString *) [hostname toQString: &_qstring_hostname]);
}

- (BOOL) isJavaScriptDebugEnabled
{
	return (BOOL) kde_KHTMLSettings_isJavaScriptDebugEnabled((kde_KHTMLSettings *)[self qt], qt_QString_null());
}

- (BOOL) isPluginsEnabled: (NSString *)hostname
{
static qt_QString * _qstring_hostname = 0L;
	return (BOOL) kde_KHTMLSettings_isPluginsEnabled((kde_KHTMLSettings *)[self qt], (qt_QString *) [hostname toQString: &_qstring_hostname]);
}

- (BOOL) isPluginsEnabled
{
	return (BOOL) kde_KHTMLSettings_isPluginsEnabled((kde_KHTMLSettings *)[self qt], qt_QString_null());
}

- (NSString *) settingsToCSS
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KHTMLSettings_settingsToCSS((kde_KHTMLSettings *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (NSString *) userStyleSheet
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KHTMLSettings_userStyleSheet((kde_KHTMLSettings *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (BOOL) isFormCompletionEnabled
{
	return (BOOL) kde_KHTMLSettings_isFormCompletionEnabled((kde_KHTMLSettings *)[self qt]);
}

- (int) maxFormCompletionItems
{
	return (int) kde_KHTMLSettings_maxFormCompletionItems((kde_KHTMLSettings *)[self qt]);
}

+ (int) strToAdvice: (NSString *)_str
{
static qt_QString * _qstring__str = 0L;
	return (int) kde_KHTMLSettings_strToAdvice((qt_QString *) [_str toQString: &_qstring__str]);
}

//+ splitDomainAdvice: (NSString *)configStr domain: (NSString *)domain javaAdvice: (KJavaScriptAdvice*)javaAdvice javaScriptAdvice: (KJavaScriptAdvice*)javaScriptAdvice
//{
//static qt_QString * _qstring_domain = 0L;
//static qt_QString * _qstring_configStr = 0L;
//	kde_KHTMLSettings_splitDomainAdvice((qt_QString *) [configStr toQString: &_qstring_configStr], (qt_QString *) [domain toQString: &_qstring_domain], (kde_KJavaScriptAdvice*) [javaAdvice qt], (kde_KJavaScriptAdvice*) [javaScriptAdvice qt]);
//	return self;
//}

+ (NSString *) adviceToStr: (int)_advice
{
	return (NSString *) [NSString stringWithCString: kde_KHTMLSettings_adviceToStr((int)_advice)];
}

+ (NSString *) availableFamilies
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KHTMLSettings_availableFamilies();
	return [NSString fromQString: _qstring];
}

+ (int) KJavaScriptDunno
{
	return (int) KHTMLSETTINGS_KJavaScriptDunno;
}

+ (int) KJavaScriptAccept
{
	return (int) KHTMLSETTINGS_KJavaScriptAccept;
}

+ (int) KJavaScriptReject
{
	return (int) KHTMLSETTINGS_KJavaScriptReject;
}

+ (int) KAnimationDisabled
{
	return (int) KHTMLSETTINGS_KAnimationDisabled;
}

+ (int) KAnimationLoopOnce
{
	return (int) KHTMLSETTINGS_KAnimationLoopOnce;
}

+ (int) KAnimationEnabled
{
	return (int) KHTMLSETTINGS_KAnimationEnabled;
}

@end
